feat(cache): remove any mentions of lazy. Move the cache to cache/luac instead of cache/lazy/luac

This commit is contained in:
Folke Lemaitre 2023-03-14 13:07:56 +01:00
parent 1a34636094
commit 49dda8751e
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 7 additions and 3 deletions

View File

@ -12,8 +12,9 @@ local M = {}
---@field paths? string[] Extra paths to search for modname ---@field paths? string[] Extra paths to search for modname
M.VERSION = 2 M.VERSION = 2
M.path = vim.fn.stdpath("cache") .. "/lazy/luac" M.path = vim.fn.stdpath("cache") .. "/luac"
M.enabled = false M.enabled = false
---@type table<string, {total:number, time:number, [string]:number?}?>
M.stats = { M.stats = {
find = { total = 0, time = 0, not_found = 0 }, find = { total = 0, time = 0, not_found = 0 },
} }
@ -147,7 +148,7 @@ function Cache.loader(modname)
return chunk or error(err) return chunk or error(err)
end end
M.track("loader", start) M.track("loader", start)
return "\nlazy_loader: module " .. modname .. " not found" return "\ncache_loader: module " .. modname .. " not found"
end end
-- The `package.loaders` loader for libs -- The `package.loaders` loader for libs
@ -171,7 +172,7 @@ function Cache.loader_lib(modname)
return chunk or error(err) return chunk or error(err)
end end
M.track("loader_lib", start) M.track("loader_lib", start)
return "\nlazy_loader_lib: module " .. modname .. " not found" return "\ncache_loader_lib: module " .. modname .. " not found"
end end
-- `loadfile` using the cache -- `loadfile` using the cache
@ -347,6 +348,9 @@ function M.enable()
break break
end end
end end
-- TODO: add an autocmd on BufWritePost that checks if its in a /lua folder
-- if thats the case, then reset the plugin path.
-- This will make sure we can properly load new top-level lua modules
end end
-- Disables the cache: -- Disables the cache: