Tips to help you navigate through your codebase.
Navigating code is a crucial skill that we can get faster at with our IDE by using the various keyboard shortcuts to move around the codebase based on recent context, what something in the code does, or to move backwards and forwards based on our movements in time. We will look at:
- Viewing Recent Files and Locations
- Going to a Declaration or Implementations
- Navigating Forward and Backwards & Preview Tab
Viewing Recent Files and Locations
You can think of Recent Files (⌘E | Ctrl+E) as your working context. Many users rely on Editor Tabs for this but you can turn them off and use Recent Files to navigate around the files that you've opened recently.
In addition to Recent Files, IntelliJ IDEA allows you to go to your Recent Locations (⌘⇧E | Ctrl+Shift+E) which is most helpful when you are navigating around specific points in longer classes.
Going to a Declaration or Implementations
Go To Declaration or Usages (⌘B | Ctrl+B) is a great way to answer the question "Where is this declared?" or "Where is this used?".
Similarly, Go to Implementation (⌘⌥B | Ctrl+Alt+B) can tell you and subsequently take you to where a method has been implemented.
Navigating Forward and Backwards & Preview Tab
Sometimes you just want to flick between a few files in the same order that you opened and navigated through them. You can do that with (⌘[ | Ctrl+Alt+←) to go backwards and (⌘[ | Ctrl+Alt+→) to go forwards.