# Live Templates Configuration File
Live templates configuration file contains all the information about templates provided by the plugin.
This page lists and describes all the elements and attributes used in live templates configuration files.
## Configuration Structure Overview
[//]: # (GENERATED CONTENT START)
[//]: # (This content is generated by generate_descriptor_pages.main.kts script.)
[//]: # (DO NOT EDIT IT MANUALLY)
- [``](#templateSet)
- [``](#templateSet__template)
- [``](#templateSet__template__variable)
- [``](#templateSet__template__context)
- [``](#templateSet__template__context__option)
## `templateSet`
{#templateSet}
**Reference:** [Live Templates](live_templates.md)
, [Live Templates (IntelliJ IDEA Web Help)](https://www.jetbrains.com/help/idea/settings-live-templates.html)
The live templates file root element.
{type="narrow"}
Required
: **yes**
{type="narrow"}
Attributes
:
- `group` _(optional)_
Name of the template set group, which is displayed in Settings | Editor | Live Templates list.
If the group name is not provided, then templates' XML file name is used by default.
- `replace` _(optional)_
Name of a template group that this template set replaces.
Templates from the replaced group are removed and are skipped in settings and completion.
Children
:
- [``](#templateSet__template)
### `template`
{#templateSet__template}
Describes a template.
{type="narrow"}
Required
: no
{type="narrow"}
Attributes
:
- `id` _(optional)_
Optional template identifier.
- `name` _(**required**)_
The template abbreviation typed by users in the editor to expand it.
The abbreviation must be unique in the group containing the template.
- `value` _(**required**)_
The text that the template is expanded to.
It may contain plain text and reference [variables](#templateSet__template__variable) in the format `$VARIABLE_NAME$`.
To escape a dollar sign `$` in the template text, use `$$`.
- `resource-bundle` _(optional)_
Message bundle containing the template description specified by `key`.
- `key` _(optional)_
The key of the template description provided in a message bundle defined by `resource-bundle`.
Description is used in the UI.
Overrides the value of `description`.
- `description` _(optional)_
The template description used in the UI.
It is ignored if the description is provided with `resource-bundle` and `key`.
- `shortcut` _(optional)_
Defines a character that expands the template.
Allowed values:
- `SPACE` - space key
- `TAB` - tab key
- `ENTER` - enter key
- `CUSTOM` - key defined in the By default expand with field in Settings | Editor | Live Templates
- `NONE` - disables expanding with a key
- `toReformat` _(optional)_
Defines whether the inserted code should be reformatted according to the language code style.
Default value: `false`.
- `toShortenFQNames` _(optional)_
Defines whether qualified names in the expanded code should be shortened,
for example, fully qualified names of Java classes are imported.
Shortening qualified names is performed in implementations of [`TemplateOptionalProcessor`](%gh-ic%/platform/analysis-impl/src/com/intellij/codeInsight/template/impl/TemplateOptionalProcessor.java).
Default value: `false`.
- `useStaticImport` _(optional)_
Defines whether symbols used in the expanded code should be statically imported, if possible.
Importing symbols statically is performed in implementations of [`TemplateOptionalProcessor`](%gh-ic%/platform/analysis-impl/src/com/intellij/codeInsight/template/impl/TemplateOptionalProcessor.java).
Default value: `false`.
- `deactivated` _(optional)_
Allows deactivating the template.
Deactivated templates are listed in the UI and can be activated by users.
Default value: `false`.
Children
:
- [``](#templateSet__template__context)
- [``](#templateSet__template__variable)
#### `variable`
{#templateSet__template__variable}
**Reference:** [Template Variables](https://www.jetbrains.com/help/idea/edit-template-variables-dialog.html)
Defines a variable to be used in the template `value`.
A single template can provide multiple variables.
The order of the variables determines the order in which the IDE will switch between
the corresponding input fields when the template is expanded.
{type="narrow"}
Required
: no
{type="narrow"}
Attributes
:
- `name` _(optional)_
The variable name that is referenced in the [``](#templateSet__template) element's `value` attribute.
- `expression` _(optional)_
Expression to calculate the value of the corresponding template input field automatically.
The expression may contain the following constructs:
- string constants in escaped double quotes, for example, `"value"`
- names of other variables defined in the template, for example, `ANOTHER_VAR`
- functions ([built-in](https://www.jetbrains.com/help/idea/template-variables.html#predefined_functions) or [custom](creating_live_template_functions.md)) with possible arguments
- `defaultValue` _(optional)_
The default value for the corresponding input field of the expanded template
if the expression does not give any result after calculation.
It can refer to other live template variables, for example, `ANOTHER_VAR`.
To define the default value as a literal, enclose it in escaped quotation marks, for example, `"value"`.
- `alwaysStopAt` _(optional)_
If `true`, the IDE will always stop at the corresponding input of the expanded template.
If `false`, the IDE will skip the corresponding input of the expanded template if the input value is defined.
Default value: `false`.
Examples
:
- Empty variable allowing to provide a value manually by a user:
```xml
```
- Variable inserting the content of the clipboard,
and referencing the `PLACEHOLDER` variable if the clipboard content is empty:
```xml
```
- Variable invoking completion and providing the `myValue` value if the completion doesn't provide any result:
```xml
```
#### `context`
{#templateSet__template__context}
Defines a mapping of a context type (for example, a Java method, a Markdown file) to applicability of the template
in this context type.
{type="narrow"}
Required
: no
Children
:
- [``](#templateSet__template__context__option)
Example
:
```xml
```
##### `option`
{#templateSet__template__context__option}
An entry specifying whether a given context type defined by the
`name` attribute is applicable for the template.
{type="narrow"}
Required
: no
{type="narrow"}
Attributes
:
- `name` _(**required**)_
The context type name.
To implement a custom context type, see the
[context type implementation](providing_live_templates.md#implement-templatecontexttype)
tutorial.
- `value` _(**required**)_
A boolean value determining whether the context type defined with the
[` `](#templateSet__template__context__option) element's
`name`
attribute is applicable for the template.
As context types are hierarchical, the `false` value can be used when the parent context type is applicable,
and it is required to disable the applicability of more specific child context types.
[//]: # (GENERATED CONTENT END)