Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upfiles.trimTrailingWhitespace does not trim trailing whitespace on save #299
Comments
But I agree with you, it's strange because vscode description says that it execute this format on save: Perhaps we should have the two formatting settings:
@fbricon @xorye @datho7561 what do you think about that? |
|
I think it makes sense to be consistent with other language servers/language support. I've checked TypeScript and Java files, and trailing white space is always removed by the formatter. Both these services also remove the trailing whitespace when |
|
Thanks for the feedback. I agree with @datho7561 in that consistency with other languages will prevent user confusion. The main thing that caught me was that the setting (as shown in the screenshot @angelozerr highlighted) did not have an effect when saving files but VSCode indicated that it should. I do not have an opinion on whether or not there is a separate setting to strip trailing whitespace only while formatting (since in my use case it will be stripped when I save anyway) but I am used to formatting stripping trailing spaces as part of the formatting process in the languages/file types I use. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.


The setting
files.trimTrailingWhitespacedoes not seem to trim trailing whitespace when a file is saved. Is this a deliberate decision?I do not want to format the entire document when saving (using e.g.
editor.formatOnSave) as this will affect other file types as well (and I occasionally use custom formatting for clarity).Extension Details
Name: XML
Id: redhat.vscode-xml
Version: 0.13.0
VSCode Details
Version: 1.47.3 (user setup)
Commit: 91899dcef7b8110878ea59626991a18c8a6a1b3e
Date: 2020-07-23T13:12:49.994Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363