diff --git a/src/server/project.ts b/src/server/project.ts index 080d3ee54cc..418532bdc45 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1549,6 +1549,11 @@ namespace ts.server { useSourceOfProjectReferenceRedirect = () => !!this.languageServiceEnabled && !this.getCompilerOptions().disableSourceOfProjectReferenceRedirect; + /** + * This implementation of fileExists checks if the file being requested is + * .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that file exists on host + */ fileExists(file: string): boolean { // Project references go to source file instead of .d.ts file if (this.useSourceOfProjectReferenceRedirect() && this.projectReferenceCallbacks) { @@ -1558,6 +1563,11 @@ namespace ts.server { return super.fileExists(file); } + /** + * This implementation of directoryExists checks if the directory being requested is + * directory of .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that directory exists on host + */ directoryExists(path: string): boolean { if (super.directoryExists(path)) return true; if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks) return false; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 1a3e9baf942..d97f62d0ba8 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -8576,7 +8576,17 @@ declare namespace ts.server { private projectErrors; private projectReferences; protected isInitialLoadPending: () => boolean; + /** + * This implementation of fileExists checks if the file being requested is + * .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that file exists on host + */ fileExists(file: string): boolean; + /** + * This implementation of directoryExists checks if the directory being requested is + * directory of .d.ts file for the referenced Project. + * If it is it returns true irrespective of whether that directory exists on host + */ directoryExists(path: string): boolean; /** * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph