Skip to content

Commit

Permalink
fix: redo directoryExists()
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jun 28, 2023
1 parent c28b1b3 commit b1344bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/typescript/src/languageServiceHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function createLanguageServiceHost(
},
readDirectory,
getDirectories,
directoryExists: undefined, // ignore for better performance
directoryExists,
fileExists,
getProjectVersion: () => {
return tsProjectVersion + ':' + sys.version;
Expand Down Expand Up @@ -258,6 +258,11 @@ export function createLanguageServiceHost(
return sys.getModifiedTime?.(fileName)?.valueOf().toString() ?? '';
}

function directoryExists(dirName: string): boolean {
return sys.directoryExists(dirName)
|| tsFileNames.some(fileName => fileName.toLowerCase().startsWith(dirName.toLowerCase()));
}

function fileExists(fileName: string) {

// virtual files
Expand Down

0 comments on commit b1344bf

Please sign in to comment.