ebynapura
ebynapura

Reputation: 3

Why neovim plug treesitter don't work on WINDOWS?

I'm trying to use the treesitter plugin of neovim on windows, but it doesn't work, error as follows: c.so is not a valid Win32 application python.so is not a valid Win32 application

I did some research which says perhaps there are something wrong with the compiler, but i don't known how to fix the problem, anyone help me?

Upvotes: 0

Views: 7380

Answers (1)

Monsieur Merso
Monsieur Merso

Reputation: 2176

Probably something messed up during compilation of grammar files, to try to fix this issue, do following steps:

  • Ensure that you have appropriate compiler installed and treesitter is configured to work with it:

    • I use clang compiler that is being installed together with llvm
    • Make sure that clang is in PATH. Try running
      clang --version
      
      it should output something like this:
      clang version 13.0.0
      Target: x86_64-pc-windows-msvc
      Thread model: posix
      InstalledDir: C:\Program Files\LLVM\bin
      
    • Make sure that treesitter configured to use clang, for that in your treesitter configuration you have to set following:
      if vim.loop.os_uname().sysname == "Windows_NT" then
         require('nvim-treesitter.install').compilers = { "clang" }
      end
      
      Note: I use here if, because I use same configuration files both on windows and on linux environments.
  • Reinstall treesitter plugin (do it according to your plugin manager)

    • Make sure that old grammar files are no longer there: Example path for packer plugin manager:
      %USERPROFILE%\AppData\Local\nvim-data\site\pack\packer\start\nvim-treesitter
      

Reinstall required parsers with :TSInstall command, that is probably it.

Upvotes: 1

Related Questions