WebStorm
 
Get WebStorm

JavaScript postfix templates

Last modified: 25 June 2024

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 (Tab by default) or when you select the abbreviation in the code completion popup.

https://resources.jetbrains.com/help/img/idea/2024.3/ws_postfix_completion.png
Gif

WebStorm is shipped with a set of predefined postfix templates and lets you define your own custom ones for JavaScript and TypeScript, refer to Creating custom templates. Note that JavaScript predefined 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.

You can also create a new template that slightly differs from an existing one, for example, in its language context or the final position of the caret. WebStorm lets you copy the original template and make the necessary changes in that copy.