From 2b0009c6790d66bbc943fc3975eb8bc9e8dec83f Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Fri, 14 Jun 2024 10:05:15 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#58846=20(Ensure=20t?= =?UTF-8?q?he=20updates=20with=20crashes=20rev...)=20into=20release-5.5=20?= =?UTF-8?q?(#58847)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sheetal Nandi --- src/server/project.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/project.ts b/src/server/project.ts index d4c519614be56..a851b346813a0 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -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 */