tree-sitter / tree-sitter-rust

Rust grammar for tree-sitter
MIT License
340 stars 97 forks source link

Parser broken with recent updates? #165

Closed amaanq closed 1 year ago

amaanq commented 1 year ago

I'm not an expert in treesitter or neovim configuration, but when my parser was updated I always get errors when opening a Rust file, as well as my lsp no longer working :) here's an error message I get:

Error executing lua callback: /usr/local/share/nvim/runtime/filetype.lua:21: Error executing lua: /usr/local/share/nvim/runtime/filetype.lua:22: Vim(append):Error executing lua callback: /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:219: query: invalid node type at position 1400 for language rust stack traceback: [C]: in function '_ts_parse_query' /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:219: in function 'get_query' ...packer/opt/nvim-treesitter/lua/nvim-treesitter/query.lua:104: in function 'get_query' ...r-textobjects/lua/nvim-treesitter/textobjects/attach.lua:9: in function 'attach' ...cker/opt/nvim-treesitter/lua/nvim-treesitter/configs.lua:505: in function 'attach_module' ...cker/opt/nvim-treesitter/lua/nvim-treesitter/configs.lua:528: in function 'reattach_module' ...cker/opt/nvim-treesitter/lua/nvim-treesitter/configs.lua:131: in function <...cker/opt/nvim-treesitter/lua/nvim-treesitter/configs.lua:130> [C]: in function 'nvim_cmd' /usr/local/share/nvim/runtime/filetype.lua:22: in function </usr/local/share/nvim/runtime/filetype.lua:21> [C]: in function 'nvim_buf_call' /usr/local/share/nvim/runtime/filetype.lua:21: in function </usr/local/share/nvim/runtime/filetype.lua:10> stack traceback: [C]: in function 'nvim_cmd' /usr/local/share/nvim/runtime/filetype.lua:22: in function </usr/local/share/nvim/runtime/filetype.lua:21> [C]: in function 'nvim_buf_call' /usr/local/share/nvim/runtime/filetype.lua:21: in function </usr/local/share/nvim/runtime/filetype.lua:10> stack traceback: [C]: in function 'nvim_buf_call' /usr/local/share/nvim/runtime/filetype.lua:21: in function </usr/local/share/nvim/runtime/filetype.lua:10>

explocion commented 1 year ago

I have the same issue on Garuda Linux with neovim 8.0

explocion commented 1 year ago
Failed to execute the following command:
{
  cmd = <function 1>
}

Got "/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:219: query: invalid node type at position 1400 for language rust" when trying to reinstall.

amaanq commented 1 year ago

Adding on to say I've tested on 234 of my own files, with the following results:

Total parses: 234; successful parses: 206; failed parses: 28; success percentage: 88.03%

If a maintainer or dev would like any of the 28 failed files, I'd be happy to upload them.

I have tried debugging/bisecting the git to figure out what's going on, but reverting back to good commits still has tree-sitter erroring on these 28/234 files. I don't know if I'm failing to update tree-sitter with that commit (via tree-sitter generate?) or if I'm missing something else. Advice is appreciated.

amaanq commented 1 year ago

Misclicked, did not mean to close.

syphar commented 1 year ago

from https://github.com/nvim-treesitter/nvim-treesitter/issues/3770 it sounds like this is an issue only in treesitter-textobjects (https://github.com/nvim-treesitter/nvim-treesitter-textobjects/issues/316)

maxbrunsfeld commented 1 year ago

Yeah, I don't think there's been any breakage; Neovim probably just has some queries that need to be tweaked to be compatible with the latest version. Should neovim just be pointing at the master branch? I would think that if Neovim has its own tree queries checked-in, it should refer explicitly to a certain commit of this repo.

amaanq commented 1 year ago

it sounds like this is an issue only in treesitter-textobjects

yeah, I can confirm uninstalling treesitter-textobjects does in fact remedy the issue. I still don't understand why at all or how to fix the problem sadly, but thanks! happy to have my highlighting back :)

maxbrunsfeld commented 1 year ago

Ok, I think that this is an issue in that treesitter-textobjects module then. Some query needs to be updated to work with the latest version of this repo.