Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

Navigate to text in a solution with Go to Text in ReSharper

Navigating within a solution is easy with ReSharper. Hitting Ctrl+T lets us navigate to types, symbols and files in our solution. In ReSharper Ultimate 2016.2 we added another navigation, Go to Text, which makes navigation to text in source and textual files much easier than using Visual Studio’s Find in Files. And much faster, too!

Now why add another navigation when we already have things like Find Usages, Go to Everything, Go to Implementation and so on? Not everything is code. Very often a solution may contain pure string references, like error messages emitted to the user. Comments may have issue numbers from a bug tracker in them. We may want to find a specific string value throughout our code base. Or search where a regular expression is used. Using Go to Text we can navigate to those very easily, whether the results are in source files, configuration, JSON or elsewhere.

Press Ctrl+T 3 times or use the ReSharper | Navigate | Go to Text menu to bring up the navigation pop-up. After typing (part of) the text to search, we can use the arrow keys to navigate through the list of results.

Using Go to Text to find a connection string throughout codebase

The nice thing is Go to Text searches in both source files and other known file types. In the above example, that makes it really easy to search where a specific setting is being used, whether in code, configuration files or elsewhere.

Just as with other navigation types in ReSharper, we can select an item from the list of results and press Enter (or click the item) to navigate there directly. We can also use the Show in Find results (+ on the numeric keypad) to display the list of results in a separate window.

Go to Text show results in separate window

Go to Text will remember the last 10 searches we navigated to. This makes it easy to repeat searches without having to type them again.

Repeat searches in Go to Text

A nice touch is auto-paste from selection and from clipboard. We can select text in the editor and then press Ctrl+T 3 times to immediately start searching for that selection.

Select text and invoke Go to Text to search for selection

By default, Go to Text searches in all source files and in any .bat, .ps1, .md, .txt, .sql, .rb, .php, .py, .java, .jsp, .kt, .ini or .fx file. Want to exclude files and folders? In ReSharper’s options, find the Environment | Search & Navigation page and add them under Elements to skip.

The Go to Text navigation is bundled with ReSharper Ultimate 2016.2. For earlier versions, head over to the extension manager and install the Go to Word extension with similar functionality.

Do give it a try and let us hear your feedback through the comments below!

image description