Eclipse 不再突出显示引用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/919614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:44:51  来源:igfitidea点击:

Eclipse doesn't highlight references anymore

eclipse

提问by Gerrie

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?

我有一个奇怪的问题。在 Eclipse Ganymede 中,我曾经能够突出显示一个变量,它会突出显示该方法中该变量的使用。但是,通过一些操作,我现在已禁用它。有没有办法启用它?

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.

这是一个非常有用的功能,令人讨厌的是它不起作用。

回答by Rytmis

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

窗口->首选项-> Java->编辑器->标记出现次数

screen shot

截屏

回答by Scott Stanchfield

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.

您可以再次按下它或按照 Rytmis 所说的进行配置。

回答by Fortega

Press alt-shift-O.

alt- shift- O

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

它切换 Eclipse 的“标记出现”功能;它提供了您缺少的突出显示功能。

回答by Chandra Sekhar

  • 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

  • Eclipse的开普勒
    你可以简单地用“切换标记出现在工具栏上的”图标,或者您也可以使用快捷键alt+ shift+ O

    在此处输入图片说明

  • Window > Preferences > Java > Editor > Mark Occurrences. 启用“标记当前文件中所选元素的出现次数”并单击Apply

    在此处输入图片说明

回答by Geert Weening

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

在 Mac OS 上opt- cmd-O我错误地按了一次,多亏了这个问题,我才找到了回来的路

回答by Thiago

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

我也有这个,我的标记出现选项已经全部检查过了。与往常一样,尝试重新启动 Eclipse,它对我有用。

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.

编辑:它实际上有点工作。Eclipse 上有一个错误,当您在新窗口中打开一个项目时(以防您的第一个 Eclipse 窗口中堆满了项目),它开始不起作用。如果您需要,您可以选择一个项目并切换工具栏中的荧光笔或使用 Alt+Shift+O,但您每次选择一个项目时都必须这样做。

回答by CodeSlinger

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.

此外,您必须转到 General->Editors->Text Editors->Annotations,选择 Occurrences 并选中“Text as”并选择 Highlighted。这会让你开心。

回答by Sankalp

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.

这可能是'标记出现'被关闭的方式......我使用Ctrl + Shift + O来组织导入并错误地选择了Alt而不是Ctrl。因此可以通过 Alt+Shift+O 再次打开它。

回答by valarmathi

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

我遇到了类似的问题,其中没有突出显示引用,在启用标记出现时,windows-prefrences-java-editor我能够突出显示引用

回答by svrkispm

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

我有一个类似的问题。我通过卸载名为“erlide”的 erlang 插件解决了这个问题。