-
Notifications
You must be signed in to change notification settings - Fork 4
Add SettingsListener. #166
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
base: master
Are you sure you want to change the base?
Conversation
|
I've run into a bit of trouble with I have solved the problem with a moderately ugly hack. After spending several hours debugging this, I'm confident that this was the problem and that the solution works — though I wouldn't call it pretty. (There's no such problem with |
|
@FichteFoll Any thoughts on the above hack? |
st3/sublime_lib/settings_listener.py
Outdated
| If `selector` is callable, then the derived value is ``selector(self)``. | ||
| If `selector` is a :class:`str`, | ||
| then the derived value is ``self.get(selector, None)``. | ||
| Otherwise, the derived value is ``projection(self, selector)``. |
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.
With the "selector" concept being reused now, it might be sensible to add a section to our docs with more details and examples.
|
Regarding the |
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.
Nice, I think that was everything.
Edit: Oh, I forgot about the documentation thing. I'd still like to see that.
|
I wrote up some docs for the projection function. I'm not completely satisfied with it, but it might be good enough. |
For #164.
Notes:
OnChangedOptionsis a named tuple so that we can easily support more arguments toon_setting_changed.asyncargument toon_setting_changed. Alternatively/additionally, we could have a separateon_setting_changed_asyncdecorator.SETTINGS_NAME = 'Foo', we could just havesettings = sublime.load_settings('Foo.sublime-settings'). I think the former might be slightly less prone to user error.on_setting_changeddecorator outside aBaseSettingsListener. Haven't looked into implementation yet.ViewSettingsListenerorGlobalSettingsListenerfrom their plugin, Sublime will dutifully use them. This probably doesn't really matter, but we could special-case this if we want.str(id(self))? I suspect not.WindowSettingsListener? I also suspect not.selectoronly supports strings and functions, but we could just use_util.collections.get_selector.