Introduction to Editor¶
Rosetta Core features a sophisticated text editor application that allows the user to edit the model files in their current workspace. We recommend that users get familiar with workspace management basics prior to reading this Editor section.
This introduction presents the basic tools available to the user in the Editor application, to assist with the editing work by navigating through model components.
The Editor contains a list of model files that have been copied across from the CDM source-control repository and into the user workspace. Each file is accessible by clicking its name in the left-side Model Explorer panel in the application. The current file opened in the right-side Editor window is highlighted in the Model Explorer:
The Model Explorer allows the user to keep track of changes made to the model in their workspace, by annotating which files have been modified with the initial
M. Those changes can be discarded and reverted back to the original source-control version by clicking the
Discard back arrow:
All the editing tools available in Rosetta Core are accessible in the Editor Toolbar shown at the top-right of the Editor window and summarised in the below table:
Commands: list of Editor tools
|Go to model element|
|Go to Symbol|
|Undo and Redo|
|Go back and forward|
|Zoom in and out|
As Rosetta Core is a web application delivered in a browser window, users should remember to always use the
-> commands provided in the Editor Toolbar to navigate within the application, and not their browser’s
-> commands (which effect would be to close their workspace instead).
Most of these tools and commands are meant to be familiar to users of traditional dev kits, albeit much slimmed-down in order to resemble a basic text editor which non-developers can also get comfortable using.
An important difference with a traditional text editor is that model elements are hyper-linked in the application. This implies that each model element can be navigated to and fro:
- either by searching for the element directly, via the
Go to Symbolcommand in the Editor Toolbar, here used to search for the
- or by pressing
Cmd+ Click on the element name wherever it appears in the Editor. Simply hovering over the element brings its description to the foreground (illustrated here with
This is akin to having a text editor associated to a dictionary, where any occurence of a word from that dictionary provides a handle to navigate to the definition of that word.
The Rosetta Core Editor application features a number of content-assist tools to guide users through editing the model:
- Syntax highlighting
- Syntax checking
- Auto completion
We recommend that users get familiar with the Rosetta DSL documentation for how the model is expressed, prior to reading this section.
Rosetta Core highlights different syntax features to improve readability of the model being edited, as shown in the colour-coding schemes displayed in the below example and further down in the documentation:
The model elements being highlighted in different colours are:
- DSL syntax keywords like
- text (as string elements between
Syntax Checking (Validation)¶
The syntax checking feature works similarly to spell checking in a text editor, with the model providing the underlying dictionary. However, syntax checking is strictly enforced against the formal Rosetta DSL: the model is invalid if there is any syntax error.
In the below example, we introduce a syntax error by mis-spelling the term
Party. The resulting term gets underlined in red as
Paty is not a valid term in the dictionary:
Often, editing the model in one place may trigger syntax errors in some other place. To aid users identify those, files containing errors are shown in red in the Model Explorer and a red cursor in the right-side scroll-bar points to the line(s) where errors appear:
Auto Completion (Scoping)¶
To prevent syntax errors occuring in the first place, Rosetta Core can guide editing of the model by offering auto-completion suggestions in a drop-down list as the user types. Auto-completion is aware of the surrounding scope in which the model is being edited and offers suggestions that are relevant to that scope.
In the below example, the user is editing a function (
Execute) and is looking to complete the arguments to invoke another function within (
NewExecutionPrimitive). As they start to type, the Editor is aware that the user is able to use
quantity as an argument, because it exists as an input to the
Execute function being edited:
Auto-completion is typically very performant and allows for fast typing when using a DSL compared to a typical auto-correction in a text editor. This is because the syntax and the dictionary are tightly constrained by the DSL and the model, respectively, which narrows-down auto-completion possibilities.
The auto-completion tool-tip can also be invoked manually by pressing