IntelliJ IDEA 2018.3 Help

Search for a target and usages within a project

You can search for a target within a project, use different scopes to narrow your search process, exclude certain items from your search, find usages and occurrences.

Find your target in a project

  1. From the main menu, select Edit | Find | Find in Path (Ctrl+Shift+F).

  2. In the search field, type your search string. To see a list of your previous searches, press Alt+Down.

    If you need, specify the additional options.

    Find in path

    IntelliJ IDEA lists the search strings and files containing them.

    To do a multi-line search, click the Multi-line search icon to enter a new line, and press Ctrl+Alt+Down / Ctrl+Alt+Up to browse through occurrences.

  3. Check the results in the preview area of the dialog where you can replace the search string or select another string, press Ctrl+Shift+F again and start a new search.

  4. If you need to see the list of occurrences in a separated tool window, click Open in Find Window. You can use this window and its options to group the results, preview them, and work with them further.

You can use different options in the Find in Path dialog to adjust your search process.

  1. In the Find in Path dialog, select options such as Words or Match case to find the exact word in a project, or match the letter case.

  2. Click the filter icon to filter your search. For example, you can filter the search to omit comments or search only in comments instead.

  3. Select one of the displayed options such as Module or Directory to limit your search. Moreover, you can select the Scope option that offers you a list of predefined scopes for your search.

    For example, you can limit your search only to the open files in your project or you can search in a class hierarchy.

    Search in class hierarchy
    You can also create your own custom scope, click the ellipsis icon icon to open the Scopes dialog.

Search in the specific file types

Use the File Mask option to narrow your search to a specific file type. You can select the existing file type from the list, add a new file type, or add an additional file mask syntax to search for file types with certain patterns.

  1. In the Find in Path dialog, select the File Mask checkbox and from the list of file types, select the one you need.

    File mask
    IntelliJ IDEA limits its search to the specified type.

  2. If you don't find the file type you need in the list, enter your file type in the File Mask field.

    For example, use the following syntax to search only in gradle files: *.gradle.

    Add a new file type

Search for usages in a project

You can search for usages of a symbol in your whole project or in a scope that you set.

  1. Select the %code element% for which you want to find usages. Note that you can extend your search to file usages as well.

  2. From the main menu select Edit | Find | Find Usages (Alt+F7).

  3. Check the results in the Find tool window.

    Find tool window

    You can also pull out the results from the previous Find Usages actions. From the main menu, select Edit | Find | Recent Find Usages and the usage query in question.

    While in the Find tool window, you can 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

    If IntelliJ IDEA doesn't return any results, it will display a message suggesting to opt for more options. You can follow the link or press Ctrl+Shift+Alt+F7 to open the Find Usages dialog where you can set a new scope for your search.

    Find usage dialog
    For example, you can set your search scope to production files only or to only open files.

    To set a custom scope, click the ellipsis icon.

  4. When you are done setting a new scope, click Find.

If you want IntelliJ IDEA to show you usages of the selected symbol in the separate window, press Ctrl+Alt+F7. You can use this window for quick navigation.

Show Usages results window

Press the same shortcut again to see the usages in the default scope.

Last modified: 1 February 2019