changeset 466:899cded39cd3

Update Diagnostic highlighting after api changes
author Zeger Van de Vannet <zegervdv@me.com>
date Fri, 24 Sep 2021 15:03:52 +0200
parents daf715cd8abe
children c72fa6d32653
files .chezmoitemplates/init.lua
diffstat 1 files changed, 22 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/.chezmoitemplates/init.lua	Thu Sep 23 20:13:52 2021 +0200
+++ b/.chezmoitemplates/init.lua	Fri Sep 24 15:03:52 2021 +0200
@@ -669,36 +669,8 @@
 
   inoremap { '<c-l>', vim.lsp.buf.signature_help, silent = true, buffer = 0 }
 
-  vim.fn.sign_define(
-    'LspDiagnosticsSignError',
-    { texthl = 'LspDiagnosticsSignError', linehl = '', numhl = '', text = '▎' }
-  )
-  vim.fn.sign_define('LspDiagnosticsSignWarning', {
-    texthl = 'LspDiagnosticsSignWarning',
-    linehl = '',
-    numhl = '',
-    text = '▎',
-  })
-  vim.fn.sign_define('LspDiagnosticsSignInformation', {
-    texthl = 'LspDiagnosticsSignInformation',
-    linehl = '',
-    numhl = '',
-    text = '▎',
-  })
-  vim.fn.sign_define(
-    'LspDiagnosticsSignHint',
-    { texthl = 'LspDiagnosticsSignHint', linehl = '', numhl = '', text = '▎' }
-  )
-
   vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
   vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
-  vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
-    underline = true,
-    update_in_insert = false,
-    virtual_text = { severity_limit = 'Warning' },
-    source = 'if_many',
-  })
-
   -- require "lsp_signature".on_attach()
 end
 
@@ -773,6 +745,28 @@
   vim.highlight.on_yank { timeout = 120 }
 end
 
+vim.diagnostic.config {
+  underline = true,
+  update_in_insert = false,
+  virtual_text = { severity = { min = vim.diagnostic.severity.WARN }, source = 'always' },
+  severity_sort = true,
+}
+
+vim.fn.sign_define('DiagnosticSignError', { texthl = 'DiagnosticSignError', linehl = '', numhl = '', text = '▎' })
+vim.fn.sign_define('DiagnosticSignWarn', {
+  texthl = 'DiagnosticSignWarn',
+  linehl = '',
+  numhl = '',
+  text = '▎',
+})
+vim.fn.sign_define('DiagnosticSignInfo', {
+  texthl = 'DiagnosticSignInfo',
+  linehl = '',
+  numhl = '',
+  text = '▎',
+})
+vim.fn.sign_define('DiagnosticSignHint', { texthl = 'DiagnosticSignHint', linehl = '', numhl = '', text = '▎' })
+
 -- Try importing local config
 local ok, localconfig = pcall(require, 'localconfig')
 if ok then