Reputation: 40561
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:
How do I configure this to stop inserting spaces?
Upvotes: 10
Views: 35833
Reputation: 148
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)
Upvotes: 1
Reputation: 847
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.
Upvotes: 0
Reputation: 586
I disabled the option of HTML formatting and no more space when saving files.
Settings > Extensions > HTML > Format: Enable
Enable/disable default HTML formatter.
Upvotes: 1
Reputation: 460
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
Upvotes: 14
Reputation: 31
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.
Upvotes: 3
Reputation: 1309
I have the following set :
"editor.formatOnSave": false,
"editor.insertSpaces": false
Now it is not inserting spaces. Hope it helps
Upvotes: 15