Using Code Insight

From RAD Studio
Jump to: navigation, search

Go Up to How To Edit Code in the Code Editor


Code Insight (sometimes referred to as Code Completion) is a set of features in the Code Editor and the HTML Tag Editor that provide code completion, display code parameter lists, and show tool tips for expressions and symbols.

The hint window list box filters out all interface method declarations that are referred to by property read or write clauses. The list box displays only properties and stand-alone methods declared in the interface type.

To enable Code Insight (general task)

  1. Choose Tools > Options > Editor Options > Code Insight.
  2. Review and set the Code Insight options and color preferences as needed. Tasks that follow this one in this help topic give more details about some of the Code Insight settings.
  3. Click OK.

To enable and use Code completion

  1. Choose Tools > Options > Editor Options > Code Insight.
  2. Check Code Completion.
  3. To display a list of types, properties, methods, and events in the Code Editor, type either a dot (.) (for Delphi or C++) or an arrow (->) (for C++) following the name of an object or class name. To display the properties, methods, and events available in a class, type the name of a variable and then press Ctrl+Space.
  4. Select the displayed element that you want to complete the class or object, and press ENTER. To cancel the code completion, either Backspace or press Esc.

Code Insight Examples

  • If you are using the C++ language, type the name of a variable that represents a pointer to a class instance followed by Ctrl + Space to display the properties, methods, and events available in the class. To invoke code completion for a pointer type, the pointer must first be de-referenced. For example, type this for C++ or self for Delphi.
  • If you are using the C++ language, type an arrow (->) for a pointer to an object. You can also type the name of non-pointer types followed by a period (.) to see its list of inherited and virtual properties, methods, and events.
    For example, for Delphi, type: var test: TRect; :: begin test.
    For C++, type TRect test; test.
  • Type an assignment operator or the beginning of an assignment statement and press Ctrl+Space to display a list of possible values for the variable.
  • Type a procedure, function, or method call and press Ctrl+Space to display the method and its list of arguments.
  • Type a record to display a list of fields. (This is the same as Step 1, but uses records instead of classes.)

To enable and use Code parameters

  1. Choose Tools > Options > Editor Options > Code Insight.
  2. Check the Code parameters check box.
  3. To use Code completion to display the method arguments in the Code Editor, type a method name and an open parenthesis "(".

To enable and use ToolTip expression evaluation

  1. Choose Tools > Options > Editor Options > Code Insight.
  2. Check the ToolTip expression evaluation check box.
  3. To display the current value of a variable while your program has paused during debugging, point the mouse cursor to any variable name displayed on the Code Editor.

To enable and use ToolTip Symbol Insight

  1. Choose Tools > Options > Editor Options > Code Insight.
  2. Check the ToolTip symbol insight check box.
  3. While editing your code in the Code Editor, point the mouse cursor to any identifier to display its declaration.

See Also