My colleagues and I have settled on a way of documenting our C functions along the lines of:
/// ---------------------------------------------------------------------------
/// @brief A brief description of the function
/// @details More in-depth documentation (if needed)
/// @param myParameter A description of the parameter.
/// @return What should we expect to be returned?
/// ---------------------------------------------------------------------------
bool aWellDocumentedFunction(int myParameter)
{
// ...
}
When I hover the mouse over this method in VS Code, it pops up a mangled Quick Info box that looks like this:
Clearly, the tooling is able to recognize the Doxygen style tags and treat those accordingly, but it is also picking up the horizontal rules and including those as part of the text, while the @details
section is filtered out.
If I remove the horizontal 'lines' from the comment, then I get a popup that's perfect.
Now clearly I could remove the 'lines', and personally I would be fine with that, but others in the team like the 'lines' as they think it provides a useful visual cue that helps with editing (and I see their point). This comment style is something we've negotiated and agreed on while we were using Eclipse, which didn't have this issue. This format is something we all feel we can live with, but its a shame that VS Code mangles the 'Intellisense' so badly. It clearly has the capability to ignore or reformat parts of the comment because it is not showing the @details
tag and it's formatting the parameters and returns tags.
Is there any way we can prevent VS Code from including those horizontal lines in its popups?
As far as I'm aware, no- this behaviour is not configurable (at least- not at the time of this writing). This is the C++ extension's Hover
contribution, and the only setting for the C++ extension that includes the substring "hover" is C_Cpp.hover
, which is to enable or disable whether the extension provides hover info at all.
You could write a feature request. If you do so, please comment here with a link to your issue ticket, and do the maintainers he courtesy of not writing a low-effort issue ticket (take the time to explain exactly what you want and why).