I am using Microsoft's VS Code to edit css, html and ts files that are shared by my team on a VSTS Git repo. However, my VS Code keeps removing empty/whitespaces that my colleagues added when I save any change (Image below) and this screws up the whole Git Diff part, as almost every single line of code shows as a diff. I tried to disable every single config setup but nothings works:



At the end, what was causing my problem was the extension: EditorConfig for VS Code
This plugin attempts to override user/workspace settings with settings found in .editorconfig files. No additional or vscode-specific files are required. As with any EditorConfig plugin, if root=true is not specified, EditorConfig will continue to look for an .editorconfig file outside of the project.
I believe, it was overriding the options I selected inside of VS Code (such as files.trimTrailingWhitespace: false). So, no setup change I was making was actually being applied.
It seems you have trailing whitespace enabled in User Preferences too.
I'd suggest opening your configuration file of VSCode using CtrlShiftP or CmdShiftP in Mac and then go to Open User Settings.
I'm sure the next line is around there somewhere, delete it or change it to false.
"files.trimTrailingWhitespace": true
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