GoLand 2019.2 Help

Finding and replacing text in a project

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

Find the search string 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. Alternatively, in the editor, highlight the string you want to find and press Ctrl+F. GoLand places the highlighted string into the search field.

    To see a list of your previous searches, press Alt+Down.

    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.

The Find in path 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
    GoLand 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.

    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 symbol 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 usages

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. Use the F3 and Shift+F3 shortcuts to navigate between highlighted symbols.

If necessary, you can disable the automatic highlighting.

  • In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | General, and clear the Highlight usages of element at caret checkbox.

When the automatic highlighting is disabled, place the caret at the necessary symbol and press Ctrl+Shift+F7. This will highlight all usages of the symbol in the current file.

Replace text in the path

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

  2. In the Replace In Path dialog, specify the search and replace strings, the search options, and the scope.

  3. Click Open in Find Window Ctrl+Enter to open a Find tool window with the list of encountered occurrences and a preview of the occurrences alongside.

Toggle between the Find and Replace

  1. To switch from the Find In Path to Replace In Path window, press Ctrl+Shift+R.

  2. To switch from the Replace In Path to Find In Path window, press Ctrl+Shift+F.

Last modified: 29 October 2019