comparison .chezmoitemplates/init.lua @ 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 375e2ea8452f
comparison
equal deleted inserted replaced
465:daf715cd8abe 466:899cded39cd3
667 nnoremap { 'gp', require('goto-preview').goto_preview_definition, silent = true, buffer = 0 } 667 nnoremap { 'gp', require('goto-preview').goto_preview_definition, silent = true, buffer = 0 }
668 nnoremap { 'gP', require('goto-preview').close_all_win, silent = true, buffer = 0 } 668 nnoremap { 'gP', require('goto-preview').close_all_win, silent = true, buffer = 0 }
669 669
670 inoremap { '<c-l>', vim.lsp.buf.signature_help, silent = true, buffer = 0 } 670 inoremap { '<c-l>', vim.lsp.buf.signature_help, silent = true, buffer = 0 }
671 671
672 vim.fn.sign_define(
673 'LspDiagnosticsSignError',
674 { texthl = 'LspDiagnosticsSignError', linehl = '', numhl = '', text = '▎' }
675 )
676 vim.fn.sign_define('LspDiagnosticsSignWarning', {
677 texthl = 'LspDiagnosticsSignWarning',
678 linehl = '',
679 numhl = '',
680 text = '▎',
681 })
682 vim.fn.sign_define('LspDiagnosticsSignInformation', {
683 texthl = 'LspDiagnosticsSignInformation',
684 linehl = '',
685 numhl = '',
686 text = '▎',
687 })
688 vim.fn.sign_define(
689 'LspDiagnosticsSignHint',
690 { texthl = 'LspDiagnosticsSignHint', linehl = '', numhl = '', text = '▎' }
691 )
692
693 vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) 672 vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
694 vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' }) 673 vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
695 vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
696 underline = true,
697 update_in_insert = false,
698 virtual_text = { severity_limit = 'Warning' },
699 source = 'if_many',
700 })
701
702 -- require "lsp_signature".on_attach() 674 -- require "lsp_signature".on_attach()
703 end 675 end
704 676
705 local capabilities = vim.lsp.protocol.make_client_capabilities() 677 local capabilities = vim.lsp.protocol.make_client_capabilities()
706 capabilities.textDocument.completion.completionItem.snippetSupport = true 678 capabilities.textDocument.completion.completionItem.snippetSupport = true
771 743
772 au.TextYankPost = function() 744 au.TextYankPost = function()
773 vim.highlight.on_yank { timeout = 120 } 745 vim.highlight.on_yank { timeout = 120 }
774 end 746 end
775 747
748 vim.diagnostic.config {
749 underline = true,
750 update_in_insert = false,
751 virtual_text = { severity = { min = vim.diagnostic.severity.WARN }, source = 'always' },
752 severity_sort = true,
753 }
754
755 vim.fn.sign_define('DiagnosticSignError', { texthl = 'DiagnosticSignError', linehl = '', numhl = '', text = '▎' })
756 vim.fn.sign_define('DiagnosticSignWarn', {
757 texthl = 'DiagnosticSignWarn',
758 linehl = '',
759 numhl = '',
760 text = '▎',
761 })
762 vim.fn.sign_define('DiagnosticSignInfo', {
763 texthl = 'DiagnosticSignInfo',
764 linehl = '',
765 numhl = '',
766 text = '▎',
767 })
768 vim.fn.sign_define('DiagnosticSignHint', { texthl = 'DiagnosticSignHint', linehl = '', numhl = '', text = '▎' })
769
776 -- Try importing local config 770 -- Try importing local config
777 local ok, localconfig = pcall(require, 'localconfig') 771 local ok, localconfig = pcall(require, 'localconfig')
778 if ok then 772 if ok then
779 localconfig.setup { on_attach = on_attach, capabilities = capabilities } 773 localconfig.setup { on_attach = on_attach, capabilities = capabilities }
780 end 774 end