Skip to content

Commit

Permalink
fix(handlers): allow overriding handler values
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 11, 2023
1 parent 3b44c3c commit 74bc61a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lua/lazy/core/handler/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@ end

---@param plugin LazyPlugin
function M:add(plugin)
local values = {}
for _, value in ipairs(plugin[self.type] or {}) do
local key = self:key(value)
values[key] = value
end

for key, value in pairs(values) do
if not self.active[key] then
self.active[key] = {}
self:_add(value)
Expand All @@ -89,7 +94,13 @@ end

---@param plugin LazyPlugin
function M:del(plugin)
local values = {}
for _, value in ipairs(plugin[self.type] or {}) do
local key = self:key(value)
values[key] = value
end

for key, value in pairs(values) do
local key = self:key(value)
if self.active[key] and self.active[key][plugin.name] then
self.active[key][plugin.name] = nil
Expand Down

0 comments on commit 74bc61a

Please sign in to comment.