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:

  1. Select Options from the Window menu.
  2. Go to the Keyword completions page.
  3. 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:

  1. Click Add.
  2. 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.
  3. 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 "<|>".
  4. Exit the Options dialog.

To insert the keyword completion:

  1. Go to a Source pane for a program element that you are editing.
  2. Type the keyword and then type Ctrl+Space.
  3. 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:

  1. Select Options from the Window menu.
  2. Go to the Macros page.
  3. 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: 

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:

  1. Click the Add button.
  2. Enter a macro name.  Hint: Start your macros with a number; this way all macros will be grouped together when you invoke Code Assist.
  3. 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 "<|>".
  4. Close the Options dialog box.

To insert the macro:

  1. Go to a Source pane for a program element that you are editing.
  2. Type the start of the macro name and then type Ctrl+Space.
  3. Select the macro and press Enter.

ngrelr.gif (548 bytes)
Code Assist