Disable statement completion on space in Eclipse Content Assist

…衆ロ難τιáo~ 提交于 2019-11-27 23:28:43

问题


Is there a way to disable auto-completion feature of Eclipse, which inserts currently selected statement in Java Content Assist when pressing space?

I still want to have such a behavior for enter key (and only for enter).


回答1:


Since Eclipse 2018-12 (4.10) there is a preference for that:

In Window > Preferences: Java > Editor > Content Assist check the checkbox Disable insertion triggers except 'Enter'

See also:

  • Eclipse 4.10 - New and Noteworthy - Disable completion insertion triggers
  • The feature here in this video in action.



回答2:


Not sure if this is what you are looking for, but:

You can disable the hotkey (or set it to a different hot key) in preferences.

1) Open the preferences window (on a mac, it is Eclipse->Preferences) 2) Navigate to the Keys window in general > editors > keys 3) search for 'content assist' in the filter box. 4) Change or remove the binding (near the bottom of the window)




回答3:


I know this is an old question but the following anwser may help those come here through google.
It is possible, but a bit of complicated.

First we can make sure content assist pop up whenever we type: In Eclipse, open window->Preferences, go to Java->Editor->Content Assist, then enter all 26 letters both upper and lower cases into Auto activation triggers for java:
This has been mentioned many times.
To only confirm with enter pressed, download Practical Macro from this answer or directly from this Source Forge page. Drop the jar file in folder dropins under Eclipse's installation directory, restart Eclipse and you will find it:

Hit the red button to begin recording, enter space anywhere in the editor then hit the red button again to bring up a save screen. Save the macro with some name, e.g. we use "space" here.
Afterwards go to Preferences again, then General->Keys, enter the name you set before as filter text, find the recorded macro then set its key binding to Space.
Now whenever you hit the space bar, it interrupts content assist from entering its suggested content, though the assist is still shown. You can do the same for the dot key.

Tested here:
Enter h to bring up the assist:

Press space bar:

It works! While if i press Enter it still auto completes.

For dot key you may want it to bring up Content Assist again after discard te previous suggestion, so when recording the macro for dot key, press dot key then use Alt+/ to bring up the assist. While replaying you may find the assist empty, that's because it needs delay. Insert some time-consuming command between inserting the dot and bring back the assist, e.g. Organize Import or Format Code.




回答4:


Not possible as far as I can tell in Kepler. Best solution I've found is to increase the "Auto activation delay (ms)" setting. For me increasing it from the aggressive default of 40 ms to 200 ms worked out well.



来源:https://stackoverflow.com/questions/18586771/disable-statement-completion-on-space-in-eclipse-content-assist

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