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 Falafel Posts (see all)
- Matching Complex Query String Rewrite Rule in IIS - March 22, 2017
- Using Google Services in UWP C# Apps – Part 2 - February 7, 2017
- Using Google Services in UWP C# Apps – Part 1 - February 6, 2017
- Redis Caching in the Google Cloud Platform - February 3, 2017
- Entity Framework with Google Cloud SQL - February 2, 2017