VS On Save Formatting is Adding Multiple Tabs

Viewed 126

Since yesterday whenever I save a file, on certain lines it is adding multiple tabs. I have always had Format On Save option on and am using Prettier extension. All the settings for Prettier are the default ones and I have Prettier set as the default formatter.

["INFO" - 11:19:53 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 11:19:53 PM] Extension Version: 5.9.2.
["INFO" - 11:19:53 PM] Loaded module 'prettier@2.0.4' from 

The "if" before I saved was where my current tab is at, after I save the file it jumps all these tabs and considers them changes The "if" before I saved was where my current tab is

2 Answers

I'd recommend updating Prettier to a newer version. Looks like you're facing this bug fixed in v2.1.

If that doesn't help (it should though), consider not using range formatting and always reformat the whole file. For that, choose the "file" value instead of "modifications" for the "Format On Save Mode" setting:

enter image description here

Thanks to @thorǹˆ (^^above for the answer). Switching the Format on Save Mode to file which is the default (Not sure how or when I changed that) was what fixed the problem.

It was a huge help as this is for my job and when pushing to master our team is strict on not adding indentions that are unneccesary and keeping changes to a minimum. It was driving me nuts.

Related