Skip to end of metadata
Go to start of metadata



Context assistant

MPS provides several mechanisms for performing an action in a context: completion, intentions, refactorings, and various other popup menus. These mechanisms have in common that they are not immediately visible to new, inexperienced users. They also usually offer many possible choices and reveal the entire available functionality, which helps advanced users but may overwhelm the beginners.

To better guide the new users through the process of creating a script in your DSL, MPS 3.4 introduces a new UI mechanism, the context assistant. A context assistant shows a dynamically constructed menu with actions that are the most appropriate for a given context. The language author specifies where the menu should be shown by putting placeholders in the editor definition. The placeholders reserve screen space for the menu in advance so that the edited content does not shift around as the menu is being shown and hidden.

Check out the Context assistant documentation for more details.


Descriptor model in Generator module

Much like @descriptor model in a language module, there's one for Generator module now as well. This is part of ongoing effort to make Generator modules first-class citizens and to support multiple generators per language. Descriptor model allows generation of Generator runtime classes independently from its language module and facilitates independent classloading. Meanwhile Generators stay as part of Language, there's still a lot to do to separate them.


'Remove Unused' button in Model properties

In Model properties dialog, Dependencies and Used Languages pages got handy button to remove unused entries at one click. The button lives next to 'Find', at the bottom of the list. 



Transformation Menu Language

The transformation menu language replaces and generalizes the language used to define context assistant menus that was released in EAP1. The new language makes it possible to describe not just the context assistant menus, but also side transformations and items for the new Context Actions tool (see below).

Context Actions Tool

The Context Actions tool (aka sidebar) known from mbeddr was incorporated into MPS. To have the tool show actions for your concepts, define the content of the menu using the transformation menu language.

Generator: reduction in node attributes

Generator used to copy node attribute as is, which is fine unless there are outgoing references or child nodes that need to get fixed during generation (e.g. a reference to a node that is transformed along with the attributed one). Now, we enabled transformation of attribute contents, so regular template processing rules apply: references to nodes in the same model get updated to point to respective nodes in output model, reduction rules are consulted to transform children of attribute node.

Cross-model generation

Next iteration of plan-backed model transformation approach. In addition to custom module facets that specify generation plan for any model inside the module, we've added a bit more fine-grained option. Now, DevKit could get a generation plan associated (still as a reference to a generation plan model), and any model that uses such devkit would get transformed according to the plan associated through DevKit. Only one DevKit with a plan is allowed per model, we did not address task to merge different plans yet.

Language jetbrains.mps.lang.generator.plan that we use to describe plans got an entry to specify required generators explicitly, in addition to specification of a language to reduce.

Security vulnerability fix

The security issue of the IntelliJ platform has been addressed in this release.



Context Assistant for MPS Language Definition DSLs

A set of context-assistant actions may help MPS beginners to speedup DSL structure & editor definition process.

Building on the new feature of Context Assistant that is available in MPS 3.4, the structure and editor languages offer hints to the user with the most-likely actions to take in the given context. These can be invoked both with mouse or through a keyboard shortcut.

Defining Completion actions in Transformation Menu and New Substitute Menu Language

New location named "completion" was added to the transformation menu language, so you can define regular transformation action for the completion menu.

New Substitute Menus language has been introduced. Substitute Menus are now defined in the editor aspect and could be referenced from the transformation menu.


Generator: attribute handling

 Generator used to copy node's attributes "as-is" during transformation of a node. With growing adoption of attributes and attributes getting more complicated it became apparent we need to treat attributes more carefully. Now, generator tries to update references of an attribute the same way it treats references of any other copied node (i.e. if a reference points to an object inside transformed model, Generator redirects it to corresponding node of an output model). Besides, child nodes of an attribute are subject to regular transformation sequence, i.e. they are checked against Reduction Rules and transformed accordingly. Note, however, use of complicated attributes (with references and children) is not endorsed. It's very easy to over- and misuse attributes, think twice before you put too much logic there.

Cross-model generation: debug information about mapping labels in checkpoint models

 To ease debug of cross-model generation scenarios, it's handy to know mapping labels actually exposed at a given checkpoint. You may have noticed a dedicated root inside each checkpoint model that lists mapping label names along with pointers to input and output nodes. Thus, next time your cross-model reference doesn't resolve, inspect corresponding checkpoint model to see if there's indeed a label for your input.

Find usage for solutions and devkits

 It was possible to find usages of a language right from the Project Pane with Alt-F7 for quite some time. Solutions and devkits, however, lack a mechanism to discover their uses. With DevKits that associate generation plans and solutions that holds these plans, we were surprised to find out one can't easily discover e.g. all models that would be generated with a given plan, and rushed to add 'Find usages' action to these modules as well.

Generating simple icons

There was always a way of specifying an icon for concept. Previously, one should have created a .png file to add an icon for a concept. Now, there's a possibility to describe simple icons with text and get them drawn at generation time (i.e. to "generate" icons). The icons should start being displayed right after generation.


It's also possible to use icons, either described with text or loaded from a png file, in any UI component, action etc. There's an "icon{}" expression in resources language for that. It converts an abstract "icon description" to javax.swing.Icon


  • No labels