vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

New lines are removed from docstrings if prefixed by "@brief" Doxygen style

Open Delgan opened this issue 2 years ago • 8 comments

Environment

  • OS and version: Ubutnu 20.04
  • VS Code: 1.72.2
  • C/C++ extension: v1.12.4
  • OS and version of remote machine (if applicable): Ubuntu 20.04 (dev container)
  • GDB / LLDB version: N/A

Bug Summary and Steps to Reproduce

Bug Summary:

When a docstrings starts with @brief (which is a Doxygen convention), then newlines are ignored. This is not very convenient, because the @brief should appear on the first line and detailed description on following blocks.

/**
 * @brief A brief description.
 * 
 * Detailed description starts here.
 */
void foobar() {}

With @brief:

with_brief

Without @brief (expected):

without_brief

Debugger Configurations

N/A

Debugger Logs

N/A

Other Extensions

No response

Additional Information

No response

Delgan avatar Oct 20 '22 13:10 Delgan

It seems it's a regression, it was already fixed with:

  • https://github.com/microsoft/vscode-cpptools/issues/5741

Delgan avatar Oct 20 '22 13:10 Delgan

It's not a regression -- the fix was to turn the newline into a space.

sean-mcmanus avatar Oct 21 '22 01:10 sean-mcmanus

This was opened on VS at https://developercommunity.visualstudio.com/t/Tooltips-are-not-showing-doxygen-comment/10087897 . They closed it as "not a bug". You could try filing a feature request.

sean-mcmanus avatar Oct 21 '22 01:10 sean-mcmanus

@sean-mcmanus Indeed, sorry for calling this a regression. I thought it worked some times ago, I must have been dreaming.

Following your advice, I opened a "feature request" ticket here: Avoid converting newlines into spaces in Doxygen "brief" comments (#10178887). :+1:

Delgan avatar Oct 21 '22 11:10 Delgan

I have realised its not just the @brief that's causing the problem... Instead, it is any type of Doxygen specific keyword (i.e. @param, @note, @return, @returns). Without any keywords, newlines are preserved.

Example with no Doxygen keywords: good

Example with Doxygen keyword used: broken

dimsanius avatar Dec 12 '22 20:12 dimsanius

@sean-mcmanus Indeed, sorry for calling this a regression. I thought it worked some times ago, I must have been dreaming.

Following your advice, I opened a "feature request" ticket here: Avoid converting newlines into spaces in Doxygen "brief" comments (#10178887). 👍

Make sure to upvote here: https://developercommunity.visualstudio.com/t/Avoid-converting-newlines-into-spaces-in/10178887

IMO it's a bug.

JPHutchins avatar Jul 30 '23 21:07 JPHutchins

An annoying workaround (setup process and only one new line) until this is pushed to release is to use the @detail command to get a line break between the brief and description. Make sure to enable the details tag in Extensions -> C/C++ -> Code Documentation -> Section Tags (C_Cpp.doxygen.sectionTags)

bastian2001 avatar Apr 12 '24 00:04 bastian2001

This problem still exist.

BA7LYA avatar Jul 05 '24 07:07 BA7LYA

An another workaround which may helps but has not regular font style. output

/**
 * @brief #### Test description 1
 * @brief #### Test description 2
 * @brief #### Test description 3
 * @param x integer
 * @param y integer
 */
void testFunction() {
...
}

emrekz avatar Jul 14 '24 23:07 emrekz

I believe this is fixed starting in 1.21.1 pre-release (soon to be published). We will interpret an empty line as a paragraph break.

/**
 * @brief Hello there 
 * 
 * Hello again
 */
void foo();

image

bobbrow avatar Jul 15 '24 16:07 bobbrow

I believe this is fixed starting in 1.21.1 pre-release (soon to be published). We will interpret an empty line as a paragraph break.

/**
 * @brief Hello there 
 * 
 * Hello again
 */
void foo();

image

It's fixed! I'm crying. 🥲

/**
 * @brief Encode the response into a packet.
 * 
 * Newlines work!  If there's a blank line first!
 * @param response The response to encode.
 * @param [out] packet Pointer to the output packet.
 * @return Error code.
 */
int api_encode(struct api_response const * response, union api_packet * out_packet);
image

JPHutchins avatar Aug 02 '24 23:08 JPHutchins

@JPHutchins from your screenshot it looks like you could benefit from #5773 as well. Did you add your 👍 to it yet?

bobbrow avatar Aug 02 '24 23:08 bobbrow