vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

invalid node type for language bash

Open rbjorklin opened this issue 1 year ago • 5 comments

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

rbjorklin avatar Dec 20 '23 19:12 rbjorklin

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

andymass avatar Dec 27 '23 15:12 andymass

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

liangkarl avatar Jan 31 '24 19:01 liangkarl

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

img

kristijanhusak avatar Feb 01 '24 11:02 kristijanhusak

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

chrisgrieser avatar Feb 01 '24 12:02 chrisgrieser

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

binhtran432k avatar Feb 01 '24 13:02 binhtran432k