diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index a585d6b1..c2a74ef5 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -12,6 +12,7 @@ return { ---@class PluginLspOpts opts = { -- options for vim.diagnostic.config() + ---@type vim.diagnostic.Opts diagnostics = { underline = true, update_in_insert = false, @@ -101,12 +102,6 @@ return { -- setup autoformat LazyVim.format.register(LazyVim.lsp.formatter()) - -- deprecated options - if opts.autoformat ~= nil then - vim.g.autoformat = opts.autoformat - LazyVim.deprecate("nvim-lspconfig.opts.autoformat", "vim.g.autoformat") - end - -- setup keymaps LazyVim.lsp.on_attach(function(client, buffer) require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) @@ -115,10 +110,9 @@ return { local register_capability = vim.lsp.handlers["client/registerCapability"] vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx) + ---@diagnostic disable-next-line: no-unknown local ret = register_capability(err, res, ctx) - local client_id = ctx.client_id - ---@type lsp.Client - local client = vim.lsp.get_client_by_id(client_id) + local client = vim.lsp.get_client_by_id(ctx.client_id) local buffer = vim.api.nvim_get_current_buf() require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) return ret @@ -126,8 +120,7 @@ return { -- diagnostics signs if vim.fn.has("nvim-0.10.0") == 0 then - local text = vim.tbl_get(opts, "diagnostics", "signs", "text") or {} - for severity, icon in pairs(text) do + for severity, icon in pairs(opts.diagnostics.signs.text) do local name = vim.diagnostic.severity[severity]:lower():gsub("^%l", string.upper) name = "DiagnosticSign" .. name vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })