- Open VS Code.
- Click on File.
- Then find Preferences -> settings.
- Click on the Text Editor in the left side menu.
- Then Click on Files.
- Locate the Trim Trailing Whitespace Setting.
- Check or Uncheck: When enabled, will trim trailing whitespace when saving a file.