Home Download Buy Blog Forum Support

AutoCompletion API

Re: AutoCompletion API

Postby jps on Wed Jun 03, 2009 12:23 pm

By the sound of it, you could implement IPython auto complete using the showCompletions API call, just not via AutoCompleteCommand.completionCallbacks.

Allowing different completion options to have different prefixes sounds like a good plan, I'll have a think about the completion API and make that change at the least.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: AutoCompletion API

Postby jps on Thu Jun 04, 2009 12:13 pm

I don't think the prefix should matter: The callback is given a view, and a position within the view, so it can inspect as much of the buffer as it wishes to generate the completions. The prefix passed in is just an informative item identifying what text will be removed before the completion is inserted (i.e., it should generally be the case that all returned completions will start with the prefix).

My tentative plan is to have the completion callback return a tuple of (display, command) strings, instead of the single string it does presently: the 'display' value is what's shown in the menu, and the 'command' value is the command that will be run, which will allow using insertInlineSnippet.

This isn't quite as flexible as allowing callback functions to be associated with each completion, but does ensure that undo groups will be setup properly, and that repeat, macros etc will work with the selected entry.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 7 guests