mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +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
@@ -135,19 +135,7 @@ local yank_cancel --- @type fun()?
|
||||
--- - event event structure (default vim.v.event)
|
||||
--- - priority integer priority (default |vim.hl.priorities|`.user`)
|
||||
function M.on_yank(opts)
|
||||
vim.validate({
|
||||
opts = {
|
||||
opts,
|
||||
function(t)
|
||||
if t == nil then
|
||||
return true
|
||||
else
|
||||
return type(t) == 'table'
|
||||
end
|
||||
end,
|
||||
'a table or nil to configure options (see `:h vim.hl.on_yank`)',
|
||||
},
|
||||
})
|
||||
vim.validate('opts', opts, 'table', true)
|
||||
opts = opts or {}
|
||||
local event = opts.event or vim.v.event
|
||||
local on_macro = opts.on_macro or false
|
||||
|
||||
Reference in New Issue
Block a user