WebStorm 2020.1 Help

Search for usages

With the Find Usages actions you can search for the references of your code element throughout the whole codebase.

You can manage the search process, and search only in a single file, extend your search to the whole project, or create a certain search scope. Moreover, you can configure the color of the usages highlighting or disable the automatic highlighting of usages altogether.

Search for usages in a file

  1. In the editor, select a symbol you want to find, WebStorm automatically highlights all found usages in the file.

    To turn this highlighting off, open the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General, and clear the Highlight usages of element at caret checkbox.

    When automatic highlighting is disabled, press Ctrl+Shift+F7 to highlight all usages of a symbol at caret within the file.
    Highlight usages in file
  2. From the main menu, select Edit | Find Usages | Find Usages in File Ctrl+F7. WebStorm selects the first usage occurrence in the file.

    Highlight usages in file: select the first occurrence

    Use the F3 and Shift+F3 shortcuts to navigate between highlighted symbols.

Search for usages in a project

  1. Select a symbol for which you want to find usages, right-click the symbol, and select Find Usages from its context menu or press Alt+F7.

  2. Check the results in the Find tool window.

    Find tool window

    To open the Find Usages dialog, click Settings icon on the toolbar in the Find tool window or press Ctrl+Alt+Shift+F7.

    While in the Find tool window, you can also use the Preview area to check the places where the usages were found, to see a call hierarchy for methods, data flow for fields, and so on.

    Find tool window preview area

    You can use the Find Usages action as an alternative to the Call Hierarchy actions.

    Find tool window preview area: Call hierarchy

Show usages in a separate window

You can view usages of the selected symbol in a separate window that you can move to different parts of your screen and use for quick navigation.

  1. In the editor, select a symbol for which you want to see the usages.

  2. From the main menu, select Edit | Find | Show Usages Ctrl+Alt+F7.

    Show usages popup

    Click Open Find Usages Tool window to move the search results to the Find tool window.

    The usages window shows the current scope and total count of usages. If you want to quickly switch to the default scope, press Ctrl+Alt+F7.

    If the search results have too many entries, then WebStorm shows the first hundred usages found and the more usages option on the bottom of the window which you can click to display another hundred usages, and so on until the search is finished.

    Use filters on the top of the window to show or hide the certain search entries.

View results of recent searches for usages

WebStorm remembers your Find Usages results, so you don't need to run the action again.

  • From the main menu, select Edit | Find | Recent Find Usages and then select the usage query.

Manage the Find Usages scope

  • If WebStorm doesn't find any usages of a symbol, it displays a message.

    Show usages: no results detected

    Click Settings or press Ctrl+Alt+Shift+F7 to open the Find Usages dialog and set a new scope for your search, for example, Open Files or Project Test Files.

    Find Usages dialog (settings for Find Usages)

    To set a custom scope, click the ellipsis icon. When you are done setting a new scope, click Find.

Disable automatic highlighting of usages

When you place the caret at a symbol, the IDE highlights all usages of this symbol in the current file. Use the F3 and Shift+F3 shortcuts to navigate between highlighted symbols.

  • To disable automatic highlighting, open the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General, and clear the Highlight usages of element at caret checkbox.

When automatic highlighting is disabled, place the caret at the necessary symbol and press Ctrl+Shift+F7. This will highlight all usages of the symbol in the current file.

Change the background color of the highlighted usages

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Color Scheme | General.

  2. From the options on the right, open the Code node and select Identifier under caret.

  3. In the Background field, specify the color you need and save the changes.

Last modified: 02 July 2020