IntelliJ | Default values in live templates

The Kotlin language is still in the process of growing. There are some things missing regarding the IDE integration. Some well-known features from developing Java are not available like the supported creation of fields and variables. To work around these missing features I added some live templates to IntelliJ to provide basic support for some default action and boilerplate code generating tasks. Starting with the live templates I stumbled over the problem that I could not set default values for my variables by using the "Default value" field.

Live template variables

It took me a minute to realize that the default value field is not really for default values. Variables are defined by expressions, and can accept some default values. To set a predefined string for a variable you have to set it as expression. More precisely the expression may contain constructs of the following basic types:

- String constants in double quotes.
- The name of another variable defined in a live template.
- Predefined functions with possible arguments.

I hope I could help you out here and wish you some luck :)

{{ message }}

{{ 'Comments are closed.' | trans }}