fix(treesitter): return correct match table in iter_captures()

This commit is contained in:
Lewis Russell
2024-03-25 22:06:31 +00:00
committed by Lewis Russell
parent c4e1930851
commit 7d97150084
7 changed files with 123 additions and 34 deletions

View File

@@ -36,15 +36,19 @@ end
--- @generic F: function
--- @param hash integer|string|fun(...): any
--- @param fn F
--- @param strong? boolean
--- @return F
return function(hash, fn)
return function(hash, fn, strong)
vim.validate({
hash = { hash, { 'number', 'string', 'function' } },
fn = { fn, 'function' },
})
---@type table<any,table<any,any>>
local cache = setmetatable({}, { __mode = 'kv' })
local cache = {}
if not strong then
setmetatable(cache, { __mode = 'kv' })
end
hash = resolve_hash(hash)