5

bad English (sorry). I'm trying to get nvim_treesitter to work on my windows machine, on my Linux one it worked great but now when I try on windows the :checkhealth nvim_treesitter gives:

health#nvim_treesitter#check

Installation

  • ERROR: tree-sitter executable not found
  • OK: git executable found.
  • ERROR: cc executable not found.
    • ADVICE:
      • Check that either gcc or clang is in your $PATH

Parser/Features H L F I

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

and I'm totally new to this thing, any advice would help:)

Noam E
  • 121
  • 1
  • 1
  • 4

4 Answers4

10

The main issue from my perspective is "ERROR: cc executable not found.". It means nvim_treesitter couldn't find any compiler on your machine, and so no parsers could be compiled and installed when you issue ":TSInstall {some_parser_name}" commands.

If you have Visual Studio installed (since nvim gets compiled by VS 2017, it's fine to have 2017 or 2019 studio, I guess), try this:

  • Run "x64 Native Tools Command Prompt for VS 201x" if you've downloaded nvim-win64 release package or "x86 Native Tools Command Prompt for VS 201x" otherwise (nvim-win32 package)

  • Run nvim in this command prompt (i.e. nvim-qt GUI)

  • Install any parsers you want, let's say ":TSInstall c". Output should look like this:

     Downloading...
     Compiling...
     Treesitter parser for c has been installed.
    
  • Optionally run :checkhealth nvim_treesitter again to see if everything is fine

Thereafter you can run nvim in any console, not via VS Tools one only (still use it to install or update parsers though).

Please also see https://github.com/nvim-treesitter/nvim-treesitter/wiki/Windows-support for various instructions.

Denis
  • 361
  • 4
  • 5
0

For the Error: tree-sitter: You can checkout creating parsers and follow the description or you download the windows binary of the binary files and put it into a directory on your PATH.

For the Error: cc: You need to install gcc

Zamino
  • 11
-1

Try to apply this vsc tutorial from Prerequisites №3 I had the same issue. It helped me.

Andrew O.
  • 171
  • 1
  • 9
-1

Ok, here's what I've done and what helped me: Go to https://www.msys2.org and follow ALL of the installation steps that are described there:

  1. Download and install
  2. Run pacman -Syu comman
  3. Run pacman -S --needed base-devel mingw-w64-x86_64-toolchain and choose mingw-w64-x86_64-gcc there.

After everything is installed, put into your PATH Environment Variable the path to MinGW64\bin folder (if you installed everything to the default folder it will be c:\msys64\mingw64\bin)

And you are good to go! Now open nvim and run

:TSInstall <yourlang>

For example, :TSInstall php

PS: you can get the list of available languages using :TSInstallInfo

Daniel Vygolov
  • 884
  • 2
  • 13
  • 26