在 Eclipse Java 编辑器中突出显示所有出现的搜索字符串
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16727024/
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
Highlighting all occurrences of a search string in Eclipse Java editor
提问by siva636
If you search for a String in Netbeans Java editor, it automatically highlights all occurrences of that string.
如果您在 Netbeans Java 编辑器中搜索字符串,它会自动突出显示该字符串的所有匹配项。
But, how can I achieve this feature in Eclipse?
但是,如何在 Eclipse 中实现此功能?
(I checked Preferences > Java > Editor > Mark Occurrences, but it seems it is only for similar variables methods etc. but not for for search matches)
(我检查了 Preferences > Java > Editor > Mark Occurrences,但它似乎只适用于类似的变量方法等,而不适用于搜索匹配)
回答by Sam Su
Have you tried the Glance pluginfor Eclipse? fully meet your requirements and even with more features.
您是否尝试过Eclipse的 Glance插件?完全满足您的要求,甚至具有更多功能。
demo and Github of this project: http://ystrot.github.io/glance/
该项目的demo和Github:http: //ystrot.github.io/glance/
UPDATE:available in Eclipse marketplace
更新:在 Eclipse 市场中可用
http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1012
http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=1012
回答by Sstx
You can enable "Toggle Mark Occurrences" (shortkey is ALT+SHIFT+O).
您可以启用“Toggle Mark Occurrences”(快捷键是ALT+ SHIFT+ O)。
For the color of the select text,you can:
对于选择文本的颜色,您可以:
Window->Preferences->General->Editors->Text Editors->Annotations->Occurrences
Window->Preferences->General->Editors->Text Editors->Annotations->Occurrences
Hope it useful.
希望有用。
回答by Sairam Krish
eclipse instasearch pluginis a very useful plugin for search needs inside eclipse. It is based on lucene. This is also available in eclipse marketplace.
eclipse instasearch插件是一个非常有用的插件,可以满足eclipse内部的搜索需求。它基于lucene。这也可以在 eclipse 市场中获得。
It has extensive feature set.
它具有广泛的功能集。
- Instantly shows search results
- Shows a preview using relevant lines
- Periodically updates the index
- Matches partial words (e.g. case in CamelCase)
- Opens and highlights matches in files
- Searches JAR source attachments
- Supports filtering by extension/project/working set
- 即时显示搜索结果
- 使用相关行显示预览
- 定期更新索引
- 匹配部分单词(例如 CamelCase 中的大小写)
- 打开并突出显示文件中的匹配项
- 搜索 JAR 源附件
- 支持按扩展/项目/工作集过滤