Fix #8523
This commit is contained in:
parent
6687f2c05e
commit
1e7790df06
|
@ -803,6 +803,7 @@ namespace ts.server {
|
|||
else {
|
||||
this.findReferencingProjects(info);
|
||||
if (info.defaultProject) {
|
||||
info.defaultProject.addOpenRef();
|
||||
this.openFilesReferenced.push(info);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue