mirror of
https://github.com/neovim/neovim.git
synced 2026-07-14 21:30:34 +00:00
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.
This commit is contained in:
@@ -3657,6 +3657,22 @@ describe('vim.diagnostic', function()
|
||||
)
|
||||
end)
|
||||
|
||||
it('errors when LSP relatedInformation is null', function()
|
||||
matches(
|
||||
'server response has invalid %(null%) relatedInformation',
|
||||
pcall_err(
|
||||
exec_lua,
|
||||
[[
|
||||
local diagnostic = _G.make_warning('Some warning', 1, 1, 1, 3)
|
||||
diagnostic.user_data = { lsp = { relatedInformation = vim.NIL } }
|
||||
vim.api.nvim_win_set_buf(0, _G.diagnostic_bufnr)
|
||||
vim.diagnostic.set(_G.diagnostic_ns, _G.diagnostic_bufnr, { diagnostic })
|
||||
vim.diagnostic.open_float({ header = false, scope = 'buffer' })
|
||||
]]
|
||||
)
|
||||
)
|
||||
end)
|
||||
|
||||
it('works with the old signature', function()
|
||||
eq(
|
||||
{ '1. Syntax error' },
|
||||
|
||||
Reference in New Issue
Block a user