mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +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
@@ -154,10 +154,8 @@ end
|
||||
--- @param lang string Name of parser
|
||||
--- @param filetype string|string[] Filetype(s) to associate with lang
|
||||
function M.register(lang, filetype)
|
||||
vim.validate({
|
||||
lang = { lang, 'string' },
|
||||
filetype = { filetype, { 'string', 'table' } },
|
||||
})
|
||||
vim.validate('lang', lang, 'string')
|
||||
vim.validate('filetype', filetype, { 'string', 'table' })
|
||||
|
||||
for _, f in ipairs(ensure_list(filetype)) do
|
||||
if f ~= '' then
|
||||
|
Reference in New Issue
Block a user