Reputation: 759
I'm currently using Neovim 6.0. And I also use the following neovim-config : https://github.com/rafi/vim-config.
After installation, I created a python program to test and a problem encountered which are as follows:
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
Upvotes: 54
Views: 90590
Reputation: 71
None of these answers worked for me.
I just did TSDisable highlight
and the errors went away.
Also, syntax highlighting (c++) still remained afterwards 🤷♂️
Upvotes: 0
Reputation: 21
Had the same problem recently: Ran :checkhealth
to find that one of my plugins needed NeoVim v.0.10.
Afterwhich, running :checkhealth
again will list your TreeSitter parsers as missing, which requires a tedious job: Running TSInstall <parser>
again.
Upvotes: 2
Reputation: 494
A bit annoying that the master branch of that neovim repo causes errors but I replaced the treesitter.lua
config of the master branch with:
-- treesitter.lua
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = {
"c",
"lua",
"vim",
"vimdoc",
"query",
"elixir",
"heex",
"javascript",
"html",
"python",
"yaml",
"xml",
"ruby",
"markdown",
"cmake",
"typescript",
},
sync_install = false,
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
ignore_install = {},
modules = {},
})
end,
}
Then another :Lazy sync
and :TSUpdate
and all errors were gone. Of course :checkhealth
always gives some direction too :)
Upvotes: 0
Reputation: 21
It happens to me! While typing :help
or :h xxx-xxx
and executing it, problem will happen!
Just delete the built-in parser like c.dll
/lua.dll
/query.dll
/vim.dll
/vimdoc.dll
in Neovim\lib\nvim\parser
. Then all will be OK!
Upvotes: 2
Reputation: 1
In my configuration I resolved these errors by prepending my personal directory to the runtime path, so that they were used before the ones installed with nvim
-- The tree-sitter cli is configured to look in this directory, so we want nvim to share
local tsDir = vim.fs.normalize("$LOCALAPPDATA\\tree-sitter", { expand_env = true })
vim.opt.runtimepath:prepend(tsDir)
require("nvim-treesitter.configs").setup({
parser_install_dir = tsDir,
...
Upvotes: 0
Reputation: 1
Maybe you need "vim" and "vimdoc" in ensure_installed
. It helped me.
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local config = require("nvim-treesitter.configs")
config.setup({
ensure_installed = {"lua", "go", "javascript", "vim", "c", "vimdoc"},
highlight = { enable = true },
indent = { enable = true }
})
end
}
Upvotes: 0
Reputation: 1
Run :TSUpdate
than :checkhealth
if it show error with treesitter try :TSInstall vim
it will ask you to reinstall, the quit and reopen vim and it should work,
I have found error in treesitter with gcc that i didn't know about and this soveled it as well
Upvotes: 0
Reputation: 434
Same thing happened right after I ran :PackerSync
command to upgrade all my nvim plugins(I use packer for managing plugins, YMMV). It seemed like treesitter
introduced some breaking changes in the latest commits.
I ran :checkhealth
and found errors for rust, javascript, typescript, and tsx.
I tried to re-install those parsers by running :TSInstall rust javascript typescript tsx
, and rebooted my nvim. And it resolved the issue.
Upvotes: 0
Reputation: 101
I ran :checkhealth
and found this:
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} ~
The following errors have been detected: ~
- ERROR vimdoc(highlights): ...im/0.9.4/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 615 for language vimdoc
vimdoc(highlights) is concatenated from the following files: | [ERROR]:"/Users/stevencamillieri/.local/share/nvim/lazy/nvim-treesitter/queries/vimdoc/highlights.scm", failed to load: ...im/0.9.4/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 615 for language vimdoc
so I ran :TSUpdate vimdoc
as instructed and it's fixed!
Upvotes: 10
Reputation: 3405
I've faced the same issue, I've removed the Markdown parser which is not installed by the nvim-treesitter
(as it told me when I run :TSUninstall
markdown) and that's fixed my issue, because there's no parser to run when I open markdown files now, of course this is not a solution for you if you care to have a Markdown parser.
sudo rm /usr/local/lib/nvim/parser/markdown.so
sudo rm /usr/local/lib/nvim/parser/markdown_inline.so
Upvotes: 0
Reputation: 911
I did :checkhealth
and figured out that "c" and "lua" are failing for treesitter, so I changed my config as
-- plugins/treesitter.lua
local config = require 'nvim-treesitter.configs'
config.setup {
...
ignore_install = { "c", "lua" },
highlight = {
....,
disable = { "c", "lua" },
},
}
and the error was gone
Upvotes: 0
Reputation: 432
You can also experience similar treesitter errors when installing nvim via snap. See here. In my case, I used the snap package because the latest neovim version on Ubuntu was significantly out of date.
If this is your case, you can install the latest version of neovim using the PPA repo.
sudo snap remove nvim
sudo add-apt-repository ppa:neovim-ppa/unstable
sudo apt-get update
sudo apt-get install neovim
Note: This installs the latest, "unstable" version of neovim, which could have bugs. You could use the "stable" PPA, but it is also out of date.
See also here for other ways of installing neovim without using the native Ubuntu package manager.
Upvotes: 3
Reputation: 33
What worked for me is similar to that answered by Oleksiy, except add vim
to the ensure_installed
table instead of cmake
Upvotes: 0
Reputation: 320
Remember, in treesitter 'c', 'help', 'lua', and 'vim' are part of the core functionality of Neovim. But that means if you are seeing this error, a sure fire way to make sure they are all installed is to run:
:TSInstall c help lua vim
Upvotes: 20
Reputation: 51
For me helped adding cmake to ensure_installed in the treesitter
config section of .config/nvim/init.lua
:
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'cmake' },
Configuration was based on https://github.com/nvim-lua/kickstart.nvim
Upvotes: 5
Reputation: 611
I just solved it using :TSInstall vim
.
Actually, run :checkhealth
and the error in there would help in figuring out what is missing.
Upvotes: 43
Reputation: 1829
I had a similar issue. I ran :TSUpdate
in Neovim to update Treesitter plugin and the error message disapear after relaunching.
Upvotes: 172