To turn off the highlighting, press Esc.
This feature actually has two "modes".
If you press Alt-F7 with:
- a method, class, or variable unselected, cursor in it:
- then all occurrences of in the current scope are highlighted.
- If a variable, then any initializations are highlighted in a different color (so you can see where the variable's value is getting set).
- method, class,variable, String literal, or xml element/attribute etc selected :
- any occurrence of that text in the file, regardless of scope, is highlighted, even text in comment blocks or String literals.
Why? Since highlighted text accumulates until you hit "Esc" to clear all highlighted text from the buffer, IntelliJ uses different colors to distinguish between "highlight this symbol in scope" and "highlight any matching text in file" modes.
Both of these modes will put markers in the right-hand gutter to to show you at a glance wherever these occurrences may be.