fix: properly setup handlers when loading a plugin before startup (build) etc

This commit is contained in:
Folke Lemaitre 2023-09-27 12:39:39 +02:00
parent 2a9354c7d2
commit 24f6b6f1c7
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 17 additions and 5 deletions

View file

@ -34,6 +34,7 @@ function M.setup()
-- load the plugins
Plugin.load()
Handler.init()
-- install missing plugins
if Config.options.install.missing then
@ -301,6 +302,12 @@ function M._load(plugin, reason, opts)
return
end
if not Handler.did_setup then
Util.try(function()
Handler.enable(plugin)
end, "Failed to setup handlers for " .. plugin.name)
end
---@diagnostic disable-next-line: assign-type-mismatch
plugin._.loaded = {}
for k, v in pairs(reason) do