Defining Code Assist macros
Two Code Assist features help you write code quickly and without errors: keyword
completions and macros.
Defining keyword completions
To view the provided keyword completions:
- Select Options from the Window menu.
- Go to the Keyword completions page.
- Select a keyword completion from the Name list. Its definition is displayed in the
Completion field.
The string in the Name list is what appears in the drop-down list when you invoke code
assist in a Source pane (Ctrl+Space). The Completion is what is inserted in the
source code when you select the name. The text "<|>" indicates where
the cursor will be placed.
To edit a keyword completion, select its name and edit the Completion text.
To create your own keyword completion:
- Click Add.
- Enter a keyword completion name. It must start with a keyword, and you should make
distinguishable from other keyword completions, so that when you see it in a list, you can
differentiate between it and other completions for the same keyword.
- In the Completion field, enter the actual text that you want inserted into code whenever
you select this keyword completion. If you want to specify where the cursor will be
left when you insert the keyword completion, use the text "<|>".
- Exit the Options dialog.
To insert the keyword completion:
- Go to a Source pane for a program element that you are editing.
- Type the keyword and then type Ctrl+Space.
- Select the keyword completion and press Enter.
Defining macros
Macros provide a way to quickly and easily insert any predefined text into source
code. To view the provided macros:
- Select Options from the Window menu.
- Go to the Macros page.
- Select a macro from the Name list. Its definition is displayed in the Expansion
field.
Similar to keyword completions, the string in the Name list is what appears in the
drop-down list when you invoke Code Assist in a Source pane (Ctrl+Space). The
Expansion is what is inserted in the source code when you select the name. The text
"<|>" indicates where the cursor will be placed.
Two special macros are defined:
- timestamp inserts the current date and time.
user
inserts the current workspace owner name.
These can be used in other macros by putting <timestamp> or <user>
in the Expansion text of those macros.
To edit a macro, select its name and edit the Expansion text.
To create your own macro:
- Click the Add button.
- Enter a macro name. Hint: Start your macros with a
number; this way all macros will be grouped together when you invoke Code Assist.
- In the Expansion field, enter the actual text that you want inserted into code whenever
you select this macro. If you want to specify where the cursor will be left when you
insert the macro, use the text "<|>".
- Close the Options dialog box.
To insert the macro:
- Go to a Source pane for a program element that you are editing.
- Type the start of the macro name and then type Ctrl+Space.
- Select the macro and press Enter.

Code Assist
