Using Live Templates

Live Templates lets you use the editor to insert frequently used code blocks into your source code.

Live Templates can be simple, parameterized, and surrounded. A simple template contains code blocks that will be expanded and inserted into the editor, replacing the abbreviation. Parameterized templates, on the other hand, have variables that will be filled automatically by IntelliJ IDEA or will prompt the user for input.

When a parameterized template is invoked and expanded in the editor, IntelliJ IDEA will suggest some predefined values for the defined variables. The surrounding templates expand before and after the selected code block. To insert a live template into the editor, just type the abbreviation and press the expand ...

Get IntelliJ IDEA Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.