-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add Semantic Higlighter #7752
Add Semantic Higlighter #7752
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated testing result: WARNING
Repo link: Semantic Highlighter
Results help
Packages added:
- Semantic Highlighter
Processing package "Semantic Highlighter"
- WARNING: The binding ['ctrl+shift+l'] is also defined in default bindings but is masked with a 'context'
- File: Default (Windows).sublime-keymap
- WARNING: The binding ['ctrl+shift+e'] is also defined in default bindings but is masked with a 'context'
- File: Default (Windows).sublime-keymap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated testing result: SUCCESS
Repo link: Semantic Highlighter
Packages added:
- Semantic Highlighter
Processing package "Semantic Highlighter"
- All checks passed
Why do you only define key bindings for Windows? Setting change event handlers are registered for the entire settings objected and keyed by a string id for later removal, not for some setting name you provide. As such, you must also unregister setting change handlers in a What is the point of this context handler? |
@kapitanluffy ping |
Hey sorry I got swamped with work. Can you elaborate on this one? |
It's like adding a key to a dictionary of callbacks that you can remove later by specifying the same key. Adding the same callback twice with different keys will result in the callback being called twice for every change. |
Hi @FichteFoll I updated the package. Can we reopen this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated testing result: SUCCESS
Repo link: Semantic Highlighter
Packages added:
- Semantic Highlighter
Processing package "Semantic Highlighter"
- All checks passed
This is still handled incorrectly, although it doesn't break with how it is currently. I suggest to just read the corresponding settings from the settings object directly when you want to use them instead of using a settings listener.
|
I rewrote the whole thing. The context handler is for the keybindings. Let me know if there's a better way of doing that :) Also, for the settings listener issue, do you mean that on So with that in mind, I should do: preferences = sublime.load_settings('Preferences.sublime-settings')
preferences.add_on_change('my_plugin_key', my_callback_for_changes) |
Tried reading the settings directly instead of registering a callback but I realized that it would read the settings file with every cursor move (which I think is very inefficient). I think I understood what you are saying now regarding the listeners though. |
Yes.
The current implementation is still the same and a no-op. It will always match when the corresponing "key" is provided, in which case you might as well omit it entirely.
Hm, that may indeed be a valid reason to have a cache in form of a native Python dict. You could time/benchmark it to be sure, but I understand the reasoning. |
I removed the keybinding contexts for now. I fully understand what contexts are for now after reading about it on the docs. I also removed a mousemap file that I forgot included in the repo. |
Plugin for semantic highlighting to variables