andymass/vim-matchup

Completely breaks in my Ubuntu 22.04 in WSL2

unphased opened this issue ยท 12 comments

I will post additional details as I troubleshoot. But once I remove matchup from my plugin list, I have no problems. Here is what comes up in the console, every time I move the cursor:

"lua/plugins.lua" 242L, 7630B
"init.lua" 1497L, 56700B
Error detected while processing function <SNR>38_timer_callback[20]..15[71]..matchup#delim#get_current[1]..<SNR>85_get_delim_multi[3]..matchup#ts_engine#get_delim[3]..<SNR>73_forward:
line    1:
E5108: Error executing lua /opt/neovim/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 6 for language lua
stack traceback:
        [C]: in function '_ts_parse_query'
        /opt/neovim/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'
        ...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:385: 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
Error detected while processing function <SNR>38_timer_callback[20]..15[81]..<SNR>38_highlight_surrounding[7]..matchup#delim#get_surrounding[1]..matchup#delim#get_surrounding_impl[18]..matchup#delim#skip[13]..matchup#ts_syntax#skip_expr[1]..matchup#ts_syntax#lang_skip[1]..<SNR>86_
forward:
line    1:
E5108: Error executing lua /opt/neovim/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 6 for language lua
stack traceback:
        [C]: in function '_ts_parse_query'
        /opt/neovim/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-matchup/lua/treesitter-matchup/third-party/query.lua:23: in function 'update_cached_matches'
        ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:31: in function 'get_matches'
        .../nvim/lazy/vim-matchup/lua/treesitter-matchup/syntax.lua:26: in function 'get_skips'
        .../nvim/lazy/vim-matchup/lua/treesitter-matchup/syntax.lua:60: in function 'lang_skip'
        [string "luaeval()"]:1: in main chunk
Error detected while processing function <SNR>38_timer_callback[20]..15[81]..<SNR>38_highlight_surrounding[7]..matchup#delim#get_surrounding[1]..matchup#delim#get_surrounding_impl[44]..matchup#delim#get_prev[1]..<SNR>85_get_delim_multi[3]..matchup#ts_engine#get_delim[3]..<SNR>73_f
orward:
line    1:
E5108: Error executing lua /opt/neovim/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 6 for language lua
stack traceback:
        [C]: in function '_ts_parse_query'
        /opt/neovim/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'
        ...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:385: 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:256: in function 'get_delim'
        [string "luaeval()"]:1: in main chunk
Error detected while processing function <SNR>38_timer_callback[20]..15[81]..<SNR>38_highlight_surrounding[7]..matchup#delim#get_surrounding[1]..matchup#delim#get_surrounding_impl[44]..matchup#delim#get_prev[1]..<SNR>85_get_delim_multi[3]..<SNR>85_get_delim[73]..matchup#delim#skip
[13]..matchup#ts_syntax#skip_expr[1]..matchup#ts_syntax#lang_skip[1]..<SNR>86_forward:
line    1:
E5108: Error executing lua /opt/neovim/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 6 for language lua
stack traceback:
        [C]: in function '_ts_parse_query'
        /opt/neovim/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-matchup/lua/treesitter-matchup/third-party/query.lua:23: in function 'update_cached_matches'
        ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:31: in function 'get_matches'
        .../nvim/lazy/vim-matchup/lua/treesitter-matchup/syntax.lua:26: in function 'get_skips'
        .../nvim/lazy/vim-matchup/lua/treesitter-matchup/syntax.lua:60: in function 'lang_skip'
        [string "luaeval()"]:1: in main chunk
Press ENTER or type command to continue

I have now tried this minimal config:

vim.cmd([[
  set nocompatible
  " load match-up
  let &rtp  = '~/.local/share/nvim/lazy/vim-matchup,' . &rtp
  let &rtp .= ',~/.local/share/nvim/lazy/vim-matchup/after'

  " load treesitter
  let &rtp  = '~/.local/share/nvim/lazy/nvim-treesitter,' . &rtp
  let &rtp .= ',~/.local/share/nvim/lazy/nvim-treesitter/after'

  " load other plugins, if necessary
  " let &rtp = '~/path/to/other/plugin,' . &rtp
  filetype plugin indent on
  set nocompatible
  syntax enable
]])

-- set up treesitter
require("nvim-treesitter.configs").setup({
  matchup = {
    enable = true,
    disable = {},
  },
})

-- match-up options
vim.g.matchup_matchparen_offscreen = { method = "popup" }
vim.g.matchup_surround_enabled = 1
vim.g.matchup_matchparen_deferred = 1
vim.g.matchup_matchparen_hi_surround_always = 1

with the same behavior!

nvim is:

NVIM v0.10.0-dev
Build type: Release
LuaJIT 2.1.0-beta3

You know what's crazy, I get similar errors, but what looks like a totally different set of stack traces, when I went back to a different commit (this is 6c8909b)

:mes
Failed to source `/home/slu/.local/share/nvim/lazy/playground/plugin/nvim-treesitter-playground.lua`
vim/_editor.lua:0: /home/slu/.vim/nvim/init.lua..nvim_exec2() called at /home/slu/.vim/nvim/init.lua:0../home/slu/.local/share/nvim/lazy/vim-matchup/plugin/matchup.vim[54]..function matchup#init[4]..<SNR>14_init_modules[6]..script /home/slu/.local/share/nvim/lazy/vim-matchup/autol
oad/matchup/loader.vim[95]..nvim_exec2() called at /home/slu/.local/share/nvim/lazy/vim-matchup/autoload/matchup/loader.vim:95../home/slu/.local/share/nvim/lazy/playground/plugin/nvim-treesitter-playground.lua: Vim(source):E5113: Error while calling lua chunk: /opt/neovim/share/nv
im/runtime/lua/vim/treesitter/query.lua:510: Overriding has-ancestor?
stack traceback:
^I[C]: in function 'error'
^I/opt/neovim/share/nvim/runtime/lua/vim/treesitter/query.lua:510: in function 'add_predicate'
^I...nvim-treesitter/lua/nvim-treesitter/query_predicates.lua:94: in main chunk
^I[C]: in function 'require'
^I.../share/nvim/lazy/nvim-treesitter/lua/nvim-treesitter.lua:8: in main chunk
^I[C]: in function 'require'
^I.../nvim/lazy/playground/lua/nvim-treesitter-playground.lua:5: in function 'init'
^I...im/lazy/playground/plugin/nvim-treesitter-playground.lua:2: in main chunk
^I[C]: in function 'nvim_exec2'
^Ivim/_editor.lua: in function 'cmd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:438: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437>
^I...
^I[C]: in function 'xpcall'
^I.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:110: in function 'try'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437: in function 'source'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:396: in function 'source_runtime'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:364: in function 'packadd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:304: in function '_load'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:180: in function 'load'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:115: in function 'startup'
^I...e/slu/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:85: in function 'setup'
^I/home/slu/.vim/nvim/init.lua:69: in main chunk
# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - /vim-matchup/lua/treesitter-matchup.lua:1
  - uaeval():1
  - vim/_editor.lua:0 _in_ **cmd**
  - init.lua:69
vim/_editor.lua:0: /home/slu/.vim/nvim/init.lua..nvim_exec2() called at /home/slu/.vim/nvim/init.lua:0../home/slu/.local/share/nvim/lazy/vim-matchup/plugin/matchup.vim[54]..function matchup#init[4]..<SNR>14_init_modules[6]..script /home/slu/.local/share/nvim/lazy/vim-matchup/autol
oad/matchup/loader.vim[95]..nvim_exec2() called at /home/slu/.local/share/nvim/lazy/vim-matchup/autoload/matchup/loader.vim:95../home/slu/.local/share/nvim/lazy/nvim-ts-context-commentstring/plugin/ts_context_commentstring.vim, line 1: Vim(lua):E5108: Error executing lua [string "
:lua"]:1: attempt to index a boolean value
stack traceback:
^I[string ":lua"]:1: in main chunk
^I[C]: in function 'nvim_exec2'
^Ivim/_editor.lua: in function 'cmd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:438: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437>
^I[C]: in function 'xpcall'
^I.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:110: in function 'try'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437: in function 'source'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:396: in function 'source_runtime'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:364: in function 'packadd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:304: in function '_load'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:180: in function 'load'
^I...
^I[C]: in function 'xpcall'
^I.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:110: in function 'try'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437: in function 'source'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:396: in function 'source_runtime'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:364: in function 'packadd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:304: in function '_load'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:180: in function 'load'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:115: in function 'startup'
^I...e/slu/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:85: in function 'setup'
^I/home/slu/.vim/nvim/init.lua:69: in main chunk
# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - /vim-matchup/lua/treesitter-matchup.lua:1
  - uaeval():1
  - vim/_editor.lua:0 _in_ **cmd**
  - init.lua:69
Failed to source `/home/slu/.local/share/nvim/lazy/nvim-treesitter/plugin/nvim-treesitter.lua`
vim/_editor.lua:0: /home/slu/.vim/nvim/init.lua..nvim_exec2() called at /home/slu/.vim/nvim/init.lua:0../home/slu/.local/share/nvim/lazy/vim-matchup/plugin/matchup.vim[54]..function matchup#init[4]..<SNR>14_init_modules[6]..script /home/slu/.local/share/nvim/lazy/vim-matchup/autol
oad/matchup/loader.vim[95]..nvim_exec2() called at /home/slu/.local/share/nvim/lazy/vim-matchup/autoload/matchup/loader.vim:95../home/slu/.local/share/nvim/lazy/nvim-treesitter/plugin/nvim-treesitter.lua: Vim(source):E5113: Error while calling lua chunk: ...are/nvim/lazy/nvim-tree
sitter/plugin/nvim-treesitter.lua:9: loop or previous error loading module 'nvim-treesitter'
stack traceback:
^I[C]: in function 'require'
^I...are/nvim/lazy/nvim-treesitter/plugin/nvim-treesitter.lua:9: in main chunk
^I[C]: in function 'nvim_exec2'
^Ivim/_editor.lua: in function 'cmd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:438: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437>
^I[C]: in function 'xpcall'
^I.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:110: in function 'try'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437: in function 'source'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:396: in function 'source_runtime'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:364: in function 'packadd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:304: in function '_load'
^I...
^I[C]: in function 'xpcall'
^I.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:110: in function 'try'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:437: in function 'source'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:396: in function 'source_runtime'

Super curious, here, the errors come up on startup but matchup seems to continue working beyond that. and moving around or hitting keys bound to matchup does not seem to cause any more errors.

OK i think this might not be specific to this plugin. something about recent changes between nvim, lazy, lua syntax, and possibly ubuntu 22.04 and WSL2 here.

can you let me know if commenting out specific queries in the query files (after/queries) fixes it?

I can't reproduce it for some reason.

I met this problem, too. But only in lua files. Removing after/queries/lua fixs that.

Same here. It is throwing this error only for lua files.

Error detected while processing CursorMoved Autocommands for "*"..function 3[3]..4[71]..matchup#delim#get_current
[1]..<SNR>48_get_delim_multi[3]..matchup#ts_engine#get_delim[3]..<SNR>45_forward:
line    1:
E5108: Error executing lua ...im/0.9.0/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node t
ype at position 6 for language lua
stack traceback:
        [C]: in function '_ts_parse_query'
        ...im/0.9.0/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'
        ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:46: in function 'fn'
        ...0/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:324: in function 'for_each_tree'
        ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:40: in function 'fn'

Thanks for the comments. @Martinits and @ravitemer are you both on Ubuntu in WSL2?

@andymass i definitely cannot reproduce this in any form from my Mac, my Linux box will be back up in a little bit

I met this problem, too. But only in lua files. Removing after/queries/lua fixs that.

Can anyone try removing specific queries from after/queries/lua/matchup.scm until it works?

I'm on archlinux. After some trying, commenting out the first line ; inherits: quote fixs the problem. And in after/queries/quote/matchup.scm, commenting out both two queries (or blocks? I don't understand scheme) fixs this.

@Martinits Did you try to do a :TSUpdate?

Oh, I forgot. Seems everything's fine after update.

Oh wow TSUpdate also fixed it over here. Thanks.