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.
The TRIM function is fully automatic. It removes removes both leading and trailing spaces from text, and also "normalizes" multiple spaces between words to one space character only.
You can enable whitespace trimming at file save time from settings:
"files.trimTrailingWhitespace": true
setting to the User Settings document if it's not already there. This is so you aren't editing the Default Setting directly, but instead adding to it.We also added a new command to trigger this manually (Trim Trailing Whitespace from the command palette).
Menu Code → Preference → Settings →
Check the "Trim Trailing Whitespace" option - "When enabled, will trim trailing whitespace when saving a file".
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