Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Dec 17, 2022
2 parents c2b81fb + f557704 commit edc5dc2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 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
6 changes: 4 additions & 2 deletions lua/config/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ import({ "mason", "mason-lspconfig", "lspconfig", "cmp_nvim_lsp" }, function(mod
function(server_name)
local has_custom_opts, custom_opts = pcall(require, "config.lsp.settings." .. server_name)

local server_opts = opts

if has_custom_opts then
opts = vim.tbl_deep_extend("force", custom_opts, opts)
server_opts = vim.tbl_deep_extend("force", custom_opts, opts)
end

modules.lspconfig[server_name].setup(opts)
modules.lspconfig[server_name].setup(server_opts)
end,
["tsserver"] = function()
import("typescript", function(typescript)
Expand Down

0 comments on commit edc5dc2

Please sign in to comment.