Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reconcile Visual Studio comment expectations with code having Doxygen comments?

It is normal for code that was written for Doxygen processing to have lines like this.

int myVariable; ///< description of myVariable

However, when Visual Studio (e.g. VS 2015) is working with code prepared with these Doxygen comments, its tooltip information for myVariable will show

XML comment contains invalid XML: Whitespace is not allowed at this location.

The problem appears to be the presence of "<" immediately following "///". That appears to be interpreted by Visual Studio as signalling (improperly formatted) XML content. However, this combination is present with the "<" to signal to Doxygen that the comment applies to the preceding item on the line, not to a following item.

Assume that we are talking about an existing body of code that already follows this Doxygen convention. It is already written this way in many places.

Is there a way to adjust or teach or set Visual Studio so that it will treat such comments as normal documenting comments for the preceding item such that they will appear in the tooltips for these items?

like image 855
Eric Avatar asked Apr 14 '16 20:04

Eric


People also ask

Can I visualize Doxygen comments in Visual Studio Code?

With the July 2020 update, Visual Studio Code supports the visualization of Doxygen comments when hovering over a function and while typing. For example, if you have the following Doxygen comment above your TriangleArea function declaration:

How do I generate comment stubs with Doxygen or XML Doc comments?

Whether you’re using Doxygen or XML Doc Comments, Visual Studio version 16.6 Preview 2 provides automatic comment stub generation as well as Quick Info, Parameter Help, and Member List tooltip support. By default, the stub generation is set to XML Doc Comments.

How do I view Doxygen comments when hovering over a function?

With the July 2020 update, Visual Studio Code supports the visualization of Doxygen comments when hovering over a function and while typing. For example, if you have the following Doxygen comment above your TriangleArea function declaration: Then when you hover over TriangleArea in your code, you’ll see the corresponding documentation:

How to comment in Visual Studio Code?

And to round it out, the mapping for uncommenting is Ctrl+K, Ctrl+U. Those are the keystrokes. Use them. Practice them. Know them. Now, Visual Studio knows how to comment in several languages. It can comment in HTML, JavaScript, SQL, C#, CSS—you name it! The comment shortcut will also lay down comments on a single line or multiple lines.


1 Answers

Doxygen has different comment styles (see manual the section about "special comment blocks", in this case the paragraph about "Putting documentation after members". Here we see the possibilities:

int var; /**< Detailed description after the member */
or
int var; //!< Detailed description after the member
//!<
or
int var; ///< Detailed description after the member

In this case we can switch from ///< to //!<

like image 85
albert Avatar answered Nov 15 '22 05:11

albert