Sublime Forum

Is sublime.Settings.get() broken in ST3 build 3028?

#1

In code for a plugin, I load my settings as follows:

settings = sublime.load_settings("myplugin.sublime-settings")

and then attempt to retrieve the value for key “logfile” as follows:

self.logfilename = settings.get("logfile")

which in ST2 works as expected but in ST3 always returns None.

Am I missing something or do we have a bug?

Thank you.

0 Likes

#2

In Sublime Text 3 things are loaded async, so you’ll need to utilize the plugin_loaded() callback before you try accessing, most of, the sublime text API.

Checkout the ‘Plugin Lifecycle’ here sublimetext.com/docs/3/api_reference.html

0 Likes

#3

Thanks for this. Before receiving your reply I replicated this behavior within run() as a workaround—having a code block executed only on first run, which works on ST2 and ST3 without any version checking—but in a future commit may revise my code to use plugin_loaded().

[quote=“subhaze”]In Sublime Text 3 things are loaded async, so you’ll need to utilize the plugin_loaded() callback before you try accessing, most of, the sublime text API.

Checkout the ‘Plugin Lifecycle’ here sublimetext.com/docs/3/api_reference.html[/quote]

0 Likes