Identifying problems in your code

This topic describes the indicators used to identify problems in your code.

Sample exercise

To get familiar with the problem indicators, try the following simple exercise:

  1. Add a syntax error

    To add a syntax error, open a source that contains a case statement and remove a letter from the endcase statement.

    This figure shows an example:

  2. Save changed code and view problem indicators

    On the Workbench toolbar, click Save to save the changed code. Do not close the editor. The source is compiled automatically and the problem is indicated in various ways.

    Note: Automatic compilation only works if the Build Automatically option in the Project menu is turned on.

    The problem is indicated in, for example, these ways:

    • In the Activity Explorer view, problem decorators appear on the affected component and its parent elements.
    • An error marker appears in the marker bar, to the left of the line that contains the syntax error.
    • Another error marker appears in the vertical ruler. This marker represents the syntax error and is shown relative to the error's position in the document. The marker does not move as you scroll the document. Click the marker to navigate quickly to the corresponding location in the source code.
    • The problem is displayed in the Problems view.
  3. View problem description via hovering

    To view the description of the problem, hover with the mouse over the error markers in the marker bar and vertical ruler.

    This figure shows an example:

    For more information on hovering, see Text Hovering.

  4. Close the editor

    Click the Close button on the editor's tab to close the editor.

  5. Use Go To command

    In the Problems view, complete one of the following steps:

    • Right-click a problem and, on the shortcut menu, select Go To.
    • Double-click a problem.

    The editor starts and opens the affected source at the location of the problem.

  6. Correct the problem

    To solve the problem, in the editor, add the missing letter in the endcase statement.

    On the Workbench toolbar, click Save to save the changed code. The source is compiled automatically and the problem indicators disappear.

    Note: Automatic compilation only works if the Build Automatically option in the Project menu is turned on.