MPS 2020.2 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.

EmptyLinePlaceholder png

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).

TextContentInPlaceholder png

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

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:

PlaceholderWithCodeEmbedded png

Last modified: 08 May 2020