Sublime Anaconda package abusive auto_complete (remove specific trigger)

269 views Asked by At

I am using the Anaconda package for Sublime Text. Everything is working perfectly, I love it. In truth, it works a bit too well, especially the auto_complete.

The auto_complete being zealous

Every time I write a colon (:) after a statement needing one (def, if, for, class, ...), it shows me an auto-complete list which I cannot avoid. Each and every time, I have to write a blank and erase it to be able to use the Enter key and go to the next line.

If I write a colon where it is not needed, it will not open the auto_complete list. If I turn off the auto_complete, it stops it from happening, but it is not ideal since I like the auto_complete in general.

I know how to add triggers for the auto_complete. Is there a way to remove a specific trigger (here the colon (:))?

1

There are 1 answers

2
Nerra On BEST ANSWER

In case others have the same trouble. I found an answer here : https://github.com/DamnWidget/anaconda/issues/891.

Like MattDMo said, it is a bug. The proposed temporary workaround is a post from ZitCode (see the link above for the source) :

I have found a solution (it's working, but I think it's should be a temporary solution 'cause it just disabling completion when ':' is typed) In file listeners/completion.py (can be found by click on 'Preferences/Browse Packages' in Sublime Text, then open Anaconda folder) add lines

if int(sublime.version()) > 4000:
    if view.substr(view.sel()[0].begin() - 1) == ':':
        return 

under 86 line view = active_view() in function _complete. The file should look like this:

def _complete(self, data: Dict[str, Any]) -> None:

    view = active_view()
    if int(sublime.version()) > 4000:
        if view.substr(view.sel()[0].begin() - 1) == ':':
            return
    proposals = data['completions'] if data['success'] else []