1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-02-23 13:27:59 +00:00

76 lines
1.7 KiB
Lua
Raw Normal View History

2022-10-01 13:46:18 +02:00
local M = {}
2023-04-12 20:09:30 +02:00
local cmp_nvim_lsp = require("cmp_nvim_lsp")
2022-10-01 13:46:18 +02:00
2022-10-18 20:41:23 +02:00
M.capabilities = cmp_nvim_lsp.default_capabilities()
2022-10-01 13:46:18 +02:00
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
M.setup = function()
local signs = {
{ name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" },
2023-09-22 19:48:39 +02:00
{ name = "DiagnosticSignHint", text = "" },
2022-10-01 13:46:18 +02:00
{ 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 18:36:24 +02:00
virtual_text = false,
2022-10-01 13:46:18 +02:00
signs = {
2022-10-10 18:36:24 +02:00
active = signs,
2022-10-01 13:46:18 +02: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 15:16:41 +01:00
M.on_attach = function(client)
2023-03-12 13:58:45 +01:00
if client.name == "lua_ls" then
2022-10-02 11:18:19 +02:00
client.server_capabilities.document_formatting = false
2022-10-01 13:46:18 +02:00
end
if client.name == "ruff-lsp" then
2023-03-12 13:58:45 +01:00
client.server_capabilities.hover = false
2022-10-01 13:46:18 +02:00
end
2023-10-28 17:49:56 +02:00
if client.name == "gopls" then
if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end
end
2023-04-12 20:09:30 +02:00
require("illuminate").on_attach(client)
2022-10-01 13:46:18 +02:00
end
return M