Broken in neovim master with TypeScript treesitter
rawhat opened this issue · comments
Explain the issue
It's possible this is related to other languages as well, but I didn't encounter it with Elixir. It happens in both typescript
and typescriptreact
. It seems like the is_in_node_range
method from treesitter
changed to expect userdata
rather than a table. The error produced, and emitted with any cursor motion, is:
Error detected while processing InsertLeave Autocommands for "*"..function 4[71]..matchup#delim#get_current[1]..<SNR>96_get_delim_multi[3]..matchup#ts_engine#get_delim[3]..<SNR>91_forward:
line 1:
E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/treesitter.lua:204: node: expected userdata, got table
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
/usr/share/nvim/runtime/lua/vim/treesitter.lua:204: in function 'is_in_node_range'
...vim/lazy/vim-matchup/lua/treesitter-matchup/internal.lua:221: in function 'get_delim'
[string "luaeval()"]:1: in main chunk
Minimal working example
This works:
import * as React from 'react'
function Test<T,>() {
return <div /
}
but as soon as I put the closing angle bracket, the error is thrown. I'm not totally sure what the error case is for regular TypeScript file types, but a normal file I have does produce the error.
Minimal vimrc file
I'm on neovim
master.
My lazy config is effectively:
{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("plugins.treesitter") -- sets { matchup = true }
end,
},
{
"andymass/vim-matchup",
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
vim.api.nvim_set_var("matchup_matchparen_offscreen", { method = "popup" })
end,
},
Let me know if you need anything else! Thank you :)
Edit: Also, I know this change to that treesitter API got merged like super recently. So this may be on your radar already! Just wanted to flag it.
I can't seem to reproduce this.. it works for me.
I wonder if it's caused by using lazy? Previous users have reported that it takes the last release, instead of HEAD which might cause issues.
I just pushed a new release in case that makes lazy pick up the recent changes.
I do seem to be on v0.7.2 that you just pushed, and do still see the issue. Also sorry, should have linked the pertinent neovim commit!
OK, thanks rawhat@ and zeertzjq@ for pointing me to the issue. It is a shame, since this piece of code operates on both nodes and ranges (for synthetically defined multi-node matches). There are probably other issues along these lines.
I just pushed a change fef9f33, can anyone test it please?
No longer errors for C now.
Same, works great for TS(X) for me now! Thank you :)