mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 02:38:46 +00:00
docs: docs for debug
This commit is contained in:
parent
4c7ed34f72
commit
14ecc90685
1 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,8 @@ local M = setmetatable({}, {
|
|||
end,
|
||||
})
|
||||
|
||||
-- Show a notification with a pretty printed dump of the object(s)
|
||||
-- with lua treesitter highlighting and the location of the caller
|
||||
function M.inspect(...)
|
||||
local len = select("#", ...) ---@type number
|
||||
local obj = { ... } ---@type unknown[]
|
||||
|
@ -28,6 +30,7 @@ function M.inspect(...)
|
|||
Snacks.notify.warn(vim.inspect(len == 1 and obj[1] or len > 0 and obj or nil), { title = title, ft = "lua" })
|
||||
end
|
||||
|
||||
-- Show a notification with a pretty backtrace
|
||||
function M.backtrace()
|
||||
local trace = {}
|
||||
for level = 2, 20 do
|
||||
|
@ -43,6 +46,9 @@ function M.backtrace()
|
|||
Snacks.notify.warn(#trace > 0 and (table.concat(trace, "\n")) or "", { title = "Backtrace" })
|
||||
end
|
||||
|
||||
-- Very simple function to profile a lua function.
|
||||
-- * **flush**: set to `true` to use `jit.flush` in every iteration.
|
||||
-- * **count**: defaults to 100
|
||||
---@param fn fun()
|
||||
---@param opts? {count?: number, flush?: boolean}
|
||||
function M.profile(fn, opts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue