Visual Studio Refactoring Shortcuts
After watching Uncle Bob playing a symphony of refactoring across his keyboard at Dev South Coast last night, I decided there was one short-cut I didn’t have and couldn’t live without: Widen Selection.
Widen selection, also known as expand selection, allows you to move your current selection outwards to the next lexical block. This is a really handy short-cut for refactoring as you can quickly grab a chunk of code before leaning on the extract-method refactoring to strip it out. This is the fastest way to extract ’til you drop.
Having considered simply converting to Java and using IntelliJ for all my programming needs (an option I still haven’t discounted) I decided to check to see if there was a way of doing this in Visual Studio.
There is, however, a plethora of plugins that will give you this option.
If you have ReSharper, you can use
W to widen the current selection and
W to narrow the selection.
If you don’t have ReSharper, grap Coderush Xpress from DevExpress, which uses (by default…)
= to widen and
- to narrow. Of course, a quick trip into “Options > Shortcuts > Selection” and you can map this to match IntelliJ and ReSharper and you’ll never have to remember the difference.