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.
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 dialog () , go to Editor | Code Editing, and clear the Usages of element at caret checkbox in the Highlight on Caret Movement area.
When automatic highlighting is disabled, press to highlight all usages of a symbol at caret within the file.
Go to Edit | Find Usages | Find Usages in File . WebStorm selects the first usage occurrence in the file.
Use the and shortcuts to navigate between highlighted symbols.
Click Usages hints that are displayed next to a class or an interface and show the number of its usages. Click the hint in the editor to jump to the usage or to select the relevant one from the list.
Usages inlay hints are enabled by default. To turn them off, hover over a hint and select Hide 'Code Vision: Usages' Inlay Hints or Hide All 'Code Vision' Inlay Hints from the context menu.
By default, Usageshints are shown above classes and interfaces. To change this position, click Configure from the context menu of a hint.
On the Inlay Hints page, that opens, select the appropriate setting from the Position list. Alternatively, select the Code vision node and change the Default position for metrics.
Select a symbol for which you want to find usages, right-click the symbol, and select Find Usages from its context menu or press .
Check the results in the Find tool window.
If you need, you can group () the results by files, packages, directories, and so on.
To open the Find Usages dialog, click on the toolbar in the Find tool window or press .
WebStorm analyzes search results, detects the most common usage patterns, and categorizes all found usages into groups based on their structural similarity. These usage clusters appear in the Preview tab.
You can select any group node from the list and click Show similar usages to look through the results.
To disable this functionality, unselect the Enable similar usages clustering in Find Usages view in the advanced settings.
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.
You can use the Find Usages action as an alternative to Call Hierarchy actions ().
You have several options to see the code source for the usages found.
Select a symbol for which you want to find usages, right-click the symbol, and select Find Usages from its context menu or press .
In the Find tool window, click the Preview Source icon.
As an alternative, you can select Jump to Source if you invoke the context menu on a usage found or Show in Split. In this case, the file with the result usage is opened in the editor.
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.
In the editor, select a symbol for which you want to see the usages.
Go to Edit | Find Usages | Show Usages In Code .
Click 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 .
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.
WebStorm remembers your Find Usages results, so you don't need to run the action again.
In the main menu, go to Edit | Find | Recent Find Usages and then select the usage query.
If WebStorm doesn't find any usages of a symbol, it displays a message.
Click or press to open the Find Usages dialog and set a new scope for your search, for example, Open Files or Project Test Files.
To set a custom scope, click . When you are done setting a new scope, click Find.
When you place the caret at a symbol, the IDE highlights all usages of this symbol in the current file. Use the and shortcuts to navigate between highlighted symbols.
note
In the Power Save Mode, highlighting of usages is disabled.
To disable automatic highlighting, open the Settings dialog () , go to Editor | Code Editing, and clear the Usages of element at caret checkbox in the Highlight on Caret Movement area.
When automatic highlighting is disabled, place the caret at the necessary symbol and press . This will highlight all usages of the symbol in the current file.
In the Settings dialog () , go to Editor | Color Scheme | General.
From the options on the right, open the Code node and select Identifier under caret.
In the Background field, specify the color you need and save the changes.
When you search for usages of a method, WebStorm prompts you to choose whether you want to search for the base method or method's implementations.
If you select the Remember, don't ask again checkbox, WebStorm will no longer display the prompt, and the selected search option will be used as default. If necessary, you can restore the prompt.
In the Settings dialog () , go to Editor | General | Smart Keys.
In the PHP area, select the Show additional options when searching for method usages checkbox.