Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2008's annoying auto-handling of block comments

I read that great post on Visual Studio 2008 annoyances, but didn't see this one. It drives me crazy. Now, I realize that some people use block comments like this for function documentation and the like:

/*
 *
 *
 *
 */

But you know, this is VS2008 and now we can use ///. The only time I ever feel the need to use C-style commenting is when I have some junk or test code that I temporarily want to remove. It absolutely drives me nuts when I do the first /* and then when I add a line after the test code, it automatically puts a space after the * and I end up with this: * / . So then I end up always having to backspace to complete the block comment.

I looked through all of the C# editor settings in the VS2008 IDE, and didn't find anything relevant.

Does this drive anyone else here crazy, or am I turning into a codemudgeon?

like image 533
Dave Avatar asked Mar 06 '10 05:03

Dave


2 Answers

I just avoid the block comments and instead I select the block and hit ctrl-k-c which will automatically comment out a whole block with // on each line. To undo it select the block and hit ctrl-k-u to uncomment the block. It doesn't fix the extra space issue, but it lets you not care.

like image 86
Mike Two Avatar answered Oct 21 '22 11:10

Mike Two


Without losing XML comments functionality, you can use #if to exclude code frahments, for example:

#if EXCLUDED
any code ...
#endif

In C++ use #if 0.

like image 4
Alex F Avatar answered Oct 21 '22 11:10

Alex F