AppCode 2020.2 Help

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

  1. In the editor, select a symbol you want to find, AppCode automatically highlights all found usages in the file. If the highlighting of usages is disabled, press ⌃⇧F7 to highlight all usages in the file.

    Find usages in file result
  2. From the main menu, select Edit | Find Usages | Find Usages in File ⌃F7. AppCode selects the first usage occurrence in the file.

    Find usages result
    Higlight exceptions

    Use the F3 and ⇧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 ⌥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 ⌃⌥⇧F7.

    While in the Find tool window, you can preview the places where the usages were found. To do this, click the Preview Usages button on the left-hand toolbar.

    Preview found usages

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 Usages | Show Usages ⌃⌥F7.

    Show Usages results window

    If the search results have too many entries, then AppCode 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 recent usages search results

AppCode 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. In the Find tool window ⌥3 click the Settings button or in the Usages window ⌥F7, click the Settings button.

  2. In the Find Usages dialog that opens, select the desired scope from the list:

    Find Usages dialog

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.

  1. In the Preferences dialog ⌃⌥S, go to Editor | General.

  2. 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 ⌃⇧F7. This will highlight all usages of the symbol in the current file.

Change the background color of the highlighted usages

  1. In the Preferences dialog ⌃⌥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: 28 July 2020