Structure is reused should be on new program instead of old program (#41005)

This commit is contained in:
Sheetal Nandi
2020-10-09 15:56:51 -07:00
committed by GitHub
parent 876e44bbc6
commit e6d525c5cb
220 changed files with 645 additions and 67 deletions

View File

@@ -1086,7 +1086,7 @@ namespace ts.server {
// bump up the version if
// - oldProgram is not set - this is a first time updateGraph is called
// - newProgram is different from the old program and structure of the old program was not reused.
const hasNewProgram = this.program && (!oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused! & StructureIsReused.Completely)));
const hasNewProgram = this.program && (!oldProgram || (this.program !== oldProgram && !(this.program.structureIsReused & StructureIsReused.Completely)));
if (hasNewProgram) {
if (oldProgram) {
for (const f of oldProgram.getSourceFiles()) {
@@ -1153,7 +1153,7 @@ namespace ts.server {
}
if (!this.importSuggestionsCache.isEmpty()) {
if (this.hasAddedorRemovedFiles || oldProgram && !oldProgram.structureIsReused) {
if (this.hasAddedorRemovedFiles || oldProgram && !this.program.structureIsReused) {
this.importSuggestionsCache.clear();
}
else if (this.dirtyFilesForSuggestions && oldProgram && this.program) {
@@ -1194,7 +1194,7 @@ namespace ts.server {
this.print(/*writeProjectFileNames*/ true);
}
else if (this.program !== oldProgram) {
this.writeLog(`Different program with same set of files:: oldProgram.structureIsReused:: ${oldProgram && oldProgram.structureIsReused}`);
this.writeLog(`Different program with same set of files:: structureIsReused:: ${this.program.structureIsReused}`);
}
return hasNewProgram;
}