简体   繁体   English

Eclipse:如何改变当前选中的方法/表达式的高亮颜色?

[英]Eclipse: How do you change the highlight color of the currently selected method/expression?

In eclipse, when your cursor is placed on a method (or other things), other places the method exists are highlighted.在eclipse中,当你的cursor放在一个方法(或其他东西)上时,该方法存在的其他地方会高亮显示。 I'd like to change the color of this highlight, but after scouring the eclipse preferences many times in all 3 places, I have yet to find it.我想改变这个突出显示的颜色,但是在所有 3 个地方多次搜索 eclipse 偏好后,我仍然没有找到它。

Any of you Eclipse gurus know where to find this option?各位Eclipse知道哪里可以找到这个选项吗?

After running around in the Preferences dialog, the following is the location at which the highlight color for "occurrences" can be changed: 在“首选项”对话框中四处运行之后,以下是可以更改“出现”的突出显示颜色的位置:

General -> Editors -> Text Editors -> Annotations

Look for Occurences from the Annotation types list. 寻找Occurences注释类型的列表。

Then, be sure that Text as highlighted is selected, then choose the desired color. 然后,确保选择了“ Text as highlighted ,然后选择所需的颜色。


And, a picture is worth a thousand words... 而且,一张图片值得一千个字...

首选项对话框
(source: coobird.net ) (来源: coobird.net

该图显示了以橙色突出显示的事件。
(source: coobird.net ) (来源: coobird.net

For those working in Titanium Studio, the item is a little different: It's under the "Titanium Studio" Themes tab. 对于那些在Titanium Studio中工作的人来说,项目有些不同:它位于“ Titanium Studio”主题标签下。

The color to change is the "Selection" one in the top right. 要更改的颜色是右上方的“选择”。

在此处输入图片说明

1 - right click the highlight whose color you want to change 1-右键单击要更改其颜色的突出显示

2 - select "Properties" in the popup menu 2-在弹出菜单中选择“属性”

3 - choose the new color (as coobird suggested) 3-选择新颜色(如coobird建议)

This solution is easy because you dont have to search for the highlight by its name ("Ocurrence" or "Write Ocurrence" etc), just right click and the appropriate window is shown. 该解决方案很容易,因为您不必按其名称(“ Ocurrence”或“ Write Ocurrence”等)搜索突出显示,只需右键单击并显示相应的窗口即可。

If you're using eclipse with PHP package and want to change highlighted colour then there is slight difference to above answer. 如果您将eclipse与PHP软件包一起使用,并且想要更改突出显示的颜色,则与上述答案略有不同。

  1. Right click on highlighted word 右键单击突出显示的单词
  2. Select 'Preferences' 选择“首选项”
  3. Go to General > Editors > Text Editors > Annotations. 转到常规>编辑器>文本编辑器>注释。 Now look for "PHP elements 'read' occurrences" and "PHP elements 'write' occurrences". 现在查找“ PHP元素'读取'事件”和“ PHP元素'写入'事件”。 You can select your desired colour there. 您可以在那里选择所需的颜色。

使用PHP更改Eclips中的突出显示文本颜色

  1. right click the highlight whose color you want to change 右键单击要更改其颜色的突出显示

  2. select "Preference" 选择“首选项”

  3. ->General->Editors->Text Editors->Annotations->Occurrences->Text as Hightlited->color. ->常规->编辑器->文本编辑器->注释->出现次数->高亮文本->颜色。

  4. Select "Preference ->java->Editor->Restore Defaults 选择“首选项-> java->编辑器->恢复默认值

in my case (Eclipse IDE 2021-06), dark theme, the issue was with the background color of "C/C++ Write Occurrences".在我的例子中(Eclipse IDE 2021-06),深色主题,问题出在“C/C++ Write Occurrences”的背景颜色上。

On each click over a variable being written in the code, the editor highlights all occurrences of that variable.每次单击代码中写入的变量时,编辑器都会突出显示该变量的所有实例。

You can find this setting here:您可以在此处找到此设置:

General -> Editors -> Text Editors -> Annotations and then select 'C/C++ Write Occurrences'. General -> Editors -> Text Editors -> Annotations 然后 select 'C/C++ Write Occurrences'。 And finally change che Color property.最后更改 che Color 属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM