Eclipse does not highlight matching variables
Eclipse loves to be the center of attention, it not only takes in your text, but it can also highlight matching variables. Make sure that the Mark Occurrences feature is on. Navigate through the menus from Window to Preferences then Java, Editor, and finally Mark Occurrences. All boxes checked? Good. You can also use the shortcut Alt + Shift + O
to swiftly show off this feature.
Perfecting the preferences
In case you can't tell Occurences and Write Occurences apart, dive into the preferences. They are like siblings, you can find them in Text Editors > Annotations
. Perhaps, they wear the same color, if so, then uncheck the Text as highlighted box for one. This way, you'll know who you're dealing with.
Kick-start the highlighters by either restarting Eclipse, or simply closing and reopening the files.
Quirk finding
If matching variables still feel shy, try troubleshooting:
- Manual override to the rescue, use
Alt + Shift + O
to switch on variable highlighting. - At times Eclipse bugs can be pesky; select variable, click elsewhere, then back to the variable.
- Play around with mark occurrence, word wrap, and show whitespace characters in the toolbar, as a quick remedy.
Aligning with your workflow
Here's the trick to making Eclipse work for you:
- Dance with the colors, and tweak annotation preferences for better visual distinction.
- Trouble in paradise? When in doubt, the default settings always welcome you back.
- Compare source code editors. They all have a flair for highlighting. It's worth checking them all out.
Beyond the horizon of variables
Rub Eclipse's magic lamp and command:
- Illuminate method exits: When the return type is selected, Eclipse can act like a guiding light.
- Unleash the power of Linked mode: Renaming variables simultaneously (faster than Flash!⚡)
- Seek Breakpoints and occurrences in debug mode: watch your program unmask itself under the spotlight.
Was this article helpful?