Editor

The Editor window lets you write and manage code with helpful features such as syntax highlighting, indentation, bookmarks, split views, and more.

In the Editor window, you can have as many scripts open as necessary.

Lines of code are numbered on the left side of the window. You can disable line numbers in Preferences > Compose > General > Editor.

Auto-Completion

The Editor automatically lists and completes words that match what you type.

The Editor automatically completes your substring text with one key stroke, which saves you time from typing long words. You can use the Tab key to accept a suggestion and fill in the complete word. If more than one word is in the list of matching words, a drop-down list shows all the matches. You can scroll or use the mouse and Tab key to select from the list.

The Editor auto-completes for both functions and system paths.

Functions

Functions are lists of keywords that are available in the interpreter, which includes language keywords like function and classdef in OML and def, class, and switch in Python. User-defined keywords and functions are also listed in the suggestions.
Figure 1. Auto-Completion in OML


Figure 2. Auto-Completion of HyperWorks APIs in Python


Paths

In addition to function completion, the Editor also supports system path completion in supported languages (OML, Python, etc). When the string to the left of a backslash is part of system paths, a drop-down list is shown. For example, 'c:/ or "c:/, depending on the supported language, brings up a list of files from the current working directory. Use the mouse and the Tab key to select the word from the suggestion.
Figure 3. Path Auto-Completion


Syntax Highlighting

Code syntax is automatically highlighted based on the language and on your settings in Preferences.

Figure 4. OML Syntax Highlighting


You can turn Highlighting on or off in Preferences > Compose > General > Editor.

You can control the color of specific syntax highlighting in the Editor page for each language in Preferences.

Smart Indentation

Certain commands, such as for and else, are automatically indented.

Figure 5. Smart Indentation of OML for/else Loop


You can define the indentation size in the Tab size field of Preferences > Compose > General > Editor for all languages, or in the Editor page for individual languages.

Collapsible Sections

Certain groups of commands, such as if...end and function...end, automatically turn into sections that you can collapse and expand.

To expand or collapse a section of code, click the plus or minus sign, respectively, next to the line numbers.

Figure 6. Collapsing and Expanding a Section of Code


Bookmarks

You can bookmark individual lines of code to easily move between them.

Figure 7. Bookmarks Context Menu with Enabled and Disabled Bookmarks


To add a bookmark to a line of code, right-click it, and then select Boomarks > Toggle Bookmark from the context menu. This action is assigned to hotkey Ctrl + K by default.

To remove the bookmark, select Toggle Bookmark again. To remove all bookmarks, select Clear All Bookmarks.

You can also quickly move between bookmarks with the Next Bookmark and Previous Bookmark options in the context menu.

You can also disable and enable bookmarks from the context menu to determine whether they are skipped over when using the Next and Previous functions.

Split View

You can split the Editor into two windows so that you can view multiple scripts at the same time.

To create a split view, there are two methods, as detailed below.

Right-click a script file name, and then from the context menu, select one of the following:

  • Move to Other Split View: The selected script moves to a second Editor window.
  • Clone to Other Split View: The selected script is duplicated in a second Editor window.
You can also use these actions when a split view has already been created. In that case, the selected script is only moved or duplicated between windows, and no new window is created.
Figure 8. Moving and Cloning Scripts to a New Split View


You can arrange split views vertically or horizontally.
  1. Hover over the area just above the Editor until the Layout icon appears in the upper-right corner.
  2. Click the Layout icon, and then select the Vertical or Horizontal icons.
Figure 9. Arranging Split Views Vertically and Horizontally


To collapse the split view into one window, click the square icon under Layout.