开发者

Change ctrl k+c to produce c style comment (/**/) instad of c++ style comments (//) in visual studio

How do i change the comment style used in visual studio from // to /*...*/ ?

I use the comment shortcut mostly for c开发者_StackOverflowommenting out code temporarily.

It annoys me that if i select bool abc in the code below and press ctrl k+c

void func( bool abc ) {}

it produces

//void func( bool abc ) {}

instead of

void func( /*bool abc*/ ) {}

Regards

Henrik


You can do it with a macro. Make it look like this:

Public Sub CommentSelection()
    If Not DTE.ActiveDocument.Selection.IsEmpty Then
        DTE.ActiveDocument.Selection.Text = "/* " + DTE.ActiveDocument.Selection.Text + " */"
    End If
End Sub

Bind it to a key other than Ctrl-K+C, you'll want to keep that one around.


ReSharper does this CTRL + SHIFT + C

Otherwise, a macro would be your best bet, add this to your VS Macros and bind it to a keyboard shortcut of your choosing:

edit: removed my crappy code, nobugz beat me.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜