fix(build): make sure to properly load handlers for plugins that were built during startup. Fixes #744

This commit is contained in:
Folke Lemaitre 2023-04-24 07:54:21 +02:00
parent a55ab60625
commit a758588008
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 4 deletions

View File

@ -25,7 +25,7 @@ function M.setup()
end end
for _, plugin in pairs(Config.plugins) do for _, plugin in pairs(Config.plugins) do
Util.try(function() Util.try(function()
M.enable(plugin) M.enable(plugin, true)
end, "Failed to setup handlers for " .. plugin.name) end, "Failed to setup handlers for " .. plugin.name)
end end
end end
@ -40,8 +40,9 @@ function M.disable(plugin)
end end
---@param plugin LazyPlugin ---@param plugin LazyPlugin
function M.enable(plugin) ---@param force? boolean
if not plugin._.loaded then function M.enable(plugin, force)
if force or not plugin._.loaded then
for type, handler in pairs(M.handlers) do for type, handler in pairs(M.handlers) do
if plugin[type] then if plugin[type] then
handler:add(plugin) handler:add(plugin)

View File

@ -70,7 +70,7 @@ function M.install_missing()
end end
end end
require("lazy.manage").install({ wait = true, lockfile = true }) 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 for _, p in pairs(Config.plugins) do
if p._.installed then if p._.installed then
Cache.reset(p.dir) Cache.reset(p.dir)