From d7af8707026968887ea4ee3a4e6fa51fd4372033 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 24 Sep 2026 13:30:07 +0100 Subject: 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 --- runtime/lua/vim/diagnostic/_float.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/diagnostic/_float.lua') diff --git a/runtime/lua/vim/diagnostic/_float.lua b/runtime/lua/vim/diagnostic/_float.lua index f7331b3c56..aace6ec025 100644 --- a/runtime/lua/vim/diagnostic/_float.lua +++ b/runtime/lua/vim/diagnostic/_float.lua @@ -271,7 +271,7 @@ function M.open(opts, ...) local line = lines[i] local prefix_len = hl.prefix and hl.prefix.length or 0 local suffix_len = hl.suffix and hl.suffix.length or 0 - if prefix_len > 0 then + if hl.prefix and prefix_len > 0 then api.nvim_buf_set_extmark(float_bufnr, float_ns, i - 1, 0, { hl_group = hl.prefix.hlname, end_col = prefix_len, @@ -283,7 +283,7 @@ function M.open(opts, ...) end_col = #line - suffix_len, strict = false, }) - if suffix_len > 0 then + if hl.suffix and suffix_len > 0 then api.nvim_buf_set_extmark(float_bufnr, float_ns, i - 1, #line - suffix_len, { hl_group = hl.suffix.hlname, end_row = i, -- cgit