简体   繁体   English

更改Eclipse自动完成的行为(内容辅助)

[英]Changing the behavior of the Eclipse auto-complete (Content Assist)

When I am programming in Eclipse, the auto-complete \\ suggestions box usually opens when typing a dot (for example after typing System. or SomeObject. , and stays open while typing a similar code to any of the suggested. 当我在Eclipse中编程时,自动完成\\建议框通常在键入点时打开(例如在键入System.SomeObject. ,并在键入类似的代码时保持打开状态。

This is what I'm talking about: 这就是我所说的: 在此输入图像描述

I often use the auto-complete \\ suggestions box to my advantage, and there are couple of changes I would like to make in order to improve my productivity while programming, if possible; 我经常使用自动完成\\建议框对我有利,并且如果可能的话,我想做一些改变以便在编程时提高我的工作效率;


  • Is there any way to make the suggestions box visible all the time, showing suggestions in real-time (and showing a blank box when there are no available suggestions) ? 有没有办法让建议框始终可见,实时显示建议(并在没有可用建议时显示空白框)?

  • Is there any way to add permanent custom suggestions to the suggestions box (eg a switch case template or a line of code like public String toString() ) ? 有没有办法在建议框中添加永久自定义建议(例如,开关案例模板或一行代码,如public String toString() )?

  • Is there any way to re-order the suggestions box (eg class private variables before general functions or System.out.println() before System.out.print() ) ? 有什么办法重新排序的建议箱(前通用功能或者如类私有变量System.out.println()之前System.out.print()

  • Is there any way to re-design the suggestions box - ie changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up? 有没有办法重新设计建议框 - 即更改其文本颜色,背景颜色,重新调整建议框窗口和删除黄色java-doc弹出窗口?

FYI, in Eclipse terminology this feature is called Content Assist . 仅供参考,在Eclipse术语中,此功能称为内容辅助

Is there any way to make the suggestions box visible all the time, showing suggestions in real-time (and showing a blank box when there are no available suggestions) ? 有没有办法让建议框始终可见,实时显示建议(并在没有可用建议时显示空白框)?

No, that's not possible. 不,那是不可能的。 You can invoke it any time you want via Ctrl + Space ( Command + Space on Mac) 您可以通过Ctrl + Space (Mac上的Command + Space )随时调用它

Is there any way to add permanent custom suggestions to the suggestions box (eg a switch case template or a line of code like public String toString()) ? 有没有办法在建议框中添加永久自定义建议(例如,开关案例模板或一行代码,如public String toString())?

Yes, you can add your own templates via Preferences > Java > Editor > Templates 是的,您可以通过首选项 > Java > 编辑器 > 模板添加自己的模板

Is there any way to re-order the suggestions box (eg class private variables before general functions or System.out.println() before System.out.print()) ? 有没有办法重新排序建议框(例如在System.out.print()之前的一般函数或System.out.println()之前的类私有变量)?

Not really. 并不是的。 There is some control of the order for "cycling" through proposal types via Preferences > Java > Content Assist > Advanced , but it's not really what you're looking for. 通过“首选项” >“ Java” >“ 内容辅助” >“ 高级 ”可以控制通过提案类型“循环”的顺序,但它并不是您正在寻找的。 The order of proposals is, I think, based on the current context of when Content Assist is invoked. 我认为,提案的顺序基于调用内容辅助时的当前上下文。

Is there any way to re-design the suggestions box - ie changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up? 有没有办法重新设计建议框 - 即更改其文本颜色,背景颜色,重新调整建议框窗口和删除黄色java-doc弹出窗口?

All of the customization option are available under Preferences > Java > Content Assist ; 所有自定义选项都可在Preferences > Java > Content Assist下找到 ; color options are available under Preferences > General > Appearance > Color and Fonts , but I think the colors for that pop-up might come from your operating system color settings. “首选项” >“ 常规” >“ 外观” >“ 颜色和字体”下提供了颜色选项,但我认为该弹出窗口的颜色可能来自您的操作系统颜色设置。

If you're using (or willing to use) Eclipse Juno (4.2) then there is a new project call Code Recommenders that you might find interesting. 如果您正在使用(或愿意使用)Eclipse Juno(4.2),那么您可能会发现一个新的项目调用Code Recommenders ,您可能会感兴趣。

E-Riz already answered all your other questions but for getting content assist in real-time there is a workaround E-Riz已经回答了所有其他问题,但为了实时获得内容帮助,有一种解决方法

Under Preferences > Java > Editor > Content Assist there is an option for "Auto activation triggers for Java". Preferences> Java> Editor> Content Assist下,有一个“Java自动激活触发器”选项。 By default it's set to ".". 默认情况下,它设置为“。”。 You can append to that all the alphabets (ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz) and then it should work. 你可以附加所有的字母表(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz)然后它应该工作。

Is there any way to re-design the suggestions box - ie changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up? 有没有办法重新设计建议框 - 即更改其文本颜色,背景颜色,重新调整建议框窗口和删除黄色java-doc弹出窗口?

Just when the auto-suggestion box pops up, if you hover your mouse pointer to its botton-right corner, you'll be able to see mouse pointer turn into resize pointer. 就在弹出自动建议框时,如果将鼠标指针悬停在右下角,您将能够看到鼠标指针变为调整大小指针。 Resize it the way you like and next time when it pops up, it will be of the same size. 按照您喜欢的方式调整大小,下次弹出时,大小会相同。 Hope this helps. 希望这可以帮助。 :-) :-)

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

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