mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
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
This commit is contained in:
committed by
Lewis Russell
parent
3eaa6c5a66
commit
76de3e2d07
@ -63,12 +63,14 @@ describe('api metadata', function()
|
||||
-- Dictionary was renamed to Dict. That doesn't break back-compat because clients don't actually
|
||||
-- use the `return_type` field (evidence: "ArrayOf(…)" didn't break clients).
|
||||
f.return_type = f.return_type:gsub('Dictionary', 'Dict')
|
||||
f.return_type = f.return_type:gsub('^ArrayOf%(.*', 'Array')
|
||||
|
||||
f.deprecated_since = nil
|
||||
for idx, _ in ipairs(f.parameters) do
|
||||
-- Dictionary was renamed to Dict. Doesn't break back-compat because clients don't actually
|
||||
-- use the `parameters` field of API metadata (evidence: "ArrayOf(…)" didn't break clients).
|
||||
f.parameters[idx][1] = f.parameters[idx][1]:gsub('Dictionary', 'Dict')
|
||||
f.parameters[idx][1] = f.parameters[idx][1]:gsub('ArrayOf%(.*', 'Array')
|
||||
|
||||
f.parameters[idx][2] = '' -- Remove parameter name.
|
||||
end
|
||||
|
Reference in New Issue
Block a user