mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
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:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
c753e70abb
commit
dc87a0d80a
@@ -1528,11 +1528,16 @@ describe('lua stdlib', function()
|
||||
pcall_err(exec_lua, "vim.validate('arg1', nil, {'number', 'string'})")
|
||||
)
|
||||
|
||||
-- Pass an additional message back.
|
||||
-- Validator func can return an extra "Info" message.
|
||||
matches(
|
||||
'arg1: expected %?, got 3. Info: TEST_MSG',
|
||||
pcall_err(exec_lua, "vim.validate('arg1', 3, function(a) return a == 1, 'TEST_MSG' end)")
|
||||
)
|
||||
-- Caller can override the "expected" message.
|
||||
eq(
|
||||
'arg1: expected TEST_MSG, got nil',
|
||||
pcall_err(exec_lua, "vim.validate('arg1', nil, 'table', 'TEST_MSG')")
|
||||
)
|
||||
end)
|
||||
|
||||
it('vim.validate (spec form)', function()
|
||||
|
@@ -6310,7 +6310,7 @@ describe('LSP', function()
|
||||
end)
|
||||
|
||||
describe('vim.lsp.config() and vim.lsp.enable()', function()
|
||||
it('can merge settings from "*"', function()
|
||||
it('merges settings from "*"', function()
|
||||
eq(
|
||||
{
|
||||
name = 'foo',
|
||||
@@ -6326,6 +6326,15 @@ describe('LSP', function()
|
||||
)
|
||||
end)
|
||||
|
||||
it('config("bogus") shows a hint', function()
|
||||
matches(
|
||||
'hint%: to resolve a config',
|
||||
pcall_err(exec_lua, function()
|
||||
vim.print(vim.lsp.config('non-existent-config'))
|
||||
end)
|
||||
)
|
||||
end)
|
||||
|
||||
it('sets up an autocmd', function()
|
||||
eq(
|
||||
1,
|
||||
@@ -6678,21 +6687,18 @@ describe('LSP', function()
|
||||
local _ = vim.lsp.config['foo*']
|
||||
end)
|
||||
)
|
||||
|
||||
matches(
|
||||
err,
|
||||
pcall_err(exec_lua, function()
|
||||
vim.lsp.config['foo*'] = {}
|
||||
end)
|
||||
)
|
||||
|
||||
matches(
|
||||
err,
|
||||
pcall_err(exec_lua, function()
|
||||
vim.lsp.config('foo*', {})
|
||||
end)
|
||||
)
|
||||
|
||||
-- Exception for '*'
|
||||
pcall(exec_lua, function()
|
||||
vim.lsp.config('*', {})
|
||||
|
Reference in New Issue
Block a user