beatiful lsp icons and messages

This commit is contained in:
Oliver Hartmann 2023-01-27 23:31:22 +01:00
parent 4565a3aabd
commit a7a4319243

View File

@ -41,6 +41,23 @@ return {
ctermbg = 'red',
bg = 'DarkRed' }
)
local diagnostics = {
Error = "",
Warning = "",
Information = "",
Question = "",
Hint = "",
}
local signs = {
{ name = "DiagnosticSignError", text = diagnostics.Error },
{ name = "DiagnosticSignWarn", text = diagnostics.Warning },
{ name = "DiagnosticSignHint", text = diagnostics.Hint },
{ name = "DiagnosticSignInfo", text = diagnostics.Information },
}
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
end
OpenDiagFloat = function()
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
@ -270,7 +287,22 @@ return {
capabilities = capabilities,
})
vim.diagnostic.config({ virtual_text = false })
-- vim.diagnostic.config({ virtual_text = false })
vim.diagnostic.config({
virtual_text = false,
signs = true,
float = {
border = "single",
format = function(diagnostic)
return string.format(
"%s (%s) [%s]",
diagnostic.message,
diagnostic.source,
diagnostic.code or diagnostic.user_data.lsp.code
)
end,
},
})
end,
event = 'VeryLazy'
}