From ac2b15e67398ecd6adcfb6834d14b3288a80e518 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Mon, 30 Dec 2024 13:07:59 +0000 Subject: [PATCH] fix(vim): update lsp config to fix deprecations Nvim lsp has changed the way the config works. This is now on all the versions on nvim I am using. The main one is in tumbleweed this is relatively up to date. The sign_define has also moved into the diagnostic config. --- site-modules/core/files/vim/plugin/lsp.lua | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/site-modules/core/files/vim/plugin/lsp.lua b/site-modules/core/files/vim/plugin/lsp.lua index f6dce44..854a59a 100644 --- a/site-modules/core/files/vim/plugin/lsp.lua +++ b/site-modules/core/files/vim/plugin/lsp.lua @@ -113,29 +113,22 @@ end require("ionide").setup { on_attach = on_attach, capabilities = capabilities } --- Change the diagnostic signs -vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint", numhl = "DiagnosticSignHint" }) -vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo", numhl = "DiagnosticSignInfo" }) -vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" }) -vim.fn.sign_define( - "DiagnosticSignError", - { text = "", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" } -) - -local border = "rounded" - -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) -vim.lsp.handlers["textDocument/show_line_diagnostics"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) -vim.lsp.handlers["textDocument/diagnostic"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) -vim.lsp.handlers["textDocument/diagnostics"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) vim.diagnostic.config { float = { focusable = false, - border = border, + border = "rounded", }, virtual_text = { prefix = " ", }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = '', + [vim.diagnostic.severity.INFO] = '', + [vim.diagnostic.severity.WARN] = '', + [vim.diagnostic.severity.HINT] = '', + } + } } vim.cmd [[set updatetime=1000]]