The Navigate To (or Ctrl+Comma) feature provides search-as-you-type support for code files, full file paths, and symbol names such as class names and member names. This feature was new in Visual Studio 2010, unchanged in Visual Studio 2012, and improved significantly in 2013.
We’ll look at Navigate To first in Visual Studio 2012. You can find this feature under the Edit menu or use Ctrl+Comma. Navigate To displays a modal dialog (see Figure 1).
In the Search Terms box in the dialog, you can enter any text to search. As you type, the matches are displayed in the Results list. This feature finds the text anywhere in the path name, code file name, type name, or type member names. Select the result you want and click OK to navigate to the selected item.
This is different from the find feature in that it only matches on the path, file and symbol names, not any other text in your code.
For example, if I type “invoice”, it will find a match in the Invoice property names, Invoice class, and Invoice code file as shown below.
Figure 1. Navigate To in Visual Studio 2010/2012.
Say good-bye to this modal dialog.
The Navigate To feature is still available in Visual Studio 2013 from the Edit menu or by using Ctrl+Comma. But now it appears “in document” similar to the current Find feature. I've added an arrow in Figure 2 pointing to the Navigate To search box.
Figure 2. Navigate To in Visual Studio 2013.
If I again type "invoice", it presents the same list. Only now the results are not confined to a modal dialog.
Figure 3. Navigate To Search Results.
The first result is automatically selected. The selected result immediately appears in the Preview Tab. You can see in Figure 3 that the Invoice class was found, selected, and displayed in the Preview tab to the right on the tab bar.
You can preview each result by navigating through the list. Use the up and down arrow keys or the mouse. Each selected result appears in the preview tab. This allows you to preview the result to determine whether you really want to navigate without committing to it.
I can’t tell you how many times I have used Navigate To in prior versions of Visual Studio and end up in the wrong place. And with the modal dialog, I had to start all over with my search. So it is nice to see where you will go before going there.
When you find the result you want, select it and press the Enter key, or double-click it with the mouse.
Press ESC at any time to close the Navigate To and return to your code.
NOTE: Visual Studio does not provide a preview of designer files. So when you select a designer file in the result list, the Preview tab continues to display the last previewed file.
The Navigate To search box supports much more than simple search strings.
You can use white space between sets of characters. The white space is treated as an "and". For example: "inv am" displays only the results that contain both "inv" and "am". In this example, it returns InvoiceAmount.
This feature is great when you don’t remember the exact name of a method (for example) but remember several of the words, or parts of the words, in the name.
When searching file names, Navigate To searches the full path and file name. For example, type "deb" returns these results:
Figure 4. Navigate To Finds in the Path name.
If you could scroll down this list, you would see every file in my project. That's because the path name to my project includes "deb". Not very helpful.
Use the “@” sign in front of the string to search only the symbols, not the path or file names. If I type "@deb", I get the result shown in Figure 5. Much better!
Figure 5. Use @ to Find Only in Symbols.
Uppercase characters in the search string will cause a case-sensitive search. So if I type "GAS" as shown in Figure 6, it will locate any path, file, or symbol names containing a capital G, A, and S.
Figure 6. Use Upper-Case Letters To Perform a Case-Sensitive Search.
There are some configuration options for the Navigate To feature. Click the arrow in the Navigate To panel to view the Search options:
Figure 7. Navigate To Search Options.
The first set of items in the drop down list are the last selected navigate to items. This does not include the items you searched; only the results you actually navigated to. Click one of the items to navigate back to it.
The Search options are at the bottom of the list.
Click Search within external items to include or exclude external items, such as files in the External Dependencies folder. (This is for C++.)
Click Use preview tab to turn on/off the ability to preview each search result in the Preview tab.
Click Show details to turn on/off the display of the project and file details for the selection. The details appear at the bottom of the result list as shown in Figure 8.
Figure 8. Navigate To Details.
The details include the project name, full file path, line number of the occurrence and the XML comments for the symbol (if any).
You can also change the size of the Navigate to window so you can see more or less of the results. Just drag the left side of the window to make it wider or narrower. Or drag the bottom to make it taller or shorter.
Use the improved Navigate To feature any time you want to Navigate to a file, class, method, property, or other symbol in your code using some part of the name. Or if you just want to preview that code without leaving your current coding location.
About the author
Deborah Kurata is a software designer/developer and the author of several books, including 'Doing Objects in Visual Basic 2005' (Addison-Wesley), 'Best Kept Secrets in .NET' (Apress), 'Doing Objects in Visual Basic 6.0' (SAMS) and 'Doing Web Development: Client-Side Techniques' (Apress). She is a Microsoft Most Valuable Professional (MVP) and co-chair of the EastBay.NET user group. She speaks at conferences, such as VSLive, DevDays, and TechEd, and writes for MSDN and CoDe magazine. Deborah is cofounder of InStep Technologies Inc., a professional consulting firm that focuses on turning your business vision into reality using Microsoft .NET technologies. Check out Deborah's blog: http://msmvps.com/blogs/DeborahK/
Nice introduction to a new helpful feature; The new Navigate To will make moving around in code much simpler. However, I find I still have to hit Crtl+Comma to get the "Navigate To" bar on top, unlike its placement as a fixed "in-document" bar like you implied. I cannot find the relevant setting in the Options/Customise boxes to place it permanently there. I am using the RTM MSDN version. Any idea what I'm doing wrong? Or is it meant to be like this only?
And, it's nice to see it all in color! Nice article Deborah
Would be useful the possibility to select and open multiple items in navigate to. It is so obvious, why not implemented?
It would also be useful if it were possible to specify what type to search for.
ex. #class GAS - would find a class named GroupAndSum.
or #file GAS - would find a file named GroupAndSum.txt
Typically, I would know that I was searching for a class etc.
Can this be indexed so that the search is instantaneous rather than taking a few seconds? For small projects, the lag isn't noticeable but for larger ones it rapidly gets annoying.
I am. HERO hi! all members have good today want morning now .
msdn site am I pace up don't coming hero same pace or cream talking press.
anytime for with v.studio this loves . good day by^by
The features and the fact it's non-modal are great, but performance wise it was way better in vs2010. Now it will most of the time freeze when looking for something, even if the result i'm looking for is already found: i won't be able to access it right away because it's frozen, until everything is retrieved.
In the modal dialog, as soon as i accessed a result, the search stopped.
Mine isn't working at all. I type in a keyword and I see the activity indicator spinning but nothing happens. No error message, no results. Any thoughts on why?