chore(nvim): lsp sign definitions, icons, settings

This commit is contained in:
2025-01-14 06:50:15 +02:00
parent 1dbc7ae5cd
commit dab7a8a38a

View File

@@ -302,30 +302,39 @@ return {
} }
-- Diagnostic configuration -- Diagnostic configuration
vim.diagnostic.config { local signs = {
virtual_text = false, { name = 'DiagnosticSignError', text = '' }, -- Error icon
float = { { name = 'DiagnosticSignWarn', text = '' }, -- Warning icon
source = true, { name = 'DiagnosticSignHint', text = '' }, -- Hint icon
}, { name = 'DiagnosticSignInfo', text = '' }, -- Information icon
} }
-- Sign configuration local function ensure_sign_defined(name, sign_opts)
vim.fn.sign_define( if vim.tbl_isempty(vim.fn.sign_getdefined(name)) then
'DiagnosticSignError', vim.fn.sign_define(name, sign_opts)
{ text = '', texthl = 'DiagnosticSignError' } end
) end
vim.fn.sign_define(
'DiagnosticSignWarn', for _, sign in ipairs(signs) do
{ text = '', texthl = 'DiagnosticSignWarn' } ensure_sign_defined(sign.name, {
) text = sign.text,
vim.fn.sign_define( texthl = sign.texthl or sign.name,
'DiagnosticSignInfo', numhl = sign.numhl or sign.name,
{ text = '', texthl = 'DiagnosticSignInfo' } })
) end
vim.fn.sign_define(
'DiagnosticSignHint', ---@type vim.diagnostic.Opts
{ text = '', texthl = 'DiagnosticSignHint' } local diagnostics_config = {
) signs = {
active = signs, -- show signs
},
update_in_insert = false,
underline = true,
severity_sort = true,
virtual_text = true,
}
vim.diagnostic.config(diagnostics_config)
-- end of junnplus/lsp-setup config -- end of junnplus/lsp-setup config
end, end,