CLion 2019.3 Help

Find 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. Position the caret at a symbol and press Ctrl+F7. CLion displays all the usages of the symbol in the file.

    find usages in a 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.

    Find usages in file result
  2. From the main menu, select Edit | Find | Find Usages in File Ctrl+F7. CLion 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

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

  2. Check the results in the Find tool window.

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

    While in the Find tool window, you can use the Preview the Preview Usages button area to check the places where the usages were found, and the Call Hierarchy.

    Find tool window preview area

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 results window

The usages window shows the results found in the current scope. To quickly swtich to the default scope, press the same shortcut Ctrl+Alt+F7 again.

View recent usages search results

CLion 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

Sometimes, you might want to find usages only in certain files or libraries of your project.

  1. Press Ctrl+Shift+Alt+F7 to open the Find Usages dialog.

  2. In the Find Usages dialog, in the Scope field, select a scope for your search. For example, you can search for usages only in Open Files or only Project Test Files.

    Find usage dialog

    You can also set a custom scope by clicking the ellipsis icon. 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.

  3. If CLion doesn't return any results, it will display a message suggesting that you opt for more options.

    No usages found popup

    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.

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: 22 January 2020