Skip to content

Commit 1f7fbc3

Browse files
authored
refactor!: deprecate old framework/configs, Nvim 0.10 #4077
1 parent 5bfcc89 commit 1f7fbc3

File tree

5 files changed

+52
-3
lines changed

5 files changed

+52
-3
lines changed

doc/lspconfig.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,41 @@ COMPLETION SUPPORT *lspconfig-completion*
115115

116116
See |lsp-completion|.
117117

118+
==============================================================================
119+
Migrate to vim.lsp.config *lspconfig-nvim-0.11*
120+
121+
The "framework" part of nvim-lspconfig is DEPRECATED. The "configs" are NOT
122+
deprecated, but were moved to the lsp/ directory so that |vim.lsp.config()|
123+
automatically finds them.
124+
125+
This means:
126+
- `require'lspconfig'[…]` must NOT be used. Use `vim.lsp.config(…)` instead.
127+
- The `require'lspconfig'` quasi-framework will be DELETED, and is not
128+
supported in Nvim 0.11+.
129+
- The nvim-lspconfig configs (|lspconfig-all|) now live in "lsp/" instead of
130+
"lua/lspconfig/".
131+
- To use the configs, call `vim.lsp.config(…)` instead of `require'lspconfig'[…]`.
132+
133+
MIGRATION INSTRUCTIONS
134+
135+
To migrate:
136+
- Upgrade to Nvim 0.11 or later.
137+
- Change `require'lspconfig'[…]` to `vim.lsp.config(…)`.
138+
- Some field names changed, see |lspconfig-vs-vim.lsp.config|.
139+
- See |lsp-config| for details.
140+
141+
BACKGROUND
142+
143+
Since Nvim 0.11, nvim-lspconfig provides configs in its "lsp/" directory. The
144+
old configs still exist in "lua/lspconfig/configs/" but are deprecated and
145+
will be DELETED.
146+
147+
This means the "configs" role of nvim-lspconfig continues to be relevant, but
148+
it is now a "data-only" repository instead of a "framework". The only change
149+
needed from you, and from plugins, is to use the Nvim 0.11 `vim.lsp.config`
150+
interface to setup LSP configs instead of the old `require'lspconfig'`
151+
quasi-framework.
152+
118153
==============================================================================
119154
DEBUGGING AND TROUBLESHOOTING *lspconfig-debugging*
120155

lsp/volar.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--- Renamed to [vue_ls](#vue_ls)
44
---
55
---
6-
vim.deprecate('volar', 'vue_ls', '3.0.0', 'lspconfig', false)
6+
vim.deprecate('volar', 'vue_ls', '3.0.0', 'nvim-lspconfig', false)
77

88
---@type vim.lsp.Config
99
return vim.lsp.config.vue_ls

lua/lspconfig.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,19 @@ end
7777
local mt = {}
7878
function mt:__index(k)
7979
if configs[k] == nil then
80+
if vim.fn.has('nvim-0.11') == 1 then
81+
vim.deprecate(
82+
'The `require(\'lspconfig\')` "framework"',
83+
'vim.lsp.config (see :help lspconfig-nvim-0.11)',
84+
'v3.0.0',
85+
'nvim-lspconfig',
86+
false
87+
)
88+
end
89+
8090
local alias = M.server_aliases(k)
8191
if alias then
82-
vim.deprecate(k, alias.to, alias.version, 'lspconfig', false)
92+
vim.deprecate(k, alias.to, alias.version, 'nvim-lspconfig', false)
8393
alias.inconfig = true
8494
k = alias.to
8595
end

lua/lspconfig/configs.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function configs.__newindex(t, config_name, config_def)
4949
config_name,
5050
config_def.default_config.deprecate.to,
5151
config_def.default_config.deprecate.version,
52-
'lspconfig',
52+
'nvim-lspconfig',
5353
false
5454
)
5555
end

plugin/lspconfig.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ if vim.g.lspconfig ~= nil then
33
end
44
vim.g.lspconfig = 1
55

6+
if vim.fn.has('nvim-0.11') == 0 then
7+
vim.deprecate('nvim-lspconfig support for Nvim 0.10 or older', 'Nvim 0.11+', 'v3.0.0', 'nvim-lspconfig', false)
8+
end
9+
610
local api, lsp = vim.api, vim.lsp
711
local util = require('lspconfig.util')
812

0 commit comments

Comments
 (0)