Skip to content

Commit

Permalink
fix: lookup now returns deep copy (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Aug 28, 2024
1 parent 8b6af27 commit dac14fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/lz/n/handler/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local handlers = {

---@param name string
---@param opts? lz.n.lookup.Opts
---@return lz.n.Plugin?
---@return lz.n.Plugin | nil
function M.lookup(name, opts)
---@type string | string[] | nil
local filter = opts and vim.tbl_get(opts, "filter")
Expand All @@ -26,7 +26,8 @@ function M.lookup(name, opts)
:totable()
or vim.tbl_values(handlers)
---@cast filter string[] | nil
return vim
---@type lz.n.Plugin | nil
local result = vim
.iter(handler_list)
---@param handler lz.n.Handler
:map(function(handler)
Expand All @@ -36,6 +37,7 @@ function M.lookup(name, opts)
:find(function(result)
return result ~= nil
end)
return result and vim.deepcopy(result)
end

---@param spec lz.n.PluginSpec
Expand Down

0 comments on commit dac14fb

Please sign in to comment.