mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat(profile): added accurate startuptime to ui/stats/docs
This commit is contained in:
parent
d1739cb7e1
commit
a2fdf369f2
6 changed files with 103 additions and 11 deletions
|
@ -1,9 +1,11 @@
|
|||
---@type LazyCommands
|
||||
local M = {}
|
||||
M._start = 0
|
||||
|
||||
---@param spec LazySpec Should be a module name to load, or a plugin spec
|
||||
---@param opts? LazyConfig
|
||||
function M.setup(spec, opts)
|
||||
M._start = M._start == 0 and vim.loop.hrtime() or M._start
|
||||
if vim.g.lazy_did_setup then
|
||||
return vim.notify(
|
||||
"Re-sourcing your config is not supported with lazy.nvim",
|
||||
|
@ -62,14 +64,7 @@ function M.setup(spec, opts)
|
|||
end
|
||||
|
||||
function M.stats()
|
||||
local ret = { count = 0, loaded = 0 }
|
||||
for _, plugin in pairs(require("lazy.core.config").plugins) do
|
||||
ret.count = ret.count + 1
|
||||
if plugin._.loaded then
|
||||
ret.loaded = ret.loaded + 1
|
||||
end
|
||||
end
|
||||
return ret
|
||||
return require("lazy.stats").stats()
|
||||
end
|
||||
|
||||
function M.bootstrap()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue