Cannot highlight all occurrences of a selected word in Eclipse

人盡茶涼 提交于 2019-11-28 17:20:52

You can try to activate Toggle Mark Occurrences with icon on Toolbar:

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

In General > Editors > Text Editors > Annotations

Check out options that are checked in Preferences -> Java -> Editor -> Mark occurrences. Then restart Eclipse.

Find the Preferences under Window,

In General > Editors > Text Editors > Annotations(1)

(5) is to select the color and press apply.

The standard "Mark Occurrences" functionality included in Eclipse that everyone recommends only highlights identifiers in editors of whatever language. For example, it won't highlight int in C editors, and it won't help at all in the Console pane.

So if you want to highlight ALL occurrences on ANY word in ANY Eclipse pane (kinda like Notepad++ does), try the Glance plug-in for Eclipse.

As of November 2017 Glance works for Eclipse Neon and Oxygen. There was a period of time in which Neon was unsupported, and a fork appeared, but it seems unnecessary now (and abandoned).

For Eclipse Mars:

Window --> Preferences --> Check (Mark occurrences of the selected element in the current file.)

As shown if figure:

Go

Java> Editor > Mark Occurrences

Uncheck "Keep Marks when the section changes" then click Ok

Restart Eclipse.

This work for me.

If you go into the window-prefrences, select the language you want/are working with. Select the editor under this specific language and then there is a mark occurrences there that has some options. Where it says keep marks when the selection changes, for me this was checked. When I unchecked it the system started highlighting correctly.

For folks who are using a dark background with light font colors, you may want to check out the highlight color in Preferences -> General -> Editors -> Text Editor -> Annotations. Mine was defaulted to black, which does not stand out on a black background.

athyagat
  1. Click the word and hold until a popup appears as shown in the figure.
  2. On the popup, there is a little right arrow, after clicking it, a new icon shows up.
  3. Click that link to open preferences.
  4. Once in preferences, select C/C++ Occurrences (it will be language specific) and select Include in next/previous navigation with Text as Highlighted.

This should enable the feature of highlighting all occurences of the selected word in the opened file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!