refactor: new cache

This commit is contained in:
Folke Lemaitre 2023-02-13 10:50:39 +01:00
parent e115f5ec17
commit 983e1c5e34
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
6 changed files with 237 additions and 177 deletions

View file

@ -242,9 +242,11 @@ end
function M.find_root(modname)
local Cache = require("lazy.core.cache")
local rtp = vim.deepcopy(Cache.get_rtp())
vim.list_extend(rtp, M.get_unloaded_rtp(modname))
local modpath = Cache.find(modname, { rtp = rtp, patterns = { "", ".lua" } })
local modpath = Cache.find(modname, {
rtp = true,
paths = M.get_unloaded_rtp(modname),
patterns = { "", ".lua" },
})
if modpath then
local root = modpath:gsub("/init%.lua$", ""):gsub("%.lua$", "")
return root