New code navigation shortcuts in Visual Studio 2017

The new Go to All window in Visual Studio 2017 lets you navigate directly to any file or symbol by typing a search query:

You can open this window using keyboard shortcuts Ctrl+, or Ctrl+T assigned by default to the Edit.GoToAll command:

You can also open the Go to All window from the main Edit – Go To menu:

The main difference from the Navigate To window (existed since Visual Studio 2010) is that now you can easily limit search results to files, types, members or symbols clicking on the corresponding toolbar button. Alternatively, you can type the special character and space before the search query (e.g. f readme.txt):

Even better, instead of opening the Go to All window in the general mode, you can open it in a filter mode using following commands:

  • Edit.GoToFile (Ctrl+1, F or Ctrl+1, Ctrl+F),
  • Edit.GoToType (Ctrl+1, T or Ctrl+1, Ctrl+T),
  • Edit.GoToMember (Ctrl+1, M or Ctrl+1, Ctrl+M),
  • Edit.GoToSymbol (Ctrl+1, S or Ctrl+1, Ctrl+S).

Additionally, you can search only in the current document by clicking the corresponding toolbar button or pressing Ctrl+Alt+C in the Go to All window. And you can include contents of external items (such as files in ‘External Dependencies’ folders) in search results by clicking the corresponding toolbar button or pressing Alt+X in the Go to All window.

Limiting search to the current document is a very common scenario when navigating to a member of the current class. On the other hand, when navigating to a file, the current document option should be deselected. Unfortunately, changing the current document option in the Go to All window clears the file/member filter mode, making the switch between the two scenarios a little cumbersome.

You can change the current document option programmatically before opening the Go to All window with the Visual Commander extension. For example, the Go to a member in the current document command sets SearchCurrentDocument option to true and then calls the built-in Edit.GoToMember command:

The Go to a file in the solution command sets SearchCurrentDocument option to false and then calls the built-in Edit.GoToFile command:

You can assign keyboard shortcuts to these Visual Commander commands and have search filters preconfigured exactly as needed. (Use the SearchExternalItems property instead of the SearchCurrentDocument property to set the external items option.)

Overall, with the new filtering capabilities and keyboard shortcuts, the Go to All window provides convenient navigation to a code fragment you need.

This entry was posted in Visual Studio tips and tagged . Bookmark the permalink.

1 Response to New code navigation shortcuts in Visual Studio 2017

  1. Thanks a lot! This was the last thing I missed from ReSharper.

Leave a comment