Skip to content

Commit a35f799

Browse files
committed
Do cleanup after opening files only if opening a file.
1 parent c8d937e commit a35f799

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/server/editorServices.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -2705,15 +2705,14 @@ namespace ts.server {
27052705
// It was then postponed to cleanup these script infos so that they can be reused if
27062706
// the file from that old project is reopened because of opening file from here.
27072707
this.removeOrphanScriptInfos();
2708-
2709-
this.printProjects();
27102708
}
27112709

27122710
openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult {
27132711
const info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
27142712
const { defaultConfigProject, ...result } = this.assignProjectToOpenedScriptInfo(info);
27152713
this.cleanupAfterOpeningFile(defaultConfigProject);
27162714
this.telemetryOnOpenFile(info);
2715+
this.printProjects();
27172716
return result;
27182717
}
27192718

@@ -2914,12 +2913,16 @@ namespace ts.server {
29142913
this.assignOrphanScriptInfosToInferredProject();
29152914
}
29162915

2917-
// Cleanup projects
2918-
this.cleanupAfterOpeningFile(defaultConfigProjects);
2919-
2920-
// Telemetry
2921-
forEach(openScriptInfos, info => this.telemetryOnOpenFile(info));
2922-
this.printProjects();
2916+
if (openScriptInfos) {
2917+
// Cleanup projects
2918+
this.cleanupAfterOpeningFile(defaultConfigProjects);
2919+
// Telemetry
2920+
openScriptInfos.forEach(info => this.telemetryOnOpenFile(info));
2921+
this.printProjects();
2922+
}
2923+
else if (length(closedFiles)) {
2924+
this.printProjects();
2925+
}
29232926
}
29242927

29252928
/* @internal */

0 commit comments

Comments
 (0)