Skip to content

Commit e3ffad0

Browse files
andrius-praKeen Yee Liau
authored andcommitted
fix: Retain the configured project even when closing last opened file from the project.
1 parent 38bcc46 commit e3ffad0

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ integration/out
77
dist/
88
**/.idea/
99
.DS_Store
10+
**/tsconfig.tsbuildinfo

server/src/editorServices.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ export class LSHost implements ts.LanguageServiceHost {
630630
}
631631

632632
getCurrentDirectory(): string {
633-
return "";
633+
return this.host.getCurrentDirectory();
634634
}
635635

636636
getScriptIsOpen(filename: string) {
@@ -1248,16 +1248,6 @@ export class ProjectService {
12481248
this.printProjects();
12491249
}
12501250

1251-
updateConfiguredProjectList() {
1252-
const configuredProjects: Project[] = [];
1253-
for (let i = 0, len = this.configuredProjects.length; i < len; i++) {
1254-
if (this.configuredProjects[i].openRefCount > 0) {
1255-
configuredProjects.push(this.configuredProjects[i]);
1256-
}
1257-
}
1258-
this.configuredProjects = configuredProjects;
1259-
}
1260-
12611251
removeProject(project: Project) {
12621252
this.log("remove project: " + project.getRootFiles().toString());
12631253
if (project.isConfiguredProject()) {
@@ -1336,7 +1326,6 @@ export class ProjectService {
13361326
this.openFileRoots.push(info);
13371327
}
13381328
}
1339-
this.updateConfiguredProjectList();
13401329
this.report("opened", info.fileName, info.defaultProject);
13411330
}
13421331

@@ -1379,7 +1368,7 @@ export class ProjectService {
13791368

13801369
this.openFileRootsConfigured = openFileRootsConfigured;
13811370
}
1382-
if (removedProject) {
1371+
if (removedProject && !removedProject.isConfiguredProject()) {
13831372
this.removeProject(removedProject);
13841373
const openFilesReferenced: ScriptInfo[] = [];
13851374
const orphanFiles: ScriptInfo[] = [];
@@ -1737,9 +1726,6 @@ export class ProjectService {
17371726
}
17381727
}
17391728
}
1740-
else {
1741-
this.updateConfiguredProject(project);
1742-
}
17431729
return { configFileName };
17441730
}
17451731
else {

0 commit comments

Comments
 (0)