Skip to content

Commit

Permalink
fix(cache): properly get rtp during fast events
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 29, 2022
1 parent 5533513 commit 95b9cf7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lua/lazy/core/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function M.find(modname)
local modpath = _find()
if not modpath then
-- update rtp
local rtp = vim.api.nvim_list_runtime_paths()
local rtp = M.list_rtp()
if #rtp ~= M.indexed_rtp then
M.indexed_rtp = #rtp
local updated = false
Expand Down Expand Up @@ -283,10 +283,7 @@ end

-- returns the cached RTP excluding plugin dirs
function M.get_rtp()
if vim.in_fast_event() then
return M.rtp or {}
end
local rtp = vim.api.nvim_list_runtime_paths()
local rtp = M.list_rtp()
if not M.rtp or #rtp ~= M.rtp_total then
M.rtp_total = #rtp
M.rtp = {}
Expand All @@ -313,6 +310,10 @@ function M.get_rtp()
return M.rtp
end

function M.list_rtp()
return vim.api.nvim_get_runtime_file("", true)
end

---@param opts? LazyConfig
function M.setup(opts)
-- no fancy deep extend here. just set the options
Expand Down

0 comments on commit 95b9cf7

Please sign in to comment.