简体   繁体   中英

IntelliJ Idea: code completion for creating method like in Eclipse

I am using Eclipse for about 5 years. Now I'm begging with IntelliJ Idea 13. I can not get used to code completion :-(

How can I create new public method?

In Eclipse i press:

pub CTRL+SPACE ENTER int CTRL+SPACE test ENTER

and get

public int test() {

}

how can I do it in Idea?

在此处输入图片说明

如果此场景对您很重要,则可以使用IntelliJ的实时模板

You can add a 'Live Template' in IntelliJ. Go to Preferences -> Live Templates -> Select your language (if Java is not there, you can select Other), select the "+" symbol and add a new template. eg Abbreviation = test, and put your method in the Template text.

IntelliJ will display a message 'No applicaable contexts yet'. Define' just below the box. If you click on 'Define' you can select 'Java' in the list that shows up.

In your editor, type the template abbreviation and press the tab key.

There are no built-in templates for that. You can create your own, like other answers advise. But in general, just typing the method with autopopup completion seems to require almost the same number of key presses:

pub < autopopup appears with "public" selected, hit ENTER > int test( < CTRL+SHIFT+ENTER >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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