Skip to content

Bug: Bundled treesitter query files are incompatible with bundled parsers #50

@paul-mc

Description

@paul-mc

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: "=" @keyword in lua_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.scm

Neovim resolves the local file before the snap's bundled version, bypassing the mismatch.

Additional notes

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions