MPS 2021.1 Help

Generic placeholders and generic comments

Generic placeholders

A generic placeholder represents the whitespace between two nodes and can be added to any node collection. The  Ctrl+Shift+Enter  key combination inserts the placeholder at the current position within a collection. The placeholder behaves in a transparent way - you may still invoke the completion menu on the placeholder node to replace it nodes or press Enter to add the usual node in the next sibling position.

Using the generic placeholder users of any language can insert arbitrary visual separators (empty lines) into code, even if the language does not support such a concept.

Empty line placeholder

Generic comments

The generic placeholder may itself contain content. MPS provides the text content for the placeholder in the  jetbrains.mps.lang.text  language or the  general-purpose  devkit. This will give you fully editable multiline text language with support for basic styling (bold, italic and underlined), clickable hyper-links and embedded nodes (code).

Text content in placeholder

After including the  jetbrains.mps.lang.text language or the  general-purpose devkit press "[" (open square bracket) on the placeholder. You will get a node that allows you to enter and edit text. The text is multiline and consists of words.

The Text language

The jetbrains.mps.lang.text language has been enhanced with several rich-text editing capabilities. These capabilities are also available in single and multi-line comments in BaseLanguage.
Use the Shift key with arrow keys to select text. Although the selection can only select whole words, it can span multiple lines. Clipboard operations, move/select by word as well as select all work as expected.
When a piece of MPS code is pasted into text, it is encapsulated and preserved in its tree form. Text from plain text editors can also be copied and pasted to and from jetbrains.mps.lang.text text.
Any word or a collection of selected words can be made  bold  (press Control + B ),  italic (press Control + I) and  underlined (press Control + U ). To add a link press Alt+Enter and invoke the Add Link intention on a word.

A line can be turned into a bullet point or a numbered point with an intention. Also, typing "-" or "*" at the beginning of two subsequent lines will create a bullet point. Numbering two subsequent lines as in "1. " will turn the lines into numbered points. The Tab key at the front of a bullet or numbered point will increase indentation of that point, Shift + Tab will decrease the indentation.

Num bul

To insert an arbitrary node into the text, invoke code completion inside the text node and select "node ". The node placeholder will appear, so you may input any sample node. The embedded code can use nodes from any imported language:

Placeholder with code embedded

Text selection is able to select only parts of lines when selecting up and down. Actions such as Make bold/italics/underline work on selection. Copy/paste from and into plain text has been implemented. Bullet and numbered lists are now supported.

Last modified: 14 April 2021