开发者

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

开发者 https://www.devze.com 2022-12-22 15:03 出处:网络
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 lik

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 automatical开发者_如何学JAVAly 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?


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.


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.


That behavior can be turned off, but it will also turn off the automatic creation of XML comments after typing ///.

To turn it off, open the options dialog and go to Text Editor/C#/Advanced. Uncheck "Generate XML documentation comments for ///".


I also agree with Dave. The auto addition of the star on the next comment-block line makes me sad to the point of really disliking Microsoft for imposing their affective and unnecessary formatting standards on the developping community. Quite honestly, I even find it quite contradictory to most past Microsoft implementations which usually empower the user instead of locking him down in a dark and humid cell. Hahhh! The good old times when Bill was king!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号