Go to next compiler error across project in IntelliJ

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.

26931 次浏览

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.

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.

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.

Settings-Keymap

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 error
  • Enter
  • Esc to get to back to code where this error is

For going to the next error across the entire project, use Alt+F2 instead of just F2.

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

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.

  1. Select Problems as shown in the image below

enter image description here

This will list all files that have errors.

  1. 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.

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.

2022 UPDATE

This is a whole project, error to error, one-click solution after a 2-second setup. For both setups, optionally disable generate warnings for your compiler.

Windows/Linux Setup

  1. Alt6 or click Project Errors tab of Problems tool window
  2. CtrlNumPad+ or click expand all to expand all errors

MacOS Setup

  1. Cmd6 or click Project Errors tab of Problems tool window
  2. Cmd+ or click expand all to expand all errors

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).