Reputation: 2043
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)
After saving: (what I don't want)
Has anyone had this issue? If so, how did you resolve it? Thanks.
Upvotes: 8
Views: 15887
Reputation: 85
disable "JS-CSS-HTML Formatter" extension. It may fix the problem
Upvotes: 6
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.
I also added extension: Formatting Toggle.
The extension shows up on the right side of the status bar in editor
Upvotes: 9