IntelliJ IDEA 2017.1 Help

Highlighting Usages

On this page:

Introduction

The search command Highlight Usages in File (Ctrl+Shift+F7) makes it possible to visualize usages of a symbol in the current file.

In particular, it is possible to highlight implemented methods of interfaces.

All found usages of a symbol in the current file are highlighted and color-coded, as defined in the Colors and Fonts settings page, to represent read or write access to the symbol. In addition to the highlights of occurrences in text, the stripes of the same colors appear in the marker bar, accompanied with tooltips.

/help/img/idea/2017.1/highlightUsages.png

The behavior of usage highlighting is configurable: you can make IntelliJ IDEA show usages of a symbol at caret automatically, or invoke it with a command.

Activating automatic highlighting of usages

  1. Open the Settings dialog box (File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for macOS), and click General under the Editor node.
  2. On the General page that opens, select the Highlight usages of element at caret check box in the Highlight on Caret Movement area.

Highlighting usages of a symbol in the current file

  1. Place the caret at the selected symbol in the editor. If automatic usages highlighting is enabled, see all its occurrences in the current file highlighted. Otherwise, proceed to the next step.
  2. On the main menu, choose Edit | Find | Highlight Usages in File, or press Ctrl+Shift+F7.

To highlight overridden methods:

  1. In a class that implements one or more interfaces, place the caret at the implements keyword in the class declaration.
  2. On the main menu, choose Edit | Find | Highlight Usages in File, or press Ctrl+Shift+F7. A list of implemented interfaces shows up:
    /help/img/idea/2017.1/highlightImplemented.png
  3. Select the interface, whose methods you want to highlight, and press Enter.

Navigating among usages

To navigate among usages, do one of the following:

  • Click on a stripe in the marker bar to navigate to the respective usage location.
  • Use the F3 and Shift+F3 keyboard shortcuts to navigate to the next and previous usages respectively.

Removing highlighting

To remove highlighting of usages, press Escape.

See Also

Last modified: 18 July 2017