nvim-treesitter / nvim-treesitter

Nvim Treesitter configurations and abstraction layer
Apache License 2.0
10.6k stars 888 forks source link

Can't install parsers on Windows #6401

Closed mrsaibaandreas closed 6 months ago

mrsaibaandreas commented 6 months ago

Describe the bug

I am unable to install any parser from the nvim-treesitter module. The error

nvim-treesitter[lua]: Failed to execute the following command: { cmd = "cmd", opts = { args = { "/C", "move", "/Y", "parser.so", "C:\Users\mrsaiba\AppData\Local\nvim-data\site\pack\packer\start\nvim-treesitter\parser\\lua.so" }, cwd = "C:\Users\mrsaiba\AppData\Local\nvim-data\tree-sitter-lua", stdio = { [2] = <userdata 1>, [3] = <userdata 2> } } } The system cannot find the file specified.^M

This error persists for every language I try to install from the file treesitter.lua

require'nvim-treesitter.configs'.setup {
  -- A list of parser names, or "all" (the five listed parsers should always be installed)
  ensure_installed = { "c", "cpp", "bash", "xml", "json" },

  -- Install parsers synchronously (only applied to `ensure_installed`)
  sync_install = false,

  -- Automatically install missing parsers when entering buffer
  -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
  auto_install = true,

  highlight = {
    enable = true,

    -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
    -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
    -- Using this option may slow down your editor, and you may see some duplicate highlights.
    -- Instead of true it can also be a list of languages
    additional_vim_regex_highlighting = false,
  },
}

To Reproduce

To reproduce this behaviour is required only to start the nvim application (either CLI or from GUI) and run it on Windows.

Expected behavior

It is expected that all the parsers are successfully installed.

Output of :checkhealth nvim-treesitter

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

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- WARNING `node` executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `git` executable found.
- OK `gcc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: gcc (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r5) 13.2.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.15421",
  sysname = "Windows_NT",
  version = "Windows 10 Enterprise"
} ~

Parser/Features         H L F I J

  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.5
Build type: RelWithDebInfo
LuaJIT 2.1.1703942320
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe /MD /Zi /O2 /Ob1  -W3 -wd4311 -wd4146 -DUNIT_TESTING -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602 -DMSWIN -DINCLUDE_GENERATED_DECLARATIONS -ID:/a/neovim/neovim/.deps/usr/include/luajit-2.1 -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include -ID:/a/neovim/neovim/build/cmake.config -ID:/a/neovim/neovim/src -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include

   system vimrc file: "$VIM\sysinit.vim"
  fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"

Run :checkhealth for more info

H:\>

Additional context

I also want to mention that if I run :TSInstall I still get the same error. Another question, is normally to have .so files in Windows ?

clason commented 6 months ago

We cannot debug this for you, unfortunately. Please read the error message carefully and see if

  1. the mentioned files exist or not
  2. the mentioned commands work if entered manually.

And please read https://github.com/nvim-treesitter/nvim-treesitter/wiki/Windows-support; we do not and cannot support every flavor of Windows -- it's purely best effort.

(And, yes, .so is fine on Windows; it's just a name and makes the implementation easier.)

mrsaibaandreas commented 6 months ago

Thank you for your answer. I'll also leave this logs, maybe other people have the same issue as me.

Error executing vim.schedule lua callback: ...s\Neovim\share\nvim\runtime/lua/vim/treesitter/query.lua:259: query: invalid structure at position 3026 for language lua stack traceback: [C]: in function '_ts_parse_query' ...s\Neovim\share\nvim\runtime/lua/vim/treesitter/query.lua:259: in function 'get' ...m\share\nvim\runtime/lua/vim/treesitter/languagetree.lua:114: in function 'new' ...m Files\Neovim\share\nvim\runtime/lua/vim/treesitter.lua:61: in function '_create_parser' ...m Files\Neovim\share\nvim\runtime/lua/vim/treesitter.lua:131: in function 'get_parser' ...\start\telescope.nvim/lua/telescope/previewers/utils.lua:141: in function 'ts_highlighter' ...\start\telescope.nvim/lua/telescope/previewers/utils.lua:119: in function 'highlighter' ...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:248: in function 'cb' vim/_editor.lua:263: in function <vim/_editor.lua:262>

clason commented 6 months ago

That's unrelated.

mrsaibaandreas commented 6 months ago

Ok, thanks. I'll close the issue