Rename getPackageNameFromAtTypesDirectoryWithoutPrefix to getUnmangledNameForScopedPackage
This commit is contained in:
parent
211be0ae69
commit
9a4fe8eb7e
|
@ -1097,16 +1097,16 @@ namespace ts {
|
||||||
export function getPackageNameFromAtTypesDirectory(mangledName: string): string {
|
export function getPackageNameFromAtTypesDirectory(mangledName: string): string {
|
||||||
const withoutAtTypePrefix = removePrefix(mangledName, "@types/");
|
const withoutAtTypePrefix = removePrefix(mangledName, "@types/");
|
||||||
if (withoutAtTypePrefix !== mangledName) {
|
if (withoutAtTypePrefix !== mangledName) {
|
||||||
return getPackageNameFromAtTypesDirectoryWithoutPrefix(withoutAtTypePrefix);
|
return getUnmangledNameForScopedPackage(withoutAtTypePrefix);
|
||||||
}
|
}
|
||||||
return mangledName;
|
return mangledName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @internal */
|
/* @internal */
|
||||||
export function getPackageNameFromAtTypesDirectoryWithoutPrefix(withoutAtTypePrefix: string): string {
|
export function getUnmangledNameForScopedPackage(typesPackageName: string): string {
|
||||||
return stringContains(withoutAtTypePrefix, mangledScopedPackageSeparator) ?
|
return stringContains(typesPackageName, mangledScopedPackageSeparator) ?
|
||||||
"@" + withoutAtTypePrefix.replace(mangledScopedPackageSeparator, ts.directorySeparator) :
|
"@" + typesPackageName.replace(mangledScopedPackageSeparator, ts.directorySeparator) :
|
||||||
withoutAtTypePrefix;
|
typesPackageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryFindNonRelativeModuleNameInCache(cache: PerModuleNameCache | undefined, moduleName: string, containingDirectory: string, traceEnabled: boolean, host: ModuleResolutionHost): SearchResult<Resolved> {
|
function tryFindNonRelativeModuleNameInCache(cache: PerModuleNameCache | undefined, moduleName: string, containingDirectory: string, traceEnabled: boolean, host: ModuleResolutionHost): SearchResult<Resolved> {
|
||||||
|
|
|
@ -315,7 +315,7 @@ namespace ts.Completions.PathCompletions {
|
||||||
const seen = createMap<true>();
|
const seen = createMap<true>();
|
||||||
if (options.types) {
|
if (options.types) {
|
||||||
for (const typesName of options.types) {
|
for (const typesName of options.types) {
|
||||||
const moduleName = getPackageNameFromAtTypesDirectoryWithoutPrefix(typesName);
|
const moduleName = getUnmangledNameForScopedPackage(typesName);
|
||||||
pushResult(moduleName);
|
pushResult(moduleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ namespace ts.Completions.PathCompletions {
|
||||||
for (let typeDirectory of directories) {
|
for (let typeDirectory of directories) {
|
||||||
typeDirectory = normalizePath(typeDirectory);
|
typeDirectory = normalizePath(typeDirectory);
|
||||||
const directoryName = getBaseFileName(typeDirectory);
|
const directoryName = getBaseFileName(typeDirectory);
|
||||||
const moduleName = getPackageNameFromAtTypesDirectoryWithoutPrefix(directoryName);
|
const moduleName = getUnmangledNameForScopedPackage(directoryName);
|
||||||
pushResult(moduleName);
|
pushResult(moduleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue