Sublime Forum

Advanced auto completion

#1

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…

0 Likes

#2

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.

0 Likes

#3

Thanks, that’s exactly what I searched for :smile:

0 Likes