Skip to content
This repository was archived by the owner on Jan 17, 2024. It is now read-only.
This repository was archived by the owner on Jan 17, 2024. It is now read-only.

Support offset! query directive #58

Description

@yara-blue

The offset directive (see :h offset!) is very useful for adjust a captures range however it does not change the range directly but instead adds a adjusted range to the content field to the metadata of the capture. Example query:

((string) @capture (#offset! @capture 0 1 0 -1))

This will adjust the range in the metadata to start one column later and end one column earlier. In python this gets the range of the string without the "

Currently the playground does not support this (probably because it uses node:range()). I think this could trivially be supported using:

local function range(node, meta)
	if meta.content ~= nil then
		return unpack(meta.content[1])
	else
		return node:range()
	end
end

I do not have the time right now but if you point me to where the query highlighting range is called I will drop in the change tomorrow and test it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions