Features

Postfix Code Completion in IntelliJ IDEA 13.1 EAP

A lot of people tend to think these days completion is a regular feature for every IDE. Well, that is not exactly the case. IntelliJ IDEA has already demonstrated that there is no such thing as a regular feature.

Take code completion, for example. IntelliJ IDEA never stops evolving in this area, and to prove it once more, today we are proud to introduce Postfix code completion, a new kind of completion which will hopefully extend your productivity even more.

Postfix code completion helps reduce backward caret jumps as you write code. It lets you transform an already typed expression to another one based on the postfix you added, the type of expression and its context. For example, the “.if” postfix applied to a boolean expression wraps it with an if statement. Likewise the “.notnull” triggers a surround template checking the expression for the null value.

post_fix_code_completion_new_3

Notice that the postfix completion suggestions are shown as part of the basic completion. In case you’d like to see the whole list of postfix completions applicable in the context, use the Ctrl + J shortcut (Cmd + J for OS X).

post_fix_code_completion_2

To see all the postfix templates and change their settings (for example, to disable the templates you don’t need), go to Settings → Editor → Postfix Templates.

postfix_code_completion_settings

Note that some of the templates have aliases (i.e. alternative postfix names). For instance, the exclamation mark will have the same effect as “.not”. Just enter “!” after an expression and press Tab to negate it. The IDE may ask you which expression you meant, if there is more than one.

postfix_code_completion_negate

 

Many thanks for the original idea and the initial implementation of this feature to our .NET colleagues.

As always, we welcome your feedback on our discussion forum and your bug reports in the issue tracker.

Develop with Pleasure!

image description