Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Delgan opened this issue Oct 20, 2022 · 15 comments
Closed
Assignees
Labels
enhancement Improvement to an existing feature Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. fixed Check the Milestone for the release in which the fix is or will be available. Language Service Visual Studio Inherited from Visual Studio
Milestone

Comments

@Delgan
Copy link

Delgan commented Oct 20, 2022

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
Copy link
Author

Delgan commented Oct 20, 2022

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

@sean-mcmanus
Copy link
Contributor

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

@sean-mcmanus
Copy link
Contributor

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 sean-mcmanus added Visual Studio Inherited from Visual Studio enhancement Improvement to an existing feature labels Oct 21, 2022
@sean-mcmanus sean-mcmanus added this to the Tracking milestone Oct 21, 2022
@sean-mcmanus sean-mcmanus added Language Service Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. labels Oct 21, 2022
@Delgan
Copy link
Author

Delgan commented Oct 21, 2022

@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). 👍

@dimsanius
Copy link

dimsanius commented Dec 12, 2022

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

@starball5
Copy link

Related on Stack Overflow: Line breaks are not preserved following @brief and similar Doxygen keywords in the VS Code hover info with the Cpptools extension.

@JPHutchins
Copy link

@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.

@bastian2001
Copy link

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)

@BA7LYA
Copy link

BA7LYA commented Jul 5, 2024

This problem still exist.

@emrekz
Copy link

emrekz commented Jul 14, 2024

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() {
...
}

@bobbrow
Copy link
Member

bobbrow commented Jul 15, 2024

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 bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label Jul 15, 2024
@bobbrow bobbrow moved this to Done in cpptools Jul 15, 2024
@bobbrow bobbrow modified the milestones: Tracking, 1.21.1 Jul 15, 2024
@JPHutchins
Copy link

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

@bobbrow
Copy link
Member

bobbrow commented Aug 2, 2024

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

@Delgan
Copy link
Author

Delgan commented Oct 1, 2024

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 This is great, I can confirm that it works very well, thanks!

I made some tests and discovered, however, that it breaks the rendering of code blocks (v1.21.6):

/**
 * @brief Hello there
 *
 * Hello again.
 *
 * ```cpp
 * int main() {
 *     std::cout << "Hello from code\n";
 *     return 1;
 * }
 *```
 */
void foo();

Screenshot from 2024-10-01 14-07-36

Should I open a new issue?

@bobbrow
Copy link
Member

bobbrow commented Oct 1, 2024

@Delgan, I can open it for you. Thanks for reporting it. This issue was supposed to have been closed with the release of 1.21.

@bobbrow bobbrow closed this as completed Oct 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement to an existing feature Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. fixed Check the Milestone for the release in which the fix is or will be available. Language Service Visual Studio Inherited from Visual Studio
Projects
Status: Done
Development

No branches or pull requests

10 participants