Chris22
Chris22

Reputation: 2043

VS Code: Line break being removed on save

We have an app written in angularJS and I want to align the directives vertically for easier reading. However, when I insert a line break in a tag and save the file, the line break is removed and the directives remain on the same line. I've disabled all extensions and it still doesn't work on save. Why is VS Code ignoring the line break?

Before saving: (what I want)

enter image description here

After saving: (what I don't want)

enter image description here

Has anyone had this issue? If so, how did you resolve it? Thanks.

Upvotes: 8

Views: 15887

Answers (2)

Fatemeh Talebi
Fatemeh Talebi

Reputation: 85

disable "JS-CSS-HTML Formatter" extension. It may fix the problem

Upvotes: 6

Chris22
Chris22

Reputation: 2043

After more research, I came across this post VSCode automatically adding new lines on save via a google search of "line break in visual studio code is removed on save". Even though the issue I was having was that I DID want a new line, and this question was just the opposite, I looked at the answer anyway since everything else I was finding was about "VSCode removing or adding new lines at the end of file" (for example) -- which isn't what I wanted. Unchecking the Format On Save setting as shown worked for what I wanted to do.

enter image description here

I also added extension: Formatting Toggle.

enter image description here

The extension shows up on the right side of the status bar in editor

enter image description here

Upvotes: 9

Related Questions