Sublime Forum

Character deletion doesn't trigger on_query_completions()


If I delete characters one by one from the end of a word, it seems that on_query_completions won’t be triggered. This function can’t only be triggered when I input characters. Is this a bug?



That is expected. Completions of any kind (snippets, completion files, plugin completions) etc. are only presented when a user types something.

When you type something, completions assist in you choosing the right words/characters to make typing faster. I don’t need assistance in deleting code (And it would be annoying as anything to keep getting AC when I delete characters).



If you want to do that desperately (in ST 4), one way is to re-bind all delete-related keybindings with the chain command by appending a auto_complete command. For example,

    "keys": ["backspace"],
    "command": "chain",
    "args": {
        "commands": [
1 Like


This sounds reasonable. However, if I mistype a character and then I delete it, I think it would be better to trigger on_query_completions so the completion list can be updated. Otherwise, I have to use the workaround which jfcherng mentioned.



Wow. This works like a charm! Many Thanks! I have to say this workaround is extremely awesome!



For what it’s worth, you can also just manually re-trigger the Autocomplete at any time if you want it, including after deletions. That would give you the ability to fix things without being hassled by the autocomplete popup every time you backspace.

1 Like


Thanks. Now I think it’s reasonable because it’s really annoying to popup the completion list when deleting characters… This way is only useful when I write plain text.



in that case, you can add context to make the chain keybinding only works in plain text syntax. or, just get used to trigger it manually, whichever.

1 Like


Thanks again!!! @jfcherng