Skip to content

Commit

Permalink
Merge pull request ixahmedxi#8 from brunohcastro/hide_empty_lsp_messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi authored Dec 11, 2022
2 parents e9295be + 4978790 commit aa36115
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lua/config/lsp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,22 @@ local config = {

vim.diagnostic.config(config)

vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
vim.lsp.handlers["textDocument/hover"] = function(_, result, ctx, conf)
if not (result and result.contents) then
return
end

local content = vim.lsp.util.convert_input_to_markdown_lines(result.contents)
content = vim.lsp.util.trim_empty_lines(content)

if vim.tbl_isempty(content) then
return
end

return vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})(_, result, ctx, conf)
end

vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
Expand Down

0 comments on commit aa36115

Please sign in to comment.