The C++ language is large and complex with context-sensitive syntax subtleties that make it difficult to create a reliable and fast rename refactoring tool. For years we wanted to include rename refactoring in Visual C++ but it never quite made it. We were concerned about scalability, performance and accuracy for different user scenarios. Rename refactoring might take longer on more complex or larger projects.
Recently, we decided to give it a try. The result is the Rename Refactor Helper for Visual Studio 2013 (see the announcement on Channel 9 / Going Native). Once installed, you can easily right click on a symbol >refactor>rename in your C++ project. You might still need to manually go through unknown/unconfirmed results proportional to the scope of the refactoring for complex refactors, but for many common scenarios little intervention is required. Make sure you have Tools->Options->Text Editor->C/C++-> Advanced->Disable Resolving set to False. This will allow us to validate the candidate references for the selected symbol.
Our goal with this release is to understand how useful this functionality is for Visual C++ developers. We hope it replaces find/replace in files or copy/paste (ugh!) – and with your feedback, we will continue trying to make it better.
Please try the Rename Refactor Helper for Visual Studio 2013 extension for yourself, and if it works well enough for you, let us know and we'll try to add other refactoring types to the tool as well! And if it does not quite meet your needs, tell us how we should improve it! And be sure to watch the video on Channel 9.
Bogdan Mihalcea (firstname.lastname@example.org) VC++ IDE Team
Excellent. I have to ask though, is there any chance this could be made available for Visual Studio 2012 as well, or does it rely on 2013 specific internal plumbing?
You are right Tom, unfortunately the APIs we need to access our internal data exist only in VS2013. Our main goal was to ship this without the need to patch the existing product.
Just downloaded and tried it out. It is very useful. Congratulations to Microsoft for the C++ love these past 2 days. With the CTP, this tool, and the C++ live course today on Microsoft Virtual Academy, you guys are finally starting to demonstrate with actions your rhetoric of commitment to C++.
This tool works well. If you are taking suggestions about refactoring tools to add, I would like to move member functions definitions from inline (with the class definition) to out of line (and vice versa)
I can just imagine getting used to this only to have it stop working when VS 2014 comes out, just as Productivity Power Tools has stopped working with VS 2013...
Thanks, I always missed some decent refactoring tools for VC++. If we now could get automatic creation of function definitions, my life would be perfect.
Julian and JBandela: We have them high in our priority list.
Jonathan: Our current plan is to have and support the refactoring going forward, so I would get used to it :)
Very good. BUT please finally find a solution for extending the syntax highlighting in a straightforward manner without the need for half-cooked extensions (like OpenGL GLSL, Direct3D HLSL, OpenCL, CUDA).
Use Visual Assist. Pay more attention to fixing the errors when building ATL/COM projects in 64-bits instead.
The ignoring Register Output and Proxy/Stub projects using the same intermediate directory causing projects to be rebuilt always.
You appear to have inherited the C# refactor window tool poor UI behaviour - which can be witnessed by the fact that the first thing the user of the demo does is resize the window.
1. The initial default size of the window showing the preview is way too small to be useful to view real code in - make it much bigger.
2. Remember the size that the user changes that window to so that they don't have to keep resizing it each time they use it.
That's a great tool. It would be nice to optionally rename occurrences in comments and strings too.
To David: Very good feedback. We are using the same VS Preview service. I will pass on your feedback. I would suggest you to open a bug in that way you will have an easy way to check the progress.
To Ricardo: Without changing the product, the current API doesn’t provide the info to allow us to separate the 2 from the unconfirmed group. Once we will add the necessary hooks into the product, we will be able to refine these a bit more.
To Bogdan: I've bugged the UI issues with the rename before ... you can only bang your head against a wall so many times before you get fed up doing it.
FWIW here's the link: connect.microsoft.com/.../refactor-preview-reference-changes-dialog-needs-to-remember-its-size-and-have-a-better-default-size
Perhaps you can get it re-opened and fixed before it gets through to another release in its current irritating form.
Just tried the C++ renaming tool - had some inital problems getting it up & running. It turned out that I had to disable Reshaper:( Would appreciate being able to use the tools together...
ReSharper is a 3rd party extension and they decided to remap the default Refactoring Rename key binding. We use the same VS key binding that exists for the other langs to maintain consistency.
To solve that conflict, you can simply re-bind in Tools->Options or add your own text editor scoped binding for Refactor.Rename (also in Tools->Options)... if you wish.
Thanks for sharing the link. I will try to follow-up to see what can we do to improve the experience. From what Dustin mentions, it was a costly fix and that was the reason for the cut. If the C++ refactoring extension will be successful and combined with c# refactoring usage, that might justify a raise in the importance of this specific fix.
"However, this is a native Win32 dialog written in C++. Making it resizable is a sizable amount of work"
Seriously? I am sure many people who read this blog would disagree with this statement.
With regards to the tool itself: yet to use it in anger but initial tests were favourable. Looking forward to further improvements in the future.
On a semi-related note clang-format and clang-modernize (as shown in Going Native 2013) are getting a lot of love here.