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/treesitter/dev.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/treesitter/dev.lua') diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index 228d434cdc..c719e0dbd2 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -410,7 +410,7 @@ function M.inspect_tree(opts) nowait = true, callback = function() local row = api.nvim_win_get_cursor(w)[1] - local lnum, col = treeview:get(row).node:start() + local lnum, col = assert(treeview:get(row)).node:start() -- update source window if original was closed if not api.nvim_win_is_valid(win) then @@ -481,7 +481,7 @@ function M.inspect_tree(opts) w = api.nvim_get_current_win() api.nvim_buf_clear_namespace(buf, treeview.ns, 0, -1) local row = api.nvim_win_get_cursor(w)[1] - local lnum, col, end_lnum, end_col = treeview:get(row).node:range() + local lnum, col, end_lnum, end_col = assert(treeview:get(row)).node:range() api.nvim_buf_set_extmark(buf, treeview.ns, lnum, col, { end_row = end_lnum, end_col = math.max(0, end_col), -- cgit