Open UtkarshVerma opened 8 months ago
It will be somewhat difficult to support this. We currently don't bother formatting comments at all, since comments could consist of anything.
We could support formatting specifically doc comments, however there is no "standardised" way of defining documentation comments in Lua (luadoc, emmylua, LuaCATs, moonwave, etc.), so it isn't clear which one, if any, we should support.
At the very minimum, we could enforce consistent whitespace in doc comments:
---text1
--- text2
--- @param a
---@return string
becomes:
--- text1
--- text2
--- @param a
--- @return string
Where the padding maybe configurable.
Also line-breaks would be very nice to have. If I write some longer API documentation, it would be great, if stylua could at least wrap long lines to what was specified in column_width
.
LuaCATS offers a way to specify the types through comments. Currently, stylua does not format it. For example, the code below:
should be formatted as: