Skip to content

Commit 1cdcb5f

Browse files
committed
If there are no open files, do not schedule ensureProjectForOpenFiles
1 parent 566faa7 commit 1cdcb5f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/server/editorServices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ namespace ts.server {
930930

931931
/*@internal*/
932932
delayEnsureProjectForOpenFiles() {
933+
if (!this.openFiles.size) return;
933934
this.pendingEnsureProjectForOpenFiles = true;
934935
this.throttledOperations.schedule(ensureProjectForOpenFileSchedule, /*delay*/ 2500, () => {
935936
if (this.pendingProjectUpdates.size !== 0) {

src/testRunner/unittests/tsserver/inferredProjects.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,5 +450,15 @@ namespace ts.projectSystem {
450450
};
451451
assert.deepEqual(inferredProject.getTypeAcquisition(), expected, "typeAcquisition should be inferred for inferred projects");
452452
});
453+
454+
it("Setting compiler options for inferred projects when there are no open files should not schedule any refresh", () => {
455+
const host = createServerHost([commonFile1, libFile]);
456+
const projectService = createProjectService(host);
457+
projectService.setCompilerOptionsForInferredProjects({
458+
allowJs: true,
459+
target: ScriptTarget.ES2015
460+
});
461+
host.checkTimeoutQueueLength(0);
462+
});
453463
});
454464
}

0 commit comments

Comments
 (0)