fix: lazy cache (#3892)

* fix: lazy cache

* refactor: add pcall
This commit is contained in:
opalmay 2023-02-24 17:07:55 +02:00 committed by GitHub
parent d682ae0657
commit 2b1af90a97
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 13 deletions

View file

@ -48,23 +48,12 @@ function plugin_loader.init(opts)
vim.opt.runtimepath:append(join_paths(plugins_dir, "*"))
pcall(function()
-- set a custom path for lazy's cache and enable it
-- set a custom path for lazy's cache
local lazy_cache = require "lazy.core.cache"
lazy_cache.path = join_paths(get_cache_dir(), "lazy", "luac")
lazy_cache.enable()
end)
end
function plugin_loader.reset_cache()
-- TODO(kylo252): is this really necessary anymore?
local lazy_cache = require "lazy.core.cache"
local cache_path = lazy_cache.path
if utils.is_directory(cache_path) then
vim.fn.delete(cache_path, "rf")
vim.fn.mkdir(cache_path, "p")
end
end
function plugin_loader.reload(spec)
local Config = require "lazy.core.config"
local lazy = require "lazy"

View file

@ -27,7 +27,6 @@ end
---It also forces regenerating any template ftplugin files
---Tip: Useful for clearing any outdated settings
function M.reset_cache()
plugin_loader.reset_cache()
local lvim_modules = {}
for module, _ in pairs(package.loaded) do
if module:match "lvim.core" or module:match "lvim.lsp" then