Eclipse doesn't highlight references anymore

Eclipse

Eclipse Problem Overview


I have an odd problem. In Eclipse Ganymede, I used to be able to highlight a variable, and it would highlight the use of that variables in that method. However through some action I have now disabled it. Is there a way I can enable it?

I tried searching Google, but since I don't know what the feature is called, its kinda tough.

Its a really useful feature, and its annoying that its not working.

Eclipse Solutions


Solution 1 - Eclipse

There's a little "highlighter" icon on the toolbar - it toggles "Mark Occurrences".

From the preferences window, the feature you mean is configured by navigating to:

Window -> Preferences -> Java -> Editor -> Mark Occurrences

screen shot

Solution 2 - Eclipse

There's a little "highlighter" icon on the toolbar - it toggles "Mark Occurrences".

You probably accidentally pressed it when trying to select a menu item at some point. I had a friend who did that with the "show selected element only" toolbar button...

You can either press it again or configure as Rytmis says.

Solution 3 - Eclipse

Press alt-shift-O.

It toggles the "Mark Occurrences" feature of Eclipse; which provides the highlighting functionality you're missing.

Solution 4 - Eclipse

  • In Eclipse Kepler,
    You can simply use the "Toggle Mark Occurrences" icon on the tool bar or you can use keyboard short cut alt+shift+O.

    enter image description here

  • Window > Preferences > Java > Editor > Mark Occurrences. Enable "Mark occurrences of the selected element in the current file" and click Apply.

    enter image description here

Solution 5 - Eclipse

On Mac OS it's opt-cmd-O I pressed that once by mistake, thanks to this question I found my way back

Solution 6 - Eclipse

I had this too and my Mark Occurrence options were already all checked. As always, try restarting Eclipse, it worked for me.

EDIT: It actually kinda worked. There's a bug on Eclipse that when you open a project in a new window (in case your first Eclipse window is a mess full of projects) it starts not to work. In case you need you can select an item and toggle the highlighter in the toolbar or use Alt+Shift+O, but you're gonna have to do it every time you select an item.

Solution 7 - Eclipse

In addition, you have to go to General->Editors->Text Editors->Annotations, choose Occurrences and check the "Text as" and choose Highlighted. This will make you happy.

Solution 8 - Eclipse

That is probably how the 'mark occurences' got turned off... I was using Ctrl+Shift+O to organize imports and by mistake chosen Alt instead of Ctrl. So it can be turned on again by Alt+Shift+O.

Solution 9 - Eclipse

I had a similar problem. I solved it by uninstalling the erlang plugin called "erlide".

Solution 10 - Eclipse

I had the similar problem where the references were not highlighted, on enabling the mark occurrences in windows-prefrences-java-editor I am able to highlight the references

Solution 11 - Eclipse

To me it didn't work anymore because there was an error in the code. It generally works, but sometimes it might not, make sure your code has no errors if nothing else works.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGerrieView Question on Stackoverflow
Solution 1 - EclipseRytmisView Answer on Stackoverflow
Solution 2 - EclipseScott StanchfieldView Answer on Stackoverflow
Solution 3 - EclipseFortegaView Answer on Stackoverflow
Solution 4 - EclipseChandra SekharView Answer on Stackoverflow
Solution 5 - EclipseGeert WeeningView Answer on Stackoverflow
Solution 6 - EclipseThiagoView Answer on Stackoverflow
Solution 7 - EclipseCodeSlingerView Answer on Stackoverflow
Solution 8 - EclipseSankalpView Answer on Stackoverflow
Solution 9 - EclipsesvrkispmView Answer on Stackoverflow
Solution 10 - EclipsevalarmathiView Answer on Stackoverflow
Solution 11 - EclipseTudorView Answer on Stackoverflow