mirror of
https://github.com/neovim/neovim.git
synced 2026-09-12 17:11:02 +00:00
feat(watch): add on_error callback
Problem: Watcher failures are reported inconsistently, and callers cannot detect when a watcher is no longer usable. Solution: Route startup and event failures and unexpected inotifywait exits through an optional on_error callback. Log to nvim-watch.log by default. Ignore disappearing child directories and exits caused by cancellation. Let LSP log failures and notify once per message, using INFO for missing roots and ERROR otherwise, without interrupting registration. AI-assisted
This commit is contained in:
committed by
Lewis Russell
parent
318ea4de21
commit
efdd73c096
@@ -209,9 +209,11 @@ end
|
||||
--- @param name string Plugin name, e.g. "zip".
|
||||
--- @param msg string
|
||||
--- @param level? integer Level from |vim.log.levels|. Defaults to ERROR.
|
||||
function M.notify(name, msg, level)
|
||||
--- @param once? boolean Only show the message once.
|
||||
function M.notify(name, msg, level, once)
|
||||
vim.schedule(function()
|
||||
vim.notify(('%s: %s'):format(name, msg), level or vim.log.levels.ERROR)
|
||||
local notify = once and vim.notify_once or vim.notify
|
||||
notify(('%s: %s'):format(name, msg), level or vim.log.levels.ERROR)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user