mirror of https://github.com/folke/lazy.nvim.git
fix(loader): dont autoload when lazy handlers have not been setup yet. Fixes #1132
This commit is contained in:
parent
c059eece0c
commit
daab5fe280
|
@ -16,6 +16,7 @@ M.init_done = false
|
||||||
M.disabled_rtp_plugins = { packer_compiled = true }
|
M.disabled_rtp_plugins = { packer_compiled = true }
|
||||||
---@type table<string,string>
|
---@type table<string,string>
|
||||||
M.did_ftdetect = {}
|
M.did_ftdetect = {}
|
||||||
|
M.did_handlers = false
|
||||||
|
|
||||||
function M.disable_rtp_plugin(plugin)
|
function M.disable_rtp_plugin(plugin)
|
||||||
M.disabled_rtp_plugins[plugin] = true
|
M.disabled_rtp_plugins[plugin] = true
|
||||||
|
@ -56,6 +57,7 @@ function M.setup()
|
||||||
-- setup handlers
|
-- setup handlers
|
||||||
Util.track("handlers")
|
Util.track("handlers")
|
||||||
Handler.setup()
|
Handler.setup()
|
||||||
|
M.did_handlers = true
|
||||||
Util.track()
|
Util.track()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -498,8 +500,11 @@ function M.auto_load(modname, modpath)
|
||||||
local plugin = Plugin.find(modpath)
|
local plugin = Plugin.find(modpath)
|
||||||
if plugin and modpath:find(plugin.dir, 1, true) == 1 then
|
if plugin and modpath:find(plugin.dir, 1, true) == 1 then
|
||||||
plugin._.rtp_loaded = true
|
plugin._.rtp_loaded = true
|
||||||
-- don't load if we're loading specs or if the plugin is already loaded
|
-- don't load if:
|
||||||
if not (Plugin.loading or plugin._.loaded) then
|
-- * handlers haven't been setup yet
|
||||||
|
-- * we're loading specs
|
||||||
|
-- * the plugin is already loaded
|
||||||
|
if M.did_handlers and not (Plugin.loading or plugin._.loaded) then
|
||||||
if plugin.module == false then
|
if plugin.module == false then
|
||||||
error("Plugin " .. plugin.name .. " is not loaded and is configured with module=false")
|
error("Plugin " .. plugin.name .. " is not loaded and is configured with module=false")
|
||||||
end
|
end
|
||||||
|
@ -508,9 +513,7 @@ function M.auto_load(modname, modpath)
|
||||||
error("You're trying to load `" .. plugin.name .. "` for which `cond==false`")
|
error("You're trying to load `" .. plugin.name .. "` for which `cond==false`")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param modname string
|
---@param modname string
|
||||||
|
|
Loading…
Reference in New Issue