Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ namespace ts.server {

/*@internal*/
delayEnsureProjectForOpenFiles() {
if (!this.openFiles.size) return;
this.pendingEnsureProjectForOpenFiles = true;
this.throttledOperations.schedule(ensureProjectForOpenFileSchedule, /*delay*/ 2500, () => {
if (this.pendingProjectUpdates.size !== 0) {
Expand Down
1 change: 0 additions & 1 deletion src/testRunner/unittests/tsserver/externalProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ namespace ts.projectSystem {
[configFile.path]);

host.deleteFile(configFile.path);
host.checkTimeoutQueueLengthAndRun(1);

knownProjects = projectService.synchronizeProjectList(map(knownProjects, proj => proj.info!)); // TODO: GH#18217 GH#20039
checkNumberOfProjects(projectService, { configuredProjects: 0, externalProjects: 0, inferredProjects: 0 });
Expand Down
10 changes: 10 additions & 0 deletions src/testRunner/unittests/tsserver/inferredProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,5 +450,15 @@ namespace ts.projectSystem {
};
assert.deepEqual(inferredProject.getTypeAcquisition(), expected, "typeAcquisition should be inferred for inferred projects");
});

it("Setting compiler options for inferred projects when there are no open files should not schedule any refresh", () => {
const host = createServerHost([commonFile1, libFile]);
const projectService = createProjectService(host);
projectService.setCompilerOptionsForInferredProjects({
allowJs: true,
target: ScriptTarget.ES2015
});
host.checkTimeoutQueueLength(0);
});
});
}
2 changes: 1 addition & 1 deletion src/testRunner/unittests/tsserver/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ namespace ts.projectSystem {
unresolvedImports: response.unresolvedImports,
});

host.checkTimeoutQueueLengthAndRun(2);
host.checkTimeoutQueueLengthAndRun(1);
assert.isUndefined(request);
});

Expand Down
8 changes: 4 additions & 4 deletions src/testRunner/unittests/tsserver/typingsInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ namespace ts.projectSystem {
installer.installAll(/*expectedCount*/ 1);

checkNumberOfProjects(projectService, { externalProjects: 1 });
host.checkTimeoutQueueLengthAndRun(2);
host.checkTimeoutQueueLengthAndRun(1);
checkNumberOfProjects(projectService, { externalProjects: 1 });
checkProjectActualFiles(p, [file2Jsx.path, file3dts.path, lodashDts.path, reactDts.path]);
});
Expand Down Expand Up @@ -642,7 +642,7 @@ namespace ts.projectSystem {
installer.installAll(/*expectedCount*/ 1);

checkNumberOfProjects(projectService, { externalProjects: 1 });
host.checkTimeoutQueueLengthAndRun(2);
host.checkTimeoutQueueLengthAndRun(1);
checkNumberOfProjects(projectService, { externalProjects: 1 });
// Commander: Existed as a JS file
// JQuery: Specified in 'include'
Expand Down Expand Up @@ -726,7 +726,7 @@ namespace ts.projectSystem {
for (const f of typingFiles) {
assert.isTrue(host.fileExists(f.path), `expected file ${f.path} to exist`);
}
host.checkTimeoutQueueLengthAndRun(2);
host.checkTimeoutQueueLengthAndRun(1);
checkNumberOfProjects(projectService, { externalProjects: 1 });
checkProjectActualFiles(p, [file3.path, commander.path, express.path, jquery.path, moment.path, lodash.path]);
});
Expand Down Expand Up @@ -829,7 +829,7 @@ namespace ts.projectSystem {
assert.equal(installer.pendingRunRequests.length, 0, "expected no throttled requests");

installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(3); // for 2 projects and 1 refreshing inferred project
host.checkTimeoutQueueLengthAndRun(2); // for 2 projects
checkProjectActualFiles(p1, [file3.path, commander.path, jquery.path, lodash.path, cordova.path]);
checkProjectActualFiles(p2, [file3.path, grunt.path, gulp.path]);
});
Expand Down