8

VSCODE seems to be inserting spaces everywhere in my html code. I checked the settings and it's the following which is causing it: "editor.formatOnSave": true

Example:

enter image description here

How do I configure this to stop inserting spaces?

1
  • 1
    Hi Even I am having the same problem. Did you find a resolution for it. For me it is inserting space after and before angle brackets too. May 17, 2017 at 12:13

6 Answers 6

14

I have the following set :

"editor.formatOnSave": false,
"editor.insertSpaces": false

Now it is not inserting spaces. Hope it helps

12

Mine was caused by an extension JS/ CSS formatter, after i uninstalled and restart vscode works great. After spending hours wondering why my django static links are broken smh

2
  • 2
    Solved my issue!
    – Isaac I9
    Dec 27, 2021 at 20:15
  • Solved the issue for me as well. In my case was the "Prettier - Code formatter" extension. Jun 24, 2022 at 19:24
3

When saving, Visual Studio inserted a lot of spaces. This happened after an update of Visual Studio. This problem was because of an extension called Bracket Pair Colorizer. What I did was, uninstall and reinstall, and that solved the problem. I suggest to check all your extensions. It could be one of them.

0

I disabled the option of HTML formatting and no more space when saving files.

Settings > Extensions > HTML > Format: Enable

Enable/disable default HTML formatter.
0

What was the case with me is that I had the option Editor: Format on save mode to be set to file, this in combination with format on save would mean VS Code will try to format the entire file, resulting in spaces as defined in the formatter. Change this to be modifictions, and VS Code will only save the lines you have made changes in.

0

Now vscode has option
"editor.formatOnSaveMode": "modificationsIfAvailable"

It will not reformat whole file on save, modified content will be formatted (given source control is present)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.