For the past 8 years or so, this plugin has worked fine with Sublime Text 2 and 3 to remove words in the current buffer from the ctrl + space autocomplete list, but it no longer works in ST4 (b4126):
import sublime, sublime_plugin
class MyAutocomplete(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
# Popup autocomplete only for .sublime-snippet and
# .sublime-completions files
return ([], sublime.INHIBIT_WORD_COMPLETIONS)
I know the on_query_completions and sublime.INHIBIT_WORD_COMPLETIONS are still valid, so I think the problem is with the array return statement. The docs don't show any changes between versions.
The only variation of a return statement I was able to get sublime.INHIBIT_WORD_COMPLETIONS to work with was this, but now I've got an extra completion in the list I don't want:
return [
sublime.CompletionItem(
trigger="fox",
completion="The quick brown fox jumps over the lazy dog",
kind=sublime.KIND_KEYWORD
)
], sublime.INHIBIT_WORD_COMPLETIONS
Had no luck at all with sublime.CompletionList or set_completions