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
|
-- install missing plugins
|
||||||
if Config.options.install.missing then
|
if Config.options.install.missing then
|
||||||
Util.track("install")
|
Util.track("install")
|
||||||
|
local count = 0
|
||||||
while M.install_missing() do
|
while M.install_missing() do
|
||||||
|
count = count + 1
|
||||||
|
if count > 5 then
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Util.track()
|
Util.track()
|
||||||
end
|
end
|
||||||
|
@ -51,7 +56,7 @@ end
|
||||||
-- multiple rounds can happen when importing a spec from a missing plugin
|
-- multiple rounds can happen when importing a spec from a missing plugin
|
||||||
function M.install_missing()
|
function M.install_missing()
|
||||||
for _, plugin in pairs(Config.plugins) do
|
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
|
for _, colorscheme in ipairs(Config.options.install.colorscheme) do
|
||||||
if pcall(vim.cmd.colorscheme, colorscheme) then
|
if pcall(vim.cmd.colorscheme, colorscheme) then
|
||||||
break
|
break
|
||||||
|
@ -64,8 +69,6 @@ function M.install_missing()
|
||||||
Cache.indexed[p.dir] = nil
|
Cache.indexed[p.dir] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- clear plugins. no need to merge in this stage
|
|
||||||
Config.plugins = {}
|
|
||||||
-- reload plugins
|
-- reload plugins
|
||||||
Plugin.load()
|
Plugin.load()
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -326,4 +326,14 @@ function M.find(path)
|
||||||
end
|
end
|
||||||
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
|
return M
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local Config = require("lazy.core.config")
|
local Config = require("lazy.core.config")
|
||||||
local Manage = require("lazy.manage")
|
local Manage = require("lazy.manage")
|
||||||
local Util = require("lazy.util")
|
local Util = require("lazy.util")
|
||||||
|
local Plugin = require("lazy.core.plugin")
|
||||||
local Git = require("lazy.manage.git")
|
local Git = require("lazy.manage.git")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
@ -31,13 +32,24 @@ function M.fast_check(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.check()
|
function M.check()
|
||||||
Manage.check({
|
local errors = false
|
||||||
show = false,
|
for _, plugin in pairs(Config.plugins) do
|
||||||
concurrency = Config.options.checker.concurrency,
|
if Plugin.has_errors(plugin) then
|
||||||
}):wait(function()
|
errors = true
|
||||||
M.report()
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if errors then
|
||||||
vim.defer_fn(M.check, Config.options.checker.frequency * 1000)
|
vim.defer_fn(M.check, Config.options.checker.frequency * 1000)
|
||||||
end)
|
else
|
||||||
|
Manage.check({
|
||||||
|
show = false,
|
||||||
|
concurrency = Config.options.checker.concurrency,
|
||||||
|
}):wait(function()
|
||||||
|
M.report()
|
||||||
|
vim.defer_fn(M.check, Config.options.checker.frequency * 1000)
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param notify? boolean
|
---@param notify? boolean
|
||||||
|
|
Loading…
Reference in New Issue