Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA: highlighting loop break points

In Eclipse, there's a possibility to highlight loop break points: I can place the cursor onto the break;, and the very loop it breaks out from will be highlighted:

enter image description here

Still, this functionality seems to be missing from IDEA:

enter image description here

Is there any hidden preference or a 3rd party plug-in which enables the same for IDEA?

like image 438
Bass Avatar asked May 14 '15 15:05

Bass


2 Answers

This feature has been introduced in IntelliJ 2018.2:

When you place a caret at the break or continue keyword, IntelliJ IDEA highlights the for or while keyword of the corresponding loop.


(source: cloudfront.net)

like image 131
ax. Avatar answered Oct 30 '22 08:10

ax.


The closest that I can get to what you're describing is to using the "Find Declaration" shortcut (Command + B or CTRL + B), which requires that you highlight the break instead of the loop.

If you're in a method that returns void, it will take you to the outermost bracket that will be broken out of. In certain cases in methods that return it will point to the return statement instead, which makes the feature not entirely reliable.

While this will properly show you which loop it breaks out of, to my knowledge there is nothing in vanilla IntelliJ that does what you describe out-of-the-box.

like image 22
Makoto Avatar answered Oct 30 '22 07:10

Makoto