Remove the check that if base file name starts with ^ is dynamic file name since those files can exist (#36109)

Fixes #35734
This commit is contained in:
Sheetal Nandi 2020-01-10 10:57:44 -08:00 committed by GitHub
parent 13cddae3f7
commit 00b21efcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 1 deletions

View File

@ -272,7 +272,7 @@ namespace ts.server {
/*@internal*/
export function isDynamicFileName(fileName: NormalizedPath) {
return fileName[0] === "^" || getBaseFileName(fileName)[0] === "^";
return fileName[0] === "^";
}
/*@internal*/

View File

@ -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", () => {

View File

@ -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",