Does anyone know if there's a way in Visual Studio 2010 with ReSharper 6.1 to comment out the selected lines of code with their closing brackets - or simply to comment out both the highlighted opening bracket and it's corresponding closing bracket? Here's an example of what I mean:
if(something) {
do(this);
}
I am looking for a hot-key so that when if(something) {
is selected, it will comment out if(something) {
and }
, preferably fixing the tabs once commented like so:
// if(something) {
do(this);
//}
This isn't entirely what you're after, but it's pretty close:
Highlight the code inside the
if
statement by placing the cursor at one brace and hittingCtrl
+Shift
+]
.Now hit
Ctrl
+Shift
+Alt
+Left Arrow
. This will move the code 'left', i.e. outside of the if statement.You don't need to comment the
if
statement out after this because it's empty.Note that you can also move code 'right' to put it back in the
if
statement later.