Open PMassicotte opened 4 days ago
I updated my plugins and can replicate the bug. I removed R.nvim
and cmp-r
from my lazy.nvim
config and the bug remains. So, the problem seems to be with nvim-treesitter
.
I deleted the nvim-treesitter
directory (~/.local/share/nvim/lazy/nvim-treesitter
). Everything was installed again by lazy.nvim
and the error messages disappeared.
Not fixed from on my own side
better to remove some of the plugins that may be conflicting with nvim.tressitter, I remove hlargs.nvim and restarted nvim, everything is back to normal.
after the bug report I wrote was closed, I was referred to their pined comment this https://github.com/nvim-treesitter/nvim-treesitter/issues/3092 so you may check it out also to diagnose what the issue may be
just using
"nvim-treesitter/nvim-treesitter",
commit = "173515a5d2be6e98c2996189f77ee5993620e2aa",
for now
Did you try:
cd ~/.local/share/nvim/lazy
rm -rf nvim-treesitter/
My nvim-treesitter
config:
{
"nvim-treesitter/nvim-treesitter",
tag = nil,
branch = "master",
run = ":TSUpdate",
config = function ()
require("nvim-treesitter.configs").setup({
sync_install = true,
ensure_installed = {
"bash",
"c",
"css",
"html",
"json",
"latex",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"r",
"rnoweb",
"vim",
"vimdoc",
"yaml",
},
highlight = {
enable = true,
},
})
vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.foldenable = false
end
},
Yes. I tried it and get the same error. Looks like the bug is known per discussions going on in the PR. It works for you? Have you tried to re-update all plugins after re-instslling them?
It fixed the bug here. I didn't uninstall any other plugins. I only deleted nvim-treesitter
directory and let lazy.nvim
install it again. I'm using the development version of Neovim.
I feel like I've been having some version of this issue as well. I initially fixed it, I thought, by deleting the nvim-treesitter
directory, but now I'm getting errors again. When I delete the nvim-treesitter
directory, and reinstall treesitter, I first get this error:
nvim-treesitter[r]: Error during tarball extraction.
tar (child): tree-sitter-r.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
but once I close and reopen an R file, it goes back to the previous error (and then there's no syntax highlighting):
Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 12:2
. Invalid node type "if":
(if
^
stack traceback:
[C]: in function '_ts_parse_query'
/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn'
/usr/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn'
/usr/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'get_query'
...r-textobjects/lua/nvim-treesitter/textobjects/shared.lua:99: in function 'available_textobjects'
...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:173: in function 'attach'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
[C]: in function 'nvim_cmd'
/usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>
[C]: in function 'pcall'
vim/shared.lua: in function <vim/shared.lua:0>
[C]: in function '_with'
/usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function '_with'
/usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
I should point out that everything was working absolutely fine until treesitter updated. Other file types also seem to be fine.
Apologies, it seems that my issue is with nvim-treesitter-textobjects
, not R.nvim
.
treesitter-r
has been updated, and it breaks nvim-treesitter
. Looks like they are working on it.
In my case, at least, disabling nvim-treesitter-textobjects
means I no longer have error messages. When following the advice here , the result of :echo nvim_get_runtime_file('queries/<lang>/*.scm', v:true)
includes subdirectories of that plugin that are not under nvim-treesitter
. Unless I'm confusing things.
How do you disable textobjects?
I either comment out the dependency within the nvim-treesitter
plugin setup, or I comment out the textobjects = { }
table. Either means that the R file loads without errors, and with syntax highlighting.
Got it! The thing is I am using textobjecsts a lot!
Oh, I'd rather not have to disable it! I just don't know whether I should report it there too. Did disabling it fix it for you too?
yes it worked, but went back to an older commit of treesitter (see above) until they fix it. See https://github.com/nvim-treesitter/nvim-treesitter/pull/6774
Going back to that commit in treesitter for some reason still didn't work for me...
Are you using lazy? If so make sure you run :Lazy update
.
Ah, yes, that did it. Thanks!
I am getting this error now:
Introduced by this PR: https://github.com/nvim-treesitter/nvim-treesitter/commit/5373c90c55a33408604d17713edaa9560306b83d