Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse highlighting the same occurrence of the word [closed]

People also ask

How do I highlight all occurrences of a word in Eclipse?

Glance does not work anymore, but in current Eclipse Versions (Eclipse 2020) you can highlight any word by selecting the word and pressing CTRL+F.

How do I turn off highlighting in Eclipse?

Alt + Shift + O disables and enables this feature, which is called Mark Occurrences. There is also a toolbar button to toggle it on and off.

Why is Eclipse highlighting my code?

This is activated because of code coverage. If you want to remove it then follow these steps. Go to "Windows -> Show View -> Coverage" Select it.


I've been working with Eclipse for quite a while and I'm pretty certain that there is no canonical way of doing this.

In Eclipse these things are managed on a per-editor basis and the Java editor does not support what your looking for for all I know. At least for the Java editor you can do some minor configuration in what is highlighted and how (Preferences > Java > Editor > Mark Occurrences), but I guess you already know that.

As for plugins, I'm not aware of any plugin that achieves what you're looking for. As a matter of fact I'd be surprised if there really was a plugin which achieves what you're looking for.

If something comes up I'd much appreciate you sharing it here, I've been trying to get decent highlighting into Eclipse for years unsuccessfully... :)


Here is a plugin for eclipse: http://ystrot.github.io/glance/

It highlights all occurrences as with notepad++ upon hitting Ctrl + Alt + F.


If you enable "Mark Occurrences" , then all words that are the same as the one you have marked will be highlighted.

You can enable it in two following ways

  1. Alt + Shift + O
  2. Preferences > Java > Editor > Mark Occurrences

    enter image description here


Below is what I found works for me but you can also assign a key shortcut to 'Find Text in File':

  1. Select the word or section of text
  2. Press CTR+3 to activate 'Quick Access' search
  3. Type 'Find Text in File'
  4. Execute

As mentioned by @Kislingk you can modify how the words are highlighted/marked in 'Preferences > General >Editors>Text Editors > Annotations'.

eclipse-highlight-search-results-in-file


Here is the closest solution I have found:

  1. Create a shortcut in Preferences/General/Keys type in the search field: "Find Text in File" By default it has nothing assigned so just assign your key binding to it.

  2. Annotations can help with displaying it in the sidebar

enter image description here


Use file search to search selected resource can highlight same word in single file.