From a3690ed8ca90823787fbaddb72f0a1874f1e999d Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 17 Nov 2021 22:24:43 +0100 Subject: Add lunarvim update to lsp/general --- .config/nvim/lua/lsp/init.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to '.config/nvim/lua/lsp/init.lua') diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index f92ecd3..9cb3e78 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -150,6 +150,13 @@ function M.get_common_opts() } end +local LSP_DEPRECATED_SIGN_MAP = { + ["LspDiagnosticsSignError"] = "DiagnosticSignError", + ["LspDiagnosticsSignWarning"] = "DiagnosticSignWarn", + ["LspDiagnosticsSignHint"] = "DiagnosticSignHint", + ["LspDiagnosticsSignInformation"] = "DiagnosticSignInfo", +} + function M.setup() Log:debug "Setting up LSP support" @@ -158,7 +165,16 @@ function M.setup() return end + local is_neovim_nightly = vim.fn.has "nvim-0.5.1" > 0 + for _, sign in ipairs(options.lsp.diagnostics.signs.values) do + local lsp_sign_name = LSP_DEPRECATED_SIGN_MAP[sign.name] + if is_neovim_nightly and lsp_sign_name then + vim.fn.sign_define( + lsp_sign_name, + { texthl = lsp_sign_name, text = sign.text, numhl = lsp_sign_name } + ) + end vim.fn.sign_define( sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name } @@ -176,7 +192,7 @@ function M.setup() require("lsp.null-ls").setup() - require("utils").toggle_autoformat() + require("core.autocmds").configure_format_on_save() end return M -- cgit v1.2.3-70-g09d2