quangnguyen30192 / cmp-nvim-ultisnips

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

Update support for new lua parser in treesitter #67

Closed tonysyu closed 2 years ago

tonysyu commented 2 years ago

It appears that cmp-nvim-ultisnips is running into the same issue described in https://github.com/nvim-treesitter/nvim-treesitter/issues/2295. As described in that issue, updates to the nvim-treesitter lua parser (https://github.com/nvim-treesitter/nvim-treesitter/pull/2272) requires updates to third-party modules. Here's the error output I see when editing a lua file:

Error detected while processing TextChangedI Autocommands for "*":
E5108: Error executing lua .../Contents/Resources/runtime/lua/vim/treesitter/query.lua:161: query: invalid field at position 18
stack traceback:
    [C]: in function '_ts_parse_query'
    .../Contents/Resources/runtime/lua/vim/treesitter/query.lua:161: in function 'get_query'
    ...ts/Resources/runtime/lua/vim/treesitter/languagetree.lua:37: in function 'new'
    ...bundle/Contents/Resources/runtime/lua/vim/treesitter.lua:45: in function '_create_parser'
    ...bundle/Contents/Resources/runtime/lua/vim/treesitter.lua:93: in function 'get_parser'
    ...plugged/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:133: in function 'get_node_at_cursor'
    ...cmp-nvim-ultisnips/lua/cmp_nvim_ultisnips/treesitter.lua:20: in function 'get_ft_at_cursor'
    ...cmp-nvim-ultisnips/lua/cmp_nvim_ultisnips/treesitter.lua:35: in function 'set_filetype'
    [string ":lua"]:1: in main chunk

Uninstalling cmp-nvim-ultisnips resolves the issue on my system.

smjonas commented 2 years ago

As some guys mentioned on that issue, can you check if you still have old parser files at ~/.local/share/nvim/site/pack/parser? If so, please delete them. Then try to run :TSUpdate. Does that help?

Edit: Sorry, I just read your last sentence. I don't think we can do anything on cmp-nvim-ultisnips' side to avoid this issue.

tonysyu commented 2 years ago

My bad, you're right that it has nothing to do with cmp-nvim-ultisnips support for the new Lua parser in Treesitter.

I didn't have a directory called ~/.local/share/nvim/site/pack/parser and :TSUpdate didn't seem to help either, but after removing the entire ~/.local/share/nvim/ directory and restarting, everything seems to be working.

Sorry for the noise!

smjonas commented 2 years ago

No worries, glad that everything works now! :)