Code Templates are reusable code snippets that allow you to quickly insert commonly used code fragments or surround given code fragment with a meaningful code block (example: try-catch statement). For more information how to import or export templates visit Code Templates
In general there are four groups of templates -
To list all available templates you press Alt+End. To apply a template just select it from the pop-up menu.
When inserting a template Telerik® JustCode™ helps you in number of ways:
- Create a new file and expand template inside it (in case of file templates).
- Declare the type of variables for you, depending on the template, what type of variable can the selected template work with and what available variables for this type you have access to. For example, if you choose a foreach template it only works with array or an object collection. In this case Telerik® JustCode™ will let you choose between all array/object collection values within your class.
Depending on the template, Telerik® JustCode™ suggests items for the current context.
- Acronyms help you expand your template only by entering a specified abbreviation for it.
To use a template with acronym enter the abbreviation and press Shift+Space (by default). The template will be generated for you.
You can change the shortcut combination from JustCode Options window.
Provide a help pop-up that lets you Change Variable choice, Commit Variable choice, Finish or Abort the operation.
Change Variable Choice iterates through all available variables within your class that are valid for the current variable.
- By pressing Enter JustCode automatically moves to the next undeclared variable in the template.
Iteration templates are those which insert iteration statements like for, foreach, while, etc.
Predefined Iteration Templates
Surround templates are those which insert a surrounding statements like if, try-catch, etc.
Predefined Surround Templates
File templates are those which insert a code snippets into a newly created file.
Predefined File Templates
Other templates are those which doesn't fall in the other three categories like insert if, insert Console.WriteLine, etc.
Predefined Other Templates
- Insert if
- Insert Console.WriteLine