-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[RDY] Notification provider #13843
[RDY] Notification provider #13843
Conversation
I'm in favor of removing anything that pipes to Maybe we could roll (the idea) of my PR handling verbosity with nvim_err into this one? |
ebcaf16
to
0380e9d
Compare
@mjlbach I find this small PR quite useful already so I prefer to keep the scope minimal to speed up merging (then we can start leveraging it in LSP). I will comment on your other PR. I've swapped the log level and message so one doesn't need to specify a log level anymore. NB: freebsd build errors unrelated |
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.
LGTM :)
function vim.notify(msg, log_level, _opts) | ||
|
||
if log_level == vim.log.levels.ERROR then | ||
vim.api.nvim_err_writeln(msg) |
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.
which reminds me, nvim_echo
should take optional 'error' arg :)
Should we add Might nice for remote plugins. |
good idea, I've just added nvim_notify. |
Adds function to notify the user like this: `:lua vim.notify("hello user")` embeds log levels vim.log.levels. you can then reassign vim.notify to for instance ``` function notify_external(msg, log_level, opts) vim.fn.jobstart({"notify-send", msg }) end ```
Could use a test where we call notify and do screen test in Lua. Could use a test from api side where you override This also gives us that the code runs once 😁 After that, I'm good with merging. |
Oh, maybe we should add a name space or provider argument. So you could multiplex them if you wanted. |
3c31490
to
eb3abe4
Compare
I've added a test, was not sure how to test the default behavior. I am fine with adding a namespace (and I think nvim_echo should too, this would allow to filter messages per plugin). but not sure if it deserves its own parameter or can be passed into the dicts. |
parameters are mandatory
There was no comment on the namespace argument so I'll merge, We can change this before release concurrently with nvim_echo (or post release via the optional dict). |
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.
Bumping the constant's value for logging levels changes behavior / needs doc adjustment.
#define DEBUG_LOG_LEVEL 1 | ||
#define INFO_LOG_LEVEL 2 | ||
#define WARN_LOG_LEVEL 3 | ||
#define ERROR_LOG_LEVEL 4 |
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.
This changes behavior, where CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1
now enables debug messages, whereas it was INFO
only before..! (e.g. via
Line 185 in 4174244
#if MIN_LOG_LEVEL <= INFO_LOG_LEVEL |
Since it is released in 0.5 already it should probably stay like this, but it seems like documentation (and CI config) needs to be adjusted also (e.g.
neovim/.github/workflows/env.sh
Line 30 in 4174244
BUILD_FLAGS="CMAKE_FLAGS=-DCI_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$HOME/nvim-install -DBUSTED_OUTPUT_TYPE=nvim -DDEPS_PREFIX=$HOME/nvim-deps/usr -DMIN_LOG_LEVEL=3" |
Address #5562 : notifications in the command line are a pain, especially wit LSP now.
I would like the possibility to use system notifications for instance (or floating windows to mimic system level notifications).
Adds a
vim.notify
function to send such notifications. By default it sends it as usual but you can override it with for instanceI've noticed a mismatch between
neovim/runtime/lua/vim/lsp/log.lua
Line 13 in 8950f4e
neovim/src/nvim/log.h
Line 20 in 8950f4e
Also could support a dict to be forward compatible with options (timeout, icon).
@mjlbach @tjdevries @bfredl