I'm trying to add a query to target key-value pairs in Lua, such as:
local test = {
foo = "bar"
}
So, in ~/.config/nvim/after/queries/lua/textobjects.scm I have this:
;;extends
(field
name: (identifier) @property.lhs
value: (_) @property.inner) @property.outer
In my textobjects config I have it assigned like so:
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
-- ...
["av"] = { query = "@property.outer", desc = "Outer property" },
["iv"] = { query = "@property.inner", desc = "Value" },
["lv"] = { query = "@property.lhs", desc = "Key" },
-- ...
},
},
-- ...
})
I've checked the query with :EditQuery, I've tried :TSEditQueryUserAfter which points to the correct file. In theory, if I go civ at foo, I should be able to change "bar" to whatever. I've checked with :InspectTree, but nothing happens. :checkhealth nvim-treesitter looks all good. I've also tried changing the ;;extends line to pretty much every variation of 1 or 2 ;, with or without spaces, nothing seems to help. What am I missing?
I'm trying to add a query to target key-value pairs in Lua, such as:
So, in
~/.config/nvim/after/queries/lua/textobjects.scmI have this:In my textobjects config I have it assigned like so:
I've checked the query with
:EditQuery, I've tried:TSEditQueryUserAfterwhich points to the correct file. In theory, if I gocivatfoo, I should be able to change"bar"to whatever. I've checked with:InspectTree, but nothing happens.:checkhealth nvim-treesitterlooks all good. I've also tried changing the;;extendsline to pretty much every variation of 1 or 2;, with or without spaces, nothing seems to help. What am I missing?