MPS 2018.3: generation plans, improvements in the assembly and packaging language and in the editor's language, updated interface
Hi, Habr! We recently released MPS 2018.3 . In this version, many new features that work on projects will be even more efficient. We improved the generation plans and editor description language, added new constructs to the assembly and packaging language, updated the interface elements to easily navigate the inheritance hierarchy and made many other changes for productive work.
Icons for navigating over defined / implemented concepts
On the margins of the concepts and interface concepts, there are icons of redefined / implemented concepts that simplify navigation to child concepts.
Customizable packages for BaseLanguage classes
In previous versions of MPS, the Java package of the generated classes was uniquely determined by the name of the model in which the original elements were located. In the new version for BaseLanguage Classifiers, the packageName property has been added, allowing to override the name of the final Java package. The packageName property only makes sense for top-level BL classifiers, as is the case with Java classifiers.
New generator capabilities for BaseLanguage extensions
For the BaseLanguage language, extensions are often created. However, for some extensions, it is not easy to write a suitable generator. We have added several new concepts to BaseLanguage to simplify the process of writing generators for extensions.
Generating Lvalue Expressions
A lvalue expression is a variable into which you can read or write a value. In some cases, generating an lvalue expression is difficult, since it may depend on the context in which it is used. The new auxiliary concept
generic lvalue-expressionwill simplify the generator and make it context-independent.
Convert lvalue expressions to links
Some expressions include other Lvalue expressions for more complex operations with variables (for example, plus assignment or increment and get expressions). It was difficult to introduce constructions with such semantics, because it is not easy for them to write the correct generator.
In the new version, you can wrap any Lvalue expression with an expression
@byRef. The BaseLanguage generator converts a wrapped expression to a type expression
Reference<T>, which provides get and set methods for the wrapped variable.
Read more about new concepts in this article .
Support for default methods
In the new version of MPS, you can create default methods in the BaseLanguage interfaces. The default keyword is implemented by the DefaultModifier concept — an extension of the Modifier concept. DefaultModifier is contained in the language jetbrains.mps.baseLanguage.jdk8, therefore, to create a default-method in the interface, import the jdk8 language.
Generator language (model transformation language)
We removed the $ INCLUDE $ macro, replacing its use with $ CALL $. Appropriate migration will help update your projects. The $ INCLUDE $ macro does not support patterns with arguments, and the presence of two macros with similar functionality complicates the language.
Macro $ WEAVE $ and weaving-rules have now learned to call patterns with arguments. In addition, we fixed an unpleasant, though not very noticeable, defect that occurs when using compiled and interpreted templates at the same time. The “implementation” (weave) of an external template from the interpreted code used to always lead to interpretation, but now the compiled template will work (of course, provided that the use of compiled templates is included in the generator properties). Similarly, the “weave” of the interpreted external template from the compiled one works.
QueriesGenerated, a set of compiled model queries for a model with templates, has always relied on the naming convention and the Java reflection mechanism to execute code. You could see it in the spectra when in the model query from the generator something went wrong. We finally got rid of this mechanism.
UI / UX Elements
MacBook Touchbar Support
Owners of MacBooks with a touchbar can now use it to work in MPS: for example, trigger startup actions, build and debug applications from the touchbar, and also quickly select a run / debug configuration or create a new one. Touchbar controls can be configured on the Settings / Preferences | Appearance & Behavior | Menus and Toolbars.
And of course, the possibilities of the touchbar can be expanded! Just add the desired action to the appropriate
High contrast theme
As in the IntelliJ Platform, a new high contrast theme appeared in the MPS. It can be enabled in Settings / Preferences -> Appearance & Behavior.
Search tools for deprecated code
In the menu Migration | Deprecated Code collected actions to search for deprecated code and work with its uses. Find Usages of Deprecated groups the search results by the intended version of the deletion, which helps determine the criticality and choose which uses should be removed first.
Icons for navigating redefined / implemented behavior methods
In the fields of the behavior classes, we added icons to navigate through the overridden / implemented behavior methods. Below is a list of getPresentation () methods that override or implement the selected method. From the list you can easily go to any of the specified methods.
Pop-up improvements for navigating redefined items
The pop-up windows of redefined / implemented concepts / classes / methods have become asynchronous. This means that the MPS will add search results to a pop-up window in the background. In addition, you can now filter the search results by object name.
Changes in finders
In this version we updated and optimized finders. To execute the finder asynchronously, use the special OnEachNodeFoundByExpression expression, which is a simple finder call with a callback function for each node found.
Find Usage Settings for concepts has also changed. We added the search options Concept Ancestors and Derived Concepts, which give a list of parent and child concepts, respectively. In addition, search capabilities for behavior methods have been extended with the Overridden Methods and Overriding Methods options.
MPS can ignore errors on nodes. This is useful in cases where the error is displayed in the editor, but in a specific context does not make sense (for example, in generator templates). Previously, the ability to suppress such errors was inflexible. If the node was annotated with the 'SuppressErrorAnnotation' attribute, then the 'Suppress error for node ...' intensity was called on it. The use of this intensity suppressed all kinds of errors on this node and all its descendants - thus the actual errors could be ignored.
Now it is possible to ignore only certain types of errors. The selected error will be ignored for this node and all its descendants, but all other messages will be displayed. Read more about the new error management features in the documentation .
Assembly language and packaging
Tips & Tricks
In the RCP (Rich Client Platform) applications, tips and tricks from MPS were added by default. Now it is possible to override the tips & tricks for your application with the help of the new design tips & tricks in the build script. As before, you can use tips from the MPS distribution or define them yourself in a catalog or solution module and import them.
Tips & Tricks Description Language
To import tips & tricks to a build script from a solution module, create a solution and import the languages jetbrains.mps.build.tips and jetbrains.mps.core.xml. Then create an instance of the concept MPSTipsAndTricks and describe your tips in it. Each tip is an HTML text and can contain no more than one image.
We marked custom packaging in BuildMps_IdeaPlugin as deprecated. Instead, use the packaging method in the BuildMpsLayout_Plugin construct.
The Auto packaging build method places all the modules of the type language and solution into the 'languages' folder of the plug-in's root directory, and the Manual packaging option allows the developer to set the structure of the plug-in independently.
New design language assembly and packaging
We have expanded the capabilities of the test configuration in the language of assembly and packaging. Now it is possible to specify additional IntelliJ IDEA plugins that must be loaded to perform MPS tests from Ant.
In some cases, a test requires a specific plugin that the build language could not calculate using the modules containing the tests. Now you can specify the plugin required to perform the test in the test configuration structure.
Reuse cell action maps
The elements of the action map from the existing action map can be reused with imports.
Fully compiled datatypes
Moving in the direction of fully compiled languages, we created fully generated datatypes. All generated information about datatypes is available through the SModel API.
Saving migration data in annotations
We have implemented a new way to save data during migrations, which we recommend to use in the future. The derived node that contains the data should now be attached to any node that is close enough to the place to which the data belongs.
In a migration script that creates nodes with data, you need to declare the concept of such nodes and use the putData () construct to insert each such annotation into the model:
Extraction of nodes containing data is performed in the same way as before:
Changes in the conflict resolution dialog
Previously, when a conflict could apply changes only on one side. But sometimes it is important not to lose other changes.
This applies to changes in neighboring nodes that are in the same multiple role. Now, after applying the changes on one side of the conflict, the changes from the other branch will be displayed as an addition. To complete the resolution of the conflict, this addition must be applied or rejected.
After applying the changes on the left side of the conflict, you can apply or ignore the line on the right side:
Download the new version here , we hope it will make you happy. In any case, we will be waiting for your feedback ! A full list of fixes is available on this page . Please report any problems to us in the tracker .
Your Team JetBrains MPS
The Drive to Develop