question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SourceFile.formatText() seems to remove all blank lines

See original GitHub issue

If I add some blank lines using this.sourceFile.addStatements(writer => writer.newLine()); (no matter if at the end of the file or somewhere in the middle), and then call SourceFile.formatText(), all the blank lines get removed.

It feels like it should leave the blank lines.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dsherretcommented, Dec 8, 2017

Fixed in v2.0.0.

1reaction
dsherretcommented, Dec 6, 2017

@Maximaximum btw, it’s the languageService.getFormattingEditsForDocument that does the job (so it is part of the compiler)

Read more comments on GitHub >

github_iconTop Results From Across the Web

createPrinter.printFile() should not remove empty lines #20506
printFile() to format the file, but not remove the empty lines inside ... formatText() seems to remove all blank lines dsherret/ts-morph#157.
Read more >
Visual Studio Code - Remove blank lines from code
Click "Use Regular Expressions". In Find specify ^$\n . leave Replace as blank; Click "Replace All" All Blank lines will be deleted.
Read more >
How Can I Remove All the Blank Lines from a Text File?
We then use this line of code – and the Trim function – to remove any blank spaces from the beginning and/or the...
Read more >
How to remove empty lines in Visual Studio Code
Open your code in Visual Studio Code · From Edit Menu, select Replace or use a short cut key (command + Option +...
Read more >
How to remove the blank line in informatica
Hi Experts, In my source,there is one blank line at the end of the file. ... the Source File Type from File to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found