feat(lsp): show feedback on empty hover response (#18308)

Without any feedback it gives the impression that the language server is
not working properly, which isn't the case.
This commit is contained in:
Mathias Fußenegger 2022-04-29 23:04:00 +02:00 committed by GitHub
parent 6d4180a0d2
commit 9a1920e223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,13 +298,13 @@ function M.hover(_, result, ctx, config)
config = config or {} config = config or {}
config.focus_id = ctx.method config.focus_id = ctx.method
if not (result and result.contents) then if not (result and result.contents) then
-- return { 'No information available' } vim.notify('No information available')
return return
end end
local markdown_lines = util.convert_input_to_markdown_lines(result.contents) local markdown_lines = util.convert_input_to_markdown_lines(result.contents)
markdown_lines = util.trim_empty_lines(markdown_lines) markdown_lines = util.trim_empty_lines(markdown_lines)
if vim.tbl_isempty(markdown_lines) then if vim.tbl_isempty(markdown_lines) then
-- return { 'No information available' } vim.notify('No information available')
return return
end end
return util.open_floating_preview(markdown_lines, "markdown", config) return util.open_floating_preview(markdown_lines, "markdown", config)