fix(lsp): show notification with empty hover response (#35014)

This commit is contained in:
Maria José Solano
2025-07-20 13:58:40 -07:00
committed by GitHub
parent 2495015455
commit c3991b8ef4
2 changed files with 43 additions and 3 deletions

View File

@@ -7110,4 +7110,31 @@ describe('LSP', function()
)
end)
end)
describe('vim.lsp.buf.hover()', function()
it('handles empty contents', function()
exec_lua(create_server_definition)
exec_lua(function()
local server = _G._create_server({
capabilities = {
hoverProvider = true,
},
handlers = {
['textDocument/hover'] = function(_, _, callback)
local res = {
contents = {
kind = 'markdown',
value = '',
},
}
callback(nil, res)
end,
},
})
vim.lsp.start({ name = 'dummy', cmd = server.cmd })
end)
eq('Empty hover response', n.exec_capture('lua vim.lsp.buf.hover()'))
end)
end)
end)