Skip to content

Commit 78236bf

Browse files
alxhubzarend
authored andcommitted
fix(language-service): use script versions for incremental compilations (#41475)
This commit has the Language Service take advantage of versioned source files added in the compiler previously. With this change, the Language Service's incremental compilations will now be correct even if the TS Language service mutates `ts.SourceFile`s without changing their object identity, as we know it does in certain corner cases. No test is added here as it is difficult to reproduce this behavior in the LS's artificial testing environment. A test for this case exists in the LS extension repo, where it will be used to validate that a workaround three is no longer necessary. PR Close #41475
1 parent dee9599 commit 78236bf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/language-service/ivy/language_service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ function createProgramDriver(project: ts.server.Project): ProgramDriver {
487487
scriptInfo.editContent(0, length, newText);
488488
}
489489
},
490+
getSourceFileVersion(sf: ts.SourceFile): string {
491+
return project.getScriptVersion(sf.fileName);
492+
}
490493
};
491494
}
492495

0 commit comments

Comments
 (0)