mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
fix(debug): make debug.inpect work in fast events
This commit is contained in:
parent
bb5754738a
commit
b70edc29db
1 changed files with 5 additions and 9 deletions
|
@ -26,19 +26,15 @@ function M.inspect(...)
|
|||
local caller = debug.getinfo(1, "S")
|
||||
for level = 2, 10 do
|
||||
local info = debug.getinfo(level, "S")
|
||||
if
|
||||
info
|
||||
and info.source ~= caller.source
|
||||
and info.what ~= "C"
|
||||
and info.source ~= "lua"
|
||||
and info.source ~= "@" .. (vim.env.MYVIMRC or "")
|
||||
then
|
||||
if info and info.source ~= caller.source and info.what ~= "C" and info.source ~= "lua" then
|
||||
caller = info
|
||||
break
|
||||
end
|
||||
end
|
||||
local title = "Debug: " .. vim.fn.fnamemodify(caller.source:sub(2), ":~:.") .. ":" .. caller.linedefined
|
||||
Snacks.notify.warn(vim.inspect(len == 1 and obj[1] or len > 0 and obj or nil), { title = title, ft = "lua" })
|
||||
vim.schedule(function()
|
||||
local title = "Debug: " .. vim.fn.fnamemodify(caller.source:sub(2), ":~:.") .. ":" .. caller.linedefined
|
||||
Snacks.notify.warn(vim.inspect(len == 1 and obj[1] or len > 0 and obj or nil), { title = title, ft = "lua" })
|
||||
end)
|
||||
end
|
||||
|
||||
--- Run the current buffer or a range of lines.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue