Coding Assistance
Code is the essence of what you do as a programmer. Code is also the essence of what Castalia does. Together with Castalia, you can write the best code you've ever written, and you can do it more effectively than ever before. From the most powerful template system ever created to the first IDE plugin that can correct syntax errors, Castalia is the great tool that a great developer deserves.
Code templates
Castalia's code templates are powerful macros that run right in the code editor. They help you produce common and complex programming structures with just a few keystrokes:
Castalia is better
| 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 |
Inline variable declaration
With Castalia's inline variable declaration, you can add local variables to code without having to move to a var section or otherwise break your train of thought. Simply type var I: Integer and press the spacebar. Your variable will be added to the var section of the function or procedure. If the var section doesn't exist, it will be created.
One-key comments
Castalia allows you to comment out sections of code with a single keystroke. Simply highlight your selection in the code editor, then press the "/" key, and your code will be commented out. Press the "/" key again, and your code will be uncommented.
One-key indentation
Castalia allows you to indent or unindent a block of code with a single keystroke. Simply highlight the section of code you wish to indent, then press the tab key. Your selected block will be indented. Pressing Shift+Tab will unindent the selected block.
Smart keys
Castalia modified the behavior of the parenthesis and square bracket keys. When text is selected in the editor, pressing the "(" key surrounds the selection with parenthesis. Likewise, pressing the "[" key surrounds the selection with square brackets.
Intelligent error correction
Castalia can automatically correct some syntax errors. When Castalia detects a syntax error, a button appears that, when clicked, will trigger syntax correction. If Castalia can correct the error, the correction will be applied.
Selection expansion
Pressing Ctrl+W will select the identifier under the cursor. Pressing it repeatedly will continue to expand the selection by logical groups, selecting the current expression, statement, block, etc... until the whole method has been selected.
Consider this example:

Pressing Ctrl+W repeatedly selects:
- Left
- FirstInd.Left
- FirstInd.Left+FDragOfs-GutterWid
- The entire Trunc() call
- The entire Editor.Paragraph.FirstIndent assignment
- All of the code in the method
- The entire method
Automatic case correction
As you write code, Castalia will change identifiers as you type them so that they match the case of the identifier's declaration.
For example, if you type showmessage, Castalia will automatically change the identifier to ShowMessage to match the original declaration of the ShowMessage procedure.
Automatic line wrap
If you type a line of code that extends beyond the editor's right margin (80 characters by default), Castalia will intelligently wrap the to the next line, looking for the ideal place between identifiers or parameters to wrap the line.
Strings and comments are handled automatically so that wrapping to the next line doesn't introduce a syntax error.