mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Increase the idle time before which ensureProject for open file is called (#37121)
* Increase timeout for ensuring projects for open files * Condense the project/file printing in the log (given now we have project printed anytime its structure changes)
This commit is contained in:
@@ -773,7 +773,7 @@ namespace ts.server {
|
||||
|
||||
private delayEnsureProjectForOpenFiles() {
|
||||
this.pendingEnsureProjectForOpenFiles = true;
|
||||
this.throttledOperations.schedule("*ensureProjectForOpenFiles*", /*delay*/ 250, () => {
|
||||
this.throttledOperations.schedule("*ensureProjectForOpenFiles*", /*delay*/ 2500, () => {
|
||||
if (this.pendingProjectUpdates.size !== 0) {
|
||||
this.delayEnsureProjectForOpenFiles();
|
||||
}
|
||||
@@ -1210,7 +1210,7 @@ namespace ts.server {
|
||||
|
||||
private removeProject(project: Project) {
|
||||
this.logger.info("`remove Project::");
|
||||
project.print();
|
||||
project.print(/*writeProjectFileNames*/ true);
|
||||
|
||||
project.close();
|
||||
if (Debug.shouldAssert(AssertionLevel.Normal)) {
|
||||
@@ -1719,19 +1719,17 @@ namespace ts.server {
|
||||
return;
|
||||
}
|
||||
|
||||
const writeProjectFileNames = this.logger.hasLevel(LogLevel.verbose);
|
||||
this.logger.startGroup();
|
||||
let counter = printProjectsWithCounter(this.externalProjects, 0);
|
||||
counter = printProjectsWithCounter(arrayFrom(this.configuredProjects.values()), counter);
|
||||
printProjectsWithCounter(this.inferredProjects, counter);
|
||||
|
||||
this.externalProjects.forEach(printProjectWithoutFileNames);
|
||||
this.configuredProjects.forEach(printProjectWithoutFileNames);
|
||||
this.inferredProjects.forEach(printProjectWithoutFileNames);
|
||||
|
||||
this.logger.info("Open files: ");
|
||||
this.openFiles.forEach((projectRootPath, path) => {
|
||||
const info = this.getScriptInfoForPath(path as Path)!;
|
||||
this.logger.info(`\tFileName: ${info.fileName} ProjectRootPath: ${projectRootPath}`);
|
||||
if (writeProjectFileNames) {
|
||||
this.logger.info(`\t\tProjects: ${info.containingProjects.map(p => p.getProjectName())}`);
|
||||
}
|
||||
this.logger.info(`\t\tProjects: ${info.containingProjects.map(p => p.getProjectName())}`);
|
||||
});
|
||||
|
||||
this.logger.endGroup();
|
||||
@@ -2766,7 +2764,7 @@ namespace ts.server {
|
||||
* After that all the inferred project graphs are updated
|
||||
*/
|
||||
private ensureProjectForOpenFiles() {
|
||||
this.logger.info("Structure before ensureProjectForOpenFiles:");
|
||||
this.logger.info("Before ensureProjectForOpenFiles:");
|
||||
this.printProjects();
|
||||
|
||||
this.openFiles.forEach((projectRootPath, path) => {
|
||||
@@ -2783,7 +2781,7 @@ namespace ts.server {
|
||||
this.pendingEnsureProjectForOpenFiles = false;
|
||||
this.inferredProjects.forEach(updateProjectIfDirty);
|
||||
|
||||
this.logger.info("Structure after ensureProjectForOpenFiles:");
|
||||
this.logger.info("After ensureProjectForOpenFiles:");
|
||||
this.printProjects();
|
||||
}
|
||||
|
||||
@@ -3553,11 +3551,7 @@ namespace ts.server {
|
||||
return (config as TsConfigSourceFile).kind !== undefined;
|
||||
}
|
||||
|
||||
function printProjectsWithCounter(projects: Project[], counter: number) {
|
||||
for (const project of projects) {
|
||||
project.print(counter);
|
||||
counter++;
|
||||
}
|
||||
return counter;
|
||||
function printProjectWithoutFileNames(project: Project) {
|
||||
project.print(/*writeProjectFileNames*/ false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,7 +1105,7 @@ namespace ts.server {
|
||||
this.projectService.sendUpdateGraphPerformanceEvent(elapsed);
|
||||
this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram} Elapsed: ${elapsed}ms`);
|
||||
if (this.hasAddedorRemovedFiles) {
|
||||
this.print();
|
||||
this.print(/*writeProjectFileNames*/ true);
|
||||
}
|
||||
else if (this.program !== oldProgram) {
|
||||
this.writeLog(`Different program with same set of files:: oldProgram.structureIsReused:: ${oldProgram && oldProgram.structureIsReused}`);
|
||||
@@ -1285,9 +1285,9 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
print(counter?: number) {
|
||||
this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]}) ${counter === undefined ? "" : counter}`);
|
||||
this.writeLog(this.filesToString(this.projectService.logger.hasLevel(LogLevel.verbose)));
|
||||
print(writeProjectFileNames: boolean) {
|
||||
this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
|
||||
this.writeLog(this.filesToString(writeProjectFileNames && this.projectService.logger.hasLevel(LogLevel.verbose)));
|
||||
this.writeLog("-----------------------------------------------");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user