diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 53bbc6cba75..02d3bff1a0f 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -272,7 +272,7 @@ namespace ts.server { /*@internal*/ export function isDynamicFileName(fileName: NormalizedPath) { - return fileName[0] === "^" || getBaseFileName(fileName)[0] === "^"; + return fileName[0] === "^"; } /*@internal*/ diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index ae859be2b3d..7bc09a955c4 100644 --- a/src/testRunner/unittests/tsserver/configuredProjects.ts +++ b/src/testRunner/unittests/tsserver/configuredProjects.ts @@ -905,6 +905,24 @@ declare var console: { ] }); }); + + it("when file name starts with ^", () => { + const file: File = { + path: `${tscWatch.projectRoot}/file.ts`, + content: "const x = 10;" + }; + const app: File = { + path: `${tscWatch.projectRoot}/^app.ts`, + content: "const y = 10;" + }; + const tsconfig: File = { + path: `${tscWatch.projectRoot}/tsconfig.json`, + content: "{}" + }; + const host = createServerHost([file, app, tsconfig, libFile]); + const service = createProjectService(host); + service.openClientFile(file.path); + }); }); describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories listed in config file input array", () => { diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index b2f9753024d..172d264242b 100644 --- a/src/testRunner/unittests/tsserver/externalProjects.ts +++ b/src/testRunner/unittests/tsserver/externalProjects.ts @@ -226,6 +226,27 @@ namespace ts.projectSystem { projectService.applyChangesInOpenFiles(arrayIterator(externalFiles)); }); + it("when file name starts with ^", () => { + const file: File = { + path: `${tscWatch.projectRoot}/file.ts`, + content: "const x = 10;" + }; + const app: File = { + path: `${tscWatch.projectRoot}/^app.ts`, + content: "const y = 10;" + }; + const host = createServerHost([file, app, libFile]); + const service = createProjectService(host); + service.openExternalProjects([{ + projectFileName: `${tscWatch.projectRoot}/myproject.njsproj`, + rootFiles: [ + toExternalFile(file.path), + toExternalFile(app.path) + ], + options: { }, + }]); + }); + it("external project that included config files", () => { const file1 = { path: "/a/b/f1.ts",