-
Notifications
You must be signed in to change notification settings - Fork 322
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Make sure you have done the following
- Updated to the latest version of
blink.cmp - Searched for existing issues and documentation (try
<C-k>on https://cmp.saghen.dev)
Bug Description
I'm trying to get to both cancel the current completion, and exit insert mode.
If I do something like:
["<Escape>"] = {
function(opts)
require("blink.cmp").cancel()
return false
end,
"fallback",
},I get the following:
vim.schedule callback: ...al/share/nvim/lazy/blink.cmp/lua/blink/cmp/lib/utils.lua:145: Vim:E785: complete() can only be used in Insert mode
stack traceback:
[C]: in function 'error'
...al/share/nvim/lazy/blink.cmp/lua/blink/cmp/lib/utils.lua:145: in function 'with_no_autocmds'
...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:368: in function 'defer_neovide_redraw'
...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:367: in function 'write_to_dot_repeat'
...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:21: in function 'apply'
...re/nvim/lazy/blink.cmp/lua/blink/cmp/completion/list.lua:326: in function 'undo_preview'
.../.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/init.lua:145: in function <.../.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/init.lua:144>
And I end up in a fairly weird state focus wise.
To reproduce, put that into your keymap, go into insert mode, bring up the completion menu, move to a different item, don't select it and instead hit escape.
I'm pretty sure that this is because the cancel is being scheduled for later, but the fallback escape is happening before that runs.
And once that happens, the completion is ended without cancelling the state.
Resulting in the above error when it does run.
Relevant configuration
neovim version
NVIM v0.12.0-dev-1812+g05de037795
blink.cmp version
main, 18712d9
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working