mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-24 04:30:53 -06:00
If there are no open files, do not schedule ensureProjectForOpenFiles (#41537)
This commit is contained in:
parent
9bbbe5c0c7
commit
2cc67ec0a6
@ -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) {
|
||||
|
||||
@ -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 });
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ namespace ts.projectSystem {
|
||||
unresolvedImports: response.unresolvedImports,
|
||||
});
|
||||
|
||||
host.checkTimeoutQueueLengthAndRun(2);
|
||||
host.checkTimeoutQueueLengthAndRun(1);
|
||||
assert.isUndefined(request);
|
||||
});
|
||||
|
||||
|
||||
@ -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]);
|
||||
});
|
||||
@ -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'
|
||||
@ -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]);
|
||||
});
|
||||
@ -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]);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user