I did some searching and didn’t find anything that seemed relevant here in the forum. I am experimenting with retrieving settings in a command and finding that the hierarchy seems inconsistent.
So, according to the docs, the hierarchy should be (for Preferences)
• Packages/Default/Preferences.sublime-settings
• Packages/Default/Preferences (Windows).sublime-settings
• Packages/AnyOtherPackage/Preferences.sublime-settings
• Packages/AnyOtherPackage/Preferences (Windows).sublime-settings
• Packages/User/Preferences.sublime-settings
• Settings from the current project
(and then some from language specific)
So, I figure I’ll experiment with obtaining the tab size. It’s set to 4 in default Preferences.sublime-settings
. I then have an activated project file with
"settings":
{
"tab_size": 9
},
I can tell that Sublime is paying attention to this because my tab stops immediately go to 9 characters when I save the file.
However in code I have the following:
class vhdlModeSettingSniffer(sublime_plugin.TextCommand):
def run(self, edit)
pref_settings = sublime.load_settings('Preferences.sublime-settings')
print('vhdl-mode: Tab size: {}'.format(pref_settings.get("tab_size")))
When I do this, it prints out that the tab size is 4.
In another instance when I’m using my own vhdl_mode.sublime-settings
file, I can correctly override the default setting (provided in the package) with my own settings and load_settings
picks this up correctly.
So, are the settings from the current project actually factored into the hierarchy using load_settings
? Like I said, I can tell the editor pays attention, I just don’t know if the API call is that automated. I may have to manually extract project settings and apply an override there if I want to pick up that behavior.