For instance, if I create a settings object to access later, I find that sometimes it won't exist when the plugin gets loaded:
- Code: Select all
def plugin_loaded():
global sh_settings
sh_settings = sublime.load_settings('scope_hunter.sublime-settings')
And then when the plugin tries to access it later:
- Code: Select all
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 205, in on_selection_modified
callback.on_selection_modified(v)
File "C:\Users\muse_i\AppData\Roaming\Sublime Text 3\Packages\ScopeHunter\scope_hunter.py", line 178, in on_selection_modified
self.clear_regions(view)
File "C:\Users\muse_i\AppData\Roaming\Sublime Text 3\Packages\ScopeHunter\scope_hunter.py", line 171, in clear_regions
if self.enabled and bool(sh_settings.get("highlight_extent", False)) and len(view.get_regions("scope_hunter")):
NameError: global name 'sh_settings' is not defined
I have at least confirmed this on Windows so far.