Search for usages
When you write or edit code, you might come across a code element that you want to change or delete. Before you make the changes, it is a good practice to see where the code element is used and how it affects the application. 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
In the editor, select an element you want to find, RubyMine automatically highlights all found usages in the file. If the highlighting of usages is disabled, press Ctrl+Shift+F7 to highlight all usages in the file.
From the main menu, selectCtrl+F7. RubyMine selects the first usage occurrence in the file.
Use the F3 and Shift+F3 shortcuts to navigate between highlighted symbols.
Search for usages in a project
Select a symbol for which you want to find usages, right-click the symbol, and selectfrom its context menu or press Alt+F7.
Check the results in the Find tool window.
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.
In the editor, select a symbol for which you want to see the usages.
From the main menu, selectCtrl+Alt+F7.
The usages window shows the current scope. If you want to quickly switch to the default scope, press Ctrl+Alt+F7.
View recent usages search results
RubyMine remembers your Find Usages results, so you don't need to run the action again.
From the main menu, selectand then select the usage query.
Manage the Find Usages scope
Sometimes, you might want to find usages only in certain files or libraries of your project.
Press Ctrl+Shift+Alt+F7 to open the Find Usages dialog.
In the Find Usages dialog, in the Scope field, select a scope for your search. For example, you can set your search scope to production files only, enable or disable searching for symbols/hash keys, and so on.
You can also set a custom scope by clicking . For example, you can create a custom scope to exclude certain files from the search for usages, such as test files. When you are done setting a new scope, click Find.
If RubyMine doesn't return any results, it will display a message suggesting that you opt for more options.
You can follow the link or press Ctrl+Shift+Alt+F7 to open the Find Usages dialog again and set a new scope for your search.
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.
If necessary, you can disable the automatic highlighting.
Clear the Highlight usages of element at caret checkbox.
When automatic highlighting is disabled, and you want to highlight usages of a symbol in the current file, select this symbol and press Ctrl+Shift+F7. This will highlight all usages of the symbol in the current file.