diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2026-09-07 16:21:52 +0100 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2026-09-09 11:39:57 +0100 |
| commit | efdd73c0962cf46889d2e043efb892cf3ec432b7 (patch) | |
| tree | 8b5bf0cf19290311253e5dd8ef2cb20cc829712e /runtime/lua/vim/_core | |
| parent | 318ea4de21121a8ca0d905289a96cf48d9025816 (diff) | |
| download | rneovim-efdd73c0962cf46889d2e043efb892cf3ec432b7.tar.gz rneovim-efdd73c0962cf46889d2e043efb892cf3ec432b7.tar.bz2 rneovim-efdd73c0962cf46889d2e043efb892cf3ec432b7.zip | |
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
Diffstat (limited to 'runtime/lua/vim/_core')
| -rw-r--r-- | runtime/lua/vim/_core/util.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/lua/vim/_core/util.lua b/runtime/lua/vim/_core/util.lua index 08cbf17f04..133e5a7eeb 100644 --- a/runtime/lua/vim/_core/util.lua +++ b/runtime/lua/vim/_core/util.lua @@ -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 |