Skip to content

@property for lua won't work #875

Description

@luiza177

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions