-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use vim.notify #280
Use vim.notify #280
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I think the second arguments should use vim.log.levels.XY
. See the stock implementation of vim.notify
:
function vim.notify(msg, log_level, _opts)
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
elseif log_level == vim.log.levels.WARN then
vim.api.nvim_echo({{msg, 'WarningMsg'}}, true, {})
else
vim.api.nvim_echo({{msg}}, true, {})
end
end
Using a string literal as log level won't be recognized.
I'm also not sure if it is justified to use error. Stuff like "No configuration selected" would be fine as info. Messages like "Restart not supported" could probably go as warning. I think "error" should be reserved for unexpected errors - like the when using the error object from the handler response.
It may also be worth to extract the title = 'DAP'
thing into a NOTIFY_OPTS
constant or something?
Oh, right, completely missed it. For some reason using string works for
Makes sense.
Where should I store it? |
Where this causes the function to stop, I left it as |
@mfussenegger I meant in which script should I store this variable? |
Good question. Given that it is used in multiple places we'd need a Another option would be to have a Let me know what you think. Otherwise it is also fine for me to merge as is. |
@mfussenegger this one sounds better. Will implement this way. Another question. Should users be allowed to customize these settings, for example, so they can specify |
Currently I wouldn't make it possible to customize these. (And if you go for the |
@mfussenegger done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import in widgets currently fails, otherwise I think this is good to go
Fixes a regression introduced in #280
Fixes a regression introduced in #280
I replaced all
print
occurrences withvim.notify
. I addedDAP
title, so users can display notifications nicer. For example, using nvim-notify users can have nice popups.Gitsigns also use title.
Closes #111.