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

Toggling Trailing Spaces Highlighting resets color to null #160

Open
RichardLitt opened this issue Jan 9, 2024 · 8 comments
Open

Toggling Trailing Spaces Highlighting resets color to null #160

RichardLitt opened this issue Jan 9, 2024 · 8 comments
Labels

Comments

@RichardLitt
Copy link

I can't display trailing spaces in a Markdown file. Here are my prefs:

{
	"keys": ["ctrl+shift+."],
	"command": "delete_trailing_spaces",
 	"scope_ignore": ["text.find-in-files", "source.build_output", "source.diff"],
	"highlight_color": "",
}

Whenever I reset the Toggle Trailing Spaces Highlighting option, highlight_color gets set back to "", no matter what I put in there before - region.reddish, error, invalid.illegal, a hex, or yellow. I can't figure out why this is happening, but I can't see highlighted final spaces on markdown at all.

Thank you for your work.

@rchl
Copy link
Member

rchl commented Jan 9, 2024

Default value of ignore_scope option ignores markdown since trailing spaces have special meaning in markdown. You can change that if you want: https://github.com/SublimeText/TrailingSpaces#ignore-scope

@rchl rchl added the question label Jan 9, 2024
@RichardLitt
Copy link
Author

I have changed that, by overriding it above in my settings. I'm not sure that's related to the highlight_color being reset.

@rchl
Copy link
Member

rchl commented Jan 10, 2024

The Trailing Spaces: Toggle Trailing Spaces Highlighting command toggles highlighting by changing the value of this setting back and forth.

Though looking at it now, it seems that the command will not be able to unset the empty value if ST is restarted after disabling highlighting.

I think the current toggle approach is not quite well done.

But if you manually remove highlight_color from your preferences then it should work (restart ST for good measure).

@rchl
Copy link
Member

rchl commented Jan 10, 2024

Note that the keys and command keys you can remove since those don't belong in preferences. Those are keybinding keys.

@RichardLitt
Copy link
Author

Thanks, @rchl

I added keys and command because they were suggested in the readme, and I just wanted the preferences to work.

I manually removed highlight_color, and restarted. It doesn't show anything. Toggling only puts it back, also with an empty "" value. I still don't see it on my Markdown file. I'm not sure what I am doing wrong.

@RichardLitt
Copy link
Author

Ok. It worked for a second. Using Toggle will put highlight_color back in the preferences object, and give it an empty value. After that, you can't remove it again - it'll just keep being there. This means that the only way to use the plugin, for me, is to delete that field, save it, restart, and never press Toggle again, as it disables the plugin permanently unless I manually edit it again and restart. That seems poorly done, to me.

@RichardLitt
Copy link
Author

I can't figure out how to buy you a coffee - there's no sponsor button on your GitHub, and this plugin isn't on Open Collective. In any event, takk or dzięki.

@rchl
Copy link
Member

rchl commented Jan 10, 2024

I added keys and command because they were suggested in the readme, and I just wanted the preferences to work.

Yeah but it says to add it in a different file.

I agree the toggle behavior is a bug but it should work as long as you don't restart ST. If you restart ST with it set to "" then it won't be possible to return back to the correct value.

In any event, takk or dzięki.

good research

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants