Steven Choi
Steven Choi

Reputation: 739

VSCode: How do I KEEP blank lines (in scss files or others)?

VSCode deletes empty lines by default in certain cases, but what if I want to preserve/keep blank/empty lines in a document? For example, in my .scss file, I want to keep the blank lines that I made in between nested styles within a parent between properties and children, but "Format Document" keeps removing them. How can I tell VSCode to not remove any blank lines that I make? It seems to keep them for other file types.

Upvotes: 4

Views: 2523

Answers (2)

Vladislav
Vladislav

Reputation: 1

Had the same problem in scss file and solved it by disabling 'prettier' extension, so it stopped to remove blank lines.

Upvotes: 0

klewis
klewis

Reputation: 8379

For example, in my .scss file, I want to keep the blank lines that I made in between nested styles

You can tryout the extension Beautify

  • Download it through VSCode's Extensions Manager.
  • Once installed, from the top menu select Go -> Go to File...
  • In the command line type, >b
  • You should then see an command for Beautify File
  • Click it. It should format your opened .SCSS file and preserve the blank spaces between each CSS rule set (if they were there already).

Upvotes: 2

Related Questions