Add a documentation class instead of a formatted string.
LadyCailinBot opened this issue · 3 comments
CMDHELPER-2915 - Reported by ACzChef
Right now functions have to pass in a string for their docs, that then later gets parsed into usable data.
My suggestion is to have a documentation class where you just define all the fields such as description, return type, arguments, name, etc. and use that instead. It would be cleaner, and less error prone.
Related to #1247, which adds the option to supply function return value and parameter descriptions.
Yes! We can start to phase the old docstring out if the signature is there. As a first step, I will just supercede the data in the docstring, but eventually it can be entirely removed, and the docstring will be exclusively the “body”.
Comment by EntityReborn
I like this. A use case could be as follows:{{
public String docs() {
FunctionDocs docs = new FunctionDocs();
docs.setReturns("void");
docs.addExpects("boolean");
docs.addExpects("player, boolean");
docs.setExplanation("Something meaningful here.");
return docs.toString();
}
}}
This would return:{{
"void {boolean | player, boolean} Something meaningful here."
}}
This would also be implemented for Events, as I always get confused as to what goes where.