Creating a new template based on selected code
You can create new templates based on selected code to enable you to use custom code snippets.
About this task
Note: Custom code snippets (and the shortcuts that invoke
them) are used in conjunction with content assist to type frequently
used code constructs quickly. For example, a predefined code snippet
is provided for the if-else statement in the list of available templates.
The shortcut that invokes this code snippet is ifelse.
In the Remote C/C++ Editor, you can type ifelse,
and then press Ctrl + Space bar to insert the
entire code block for an if else statement into the source file.
To
create a new template based on selected code, complete the following
steps:Procedure
- In the file that is currently open in the Remote C/C++ editor, select the code on which you want to base a new template.
- Right-click the selected code to open the pop-up menu.
- Select Add as new template to open
the New Template dialog box. The Template section in this dialog box displays the selected code on which you want to base a new template.
- In the Name field, type a name for the new template that you want to create. For example, if you want to create a template for if else statements, type ifelse.
- In the Description field, type a description of the type of code snippet that you want to create a template for. For example, if else statement.
- Click OK to add the new template to the list of available templates in the Templates preference page.