Sublime Forum

Character deletion doesn't trigger on_query_completions()

#1

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?

0 Likes

#2

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).

0 Likes

#3

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": [
            ["left_delete"],
            ["auto_complete"],
        ],
    },
},
1 Like

#4

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.

0 Likes

#5

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

0 Likes

#6

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

#8

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.

0 Likes

#9

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

#10

Thanks again!!! @jfcherng

0 Likes