Edit

Share via


Find code by using Go To commands

The Visual Studio Go To commands perform a focused search of your code to help you quickly find specific items. You can go to a specific line, type, symbol, file, or member by using a simple, unified interface.

In Visual Studio 2022, a new search experience replaces much of the functionality described here. For example, Go to type (Ctrl+T) goes, by default, to the new search experience in Visual Studio 2022 rather than opening the Go to type window. For information about the new search experience, see Visual Studio search.

How to use Go To

Input method Steps
Keyboard Select Ctrl+T or Ctrl+,
Mouse Select Edit > Go To > Go To All

A small window is displayed in the top right corner of the code editor:

Screenshot that shows the Go to All window.

As you type in the text box, the results appear in a drop-down list below the text box. To go to an element, select it.

Screenshot that shows the Navigate To window.

You can also enter a question mark (?) to get additional help:

Screenshot that shows the Go to All Help window.

Filtered searches

By default, the specified item is searched for among all solution items. However, you can limit your code search to specific element types by prefacing the search terms with certain characters. You can also quickly change the search filter by selecting buttons on the toolbar of the Go To dialog. Buttons that change the type filters are on the left side, and buttons that change the scope of the search are on the right side:

Screenshot that shows the filter and scope buttons in the toolbar.

Filter by a specific type of code element

To narrow your search to return only a specific type of code element, you can either specify a prefix in the search box or select one of the five filter icons:

Prefix Icon Shortcut Description
: Ctrl+G Go to the specified line number
f Ctrl+1, Ctrl+F Go to the specified file
r Ctrl+1, Ctrl+R Go to the specified recently visited file
t Ctrl+1, Ctrl+T Go to the specified type
m Ctrl+1, Ctrl+M Go to the specified member
# Ctrl+1, Ctrl+S Go to the specified symbol

Filter by a specific location

To narrow your search to return only items from a specific location, select one of the two document icons:

Icon Description
Search current document only
Search external documents in addition to those located in the project/solution

Camel casing

If you use camel casing in your code, you can find code elements faster by entering only the capital letters of the code element name. For example, if your code has a type called CredentialViewModel, you can narrow the search by selecting the Type filter (t) and then entering just the capital letters of the name (CVM) in the Go To dialog. This feature can be helpful if your code has long names.

Screenshot that shows how to search with uppercase letters.

Settings

You can select the gear icon to change how this feature works:

Setting Description
Use preview tab Display the selected item immediately in the IDE's preview tab
Show details Display project, file, line, and summary information from documentation comments in the window
Center window Move the window to the center of the top of the code editor, instead of the top-right corner