-
-
Notifications
You must be signed in to change notification settings - Fork 627
feat: Add ability to customize notification handler #2117
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,6 +440,7 @@ applying configuration. | |
}, | ||
notify = { | ||
threshold = vim.log.levels.INFO, | ||
handler = "default", | ||
}, | ||
ui = { | ||
confirm = { | ||
|
@@ -1224,6 +1225,19 @@ Configuration for notification. | |
`INFO:` information only e.g. file copy path confirmation. | ||
`DEBUG:` not used. | ||
|
||
*nvim-tree.notify.handler* | ||
Change the default notification handler, can be a string `"default"` or a function. | ||
The default handler will use |vim.notify()| | ||
Type: `string` | `function`, Default: `"default"` | ||
|
||
Parameters: ~ | ||
• {msg} (string) See |vim.notify()| | ||
• {level} (number) See |vim.notify()| | ||
• {opts} (table) Optional parameters | ||
|
||
Options: ~ | ||
• {title} (string) Usually `"NvimTree"` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about: *nvim-tree.notify.handler*
Change the default notification handler, can be a string `"default"` or a function.
The default handler will check if the nvim-notify plugin is present on the
runtime path and use it, otherwise it will fallback to use |vim.notify()|
Type: `string` | `function`, Default: `"default"`
Parameters: ~
• {msg} (string) See |vim.notify()|
• {level} (number) See |vim.notify()|
• {opts} (table) Optional parameters
Options: ~
• {title} (string) Usually `"NvimTree"` There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we checking for nvim-notify at all? Wasn't idea behind vim.notify such that it handles notifications send to it per users' handler, if it happens to be nvim-notify so be it. Not near my computer so can't check much easily. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see! We set handler directly to vim.notify. Much cleaner. Just have to ensure that the arguments line up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct. I did it like that only to preserve the previous behavior, but I would happy to simplify it. Is there any issue/way of notifying users of such change?
They do :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Working: the latter case does not prepend the title, however that's expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we were building this today, the user would need to specify How about:
"nvim-notify plugin detected: please set notify.handler = require("notify").notify. See :help nvim-tree.notify" Options:
Your call @gegoune :) |
||
*nvim-tree.ui* | ||
General UI configuration. | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.