mirror of https://github.com/folke/lazy.nvim.git
perf: when reloading plugin specs always use cache
This commit is contained in:
parent
e897524b1f
commit
060cf23aca
|
@ -92,6 +92,10 @@ function M.loader(modname)
|
|||
return chunk or error(err)
|
||||
end
|
||||
|
||||
function M.require(modname)
|
||||
return M.loader(modname)()
|
||||
end
|
||||
|
||||
function M.idx()
|
||||
-- update our loader position if needed
|
||||
if package.loaders[M.loader_idx] ~= M.loader then
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
local Config = require("lazy.core.config")
|
||||
local Util = require("lazy.core.util")
|
||||
local Handler = require("lazy.core.handler")
|
||||
local Cache = require("lazy.core.cache")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
@ -217,7 +218,7 @@ function M.spec()
|
|||
---@diagnostic disable-next-line: no-unknown
|
||||
package.loaded[modname] = nil
|
||||
Util.try(function()
|
||||
spec:normalize(require(modname))
|
||||
spec:normalize(Cache.require(modname))
|
||||
end, "Failed to load **" .. modname .. "**")
|
||||
end
|
||||
local path_plugins = vim.fn.stdpath("config") .. "/lua/" .. Config.spec:gsub("%.", "/")
|
||||
|
|
Loading…
Reference in New Issue