Configurable message prompts
askfiy opened this issue · comments
Problem Statement
I noticed that now whether I start debugging or continue debugging, it pops up the annoying notify popup.
Maybe we can use vim.api.nvim_echo to display these debug content, some important notifications can use notify.
It should be user configurable:
Similar to:
require("dap").setup({
informe_method = "notify | echo"
...
})
Well, it doesn't seem to be necessary, we can filter it through notify
, and for the convenience of someone who asks the same question later, I will paste my solution here:
-- Define message warnings to ignore, usually from the LSP server
local ignore_message = {
"exit code",
"Invalid buffer",
"textDocument/documentSymbol is not supported",
"client has shut down after sending the message",
}
-- The following information will not be displayed using Notify, but using echo
local switch_notice_method = {
"Reason: breakpoint",
"Reason: step",
},
}
...
local notify = require("notify").setup()
vim.notify = setmetatable({}, {
__call = function(self, msg, ...)
for _, v in ipairs(ignore_message) do
if msg:match(v) then
return
end
end
for _, v in ipairs(switch_notice_method) do
if msg:match(v) then
vim.api.nvim_echo({ { msg, "MoreMsg" } }, false, {})
return
end
end
return notify(msg, ...)
end,
__index = notify,
})
Are you sure this notification is generated by nvim-dap itself? Looks like it might origin from another extension?
I asked the same question in dap-ui
and he told me that this is the information generated by dap
.
Also, I use the nvim-notify
plugin to pretty print all the information.