All Topics
Templates
You can define templates to quickly create files of various types, reducing the need to write boilerplate code. Templates are defined per language configuration, and can be edited under Preferences ‣ Languages ‣ Templates
.
Template Options
- Name: The name of the template. Create multi-file templates by giving them the same name and varying the extension. For example, if a template for a class requires a header file and an implementation file, create two entries, naming them both "Class", specifying "h" for the extension of the header file, and "cpp" as the extension for the implementation file.
- Default: You can set a single template as the default template. The default template is used when creating new files in this language.
- Extension: The file extension to use when creating the template file.
- Name on Creation: Specifies that CodeRunner will ask for a name and a location when creating file(s) from a template. This option cannot be combined with Default.
- Template: The template contents. The template may contain placeholders as defined below. Indentation is automatically adjusted to match the user's preferences. The special string
<##>
may appear in the template to represent the text insertion point.
Template Placeholders
The placeholders below may be used in file templates. Note that all placeholders are surrounded by three underscores.
___FILENAME___
The full filename of the source file. Example: MyFile.java
___FILEBASENAME___
The filename of the source file, excluding the file extension. Example: MyFile
___FILEEXTENSION___
The file extension of the source file. Example: java
___FILEIDENTIFIER___
The file basename with non-word characters removed.
___DATE___
The current date.
___USERNAME___
The logon name of the current user.
___FULLUSERNAME___
The full name of the current user.