quangnguyen30192 / cmp-nvim-ultisnips

nvim-cmp source for ultisnips
Apache License 2.0
144 stars 19 forks source link

bad argument #1 to 'pairs' (table expected, got nil) in source.lua:29 #97

Closed fidelski closed 3 months ago

fidelski commented 3 months ago

After updating to nvim-0.10 I get the following error on every first edit of a file:

E5108: Error executing lua ...azy/cmp-nvim-ultisnips/lua/cmp_nvim_ultisnips/source.lua:29: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
        [C]: in function 'pairs'
        ...azy/cmp-nvim-ultisnips/lua/cmp_nvim_ultisnips/source.lua:29: in function 'complete'
        ...fidel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:326: in function 'complete'
        ...e/fidel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:299: in function 'complete'
        ...e/fidel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:169: in function 'autoindent'
        ...e/fidel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:161: in function 'on_change'
        ...e/fidel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:331: in function <...e/fidel/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:326>
        ...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/utils/feedkeys.lua:47: in function 'run'
        [string ":lua"]:1: in main chunk

A simple check for nil of snippets and corresponding conditional execution of the for loop would make the error go away. I don't know whether this is a good idea though, since I don't know about other consequences or whether the problem should be treated beforehand. I also don't know why this suddenly pops up or whether the problem lies within Ultisnips itself.

smjonas commented 3 months ago

Thanks for reporting, should be fixed now! I accidentally introduced this bug in the recent refactor commit.

fidelski commented 3 months ago

That was fast! Thanks a lot! ❤️