ReSharper 2021.1 Help

Highlight Usages in File

ReSharper | Find | Highlight Usages in File

The editor automatically highlights usages of a symbol at caret, which is very convenient in short files and for locals in small contexts. However, this kind of highlighting does not always work well in larger contexts because the selection is only there as long as the caret stays at the symbol.

There is also a caret-independent highlighting that stays until you press Esc and applies different configurable colors to read and write access usages. You can toggle this highlighting for a single item or for several different items simultaneously, and then use shortcuts to jump between the highlightings.

Highlight usages in the current document

  1. Do one of the following:

    • To highlight usages of a symbol, set the caret at a declaration or a usage of this symbol.

    • To highlight usages of all types from an imported namespace, set the caret at the using directive (Imports statement in Visual Basic) of this namespace.

    • To highlight usages of specific expression, select this expression.

  2. Press Control+Shift+F7 or choose ReSharper | Find | Highlight Usages in File from the main menu. Alternatively, you can press Control+Shift+A, start typing the command name in the popup, and then choose it there.

  3. ReSharper highlights read usages with blue and write usages with red. The colors are configurable.

  4. The highlights are also duplicated with blue and red markers on the marker bar on the right. Checking these markers may be helpful if not all highlights are visible on the current screen.
    To navigate between the highlighted items, choose ReSharper | Find | Go to Next/Previous Highlight in the menu or press Control+Alt+PageDown/ Control+Alt+PageUp. Alternatively, click the status indicator (that should be displaying Themed icon error stripe find next screen gray) in the right top corner of the editor to jump between the highlights.
    When you finish examining the highlights, press Esc to remove them.

Usages of a symbol:

ReSharper: Highlighting usages of a symbol in the current document

Usages of all types from an imported namespace:

ReSharper: Highlighting usages of types form imported namespace

Usages of an expression:

ReSharper: Highlighting usages of selected expression

Configure highlighting colors

  1. Choose Tools | Options from the menu and then go to Environment | Font and Colors page.

  2. In Display items, configure the following items:

    • ReSharper Read Usage
    • ReSharper Read Usage Marker on Error Stripe
    • ReSharper Write Usage
    • ReSharper Write Usage Marker on Error Stripe

This feature is supported in the following languages and technologies:

Language: C#Language: VB.NETLanguage: C++Language: HTMLLanguage: ASP.NETLanguage: RazorLanguage: JavaScriptLanguage: TypeScriptLanguage: CSSLanguage: XMLLanguage: XAMLLanguage: ResxLanguage: Build ScriptsLanguage: ProtobufLanguage: JSON
Feature is available in C#Feature is available in Visual Basic .NETFeature is available in C++Feature is available in HTMLFeature is available in ASP.NETFeature is available in RazorFeature is available in JavaScriptFeature is available in TypeScriptFeature is available in CSSFeature is available in XMLFeature is available in XAMLFeature is available in Resource filesFeature is available in build script filesFeature is available in Protobuf Feature is not available in JSON

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.

Last modified: 09 June 2021