4

When using Visual Studio 2019, when I hit enter within a block comment in a C++ file it adds a leading * . I've found a solution to this problem for C# at How do I stop Visual Studio from automatically inserting asterisk during a block comment? but the same option is not present for C++ and changing the C# option doesn't disable the feature for C++. This does not occur with Visual Studio 2017.

So when I have:

/*<cursor here>
*/

and I hit enter I want it to look like:

/*
<cursor here>
*/

but instead I get

/*
* <cursor here>
*/

Is there an option somewhere that disables this behavior or another way to do so?

Dodge
  • 43
  • 3

2 Answers2

3
  • In VS2019, click menu Tools\Options
  • In the search field up to the left, type comment style
  • In the tree view that appears under the search field, you should see a few nodes, Select the bottom node in the Text Editor/C/C++ tree (currently named General).
  • To the right, you'll have a checkbox:
    [x] Insert existing comment style at the start of new lines when writing comments. Uncheck that.

Done.

Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
0

According to the link: https://developercommunity2.visualstudio.com/t/disable-new-extend-multiline-comments-in/1185751

It seems an issue, and the issue was fixed in 16.8. I suggest you could install the most recent release from https://visualstudio.microsoft.com/downloads/. Or you could update your Visual studio.

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20
  • I have Microsoft Visual Studio Community 2019 Version 16.9.3. Ted's answer worked for me though. That solution is also present in the link you posted here. – Dodge May 02 '21 at 23:24