nvim-treesitter / nvim-treesitter

Nvim Treesitter configurations and abstraction layer
Apache License 2.0
10.47k stars 879 forks source link

nvim-treesitter[wing]: Error during "tree-sitter generate" #5048

Closed particledecay closed 1 year ago

particledecay commented 1 year ago

Describe the bug

The specific error I get every time I open neovim:

nvim-treesitter[wing]: Error during "tree-sitter generate"
nodenv: version `18.16.0' is not installed (set by /home/myuser/.local/share/nvim/tree-sitter-wing/.node-version)
Node process exited with status 1

What I believe is happening here is that I use Nodenv to manage all my system's Node.js versions. However, the version I am currently using is 18.7.0. The development version that wing is using is 18.16.0, and they've added their .node-version to version control, thus forcing everyone using Nodenv (or nvm really, since they also have a .nvmrc file in there) to use explicitly 18.16.0 if any Node process attempts to use that library (such as treesitter).

I'm not sure if this is a behavior issue on treesitter's part (I note that the inclusion of wing is experimental), or an issue on wing's part (debatable whether it's a good idea to include .node-version in version control).

To Reproduce

  1. Install Nodenv and install a Node.js version that's not 18.16.0
  2. Set the global Node.js to that version (rather than using an OS-maintained package)
  3. Use the latest nvim-treesitter

Expected behavior

Treesitter works and does not generate errors

Output of :checkhealth nvim-treesitter

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

Installation ~
- OK `tree-sitter` found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v18.7.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 12.3.1 20230508 (Red Hat 12.3.1-1)
- 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 = "6.2.15-200.fc37.x86_64",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Thu May 11 15:56:33 UTC 2023"
} ~

Parser/Features         H L F I J
  - ada                 ✓ ✓ ✓ . .
  - agda                ✓ . ✓ . .
  - arduino             ✓ ✓ ✓ ✓ ✓
  - astro               ✓ ✓ ✓ ✓ ✓
  - awk                 ✓ . . . ✓
  - bash                ✓ ✓ ✓ . ✓
  - bass                ✓ ✓ ✓ ✓ ✓
  - beancount           ✓ . ✓ . .
  - bibtex              ✓ . ✓ ✓ .
  - bicep               ✓ ✓ ✓ ✓ ✓
  - blueprint           ✓ . . . .
  - c                   ✓ ✓ ✓ ✓ ✓
  - c_sharp             ✓ ✓ ✓ . ✓
  - capnp               ✓ ✓ ✓ ✓ ✓
  - chatito             ✓ ✓ ✓ ✓ ✓
  - clojure             ✓ ✓ ✓ . ✓
  - cmake               ✓ . ✓ ✓ .
  - comment             ✓ . . . .
  - commonlisp          ✓ ✓ ✓ . .
  - cooklang            ✓ . . . .
  - corn                ✓ ✓ ✓ ✓ .
  - cpon                ✓ ✓ ✓ ✓ ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - cuda                ✓ ✓ ✓ ✓ ✓
  - cue                 ✓ ✓ ✓ ✓ ✓
  - d                   ✓ . ✓ ✓ ✓
  - dart                ✓ ✓ ✓ ✓ ✓
  - devicetree          ✓ ✓ ✓ ✓ ✓
  - dhall               ✓ . ✓ . ✓
  - diff                ✓ . . . .
  - dockerfile          ✓ . . . ✓
  - dot                 ✓ . . . ✓
  - ebnf                ✓ . . . .
  - eex                 ✓ . . . ✓
  - elixir              ✓ ✓ ✓ ✓ ✓
  - elm                 ✓ . . . ✓
  - elsa                ✓ ✓ ✓ ✓ ✓
  - elvish              ✓ . . . ✓
  - embedded_template   ✓ . . . ✓
  - erlang              ✓ . ✓ . .
  - fennel              ✓ ✓ ✓ . ✓
  - firrtl              ✓ ✓ ✓ ✓ ✓
  - fish                ✓ ✓ ✓ ✓ ✓
  - foam                ✓ ✓ ✓ ✓ ✓
  - fortran             ✓ . ✓ ✓ .
  - fsh                 ✓ . . . .
  - func                ✓ . . . .
  - fusion              ✓ ✓ ✓ ✓ .
  - gdscript            ✓ ✓ ✓ ✓ ✓
  - git_config          ✓ . . . .
  - git_rebase          ✓ . . . ✓
  - gitattributes       ✓ . . . ✓
  - gitcommit           ✓ . . . ✓
  - gitignore           ✓ . . . .
  - gleam               ✓ ✓ ✓ ✓ ✓
  - glimmer             ✓ ✓ ✓ ✓ .
  - glsl                ✓ ✓ ✓ ✓ ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - godot_resource      ✓ ✓ ✓ . .
  - gomod               ✓ . . . ✓
  - gosum               ✓ . . . .
  - gowork              ✓ . . . ✓
  - graphql             ✓ . . ✓ ✓
  - groovy              ✓ . . . ✓
  - hack                ✓ . . . .
  - hare                ✓ ✓ ✓ ✓ ✓
  - haskell             ✓ . ✓ . ✓
  - haskell_persistent  ✓ . ✓ . .
  - hcl                 ✓ . ✓ ✓ ✓
  - heex                ✓ ✓ ✓ ✓ ✓
  - hjson               ✓ ✓ ✓ ✓ ✓
  - hlsl                ✓ ✓ ✓ ✓ ✓
  - hocon               ✓ . . . ✓
  - hoon                ✓ ✓ ✓ . .
  - html                ✓ ✓ ✓ ✓ ✓
  - htmldjango          ✓ . ✓ ✓ ✓
  - http                ✓ . . . ✓
  - ini                 ✓ . ✓ . .
  - ispc                ✓ ✓ ✓ ✓ ✓
  - janet_simple        ✓ ✓ ✓ . ✓
  - java                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - jq                  ✓ . . . ✓
  - jsdoc               ✓ . . . .
  - json                ✓ ✓ ✓ ✓ .
  - json5               ✓ . . . ✓
  - jsonc               ✓ ✓ ✓ ✓ ✓
  - jsonnet             ✓ . . . .
  - julia               ✓ ✓ ✓ ✓ ✓
  - kdl                 ✓ ✓ ✓ ✓ ✓
  - kotlin              ✓ ✓ ✓ . ✓
  - lalrpop             ✓ ✓ . . ✓
  - latex               ✓ . ✓ . ✓
  - ledger              ✓ . ✓ ✓ ✓
  - llvm                ✓ . . . .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - luadoc              ✓ . . . .
  - luap                ✓ . . . .
  - luau                ✓ ✓ ✓ ✓ ✓
  - m68k                ✓ ✓ ✓ . ✓
  - make                ✓ . ✓ . ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - matlab              ✓ ✓ ✓ ✓ ✓
  - menhir              ✓ . . . ✓
  - mermaid             ✓ . . . .
  - meson               ✓ . ✓ . ✓
  - mlir                ✓ ✓ . . .
  - nickel              ✓ . . ✓ .
  - ninja               ✓ . ✓ ✓ .
  - nix                 ✓ ✓ ✓ . ✓
  - norg                . . . . .
  - objc                ✓ ✓ ✓ ✓ ✓
  - ocaml               ✓ ✓ ✓ ✓ ✓
  - ocaml_interface     ✓ ✓ ✓ ✓ ✓
  - ocamllex            ✓ . . . ✓
  - odin                ✓ ✓ ✓ ✓ ✓
  - org                 . . . . .
  - pascal              ✓ ✓ ✓ ✓ ✓
  - passwd              ✓ . . . .
  - pem                 ✓ . ✓ . ✓
  - perl                ✓ . ✓ . ✓
  - php                 ✓ ✓ ✓ ✓ ✓
  - phpdoc              ✓ . . . .
  - pioasm              ✓ . . . ✓
  - po                  ✓ . ✓ . ✓
  - poe_filter          ✓ . ✓ ✓ ✓
  - pony                ✓ ✓ ✓ ✓ ✓
  - prisma              ✓ . . . .
  - proto               ✓ . ✓ . .
  - prql                ✓ . . . ✓
  - pug                 ✓ . . . ✓
  - puppet              ✓ ✓ ✓ ✓ ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - ql                  ✓ ✓ ✓ ✓ ✓
  - qmldir              ✓ . . . ✓
  - qmljs               ✓ . ✓ . .
  - query               ✓ ✓ ✓ ✓ ✓
  - r                   ✓ ✓ . ✓ ✓
  - racket              ✓ . ✓ . ✓
  - rasi                ✓ ✓ ✓ ✓ .
  - regex               ✓ . . . .
  - rego                ✓ . . . ✓
  - rnoweb              ✓ . ✓ . ✓
  - ron                 ✓ ✓ ✓ ✓ ✓
  - rst                 ✓ ✓ . . ✓
  - ruby                ✓ ✓ ✓ ✓ ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - scala               ✓ ✓ ✓ . ✓
  - scheme              ✓ . ✓ . ✓
  - scss                ✓ . ✓ ✓ .
  - slint               ✓ . . ✓ .
  - smali               ✓ ✓ ✓ ✓ ✓
  - smithy              ✓ . . . .
  - solidity            ✓ . . . .
  - sparql              ✓ ✓ ✓ ✓ ✓
  - sql                 ✓ . . ✓ ✓
  - squirrel            ✓ ✓ ✓ ✓ ✓
  - starlark            ✓ ✓ ✓ ✓ ✓
  - supercollider       ✓ ✓ ✓ ✓ ✓
  - surface             ✓ . ✓ ✓ ✓
  - svelte              ✓ . ✓ ✓ ✓
  - swift               ✓ ✓ . ✓ .
  - sxhkdrc             ✓ . ✓ . ✓
  - t32                 ✓ ✓ ✓ ✓ ✓
  - tablegen            ✓ ✓ ✓ ✓ ✓
  - teal                ✓ ✓ ✓ ✓ ✓
  - terraform           ✓ . ✓ ✓ ✓
  - thrift              ✓ ✓ ✓ ✓ ✓
  - tiger               ✓ ✓ ✓ ✓ ✓
  - tlaplus             ✓ ✓ ✓ . ✓
  - todotxt             ✓ . . . .
  - toml                ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - turtle              ✓ ✓ ✓ ✓ ✓
  - twig                ✓ . . . ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - ungrammar           ✓ ✓ ✓ ✓ ✓
  - usd                 ✓ ✓ ✓ ✓ .
  - uxntal              ✓ ✓ ✓ ✓ ✓
  - v                   ✓ ✓ ✓ ✓ ✓
  - vala                ✓ . ✓ . .
  - verilog             ✓ ✓ ✓ . ✓
  - vhs                 ✓ . . . .
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - vue                 ✓ . ✓ ✓ ✓
  - wgsl                ✓ . ✓ ✓ .
  - wgsl_bevy           ✓ . ✓ ✓ .
  - yaml                ✓ ✓ ✓ ✓ ✓
  - yang                ✓ . ✓ ✓ ✓
  - yuck                ✓ ✓ ✓ ✓ ✓
  - 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} ~

Output of nvim --version

NVIM v0.9.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno
-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=auto -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/usr/include/luajit-2.1 -I/usr/include -I/usr/include/luajit-2.1 -I/bui
lddir/build/BUILD/neovim-0.9.0/redhat-linux-build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.9.0/redhat-linux-build/include -I/builddir/build/BUILD/neovim-0.9.0/redhat-linux-build/cmake.config -I/builddir/build/BUILD/neovim-0.9.0/s
rc -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Additional context

No response

clason commented 1 year ago

Sorry, this is exactly the reason why you should not blindly install all parsers.

clason commented 1 year ago

@gshpychka

particledecay commented 1 year ago

Whether it's all or just this one, I fail to see how that invalidates the issue.

clason commented 1 year ago

It invalidates this as an nvim-treesitter issue (experimental parsers are marked experimental for a reason; don't install unless you know what you're getting into), as this is nothing we can do anything about.

It's a valid suggestion to make at the wing parser repo, if you care enough about wing.

gshpychka commented 1 year ago

The Wing team is currently considering extracting the grammar/parser into its own repo, which should fix this. That being said, this is still in the early stages and highly experimental, so don't install unless you need it.