Skip to content

vimPlugins.nvim-treesitter: incomplete queries for javascript/typescript #478561

@yelite

Description

@yelite

Nixpkgs version

  • Unstable (26.05)

Describe the bug

With the recent nvim-treesitter master->main update #470883 , we now have a nvim-treesitter-grammars package for parsers and queries for installed grammars. Based on

queryPlugins = lib.pipe selectedGrammars [
(map (g: g.passthru.associatedQuery or null))
for each installed grammar, it will symlink at most one query into the nvim-treesitter-grammars package. There are special cases, like js/ts queries, which inherit the ecma query (https://github.com/nvim-treesitter/nvim-treesitter/blob/2ba5ec184609a96b513bf4c53a20512d64e27f39/runtime/queries/javascript/highlights.scm#L1). The ecma query is just a base query with no corresponding grammar.

This means the following package will miss the ecma query in nvim's runtime paths. The syntax highlighting will just fail silently.

pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [p.javascript])

For now, I am manually adding the ${nvim-treesitter}/runtime to rtp

      {
        plugin = my-treesitter;
        config = ''vim.opt.rtp:prepend("${my-treesitter}/runtime/")'';
        type = "lua";
      }

in my home manager neovim config to workaround this problem.

Steps to reproduce

use pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [p.javascript]), open a javascript file, turn on treesitter highlight. There will be no syntax highlighting and no error message.

Expected behaviour

the ecma query should be included when javascript/typescript grammar is installed

Screenshots

No response

Relevant log output

Additional context

No response

System metadata

  • system: "aarch64-darwin"
  • host os: Darwin 25.1.0, macOS 26.1
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.31.2+1
  • channels(root): "nixpkgs"
  • nixpkgs: /nix/store/0yj36irhwn225ywy1saz0gf5wr2ciz50-source

Notify maintainers

@HeitorAugustoLN @PerchunPak


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: tree-sitterTree-sitter is a parser generator tool and an incremental parsing library.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions