1

I want to get information about the tree sitter. Among them, I want to get the value of @punctuation.delimiter. How can I get it?

https://github.com/nvim-treesitter/nvim-treesitter/blob/419153c1f1992ced7f9462d92f0d7505c6ff3137/queries/rust/highlights.scm#L131

In the above case, ":":",""." I want to get the string ":",";",",","".

1 Answers1

0

You can simply check it by comparing the name of this "decorator" with the character type of the node:

for _, match, _ in query:iter_matches(parent_node, 0, start_row, end_row) do
    for id, node in pairs(match) do
        if character_type == 'punctuation.delimiter' then
            -- do your stuff
        end
    end
end

Here's is an example how I tried to "access" those "decorators" in my query files.

TornaxO7
  • 1,150
  • 9
  • 24