Saturday, June 28, 2008

Surround Code With More Code Using ReSharper

A common everyday need is to be able to surround portions of your code with anything from curly braces, to an if block. To achieve this wonderfulness with ReSharper, highlight a block of code, hit "CTRL+ALT+J" (or "CTRL+E, U" for VS keymapping) and choose from the resulting context menu with your arrow keys. Your choices are as follows:

if
while
for
do...while
#region
#if...#endif
{}
try..catch
try..finally
cast
lock

surround_thumb[5]

Also:
ReSharper released their keymappings for version 4.0 RTM.
Visual Studio Scheme is here.
IDEA Scheme is here.

This is part 3 of a series of posts exploring how to become a ReSharper keyboard ninja.

Previously:
Part 2 - Find Inheritors
Part 1 - Quick Documentation View

1 comments:

Anonymous said...

Here's a shortcut to get rid of your code selection using the mouse in that little video.

CTRL + W: Selects the next larger, logical "block" of code. ;)