Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio auto complete Doxygen tags for C++

Is there a way to make visual studio automatically place the doxygen tags in a C++ source file ?

What I mean is for example this piece of code:

int foo(bool p);

If I type /// on top of it, Visual Studio automatically generates the following lines:

/// <summary>
/// 
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
int foo(bool p);

My question is: is it possible to do the same with doxygen (when I type /**)? To make VS generate the following:

   /**
    * @brief
    * @param p
    * @return
    */
    int foo(bool p)

My question is about writing the documentation tags (not generating the final doxygen).

like image 739
Pierre Baret Avatar asked Oct 26 '18 14:10

Pierre Baret


People also ask

What is Doxygen in C?

Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, and to some extent D.

How do I add Doxygen comments in C++?

Once specified, you can generate the comment stub by typing the respective “///” or “/**” above a function, or by using the (Ctrl+/) shortcut.


2 Answers

There is a setting in VS19 that does just that:

Tools > Options > Text Editor > C/C++ > CodeStyle > General > Generated documentation comments style

Set this to Doxygen (/**)

like image 157
Iizuki Avatar answered Oct 16 '22 07:10

Iizuki


I don't know why this did not pop out on my search on Visual Studio Marketplace, but this does the job using /*! doxygen tag.

https://marketplace.visualstudio.com/items?itemName=dragospop.CppDoxyComplete

Example:

/*!
 * 
 * 
 * \param b
 * \return 
 */
int foo(bool b)
like image 40
Pierre Baret Avatar answered Oct 16 '22 05:10

Pierre Baret