What’s New in MPS 2022.3

MPS 2022.3 comes with improvements to constraint rules, sync migration with MPS extensions, Kotlin stubs for the JVM, and more.

The constraint rules update
Client sponsored

The Constraint Rules language was created to address Constraint language deficiencies. For this release, the Constraint Rules have taken a step forward in improving the usability of the language.

  • The constraint rules definitions can now be referred to from NodeTestCases. Previously, this was not possible.
  • The experimental constraint rules definitions allow logging messages to be specified in the Inspector window for better tracing and debugging.
  • The error message for constraint rules can be targeted for specific nodes’ properties or references. Instead of the error highlighting the whole node, it can be configured to highlight only a property or a reference.

Improved Module Class Loading

MPS modules serve different purposes, ranging from a sandbox to play with your language to an active plugin code to alter MPS or IntelliJ IDEA platform behavior. In MPS 2022.3, we’ve brought all these under a single umbrella. The Java Facet page for the Solution module was reworked to house all relevant settings and identify common scenarios to help language designers and users easily recognize a module’s intended use. IDEA Plugin Module Facet has been deprecated and will no longer be used. We’ve exposed the settings for Solution modules only – both Language and Generator modules take the same approach, but have their settings configured implicitly. Learn more.

Migration sync with MPS extensions

MPS has always had an active community that brings value to the ecosystem and we have always encouraged users to use external libraries to enrich the product's functionality. Third-party libraries, such as MPS Extensions, have been key to improving the user experience for products built with MPS. Even though this has brought many benefits to the community, there is a significant downside – the user needs to wait for the migration of the third-party library to update the MPS version. We’ve been working together with itemis, our official partner and main MPS extension maintainer, to synchronize our releases for smoother migration to the newest version of the product.

Additional utility methods in the language definition

Language designers can now reduce the amount of repetitive code by extracting it into helper methods right inside the definition root node. These additional methods can be defined in:

  • Constraints
  • Transformation and substitute actions
  • Inference and checking rules
  • Quick-fixes
  • Intentions

Intentions also allow for additional fields to preserve the values calculated in the isApplicable method to be used in the execute method.

Kotlin stubs for JVM

Kotlin stubs for JVM

It ‘s now possible to import stubs from compiled Kotlin/JVM libraries, while it was previously only possible to import Kotlin/Common libraries. With this improvement, it’s possible to use libraries compiled to JVM (Java, Kotlin, or mixed) through the Kotlin JVM model root in your module options. Learn more.

Kotlin edition improvements

Several minor changes and improvements have been bundled with this new version of MPS:

  • Kotlin classes are now rootable nodes and have their own icons.
  • Kotlin code can now refer to Java enum entries.
  • The this expression can now correctly refer to a label (e.g. this@SomeClass).
  • withKotlin flags in build scripts now ask for a $kotlinc_home macro instead of a previously hardcoded location.
  • Stubs have been improved:
    • Excluding / Including packages in the stub options now functions as it would with Java stubs.
    • Several methods with unstable IDs, leading to broken references, have been fixed.
Transformation to create a constructor from a type

Transformation to create a constructor from a type

It’s now possible to create a constructor call for a given call using a right transformation by typing left parenthesis. This can work for any Kotlin type that supports this operation (this is extensible for user types) and can facilitate creating a default expression for a given type, like when creating a lambda from a functional interface type.

Improvements to extension functions in Scopes

Improvements to extension functions in Scopes

Extension functions in scopes have been changed to not exclude compatible methods in scopes. This comes at the cost of having some items in scopes that are not applicable due to the performance of the current type of system implementation.

The automatic resolution of function references can fix references in case a non-applicable function is selected.

New intention to reset the classpath and VM options

New intention to reset the classpath and VM options

A new intention updates the MPSStartupScript node and sets VM options and classpath values to the current MPS values. MPS VM options and classpath values change with every new release. Previously, the user had to manually update build projects for a standalone IDE.

Migration Guide

For every major release, we prepare instructions for migrating from older versions of MPS to ensure everything goes smoothly. Please review them carefully.