Navigation in Groovy
IntelliJ IDEA offers standard navigation actions when you work with Groovy.
Most of the time you work with a finite set of files, and need to switch between them quickly. A real time-saver here is an action called Recent Files invoked by pressing Ctrl0E. By default, the focus is on the last accessed file. Note that you can also open any tool window through this action:
Navigate to Class is available by pressing Ctrl0N and supports sophisticated expressions, including camel humps, paths, line navigate to, middle name matching, and many more. If you call it twice, it shows you the results out of the project classes.
Navigate to File works similarly by pressing CtrlShift0N, but is used for files and folders. To navigate to a folder, end your expression with the Slash character.
Navigate to Symbol is available by pressing CtrlAltShift0N and allows you to find a method or a field by its name.
Recent Locations popup lets you check recently visited or changed code locations and is available by pressing CtrlShift0E.
When you are not switching between files, you are most probably navigating within a file. The simplest way to do it is to press CtrlF12. The popup shows you the structure of a file, and allows you to quickly navigate to any of them:
If you need to open a file in a particular tool window (or Finder/Explorer), you can do so via the Select In action by pressing AltF1:
Navigation shortcuts include:
Action | Shortcut |
---|---|
Search everywhere | Double Shift |
Navigate to class | Ctrl0N |
Navigate to file | CtrlShift0N |
Navigate to symbol | CtrlAltShift0N |
Recent files | Ctrl0E |
File structure | CtrlF12 |
Select in | AltF1 |
Navigate to declaration | Ctrl0B |
Navigate to type hierarchy | Ctrl0H |
Quick Popups are helpful for checking additional information related to the symbol at the caret. Below is a list of popups you should know if you want to be more productive:
Action | Shortcut |
---|---|
Documentation | Ctrl0Q |
Quick definition | CtrlShift0I |
Show usages | CtrlAltF7 |
Show implementation | CtrlAlt0B |
tip
Quick Popups are available for symbols in the editor; however, they are also available for items in any other list via the same shortcuts.
Find Usages helps you quickly find all pieces of code referencing the symbol at the caret, no matter if the symbol is a class, method, field, parameter, or another statement. Just press AltF7 and get a list of references grouped by usage type, module, and file.
If you want to set custom options for the Find Usages algorithm, press CtrlAltShiftF7, or click the first button on the right panel with search results.
If what you're looking for is plain text, use Find in Files by pressing CtrlShift0F.
For more information, refer to Search for usages.
Thanks for your feedback!