Editor

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.

Model Explorer

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:

../_images/2020-07-16-12-09-51.png

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:

../_images/2020-07-16-12-09-51i.png

Editor Toolbar

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:

Icon Function
../_images/icon-command.png

Commands: list of Editor tools

../_images/2020-07-16-16-19-02.png
../_images/icon-model.png Go to model element
../_images/icon-gotosymbol.png Go to Symbol
../_images/icon-undoredo.png Undo and Redo
../_images/icon-backforward.png Go back and forward
../_images/icon-zoom.png Zoom in and out

Note

As Rosetta Core is a web application delivered in a browser window, users should remember to always use the <- and -> commands provided in the Editor Toolbar to navigate within the application, and not their browser’s <- and -> 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 Symbol command in the Editor Toolbar, here used to search for the contract element
../_images/2020-07-16-16-11-24.png
  • or by pressing Ctrl / 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 TradeDate):
../_images/2020-07-16-15-48-28.png

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.

Content Assist

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.

Syntax Highlighting

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:

../_images/2020-07-16-16-22-49.png

The model elements being highlighted in different colours are:

  • DSL syntax keywords like func, alias etc.
  • text (as string elements between "")
  • numbers

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:

../_images/2020-07-16-16-29-41.png

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:

../_images/2020-07-16-12-18-18.png

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:

../_images/2019-10-10-15-33-14-AutoComplete-i.png

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 Ctrl + Space.