doxdocgen
doxdocgen copied to clipboard
Different @param templates for pointer and non-pointer types
Is your feature request related to a problem? Please describe.
This is mostly related to the [in/out] direction specifiers for parameters in c/c++.
I usually specify all non-pointer parameters with @param xxx, since their direction is implicitly in, and pointer parameters with @param[dir] xxx, to make their direction obvious.
Since there is currently only one paramTemplate configuration, I have two options.
1. "doxdocgen.generic.paramTemplate": "@param {param} " and add [dir] for all pointer parameters manually
2. "doxdocgen.generic.paramTemplate": "@param[??] {param} " and remove [dir] for all non-pointer parameters manually
Describe the solution you'd like
A separate paramTemplate for pointer types, so that less manual editing will be required.
Example of current behaviour:
Settings:
"doxdocgen.generic.paramTemplate": "@param {param}
What is generated:
/**
* @brief
*
* @param buff
* @param len
* @return int
*/
int send_buffer(uint8_t *buff, uint16_t len);
Example of suggested behaviour:
Settings:
"doxdocgen.generic.paramTemplate": "@param {param}
"doxdocgen.generic.pointerParamTemplate": "@param[??] {param}
What is generated:
/**
* @brief
*
* @param[??] buff
* @param len
* @return int
*/
int send_buffer(uint8_t *buff, uint16_t len);
Is something like this possible?
hope to increase this demand
Hi @TjazVracko ,
great detailed feature suggestion!
Is something like this possible?
I think this should be possible but for implementing it I wouldn't limit the scope to pointers but also include references.
In addition I would prefer to make this a configuration template like this:
"doxdocgen.generic.paramTemplate": "@param{direction} {param}",
"doxdocgen.generic.paramDirectionInTemplate": "[{in}]",
"doxdocgen.generic.paramDirectionOutTemplate": "[{out}]"
as it doesn't break existing code if {direction} isn't specified.
This is more complicated but it also handles the usecase from #122 where non-const parameters are treated without any direction specifier.
@cschlosser great!
If one were to attempt to implement this themselves, how might they go about it? any pointers?
Hi @TjazVracko ,
Sorry for keeping you waiting so long. I think first one should extend this class: https://github.com/cschlosser/doxdocgen/blob/master/src/Lang/Cpp/CppArgument.ts With an In/Out field.
The arguments are extracted from the tree here: https://github.com/cschlosser/doxdocgen/blob/66816501cae9f60d0f363b4476cffd8b7c896505/src/Lang/Cpp/CppParser.ts#L545
and finally one has to read the field here and use the correct templated string then: https://github.com/cschlosser/doxdocgen/blob/66816501cae9f60d0f363b4476cffd8b7c896505/src/Lang/Cpp/CppDocGen.ts#L407