mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-15 14:05:47 -05:00
Fix conversion of TextChanges to FileCodeEdits for new file (#24126)
This commit is contained in:
@@ -719,7 +719,7 @@ namespace ts.textChanges {
|
||||
|
||||
export function newFileChanges(oldFile: SourceFile, fileName: string, statements: ReadonlyArray<Statement>, newLineCharacter: string): FileTextChanges {
|
||||
const text = statements.map(s => getNonformattedText(s, oldFile, newLineCharacter).text).join(newLineCharacter);
|
||||
return { fileName, textChanges: [createTextChange(createTextSpan(0, 0), text)] };
|
||||
return { fileName, textChanges: [createTextChange(createTextSpan(0, 0), text)], isNewFile: true };
|
||||
}
|
||||
|
||||
function computeNewText(change: Change, sourceFile: SourceFile, newLineCharacter: string, formatContext: formatting.FormatContext, validate: ValidateNonFormattedText): string {
|
||||
|
||||
@@ -439,6 +439,7 @@ namespace ts {
|
||||
export interface FileTextChanges {
|
||||
fileName: string;
|
||||
textChanges: TextChange[];
|
||||
isNewFile?: boolean;
|
||||
}
|
||||
|
||||
export interface CodeAction {
|
||||
|
||||
Reference in New Issue
Block a user