refactor(ts): make it work on nightly

This commit is contained in:
Oleksandr Smirnov 2025-03-23 18:39:39 +02:00
parent 25e2174bba
commit 65fc2904fb
No known key found for this signature in database

View file

@ -50,18 +50,15 @@ end
---@return {name:string, is_varstruct:boolean}
local function get_captures(query, node, bufnr)
local res = {}
for _, match, _ in query:iter_matches(node, bufnr) do
for capture_id, captured_node in pairs(match) do
local capture_name = query.captures[capture_id]
if capture_name == "_name" then
res["name"] = vim.treesitter.get_node_text(captured_node, bufnr)
for id, n in query:iter_captures(node, bufnr) do
if query.captures[id] == "_name" then
res["name"] = vim.treesitter.get_node_text(n, bufnr)
end
if capture_name == "_var" then
if query.captures[id] == "_var" then
res["is_varstruct"] = true
end
end
end
return res
end