mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
perf(loader): re-use topmod cache to find setup()
module
This commit is contained in:
parent
887c602957
commit
730bb84364
2 changed files with 15 additions and 10 deletions
|
@ -1,6 +1,7 @@
|
|||
local Util = require("lazy.core.util")
|
||||
local Config = require("lazy.core.config")
|
||||
local Handler = require("lazy.core.handler")
|
||||
local Cache = require("lazy.core.cache")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
@ -204,19 +205,17 @@ function M.config(plugin)
|
|||
end
|
||||
else
|
||||
local normname = Util.normname(plugin.name)
|
||||
---@type table<string, string>
|
||||
---@type string[]
|
||||
local mods = {}
|
||||
Util.ls(plugin.dir .. "/lua", function(_, modname)
|
||||
modname = modname:gsub("%.lua$", "")
|
||||
mods[modname] = modname
|
||||
for _, modname in ipairs(Cache.get_topmods(plugin.dir)) do
|
||||
mods[#mods + 1] = modname
|
||||
local modnorm = Util.normname(modname)
|
||||
-- if we found an exact match, then use that
|
||||
if modnorm == normname then
|
||||
mods = { modname }
|
||||
return false
|
||||
break
|
||||
end
|
||||
end)
|
||||
mods = vim.tbl_values(mods)
|
||||
end
|
||||
if #mods == 1 then
|
||||
fn = function()
|
||||
local opts = plugin.config
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue