Skip to content

Commit b4d65bc

Browse files
committed
fix: remove validation from configs.lua
This is because using the old syntax for vim.validate causes `:checkhealth vim.deprecated` to be flooded with deprecated messages. It would also be possible to do a version check and use the newer syntax for vim.validate, but since configs.lua will be replaced by vim.lsp.config in the future there is little need to future-proof it. Closes #3583.
1 parent c31abb8 commit b4d65bc

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

lua/lspconfig/configs.lua

+2-40
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
local util = require 'lspconfig.util'
77
local async = require 'lspconfig.async'
8-
local api, validate, lsp, fn = vim.api, vim.validate, vim.lsp, vim.fn
8+
local api, lsp, fn = vim.api, vim.lsp, vim.fn
99
local tbl_deep_extend = vim.tbl_deep_extend
1010

1111
local configs = {}
@@ -39,14 +39,6 @@ end
3939
---@param config_name string
4040
---@param config_def table Config definition read from `lspconfig.configs.<name>`.
4141
function configs.__newindex(t, config_name, config_def)
42-
validate {
43-
name = { config_name, 's' },
44-
default_config = { config_def.default_config, 't' },
45-
on_new_config = { config_def.on_new_config, 'f', true },
46-
on_attach = { config_def.on_attach, 'f', true },
47-
commands = { config_def.commands, 't', true },
48-
}
49-
5042
if config_def.default_config.deprecate then
5143
vim.deprecate(
5244
config_name,
@@ -57,16 +49,7 @@ function configs.__newindex(t, config_name, config_def)
5749
)
5850
end
5951

60-
if config_def.commands then
61-
for k, v in pairs(config_def.commands) do
62-
validate {
63-
['command.name'] = { k, 's' },
64-
['command.fn'] = { v[1], 'f' },
65-
}
66-
end
67-
else
68-
config_def.commands = {}
69-
end
52+
config_def.commands = config_def.commands or {}
7053

7154
local M = {}
7255

@@ -79,27 +62,6 @@ function configs.__newindex(t, config_name, config_def)
7962
function M.setup(user_config)
8063
local lsp_group = api.nvim_create_augroup('lspconfig', { clear = false })
8164

82-
validate {
83-
cmd = {
84-
user_config.cmd,
85-
{ 'f', 't' },
86-
true,
87-
},
88-
root_dir = { user_config.root_dir, { 's', 'f' }, true },
89-
filetypes = { user_config.filetype, 't', true },
90-
on_new_config = { user_config.on_new_config, 'f', true },
91-
on_attach = { user_config.on_attach, 'f', true },
92-
commands = { user_config.commands, 't', true },
93-
}
94-
if user_config.commands then
95-
for k, v in pairs(user_config.commands) do
96-
validate {
97-
['command.name'] = { k, 's' },
98-
['command.fn'] = { v[1], 'f' },
99-
}
100-
end
101-
end
102-
10365
local config = tbl_deep_extend('keep', user_config, default_config)
10466

10567
sanitize_cmd(config.cmd)

0 commit comments

Comments
 (0)