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

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

Solution:
Add the missing logic.

(cherry picked from commit 40351bbbbe)
This commit is contained in:
Justin M. Keyes
2025-05-04 16:36:32 -07:00
committed by github-actions[bot]
parent c753e70abb
commit dc87a0d80a
4 changed files with 28 additions and 15 deletions

View File

@@ -457,7 +457,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,
@@ -467,7 +468,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,