andymass / vim-matchup

vim match-up: even better % :facepunch: navigate and highlight matching words :facepunch: modern matchit and matchparen. Supports both vim and neovim + tree-sitter.
https://www.vim.org/scripts/script.php?script_id=5624
MIT License
1.71k stars 73 forks source link

invalid node type for language bash #335

Open rbjorklin opened 11 months ago

rbjorklin commented 11 months ago

Explain the issue

Error detected while processing CursorMoved Autocommands for "*"..function 3[3]..4[71]..matchup#delim#get_current[1]..<SNR>73_get_delim_multi[3]..matchup#ts
_engine#get_delim[3]..<SNR>70_forward:
line    1:
E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 600 for language bash
stack traceback:
        [C]: in function '_ts_parse_query'
        /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: in function 'get_query'
        ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:55: in function 'get_query'
        ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:142: in function 'prepare_query'
        ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:339: in function 'iter_group_results'
        ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:351: in function 'collect_group_results'
        ...vim/lazy/vim-matchup/lua/treesitter-matchup/internal.lua:46: in function 'fn'
        /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:345: in function 'for_each_tree'
        ...vim/lazy/vim-matchup/lua/treesitter-matchup/internal.lua:40: in function 'fn'
        ...im/lazy/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_matches'
        ...vim/lazy/vim-matchup/lua/treesitter-matchup/internal.lua:102: in function 'fn'
        ...im/lazy/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_active_nodes'
        ...vim/lazy/vim-matchup/lua/treesitter-matchup/internal.lua:221: in function 'get_delim'
        [string "luaeval()"]:1: in main chunk

This seems very similar to #334.

EDIT: Setting disable = { "bash" } makes the error go away. EDIT2: Nvm, looks like disabling bash only reduced the frequency. Running TSUninstall bash actually makes the problem go away but also disables TreeSitter for bash. EDIT3: That also didn't help. Reverted to the last known good commit: 6c8909b682803d8c3a054259079f158a73a0e30f

andymass commented 10 months ago

I can't seem to reproduce this, bash tree-sitter works fine for me using latest plugin and parser

liangkarl commented 9 months ago

One time, after I updated nvim, nvim always prompt out the same errors as yours. I spent some time to fix it and found out that I have to remove the whole plugin directory and make treesitter re-run the whole install process, which finally makes the problem gone. It seems like there are some dependency problem among nvim, treesitter or vim-matchup. However, I'm not sure which one makes the root cause. The only thing I know is that vim-matchup is the only one plugin in my list that would prompt out these messages after I did some changes on nvim or treesitter (yes, I met these errors several times) So, assume you didn't meet this problem before and you did some update recently. Maybe you could try to clean the whole nvim configuration including the download repositories inside the treesitter

kristijanhusak commented 9 months ago

@andymass Today I started getting a similar issue with typescript:

img

chrisgrieser commented 9 months ago

I got the same issue for javascript/typescript since today.

I could pinpoint the issue to this treesitter commit: https://github.com/nvim-treesitter/nvim-treesitter/commit/6da205148fb43eb4fa70888fd6ac46a32f1fc3f2

The commit before works fine, while 6da2051 introduces the error

binhtran432k commented 9 months ago

Hi @chrisgrieser, there is a patch here (#338). You can apply it locally before the PR is merged.