Is there a way to remove trailing spaces in Visual Studio Code (automatically or with a shortcut)?
I've been looking for this in the command palette and in the editor settings, but I cannot find what I am looking for.
This question is related to
visual-studio-code
vscode-settings
<Ctr>-<Shift>-<F>
Format, does it as well.
This removes trailing whitespace and formats/indents your code.
In recent Visual Studio Code versions you can find settings here:
Menu File → Preference → Settings → Text Editor → Files → (scroll down a bit) Trim Trailing Whitespace
This is for trimming whitespace when saving a file.
Or you can search "Trim Trailing Whitespace" in the top search bar.
Have a look at the EditorConfig plugin.
By using the plugin you can have settings specific for various projects. Visual Studio Code also has IntelliSense built-in for .editorconfig files.
Source: Stackoverflow.com