Bass
Bass

Reputation: 5338

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?

Upvotes: 8

Views: 1027

Answers (3)

ax.
ax.

Reputation: 60167

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)

Upvotes: 3

ZhongYu
ZhongYu

Reputation: 19682

Try placing cursor at break, and press Ctrl+B

Upvotes: 1

Makoto
Makoto

Reputation: 106490

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.

Upvotes: 2

Related Questions