diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-10-16 17:03:48 +0100 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-10-17 16:53:52 +0100 |
commit | 3f3e4837d5f7d2d9cb1c89bd3a5b2ee8a730772a (patch) | |
tree | 54dc9c0e06c7436d18b1863e5b26272dc1948d78 /runtime/lua/vim/_editor.lua | |
parent | fa6ab0d90958516d0bc1ed62839d85405ad08fa8 (diff) | |
download | rneovim-3f3e4837d5f7d2d9cb1c89bd3a5b2ee8a730772a.tar.gz rneovim-3f3e4837d5f7d2d9cb1c89bd3a5b2ee8a730772a.tar.bz2 rneovim-3f3e4837d5f7d2d9cb1c89bd3a5b2ee8a730772a.zip |
perf(validate): use lighter version
- Also fix `vim.validate()` for PUC Lua when showing errors for values
that aren't string or number.
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index ce269f087d..f0b8cf6a52 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -473,9 +473,7 @@ do --- @param handle? false|integer --- @return vim.var_accessor local function make_dict_accessor(scope, handle) - validate({ - scope = { scope, 's' }, - }) + validate('scope', scope, 'string') local mt = {} function mt:__newindex(k, v) return vim._setvar(scope, handle or 0, k, v) @@ -1171,12 +1169,10 @@ function vim.deprecate(name, alternative, version, plugin, backtrace) local displayed = vim._truncated_echo_once(msg) return displayed and msg or nil else - vim.validate { - name = { name, 'string' }, - alternative = { alternative, 'string', true }, - version = { version, 'string', true }, - plugin = { plugin, 'string', true }, - } + vim.validate('name', name, 'string') + vim.validate('alternative', alternative, 'string', true) + vim.validate('version', version, 'string', true) + vim.validate('plugin', plugin, 'string', true) local msg = ('%s is deprecated'):format(name) msg = alternative and ('%s, use %s instead.'):format(msg, alternative) or (msg .. '.') |