diff options
| author | glepnir <glephunter@gmail.com> | 2024-09-18 20:36:07 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-18 20:36:07 +0800 |
| commit | 73e0002b6f211376bbf36c31a2f812aedf6bd6b0 (patch) | |
| tree | e3320b5a0458b432d0762e4ade9ac4cadcbdc2c7 /lua/lspconfig.lua | |
| parent | fix(ltex-ls): command fails on windows when using mason (#3305) (diff) | |
| download | nvim-lspconfig-73e0002b6f211376bbf36c31a2f812aedf6bd6b0.tar nvim-lspconfig-73e0002b6f211376bbf36c31a2f812aedf6bd6b0.tar.gz nvim-lspconfig-73e0002b6f211376bbf36c31a2f812aedf6bd6b0.tar.bz2 nvim-lspconfig-73e0002b6f211376bbf36c31a2f812aedf6bd6b0.tar.lz nvim-lspconfig-73e0002b6f211376bbf36c31a2f812aedf6bd6b0.tar.xz nvim-lspconfig-73e0002b6f211376bbf36c31a2f812aedf6bd6b0.tar.zst nvim-lspconfig-73e0002b6f211376bbf36c31a2f812aedf6bd6b0.zip | |
feat: show deprecate servers list in LspInfo (#3308)
* feat: show deprecate servers list in LspInfo
In order to smoothly transition to the vim.lsp.start interface in the future,
adding checkhealth here is meaningless. Only the lspinfo information window
is available. So shown deprecate servers list in LspInfo and update the
server deprecate remove version to 0.2.1. 0.2.0 is tagged too
quickly cause some servers not removed.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Diffstat (limited to 'lua/lspconfig.lua')
| -rw-r--r-- | lua/lspconfig.lua | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua index b9012f87..f5129bc6 100644 --- a/lua/lspconfig.lua +++ b/lua/lspconfig.lua @@ -4,44 +4,57 @@ local M = { util = require 'lspconfig.util', } +--- Deprecated config names. +--- ---@class Alias ---@field to string The new name of the server ---@field version string The version that the alias will be removed in ----@param name string ----@return Alias -local function server_alias(name) - local aliases = { - ['fennel-ls'] = { - to = 'fennel_ls', - version = '0.2.0', - }, - ruby_ls = { - to = 'ruby_lsp', - version = '0.2.0', - }, - ['starlark-rust'] = { - to = 'starlark_rust', - version = '0.2.0', - }, - sumneko_lua = { - to = 'lua_ls', - version = '0.2.0', - }, - tsserver = { - to = 'ts_ls', - version = '0.2.0', - }, - } +---@field inconfig? boolean need shown in lspinfo +local aliases = { + ['fennel-ls'] = { + to = 'fennel_ls', + version = '0.2.1', + }, + ruby_ls = { + to = 'ruby_lsp', + version = '0.2.1', + }, + ['starlark-rust'] = { + to = 'starlark_rust', + version = '0.2.1', + }, + sumneko_lua = { + to = 'lua_ls', + version = '0.2.1', + }, + tsserver = { + to = 'ts_ls', + version = '0.2.1', + }, +} - return aliases[name] +---@return Alias +---@param name string|nil get this alias, or nil to get all aliases that were used in the current session. +M.server_aliases = function(name) + if name then + return aliases[name] + end + local used_aliases = {} + for sname, alias in pairs(aliases) do + if alias.inconfig then + used_aliases[sname] = alias + end + end + return used_aliases end local mt = {} function mt:__index(k) if configs[k] == nil then - local alias = server_alias(k) + local alias = M.server_aliases(k) if alias then vim.deprecate(k, alias.to, alias.version, 'lspconfig', false) + alias.inconfig = true k = alias.to end |
