Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2 highlighting always disabled on trailing spaces plugin

In Sublime Text 2 I have installed the trailing spaces plugin, however the highlighting is always set to disabled.

if I toggle the highlight regions, by doing the following:

edit -> trailing spaces -> highlight regions

I always get the following:

highlighting of trailing spaces is disabled!

I have restarted sublime since the package install, but the toggle doesn't seem to work, does anyone know how to fix this issue?

Work around fix - not the solution to the problem

As for others it seems, i couldn't seem to get this trailing spaces to highlight no matter what i did, so what i did was remove the trailing spaces automatically on save. Not ideal but used to it now, works nicely.

Go to SublimeText 2 > Preferences > User Settings (or just hit the Mac Standard cmd + ,). This should open your User Settings as a JSON file. Add the following to your file

"trim_trailing_white_space_on_save": true

That's it. You're good to go.

like image 526
gardni Avatar asked Jun 04 '13 10:06

gardni


2 Answers

It's a known bug - see their Issues page on GitHub.

I was able to get it working by starting Sublime with a non-blank string value for the setting trailing_spaces_highlight_color

  1. Open Preferences > Package Settings > Trailing Spaces > Settings - User

  2. Replace:
    "trailing_spaces_highlight_color": ""
    With:
    "trailing_spaces_highlight_color": "invalid"

  3. Restart Sublime.

  4. Edit > Trailing Spaces > Highlight Regions should work as expected now.

If you restart Sublime, "trailing_spaces_highlight_color" must not be a blank string, otherwise it will stop working again. Repeat the steps above to fix.

As long as Sublime is started with a non-blank string value for trailing_spaces_highlight_color, the toggle highlight regions works.

It looks like the plugin is caching the value in the setting file when Sublime loads. If you make changes to the settings file and toggle highlighting, the original value is restored. Which is why you need to restart Sublime for setting changes to take effect.

like image 194
Mike Causer Avatar answered Oct 16 '22 02:10

Mike Causer


I had this problem in Sublime Text 3.

I fixed it by deleting my trailing_spaces.sublime-settings file in the Sublime Text user package settings folder (which for me was %APPDATA%\Sublime Text 3\Packages\User) and reinstalling the plugin.

Some more discussion about this issue can be found on the plugin GitHub page here.

like image 39
Lewis Avatar answered Oct 16 '22 02:10

Lewis