Lua unable to delete table field
matthewsia98 opened this issue · comments
Describe the bug
Lua @parameter.inner
/ @parameter.outer
keymaps not working
I can see that the query is matching the right thing
E5108: Error executing lua: /usr/local/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/local/share/nvim/runtime/lua/vim/treesitter.lua:204: in function 'is_in_node_range'
...r-textobjects/lua/nvim-treesitter/textobjects/shared.lua:142: in function 'best_match_at_point'
...r-textobjects/lua/nvim-treesitter/textobjects/shared.lua:240: in function 'textobject_at_point'
...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:103: in function 'select_textobject'
...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:184: in function <...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:183>
To Reproduce
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
-- add any other plugins here
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" },
config = function()
require("nvim-treesitter.configs").setup({
textobjects = {
select = {
enable = true,
keymaps = {
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
},
},
},
})
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Steps to reproduce the behavior:
- Place cursor on a table field
- Press
daa
Expected behavior
Table field should get deleted
Output of :checkhealth nvim-treesitter
==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- OK
tree-sitter
found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
- OK
node
found v17.0.1 (only needed for :TSInstallFromGrammar)
- OK
git
executable found.
- OK
cc
executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (GCC) 12.2.1 20230201
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "6.2.2-arch1-1",
sysname = "Linux",
version = "#1 SMP PREEMPT_DYNAMIC Fri, 03 Mar 2023 15:58:31 +0000"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- help ✓ . . . ✓
- lua ✓ ✓ ✓ ✓ ✓
- markdown ✓ . ✓ . ✓
- markdown_inline ✓ . . . ✓
- norg . . . . .
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- regex ✓ . . . .
- toml ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
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} ~
Output of nvim --version
NVIM v0.9.0-dev-1166+g06aed7c17
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/home/msia/repos/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/home/msia/repos/neovim/.deps/usr/include -I/home/msia/repos/neovim/build/src/nvim/auto -I/home/msia/repos/neovim/build/include -I/home/msia/repos/neovim/build/cmake.config -I/home/msia/repos/neovim/src -I/usr/include -I/home/msia/repos/neovim/.deps/usr/include -I/home/msia/repos/neovim/.deps/usr/include -I/home/msia/repos/neovim/.deps/usr/include -I/home/msia/repos/neovim/.deps/usr/include -I/home/msia/repos/neovim/.deps/usr/include -I/home/msia/repos/neovim/.deps/usr/include
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
Run :checkhealth for more info
Additional context
Add any other context about the problem here.
Does it still happen when you use the latest nightly neovim?
seems to be working after building latest nightly
Encountered the same error, went away with the latest nightly. ty!