Eclipse代码自动完成功能

简介:

down vote accepted

Found the answer via this question: Auto Code Completion on 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:

.abcdefghijklmnopqrstuvwxyz

In v21.x.x version of ADT, this is located in Preferences -> Java --> Editor --> Content Assist.

up vote 15 down vote accepted

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.

see this question for more details: Automatically opening completion window in Eclipse

share | improve this answer
 
   
This is exactly what I wanted! Thanks! – Marcelo Assis Jun 1 '11 at 18:21

Use the Ctrl+Space 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 -> Preferences -> Java -> Editor -> Content Assist -> Auto Activation delay (specify the reduced delay here).
  • Auto activation trigger for Java. Accessible in the same pane, this happens to be the . character by default. When you have just keyed in typeA. 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 -> Preferences -> Java -> Editor -> Content Assist -> 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 -> Preferences -> Java -> Editor -> 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
相关文章
|
6月前
|
Java Maven Android开发
在Eclipse里配置Maven插件
Maven是一款比较常用的Java开发拓展包,它相当于一个全自动jar包管理器,会导入用户开发时需要使用的相应jar包。使用Maven开发Java程序,可以极大提升开发者的开发效率。下面我就跟大家介绍一下如何在Eclipse里安装和配置Maven插件。
145 0
|
6月前
|
XML Java Maven
eclipse 、idea 安装activiti插件
eclipse 、idea 安装activiti插件
149 0
|
11月前
|
Java Android开发
eclipse安装SpringBoot插件的无敌办法
eclipse安装SpringBoot插件的无敌办法
125 0
|
11月前
|
Java Android开发 Spring
在 Eclipse 中安装 SpringTools 插件
在 Eclipse 中安装 SpringTools 插件
124 0
|
12月前
|
XML Java 应用服务中间件
Eclipse插件下载地址汇总
Eclipse插件下载地址汇总
297 0
|
存储 Android开发
Eclipse安装Flowable Eclipse Designer插件实现图形建模BPMN 2.0流程图
Eclipse安装Flowable Eclipse Designer插件实现图形建模BPMN 2.0流程图
376 0
|
IDE NoSQL Java
Eclipse下载安装和JDK下载安装(环境配置)及下载C++插件CDT
Eclipse下载安装和JDK下载安装(环境配置)及下载C++插件CDT
367 0
|
存储 Java 应用服务中间件
Java开发 —— eclipse,myeclipse安装+Tomcat插件
Java开发 —— eclipse,myeclipse安装+Tomcat插件
Java开发 —— eclipse,myeclipse安装+Tomcat插件