Home Download Buy Blog Forum Support

Advanced auto completion

Advanced auto completion

Postby thewavelength on Fri Mar 15, 2013 9:57 am

Hello,

is it possible to create a self implemented advanced auto completion plugin in ST2 or 3?
The main "problem" in here is that I need to know whether there's a way to display a popup with suggestions (and maybe advanced information).

Thanks for your help!

Edit: it seems that sublime.Window.show_quick_panel is what I'm looking for. Is there a way to close a previously opened panel?
Edit2: it seems not to be what I'm looking for. show_quick_panels opens in the center-top of the current window...
thewavelength
 
Posts: 3
Joined: Fri Mar 15, 2013 9:55 am

Re: Advanced auto completion

Postby skuroda on Fri Mar 15, 2013 8:40 pm

I think what you want is on_query_completions(). It's not in the docs, which is odd, but there is an example of its usage here. With this, you can customize the auto complete list. The parameters are straight forward. View is the view. Prefix is the text preceding the cursor. Locations is a list of cursor locations. The return value is a list of tuples, where the tuples are (display text, insert text). In addition I believe you can return something like (completions, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS), where completions is the previously described list of tuples. This will, I believe, prevent sublime text from inserting it's own auto complete text, which may be desirable.
Last edited by skuroda on Sun Mar 17, 2013 8:38 pm, edited 1 time in total.
skuroda
 
Posts: 683
Joined: Fri Oct 05, 2012 8:11 am

Re: Advanced auto completion

Postby thewavelength on Sun Mar 17, 2013 2:03 pm

Thanks, that's exactly what I searched for :-)
thewavelength
 
Posts: 3
Joined: Fri Mar 15, 2013 9:55 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 5 guests