diff options
Diffstat (limited to 'runtime/lua/vim/shared.lua')
| -rw-r--r-- | runtime/lua/vim/shared.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 18195d1126..982cfbdf81 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -366,7 +366,7 @@ local function can_merge(v) end --- Recursive worker for tbl_extend ---- @param behavior 'error'|'keep'|'force'|fun(key:any, v:any, prev_value:any): any +--- @param behavior 'error'|'keep'|'force'|fun(key:any, prev_value:any?, value:any): any --- @param deep_extend boolean --- @param ... table<any,any> local function tbl_extend_rec(behavior, deep_extend, ...) @@ -382,7 +382,7 @@ local function tbl_extend_rec(behavior, deep_extend, ...) if deep_extend and can_merge(v) and can_merge(ret[k]) then ret[k] = tbl_extend_rec(behavior, true, ret[k], v) elseif type(behavior) == 'function' then - ret[k] = behavior(k, v, ret[k]) + ret[k] = behavior(k, ret[k], v) elseif behavior ~= 'force' and ret[k] ~= nil then if behavior == 'error' then error('key found in more than one map: ' .. k) @@ -397,7 +397,7 @@ local function tbl_extend_rec(behavior, deep_extend, ...) return ret end ---- @param behavior 'error'|'keep'|'force'|fun(key:any, v:any, prev_value:any): any +--- @param behavior 'error'|'keep'|'force'|fun(key:any, prev_value:any?, value:any): any --- @param deep_extend boolean --- @param ... table<any,any> local function tbl_extend(behavior, deep_extend, ...) @@ -427,11 +427,11 @@ end --- ---@see |extend()| --- ----@param behavior 'error'|'keep'|'force'|fun(key:any, v:any, prev_value:any?): any Decides what to do if a key is found in more than one map: +---@param behavior 'error'|'keep'|'force'|fun(key:any, prev_value:any?, value:any): any Decides what to do if a key is found in more than one map: --- - "error": raise an error --- - "keep": use value from the leftmost map --- - "force": use value from the rightmost map ---- - If a function, it receives the current key, value, and the previous value in the currently merged table (if present) and should +--- - If a function, it receives the current key, the previous value in the currently merged table (if present), the current value and should --- return the value for the given key in the merged table. ---@param ... table Two or more tables ---@return table : Merged table @@ -450,11 +450,11 @@ end --- ---@generic T1: table ---@generic T2: table ----@param behavior 'error'|'keep'|'force'|fun(key:any, v:any, prev_value:any?): any Decides what to do if a key is found in more than one map: +---@param behavior 'error'|'keep'|'force'|fun(key:any, prev_value:any?, value:any): any Decides what to do if a key is found in more than one map: --- - "error": raise an error --- - "keep": use value from the leftmost map --- - "force": use value from the rightmost map ---- - If a function, it receives the current key, value, and the previous value in the currently merged table (if present) and should +--- - If a function, it receives the current key, the previous value in the currently merged table (if present), the current value and should --- return the value for the given key in the merged table. ---@param ... T2 Two or more tables ---@return T1|T2 (table) Merged table |
