Sublime Forum

[solved]Trim trailing whitespace setting seems to be ignored

#1

I am in the unfortunate position of working on a code-base which already contains bits of (erroneous) trailing white space. To avoid spurious changes in my patches I need to have trim_trailing_white_space_on_save turned off. However, the setting seems to be ignored, which leaves me with a bunch of whitespace changes that I have to exclude from commits.

My Default/Preferences.sublime-settings contains:

    "trim_trailing_white_space_on_save": false,

My User/Preferences.sublime-settings does not mention this setting.
My project specific file contains:

"settings": { "trim_trailing_white_space_on_save": false, "ensure_newline_at_eof_on_save": true }

Can anyone suggest what I’m missing? Is there some other setting that has a similar effect? Or perhaps a package that may be interfering? Or is this just a bug?

0 Likes

#2

Found it. Turns out I’d created a syntax specific configuration for C++ that turned whitespace trimming on.

0 Likes

#3

You can use diff -db to prevent whitespace from showing in the diff. Not sure if that is allowed where you work though.

0 Likes

#4

Thanks. The diff display is not the problem though, the problem is the commit: If the commit contains spurious lines then it increases the chance of causing a merge conflict later on.

Over time we will (I hope) gradually eliminate these whitespace problems, but it’ll probably require a bit of coordination to do it without irritating people.

0 Likes