Skip to content

Commit

Permalink
fix: finder filter functions should work on items inside of result table
Browse files Browse the repository at this point in the history
rather than the result table as a whole
  • Loading branch information
winter-again committed Mar 3, 2024
1 parent 802f6fe commit a23402f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lua/lspsaga/finder/box.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ function M.filter(method, results)
end
local retval = {}
for client_id, item in pairs(results) do
retval[client_id] = { result = fn(item.result) }
-- NOTE: by the example, fn(client_id, result) is supp to return a bool
-- and if the results tbl = { { result = { {...}, {...}, ... } } }
-- likely want to allow user to filter using the members of the result table
-- rather than all the results
for _, result_member in ipairs(item.result) do
if fn(client_id, result_member) == true then
if retval[client_id] == nil then
retval[client_id] = { result = { result_member } }
else
table.insert(retval[client_id].result, result_member)
end
end
end
end
return retval
end
Expand Down

0 comments on commit a23402f

Please sign in to comment.