19

When typing multi-line comments Visual studio used to add an automatic asterisk to each new line of the comment as I press enter(apparently 2015 does not do this anymore). I really liked this. As of right now though, if I type "/*" and enter, Visual studio does not try to autocomplete it at all. In fact, it even lets me end the comment with "*/", too, instead of doing it for me. So my question is: is anyone else experiencing this? How do I get the original functionality back, so each new line is automatically prefixed with an asterisk, and closed for me by "*/"?

I already checked and yes, my environment settings are set to C# and yes the option "Generate XML documentation comments for ///" is indeed checked in my settings.

Krythic
  • 4,184
  • 5
  • 26
  • 67
  • 3
    Funny. I never liked that behavior with the comments. I'm glad you pointed out this change. I like it better this way. :) – sstan Aug 22 '15 at 00:42
  • 2
    @sstan I don't; it bothers the crap out of me. – Krythic Aug 22 '15 at 00:42
  • Relevant: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2947213-don-t-create-asterisk-for-new-lines-within-block-c. I wonder if this caused the change... – sstan Aug 22 '15 at 00:50
  • @sstan I agree with the poster of that in one regard: it should be optional. – Krythic Aug 22 '15 at 00:51
  • That's weird, the `AutoComment` is set to `true` in the settings, but it's simply not working. As a workaround, if you have `ReSharper`, press CTRL + SHIFT + 3 to generate `/**/` with the cursor in the middle. – Pierre-Luc Pineault Aug 22 '15 at 00:51
  • @Pierre-LucPineault That doesn't work for me. I have the newest version of Resharper, too, including Resharper C++. – Krythic Aug 22 '15 at 00:53
  • It's the `ReSharper.ReSharper_BlockComment` shortcut, you can reassign it. – Pierre-Luc Pineault Aug 22 '15 at 01:02
  • I just sifted through all Visual Studio settings hoping I would see some kind of new checkbox hidden there. I didn't see anything remotely close to this as an option, though. – Krythic Aug 22 '15 at 01:09
  • 5
    The C# Coding Conventions from MSDN state "Do not create formatted blocks of asterisks around comments.". Maybe that's their way to enforce that a little? - https://msdn.microsoft.com/en-us/library/ff926074.aspx – PhilMasteG Aug 22 '15 at 14:26
  • I just wanted to point out that even Visual Studio C++ auto-completes comments, so when you type the beginning backslash-star, it adds the ending star-backslash. – Krythic Aug 30 '15 at 21:14

2 Answers2

17

This is a well-known problem, the feature fell by the way-side in the Roslyn refactoring of the C# Editor Features. Nothing to do with config or a change of preferences, it simply was not implemented.

It is currently being tracked by this Github issue. Status is "Up for grabs" right now with nobody having shown an interest in grabbing it yet as of today. Afaict, best to not hold your breath for it, I think they have several bigger fires to put out. It will surely be delivered in an update sooner or later.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • I upvoted you, but this is more informational, rather than an answer on how to get the feature back. – Krythic Aug 24 '15 at 19:01
  • 7
    Patience grasshopper, I'll first have to talk to wife into moving to rainy Redmond, then apply for a job at Microsoft, then implement the feature. 6 to 8 weeks. – Hans Passant Aug 26 '15 at 23:55
  • 2
    No need to be sarcastic. – Krythic Aug 27 '15 at 09:21
  • I agree, that characterization of my post was quite unnecessary. Just DV posts you don't like. – Hans Passant Aug 27 '15 at 11:40
  • This is confusing to me because Roslyn is the new compiler but Visual Studio is the IDE. I believe your answer, but I don't understand how this is the case. – Sam Rueby Oct 06 '15 at 16:03
  • The basic reason to create Roslyn in the first place was to make other tools smarter about C# code, without them each having to implement a C# language parser. Like the editor. – Hans Passant Oct 06 '15 at 16:07
0

Just wanted to update and say that this problem was apparently fixed(sort of) in one of the newer updates of Visual Studio. The editor still does not complete the comment for you, but it does at least keep the formatting consistent, and adds an asterisk to the next line for you.

Krythic
  • 4,184
  • 5
  • 26
  • 67