Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treesitter integration broken on Javascript #307

Open
bmulholland opened this issue Jul 12, 2023 · 26 comments
Open

Treesitter integration broken on Javascript #307

bmulholland opened this issue Jul 12, 2023 · 26 comments
Labels

Comments

@bmulholland
Copy link

Explain the issue

When I open a JS file, I get constant popup errors:

Error detected while processing InsertLeave Autocommands for "*"..function 4[71]..matchup#delim#get_current[1]..<SNR>130
_get_delim_multi[3]..matchup#ts_engine#get_delim[3]..<SNR>124_forward:
line    1:
E5108: Error executing lua ...im/0.9.1/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid structure at
position 1171 for language javascript
stack traceback:
        [C]: in function '_ts_parse_query'
        ...im/0.9.1/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'
        ...1/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:341: 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

Latest version from this repo. Disabling the treesitter integration fixes it.

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

I don't have bandwidth for a minimal repro right now, let me know if it's not clear from the backtrace what's happening.

@andymass
Copy link
Owner

Just merged this:
#306

Did it fix it?

@bmulholland
Copy link
Author

It did! Fast work -- thank you!

I was just tracking it down, but seems like disabling treesitter integration didn't solve it? Just made it less frequent. Bit odd.

Anyway, fixed now, thank you!

@riverajohan
Copy link

Im still experiencing this bug when the cursor is at the opening or close of a parenthesis ()

@andymass
Copy link
Owner

@riverajohan have you done :TSUpdate?

@idevat
Copy link

idevat commented Jul 14, 2023

I've got similar issue after update #306. I fixed it by using 'commit': '3c4ccc489002fe72b5d2e2ffc4b3b5a7d3ab65d8' in plug definition.
My neovim version is v0.9.1. I had this issue before and I fixed it by using 'tag': 'v0.9.0' for neovim-treesitter.
Is there also a tag for specific neovim version?

@riverajohan
Copy link

riverajohan commented Jul 14, 2023

@riverajohan have you done :TSUpdate?

Yes I did. Then uninstall / install with no luck. I just reverted to a previous version of the plugin. Im using Lunarvim maybe its related to that but im ok not using the latest update. Thanks

@gipo355
Copy link

gipo355 commented Jul 24, 2023

can confirm: matchup broken in javascript.
spawns an error on every cursor move

Error detected while processing CursorMoved Autocommands for "*"..function 3[3]..4[71]..matchup#delim#get_current[1]..<SNR>96_get_delim_multi[3]..matchup#ts_engine#get_delim[3]..<SNR>91_forward:
     1 line    1:
     2 E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:273: query: invalid node type at position 1172 for language javascript
     3 stack traceback:
     4   [C]: in function '_ts_parse_query'
     5   /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:273: in function 'parse'
     6   /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:232: in function 'get_query'
 ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:55: in function 'get_query'
     1   ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:142: in function 'prepare_query'
     2   ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:339: in function 'iter_group_results'
     3   ...vim-matchup/lua/treesitter-matchup/third-party/query.lua:351: in function 'collect_group_results'
     4   ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:46: in function 'fn'
     5   /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:384: in function 'for_each_tree'
...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:40: in function 'fn'
     1   ...azy/opt/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_matches'
     2   ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:102: in function 'fn'
     3   ...azy/opt/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_active_nodes'
     4   ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:221: in function 'get_delim'
     5   [string "luaeval()"]:1: in main chunk

:TSUpdate everything is updated, js parser installed

edit:
tried 'commit': '3c4ccc489002fe72b5d2e2ffc4b3b5a7d3ab65d8' and it works so possibly a bad commit bisect after that

@rbjorklin
Copy link

I'm seeing a very similar issue that shows up on lua files. The issue I'm seeing was introduced in b8eca3b.

Error detected while processing CursorMoved Autocommands for "*"..function 3[3]..4[71]..matchup#delim#get_current[1]..<SNR>75_get_delim_multi[3]..matchup#ts
_engine#get_delim[3]..<SNR>72_forward:
line    1:
E5108: Error executing lua /usr/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'
        /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'
        ...er/start/vim-matchup/lua/treesitter-matchup/internal.lua:46: in function 'fn'
        /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:341: in function 'for_each_tree'
        ...er/start/vim-matchup/lua/treesitter-matchup/internal.lua:40: in function 'fn'
        ...r/start/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_matches'
        ...er/start/vim-matchup/lua/treesitter-matchup/internal.lua:102: in function 'fn'
        ...r/start/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_active_nodes'
        ...er/start/vim-matchup/lua/treesitter-matchup/internal.lua:221: in function 'get_delim'
        [string "luaeval()"]:1: in main chunk

@0rtz
Copy link

0rtz commented Jul 27, 2023

Seeing same issue in c files with treesitter + matchup enabled

@amaanq
Copy link
Contributor

amaanq commented Jul 27, 2023

C is fixed now

@cova-fe
Copy link

cova-fe commented Aug 2, 2023

I'm seeing apparently the same problem while opening the config.lua (lunarvim)
Error detected while processing CursorMoved Autocommands for "*"..function 3[3]..4[71]..matchup#delim#get_current[1]..<SNR>65_get_delim_multi[3]..matchup#ts_engine#get_delim[3]..<SNR>60_forward: line 1: E5108: Error executing lua /usr/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' /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' ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:46: in function 'fn' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:341: in function 'for_each_tree' ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:40: in function 'fn' ...azy/opt/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_matches' ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:102: in function 'fn' ...azy/opt/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:380: in function 'get_active_nodes' ...lazy/opt/vim-matchup/lua/treesitter-matchup/internal.lua:221: in function 'get_delim' [string "luaeval()"]:1: in main chunk

@amaanq
Copy link
Contributor

amaanq commented Aug 2, 2023

You need to ensure your plugins are up to date and tree-sitter parsers as well with :TSUpdate

@gipo355
Copy link

gipo355 commented Aug 2, 2023

My parsers are up to date and I still can't use the plugin in JavaScript files as it triggers the error on every cursor move

@amaanq
Copy link
Contributor

amaanq commented Aug 2, 2023

can't reproduce in a js file - a reproducer w/ steps would be useful

@cova-fe
Copy link

cova-fe commented Aug 2, 2023

Just checked: Forcing nvim-treesitter to latest commit, followed by TSUpdate seems to have fixed the issue. So if someone else is experiencing similar issues, it is worth to have a look at nvim-treesitter plugin status

@amaanq
Copy link
Contributor

amaanq commented Aug 2, 2023

right...updating it to the latest commit = updating the plugin

@kohane27
Copy link

kohane27 commented Aug 9, 2023

My bad. Turned out I can't lazy load vim-matchup with lazy.nvim

spiritphyz added a commit to spiritphyz/Save-the-Environment that referenced this issue Aug 27, 2023
Need to run :PlugUpdate and :TSUpdate to ensure JavaScript files don't produce a lot of junk at top of screen:
andymass/vim-matchup#307

Make vim-matchup use popup method at top of screen with syntax highlighting even though it make degrade performance.
@crabsinger
Copy link

I'm getting this same type of error with lua files

@riverajohan
Copy link

I can confirm this is fixed.

@titanve
Copy link

titanve commented Nov 9, 2023

I'm still getting this error

@riverajohan
Copy link

I'm still getting this error

Validate you have an updated version of treesitter. In my case I was using Lunarvim on the 1.3 release. That release have the plugins version locked to a pretty old version and that was the cause for the error for me. I moved to the master branch and after the update the issue was fixed.

@titanve
Copy link

titanve commented Nov 10, 2023

@riverajohan Hi!
I can see in my lazy-lock.json file that I have this for treesitter "nvim-treesitter": { "branch": "master", "commit": "2ce3c9080cfe4a39c7907e672edafd2a95244a7c" }, Is this ok?

Thanks

@titanve
Copy link

titanve commented Nov 10, 2023

I changed the commit SHA to this one 208504c7072ca81e8bf9fa2e666cf3436dfc0ef5 (latest) in the lazy-lock.json file and then LunarVim reverted it back again to 2ce3c9080cfe4a39c7907e672edafd2a95244a7c

How may I change the version/SHA?

@riverajohan
Copy link

I changed the commit SHA to this one 208504c7072ca81e8bf9fa2e666cf3436dfc0ef5 (latest) in the lazy-lock.json file and then LunarVim reverted it back again to 2ce3c9080cfe4a39c7907e672edafd2a95244a7c

How may I change the version/SHA?

What I did was installing lunarvim from the Master branch. https://www.lunarvim.org/docs/master/installation#nightly

@titanve
Copy link

titanve commented Nov 14, 2023

@riverajohan hi!

Do you mean the nightly version?

Thanks

@riverajohan
Copy link

riverajohan commented Nov 14, 2023

@riverajohan hi!

Do you mean the nightly version?

Thanks

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests