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