From cecb7d9bb4069fcce3d5c54e9c8e9d655ad78c39 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 Jun 2023 15:35:30 +0000 Subject: [PATCH] home: vim: lspconfig: configure diagnostics once There's no need to configure it on each LSP attach, this is wasted work and could change options that have since been changed. --- home/vim/lua/ambroisie/lsp.lua | 16 ---------------- home/vim/plugin/settings/lspconfig.lua | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/home/vim/lua/ambroisie/lsp.lua b/home/vim/lua/ambroisie/lsp.lua index 05869b7..7ef6e26 100644 --- a/home/vim/lua/ambroisie/lsp.lua +++ b/home/vim/lua/ambroisie/lsp.lua @@ -44,22 +44,6 @@ end -- @param client native client configuration -- @param bufnr int? buffer number of the attched client M.on_attach = function(client, bufnr) - -- Diagnostics - vim.diagnostic.config({ - -- Disable virtual test next to affected regions - virtual_text = false, - -- Also disable virtual diagnostics under the affected regions - virtual_lines = false, - -- Show diagnostics signs - signs = true, - -- Underline offending regions - underline = true, - -- Do not bother me in the middle of insertion - update_in_insert = false, - -- Show highest severity first - severity_sort = true, - }) - -- Format on save lsp_format.on_attach(client, bufnr) diff --git a/home/vim/plugin/settings/lspconfig.lua b/home/vim/plugin/settings/lspconfig.lua index 45be269..794a765 100644 --- a/home/vim/plugin/settings/lspconfig.lua +++ b/home/vim/plugin/settings/lspconfig.lua @@ -2,6 +2,22 @@ local lspconfig = require("lspconfig") local lsp = require("ambroisie.lsp") local utils = require("ambroisie.utils") +-- Diagnostics +vim.diagnostic.config({ + -- Disable virtual test next to affected regions + virtual_text = false, + -- Also disable virtual diagnostics under the affected regions + virtual_lines = false, + -- Show diagnostics signs + signs = true, + -- Underline offending regions + underline = true, + -- Do not bother me in the middle of insertion + update_in_insert = false, + -- Show highest severity first + severity_sort = true, +}) + -- Inform servers we are able to do completion, snippets, etc... local capabilities = require("cmp_nvim_lsp").default_capabilities()