fix(lua): vim.validate message param #33675

Problem:
vim.validate does not handle `message` param.

Solution:
Add the missing logic.
This commit is contained in:
Justin M. Keyes
2025-05-04 16:36:32 -07:00
committed by GitHub
parent 0862c1036a
commit 40351bbbbe
4 changed files with 28 additions and 15 deletions

View File

@ -475,7 +475,8 @@ lsp.config = setmetatable({ _configs = {} }, {
--- @param cfg vim.lsp.Config
__newindex = function(self, name, cfg)
validate_config_name(name)
validate('cfg', cfg, 'table')
local msg = ('table (hint: to resolve a config, use vim.lsp.config["%s"])'):format(name)
validate('cfg', cfg, 'table', msg)
invalidate_enabled_config(name)
self._configs[name] = cfg
end,
@ -485,7 +486,8 @@ lsp.config = setmetatable({ _configs = {} }, {
--- @param cfg vim.lsp.Config
__call = function(self, name, cfg)
validate_config_name(name)
validate('cfg', cfg, 'table')
local msg = ('table (hint: to resolve a config, use vim.lsp.config["%s"])'):format(name)
validate('cfg', cfg, 'table', msg)
invalidate_enabled_config(name)
self[name] = vim.tbl_deep_extend('force', self._configs[name] or {}, cfg)
end,