diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-09-08 15:44:00 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2022-09-08 15:44:00 +0100 |
commit | 514a1679dcd7444c7a1b66612b3313fb249d310a (patch) | |
tree | 71b037d1b0821b02e24befc853c09cd07e35ed7d /runtime/lua/vim/_meta.lua | |
parent | b8de5ada80f7cc2cda3dc55defeb635ee39f3a24 (diff) | |
download | rneovim-514a1679dcd7444c7a1b66612b3313fb249d310a.tar.gz rneovim-514a1679dcd7444c7a1b66612b3313fb249d310a.tar.bz2 rneovim-514a1679dcd7444c7a1b66612b3313fb249d310a.zip |
refactor(vim.opt): simplify get_option_metatype
Diffstat (limited to 'runtime/lua/vim/_meta.lua')
-rw-r--r-- | runtime/lua/vim/_meta.lua | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 9e10e5ccf5..66b55a3d47 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -18,27 +18,18 @@ local key_value_options = { --- Convert a vimoption_T style dictionary to the correct OptionType associated with it. ---@return string local function get_option_metatype(name, info) - if info.type == 'boolean' then - return 'boolean' - elseif info.type == 'number' then - return 'number' - elseif info.type == 'string' then - if not info.commalist and not info.flaglist then - return 'string' - end - - if key_value_options[name] then - assert(info.commalist, 'Must be a comma list to use key:value style') - return 'map' - end - + if info.type == 'string' then if info.flaglist then return 'set' elseif info.commalist then + if key_value_options[name] then + return 'map' + end return 'array' end + return 'string' end - error('Not a known info.type:' .. info.type) + return info.type end local options_info = setmetatable({}, { |