This commit is contained in:
Oleksandr Smirnov 2025-03-23 19:01:47 +02:00
parent 327a59dda1
commit 8c4993363e
No known key found for this signature in database

View file

@ -50,9 +50,9 @@ 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 id, n in query:iter_captures(node, bufnr) do for id, _node in query:iter_captures(node, bufnr) do
if query.captures[id] == "_name" then if query.captures[id] == "_name" then
res["name"] = vim.treesitter.get_node_text(n, bufnr) res["name"] = vim.treesitter.get_node_text(_node, bufnr)
end end
if query.captures[id] == "_var" then if query.captures[id] == "_var" then
@ -74,8 +74,7 @@ end
---@param query string ---@param query string
---@return gopher.TsResult ---@return gopher.TsResult
local function do_stuff(bufnr, parent_type, query) local function do_stuff(bufnr, parent_type, query)
local parser = vim.treesitter.get_parser(bufnr, "go") if not vim.treesitter.get_parser(bufnr, "go") then
if not parser then
error "No treesitter parser found for go" error "No treesitter parser found for go"
end end