Simple templates are expanded into predefined text independently of the context in which they are used. After the template code is inserted into your source code, you resume typing at the position specified by template developer. However, the most powerful feature of live templates is their ability to adapt to the surrounding context.
When invoked and expanded, parameterized templates suggest reasonable choices at the input positions of template variables. For example, a well-designed parameterized template for an iteration over all elements of a container will suggest:
- A suitable name for the loop index variable (for example,
iorj). - A list of all variables of the specified type in the current scope (for example, Arrays or Lists) as an expression for the iterated container.
- A suitable name for the assigned variable that will hold the current container element during the iteration.
- The type of elements in the iterated container.
When a template that requires user input is expanded, the code editor temporarily switches into the template editing mode that lets you specify values for template variables (see also
To learn more about parameterized templates, see
