I've written a VS Code extension that uses TypeScrpt AST API for organizing class members. My issue is that after running ts.transform(...) and than convert transformed syntax tree back to text all empty lines are missing making the resulting source code incorrectly formatted. How do I prevent AST API from removing blank lines?
Sample of the code I'm using:
let sourceFile: ts.SourceFile;
let sourceCode: string;
sourceCode = editor.document.getText();
sourceFile = ts.createSourceFile(editor.document.fileName, sourceCode, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
transformation = ts.transform(sourceFile, [organizeTransformer]);
sourceCode = transformation.transformed[0].getFullText();