The MorphX Development Environment and Tools

  • 8/11/2014

X++ code editor

All X++ code is written with the X++ code editor. You open the editor by selecting a node in the AOT and pressing Enter. The editor contains two panes. The left pane shows the methods available, and the right pane shows the X++ code for the selected method, as shown in Figure 2-11.

FIGURE 2-11

FIGURE 2-11 The X++ code editor.

The X++ code editor is a basic text editor that supports color coding and IntelliSense.

Shortcut keys

Navigation and editing in the X++ code editor use standard shortcuts, as described in Table 2-3. For AX 2012, some shortcuts differ from those in earlier versions to align with commonly used integrated development environments (IDEs) such as Microsoft Visual Studio.

TABLE 2-3 X++ code editor shortcut keys.

Action

Shortcut

Description

Show the Help window

F1

Opens context-sensitive Help for the type or method currently selected in the editor.

Go to the next error message

F4

Opens the editor and positions the cursor at the next compilation error, based on the contents of the Compiler Output window.

Execute the current element

F5

Starts the current form, job, or class.

Compile

F7

Compiles the current method.

Toggle a breakpoint

F9

Sets or removes a breakpoint.

Run an editor script

Alt+R

Lists all available editor scripts and lets you select one to execute (such as Send To Mail Recipient).

Open the Label editor

Ctrl+Alt+Spacebar

Opens the Label editor and searches for the selected text.

Go to the implementation (drill down in code)

F12

Goes to the implementation of the selected method. This shortcut is highly useful for fast navigation.

Go to the next method

Ctrl+Tab

Sets the focus on the next method in the editor.

Go to the previous method

Ctrl+Shift+Tab

Sets the focus on the previous method in the editor.

Enable block selection

Alt+<mouse select>

or

Alt+Shift+arrow keys

Selects a block of code. Select the code you want by pressing the Alt key while selecting text with the mouse. Alternatively, hold down Alt and Shift while moving the cursor with the arrow keys.

Cancel the selection

Esc

Cancels the current selection.

Delete the current selection or line

Ctrl+X

Deletes the current selection or, if nothing is selected, the current line.

Start an incremental search

Ctrl+I

Starts an incremental search, which marks the first occurrence of the search text as you type it.

Pressing Ctrl+I again moves to the next occurrence, and Ctrl+Shift+I moves to the previous occurrence.

Insert an XML document header

///

Inserts an XML comment header when you type ///.

When typed in front of a class or method header, this shortcut prepopulates the XML document with template information relevant to the class or method.

Comment the selection

Ctrl+E, C

Inserts comment marking for the current selection.

Uncomment the selection

Ctrl+E, U

Removes comment marking for the current selection.

Editor scripts

The X++ code editor contains a set of editor scripts that you can invoke by clicking the Script icon on the X++ code editor toolbar or by right-clicking an empty line in the code editor, pointing to Scripts, and then clicking the script you want. Built-in editor scripts provide functionality such as the following:

  • Send to mail recipient.
  • Send to file.
  • Generate code for standard code patterns such as main, construct, and parm methods.
  • Open the AOT for the element that owns the method.

The list of editor scripts is extendable. You can create your own scripts by adding new methods to the EditorScripts class.

Related resources

There are currently no related titles.