This commit is contained in:
zhengbli 2016-06-10 03:44:44 -07:00
parent 6687f2c05e
commit 1e7790df06
2 changed files with 28 additions and 0 deletions

View file

@ -803,6 +803,7 @@ namespace ts.server {
else {
this.findReferencingProjects(info);
if (info.defaultProject) {
info.defaultProject.addOpenRef();
this.openFilesReferenced.push(info);
}
else {

View file

@ -567,5 +567,32 @@ namespace ts {
checkConfiguredProjectActualFiles(project, [file1.path, classicModuleFile.path]);
checkNumberOfInferredProjects(projectService, 1);
});
it("should keep the configured project when the opened file is referenced by the project but not its root", () => {
const file1: FileOrFolder = {
path: "/a/b/main.ts",
content: "import { objA } from './obj-a';"
};
const file2: FileOrFolder = {
path: "/a/b/obj-a.ts",
content: `export const objA = Object.assign({foo: "bar"}, {bar: "baz"});`
};
const configFile: FileOrFolder = {
path: "/a/b/tsconfig.json",
content: `{
"compilerOptions": {
"target": "es6"
},
"files": [ "main.ts" ]
}`
};
const host = new TestServerHost(/*useCaseSensitiveFileNames*/ false, getExecutingFilePathFromLibFile(libFile), "/", [file1, file2, configFile]);
const projectService = new server.ProjectService(host, nullLogger);
projectService.openClientFile(file1.path);
projectService.closeClientFile(file1.path);
projectService.openClientFile(file2.path);
checkNumberOfConfiguredProjects(projectService, 1);
checkNumberOfInferredProjects(projectService, 0);
});
});
}