hrsh7th / nvim-cmp

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

attempt to call field 'list_contains' (a nil value) #1858

Closed mhogeveen closed 6 months ago

mhogeveen commented 6 months ago

Temporary fix by @the0val: https://github.com/hrsh7th/nvim-cmp/issues/1858#issuecomment-2014660238

FAQ

Announcement

Minimal reproducible full config

Description

After updating to b7b2c12610e18810f95b3d87d673ce6e72ece916 or later, cmp emits the following error: ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:27: attempt to call field 'list_contains' (a nil value). This is not expected

Steps to reproduce

Update to b7b2c12610e18810f95b3d87d673ce6e72ece916 and use cmp

Expected behavior

As described in the description

Actual behavior

As described in the description

Additional context

No response

mhogeveen commented 6 months ago

Just received another more detailed error message:

Error executing vim.schedule lua callback: ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:27: attempt to call field 'list_contains' (a nil value)
stack traceback:
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:27: in function 'parser'
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:61: in function 'parser'
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:134: in function 'parser'
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:112: in function 'parser'
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:61: in function 'snippet'
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:405: in function 'parse'
        ...geveen/.local/share/nvim/lazy/nvim-cmp/lua/cmp/entry.lua:128: in function 'callback'
        .../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/cache.lua:38: in function 'get_word'
        ...geveen/.local/share/nvim/lazy/nvim-cmp/lua/cmp/entry.lua:79: in function 'callback'
        .../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/cache.lua:38: in function 'get_offset'
        ...eveen/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:353: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
isther commented 6 months ago

I have same question. 截屏2024-03-22 16 43 28

szsdk commented 6 months ago

Following this, I can get rid of this problem by using a nightly nvim.

mhogeveen commented 6 months ago

@szsdk Good to know that fixes the issue. I don't think nightly should be required to be able to use nvim-cmp however. There isn't any indication of that in the readme as far as I'm aware. If it is required it should probably be stated somewhere.

the0val commented 6 months ago

I encountered the same issue. Pinning nvim-cmp to commit b356f2c in my Lazy config fixes it for now so I can keep working.

nusje2000 commented 6 months ago

Same issue here running nvim v0.9.6, pinning to b356f2c did indeed fix the issue. Thanks @the0val !

KonstantinKai commented 6 months ago

Thanks!!! Blazingly fast

Madoshakalaka commented 4 months ago

@hrsh7th Hi, I see your fix in https://github.com/hrsh7th/nvim-cmp/commit/630cdf7d547c4461ef6d7362c3794a08abfad4fb

However, I now have the following error originating from the code: nvim-cmp/lua/cmp/utils/snippet.lua:29: attempt to call field 'contains' (a nil value)

It repeated gives me this error for every character I type. Weirdly, if I wait for like 5 seconds before I type anything, it's all fine. I'm on nightly if that matters, specifically NVIM v0.10.0-dev-3096+g17c89eac1

redtechtiger commented 2 months ago

@hrsh7th Hi, I see your fix in 630cdf7

However, I now have the following error originating from the code: nvim-cmp/lua/cmp/utils/snippet.lua:29: attempt to call field 'contains' (a nil value)

It repeated gives me this error for every character I type. Weirdly, if I wait for like 5 seconds before I type anything, it's all fine. I'm on nightly if that matters, specifically NVIM v0.10.0-dev-3096+g17c89eac1

Same problem here. Did you find a solution?

Madoshakalaka commented 2 months ago

@redtechtiger I've been free of this bug for a while. I'm on the release version of neovim ever since 10.0 dropped:

$ nvim --version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
redtechtiger commented 2 months ago

Hmm, odd. Could it be that I'm running MacOS somehow? Never had this issue on my Linux rig or my Windows rig. Currently running Neovim nightly from Homebrew. Also worth noting is that the bug only occurs spuriously, and goes away when I restart Neovim. Thanks for letting me know though!

$ nvim --version
NVIM v0.11.0-dev-422+g3c803483a-Homebrew
Build type: Release
LuaJIT 2.1.1720049189

EDIT: Apparently I can't format code correctly 😅

olivier-duchaine commented 2 months ago

Hmm, odd. Could it be that I'm running MacOS somehow? Never had this issue on my Linux rig or my Windows rig. Currently running Neovim nightly from Homebrew. Also worth noting is that the bug only occurs spuriously, and goes away when I restart Neovim. Thanks for letting me know though!

$ nvim --version
NVIM v0.11.0-dev-422+g3c803483a-Homebrew
Build type: Release
LuaJIT 2.1.1720049189

EDIT: Apparently I can't format code correctly 😅

I'm on MacOS too and pinning to the latest version fixed the issue

tw-ilson commented 1 month ago

I am also having this issue on debian with commit ae644fe with stable nvim

timon-sue commented 1 week ago

I'm having this as well.. tried several different VIM versions, from 0.9 until current from source build

NVIM v0.11.0-dev-826+g2276743cb
Build type: Debug
LuaJIT 2.1.1724512491

nvim-cmp is at ae644fe

This is happening all the time for me, on all files in my project :(

I'm on linux

redtechtiger commented 3 days ago

Odd. Been running on Linux for a while now and no issues so far.

NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1725453128
Madoshakalaka commented 2 days ago

nvim-cmp/lua/cmp/utils/snippet.lua:29: attempt to call field 'contains' (a nil value)

I'm now having this problem again

my nvim-cmp version is

branch main
commit ae644fe

and my neovim version is

NVIM v0.10.0-dev-3096+g17c89eac1
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
timon-sue commented 2 days ago

Pinning to b356f2c does fix the issue for me.