Fix conversion of TextChanges to FileCodeEdits for new file (#24126)

This commit is contained in:
Andy
2018-05-15 13:55:26 -07:00
committed by GitHub
parent 86dce41ec0
commit cbbe34b35e
6 changed files with 25 additions and 8 deletions
+1 -1
View File
@@ -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 {