Tips and Tricks

Filtering results of Find References

We regularly hear from C/C++ and C# users that Find References is their most-used feature of Visual Assist. Despite the existence of a similarly named feature in Visual Studio, the functionality and speed provided by our version appears to be a game changer. And Find References keeps getting better.

Beginning with Visual Assist build 2036, you can filter the results of Find References, in original and cloned windows. Although filtering is available via the context menu, keyboard access is the way to go.

I begin with a simple example that includes a reference to a quantity in a comment, its definition, one write access, and one read access.

findRefsExample

Find References (Shift+Alt+F) on quantity produces a results window with four entries, one of each type.

findRefsResultsAll

Although Find References has always differentiated read versus write references—blue and pink in my example—you can now use shortcuts R and W to filter by type. When focus is in the results, press W to remove the write reference(s).

findRefsResultsW

Press W again to make the write reference reappear, then R to remove the read reference(s).

findRefsResultsR

Initializations aren’t considered write references. Instead, they are included in definition references, which are filtered with the D shortcut. (In C/C++, declarations are also filtered with D.)

“References” in coMments and strings are filtered using M, and if my example had any, unknown/Guess hits would be filtered with G. Hence, pressing RDM immediately after my initial find would leave me with only the write reference.

findRefsResultsWOnly

Filter states aren’t sticky. Each Find References begins with all results, and each of the shortcuts initially removes references.

Additionally, filter states are specific to the window. You can show read references in one window and write references in a cloned window—to one or different symbols. If you can’t remember the state of a filter in a window, toggle it and look for a change in the vertical scroll bar.

Shortcuts for Highlight All (H) and Search All Projects (P) work similarly. H toggles the highlighting of references in source windows; P refreshes search results to include references from all projects, or restrict them to the current project. (Because quantity is a local variable in my example, my searches were always restricted to the current file.) .

Open the context menu of Find References if you forget the shortcuts. Only those that apply to your results are visible.

findRefsResultsMenu

Find References in Visual Assist is powerful and complex, and you need time and revisits to take full advantage of the command. Try the filtering described in this post, check out a previous post about using Find References to manage a task , then hit the documentation when you are ready for more.

Leave a Reply

%d