summaryrefslogtreecommitdiffstats
path: root/nvim
diff options
context:
space:
mode:
authorGeloCraft <115651305+gelocraft@users.noreply.github.com>2025-02-18 02:01:07 +0800
committerGitHub <noreply@github.com>2025-02-17 13:01:07 -0500
commit08e4150deec854f2b691a8a4471b4defe0ee330d (patch)
treeba399954c567cc514afd047c6c92bbcda13e11fa /nvim
parent81dcb9dea347be486a2538545c7ad733ad327fee (diff)
downloaddots-08e4150deec854f2b691a8a4471b4defe0ee330d.tar.gz
feat(diagnostic): add diagnostic config (#1335)
Co-authored-by: gelocraft <gelocraft@users.noreply.github.com>
Diffstat (limited to 'nvim')
-rw-r--r--nvim/init.lua37
1 files changed, 28 insertions, 9 deletions
diff --git a/nvim/init.lua b/nvim/init.lua
index 7ef6120..d91174b 100644
--- a/nvim/init.lua
+++ b/nvim/init.lua
@@ -599,15 +599,34 @@ require('lazy').setup({
end,
})
- -- Change diagnostic symbols in the sign column (gutter)
- -- if vim.g.have_nerd_font then
- -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
- -- local diagnostic_signs = {}
- -- for type, icon in pairs(signs) do
- -- diagnostic_signs[vim.diagnostic.severity[type]] = icon
- -- end
- -- vim.diagnostic.config { signs = { text = diagnostic_signs } }
- -- end
+ -- Diagnostic Config
+ -- See :help vim.diagnostic.Opts
+ vim.diagnostic.config {
+ severity_sort = true,
+ float = { border = 'rounded', source = 'if_many' },
+ underline = { severity = vim.diagnostic.severity.ERROR },
+ signs = vim.g.have_nerd_font and {
+ text = {
+ [vim.diagnostic.severity.ERROR] = '󰅚 ',
+ [vim.diagnostic.severity.WARN] = '󰀪 ',
+ [vim.diagnostic.severity.INFO] = '󰋽 ',
+ [vim.diagnostic.severity.HINT] = '󰌶 ',
+ },
+ } or {},
+ virtual_text = {
+ source = 'if_many',
+ spacing = 2,
+ format = function(diagnostic)
+ local diagnostic_message = {
+ [vim.diagnostic.severity.ERROR] = diagnostic.message,
+ [vim.diagnostic.severity.WARN] = diagnostic.message,
+ [vim.diagnostic.severity.INFO] = diagnostic.message,
+ [vim.diagnostic.severity.HINT] = diagnostic.message,
+ }
+ return diagnostic_message[diagnostic.severity]
+ end,
+ },
+ }
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.