Using The Code Editor
The code editor is used is several templates to allow direct entry of commands, functions and keywords into a document. Depending on the template, a code editor may be used to enter specific functions or an entire document.
Documents
Documents are saved with standard extensions that must be used when referencing the document name in code.
Example: Run a model named Main
Run MODEL "Main.lvmod" ON daMain
These are the standard extensions.
Document | Extension |
---|---|
Calculated Journal Entry Spec |
.lvcje |
Data Area Definition |
.lvdsp |
Data View |
.lvdvw |
Export Spec |
.lvexp |
Form |
.lvfrm |
HTML Document |
.html |
Import Spec |
.lvimp |
Model |
.lvmod |
Model Subroutine |
.lvsub |
Procedure |
.lvpro |
Symbol Map |
.lvmap |
Table Definition |
.lvdtd |
Table View |
.lvtvw |
UI |
.lvui |
Keyboard shortcuts
The code editor supports several keyboard shortcuts.
Movement and selection
The following keyboard shortcuts can be used to navigate through the code editor and select text:
Shortcut | Action |
---|---|
Left, Right, Up, Down, Home, End, Page Up, Page Down |
Moves caret |
Shift+(Left, Right, Up, Down, Home, End, PageUp, Page Down) |
Moves caret with selection |
Ctrl+A |
Selects all text |
Ctrl+Home |
Go to first character of the text |
Ctrl+End |
Go to last character of the text |
Shift+Ctrl+Home |
Go to first character of the text with selection |
Shift+Ctrl+End |
Go to last character of the text with selection |
Ctrl+Left |
Go to next word to the left |
Ctrl+Right |
Go to next word to the right |
Shift+Ctrl+Left |
Go to next word to the left with selection |
Shift+Ctrl+Right |
Go to next word to the right with selection |
Ctrl+- |
Go back to previous caret location in the editor |
Shift+Ctrl+- |
go forward to next caret location in the editor |
Searching
Shortcut | Action |
---|---|
Ctrl+F |
Shows Find dialog |
Ctrl+H |
Shows Replace dialog |
F3 |
Find next |
Ctrl+G |
Shows GoTo dialog |
Alt+F [character] |
Finds nearest [character] |
Editing
Shortcut | Action |
---|---|
Ctrl+C |
Copy selected text to clipboard |
Ctrl+V |
Paste text from clipboard |
Ctrl+X |
Copy selected text to clipboard and delete |
Ctrl+Z |
Undo operation |
Ctrl+R |
Redo operation |
Tab / Shift+Tab |
Increase/decrease left indent of selected range |
Ctrl+U/Shift+Ctrl+U |
Converts selected text to upper / lower case |
Ctrl+Shift+C |
Inserts/removes comment prefix in selected lines |
Insert |
Switches between Insert Mode and Overwrite Mode |
Ctrl+Backspace / Ctrl+Del |
Remove word left / right |
Alt+Up / Alt+Down |
Moves selected lines up / down |
Shift+Del |
Removes current line |
Note: To quickly select a line, click on the line number. Select multiple contiguous lines by clicking on a line number and dragging the mouse while holding down the mouse button.
Boomarks and Macros
Note: Bookmarks and macros only persist in the current document editor while it is active.
Shortcut | Action |
---|---|
Ctrl+B |
Add a bookmark |
Ctrl+Shift+B |
Remove a bookmark |
Ctrl+N |
navigate to next bookmark |
Ctrl+Shift+N |
Navigate to previous bookmark |
Ctrl+M |
Start / stop macro recording |
Ctrl+E |
Execute macro |
Others
Shortcut | Action |
---|---|
Esc |
Closes all opened tool tips, menus, and hints |
Ctrl+Mouse Wheel |
Zooming |
Ctrl+Up |
Scroll up |
Ctrl+Down |
Scroll down |
Ctrl+NumPadPlus |
Zoom in |
Ctrl+NumPadMinus |
Zoom out |
Ctrl+0 |
Reset zoom level to default |
Using quick selectors
The code editor provides selectors to make inserting names into your code quicker and easier.
Note: You can select text in the editor before invoking the symbol selector to have the selected symbol replace the highlighted text.
To access the symbol selector:
- In any code editor, right-click within the code editor area. A pop up menu will appear.
- Highlight Symbol and select the dimension in which the symbol you require is located.
- Once the dimension is selected, a symbol selector will appear where you can select your required symbol.
- Click OK. The symbol name will be entered into the code editor at the spot your cursor is located.
Note: If a numeric symbol name was selected (i.e: 1050), a ! will be prefixed to the symbol name in a model document only. This is required for any numeric symbol in a model where a spec is not defined. If a spec is defined for a numeric symbol (i.e: 1050###), the ! would need to be removed from the syntax. ! are not prefixed to numeric symbols in any other document type (i.e: procedures).
To access the dimension selector:
- In any code editor, right-click within the code editor area. A pop up menu will appear.
- Highlight Dimension and select the dimension.
- The dimension name will be entered into the code editor at the spot your cursor is located.
Using syntax templates
The code editor provides syntax templates in the form of functions, keywords, function templates and in some cases sample documents. Start to type a function and pause typing to be presented with a selection list:
For example, if you type ‘cre’ and pause typing the selection list will present:
- valid functions that start with ‘cre’ are presented first
- any keywords that start with ‘cre’ are presented next
- templates for functions starting with ‘cre’ are presented last
Select an item from the list and press the Tab key or double-click the item to insert it into the editor, or continue typing to narrow the choices.
Understanding syntax conventions
The following conventions are used in the code editor:
- functions are highlighted with bold blue text and are presented in upper camel case.
- keywords are highlighted with bold black text and are presented in uppercase
- identified names (for example dimension names and attribute names) are highlighted with an underline
- in a function template parameters to be manually entered are in default text color and presented in lower camel case
- in a function template parameters that have defined possible values are in default text color and presented in lower camel case followed by an underscore (‘_’)
- dimensionName is a parameter that can be replaced using the dimension selector. See Using quick selectors.
- symbolName is a parameter that can be rpelaced using the symbol selector. See Using quick selectors.
- #symbolSpec indicates a hierarchical symbol specification. You can invoke a list of symbol specifications by placing the caret within ‘symbolSpec’ and pressing Ctrl+SPACE.
Example: Create SYMBOL command template:
Create SYMBOL dimensionName symbolName "description" symbolType_ childSortOrder_ balanceType_
- Create is the function
- SYMBOL is a keyword
- dimensionName, symbolName and description are parameters to be entered manually
- symbolType_, childSortType_ and balanceType_ are parameters with defined values
In either case you can replace the parameter by selecting it and typing the desired value. In the case of parameters with defined possible values you can also do one of the following to open a list of possible values:
- place the caret in the word and press Ctrl+SPACE
- place the caret at the end of the word and press CTRL+SPACE
Using document templates
For some document types you can insert a complete document template using the code editor.
Template documents are supported for the following code editor types:
- Calculated journal entry specifications
- Data views
- Export specifications
- Forms
- Import specifications
- Symbol maps
- Table definitions
- Table views
- UI definitions
To insert a template for one of these types do the following:
- start typing the word ‘template’ into the code editor
- If templates are available a list of them will be displayed. In some cases, there is only a single template, while in other cases multiple templates are available.