Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting Does No Work On Sublime Build 3143 #121

Closed
justinlopez0 opened this issue Sep 14, 2017 · 12 comments
Closed

Highlighting Does No Work On Sublime Build 3143 #121

justinlopez0 opened this issue Sep 14, 2017 · 12 comments

Comments

@justinlopez0
Copy link

After updating Sublime, the plugin's highlighting feature no longer work.

@seppestas
Copy link

Can confirm it stopped working (causing me to commit trailing spaces -.-).

Sublime text version 3.0 Build 3143, macOS version 10.12.6.

@anbotero
Copy link

anbotero commented Oct 12, 2017

Confirmed.

I tried copy-pasting all the settings from Default configuration file into the user settings file, and the only line that changes with each plugin activation is the trailing_spaces_highlight_color. Like, you might have changed both trailing_spaces_highlight_color and trailing_spaces_include_empty_lines values in the user settings file, and if you activate the plugin (super+alt+x in my case), the user settings file will reload, and trailing_spaces_highlight_color is the only value that will be left empty, other values will be left untouched.

@tcaddy
Copy link

tcaddy commented Oct 13, 2017

Confirmed. on macOS, dev channel build 3148.

@Equim-chan
Copy link

Comfirmed, on Windows 10, build 3143.
I checked console, it said the setting file was not found. Can that be the reason?

Traceback (most recent call last):
  File "D:\xxxx\Sublime Text Build 3143 x64\sublime_plugin.py", line 389, in run_callback
    expr()
  File "D:\xxxx\Sublime Text Build 3143 x64\sublime_plugin.py", line 522, in <lambda>
    run_callback('on_activated', callback, lambda: callback.on_activated(v))
  File "trailing_spaces in D:\xxxx\Sublime Text Build 3143 x64\Data\Installed Packages\TrailingSpaces.sublime-package", line 419, in on_activated
  File "trailing_spaces in D:\xxxx\Sublime Text Build 3143 x64\Data\Installed Packages\TrailingSpaces.sublime-package", line 440, in freeze_last_version
  File "./python3.3/codecs.py", line 896, in open
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\xxxx\\Sublime Text Build 3143 x64\\Data\\Packages\\TrailingSpaces\\trailing_spaces.sublime-settings'

@pensnarik
Copy link

I have the same issue.trailing_spaces_highlight_color configuration parameter always reset to "" (empty string).

@pensnarik
Copy link

I found that plugin reads empty string as default value from settings in plugin_loaded() function. So you can fix this issue just adding these lines before DEFAULT_COLOR_SCOPE_NAME declaration:

    if current_highlighting_scope == '':
        current_highlighting_scope = "invalid"

I will try to find out the reason of this later. Maybe sublime.load_settings() method was changed in last Sublime build.

@becomesaflame
Copy link

Windows 10, build 3143.
Clicking on Edit > Trailing Spaces > Highlight Regions has no effect. A message appears in the bottom bar saying "Highlighting of Trailing Spaces is disabled!"
Clicking the menu selection again has the same effect.
Nothing shows up in the console other than "reloading settings Packages/User/trailing_spaces.sublime-settings" when I click it.

@ecspresso
Copy link

ecspresso commented May 3, 2018

See issue #116. This fixes the problem, at least temporarily. Version 3.0 Build 3143.

I had this problem all of a sudden, can't remember when it started, but I basically just had to enter a value and restart. See : https://stackoverflow.com/questions/16916060#answer-23051790

Sublime Text 3 Build 3143 default settings

From Stack Overflow

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

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

Replace:
"trailing_spaces_highlight_color": ""
With:
"trailing_spaces_highlight_color": "invalid"

Restart Sublime.

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.

@Pictor13
Copy link

@ecspresso is right. Just tried now (set value "invalid" and restart right after) and it works!

Although I have no time atm to see why that happens, fix the code and make a PR :(

@Nindaleth
Copy link

Based on #125, for more recent Sublime Text 3 builds the "region.redish" might be a more fitting value than "invalid" for some color schemes.

@Pictor13
Copy link

Pictor13 commented Feb 17, 2019

Update: to me the problem keeps reappearing regularly, even after fixing the settings.

The bug lays in persisting the setting in the code, assuming that the value is the one desired by the user, but looks like the settings are not loaded properly in some situations, so the plugin will find an empty string and re-persist that (why? 🤷‍♂️).

I think there should be a specific setting value that should be intended to disable trailing spaces.
Using an empty string in trailing_spaces_highlight_color, interpreted as "disable" setting, leads to this weird behaviour.
If not wanting to use a specific value then the logic in the code should be fixed.
And I would add a specific/less-shady-setting to explicitly disable trailing space.

Although I am not sure what else the plugin still does when the trailing-spaces visualization is not enabled.

@rchl
Copy link
Member

rchl commented Mar 23, 2020

Duplicate of #65

@rchl rchl marked this as a duplicate of #65 Mar 23, 2020
@rchl rchl closed this as completed Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests