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?
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:
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.
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:
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.
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 //!<
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With