Sublime Forum

Removal of api-injected completions?

#1

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

0 Likes

#2

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.

0 Likes

#3

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!

0 Likes