kkoomen / vim-doge

(Do)cumentation (Ge)nerator for nearly 20 languages 📚 Generate proper code documentation with a single keypress. ⚡️🔥
GNU General Public License v3.0
1.01k stars 51 forks source link

Add automaticly the type for the comment for c++ #647

Closed raiseFlaymeException closed 11 months ago

raiseFlaymeException commented 11 months ago

Is your feature request related to a problem? Please describe.

when calling :DogeGenerate on a function like

template <typename T>
int test_func(int x, const char *y, const T &z);

the following comment is created:

///
/// @brief [TODO:summary]
///
/// @tparam T [TODO:description]
/// @param[[TODO:direction]] x [TODO:description]
/// @param[[TODO:direction]] y [TODO:description]
/// @param[[TODO:direction]] z [TODO:description]
/// @return [TODO:description]
///

Describe the solution you'd like

I think it would be better to have the choice to automaticly put the type of the arguments into the comment. It would generate something like:

///
/// @brief [TODO:summary]
///
/// @tparam T [TODO:description]
/// @param[int] x [TODO:description]
/// @param[const char *] y [TODO:description]
/// @param[const T &] z [TODO:description]
/// @return [TODO:description]
///

Describe alternatives you've considered

no alternatives considered

Additional context

I just installed this pluggin on neovim 0.10 and I use g:doge_doc_standard_cpp = doxygen_cpp_comment_slash.

If anything is unclear I can try to explain (I'm not english)

thank you for your time and for this project,

Flayme

kkoomen commented 11 months ago

Hi,

The direction parameter in c++ indicates whether it's an IN (incoming) or OUT (outgoing) parameters. See the Doxygen Manual:

For functions one can use the @param command to document the parameters and then use [in], [out], [in,out] to document the direction. For inline documentation this is also possible by starting with the direction attribute, e.g.

void foo(int v /**< [in] docs for input parameter v. */);

Since cpp enforces type hints, it is redundant to add type hints into doc blocks, hence Doxygen also doesn't suggest to add this within the comment. Therefore, C++ docblocks never contain type hints of the function itself.

raiseFlaymeException commented 11 months ago

thank you, I have always used the direction the wrong way. I learned something!