I’m working on a plugin with a ton of completions and would like to include a feature to be able to make them active or inactive.
My current way of going about this is to store the completions in a .json and then import them into a script in a .py file based on if corresponding values are true
or false
in the settings fil. These are then put in a list that I’m calling ‘allCompletions’, which is returned using on_query_completions() as seen here:
class CompletionsCommand(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
if JSON['scope'] in view.scope_name(view.sel()[-1].b):
return allCompletions
As convoluted as this may seem, it’s working great! Thing is, it blocks any other completions that would otherwise appear in the specified scope, as if this is replacing all pre-existing completions. Is that what’s going on? Any idea how to stop it from doing that?
I’m also open to suggestions about other ways to go about making the specific completions active or inactive. I think I would ultimately prefer to be using .sublime-completions
files, but is there a way to tell auto-complete to ignore specific ones via settings?