Julian
Julian

Reputation: 1736

How to enable the automatic asterisk in Visual Studio 2010 when adding a multi-line comment in C++?

I've seen many people complain about Visual Studio automatically adding an asterisk in multi-line comments for C#. My question is: How do I enable this behaviour for C++?

Example:

/**
 * I want
 * my comments
 * to look like this
 */

/**
But,
they look like this
*/

Thanks!

Upvotes: 7

Views: 2002

Answers (2)

geometrian
geometrian

Reputation: 15387

This behavior is automatically enabled in new Visual Studio installs, but you can set whether it is enabled or disabled by going to "Tools" -> "Options", then under "Text Editor" -> "C/C++" -> "Code Style"[ -> "General"], then twiddle "Insert existing comment style at the start of new lines when writing comments" to your liking: options panel Obligatory image of the options panel, since no one reads text anymore.

(I myself have the feature disabled, since I find it annoying—when I comment out code, adding random asterisks when I make small changes is clearly deleterious.)

Upvotes: 1

Tonia Sanzo
Tonia Sanzo

Reputation: 355

I noticed in Visual Studio 2019 that if you place your text cursor just after the first asterisk in a block comment and hit enter it will automatically put an asterisk on the next line.

Step 1) Place text cursor to the right of the first asterisk in a block comment separated by a newline.

step 1

Step 2) Hit enter and Visual Studio 2019 will automatically place a asterisk on the next line.

step 2

Upvotes: 2

Related Questions