Home Download Buy Blog Forum Support

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

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

Postby yrammos on Thu Apr 18, 2013 4:11 pm

In code for a plugin, I load my settings as follows:
Code: Select all
settings = sublime.load_settings("myplugin.sublime-settings")


and then attempt to retrieve the value for key "logfile" as follows:
Code: Select all
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.
yrammos
 
Posts: 28
Joined: Fri Jun 22, 2012 3:26 am

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

Postby subhaze on Fri Apr 19, 2013 4:34 am

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 http://www.sublimetext.com/docs/3/api_reference.html
subhaze
 
Posts: 224
Joined: Tue Apr 09, 2013 3:22 am

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

Postby yrammos on Fri Apr 19, 2013 6:18 am

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().

subhaze wrote: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 http://www.sublimetext.com/docs/3/api_reference.html
yrammos
 
Posts: 28
Joined: Fri Jun 22, 2012 3:26 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests