mirror of https://github.com/folke/lazy.nvim.git
fix(install): dont try re-installing failed missing plugins during startup. Fixes #303
This commit is contained in:
parent
1fd80159d0
commit
c85f929bd9
|
@ -33,7 +33,12 @@ function M.setup()
|
|||
-- install missing plugins
|
||||
if Config.options.install.missing then
|
||||
Util.track("install")
|
||||
local count = 0
|
||||
while M.install_missing() do
|
||||
count = count + 1
|
||||
if count > 5 then
|
||||
break
|
||||
end
|
||||
end
|
||||
Util.track()
|
||||
end
|
||||
|
@ -51,7 +56,7 @@ end
|
|||
-- multiple rounds can happen when importing a spec from a missing plugin
|
||||
function M.install_missing()
|
||||
for _, plugin in pairs(Config.plugins) do
|
||||
if not plugin._.installed then
|
||||
if not (plugin._.installed or Plugin.has_errors(plugin)) then
|
||||
for _, colorscheme in ipairs(Config.options.install.colorscheme) do
|
||||
if pcall(vim.cmd.colorscheme, colorscheme) then
|
||||
break
|
||||
|
@ -64,8 +69,6 @@ function M.install_missing()
|
|||
Cache.indexed[p.dir] = nil
|
||||
end
|
||||
end
|
||||
-- clear plugins. no need to merge in this stage
|
||||
Config.plugins = {}
|
||||
-- reload plugins
|
||||
Plugin.load()
|
||||
return true
|
||||
|
|
|
@ -326,4 +326,14 @@ function M.find(path)
|
|||
end
|
||||
end
|
||||
|
||||
---@param plugin LazyPlugin
|
||||
function M.has_errors(plugin)
|
||||
for _, task in ipairs(plugin._.tasks or {}) do
|
||||
if task.error then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
local Config = require("lazy.core.config")
|
||||
local Manage = require("lazy.manage")
|
||||
local Util = require("lazy.util")
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
local Git = require("lazy.manage.git")
|
||||
|
||||
local M = {}
|
||||
|
@ -31,6 +32,16 @@ function M.fast_check(opts)
|
|||
end
|
||||
|
||||
function M.check()
|
||||
local errors = false
|
||||
for _, plugin in pairs(Config.plugins) do
|
||||
if Plugin.has_errors(plugin) then
|
||||
errors = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if errors then
|
||||
vim.defer_fn(M.check, Config.options.checker.frequency * 1000)
|
||||
else
|
||||
Manage.check({
|
||||
show = false,
|
||||
concurrency = Config.options.checker.concurrency,
|
||||
|
@ -39,6 +50,7 @@ function M.check()
|
|||
vim.defer_fn(M.check, Config.options.checker.frequency * 1000)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
---@param notify? boolean
|
||||
function M.report(notify)
|
||||
|
|
Loading…
Reference in New Issue