fix(gen_vimdoc): correctly generate function fields

This commit is contained in:
TheLeoP 2024-06-21 14:44:40 -05:00 committed by Lewis Russell
parent 5a8a34dafa
commit 6c3f7e7e27

View File

@ -253,9 +253,12 @@ end
--- @return nvim.luacats.parser.field
local function fun2field(fun)
local parts = { 'fun(' }
local params = {} ---@type string[]
for _, p in ipairs(fun.params or {}) do
parts[#parts + 1] = string.format('%s: %s', p.name, p.type)
params[#params + 1] = string.format('%s: %s', p.name, p.type)
end
parts[#parts + 1] = table.concat(params, ', ')
parts[#parts + 1] = ')'
if fun.returns then
parts[#parts + 1] = ': '