mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
Minor cleanups in pathCompletions.ts (#19685)
* Minor cleanups in pathCompletions.ts * Update name
This commit is contained in:
@@ -7,18 +7,10 @@ namespace ts {
|
||||
const ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/;
|
||||
|
||||
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName = "tsconfig.json"): string {
|
||||
while (true) {
|
||||
const fileName = combinePaths(searchPath, configName);
|
||||
if (fileExists(fileName)) {
|
||||
return fileName;
|
||||
}
|
||||
const parentPath = getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
return undefined;
|
||||
return forEachAncestorDirectory(searchPath, ancestor => {
|
||||
const fileName = combinePaths(ancestor, configName);
|
||||
return fileExists(fileName) ? fileName : undefined;
|
||||
});
|
||||
}
|
||||
|
||||
export function resolveTripleslashReference(moduleName: string, containingFile: string): string {
|
||||
|
||||
Reference in New Issue
Block a user