Using Postfix Templates
On this page:
Postfix code completion lets you transform an already typed expression to another one based on the postfix you type after a dot, the type of the expression, and its context. This transformation is performed by expanding the postfix-specific predefined template.
For example, the
.if postfix applied to an expression wraps it with an
See more at: Postfix Code Completion.
Activating and de-activating postfix templates
When the postfix template functionality is enabled, IntelliJ IDEA transforms expressions with postfixes into other expressions by expanding the corresponding postfix-specific templates.
To activate the postfix templates functionality, follow these steps:
Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing for Windows and Linux or
for OS X.
Expand the Editor node, and then
click Postfix under General.
The Postfix Completion page that opens shows a list of postfixes for which IntelliJ IDEA can transform expressions according to postfix-specific templates. Transformation templates are shown next to corresponding postfixes. When you select a postfix, the Description pane illustrates the corresponding transformation showing the code snippet before and after the template is expanded.
- Select the Enable postfix templates check box and choose the key to launch template expansion from the Expand template with drop-down list.
- Select the check boxes next to the postfixes for which you want IntelliJ IDEA to expand the corresponding templates.
To suppress expanding a template, clear the check box next to the corresponding postfix.
To block the postfix templates functionality, clear the Enable postfix templates check box.
Using postfix templates
To apply a postfix template, follow these steps:
- Type your code followed by a dot, until a suggestion list appears, or press Ctrl+J.
- Choose the desired postfix template from the suggestion list. If necessary, choose an expression to be surrounded or replaced.
- Press the expansion key, defined in the Postfix Completion page of the editor settings.