diff --git a/CHANGELOG.md b/CHANGELOG.md index 23dde12502..2440da01b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Upgrade `@prettier/plugin-pug` to fix formatter issues. #2347. - Fix files with CRLF having errors with wrong range. #1319. - 🙌 Fix collapse code missing end mark. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2303 and #2352. +- 🙌 Respect include exclude files options in tsconfig for ts js external files. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2339 and #2371. - 🙌 Fix undefined valueDeclaration in props crashing vls. Thanks to contribution from [@javiertury](https://github.com/javiertury). #2367. - 🙌 Reduce recreate ts program when no need for ts perf. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2192 and #2328. - 🙌 Display VTI errors. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2324 and #2330. diff --git a/server/src/services/typescriptService/serviceHost.ts b/server/src/services/typescriptService/serviceHost.ts index 4066dad4ab..92101f60da 100644 --- a/server/src/services/typescriptService/serviceHost.ts +++ b/server/src/services/typescriptService/serviceHost.ts @@ -198,6 +198,19 @@ export function getServiceHost( // External Documents: JS/TS, non Vue documents function updateExternalDocument(fileFsPath: string) { + // respect tsconfig + // use *internal* function + const configFileSpecs = (parsedConfig as any).configFileSpecs; + const isExcludedFile = (tsModule as any).isExcludedFile; + if ( + isExcludedFile && + configFileSpecs && + isExcludedFile(fileFsPath, configFileSpecs, workspacePath, true, workspacePath) + ) { + return; + } + logger.logInfo(`update ${fileFsPath} in ts language service.`); + const ver = versions.get(fileFsPath) || 0; versions.set(fileFsPath, ver + 1); projectVersion++; diff --git a/test/lsp/features/completion/script.test.ts b/test/lsp/features/completion/script.test.ts index b1540b7074..133896c0ff 100644 --- a/test/lsp/features/completion/script.test.ts +++ b/test/lsp/features/completion/script.test.ts @@ -30,7 +30,7 @@ describe.only('Should autocomplete for