Skip to content

Commit 00b21ef

Browse files
authored
Remove the check that if base file name starts with ^ is dynamic file name since those files can exist (#36109)
Fixes #35734
1 parent 13cddae commit 00b21ef

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

src/server/scriptInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ namespace ts.server {
272272

273273
/*@internal*/
274274
export function isDynamicFileName(fileName: NormalizedPath) {
275-
return fileName[0] === "^" || getBaseFileName(fileName)[0] === "^";
275+
return fileName[0] === "^";
276276
}
277277

278278
/*@internal*/

src/testRunner/unittests/tsserver/configuredProjects.ts

+18
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,24 @@ declare var console: {
905905
]
906906
});
907907
});
908+
909+
it("when file name starts with ^", () => {
910+
const file: File = {
911+
path: `${tscWatch.projectRoot}/file.ts`,
912+
content: "const x = 10;"
913+
};
914+
const app: File = {
915+
path: `${tscWatch.projectRoot}/^app.ts`,
916+
content: "const y = 10;"
917+
};
918+
const tsconfig: File = {
919+
path: `${tscWatch.projectRoot}/tsconfig.json`,
920+
content: "{}"
921+
};
922+
const host = createServerHost([file, app, tsconfig, libFile]);
923+
const service = createProjectService(host);
924+
service.openClientFile(file.path);
925+
});
908926
});
909927

910928
describe("unittests:: tsserver:: ConfiguredProjects:: non-existing directories listed in config file input array", () => {

src/testRunner/unittests/tsserver/externalProjects.ts

+21
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,27 @@ namespace ts.projectSystem {
226226
projectService.applyChangesInOpenFiles(arrayIterator(externalFiles));
227227
});
228228

229+
it("when file name starts with ^", () => {
230+
const file: File = {
231+
path: `${tscWatch.projectRoot}/file.ts`,
232+
content: "const x = 10;"
233+
};
234+
const app: File = {
235+
path: `${tscWatch.projectRoot}/^app.ts`,
236+
content: "const y = 10;"
237+
};
238+
const host = createServerHost([file, app, libFile]);
239+
const service = createProjectService(host);
240+
service.openExternalProjects([{
241+
projectFileName: `${tscWatch.projectRoot}/myproject.njsproj`,
242+
rootFiles: [
243+
toExternalFile(file.path),
244+
toExternalFile(app.path)
245+
],
246+
options: { },
247+
}]);
248+
});
249+
229250
it("external project that included config files", () => {
230251
const file1 = {
231252
path: "/a/b/f1.ts",

0 commit comments

Comments
 (0)