Book a Demo
Prev Next

Function Details

Code Editor Functions



See also

Syntax Highlighting

The Code Editor highlights - in colored text - the standard code syntax of all language file formats supported by Enterprise Architect

Syntax highlighting in code editor in Sparx Systems Enterprise Architect.

You can define how the Code Editor implements syntax highlighting for each language, through the 'Code Editors' page of the 'Preferences' dialog.

Languages Supported Options - Code Editors Editor Language Properties Language Options


Bookmarks denote a line of interest in the document; you can toggle them on and off for a particular line by pressing Ctrl+F2.

Additionally, you can press F2 and Shift+F2 to navigate to the next or previous bookmark in the document.

To clear all bookmarks in the code file, press Ctrl+Shift+F2.

Cursor History

The Code Editor Control keeps a history of the previous 50 cursor positions; an entry in the history list is created when:

  • The cursor is moved more than 10 lines from its previous position
  • The cursor is moved in a find/replace operation

You can navigate to an earlier point in the cursor history by pressing Ctrl+-, and to a later point by pressing Ctrl+Shift+-.

Brace Matching

When you place the cursor over a brace or bracket, the Code Editor highlights its corresponding partner; you can then navigate to the matching brace by pressing Ctrl+E.

Highlighted match pair of braces in the code editor in Sparx Systems Enterprise Architect.

Automatic Indentation

For each supported language, the Code Editor adjusts the indentation of a new line according to the presence of control statements or scope block tokens in the lines leading up to the cursor position.

Indenting code in the code editor in Sparx Systems Enterprise Architect.

The levels of indent are indicated by pale horizontal lines.

You can also manually indent selected lines and blocks of code by pressing the Tab key; to un-indent the selected code, press Shift+Tab.

Commenting Selections

For languages that support comments, the Code Editor can comment entire selections of code.

The Code Editor recognizes two types of commenting:

  • Line Commenting - entire lines are commented from the start (for example:
         // This is a comment)
  • Stream Commenting - sections of a line are commented from a specified start point to a specified end point (for example:
         /* This is a comment */)

You can toggle comments on the current line or selection by pressing:

  • Ctrl+Shift+C for line comments, or
  • Ctrl+Shift+X for stream comments

Scope Guides

If the cursor is placed over an indentation marker, the Code Editor performs a 'look back' to find the line that started the scope at that indentation level; if the line is found and is currently on screen, it is highlighted in light blue.

Guide to scope when it doesn't extend off-screen

Alternatively if the line is off screen, a calltip is displayed advising of the line number and contents:

Guide to scope when it extends off-screen


You can zoom into and out of the contents of the Code Editor using:

  • Ctrl+keypad + and
  • Ctrl+keypad -

Zoom can be restored to 100% using Ctrl+keypad /.

Line Selection

If you want to move the cursor to a specific line of code, press Ctrl+G and, in response to the prompt, type in the line number.

Press the OK button; the editor displays the specified line of code with the cursor at the left.