mirror of https://github.com/folke/lazy.nvim.git
fix(cache): only autoload when plugins have been parsed. Needed to support `import`
This commit is contained in:
parent
f6b0172e92
commit
0bc73db503
|
@ -81,12 +81,15 @@ function M.check_autoload(modname, modpath)
|
||||||
if plugin and modpath:find(plugin.dir, 1, true) == 1 then
|
if plugin and modpath:find(plugin.dir, 1, true) == 1 then
|
||||||
-- we're not interested in loader time, so calculate delta here
|
-- we're not interested in loader time, so calculate delta here
|
||||||
M.stats.autoload.time = M.stats.autoload.time + uv.hrtime() - start
|
M.stats.autoload.time = M.stats.autoload.time + uv.hrtime() - start
|
||||||
|
-- only autoload when plugins have been loaded
|
||||||
|
if #require("lazy.core.config").plugins > 0 then
|
||||||
if not plugin._.loaded then
|
if not 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
|
||||||
require("lazy.core.loader").load(plugin, { require = modname })
|
require("lazy.core.loader").load(plugin, { require = modname })
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue