1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-23 18:26:48 +00:00
dotfiles/.config/nvim/lua/plugins/lsp/handlers.lua

69 lines
1.5 KiB
Lua
Raw Normal View History

2022-10-01 11:46:18 +00:00
local M = {}
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not status_cmp_ok then
return
end
2022-10-18 18:41:23 +00:00
M.capabilities = cmp_nvim_lsp.default_capabilities()
2022-10-01 11:46:18 +00:00
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
M.setup = function()
local signs = {
{ name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" },
{ name = "DiagnosticSignHint", text = "" },
{ name = "DiagnosticSignInfo", text = "" },
}
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
end
local config = {
2022-10-10 16:36:24 +00:00
virtual_text = false,
2022-10-01 11:46:18 +00:00
signs = {
2022-10-10 16:36:24 +00:00
active = signs,
2022-10-01 11:46:18 +00:00
},
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
focusable = true,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
}
vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
})
end
2022-12-10 14:16:41 +00:00
M.on_attach = function(client)
2022-10-01 11:46:18 +00:00
if client.name == "tsserver" then
2022-10-02 09:18:19 +00:00
client.server_capabilities.document_formatting = false
2022-10-01 11:46:18 +00:00
end
2023-02-13 18:27:54 +00:00
if client.name == "lua_ls" then
2022-10-02 09:18:19 +00:00
client.server_capabilities.document_formatting = false
2022-10-01 11:46:18 +00:00
end
local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then
return
end
illuminate.on_attach(client)
end
return M