From 74bc61ab97c3bc2e73e19d269f23076d50c3285f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 11 Jan 2023 13:43:57 +0100 Subject: [PATCH] fix(handlers): allow overriding handler values --- lua/lazy/core/handler/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/lazy/core/handler/init.lua b/lua/lazy/core/handler/init.lua index 0935f51..67ad44c 100644 --- a/lua/lazy/core/handler/init.lua +++ b/lua/lazy/core/handler/init.lua @@ -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) @@ -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