style: debug

This commit is contained in:
Folke Lemaitre 2024-06-13 19:51:42 +02:00
parent 8d5e05c0d0
commit b8ecaafff8
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
3 changed files with 10 additions and 3 deletions

View File

@ -73,7 +73,7 @@ function M.error(msg, opts)
M.notify(msg, vim.tbl_extend("keep", { level = vim.log.levels.ERROR }, opts or {}))
end
---@param msg string
---@param msg string|string[]
function M.debug(msg, ...)
if Config.debug then
if select("#", ...) > 0 then

View File

@ -482,7 +482,10 @@ function M:open()
if count == 0 then
if not self.opts.open_no_results then
if self.opts.warn_no_results then
Util.warn("No results for **" .. self.opts.mode .. "**")
Util.warn({
"No results for **" .. self.opts.mode .. "**",
"Buffer: " .. vim.api.nvim_buf_get_name(self:main().buf),
})
end
return
end

View File

@ -110,7 +110,11 @@ function M:main_call(fn)
fn(main)
end)
else
Util.debug("Main window switched buffers")
Util.debug({
"Main window switched buffers",
"Main: " .. vim.api.nvim_buf_get_name(main.buf),
"Current: " .. vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(main.win)),
})
end
end