Skip to content

Commit 15e019c

Browse files
committed
Merge 'upstream': feat(diagnostic): add diagnostic config
2 parents 07778f6 + 76e06fe commit 15e019c

1 file changed

Lines changed: 28 additions & 9 deletions

File tree

lua/kickstart/plugins/lspconfig.lua

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,34 @@ return {
150150
end,
151151
})
152152

153-
-- Change diagnostic symbols in the sign column (gutter)
154-
-- if vim.g.have_nerd_font then
155-
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
156-
-- local diagnostic_signs = {}
157-
-- for type, icon in pairs(signs) do
158-
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
159-
-- end
160-
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
161-
-- end
153+
-- Diagnostic Config
154+
-- See :help vim.diagnostic.Opts
155+
vim.diagnostic.config {
156+
severity_sort = true,
157+
float = { border = 'rounded', source = 'if_many' },
158+
underline = { severity = vim.diagnostic.severity.ERROR },
159+
signs = vim.g.have_nerd_font and {
160+
text = {
161+
[vim.diagnostic.severity.ERROR] = '󰅚 ',
162+
[vim.diagnostic.severity.WARN] = '󰀪 ',
163+
[vim.diagnostic.severity.INFO] = '󰋽 ',
164+
[vim.diagnostic.severity.HINT] = '󰌶 ',
165+
},
166+
} or {},
167+
virtual_text = {
168+
source = 'if_many',
169+
spacing = 2,
170+
format = function(diagnostic)
171+
local diagnostic_message = {
172+
[vim.diagnostic.severity.ERROR] = diagnostic.message,
173+
[vim.diagnostic.severity.WARN] = diagnostic.message,
174+
[vim.diagnostic.severity.INFO] = diagnostic.message,
175+
[vim.diagnostic.severity.HINT] = diagnostic.message,
176+
}
177+
return diagnostic_message[diagnostic.severity]
178+
end,
179+
},
180+
}
162181

163182
-- LSP servers and clients are able to communicate to each other what features they support.
164183
-- By default, Neovim doesn't support everything that is in the LSP specification.

0 commit comments

Comments
 (0)