A Developer asked on Stackoverflow platform : –
Is there a way to remove trailing spaces in Visual Studio Code (automatically or with a shortcut)?
The solution to this problem is simple:
Go to File → Preference → Settings → search for “trim”:
Check the “Trim Trailing Whitespace” option – “When enabled, will trim trailing whitespace when saving a file”.
Not only can you change the Visual Studio Code settings to trim trailing whitespace automatically, but you can also do this from the command palette (
You can also use the keyboard shortcut:
⌘ + k,
⌘ + x.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?