如何解决Neovim配置中的treesitter/highlighter: Error executing lua问题

我当前正在使用Neovim 6.0,同时我也使用以下的neovim-config: https://github.com/rafi/vim-config

安装后,我创建了一个python程序进行测试,遇到了一个问题,具体如下所示:

treesitter/highlighter: Error executing lua: ...im/0.6.0/share/nvim/runtime/lua/vim/treesitter/query.lua:161: query: invalid node type at position 5622 ~ pdb~ ⮡ Snippet [VSnip] st

原文链接 https://stackoverflow.com/questions/70373650

点赞
stackoverflow用户12678926
stackoverflow用户12678926

我遇到了类似的问题。我在 Neovim 中运行了 :TSUpdate 命令来更新 Treesitter 插件,在重新启动后,错误消息消失了。

2022-01-16 20:23:29
stackoverflow用户4830637
stackoverflow用户4830637

我刚刚使用:TSInstall vim解决了它。

实际上,运行 :checkhealth 命令,里面的错误会帮助你找出缺少什么东西。

2022-12-23 20:04:58
stackoverflow用户18932559
stackoverflow用户18932559

对我而言,在 .config/nvim/init.luatreesitter 配置部分将 cmake 添加到 ensure_installed 参数中是有用的:

-- [[ 配置 Treesitter ]]
-- 查看 `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
  -- 在这里添加要为 treesitter 安装的语言
  ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'cmake' },

这个配置是基于 https://github.com/nvim-lua/kickstart.nvim

2023-01-01 15:29:17
stackoverflow用户484961
stackoverflow用户484961

请记住,在 Treesitter 中,'c'、'help'、'lua' 和 'vim' 是 Neovim 核心功能的一部分。但这也意味着,如果您遇到此错误,确保它们都已安装的方法是运行以下命令:

:TSInstall c help lua vim
2023-01-12 05:44:58