I am facing an irritating problem that no new line is being saved for HTML and JavaScript despite explicitly setting that they should be done. Can someone please guide me what I am doing wrong?
GitHub Project
Visual Studio Code version details:
Version 1.23.0
Commit 7c7da59c2333a1306c41e6e7b68d7f0caa7b3d45
Date 2018-05-03T15:23:19.356Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
VS Code Settings:
Highlight the row and press ENTER. Press Shift + Space.
That's because of a default setting in 🆚CODE
// When enabled, insert a final new line at the end of the file when saving it.
"files.insertFinalNewline": false,
Turn that to true and you'll be able to persist a new line. I'd also recommend that your turn on the trimmer for more than one new lines at the end.
STEP #2: Add the following two settings.
"files.insertFinalNewline": true, "files.trimFinalNewlines": true,
⚡ Here's a GIF Demo — Save a file to add a line or trim extra lines
The problem was not in the settings but in the extensions. As pointed out in a comment in the question by VictorS., running the editor in code --disable-extensions
I validated that without extensions it does work. Then I started uninstalling extensions until it works and finally zero'd down to this plugin and uninstalling it made things work as I was expecting.
It's the wrong setting.
The correct setting is
"files.insertFinalNewline": false,
setting this to true
will enable a new line to be added when saving the file.
There is an even more explicit setting "html.format.endWithNewline": false,
but I've never used that so I am unsure how it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With