File tree 3 files changed +34
-9
lines changed
3 files changed +34
-9
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,12 @@ function M.setup()
33
33
-- install missing plugins
34
34
if Config .options .install .missing then
35
35
Util .track (" install" )
36
+ local count = 0
36
37
while M .install_missing () do
38
+ count = count + 1
39
+ if count > 5 then
40
+ break
41
+ end
37
42
end
38
43
Util .track ()
39
44
end
51
56
-- multiple rounds can happen when importing a spec from a missing plugin
52
57
function M .install_missing ()
53
58
for _ , plugin in pairs (Config .plugins ) do
54
- if not plugin ._ .installed then
59
+ if not ( plugin ._ .installed or Plugin . has_errors ( plugin )) then
55
60
for _ , colorscheme in ipairs (Config .options .install .colorscheme ) do
56
61
if pcall (vim .cmd .colorscheme , colorscheme ) then
57
62
break
@@ -64,8 +69,6 @@ function M.install_missing()
64
69
Cache .indexed [p .dir ] = nil
65
70
end
66
71
end
67
- -- clear plugins. no need to merge in this stage
68
- Config .plugins = {}
69
72
-- reload plugins
70
73
Plugin .load ()
71
74
return true
Original file line number Diff line number Diff line change @@ -326,4 +326,14 @@ function M.find(path)
326
326
end
327
327
end
328
328
329
+ --- @param plugin LazyPlugin
330
+ function M .has_errors (plugin )
331
+ for _ , task in ipairs (plugin ._ .tasks or {}) do
332
+ if task .error then
333
+ return true
334
+ end
335
+ end
336
+ return false
337
+ end
338
+
329
339
return M
Original file line number Diff line number Diff line change 1
1
local Config = require (" lazy.core.config" )
2
2
local Manage = require (" lazy.manage" )
3
3
local Util = require (" lazy.util" )
4
+ local Plugin = require (" lazy.core.plugin" )
4
5
local Git = require (" lazy.manage.git" )
5
6
6
7
local M = {}
@@ -31,13 +32,24 @@ function M.fast_check(opts)
31
32
end
32
33
33
34
function M .check ()
34
- Manage .check ({
35
- show = false ,
36
- concurrency = Config .options .checker .concurrency ,
37
- }):wait (function ()
38
- M .report ()
35
+ local errors = false
36
+ for _ , plugin in pairs (Config .plugins ) do
37
+ if Plugin .has_errors (plugin ) then
38
+ errors = true
39
+ break
40
+ end
41
+ end
42
+ if errors then
39
43
vim .defer_fn (M .check , Config .options .checker .frequency * 1000 )
40
- end )
44
+ else
45
+ Manage .check ({
46
+ show = false ,
47
+ concurrency = Config .options .checker .concurrency ,
48
+ }):wait (function ()
49
+ M .report ()
50
+ vim .defer_fn (M .check , Config .options .checker .frequency * 1000 )
51
+ end )
52
+ end
41
53
end
42
54
43
55
--- @param notify ? boolean
You can’t perform that action at this time.
0 commit comments