Scope of Refactoring in Multi-Project Solutions

There is a subtle connection among the Find References, Rename, and Change Signature commands of Visual Assist, and if you didn’t perceive the connection, you might believe something was awry—with your memory.

The three commands—Find References, Rename, and Change Signature—share a setting to display references from, or refactor in, the current project or all projects. The shared setting prevents you from inadvertently reviewing code with Find References in one scope, then refactoring your code in a broader or narrower scope.

If you restrict Find References to the current project, the default scope of the next Rename or Change Signature is also the current project. If you broaden the scope of Find References to all projects, the default scope of the next Rename or Change Signature is also all projects.

When the scope of Find References is set to all projects, multiple project nodes appear in the results.

blogMultiProjectFindAll

After a Find References whose scope was all projects, the Rename and Change Signature dialogs open with the same scope—all projects.

blogMultiProjectRename

The same holds for reverse use of the commands. If you set the scope in Rename or Change Signature, the next Find References opens with the same scope.

In short, Visual Assist assumes you’re working at the project or solution level, and holds the assumption until you say otherwise.

And remember, you can always fine tune the scope of any Rename or Change Signature by selecting/deselecting references, including entire project nodes, before a commit.

Finally, if you are working in a Universal Solution, there are more nuances to the scope of Find References, Rename, and Change Signature. I’ll touch on those nuances in the next post.

Sorting One’s Code

Visual Assist has a plethora of features, and it’s difficult to know them all. It’s an even greater challenge to use all of them at every opportunity.

We had one user, Tom, write recently that his “very small favourite feature” in Visual Assist is Sort Lines. Sort lines, we wondered. We don’t often sort when writing code. After a bit of thought, we acknowledged that if one does need to sort, however infrequently, a built-in sort can be very handy.

In this blog post, I touch on a few use cases for Sort Lines, some of which might resonate with you.

If you have enums not dependent on order, consider sorting them for readability. Sort all or a subset, remembering to exclude a count that must be the last item.

Select your lines and invoke sort from the Tools submenu of VAssistX:

Sorting is always alphabetic, and done in place. Only complete lines of a selection are sorted; sort Lines ignores the line with the text caret—whether or not the line includes any selected text.

In unmanaged code,  #defines are sometimes good candidates for a sort. If circumstances allow, sort before assigning values to your macros. Sorting operates at the line level, so don’t attempt a sort if your macros and their comments span multiple lines.

Finally, if you are confident your C/C++ headers don’t need to be included in order, sort them so they are easier to browse.

If you find yourself sorting manually, however infrequently, remember that Visual Assist makes the task simple. Our user Tom uses Sort Lines so much he assigned a shortcut to the command.

Finally, if you have a different use case for Sort Lines, we’d love to hear about it. Please share your case in a comment.

Visual Assist build 2031 is available

Greetings from San Francisco!

Thank you to all of the customers who stopped by our booth at the Build conference. It’s clear we have ardent supporters. We look forward to providing you with the debugger improvement we demo’d. Expect a beta in a few months. To the many first-time visitors, we hope you find Visual Assist as valuable as we led you to believe.

Build 2031 of Visual Assist was made available the first day of Build, to coincide with Microsoft’s announcement of universal solutions and shared projects. Although beta, Visual Assist build 2031 has support for the new features of Visual Studio 2013 Update 2 RC. We’ll blog separately to discuss the impact of shared projects on several features of Visual Assist, including Find References, Rename, and Change Signature.

Visual Assist build 2031 requires maintenance through 2014.03.31. The build includes an entirely new editor for VA Snippets. The editor is available only for Visual Studio 2010 and newer, but since VA Snippets are shared among IDEs, edit VA Snippets with your newest IDE and your changes will be available in any old code you still maintain. We already have changes planned for the editor before GA, including a redo of the type filters, but we’d love to hear suggestions for more.

If you use a dark theme in Visual Studio 2012 or 2013, you won’t need your sunglasses when our find dialogs open. Enough said.

Learn what’s new in build 2031, or skip directly to download the installer.