IntelliJ IDEA 2018.2 Help

Postfix Completion

File | Settings | Editor | General | Postfix Completion for Windows and Linux
IntelliJ IDEA | Preferences | Editor | General | Postfix Completion for macOS
Ctrl+Alt+S icons general settings svg


Postfix code completion lets you add template code around an expression you’ve just typed. A template expands when you type its abbreviation (postfix) after a dot and press the expansion key or when you select the abbreviation in the code completion popup. For example, the .if postfix applied to an expression wraps it with an if statement. IntelliJ IDEA is shipped with a set of predefined postfix templates and lets you define your own custom ones for JavaScript and TypeScript. Note that JavaScript templates work in TypeScript files as well.

Custom templates can be copied, updated, and removed. For predefined templates you can only change their postfixes, for example to replace a long key with a shorter one, or to expand the list of expression types where a template can be applied.

On this page, enable and disable postfix templates, create new ones, and choose keyboard keys to expand them.

Item

Description

Enable postfix completion

  • Select this checkbox to have IntelliJ IDEA transform expressions with postfixes into other expressions by expanding postfix-specific templates. When the checkbox is selected, choose the postfixes to apply transformations to by selecting the checkboxes next to the desired postfixes in the list below.

  • When this checkbox is cleared, no template expansion is applied.

Expand template with

From this drop-down box, choose the keyboard key that will invoke template expansion. The available options are: Tab, Enter, or the Spacebar.

Table of available postfix templates

The table below shows the list of available postfix templates. To enable or disable a template, select or clear the checkbox next to it. When you select a template, the right-hand pane shows its description and illustrates how it works by displaying the expression before and after the selected template is applied.

Custom templates can be copied, updated, and removed. For predefined templates you can only change their postfixes, for example to replace a long key with a shorter one, or to expand the list of expression types where a template can be applied.

  • To add a custom template, click Add button and create a new template in the dialog that opens.

  • To remove a template, select it in the list and click . Note that you can remove only user-defined templates, for predefined ones the icon is not available.

  • To edit a template, select it and click Edit button.

  • To copy a template, select it in the list and click Duplicate button.

Last modified: 20 November 2018