Postfix Code Completion in IntelliJ IDEA 13.1 EAP

Posted on by

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.

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).

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.

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.

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!