mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat(cache): use vim.cache
everywhere. poly-fill when needed
This commit is contained in:
parent
4446d69c28
commit
ea1a044e3c
6 changed files with 14 additions and 15 deletions
|
@ -1,7 +1,6 @@
|
|||
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 Plugin = require("lazy.core.plugin")
|
||||
|
||||
---@class LazyCoreLoader
|
||||
|
@ -73,7 +72,7 @@ function M.install_missing()
|
|||
-- remove and installed plugins from indexed, so cache will index again
|
||||
for _, p in pairs(Config.plugins) do
|
||||
if p._.installed then
|
||||
Cache.reset(p.dir)
|
||||
vim.cache.reset(p.dir)
|
||||
end
|
||||
end
|
||||
-- reload plugins
|
||||
|
@ -346,7 +345,7 @@ function M.get_main(plugin)
|
|||
local normname = Util.normname(plugin.name)
|
||||
---@type string[]
|
||||
local mods = {}
|
||||
for modname, _ in pairs(Cache.lsmod(plugin.dir)) do
|
||||
for modname, _ in pairs(vim.cache.lsmod(plugin.dir)) do
|
||||
mods[#mods + 1] = modname
|
||||
local modnorm = Util.normname(modname)
|
||||
-- if we found an exact match, then use that
|
||||
|
@ -476,7 +475,7 @@ end
|
|||
---@param modname string
|
||||
function M.loader(modname)
|
||||
local paths = Util.get_unloaded_rtp(modname)
|
||||
local modpath, hash = Cache.find(modname, { rtp = false, paths = paths })
|
||||
local modpath, hash = vim.cache.find(modname, { rtp = false, paths = paths })
|
||||
if modpath then
|
||||
M.auto_load(modname, modpath)
|
||||
local mod = package.loaded[modname]
|
||||
|
@ -485,7 +484,7 @@ function M.loader(modname)
|
|||
return mod
|
||||
end
|
||||
end
|
||||
return Cache.load(modpath, { hash = hash })
|
||||
return vim.cache.load(modpath, { hash = hash })
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue