Skip to content

Commit

Permalink
property handle missing config files in external projects (#12094)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladima authored Nov 7, 2016
1 parent 0173a3f commit be2e8e8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/harness/unittests/tsserverProjectSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2249,6 +2249,27 @@ namespace ts.projectSystem {
assert.equal(diags.length, 0);
});

it("should property handle missing config files", () => {
const f1 = {
path: "/a/b/app.ts",
content: "let x = 1"
};
const config = {
path: "/a/b/tsconfig.json",
content: "{}"
};
const projectName = "project1";
const host = createServerHost([f1]);
const projectService = createProjectService(host);
projectService.openExternalProject({ rootFiles: toExternalFiles([f1.path, config.path]), options: {}, projectFileName: projectName });

// should have one external project since config file is missing
projectService.checkNumberOfProjects({ externalProjects: 1 });

host.reloadFS([f1, config]);
projectService.openExternalProject({ rootFiles: toExternalFiles([f1.path, config.path]), options: {}, projectFileName: projectName });
projectService.checkNumberOfProjects({ configuredProjects: 1 });
});
});

describe("add the missing module file for inferred project", () => {
Expand Down
4 changes: 3 additions & 1 deletion src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,9 @@ namespace ts.server {
for (const file of proj.rootFiles) {
const normalized = toNormalizedPath(file.fileName);
if (getBaseFileName(normalized) === "tsconfig.json") {
(tsConfigFiles || (tsConfigFiles = [])).push(normalized);
if (this.host.fileExists(normalized)) {
(tsConfigFiles || (tsConfigFiles = [])).push(normalized);
}
}
else {
rootFiles.push(file);
Expand Down

0 comments on commit be2e8e8

Please sign in to comment.