From 76de3e2d07f20c77b7ee6f72c8ec27b045e51ed1 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 16 Jun 2025 11:45:44 +0100 Subject: docs(api): document types using LuaCATS types - Render Lua types in api.txt. - Added `DictAs(name)` API type which acts the same as `Dict` (no parens) when generating the dispatchers, but acts the same as `Dict(name)` when generating docs. - Added `Tuple(...)` API type which is the treated the as `Array` for generating the dispatchers, but is used to document richer types. - Added `Enum(...)` API type to better document enums - Improve typing of some API functions. - Improve c_grammar to properly parse API types and replace string pattern logic in the parsers. - Removed all the hardcoded type overrides in gen_eval_files.lua --- runtime/lua/vim/_meta/api_keysets.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'runtime/lua/vim/_meta/api_keysets.lua') diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index 65cfa349bc..da537da5d6 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -24,15 +24,15 @@ error('Cannot require a meta file') --- @class vim.api.keyset.cmd --- @field cmd? string ---- @field range? any[] +--- @field range? integer[] --- @field count? integer --- @field reg? string --- @field bang? boolean --- @field args? string[] ---- @field magic? table ---- @field mods? table ---- @field nargs? integer|string ---- @field addr? string +--- @field magic? vim.api.keyset.cmd.magic +--- @field mods? vim.api.keyset.cmd.mods +--- @field nargs? integer|"?"|"+"|"*" +--- @field addr? "line"|"arg"|"buf"|"load"|"win"|"tab"|"qf"|"none"|"?" --- @field nextcmd? string --- @class vim.api.keyset.cmd_magic @@ -79,7 +79,7 @@ error('Cannot require a meta file') --- @class vim.api.keyset.create_autocmd --- @field buffer? integer ---- @field callback? string|(fun(args: vim.api.keyset.create_autocmd.callback_args): boolean?) +--- @field callback? string|fun(args: vim.api.keyset.create_autocmd.callback_args): boolean? --- @field command? string --- @field desc? string --- @field group? integer|string @@ -294,9 +294,9 @@ error('Cannot require a meta file') --- @field col? number --- @field width? integer --- @field height? integer ---- @field anchor? 'NW'|'NE'|'SW'|'SE' ---- @field relative? 'cursor'|'editor'|'laststatus'|'mouse'|'tabline'|'win' ---- @field split? 'left'|'right'|'above'|'below' +--- @field anchor? "NW"|"NE"|"SW"|"SE" +--- @field relative? "cursor"|"editor"|"laststatus"|"mouse"|"tabline"|"win" +--- @field split? "left"|"right"|"above"|"below" --- @field win? integer --- @field bufpos? integer[] --- @field external? boolean @@ -304,12 +304,12 @@ error('Cannot require a meta file') --- @field mouse? boolean --- @field vertical? boolean --- @field zindex? integer ---- @field border? 'none'|'single'|'double'|'rounded'|'solid'|'shadow'|string[] +--- @field border? string[]|"none"|"single"|"double"|"rounded"|"solid"|"shadow" --- @field title? any ---- @field title_pos? 'center'|'left'|'right' +--- @field title_pos? "center"|"left"|"right" --- @field footer? any ---- @field footer_pos? 'center'|'left'|'right' ---- @field style? 'minimal' +--- @field footer_pos? "center"|"left"|"right" +--- @field style? "minimal" --- @field noautocmd? boolean --- @field fixed? boolean --- @field hide? boolean -- cgit