6

I've been using VS Code for about three months now.

I have this issue where I update one single line of code in a .js file (also happens with some .css files) and my diff tool tells me that there are 100s of changes.

Apparently the files.trimTrailingWhitespace: false is not doing anything at all as it continues to trim whitespace on the file(s) on save.

These are all the settings I have been overridden on my user config:

"editor.trimAutoWhitespace": false,
"files.trimTrailingWhitespace": false,
"editor.formatOnSave": false

Nothing seems to be taking.

Also, I don't have any extensions that format my code (as far as I know).

Running VS Code for Mac v1.16.1 (latest? as of today)

Update

So, it looks like any other app (Sublime, Brackets, Atom) or even a git repo tool (like Gitlab) modifies either whitespaces or line-breaks on this file...

I even thought that maybe it was a platform-related issue (gitlab's modifications to the file, kinda hinted that it wasn't platform-related) but opening the file in Sublime on Windows did the same thing... whitespaces or line-breaks get reformatted on save. I still don't know what exactly is going on on save.

starball
  • 20,030
  • 7
  • 43
  • 238
Mau S
  • 69
  • 6
  • 4
    Do you have the editorconfig extension installed? Is there a workspace setting overriding your user setting? – Rob Lourens Sep 18 '17 at 20:27
  • Why wouldn't you want it to trim trailing whitespace? What specific application would you want that for? – ifconfig Sep 18 '17 at 22:48
  • @RobLourens no workspace config. Only user config. I don’t think I have that extension. I will check tomorrow for it. Thanks for the insight. – Mau S Sep 20 '17 at 00:30
  • @ifconfig it’s a '.js' file. But I see that happening a lot when opening other files too. I don’t want it because it triggers massive lists of changes on my commits to git. One line change is triggering a git commit of 1500+ changes. I understand and agree with you that the trimming is often a good thing, but I don’t like it when my code editor changes things I didn’t ask it to do so. Also, that’s why there’s a setting, which is being ignored. – Mau S Sep 20 '17 at 00:33
  • Fixing all of the trailing whitespace issues is never a bad option. Fix it once, and then enforce the code style in the future. – ifconfig Sep 20 '17 at 01:07
  • @ifconfig I understand the benefits, but it’s not the point here. The application is not doing what I am asking it to do. I don’t want it modifying stuff. – Mau S Sep 20 '17 at 02:50
  • 1
    @RobLourens, I just checked and I do not have the editorconfig extension installed at all. – Mau S Sep 20 '17 at 19:34
  • @ifconfig useful to have it turned off for pug else your inline anchors run together with the previous word. – David Nov 29 '18 at 03:19
  • Can you still reproduce this issue? Did you have a `.vscode/settings.json` file in your workspace folder? (settings in such a file can override the user settings) – starball Feb 15 '23 at 01:28

0 Answers0