Preferences - Templates

Use this dialog window to create, edit, and remove templates.

These settings only apply to the LN Studio Script Editor.

To insert a template in the script editor, use the Code Assist feature.

Overview window

Use the check boxes to enable and disable templates. If a check box is selected, you can use Code Assist to insert the corresponding template in your source code.

Use these buttons to manipulate and configure templates:

Button Description
New Opens a dialog box to create a new template.
Edit Opens a dialog box to edit the currently selected template.
Remove Removes all selected templates.
Restore Removed Restores any predefined templates that have been removed.
Revert to Default Restores any predefined templates to their default configuration.

This action does not modify user-created templates.

Import Imports templates from an XML file in the file system.
Export Exports all selected templates to an XML file in the file system.

Edit Template dialog window

Name
The name of the template.
Context
This is a standard Eclipse option that is not used by LN Studio.
Automatically insert
If this check box is selected, code assist automatically inserts the template at the cursor position, if the template is the only completion proposal for the string you entered in the Script Editor.
Description
The description of the template.
Pattern
The pattern of the template. This is the text inserted in the editor when you select the template.

In the template pattern, you can use predefined template variables. Variables are resolved to their concrete value when the template is evaluated in its context. You can specify variables using simple or full syntax. If there are multiple possible matches for a variable, they are presented as proposals to the user.

To add a variable to the template pattern, click Insert Variable and select the desired variable from the list.

You can select general and LN-specific template variables.

This table shows the general template variables:
Variable Description
${cursor} Specifies the cursor position when you leave the template edit mode. This is useful if the cursor must jump to another place than to the end of the template, on leaving template edit mode.
${date} The current date.
${dollar} The dollar symbol '$'. Alternatively, you can use two dollar signs: '$$'.
${line_selection} The content of all currently selected lines.
${time} The current time.
${user} The user name.
${word_selection} The content of the current text selection.
${year} The current year.
This table shows the LN-specific template variables:
Variable Description
${name} The name of the function which is used above this variable
${input_arg} The arguments of the function which is used above this variable.
${returnType} The return type of the function which is used above this variable.
${output_arg} Place holder