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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.