diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2026-09-24 13:30:07 +0100 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2026-09-25 10:28:19 +0100 |
| commit | d7af8707026968887ea4ee3a4e6fa51fd4372033 (patch) | |
| tree | 19cae6c571311bbd5af56575dcc710485568f7b8 /runtime/lua/vim/_watch.lua | |
| parent | f6aac851ddd82db5241a56ddfb9cc9a9aec8f7e5 (diff) | |
| download | rneovim-d7af8707026968887ea4ee3a4e6fa51fd4372033.tar.gz rneovim-d7af8707026968887ea4ee3a4e6fa51fd4372033.tar.bz2 rneovim-d7af8707026968887ea4ee3a4e6fa51fd4372033.zip | |
fix(lua): enable nil-safety diagnostics in runtime code
Enable EmmyLua's need-check-nil diagnostic and resolve nullable values
through more precise types, explicit invariants, and guards for missing
runtime state. Keep analyzer-specific workarounds local and update the
affected API documentation.
Exclude the bundled re.lua from analysis so its nil-check warnings do
not fail CI.
AI-assisted
Diffstat (limited to 'runtime/lua/vim/_watch.lua')
| -rw-r--r-- | runtime/lua/vim/_watch.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index bdb5882150..b3b9b99b96 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -65,7 +65,7 @@ M.FileChangeType = { --- @field subscribers table<vim._watch.Subscriber, true> --- @field cancel? fun() ---- @type table<string, table<string, table<vim._watch.Shared, true>>> +--- @type table<'watch'|'watchdirs'|'inotify', table<string, table<vim._watch.Shared, true>>> local shared = { watch = {}, watchdirs = {}, inotify = {} } --- Counts backend watchers with outstanding subscriptions, excluding failed starts. @@ -238,7 +238,7 @@ local function subscribe(name, backend, path, opts, rules, subscriber) shared[name][path] = nil end - entry.cancel() + assert(entry.cancel)() end end end |