Programming With Castalia : IDE Changes : Editor Changes : Code Templates
Previous  Top  Next

Castalia allows the use of powerful code templates. These template similar to those provided by Delphi, with the following enhancements:

·Templates can fire on a single editor keystroke, rather than a key combination  
·Templates can contain multiple logical entry points, using the Bookmark Stack  
·Templates can contain code formatting instructions  
·Templates are context-aware, only firing in the code context that you specify  

Castalia templates are activated by typing the template name in the editor and pressing the template key. By default, this template key is the spacebar.

For example, to activate the ifb template, you would type i-f-b<spacebar>, and the following code would be inserted in the code editor:

template

The cursor is placed at the first logical entry point, and subsequent entry points are pushed onto the Bookmark Stack. You can then type your if condition, followed by pushing the <esc> key. The cursor will move to the newly created block (where the subscripted '1' is located) and you can write the result of your if statement.

Templates are stored in a file called Templates.ini in your Castalia install directory. It is not recommended that you modify this file manually, though you may wish to back it up from time to time if you use any custom templates.

See also Configuring Code Templates, Bookmark Stack, Modifying Existing Code Templates, Creating Custom Code Templates, Inline Variable Declaration