diff options
| author | Colin Kennedy <colinvfx@gmail.com> | 2024-12-11 01:01:14 -0800 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2024-12-13 17:05:38 +0000 |
| commit | f9dd6826210335d8b37455002d767d1b37c09ce4 (patch) | |
| tree | de202d9b1f6126c07cb0b8948eee52e2e0679987 /runtime | |
| parent | 65b1733405e558e80527096a0ba42b5a678c9b54 (diff) | |
| download | rneovim-f9dd6826210335d8b37455002d767d1b37c09ce4.tar.gz rneovim-f9dd6826210335d8b37455002d767d1b37c09ce4.tar.bz2 rneovim-f9dd6826210335d8b37455002d767d1b37c09ce4.zip | |
docs(annotations): added `---@generic` support
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/doc/builtin.txt | 24 | ||||
| -rw-r--r-- | runtime/lua/vim/_meta/vimfn.lua | 29 |
2 files changed, 29 insertions, 24 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 398947a31f..5f74080e0c 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1305,10 +1305,10 @@ copy({expr}) *copy()* Also see |deepcopy()|. Parameters: ~ - • {expr} (`any`) + • {expr} (`T`) Return: ~ - (`any`) + (`T`) cos({expr}) *cos()* Return the cosine of {expr}, measured in radians, as a |Float|. @@ -1490,11 +1490,11 @@ deepcopy({expr} [, {noref}]) *deepcopy()* *E69 Also see |copy()|. Parameters: ~ - • {expr} (`any`) + • {expr} (`T`) • {noref} (`boolean?`) Return: ~ - (`any`) + (`T`) delete({fname} [, {flags}]) *delete()* Without {flags} or with {flags} empty: Deletes the file by the @@ -5281,7 +5281,7 @@ items({dict}) *items()* the index. Parameters: ~ - • {dict} (`any`) + • {dict} (`table`) Return: ~ (`any`) @@ -6567,7 +6567,7 @@ max({expr}) *max()* • {expr} (`any`) Return: ~ - (`any`) + (`number`) menu_get({path} [, {modes}]) *menu_get()* Returns a |List| of |Dictionaries| describing |menus| (defined @@ -7733,11 +7733,11 @@ reduce({object}, {func} [, {initial}]) *reduce()* *E99 Parameters: ~ • {object} (`any`) - • {func} (`function`) + • {func} (`fun(accumulator: T, current: any): any`) • {initial} (`any?`) Return: ~ - (`any`) + (`T`) reg_executing() *reg_executing()* Returns the single letter name of the register being executed. @@ -7951,10 +7951,10 @@ reverse({object}) *reverse()* < Parameters: ~ - • {object} (`any`) + • {object} (`T[]`) Return: ~ - (`any`) + (`T[]`) round({expr}) *round()* Round off {expr} to the nearest integral value and return it @@ -9952,12 +9952,12 @@ sort({list} [, {how} [, {dict}]]) *sort()* *E70 < Parameters: ~ - • {list} (`any`) + • {list} (`T[]`) • {how} (`string|function?`) • {dict} (`any?`) Return: ~ - (`any`) + (`T[]`) soundfold({word}) *soundfold()* Return the sound-folded equivalent of {word}. Uses the first diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 77c78f03d4..cf1beda15f 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -1147,8 +1147,9 @@ function vim.fn.confirm(msg, choices, default, type) end --- A |Dictionary| is copied in a similar way as a |List|. --- Also see |deepcopy()|. --- ---- @param expr any ---- @return any +--- @generic T +--- @param expr T +--- @return T function vim.fn.copy(expr) end --- Return the cosine of {expr}, measured in radians, as a |Float|. @@ -1308,9 +1309,10 @@ function vim.fn.debugbreak(pid) end --- {noref} set to 1 will fail. --- Also see |copy()|. --- ---- @param expr any +--- @generic T +--- @param expr T --- @param noref? boolean ---- @return any +--- @return T function vim.fn.deepcopy(expr, noref) end --- Without {flags} or with {flags} empty: Deletes the file by the @@ -4769,7 +4771,7 @@ function vim.fn.isnan(expr) end --- cases, items() returns a List with the index and the value at --- the index. --- ---- @param dict any +--- @param dict table --- @return any function vim.fn.items(dict) end @@ -5952,7 +5954,7 @@ function vim.fn.matchstrpos(expr, pat, start, count) end --- an error. An empty |List| or |Dictionary| results in zero. --- --- @param expr any ---- @return any +--- @return number function vim.fn.max(expr) end --- Returns a |List| of |Dictionaries| describing |menus| (defined @@ -7016,10 +7018,11 @@ function vim.fn.readfile(fname, type, max) end --- echo reduce('xyz', { acc, val -> acc .. ',' .. val }) --- < --- +--- @generic T --- @param object any ---- @param func function +--- @param func fun(accumulator: T, current: any): any --- @param initial? any ---- @return any +--- @return T function vim.fn.reduce(object, func, initial) end --- Returns the single letter name of the register being executed. @@ -7215,8 +7218,9 @@ function vim.fn.resolve(filename) end --- let revlist = reverse(copy(mylist)) --- < --- ---- @param object any ---- @return any +--- @generic T +--- @param object T[] +--- @return T[] function vim.fn.reverse(object) end --- Round off {expr} to the nearest integral value and return it @@ -9079,10 +9083,11 @@ function vim.fn.sockconnect(mode, address, opts) end --- eval mylist->sort({i1, i2 -> i1 - i2}) --- < --- ---- @param list any +--- @generic T +--- @param list T[] --- @param how? string|function --- @param dict? any ---- @return any +--- @return T[] function vim.fn.sort(list, how, dict) end --- Return the sound-folded equivalent of {word}. Uses the first |