Michael Berry
Michael Berry

Reputation: 72379

Variable use highlighting in Intellij IDEA

One of the features I really like about Netbeans is that when you click on a variable, method, field etc. Netbeans shows you all the usages of this entity in the right hand bar as little bars of colour. Is there a way to get this behaviour in IntelliJ IDEA and if so, how do I turn it on? I haven't found anything in the settings or Google but I might be missing something!

Upvotes: 9

Views: 3511

Answers (3)

Pakka Pakka
Pakka Pakka

Reputation: 2136

Apart from enabling the "automatic highlight usages" setting described above, you can also invoke "highlight usages" manually, using the shortcut Ctrl+Shift+F7.

The benefits of using the "manual" highlight usages are:

  • You can highlight usages of multiple variables/methods/etc at the same time
  • You can remove highlighting for an individual element selectively, by invoking Ctrl+Shift+F7 again on that element
  • some users find it less distracting than "automatic highlight usage" - this is subjective or course

Upvotes: 6

topr
topr

Reputation: 21

Above answers are correct but still to get the exact behavior like in Netbeans try to use Identyfier Highlighter plugin for Intellij Idea (available in default plugin list under window settings).

This is really strange as Idea features mentioned in previous answers would do the job if merged into the one configurable feature.

Upvotes: 2

subhaze
subhaze

Reputation: 8855

file>settings or ctrl+alt+s (for windows) select editor from the list on the left and check Highlight usages of element at caret in the Highlight on Caret Movement section

Upvotes: 11

Related Questions