Skip to content

Commit 46fe067

Browse files
authored
Ensure the updates with crashes reverts the change to scriptInfo (microsoft#58846)
1 parent dca9182 commit 46fe067

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/server/project.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -2245,8 +2245,12 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
22452245

22462246
this.getScriptInfo(rootFile)?.editContent(0, originalText.length, updatedText);
22472247
this.updateGraph();
2248-
cb(this.program!, originalProgram, (this.program?.getSourceFile(rootFile))!);
2249-
this.getScriptInfo(rootFile)?.editContent(0, this.program!.getSourceFile(rootFile)!.getText().length, originalText);
2248+
try {
2249+
cb(this.program!, originalProgram, (this.program?.getSourceFile(rootFile))!);
2250+
}
2251+
finally {
2252+
this.getScriptInfo(rootFile)?.editContent(0, this.program!.getSourceFile(rootFile)!.getText().length, originalText);
2253+
}
22502254
}
22512255

22522256
/** @internal */

0 commit comments

Comments
 (0)