hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
8.01k stars 398 forks source link

Custom Entries Error after 'get-selected' api #1988

Open smsjr opened 3 months ago

smsjr commented 3 months ago

After last commit (e1757ae), I'm getting the following error when trying to select suggestions (through TAB, \<C-n> or arrows):

E5108: Error executing lua: .../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: attempt to perform arithmetic on local 'cursor' (a nil value)
stack traceback:
    .../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: in function 'select_next_item'
    ...e/smsjr/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:224: in function 'select_next_item'
    ...e/smsjr/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:146: in function 'select_next_item'
    /home/smsjr/.config/nvim/lua/plugins/config/cmp.lua:195: in function 'on_keymap'
    ...e/smsjr/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
    ....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:127>

I've already tried updating custom entries configs (following the Wiki), but also unsuccessful.

gazsp commented 3 months ago

Just got this as well.

sjclayton commented 3 months ago

Culprit is here --> https://github.com/hrsh7th/nvim-cmp/pull/1986

thesantatitan commented 3 months ago

pushed a fix #1989

miguelsrmv commented 3 months ago

I have that too.

Shougo commented 3 months ago

Please test this.

https://github.com/hrsh7th/nvim-cmp/pull/1993

barreiroleo commented 3 months ago

Meanwhile reverting e1757ae locally worked for me

sjclayton commented 3 months ago

1993 solved this issue for me.

Shougo commented 3 months ago

It should be closed.