ReSharper 2017.3 Help

Navigation and Search in CSS

Most of ReSharper's navigation and search features are also supported in CSS. You can find the detailed information on these features in the corresponding topics of the Navigation and Search section. In the main topic of the section, you can also find the feature matrix and check what exactly is supported in CSS.

In this topic, you can find some examples of using navigation and search features in CSS:

Navigation within CSS file

File Structure and Go to File Member are both available in CSS files, so you can navigate to an element from the editor or File Structure window:

ReSharper by Language CSS File Structure

These navigation features fully support lowerCamelCase search, enabling you to instantly land at selectors with tricky names, like this:
ReSharper by Language CSS Navigation Go to File Member

Navigation between CSS and markup files

There are several methods you can use to navigate from a CSS file to a markup file and vice versa. For instance, you can invoke Navigate to usage on a CSS selector or class and navigate to a usage inside markup file:

ReSharper by Language CSS Navigation Usages of Symbol

As an alternative, you can choose Matched Tags from the Navigate To context menu in order to navigate to tags that match chosen CSS element.
ReSharper by Language CSS Navigation Matched Tags 01

ReSharper by Language CSS Navigation Matched Tags 02

In order to navigate from a markup file to a CSS file, you can use the Go To Declaration feature:
ReSharper by Language CSS Navigation Go to Declaration

Search

You can easily find where a certain CSS property or selector is used both within the current file and in a larger scope. For example, when you have multiple CSS files in your solution, applying Find Usages over a selector in one of these files finds all occurrences of the selector in all remaining files:

ReSharper by Language CSS Find Results
ReSharper also can highlight usages:
ReSharper by Language CSS Navigation Highlight Usages

Go To Matched Tags

This navigation feature allows you to find all HTML tags that are matched by a specific CSS selector. To invoke this feature, place the caret on a CSS selector and press ? or choose ReSharper | Navigate | Navigate To in the main menu, then choose Matched tags,

There is no default shortcut for this action. However, you can assign a custom shortcut in Visual Studio options (Tools | Options | Environment | Keyboard). The action alias is: ReSharper_GotoMatchedTags

Last modified: 7 December 2017

See Also