@@ -60,6 +60,8 @@ function M:update()
60
60
self :help ()
61
61
elseif mode == " profile" then
62
62
self :profile ()
63
+ elseif mode == " debug" then
64
+ self :debug ()
63
65
else
64
66
for _ , section in ipairs (Sections ) do
65
67
self :section (section )
@@ -109,7 +111,7 @@ function M:title()
109
111
end
110
112
self :nl ()
111
113
112
- if View .mode ~= " help" and View .mode ~= " profile" then
114
+ if View .mode ~= " help" and View .mode ~= " profile" and View . mode ~= " debug " then
113
115
if self .progress .done < self .progress .total then
114
116
self :append (" Tasks: " , " LazyH2" )
115
117
self :append (self .progress .done .. " /" .. self .progress .total , " LazyMuted" )
@@ -208,8 +210,8 @@ function M:reason(reason, opts)
208
210
end
209
211
end
210
212
end
211
- local time = " " .. math.floor (( reason .time or 0 ) / 1e6 * 100 ) / 100 .. " ms"
212
- if not opts .time_right then
213
+ local time = reason . time and ( " " .. math.floor (reason .time / 1e6 * 100 ) / 100 .. " ms" )
214
+ if time and not opts .time_right then
213
215
self :append (time , " Bold" )
214
216
end
215
217
self :append (" " )
@@ -227,10 +229,6 @@ function M:reason(reason, opts)
227
229
local value = reason [key ]
228
230
if type (key ) == " number" then
229
231
elseif key == " require" then
230
- -- self:append("require", "@function.builtin")
231
- -- self:append("(", "@punctuation.bracket")
232
- -- self:append('"' .. value .. '"', "@string")
233
- -- self:append(")", "@punctuation.bracket")
234
232
elseif key ~= " time" then
235
233
if first then
236
234
first = false
@@ -239,8 +237,10 @@ function M:reason(reason, opts)
239
237
end
240
238
if key == " event" then
241
239
value = value :match (" User (.*)" ) or value
240
+ elseif key == " ft" then
241
+ value = value :match (" FileType (.*)" ) or value
242
242
end
243
- local hl = " LazyLoader " .. key :sub (1 , 1 ):upper () .. key :sub (2 )
243
+ local hl = " LazyHandler " .. key :sub (1 , 1 ):upper () .. key :sub (2 )
244
244
local icon = Config .options .ui .icons [key ]
245
245
if icon then
246
246
self :append (icon .. " " , hl )
@@ -251,7 +251,7 @@ function M:reason(reason, opts)
251
251
end
252
252
end
253
253
end
254
- if opts .time_right then
254
+ if time and opts .time_right then
255
255
self :append (time , " Bold" )
256
256
end
257
257
-- self:append(")", "Conceal")
@@ -432,4 +432,37 @@ function M:profile()
432
432
end
433
433
end
434
434
435
+ function M :debug ()
436
+ self :append (" Active Handlers" , " LazyH2" ):nl ()
437
+ self
438
+ :append (
439
+ " This shows only the lazy handlers that are still active. When a plugin loads, its handlers are removed" ,
440
+ " Comment" ,
441
+ { indent = 2 }
442
+ )
443
+ :nl ()
444
+
445
+ Util .foreach (require (" lazy.core.handler" ).handlers , function (type , handler )
446
+ Util .foreach (handler .active , function (value , plugins )
447
+ if not vim .tbl_isempty (plugins ) then
448
+ plugins = vim .tbl_values (plugins )
449
+ table.sort (plugins )
450
+ self :append (" ●" , " LazySpecial" , { indent = 2 })
451
+ self :reason ({ [type ] = value }, { time_right = true })
452
+ for _ , plugin in pairs (plugins ) do
453
+ self :reason ({ plugin = plugin }, { time_right = true })
454
+ end
455
+ self :nl ()
456
+ end
457
+ end )
458
+ end )
459
+ self :nl ()
460
+ self :append (" Cache" , " LazyH2" ):nl ()
461
+ local Cache = require (" lazy.core.cache" )
462
+ Util .foreach (Cache .cache , function (modname , entry )
463
+ local kb = math.floor (# entry .chunk / 10.24 ) / 100
464
+ self :append (" ● " , " LazySpecial" , { indent = 2 }):append (modname ):append (" " .. kb .. " Kb" , " Bold" ):nl ()
465
+ end )
466
+ end
467
+
435
468
return M
0 commit comments