mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-14 07:02:44 -05:00
Fixing range for primary edit (#59369)
This commit is contained in:
@@ -2319,7 +2319,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
|
||||
runWithTemporaryFileUpdate(rootFile: string, updatedText: string, cb: (updatedProgram: Program, originalProgram: Program | undefined, updatedFile: SourceFile) => void) {
|
||||
const originalProgram = this.program;
|
||||
const rootSourceFile = Debug.checkDefined(this.program?.getSourceFile(rootFile), "Expected file to be part of program");
|
||||
const originalText = Debug.checkDefined(rootSourceFile.getText());
|
||||
const originalText = Debug.checkDefined(rootSourceFile.getFullText());
|
||||
|
||||
this.getScriptInfo(rootFile)?.editContent(0, originalText.length, updatedText);
|
||||
this.updateGraph();
|
||||
@@ -2327,7 +2327,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
|
||||
cb(this.program!, originalProgram, (this.program?.getSourceFile(rootFile))!);
|
||||
}
|
||||
finally {
|
||||
this.getScriptInfo(rootFile)?.editContent(0, this.program!.getSourceFile(rootFile)!.getText().length, originalText);
|
||||
this.getScriptInfo(rootFile)?.editContent(0, updatedText.length, originalText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user