MPS 2021.1 has been released!
The first release of the year is here! For the past few months, we have been enhancing different subsystems of the product to improve the user experience. Read more about the new functionality above, or if you are a more visual person, watch our screencast.
Editor
Zoom in and zoom out
The font size can be quickly adjusted in an open editor window by holding Ctrl and rolling the mouse wheel. Font size changes are not persistent, so when you reopen the file, the text size will be reset to the default value. You can enable/disable this feature in Preferences | Editor | General section: Change font size with Ctrl/Cmd+Mouse Wheel.
Improved performance on indent layout
The implementation of the indent layout has been made incremental in some core cases, which will reduce the rendering time for big models in languages that mainly use the indent layout (such as BaseLanguage). This feature can be disabled with the VM option mps.indent_layout.disable_incremental.
Font weight options
Choosing an editor font that you can look at without difficulty for long stretches of time is crucial. The recently added typography settings make this choice a bit easier and more personalized. In v2021.1, you can fine-tune the weight of your main and bold font styles in Preferences | Editor | Fonts.
Version Control System
Root annotation improvements
Version Control System support improves root annotation. A new algorithm for calculating revision changes with movement tracking is now used for root annotation. The colors for annotated lines/cells are determined using only those revisions where the root was changed. The annotated cells now have a special context menu group when the annotation column is open. You can apply Copy Revision Number, Show Diff, and other actions to each annotated cell.
Diff dialog for merge commits
The Diff dialog is enabled for merged commits in the Git log. The viewer displays three panels – the center panel for the merged model, and the left and right panels for the models of the two merged branches.
Synchronize scrolling in the Diff editor
It is now possible to switch off the editor scrolling synchronization in the Diff dialog with a button.
Revisions graph used for root annotation and root/node history
The root annotation and root/node history algorithms were previously based on the ordered list of file revisions, calculating the changes for the root between two adjacent revisions. It was possible, however, for these revisions to be from two different branches, in which case the obtained changes made no sense. Merge revisions also were not handled correctly. The changes from older revision rounds could be erroneously displayed as changes from newer merge revisions. Now the algorithm considers the revisions graph when it formulates the change history.
Save to Shelf
Our new Save to Shelf action allows you to copy your changes to the Shelf while keeping them in the local changes. You can access this action by pressing ⇧⌘A on macOS (Ctrl+Shift+A on Windows or Linux) and typing Save to Shelf.
Generator
Improved access to $LOOP$ macro variables
It is now possible to refer to the input node of a LOOP macro by using a LOOP.inputNode expression, removing the need to use a VAR macro. The index of the LOOP can also be accessed under the same namespace by using LOOP.index and replacing the previous user-defined context variable.
Updated Transform statement in GenPlan declaration
To improve Generation Plan extensibility, there’s a new mechanism for including languages or generators that are unknown to the plan designer. Now, with the transform statement, the language designer may include a language that targets or extends a given one. When we say Language B ‘targets’ Language A, we mean that Language B’s generator produces constructs of Language A.
Compiled templates enhancement
Generator Preferences in the IDE contains an option called Warn when child cannot be placed into role, which checks whether the nodes template that is produced fits into the proper role of a parent node. The option is available through build project settings as well. The generator may issue a warning, which usually indicates that there’s some inconsistency in the templates, such as an improperly placed Template Fragment or COPY-SRC annotation.
Compiled templates, however, didn’t perform this check. With MPS 2021.1, compiled templates now go the extra mile and check whether children are properly placed into parent nodes if the option is active.
Miscellaneous
Java Compiler for MPS modules with Java facet
A lot has changed in our approach to Java compilation of MPS modules. This addresses one of our top-voted issues, Annotation Processing support. We switched the MPS Java Compiler infrastructure to utilize the javax.tools.JavaCompiler set of APIs, so MPS can now use any compiler that implements this standard API. As of version 2021.1, MPS runs with the default compiler configured for this API, with the option to use the Eclipse Compiler for Java (ECJ), if present. When ECJ libraries are in the classpath, you may switch MPS to use ECJ with mps.compiler.java=ecj as the system property (e.g. by editing mps.vmpoptions). Note that if you experience unrecoverable issues using the new compiler infrastructure, there’s also an option to switch back to the legacy mechanism of direct ECJ API by changing the configuration for mps.compiler.java=ecjlegacy as the system property.
Furthermore, we now run the compiler with the -release option, with the version specified in project preferences (Preferences -> Java Compiler). This option is stricter than the combination of -source/-target options on which MPS relied in previous releases, as it controls uses of library APIs that were available in certain releases. You may need to update the Java version in your project if you encounter compilation issues due to using APIs unavailable in certain releases.
Baseline MPS version for project migrations
When a new project is created, a ‘baseline’ MPS version will now be saved. Project migrations from MPS versions earlier than the project’s baseline version won’t apply. This gives authors the flexibility to give project migrations a specified desired ‘baseline’ version, which they can modify in the Project migration interface by using the new ‘getBaselineVersion():int’ method.
When there is no version for the project, the default version will be 2018.1 and the migration will run according to that. For any project, you can still apply any project migration by running it manually from the Migrations menu.
Method signature refactoring improvements
The Method Signature refactoring dialog now includes a way to specify default values for new arguments or arguments whose types have changed. When a parameter is removed but is still used in the method, a new local variable is introduced so the reference is not lost. In addition, vararg type parameters are now handled.
When the call of a method does not match its signature, an intention action allows you to change the method signature according to the call. This intention action has been improved. It now maps the existing parameters more intelligently, so the maximum number of existing parameters are reused and their references are kept.
New options in BaseLanguage comments
The lang.text language has been given several new capabilities, which directly enhances single and multi-line comments in BaseLanguage.
- Text selection now allows you to highlight only parts of lines when selecting up and down.
- Actions such as bold, italicize, and underline work on the selection.
- Copy/paste from and into plain text has been implemented.
- Bulleted and numbered lists are now supported.
Improved expressions in lang.smodel
The expressions model.roots(), model.rootsIncludingImported() and model.nodesIncludingImported() now support #expression for specifying concepts, just as model.nodes() does.
Control visibility of modules distributed with your plugin
For a long time, MPS assumed all modules coming from language plugins were visible to the end user. With the number of languages growing, as well as the complexity of plugins, there are cases when language designers want to hide certain modules so as not to confuse or overwhelm the end user with a huge number of unrelated languages or solutions. Plugins tell MPS about modules they contribute by means of com.intellij.mps.LanguageLibrary extension point. Now, extensions to the point may provide an optional hide=”true” attribute, that makes modules of the plugin eligible to filtering by a pattern specified with com.intellij.mps.VisibleModuleMask. Most MPS plugins now bear the flag, facilitating the filtering of MPS’s own languages if the Language Designer needs to hide them. MPS provides masks for its own modules as part of jetbrains.mps.ide.devkit plugin, authors of a custom IDE generally don’t include this plugin into a distribution, and have full control over visible modules in their product.
Other Improvements
Built-in HTML preview
The new built-in browser preview allows you to preview HTML files quickly. To open it, click on the icon with the MPS logo in the widget in the top-right corner of the editor. If you make any changes in HTML or if you change the linked CSS and JavaScript files, the preview will update on the fly.
Apple Silicon Support
You can now use MPS on Macs that have an M1 chip. To get started, download the installer for JetBrains MPS for Apple Silicon directly from our website or get it from the Toolbox App.
Auto-import settings
With MPS 2021.1, the Import Settings dialog that appears every time you install a new version of MPS will only be shown when you don’t have the appropriate settings and configurations.
Improved accessibility
In this release, we’ve added more labels to UI elements on the Welcome screen, in the Project Structure view, and in the VCS log. These elements, as well as gutter icons, are now read out correctly when a screen reader is enabled. We are also working on improving accessibility support for macOS users.
Minor changes
- There is now a visual indication that the intention of the Call-Site macro is executed. (MPS-32928)
- Changes to the new model dialog. (MPS-30787)
We have also fixed a bunch of bugs. Your feedback is important for us, so please let us know what you think about the new functionality in the comment section below. Remember that in our issues tracker you can create feature requests and upvote the current ones, this helps us to define the new functionality for the upcoming releases.
Have a great day!
Your JetBrains MPS team
The Drive to Develop