nvim-treesitter / nvim-treesitter

Nvim Treesitter configurations and abstraction layer
Apache License 2.0
10.41k stars 874 forks source link

[Bug] Invalid `injections.scm` scheme for `LaTeK` #6942

Closed pidgeon777 closed 1 month ago

pidgeon777 commented 1 month ago

Describe the bug

Some errors occurs when opening a Markdown file containing LaTeX syntax:

Error in decoration provider treesitter/highlighter.win:
Error executing lua: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 20:2. Invalid node type "luacode_environment":
(luacode_environment
 ^

stack traceback:
    [C]: in function '_ts_parse_query'
    .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn'
    ...vim/current/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn'
    ...vim/current/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'get'
    ...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:128: in function 'new'
    ...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:511: in function 'add_child'
    ...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:395: in function '_add_injections'
    ...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:447: in function 'parse'
    ...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:460: in function 'parse'
    ...nt/share/nvim/runtime/lua/vim/treesitter/highli

Also, opening C:\Users\<USERNAME>\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\latex\injections.scm reports those errors:

     ├╴  Invalid node type "luacode_environment" latex  [20, 2]
     ├╴  Invalid node type "asy_environment" latex  [24, 2]
     └╴  Invalid node type "asydef_environment" latex  [28, 2]

To Reproduce

Paste this line inside a Markdown buffer with treesitter enabled:

$t = \frac{L}{v}$

excluding the triple backtics.

Expected behavior

Should not report errors.

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.22.6 (b40f342067a89cd6331bf4c27407588320f3c263) (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v21.7.3 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (Rev3, Built by MSYS2 project) 14.1.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "10.0.22631",
  sysname = "Windows_NT",
  version = "Windows 11 Pro"
} ~

Parser/Features         H L F I J
  - ada                 ✓ ✓ ✓ . ✓
  - agda                ✓ . ✓ . ✓
  - angular             ✓ ✓ ✓ ✓ ✓
  - apex                ✓ ✓ ✓ . ✓
  - arduino             ✓ ✓ ✓ ✓ ✓
  - asm                 ✓ . . . ✓
  - astro               ✓ ✓ ✓ ✓ ✓
  - authzed             ✓ . . . ✓
  - awk                 ✓ . . . ✓
  - bash                ✓ ✓ ✓ . ✓
  - bass                ✓ ✓ ✓ ✓ ✓
  - beancount           ✓ . ✓ . ✓
  - bibtex              ✓ . ✓ ✓ ✓
  - bicep               ✓ ✓ ✓ ✓ ✓
  - bitbake             ✓ ✓ ✓ ✓ ✓
  - blueprint           ✓ . . . ✓
  - bp                  ✓ ✓ ✓ ✓ ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - c_sharp             ✓ ✓ ✓ . ✓
  - cairo               ✓ ✓ ✓ ✓ ✓
  - capnp               ✓ ✓ ✓ ✓ ✓
  - chatito             ✓ ✓ ✓ ✓ ✓
  - clojure             ✓ ✓ ✓ . ✓
  - cmake               ✓ . ✓ ✓ ✓
  - comment             ✓ . . . .
  - commonlisp          ✓ ✓ ✓ . ✓
  - cooklang            ✓ . . . ✓
  - corn                ✓ ✓ ✓ ✓ ✓
  - cpon                ✓ ✓ ✓ ✓ ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - csv                 ✓ . . . .
  - cuda                ✓ ✓ ✓ ✓ ✓
  - cue                 ✓ ✓ ✓ ✓ ✓
  - d                   ✓ ✓ ✓ ✓ ✓
  - d2                  ✓ ✓ ✓ ✓ ✓
  - dart                ✓ ✓ ✓ ✓ ✓
  - devicetree          ✓ ✓ ✓ ✓ ✓
  - dhall               ✓ . ✓ . ✓
  - diff                ✓ . . . ✓
  - disassembly         ✓ . . . ✓
  - djot                ✓ ✓ ✓ ✓ ✓
  - dockerfile          ✓ . . . ✓
  - dot                 ✓ . . ✓ ✓
  - doxygen             ✓ . . ✓ ✓
  - dtd                 ✓ ✓ ✓ . ✓
  - earthfile           ✓ . . . ✓
  - ebnf                ✓ . . . ✓
  - editorconfig        ✓ . ✓ . ✓
  - eds                 ✓ . ✓ . .
  - eex                 ✓ . . . ✓
  - elixir              ✓ ✓ ✓ ✓ ✓
  - elm                 ✓ . ✓ . ✓
  - elsa                ✓ ✓ ✓ ✓ ✓
  - elvish              ✓ . . . ✓
  - embedded_template   ✓ . . . ✓
  - erlang              ✓ . ✓ . ✓
  - facility            ✓ . ✓ ✓ ✓
  - faust               ✓ . . . ✓
  - fennel              ✓ ✓ ✓ . ✓
  - fidl                ✓ . ✓ . ✓
  - firrtl              ✓ ✓ ✓ ✓ ✓
  - fish                ✓ ✓ ✓ ✓ ✓
  - foam                ✓ ✓ ✓ ✓ ✓
  - forth               ✓ ✓ ✓ ✓ ✓
  - fortran             ✓ . ✓ ✓ ✓
  - fsh                 ✓ . . . ✓
  - func                ✓ . . . ✓
  - fusion              ✓ ✓ ✓ ✓ ✓
  - gdscript            ✓ ✓ ✓ ✓ ✓
  - gdshader            ✓ . . . ✓
  - git_config          ✓ . ✓ . ✓
  - git_rebase          ✓ . . . ✓
  - gitattributes       ✓ ✓ . . ✓
  - gitcommit           ✓ . . . ✓
  - gitignore           ✓ . . . ✓
  - gleam               ✓ ✓ ✓ ✓ ✓
  - glimmer             ✓ ✓ ✓ ✓ ✓
  - glsl                ✓ ✓ ✓ ✓ ✓
  - gn                  ✓ ✓ ✓ ✓ ✓
  - gnuplot             ✓ . . . ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - goctl               ✓ . ✓ ✓ ✓
  - godot_resource      ✓ ✓ ✓ . ✓
  - gomod               ✓ . . . ✓
  - gosum               ✓ . . . .
  - gotmpl              ✓ . . . ✓
  - gowork              ✓ . . . ✓
  - gpg                 ✓ . . . ✓
  - graphql             ✓ . . ✓ ✓
  - groovy              ✓ ✓ ✓ ✓ ✓
  - gstlaunch           ✓ . . . .
  - hack                ✓ . . . ✓
  - hare                ✓ ✓ ✓ ✓ ✓
  - haskell             ✓ ✓ ✓ . ✓
  - haskell_persistent  ✓ . ✓ . .
  - hcl                 ✓ . ✓ ✓ ✓
  - heex                ✓ ✓ ✓ ✓ ✓
  - helm                ✓ . . . ✓
  - hjson               ✓ ✓ ✓ ✓ ✓
  - hlsl                ✓ ✓ ✓ ✓ ✓
  - hlsplaylist         ✓ . . . ✓
  - hocon               ✓ . ✓ . ✓
  - hoon                ✓ ✓ ✓ . ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - htmldjango          ✓ . ✓ ✓ ✓
  - http                ✓ . . . ✓
  - hurl                ✓ . ✓ ✓ ✓
  - hyprlang            ✓ . ✓ ✓ ✓
  - idl                 ✓ . . ✓ ✓
  - ini                 ✓ . ✓ . ✓
  - inko                ✓ ✓ ✓ ✓ ✓
  - ispc                ✓ ✓ ✓ ✓ ✓
  - janet_simple        ✓ ✓ ✓ . ✓
  - java                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - jq                  ✓ ✓ . . ✓
  - jsdoc               ✓ . . . .
  - json                ✓ ✓ ✓ ✓ .
  - json5               ✓ . . . ✓
  - jsonc               ✓ ✓ ✓ ✓ ✓
  - jsonnet             ✓ ✓ ✓ . ✓
  - julia               ✓ ✓ ✓ ✓ ✓
  - just                ✓ ✓ ✓ ✓ ✓
  - kconfig             ✓ ✓ ✓ ✓ ✓
  - kdl                 ✓ ✓ ✓ ✓ ✓
  - kotlin              ✓ ✓ ✓ . ✓
  - koto                ✓ ✓ ✓ . ✓
  - kusto               ✓ . . . ✓
  - lalrpop             ✓ ✓ ✓ . ✓
  - latex               ✓ . ✓ . x
  - ledger              ✓ . ✓ ✓ ✓
  - leo                 ✓ . . ✓ ✓
  - linkerscript        ✓ ✓ ✓ ✓ ✓
  - liquid              ✓ . . . ✓
  - liquidsoap          ✓ ✓ ✓ ✓ ✓
  - llvm                ✓ . . . ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - luadoc              ✓ . . . .
  - luap                ✓ . . . .
  - luau                ✓ ✓ ✓ ✓ ✓
  - m68k                ✓ ✓ ✓ . ✓
  - make                ✓ . ✓ . ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - matlab              ✓ ✓ ✓ ✓ ✓
  - menhir              ✓ . . . ✓
  - mermaid             ✓ . . . ✓
  - meson               ✓ . ✓ ✓ ✓
  - mlir                ✓ ✓ . . ✓
  - muttrc              ✓ . . . ✓
  - nasm                ✓ . . . ✓
  - nginx               ✓ . ✓ . ✓
  - nickel              ✓ . . ✓ ✓
  - nim                 ✓ ✓ ✓ . ✓
  - nim_format_string   ✓ . . . ✓
  - ninja               ✓ . ✓ ✓ ✓
  - nix                 ✓ ✓ ✓ ✓ ✓
  - norg                . . . . .
  - nqc                 ✓ ✓ ✓ ✓ ✓
  - objc                ✓ ✓ ✓ ✓ ✓
  - objdump             ✓ . . . ✓
  - ocaml               ✓ ✓ ✓ ✓ ✓
  - ocaml_interface     ✓ ✓ ✓ ✓ ✓
  - ocamllex            ✓ . . . ✓
  - odin                ✓ ✓ ✓ ✓ ✓
  - org                 . . . . .
  - pascal              ✓ ✓ ✓ ✓ ✓
  - passwd              ✓ . . . .
  - pem                 ✓ . ✓ . ✓
  - perl                ✓ . ✓ . ✓
  - php                 ✓ ✓ ✓ ✓ ✓
  - php_only            ✓ ✓ ✓ ✓ ✓
  - phpdoc              ✓ . . . .
  - pioasm              ✓ . . . ✓
  - plantuml            . . . . .
  - po                  ✓ . ✓ . ✓
  - pod                 ✓ . . . .
  - poe_filter          ✓ . ✓ ✓ ✓
  - pony                ✓ ✓ ✓ ✓ ✓
  - printf              ✓ . . . .
  - prisma              ✓ . ✓ . ✓
  - problog             ✓ . ✓ ✓ ✓
  - prolog              ✓ . ✓ ✓ ✓
  - promql              ✓ . . . ✓
  - properties          ✓ ✓ . . ✓
  - proto               ✓ . ✓ . ✓
  - prql                ✓ . . . ✓
  - psv                 ✓ . . . .
  - pug                 ✓ . . . ✓
  - puppet              ✓ ✓ ✓ ✓ ✓
  - purescript          ✓ ✓ . . ✓
  - pymanifest          ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - ql                  ✓ ✓ ✓ ✓ ✓
  - qmldir              ✓ . . . ✓
  - qmljs               ✓ . ✓ . ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - r                   ✓ ✓ . ✓ ✓
  - racket              ✓ . ✓ . ✓
  - ralph               ✓ . . . ✓
  - rasi                ✓ ✓ ✓ ✓ ✓
  - rbs                 ✓ . ✓ ✓ ✓
  - re2c                ✓ ✓ ✓ ✓ ✓
  - readline            ✓ . ✓ ✓ ✓
  - regex               ✓ . . . .
  - rego                ✓ . . . ✓
  - requirements        ✓ . . . ✓
  - rnoweb              ✓ . ✓ . ✓
  - robot               ✓ . ✓ ✓ ✓
  - robots              ✓ . . . ✓
  - roc                 ✓ ✓ . . ✓
  - ron                 ✓ ✓ ✓ ✓ ✓
  - rst                 ✓ ✓ . . ✓
  - ruby                ✓ ✓ ✓ ✓ ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - scala               ✓ ✓ ✓ . ✓
  - scfg                ✓ . . . ✓
  - scheme              ✓ . ✓ . ✓
  - scss                ✓ . ✓ ✓ ✓
  - slang               ✓ ✓ ✓ ✓ ✓
  - slint               ✓ ✓ ✓ ✓ ✓
  - smali               ✓ ✓ ✓ ✓ ✓
  - smithy              ✓ . . . ✓
  - snakemake           ✓ ✓ ✓ ✓ ✓
  - solidity            ✓ . ✓ . ✓
  - soql                ✓ . . . .
  - sosl                ✓ . . . .
  - sourcepawn          ✓ ✓ . . ✓
  - sparql              ✓ ✓ ✓ ✓ ✓
  - sql                 ✓ . . ✓ ✓
  - squirrel            ✓ ✓ ✓ ✓ ✓
  - ssh_config          ✓ ✓ ✓ ✓ ✓
  - starlark            ✓ ✓ ✓ ✓ ✓
  - strace              ✓ . . . ✓
  - styled              ✓ . ✓ ✓ ✓
  - supercollider       ✓ ✓ ✓ ✓ ✓
  - surface             ✓ . ✓ ✓ ✓
  - svelte              ✓ ✓ ✓ ✓ ✓
  - swift               ✓ ✓ . ✓ ✓
  - sxhkdrc             ✓ . ✓ . ✓
  - systemtap           ✓ ✓ ✓ . ✓
  - t32                 ✓ ✓ ✓ ✓ ✓
  - tablegen            ✓ ✓ ✓ ✓ ✓
  - tact                ✓ ✓ ✓ ✓ ✓
  - tcl                 ✓ . ✓ ✓ ✓
  - teal                ✓ ✓ ✓ ✓ ✓
  - templ               ✓ . ✓ . ✓
  - terraform           ✓ . ✓ ✓ ✓
  - textproto           ✓ . ✓ ✓ ✓
  - thrift              ✓ ✓ ✓ ✓ ✓
  - tiger               ✓ ✓ ✓ ✓ ✓
  - tlaplus             ✓ ✓ ✓ . ✓
  - tmux                ✓ . . . ✓
  - todotxt             ✓ . . . .
  - toml                ✓ ✓ ✓ ✓ ✓
  - tsv                 ✓ . . . .
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - turtle              ✓ ✓ ✓ ✓ ✓
  - twig                ✓ . . . ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - typespec            ✓ . . ✓ ✓
  - typoscript          ✓ . ✓ ✓ ✓
  - typst               ✓ . ✓ ✓ ✓
  - udev                ✓ ✓ . . ✓
  - ungrammar           ✓ ✓ ✓ ✓ ✓
  - unison              ✓ . . . ✓
  - usd                 ✓ ✓ ✓ ✓ ✓
  - uxntal              ✓ ✓ ✓ ✓ ✓
  - v                   ✓ ✓ ✓ ✓ ✓
  - vala                ✓ . ✓ . ✓
  - vento               ✓ . . . ✓
  - verilog             ✓ ✓ ✓ . ✓
  - vhdl                ✓ . ✓ . ✓
  - vhs                 ✓ . . . ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - vue                 ✓ . ✓ ✓ ✓
  - wgsl                ✓ . ✓ ✓ ✓
  - wgsl_bevy           ✓ . ✓ ✓ .
  - wing                ✓ ✓ ✓ . ✓
  - wit                 ✓ . ✓ . ✓
  - xcompose            ✓ ✓ . . ✓
  - xml                 ✓ ✓ ✓ ✓ ✓
  - yaml                ✓ ✓ ✓ ✓ ✓
  - yang                ✓ . ✓ ✓ ✓
  - yuck                ✓ ✓ ✓ ✓ ✓
  - zathurarc           ✓ . . . ✓
  - zig                 ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

The following errors have been detected: ~
- ERROR latex(injections): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 20:2. Invalid node type "luacode_environment":
  (luacode_environment
   ^

  latex(injections) is concatenated from the following files:
  | [ERROR]:"C:\Users\g.cerqui\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\latex\injections.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 20:2. Invalid node type "luacode_environment":
  (luacode_environment
   ^

Output of nvim --version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Additional context

No response

clason commented 1 month ago

Duplicate of #3092