mirror of
https://github.com/neovim/neovim.git
synced 2026-05-03 12:35:00 +00:00
feat(vim.validate): improve fast form and deprecate spec form
Problem: `vim.validate()` takes two forms when it only needs one. Solution: - Teach the fast form all the features of the spec form. - Deprecate the spec form. - General optimizations for both forms. - Add a `message` argument which can be used alongside or in place of the `optional` argument.
This commit is contained in:
committed by
Lewis Russell
parent
6fd13eedda
commit
3572319b4c
@@ -17,10 +17,8 @@ local M = {}
|
||||
--- otherwise. {seq} is the control sequence for the capability if found, or nil for
|
||||
--- boolean capabilities.
|
||||
function M.query(caps, cb)
|
||||
vim.validate({
|
||||
caps = { caps, { 'string', 'table' } },
|
||||
cb = { cb, 'f' },
|
||||
})
|
||||
vim.validate('caps', caps, { 'string', 'table' })
|
||||
vim.validate('cb', cb, 'function')
|
||||
|
||||
if type(caps) ~= 'table' then
|
||||
caps = { caps }
|
||||
|
||||
Reference in New Issue
Block a user