Go to next compiler error across project in IntelliJ
ScalaIntellij IdeaScala Problem Overview
I spend a lot of time going back and forth between SBT and IntelliJ, getting a file, line number, and error from SBT and navigating to it in IntelliJ. Is there a way to automate this at all? Even if it's only via IntelliJ's compiler, I'd love to be able to navigate to the next error project-wide.
Scala Solutions
Solution 1 - Scala
To navigate between errors or warnings in IntelliJ you can do one of the following:
- Use keyboard shortcuts F2 (Next) and Shift+F2 (Previous) respectively.
- On the main menu, choose
Navigate
|Next / Previous Highlighted Error
.
Solution 2 - Scala
I am using Ctrl+Alt+Up/Down to scroll through the list of errors. This is inside the Compile Messages
window. The SBT Console
uses the same shortcut, as stated in the SBT wiki.
Solution 3 - Scala
For this specific question, just use F2 (Next) and Shift+F2 (Previous);
But for any other questions related to shortcuts of IDEA, searching in the Settings-Keymap is better than in Google.
Solution 4 - Scala
To go to next compilation error in the next file:
Command-0
(go to messages tab where compile errors are)Down
arrow until get to next errorEnter
Esc
to get to back to code where this error is
Solution 5 - Scala
The highly voted answer has not really answered the question. The provided solution of F2
only navigates through the errors in the current file. But picking up from the comments, the suggestion below is not the ultimate answer but is a little bit closer.
- Select
Problems
as shown in the image below
This will list all files that have errors.
- Use
F2
to navigate through the errors.
At least with this method, it has narrowed down the files with the errors and are just a click away.
Solution 6 - Scala
For the mac I couldn't find anything that worked until I discovered the following
cmd + 1 -> f2 (on files) -> escape -> f2 (inside file) -> cmd + 1 -> repeat
Solution 7 - Scala
2022 UPDATE
This is a whole project, error to error, one-click solution after a 2-second setup.
Windows/Linux Setup
MacOS Setup
Now click
the first error in the Project Errors
tab, fix it, then click
the next error. Works regardless of build tool and may work in older versions of intellij than 2022.1.
Edit: Credit @Manuel Romeiro - the answer in his comment worked for a while, but stopped when intellij got confused somehow. Will update my answer if I figure that out.
Thanks @meridsa for providing setup step 1 for Mac. Also to @K. Symbol for syntax for showing keys in an answer (very cool).
Solution 8 - Scala
For going to the next error across the entire project, use Alt+F2 instead of just F2.
Solution 9 - Scala
On Mac, you can enable Fn regular key functionality in System Preference.
Choose Apple Menu > System Preferences.
Click Keyboard & Mouse.
Click the Keyboard tab.
Select the option Use All F1, F2, Etc. Keys As Standard Function Keys.
Quit System Preferences.