I try to get an overview of a view’s settings.
But I only wants view’s specific settings. Not all inherit values.
Basic setup:
- We have no
rulerssettings inPreferences.sublime-settings- We have rulers at
[ 100 ]inPackages/User/Python.sublime-settings- The current view’s syntax is
PythonAt this point, if we check
view.settings().get("rulers")we get the value defined inPackages/User/Python.sublime-settingsas expected.
- For the view, we set
rulersat[ 120 ]. We specifically use menu/command to do it
The view has its own/specific settings.- Same operation, but with
[ 100 ], same as “default”.- Change the
Packages/User/Python.sublime-settingsfor"rulers": [ 80 ]At this point, we see/know that the view has still its rulers at
[ 100 ], not as “default”.
→ ofc : we do not usedview.settings().erase("rulers")Note: Users that expect a “reset” for this operation, could tell “What the
F…bug is this?” (^^)
Using view.settings().to_dict() also contains the “parent settings”
eg. from Packages/User/Python.sublime-settings
We can’t get the “source settings” of settings values. (ie. where is it from? Application, Syntax, Project settings?) — Is it a settings specific only to this view or not? 🤷
I could “compare all parents settings to view settings, and remove all keys that as the same values” and use this to get a “final view specific settings dict” but:
- I need to find all parents settings : which seems hard for some cases. Even if I could…
- as we saw above : a view’s specific settings could have the same value as a parent settings. Which will be “removed” to the “final view specific settings dict” (not intended).
So. Is there a workaround?
Or, should I request this as api feature? Will it be useful? or I just need to “deal with it”? x)