Saghen / blink.cmp

Performant, batteries-included completion plugin for Neovim
MIT License
631 stars 26 forks source link

fix(snippets): allow snippets jumps after edition #70

Closed Biggybi closed 1 day ago

Biggybi commented 1 day ago

This PR fixes a bug which prevents from jumping to the next snippet item after a value is modified.

Mentioned in #60.

Saghen commented 1 day ago

Thanks! The root issue was slightly different so implemented in a separate commit

scottmckendry commented 1 day ago

@Saghen, just a heads up your commit is missing the union_keys definition in utils. Might want to double-check that it isn't still in your working tree.

I'm currently getting the following error:


Error executing vim.schedule lua callback: ...local/share/nvim/lazy/blink.cmp/lua/blink/cmp/keymap.lua:56: attempt to call field 'union_keys' (a nil value)
stack traceback:
    ...local/share/nvim/lazy/blink.cmp/lua/blink/cmp/keymap.lua:56: in function 'apply_keymap_to_current_buffer'
    ...local/share/nvim/lazy/blink.cmp/lua/blink/cmp/keymap.lua:45: in function 'setup'
    .../.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/init.lua:16: in function 'callback'
    ...are/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/download.lua:19: in function <...are/nvim/lazy/blink.cmp/lua/blink/cmp/fuzzy/download.lua:19>
``
scottmckendry commented 1 day ago

I have a fix in this commit that uses a built-in function to merge the two tables, but I'm not confident it's doing the same thing.

https://github.com/scottmckendry/blink.cmp/commit/a4482f31feb15c13de527213be7a1c8a4915321c

Saghen commented 1 day ago

Sorry about that, fixed

Biggybi commented 1 day ago

There's still a problem, @scottmckendry's fix is working.

utils.union_keys(insert_keys_to_commands, snippet_keys_to_commands) does not merge snippet keys. It looks like the second 'for' is not being entered, which makes no sense to me.

Edit: is there a reason why union_keys use both pair and ipair? Using pair only fixes the problem.