From 82da5a004867be2cc96c345430d9381f991cf2e6 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 4 Oct 2023 12:50:46 +0200 Subject: [PATCH] refactor(plugin): refactored rebuild --- lua/lazy/core/plugin.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 0517aa3..95a21ec 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -172,8 +172,14 @@ function Spec:warn(msg) end --- Rebuilds a plugin spec excluding any removed fragments ----@param name string +---@param name? string function Spec:rebuild(name) + if not name then + for n, _ in pairs(self.dirty) do + self:rebuild(n) + end + self.dirty = {} + end local plugin = self.plugins[name] if not plugin then return @@ -292,11 +298,11 @@ function Spec:fix_disabled() end self:fix_optional() - -- rebuild any plugin specs that were modified - for name, _ in pairs(self.dirty) do - self:rebuild(name) - end + self:rebuild() + self:fix_cond() + self:rebuild() + self.dirty = {} for _, plugin in pairs(self.plugins) do @@ -311,9 +317,7 @@ function Spec:fix_disabled() end -- rebuild any plugin specs that were modified - for name, _ in pairs(self.dirty) do - self:rebuild(name) - end + self:rebuild() end ---@param msg string