locked
Disabling Comment Formatting in C# Editor RRS feed

  • Question

  • I'd like to know how to disable the automatic comment formatting in the Visual Studio C# editor. I greatly dislike the way that it adds a leading asterisk in front of each new line in a comment. Instead of this:

     

    /* This is a multi-line

     * comment that has been

     * mangled by the editor. */

     

    I want to have this:

     

    /* This is a multi-line

    comment that looks

    exactly as I intended. */

     

    Is there a way to disable this annoying feature?

     

    Thanks,

    PMP

    Friday, July 27, 2007 3:09 AM

Answers

  • Hi, PMP

    The feature help us to give the same indent of the comment, which looks tidy.  I don't regard it as annoying thing Smile

    As far as I know, there is no built-in function to disable such a feature, however you may find other 3-rd party add-in for this.

    Thanks

    Tuesday, July 31, 2007 4:11 AM
  • Hi Karl,

    Really thank you for your feedback!

    You can also post the suggestions to our Connect feedback portal. Our developer will evaluate them seriously and take them into consideration when designing future release of the product.
    http://connect.microsoft.com/VisualStudio/


    Improving the quality of our products and services is a never ending process for Microsoft.

    Thanks again!
    Friday, September 21, 2007 2:15 AM

All replies

  • Hi, PMP

    The feature help us to give the same indent of the comment, which looks tidy.  I don't regard it as annoying thing Smile

    As far as I know, there is no built-in function to disable such a feature, however you may find other 3-rd party add-in for this.

    Thanks

    Tuesday, July 31, 2007 4:11 AM
  • I find this feature more than annoying.

     

    a) It makes paragraph-reformatting comments quite difficult and time consuming.

     

    b) I like to write large, conceptual and overall descriptive comments in code, and later clip them out into other writing tools (i.e. WinWord), then reformat and edit them, to create documentation.  After I get WinWord to format the paragraphs, I have to find all the stray asterisks and remove them.

     

    Please don't tell me about the XML-commenting features of VS: I know about them, and don't like them (or Doxygen or any other "documentation generators").  So far as I am concerned, they are a mechanism for generating fake documentation, consisting of huge amounts of redundant junk with little real information.  They are a crutch for people who can't write, and for ignorant managers who just want to be able to pretend that documentation exists.

     

    The best solution I have found to the VS commenting "feature" is to load the source code into vim, which knows how to "undecorate" the comments.  This is tedious; moreover, if I later try to edit the comments in VS, it screws them up again.

     

    More generally, I dislike all editor features that change the actual text I type in any way.  (I don't greatly object to color-coding, or in general features which change the _appearance_ of text, without actually changing the text.)  In Visual Studio, I have gradually figured out how to turn most of them off, one by one.

     

    ** Visual Studio Feature Request: I would like a single config which would turn _all_ that stuff off, at once.

     

    ps.  One other major annoyance I have been unable to disable is when I type:

     

       public override void SomeMethod()

     

    and VS fills in the method body with a throw of some exception.  Goddamn it, if I wanted to throw an exception, I would do so.

     

    pps. The previous response from some MS person is just the kind of arrogant, patronistic *** that Microsoft is famous for and which, I thought, the company was trying to reform.  Nobody asked him whether he found the feature annoying or not: it should be sufficient that some users of the product do.  And no tool like VS should ever contains features like this comment formatting without a simple way to turn them off.  This is a bug.

    • Proposed as answer by James IT Guy Saturday, October 27, 2012 12:04 AM
    Thursday, September 20, 2007 3:21 PM
  • Hi Karl,

    Really thank you for your feedback!

    You can also post the suggestions to our Connect feedback portal. Our developer will evaluate them seriously and take them into consideration when designing future release of the product.
    http://connect.microsoft.com/VisualStudio/


    Improving the quality of our products and services is a never ending process for Microsoft.

    Thanks again!
    Friday, September 21, 2007 2:15 AM
  • The OP has a good point. For me it's not a big deal, but on those times when I want to write a big C-style block comment, the auto formatting with stars down the left side is irritating. There ought to be an option to turn it off.
    Friday, September 21, 2007 2:51 AM
  • This (/*...*/) feature is very irritating to me as well. I would cherish the option to turn this auto formatting off to allow easier formatting of my comments (pasted XML fragments, design doc notes, etc).
    Friday, June 27, 2008 3:01 PM
  • This works with Visual Studio 2005 and 2008:

    1. in the IDE, go to Tools->Import and Export Settings; then Export selected environment settings; deselect everything except Options->Text Editor; save to a new file.

    2. Edit your exported settings file in some text editor. Search for the string "AutoComment". There's a PropertyValue tag with value 1, change it to 0, and save the file.

    3. in the IDE, import this new file using Tools->Import and Export Settings. It should stop formatting comments right away.

    • Edited by zimpsonr Friday, July 4, 2008 4:11 AM tested on 2005
    Friday, July 4, 2008 12:32 AM
  • The "AutoComment" node in the settings XML is tied to the following checkbox under Tools > Options. Clearing that checkbox is easier than going through the export-edit-import process.

      Text Editor > C# > Advanced > Generate XML documentation comments for ///

    Unfortunately, turning this off not only disables the leading asterisk for block comments, but of course also disables the auto-complete feature for XML documentation comments. It would be nice if these two different "auto comment" features weren't tied together as a single option...
    Monday, August 25, 2008 4:05 PM
  • Yeay,

    Thanx for telling me how to remove that formatting, it really is irratating and I too found the comment by the MS person to be a tad arrogant.

    As to GIZ72 comment about auto-complete feature, I have been using a 3rd party add-in called Ghost doc for a year, it is absolutly wonderful for doing my auto documentation (I actually do it now) and best of all it is free.

    Don't know where to find it but a quick Goog for "GhostDoc" will do the trick.
    Tuesday, January 20, 2009 11:31 PM
  • Hurrah! Hurrah!  Hurrah!  This problem with the unwanted '*' chars has been bugging me for years.   Thanks to Davo.net for raising the question and zimpsonr for giving the answer.  As a side note, I don't think the MS people were being untoward, they were just trying to be diplomatic.  They probably hate this feature as much the rest of of us.
    hello
    Thursday, May 28, 2009 12:46 AM
  • May be using +Expand or -Collapse to turn on/off AutoComment would be a great tool, instead of hardcoding.
    Friday, May 29, 2009 12:12 AM
  • I also find the automatic asterisks irritating and hope there will be a new, separate checkbox in the next release of VS.

    The fuzzy asterisk character does not create a "tidy" boundary precisely because it is fuzzy.  Asterisks have been annoying me for 25 years, and now Microsoft has found a way to make them more annoying.

    When I want a border I use characters with strong vertical or horizontal strokes - _ # | - seems obvious to me.

    Having said that, I see the point of keeping the indentation even, and even sort of saw the idea at first, but there are just too many times that I want to put something in a comment that I do not want to be preceded by an asterisk.

    In this case I was more than happy to give up the automatic /// groups (which I actually like) for the far more frequent asterisk issue.

    One more annoying thing about this issue: tying two different features to the same UI element and not documenting it.  The worst case of course is the way MS Windows and MS Office use Control Panel display properties - various Control Panel display settings (tool tip size, icon size, ...) are co-opted for UI elements in MS programs (also undocumented), making it finicky at best to get a good set of display settings (including the massively annoying Office 2007 ribbon, which is tied to one of those attributes).
    Wayne Erfling
    Friday, June 19, 2009 4:50 PM
  • This irritates me to the point that I do not use this type of comments anymore.

     

    Microsoft strikes again!

     

     

     

     

     

    Tuesday, January 24, 2012 8:50 PM
  • I find this feature more than annoying.

     

    a) It makes paragraph-reformatting comments quite difficult and time consuming.

     

    b) I like to write large, conceptual and overall descriptive comments in code, and later clip them out into other writing tools (i.e. WinWord), then reformat and edit them, to create documentation.  After I get WinWord to format the paragraphs, I have to find all the stray asterisks and remove them.

     

    Please don't tell me about the XML-commenting features of VS: I know about them, and don't like them (or Doxygen or any other "documentation generators").  So far as I am concerned, they are a mechanism for generating fake documentation, consisting of huge amounts of redundant junk with little real information.  They are a crutch for people who can't write, and for ignorant managers who just want to be able to pretend that documentation exists.

     

    The best solution I have found to the VS commenting "feature" is to load the source code into vim, which knows how to "undecorate" the comments.  This is tedious; moreover, if I later try to edit the comments in VS, it screws them up again.

     

    More generally, I dislike all editor features that change the actual text I type in any way.  (I don't greatly object to color-coding, or in general features which change the _appearance_ of text, without actually changing the text.)  In Visual Studio, I have gradually figured out how to turn most of them off, one by one.

     

    ** Visual Studio Feature Request: I would like a single config which would turn _all_ that stuff off, at once.

     

    ps.  One other major annoyance I have been unable to disable is when I type:

     

       public override void SomeMethod()

     

    and VS fills in the method body with a throw of some exception.  Goddamn it, if I wanted to throw an exception, I would do so.

     

    pps. The previous response from some MS person is just the kind of arrogant, patronistic *** that Microsoft is famous for and which, I thought, the company was trying to reform.  Nobody asked him whether he found the feature annoying or not: it should be sufficient that some users of the product do.  And no tool like VS should ever contains features like this comment formatting without a simple way to turn them off.  This is a bug.


    Here I am in 2012 and struggling with the same issue. Has this been fixed yet?
    Saturday, October 27, 2012 12:05 AM
  • The "AutoComment" node in the settings XML is tied to the following checkbox under Tools > Options. Clearing that checkbox is easier than going through the export-edit-import process.

      Text Editor > C# > Advanced > Generate XML documentation comments for ///

    Unfortunately, turning this off not only disables the leading asterisk for block comments, but of course also disables the auto-complete feature for XML documentation comments. It would be nice if these two different "auto comment" features weren't tied together as a single option...

    It's funny that it always seems that the people with the fewest number of points always have the best answers. I always picture the MS people sitting in electric chairs with 12 cameras with microphones. If they don't respond in the "MS Way", they get zapped with 12,000 Volts! I wonder if the same brain numbness stays with them when they get home? I didn't propose this response as the answer, because the real problem is with Microsoft culture itself. Everybody seems to know this except for Gates and his cohorts!
    Saturday, October 27, 2012 12:15 AM
  • The "AutoComment" node in the settings XML is tied to the following checkbox under Tools > Options. Clearing that checkbox is easier than going through the export-edit-import process.

      Text Editor > C# > Advanced > Generate XML documentation comments for ///

    Unfortunately, turning this off not only disables the leading asterisk for block comments, but of course also disables the auto-complete feature for XML documentation comments. It would be nice if these two different "auto comment" features weren't tied together as a single option...

    These should absolutely be separate options!

    I would have the option for Generate XML documentation comments for /// enabled, and the one for "Format new lines inside a block comment with a *" disabled.

    It's really annoying that these features are tied together.

    Thursday, December 13, 2012 10:17 PM