From 543a96e49179060999ebcb12372ce36ea6be646d Mon Sep 17 00:00:00 2001 From: "Kim A. Brandt" Date: Sun, 12 Jul 2026 18:52:10 +0200 Subject: fix(lsp): unclear error on malformed server responses #40422 Problem: Malformed server responses with `null` (vim.NIL) values, do not show clear error messages. Solution: Assert two known, specific cases, to avoid user confusion. --- runtime/lua/vim/diagnostic/_float.lua | 1 + 1 file changed, 1 insertion(+) (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 4cda1be61f..aa41cdd38e 100644 --- a/runtime/lua/vim/diagnostic/_float.lua +++ b/runtime/lua/vim/diagnostic/_float.lua @@ -211,6 +211,7 @@ function M.open(opts, ...) --- @type lsp.DiagnosticRelatedInformation[] local related_info = vim.tbl_get(diagnostic, 'user_data', 'lsp', 'relatedInformation') or {} + assert(related_info ~= vim.NIL, 'server response has invalid (null) relatedInformation') -- Below the diagnostic, show its LSP related information (if any) in the form of file name and -- range, plus description. for _, info in ipairs(related_info) do -- cgit