From a7585880081a8ae3dfbecfced960dcfdc124c361 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 24 Apr 2023 07:54:21 +0200 Subject: [PATCH] fix(build): make sure to properly load handlers for plugins that were built during startup. Fixes #744 --- lua/lazy/core/handler/init.lua | 7 ++++--- lua/lazy/core/loader.lua | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/lazy/core/handler/init.lua b/lua/lazy/core/handler/init.lua index 5e9074b..af85820 100644 --- a/lua/lazy/core/handler/init.lua +++ b/lua/lazy/core/handler/init.lua @@ -25,7 +25,7 @@ function M.setup() end for _, plugin in pairs(Config.plugins) do Util.try(function() - M.enable(plugin) + M.enable(plugin, true) end, "Failed to setup handlers for " .. plugin.name) end end @@ -40,8 +40,9 @@ function M.disable(plugin) end ---@param plugin LazyPlugin -function M.enable(plugin) - if not plugin._.loaded then +---@param force? boolean +function M.enable(plugin, force) + if force or not plugin._.loaded then for type, handler in pairs(M.handlers) do if plugin[type] then handler:add(plugin) diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index 6e3b653..03f1105 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -70,7 +70,7 @@ function M.install_missing() end end require("lazy.manage").install({ wait = true, lockfile = true }) - -- remove and installed plugins from indexed, so cache will index again + -- remove any installed plugins from indexed, so cache will index again for _, p in pairs(Config.plugins) do if p._.installed then Cache.reset(p.dir)