Code Templates Options

Applies to TestComplete 15.68, last modified on October 16, 2024

The Code Templates dialog defines macros for the Code Editor.

To open the dialog

  • Click Call the Panel Options Dialog on the Code Editor toolbar and then click Code Templates.

– or –

  • Right-click somewhere in the Code Editor, select Panel Options from the context menu, and then select Panels > Code Editor > Code Templates on the left of the Options dialog.

– or –

  • Select Tools > Options from the TestComplete main menu and then select Panels > Code Editor > Code Templates on the left of the Options dialog.

About code templates

The idea behind Code Templates is simple. You type a shortcut word, then press Ctrl+J, and the shortcut is replaced by an entire pre-formatted template, which may span several lines. If you press Ctrl+J after a word that is not in the shortcut list, the entire list will be displayed, with the descriptions, in a list box from which you may select any template (if the list is empty, nothing will happen). Code Templates are found in most development-tool editors in which a large list is pre-defined, for instance, in Microsoft Visual Studio or Borland Delphi. Like all Editor Options, Code Template settings apply to all projects sharing the current project’s scripting language, and not to those using another language.

This dialog is fairly self-explanatory. The box at the top specifies the scripting language, whose templates the dialog displays. The box below it holds a list of pre-defined shortcuts and their explanatory descriptions. Shortcuts may be single letters, and descriptions are optional.

The box in the middle of the dialog reproduces a code editor section. There you may enter and format the contents of the template selected in the top list. In other words, a complete template definition is a shortcut and description, both displayed in the list on top, and the template contents, displayed only in this box. If you select an existing template and change any of these three elements, the changes will be saved when you exit the dialog using the OK button.

To add a new code template to the template list, click Add and specify the shortcut, description and the template code (for more information on the templates syntax, see Code Templates). To remove the selected code template from the template list, click Delete. To delete all existing code templates, click Clear.

Finally, the Save to File button saves the auto-replace list for a currently selected language to an XML file having the .ct extension. The Load From File button, in its turn, restores the entire auto-replace list from a .ct file. Code templates settings can also be exported and imported via the Export Settings and Import Settings dialogs.

See Also

Code Editor Options
Code Templates

Highlight search results