diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-10-18 11:33:12 +0100 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-10-21 11:32:06 +0100 |
commit | 3572319b4cb1a4163624a5fe328886f1928dbc4a (patch) | |
tree | 5e190a6d9ca8a2e0f998ef578f895efee9450fb4 /runtime/lua/vim/_watch.lua | |
parent | 6fd13eeddaf5db89c1b81cc7d3d3f1a7da5401a7 (diff) | |
download | rneovim-3572319b4cb1a4163624a5fe328886f1928dbc4a.tar.gz rneovim-3572319b4cb1a4163624a5fe328886f1928dbc4a.tar.bz2 rneovim-3572319b4cb1a4163624a5fe328886f1928dbc4a.zip |
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.
Diffstat (limited to 'runtime/lua/vim/_watch.lua')
-rw-r--r-- | runtime/lua/vim/_watch.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index 7a306d1123..13894c6147 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -59,9 +59,9 @@ end --- @param callback vim._watch.Callback Callback for new events --- @return fun() cancel Stops the watcher function M.watch(path, opts, callback) - vim.validate('path', path, 'string', false) + vim.validate('path', path, 'string') vim.validate('opts', opts, 'table', true) - vim.validate('callback', callback, 'function', false) + vim.validate('callback', callback, 'function') opts = opts or {} @@ -125,9 +125,9 @@ end --- @param callback vim._watch.Callback Callback for new events --- @return fun() cancel Stops the watcher function M.watchdirs(path, opts, callback) - vim.validate('path', path, 'string', false) + vim.validate('path', path, 'string') vim.validate('opts', opts, 'table', true) - vim.validate('callback', callback, 'function', false) + vim.validate('callback', callback, 'function') opts = opts or {} local debounce = opts.debounce or 500 |