-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Neovim snap version
nvim v0.11.5 (Rev 4611, latest/stable, classic)
Description
The snap package bundles treesitter query files (queries/vim/highlights.scm) that reference node types not present in the bundled vim.so parser. This causes errors on startup for any plugin that triggers vim filetype treesitter parsing (e.g. noice.nvim).
Errors
.../usr/share/nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 130:4. Invalid node type: "substitute"
.../usr/share/nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 256:3. Impossible pattern: (parameter) @keyword)
.../usr/share/nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 318:3. Impossible pattern: "=" @keyword)
Root cause
The file /snap/nvim/4611/usr/share/nvim/runtime/queries/vim/highlights.scm (362 lines) references node types that the bundled parser at /snap/nvim/4611/usr/share/nvim/runtime/parser/vim.so does not support. The query file and parser are from different versions and are out of sync.
Specific incompatibilities found:
- Line 130:
"substitute"- invalid node type - Line 255-256:
(script (parameter) @keyword)- impossible pattern - Line 317-318:
"=" @keywordinlua_statement- impossible pattern
Expected behaviour
The bundled query files and parsers should be from matching versions so that no query errors occur on a clean install.
Workaround
Create a local override at ~/.config/nvim/queries/vim/highlights.scm using the compatible version from the nvim-treesitter repository:
mkdir -p ~/.config/nvim/queries/vim
curl -sL https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/master/queries/vim/highlights.scm \
-o ~/.config/nvim/queries/vim/highlights.scmNeovim resolves the local file before the snap's bundled version, bypassing the mismatch.
Additional notes
- The nvim-treesitter plugin cannot fix this by installing an updated parser because the snap's bundled parsers take precedence in the runtime path
- Even with
snap install nvim --classic, the issue persists since the bundled files are inside the read-only snap mount at/snap/nvim/ - Related upstream issues: Invalid node type "tab" for vim parser after commit 8cdffc6d nvim-treesitter/nvim-treesitter#8369, treesitter: noisy "Invalid node type" error neovim#27235
Environment
- Ubuntu 24.04 LTS
snap install nvim --classic(also reproduced without--classic)- Plugins triggering the error: noice.nvim (any plugin using treesitter vim queries would trigger it)