Skip to content

Commit

Permalink
fix: dont add debug info recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 16, 2022
1 parent 03c463a commit 6991e3e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lua/noice/config/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ M.formats = {
---@class NoiceFormatOptions
M.defaults = {
---@class NoiceFormatOptions.debug
debug = {},
debug = {
enabled = true,
},
---@class NoiceFormatOptions.level
level = {
hl_group = {
Expand Down
10 changes: 8 additions & 2 deletions lua/noice/text/format/formatters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ end
---@param message NoiceMessage
---@param opts NoiceFormatOptions.progress
function M.progress(message, opts)
local contents = require("noice.text.format").format(message, opts.contents)
local contents = require("noice.text.format").format(message, opts.contents, {
debug = { enabled = false },
})
local value = vim.tbl_get(message.opts, unpack(vim.split(opts.key, ".", { plain = true })))
if type(value) == "number" then
local width = math.max(opts.width, contents:width() + 2)
Expand Down Expand Up @@ -108,7 +110,11 @@ function M.date(message, opts)
end

---@param message NoiceMessage
function M.debug(message)
---@param opts NoiceFormatOptions.debug
function M.debug(message, opts)
if not opts.enabled then
return
end
local blocking, reason = Util.is_blocking()
local debug = {
message:is({ cleared = true }) and "" or "",
Expand Down
2 changes: 1 addition & 1 deletion lua/noice/text/format/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ end
---@param opts? NoiceFormatOptions
---@return NoiceMessage
function M.format(message, format, opts)
opts = vim.tbl_deep_extend("force", Config.options.format, opts or {})
opts = vim.tbl_deep_extend("force", vim.deepcopy(Config.options.format), opts or {})

format = format or "default"

Expand Down
3 changes: 3 additions & 0 deletions lua/noice/view/mini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ end

function MiniView:show()
for _, message in ipairs(self._messages) do
-- we already have debug info,
-- so make sure we dont regen it in the child view
message._debug = true
self.active[message.id] = message
self:autohide(message.id)
end
Expand Down

0 comments on commit 6991e3e

Please sign in to comment.