What’s New in MPS 3.3

Download

Custom language aspects

The set of language definition aspects is no longer limited by the MPS platform. Check out more details in the Custom aspects documentation.

Language aspect definition

The set of language definition languages available in MPS can be extended through a custom language aspect model declared inside the plugin model of a language.

Language aspect usage

Language developers will then have an option to create an additional language aspect model in their languages, which holds aspect-specific information about their concepts expressed using the aspect's main language.

Using DSLs with custom aspects defined

DSL users will see in the IDE the additional functionality provided by language aspects developers. Custom language aspects can be used, for example, to generate documentation tied closely to the code, or to provide additional DSL verification or interpretation capabilities.

Attribute support during code generation

Generator

The generator preserves node attributes during the transformation process. The attributes attached to a node will be propagated to the output model during its reduction and attached to the output node. The drop attributes generation rules can be used to remove attributes at the right phase of generation, if needed.

TextGen

An attribute on a node now changes the control flow in TextGen. A TextGen aspect of an attribute takes precedence over the TextGen aspect of the attributed node. It can then delegate to the attributed node through the new 'attributed node' append part.

Attribute support in type-system

Overriding the types

The type-system has become more versatile with Substitute Type Rules. They allow arbitrary nodes to substitute for calculated types.

Substitutions for attributes

The type of a node can be modified by Substitute Type Rules specified for its attributes.

Overriding inference rules from attributes

The type-system now allows attributes attached to nodes to influence type evaluation. The inference rules specified for attributes have greater priority than the rules specified for the annotated nodes themselves.

User experience

Generic comment-out functionality

All MPS languages got the implicit support for commenting out pieces of code. Any nodes in the model can be commented out with a single key stroke and without any explicit commenting support implemented in the language itself. Obviously, language designers can customize the behavior and visual appearance of commented-out nodes easily..

Compare Two Nodes

Any two nodes from the Project View tool window can be visually compared in a diff view. You will see the nodes side-by-side with graphically emphasized differences and the possibility the edit them.

Paste from History

You can now use the Paste from History action in the projectional editor (Edit -> Paste from History, or Ctrl/Cmd+Shift+V).

Reflective editor

Reflective editor is a new capability of MPS to show the exact structure of the nodes under caret and to let you edit it directly. Simply right click on any node and choose "Show Reflective Editor" from the pop-up menu. You'll get a generic editable visualization of the current node and so bypass the standard editor when it is getting in the way.

Generator and TextGen

Layout control for output files in TextGen

Textgen Layouts now allow language designers to define one or more areas of the output file and then leverage them in the append operation during the text generation process.

Anchors in weavings rules

In order to weave a node at an exact location in the children list, weaving rules now offer an additional anchor query, which may provide the desired anchor node, in front of which the weaved node gets inserted.

Generation plan

The newly added support for generation plans allow developers to specify the desired order of generation for their models explicitly and thus gain better control over the generation process.

Updated cross-model generation

Regular mapping labels now support mutually independent generation of models with cross-references, if the models share a generation plan. The mechanism leverages checkpoints to capture the intermediate transient models and then use them for reference resolution.

Editor improvements

The new Next Applicable Editor cell

An additional way to compose editors applicable to different editor hints has been introduced — a more specific editor may reuse a less specific editor of the same concept through the new next applicable editor editor cell. The next applicable editor cell is used as a place holder, which will re-apply the logic for finding the less specific editor and insert the found editor in its place.

Collapse by default

It is possible to specify the default state for foldable collections of editor cells. The collapse by default property value can be true/false/or a custom query. The language designer thus has one more option to tailor the visual experience to her users' needs.

Other improvements

Generating images of MPS nodes

To help authors document their languages, image files containing relevant MPS nodes can be created as part of the model build process, provided jetbrains.mps.lang.editor.imageGen is set as a generation target.

Lightweight DSLs

The newly added jetbrains.mps.baselanguage.lightweightdsl language provides the possibility to define internal DSL extensions generated down to BaseLanguage. Internal DSLs are easier and faster to develop than full-blown external DSLs and they more tightly integrate with the surrounding non-DSL code.

No Used Languages in modules

Modules now derive used languages from their models. It is no longer possible to add/remove languages in the 'Used Languages' tab in module properties. The search button reveals the models that declare the selected dependencies.

BaseLanguage compile-time expression value assistance

BaseLanguage now performs static code analysis of constant expressions, offers intentions to simplify them and generates warnings for unnecessarily complex boolean expressions that evaluate to either true or false.

Using "console" commands in migrations and other code

The Console query expressions, such as #instances or #models, are now conveniently available anywhere in code to simplify smodel expressions. This is in particular handy for node queries when writing language migrations.