cmp_luasnip
cmp_luasnip copied to clipboard
Keep getting sporadic errors (may be related to packer.nvim?)
Every now and then I get the error below. I've tried to find a way to reproduce it but it's very difficult. I think it only occurs after I run source <afile> | PackerCompile after saving my init.lua, and it appears to trigger randomly every now and then when I type in insert mode and a snippet appears as the hovered selection in the popup menu.
Without a way to reproduce it's not much help but I still wanted to post this issue to hear if there's an easy fix or if anyone else is having the same issue.
Error executing vim.schedule lua callback: ...e/pack/packer/start/cmp_luasnip/lua/cmp_luasnip/init.lua:106: attempt to index a nil value
stack traceback:
...e/pack/packer/start/cmp_luasnip/lua/cmp_luasnip/init.lua:106: in function 'resolve'
.../nvim/site/pack/packer/start/nvim-cmp/lua/cmp/source.lua:348: in function 'resolve'
...e/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/entry.lua:454: in function 'resolve'
...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/view.lua:225: in function 'fn'
.../site/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:41: in function <.../site/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:39>
I don't know much about packer's internals, does it change anything about the loaded plugins when PackerCompile is called? Your error "shouldn't" occur during normal usage I think.
Try find for get_documentation function and add:
local function get_documentation(snip, data)
if snip == nil then
return ""
end
local header = (snip.name or "") .. " _ `[" .. data.filetype .. "]`\n"
...
@melkster Could you make sure you're adding snippets via ls.add_snippets(ft, snippets)?
I didn't consider that not everybody is using that already (it is deprecated, but not yet unsupported).
What is deprecated? get_documentation?
@wuilliam321 adding snippets by directly accessing the snippet table
Could you make sure you're adding snippets via
ls.add_snippets(ft, snippets)?
This might actually be it! I wasn't using ls.add_snippets() and after changing to it I haven't experienced the issue!
Great! was the same for me!