alaviss / tree-sitter-nim

tree-sitter grammar for Nim
Mozilla Public License 2.0
46 stars 5 forks source link

Error when opening in neovim 0.9.5 #82

Closed sainttttt closed 7 months ago

sainttttt commented 7 months ago

Hi, I'm getting an error when I open a nim file in neovim. It didn't use to happen before, so I'm not sure what went wrong. Here's the error.

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: ...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:24: Error executing lua: ...ocal/Cellar/neovim/0.9.5/share/nvim/runti
me/filetype.lua:25: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: ...im/0.9.5/share/nvim/runtime/l
ua/vim/treesitter/query.lua:259: query: invalid node type at position 239 for language nim
stack traceback:
        [C]: in function '_ts_parse_query'
        ...im/0.9.5/share/nvim/runtime/lua/vim/treesitter/query.lua:259: in function 'get_query'
        ...r-textobjects/lua/nvim-treesitter/textobjects/shared.lua:99: in function 'available_textobjects'
        ...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:173: in function 'attach'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
        [C]: in function 'nvim_cmd'
        ...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:25: in function <...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:24>
        [C]: in function 'nvim_buf_call'
        ...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:24: in function <...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_cmd'
        ...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:25: in function <...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:24>
        [C]: in function 'nvim_buf_call'
        ...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:24: in function <...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        ...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:24: in function <...ocal/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua:10>
Error detected while processing BufReadPost Autocommands for "*.nim"..FileType Autocommands for "*":
Error executing lua callback: ...im/0.9.5/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 239 for language nim
stack traceback:
        [C]: in function '_ts_parse_query'
        ...im/0.9.5/share/nvim/runtime/lua/vim/treesitter/query.lua:259: in function 'get_query'
        ...r-textobjects/lua/nvim-treesitter/textobjects/shared.lua:99: in function 'available_textobjects'
        ...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:173: in function 'attach'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
Error executing lua callback: ...im/0.9.5/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 239 for language nim

Thanks!

sainttttt commented 7 months ago

Okay, I see that it is actually an issue with the nvim-treesitter/nvim-treesitter-textobjects plugin. When I disable that it works fine. Still seems to be an issue because it wasn't giving me errors with this plugin enabled before

alaviss commented 7 months ago

This looks awfully similar to https://github.com/nvim-treesitter/nvim-treesitter-textobjects/issues/542. Try to see if updating your config solves the issue.

And I'd recommend taking this issue to that repository as well, since it's clearly an issue with that plugin and not this grammar.

sainttttt commented 7 months ago

This was fixed with an update of the textobject plugin! I'm pretty sure it was the exact issue that you mentioned. Thanks!