@@ -116,29 +116,27 @@ vim.api.nvim_create_autocmd('LspAttach', {
116116})
117117
118118-- setup diagnostics
119- vim .lsp . handlers [ ' textDocument/publishDiagnostics ' ] = vim . lsp . with ( vim . lsp . diagnostic .on_publish_diagnostics , {
120- signs = true ,
119+ vim .diagnostic .config ( {
120+ severity_sort = true ,
121121 underline = true ,
122+ update_in_insert = false ,
122123 virtual_text = {
123124 spacing = 4 ,
124- severity = { min = vim .diagnostic .severity .WARN }, -- Basically show all messages
125+ -- Show WARN and above in virtual text
126+ severity = { min = vim .diagnostic .severity .WARN },
127+ },
128+ signs = {
129+ priority = 40 , -- Keep signs above most others (e.g., VCS)
130+ text = {
131+ [vim .diagnostic .severity .ERROR ] = ' E' ,
132+ [vim .diagnostic .severity .WARN ] = ' W' ,
133+ [vim .diagnostic .severity .INFO ] = ' I' ,
134+ [vim .diagnostic .severity .HINT ] = ' H' ,
135+ },
125136 },
126- update_in_insert = false ,
127- })
128-
129- vim .diagnostic .config ({
130- severity_sort = true ,
131- signs = true ,
132- virtual_text = true ,
133137 float = { scope = ' line' },
134138})
135139
136- -- setup gutter signs for diagnostics
137- vim .fn .sign_define (' DiagnosticSignError' , { text = ' E' , texthl = ' DiagnosticSignError' , priority = 40 })
138- vim .fn .sign_define (' DiagnosticSignWarn' , { text = ' W' , texthl = ' DiagnosticSignWarn' , priority = 30 })
139- vim .fn .sign_define (' DiagnosticSignInfo' , { text = ' I' , texthl = ' DiagnosticDefaultInfo' , priority = 20 })
140- vim .fn .sign_define (' DiagnosticSignHint' , { text = ' H' , texthl = ' DiagnosticDefaultHint' , priority = 10 })
141-
142140-- diagnostic highlights
143141vim .api .nvim_set_hl (0 , ' DiagnosticError' , { fg = ' Red' , ctermfg = ' Red' })
144142vim .api .nvim_set_hl (0 , ' DiagnosticUnderlineError' , { fg = ' Red' , ctermfg = ' Red' , cterm = { underline = true } })
0 commit comments