Curly Bracket automatic comments line

I'm just starting using ReSharper and need some help on some settings.

If I write some code in C# and I want to write a left curly bracket ("{") ReSharper automatic reformats my code to // notation

For Example I have following code

var teststring = string.Format("");

If i try to insert a left curly bracket between the qoutes resharper will change my text to following
//                    var teststring = string.Format("");
So it automatically assumes I'm out commmenting the line
It would like to be able to write somthing like this instead
var teststring = string.Format("{0}", someVariable);

So my question is how do I prevent ReSharper from autocommenting when using bracket



I'm using Build 7.1.2000.1478 on  Visual Studio 2010

Comment actions Permalink

Hi Morten,

Could you please go to Tools | Options | Environment | Keyboard and check if you have any command mapped to the { key (or key combilation)?


Comment actions Permalink

Hi Alex,

Thank you - that helped isolate the problem.
I'm using a danish keyboard and the curly bracket is  the key combination ctrl+alt+7 and this is the linecomment short cut.

Now a new question is there a way to change the keyboard short cut for line comment to ctrl+alt+6 instead of ctrl+alt+7


Comment actions Permalink

Hi Morten,

Actually you may remap your keyboard shortcuts in the dialog I described - "Tools | Options | Environment | Keyboard". It's a VS functionality to handle the keymaps and commands combinations.


Comment actions Permalink

Thanks Alex,
This works perfect :)

I've changed it to alt+shift+7 which makes more sense to me.

Best Morten


Please sign in to leave a comment.