Home Download Buy Blog Forum Support

Removal of api-injected completions?

Removal of api-injected completions?

Postby tcbeutler on Sat Nov 23, 2013 6:39 pm

Hello!

I have a plugin that provides some very useful platform-specific autocompletions that happen to be big and ugly filepaths. It works exactly the way I want it to, but it has some nasty side effects.

All of the autocompletions returned from "on_query_completions" get stuck in the completions list, so when I continue to code completions goes beyond being useless and just becomes a burden, since the long completions I added match pretty much everything via regex.

Is there some mechanism for accessing and modifying the current list of autocompletions, even if it's just the API-injected ones? I just want to remove the completions I added when "on_query_completions" gets called if the prefix doesn't meet my criteria.

Thanks in advance,

Tom
tcbeutler
 
Posts: 2
Joined: Sat Nov 23, 2013 6:23 pm

Re: Removal of api-injected completions?

Postby skuroda on Sun Nov 24, 2013 4:17 am

I'm confused, if you don't want to return your own completions given some condition, why not just have your plugin return an empty array from "on_query_completions"? You have access to the view, cursor locations, and prefix there, so you should be able to determine what should be in the completion list.
skuroda
 
Posts: 676
Joined: Fri Oct 05, 2012 8:11 am

Re: Removal of api-injected completions?

Postby tcbeutler on Sun Nov 24, 2013 5:15 pm

Hey, thanks for the response. I went back and checked and found a bug, I was doing:

if prefix not in 'require': return []

Changed to

if not prefix or prefix not in 'require': return []

and now when I press ctrl+space it doesn't include my masses of returned values. Thanks!
tcbeutler
 
Posts: 2
Joined: Sat Nov 23, 2013 6:23 pm


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 13 guests