🤖 Pick PR #58846 (Ensure the updates with crashes rev...) into release-5.5 (#58847)

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
This commit is contained in:
TypeScript Bot
2024-06-14 10:05:15 -07:00
committed by GitHub
co-authored by Sheetal Nandi
parent a20c69e8df
commit 2b0009c679
+6 -2
View File
@@ -2245,8 +2245,12 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
this.getScriptInfo(rootFile)?.editContent(0, originalText.length, updatedText);
this.updateGraph();
cb(this.program!, originalProgram, (this.program?.getSourceFile(rootFile))!);
this.getScriptInfo(rootFile)?.editContent(0, this.program!.getSourceFile(rootFile)!.getText().length, originalText);
try {
cb(this.program!, originalProgram, (this.program?.getSourceFile(rootFile))!);
}
finally {
this.getScriptInfo(rootFile)?.editContent(0, this.program!.getSourceFile(rootFile)!.getText().length, originalText);
}
}
/** @internal */