luaneovimtreesitterneovim-plugin

What Should I Do to Fix Unknown Error was Caused by Treesitter


When I use Neovim with treesitter plugin to edit lua file, it show these error info

Error detected while processing BufNewFile Autocommands for "*":
Error executing lua callback: C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:21: Error executing lua: C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:22: BufNewFile Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: Failed to load parser for language 'lua': uv_dlopen: C:\Users\CoolPlayLin\AppData\Local\nvim-data\site\pack\packer\start\nvim-treesitter\parser\lua.so is not a valid Win32 application.

stack traceback:
        [C]: in function '_ts_add_language'
        ...eovim\share\nvim\runtime/lua/vim/treesitter/language.lua:99: in function 'add'
        ...m\share\nvim\runtime/lua/vim/treesitter/languagetree.lua:98: 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'
        ...m Files\Neovim\share\nvim\runtime/lua/vim/treesitter.lua:459: in function 'start'
        ...\start\nvim-treesitter/lua/nvim-treesitter/highlight.lua:20: in function 'attach'
        ...er\start\nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
        ...er\start\nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
        ...er\start\nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...er\start\nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
        [C]: in function 'nvim_cmd'
        C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:22: in function <C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:21>
        [C]: in function 'nvim_buf_call'
        C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:21: in function <C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_cmd'
        C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:22: in function <C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:21>
        [C]: in function 'nvim_buf_call'
        C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:21: in function <C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:21: in function <C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:10>

These error only be caused when I edit lua file.

My config is in: https://github.com/CoolPlayLin/CoolPlayLin/tree/master/src/nvim/

What should I do to fix it or avoid it?

I'd like launch Neovim with lua file without any error caused


Solution

  • I've found the way to resolve this issue

    require("nvim-treesitter.install").compilers = {"clang", "gcc"}
    
    Scoop install gcc
    
    :TSInstall lua