Just like the new Visual Studio 2015 Light Bulb, the Rename feature is an IDE improvement you may have seen before as part of an extension. ReSharper and CodeRush users have been happily renaming for a while now, and there’s a reason it’s an often-used feature. Any refactoring operation is likely to involve some renaming, and having to do it just one time (without having to roll the dice with a find/replace) is so much faster! Now the rest of us can rejoice – Rename is built-in to Visual Studio 2015 and I like it better than any other method I’ve tried.
Rename refactoring can be accessed through the context menu, by using the shortcut Ctrl+R, or may be given as an option in the Light Bulb Quick Action menu. And similar to the Light Bulb, there is a friendly Preview Changes option that might save you a few Undo actions in the future. You can specify the scope of the Rename here, select/unselect classes, and preview individual changes.
Once the Rename is activated, just start typing the new name in-place, and Rename will take care of the rest – highlighting other instances in the same file, and warning you of conflicts. Select your options and click Apply to finish the rename action.
It’s also a lot smarter than you may realize. If Visual Studio 2015 detects that you just renamed a method, for instance, the Light Bulb will show up and give you the option to do a full ‘Rename’ operation.
The Light Bulb will also expand into a sort of preview pane itself, showing the changed items inline. This is another useful view I haven’t seen before – this makes it easy to see what will change when the operation is completed.
Making Rename an in-place operation is just another piece of this new set of Visual Studio 2015 features that help make refactoring a smooth part of the development cycle. And that makes this developer pretty pleased.
Latest posts by Rachel Hagerman (see all)
- Entity Framework with Google Cloud SQL - February 2, 2017
- Cloud Storage Options Part 2 - February 1, 2017
- Cloud Storage Options Part 1 - January 31, 2017
- SQL Server in the Google Cloud - January 30, 2017
- Breakpoints in Auto-Properties in Visual Studio 2015 - December 30, 2016