Navigating Code with ReSharper
Let's look at some fast and easy ways to navigate around a code base.
Navigating Code in ReSharper
No matter which programming language you use, ReSharper helps you navigate your Visual Studio solutions. ReSharper lets you navigate C#, F#, VB.NET, HTML, and many more languages, and even provides Go-to-Text to quickly find string literals in your code files.
Using Search Everywhere, triggered by the Ctrl+T keyboard shortcut, you can navigate to types, symbols, files, string literals in source and textual files, recent edits, recent files, and recently viewed methods. ReSharper also searches in referenced libraries and NuGet packages, and can decompile code or download symbol information to show external source code.
In searches, you can make use of "CamelHumps". In code, we often use CamelCase for classes and methods. ReSharper can search based on just the uppercase characters - in other words, searching for VE
will find ViewEngine
.
If the list of search results contains too many entries, you can cycle through different types of results to narrow the scope. For example, pressing Ctrl+T again will cycle between finding symbols, files, and other elements. In a search, you can press Shift+Enter to open results in a separate tool window.
Some other options available are:
This is not a complete list - check the ReSharper web help on Navigation for more examples and use cases.
Navigate To menu
The Navigate To... action (Alt+Backtick) is a single shortcut for many navigation actions. The list of navigation destinations is displayed depending on the current context.
You can invoke Navigate To from code in the editor, and also in the Solution Explorer, the File Structure window and several other tool windows. Definitely try it out!
Recent Files and Edits
By keeping track of your actions and navigation history, ReSharper lets you navigate to recent locations and edits using the Ctrl+, and Ctrl+Shift+, keyboard shortcuts.
This makes it easy to navigate to places where you have edited or just looked at code. The list of viewed/edited files are stored separately for each solution, and is saved. As soon as you open a solution, you'll get the list of the files you worked with in previous sessions.
Navigate by Stack Trace
When you get a textual stack trace (for example, from a bug report), you can open it in the Stack Trace Explorer window. ReSharper then lets you navigate from Stack Trace to Exception, to make it easier to track down the origin of a particular exception.