lunarmodules/ldoc

Support nested subparams

DifferentialOrange opened this issue · 2 comments

ldoc has support of subparams (even though the feature is a bit hidden):

-- A function with subfield arguments.
-- @param s string
-- @param opts multibyte encoding options
-- @param opts.charset string
-- @param opts.strict bool
-- @param verbose bool

Since Lua does not have support of named params, it is not rare to have multiple level nested tables. Unfortunately, now ldoc doesn't have nested subparams support.

The following script

-- @table opts
--
-- @table opts.mytarg1
--  My table arg 1
--
-- @string opts.mytarg1.field1
--  My table arg 1 string field
--
-- @bool opts.mytarg1.field2
--  My table arg 1 bool field

is compiled to
image
even though it would be nice to see something like
image

Restricting max nesting depth with configuration may also be useful here.

This does seem like something we should surface. I don't have much dev time to contribute right now but I am keeping an eye on PRs and if anybody chips in to contribute this I think we can facilitate it getting included.

It can be done by making a custom LTP template, see https://awesomewm.org/apidoc/core_components/client.html#shape