SublimeText / TrailingSpaces

Highlight trailing spaces and delete them in a flash.
MIT License
897 stars 94 forks source link

Broken? trailing_spaces_include_current_line: false not being respected. #109

Closed alexburner closed 4 years ago

alexburner commented 7 years ago

I love this package, I've been silently using it for the last year. However I recently reverted my Sublime installation while chasing down some buggy behavior and am now setting everything back up fresh. While doing so, I hit an issue with TrailingSpaces.

I've updated my User/Preferences.sublime-settings with:

"trailing_spaces_include_current_line": false,

However I'm still seeing trailing spaces highlighted on my current line (even after closing & opening file, restarting sublime, etc).

I also see trailing spaces highlighted in places like Find & Replace and the Command Palette.

What am I doing wrong?

I'm using Sublime Text 3 Build 3114 on Linux

Phvli commented 7 years ago

I had the same issue and did some digging.

Trailing Spaces uses Packages/TrailingSpaces/trailing_spaces.sublime-settings, which is where you'll have to put your preferences instead of user settings. That, however, is not all. Turns out several settings are loaded without specifying a fallback default value, which means that some of them will make the plugin fail to load if they're not specified.

Workaround for this issue:

  1. Copy trailing_spaces.sublime-settings from this repo, put it under your package directory and edit only the lines you want changed, while keeping the rest intact.

Proposed fix:

  1. Load settings from user configuration file instead.
  2. Specify a default value for each Settings.get() call (returns a NoneType when no default is specified, causing TypeErrors and making the plugin fail to load).
alexburner commented 7 years ago

@Phvli that workaround fixed it for me, thank you!

rchl commented 4 years ago

Happy the workaround helped and maybe will help someone else also but such workaround should absolutely not be needed. You can override only specific settings, should be no need to specify all of them.