Castalia's code templates increase your speed and accuracy by helping you to produce common and complex programming structures with just a few keystrokes.
Errors are often introduced into code by malformed control structures. By consistently utilizing code structures that are known to be correct, the chances of introducing these errors is greatly reduced.
Castalia's code templates are fully scriptable, using a Delphi-like scripting language. Templates can do math, manipulate strings, and even ask the user for additional input or use the clipboard. Templates are also context-aware, so templates can be configured to only apply in certain files or certain parts of your code. Castalia code templates even know which class or method they're being triggered in, and can use that information.
Castalia's code templates do not replace Delphi's built-in templates, but are a separate mechanism. Below is a comparison of Delphi's templates to Castalia's:
| Delphi Templates | Castalia Templates | |
| Scripting | No scripting - just text entry | Fully scriptable: use Delphi code in your templates |
| Code formatting | No code formatting | Each template can be customized to match your programming style |
| Template Activation | Requires you to press (and remember) a hotkey (Ctrl+J by default) | Automatically activate on ANY key you designate (spacebar by default). You can choose a hotkey if you wish |
| Clipboard integration | No clipboard Integration | Use the clipboard contents in your templates |
| Context awareness | No context awareness | Templates know their context. Names of files, methods, and classes are all accessible to the template script. |
| Context sensitivity | No context sensitivity | Each template can be very flexibly customized to trigger only in certain contexts |
Code templates are available in the Delphi, C#, and C++ languages.
Code Analysis