Home Download Buy Blog Forum Support

ST3 API changes and Will Bond's plugin tutorial

ST3 API changes and Will Bond's plugin tutorial

Postby gregor.hoch on Sun Feb 03, 2013 7:56 pm

Hi,

I still don't get some details about the ST3 API changes. Here are a couple of concrete questions (one refers to Will Bond's ST2 plugin tutorial):

1) The plugin API is now thread-safe. Does that mean that I can call API functions from a thread? In ST2, I always had to do the API calls from the main plugin thread and not from the threaded code (e.g. call to `sublime.status_message`).
2) What are the new asynchronous API events? `on_modified_async` is the example in the beta ST3 beta blog post and I guess behaves like `on_modified` but in a separate thread. Is there a list anywhere because I can't find them in the API documentation at http://www.sublimetext.com/docs/3/api_r ... ntListener
3) What does "Projects are exposed to the API" mean?
4) Will Bond's ST2 plugin tutorial is great (link below) particularly because it is a little more advanced and covers threading. Can anyone comment on how ST3 affects the the stuff covered in the tutorial? http://net.tutsplus.com/tutorials/pytho ... -2-plugin/

ST3 API changes (from blog post)
API: Upgrade from Python 2.6 to Python 3.3
API: Plugins run out-of-process
API: Plugin API is now thread-safe
API: Some API events are now run asynchronously
API: begin_edit() / end_edit() are no longer accessible
API: Projects are exposed to the API
API: Added window.settings() and window.template_settings()
API: show_quick_panel() accepts an on_highlighted callback
gregor.hoch
 
Posts: 144
Joined: Sat Oct 01, 2011 7:54 pm

Re: ST3 API changes and Will Bond's plugin tutorial

Postby gregor.hoch on Sun Feb 03, 2013 8:04 pm

2) A list of the asynchronous API events is here: http://www.sublimetext.com/docs/3/porting_guide.html
gregor.hoch
 
Posts: 144
Joined: Sat Oct 01, 2011 7:54 pm

Re: ST3 API changes and Will Bond's plugin tutorial

Postby icylace on Sun Feb 03, 2013 8:48 pm

Another API change I've come across is that sublime.Region's method xpos() from ST2 is now the property xpos in ST3. It remains undocumented though it has been talked about before: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=8334
icylace
 
Posts: 48
Joined: Mon Jan 14, 2013 7:24 am

Re: ST3 API changes and Will Bond's plugin tutorial

Postby jps on Mon Feb 04, 2013 1:27 am

1. You can call API functions from any thread now. Be aware though, if you are calling a function from an alternate thread, that the user can be typing etc as your function is running, so the buffer will be changing underneath you.

3. There are new functions window.project_data() and window.set_project_data()
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests