天天看點

Eclipse代碼自動完成功能

basically the auto activation trigger for auto-complete by default is set to only the character ".".

to make code assist / auto complete trigger always, you have to change the string to:

in v21.x.x version of adt, this is located in preferences -> java --> editor --> content assist.

you can also set auto completion to open automatically while typing: write .abcdefghijklmnopqrstuvwxyz in "auto activation triggers for java" field, in java/editor/content assist.

answered jun 1 '11 at 14:45

Eclipse代碼自動完成功能

<a href="http://stackoverflow.com/users/411965/oshai">oshai</a>

1,928833

Eclipse代碼自動完成功能
Eclipse代碼自動完成功能

<a></a>

use the <code>ctrl+space</code> shortcut for getting all possible autocomplete options available in a particular context in the editor.

auto complete will also allow you to insert custom code templates into the editor, with placeholders for various inputs. for instance, attempting to auto complete the word "test" in a java editor, in the context of a class body, will allow you to create a unit test that uses junit; you'll have to code the body of the method though. some code templates like the former, come out of the box.

configuration options of interest

auto-activation delay. if the list of auto complete options is taking too long to appear, the delay can be reduced from windows -&gt; preferences -&gt; java -&gt; editor -&gt; content assist -&gt; auto activation delay (specify the reduced delay here).

auto activation trigger for java. accessible in the same pane, this happens to be the <code>.</code> character by default. when you have just keyed in <code>typea.</code> and you expect to see relevant members that can be accessed, the auto completion list will automatically popup with the appropriate members, on this trigger.

proposal types. if you do not want to see proposals of a particular variety, you can disable them from windows -&gt; preferences -&gt; java -&gt; editor -&gt; content assist -&gt; advanced. i typically switch off proposals of most kinds except java and template proposals. hitting ctrl+space multiple times will cycle you through proposals of various kinds.

template proposals. these are different from your run of the mill proposals. you could add your code templates in here; it can be accessed from windows -&gt; preferences -&gt; java -&gt; editor -&gt; templates. configuration of existing templates is allowed and so is addition of new ones. reserve usage however for the tedious typing tasks that do not have a template yet.

歡迎加群互相學習,共同進步。qq群:ios: 58099570 | android: 330987132 | go:217696290 | python:336880185 | 做人要厚道,轉載請注明出處!http://www.cnblogs.com/sunshine-anycall/archive/2013/03/02/2940023.html

繼續閱讀