Moving Through Your Code
Tips for navigating your code base efficiently.
Navigating Forward & Backward
Move forward and backward between your locations in the code so you don't need to have tabs open.
Use ⌘[ (macOS) / Ctrl+Alt+Left Arrow (Windows/Linux) to navigate backwards and ⌘] / (macOS) Ctrl+Alt+Right Arrow (Windows/Linux) to navigate forwards.
Find Usages
Use Find Usages to search for references in your code base.
Press ⌥F7 (macOS) / Alt+F7 (Windows/Linux), to bring up the Find Usages tool window. You can search a single file, your whole project, or customise the scope.
You can also configure the color of the usages highlighting or disable the automatic highlighting of usages.
Interested in JVM Development?
Go to Declaration or Implementation
Use Go to Declaration or Usages, and Go to Implementation to navgiate around your codebase.
Go To Declaration or Usages ⌥⌘B (macOS) / Ctrl+Alt+B (Windows/Linux) to see where code is declared or used. Go to Implementation ⌥⌘B (macOS) / Ctrl+Alt+B (Windows/Linux) can tell you where a method is implemented and take you there.
Interested in JVM Development?
Navigate to Test
Go to your matching test class with one keyboard shortcut.
You can use ⌘⇧T (macOS) / Ctrl+Shift+T (Windows/Linux), to navigate to a test class and back again. IntelliJ IDEA will navigate to the related Test file, or suggest creating a test. It can even add some of the code constructs for the tests as well.
Use Recent Files
Jump to any of the files you've been using recently in your JetBrains IDE.
The Problem
Have you ever been deep into a project, only to realize that you forgot to include something crucial in a file? We've all been there, so let's learn how to prevent this from happening to us again. While the tabs at the top of your screen are helpful, they can be a little bit overwhelming.
The Solution
Instead of searching for a certain tab, let’s use our IDE. One convenient way to find certain files is using the Recent File Window. It gives you a nice list of all the files you have visited recently. It is automatically sorted in the order you have visited them, which makes going back so much easier
Well, that is already a great improvement, but we can do even better! What if the file you are looking for is at the very bottom. Well sure we could press arrow down like a hundred times, or worse use the mouse, or we just type directly into the window, which lets you search for a particular file.
Wouldn’t it be nice if you could narrow it to only the files you edited, not all you visited? In the upper right corner, you see the “Show edited only” files. This will help you remove some clutter and hides the files you just visited without doing any changes, and you can even open a certain file in a split window to have a look at multiple files at the same by clicking on the icon on the right side or pressing Shift or Enter.
I got one more for you, let’s check it out! If we look to the left side of our Recent Files Window we see all the amazing tools we recently used. You want to jump to the Terminal? Just type in “T-E-R” and it will take you right there.
Development is hard! and having a good overview of edited files is difficult. Luckily our IDEs make navigation really convenient!!
Recent Files & Locations
Quickly navigate around your recent files & locations to stay in your current working context.
Press ⌘⇧E (macOS) / Ctrl+Shift+E (Windows/Linux), to navigate around the files that you've opened recently.
You can filter the recent locations list to files that you've changed by using the same shortcut again.
Interested in JVM Development?
Go to Next Error
Quickly move to the next (or previous) error or warning in the file.
When you open a source file in the editor, you may see warnings or errors in this file. You can quickly step through to check all these issues without having to use the mouse, just press F2 (macOS) / F2 (Windows/Linux).
While you're coding, you may want to jump to the next error or warning F2 (macOS) / F2 (Windows/Linux) or the last one ⇧F2 (macOS) / Shift+F2 (Windows/Linux). This way, you can quickly hop to the next thing that needs fixing or addressing without having to move your hand to the mouse.
Combine this with Alt+Enter (Windows/Linux) to quickly see the suggested solution to the problem and apply a fix. This will show a list of suggested solutions, as we saw in the tip about Context Actions, and we can pick the solution that suits us best.
If you're confident IntelliJ IDEA has the correct fix for the problem, you can skip the step of listing the solutions. Press F2 (macOS) / F2 (Windows/Linux) to navigate to the problem, then press ⌥⇧⏎ (macOS) / Shift+Alt+Enter (Windows/Linux), to accept IntelliJ IDEA's suggested fix.
Interested in JVM Development?