The MPS Blog : Language workbench to create Domain-Specific Languages | The JetBrains Blog https://blog.jetbrains.com Developer Tools for Professionals and Teams Thu, 04 May 2023 13:30:16 +0000 en-US hourly 1 https://blog.jetbrains.com/wp-content/uploads/2023/02/cropped-icon-512-32x32.png The MPS Blog : Language workbench to create Domain-Specific Languages | The JetBrains Blog https://blog.jetbrains.com 32 32 MPS 2022.3 Is Finally Here! https://blog.jetbrains.com/mps/2023/05/mps-2022-3-is-finally-here/ Tue, 02 May 2023 12:00:12 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/05/Release_Preview_image_1280x600_MPS-2x.png https://blog.jetbrains.com/?post_type=mps&p=347335 This version was supposed to be released last year, but we had to delay the release date because of some technical issues. MPS is built on top of the IntelliJ IDEA platform, so every release cycle, we have to migrate to the new version of the platform. Sometimes the migration is straightforward, other times not so much. We’re working to make this migration smoother to avoid delays in the future. We apologize for any inconvenience that this delay might have caused you.

DOWNLOAD MPS 2022.3

Let’s take a look at the new functionality that we prepared for this release or watch our screencast to get better acquainted with the main features.

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. To address this range of tasks, MPS relied on a few scattered and confusing flags and settings, like SolutionKind, IDEA Plugin Module Facet, Compile In MPS, and many more (see MPS-20726).

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.

This is how the Java Facet page from Solution Properties looks now, with a collapsed section at the top, where the “Compile In MPS” flag used to be:

The section expands to reveal different settings to control compilation, class loading, and extension for a module:

“Compilation” determines whether MPS will compile generated sources or if there’s another mechanism that compiles classes and MPS shouldn’t compile anything. Still, MPS assumes there are classes for the module in the case when “External Compiler” is selected. If your module is not expected to deliver classes for MPS use, like for a sandbox or a solution that the generated sources are part of another project, use “None”:

The “Class loader” setting determines whether MPS is responsible for creating a class loader or if classes are loaded by code that contributes a module. One of the most common module contributors is IDEA Plugin. In this case, the “Module Contributor” setting tells MPS to use the IDEA Plugin class loader to access module classes:

The last setting, “Contributes extensions to MPS”, determines whether MPS will try to load its plugins and extensions from the module. This is most common for pluginSolution and is implicit for Languages:

Unless your module provides extensions, keeping the setting on “No” avoids unnecessary overhead from extension look-up. Classes are still available for any code that depends on a solution. Language runtime solutions or a solution with stub models are examples of modules that comes with classes but don’t provide MPS extensions:

There’s also a migration that updates project module descriptors to reflect these settings in an explicit form for all module types, including Languages and Generators. We’ll keep old values (solutionKind and compileInMps attributes) in XML for a transition period until the next MPS release.

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

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.

For example, the Kotlin UI DSL has been loaded as stubs into jetbrains.mps.kotlin.ui.dsl module. While this library was already available as Java classes, this module allows you to reference it using Kotlin.

For a pure Java library, it doesn’t make any difference whether you use Java Classes or Kotlin JVM. The new functionality applies only to using Kotlin in the loaded library.

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

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

Extension functions were not always handled correctly in scopes, leading to some situations where it was not possible to select the right function.

These 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.

Together with this new functionality, we’ve fixed a long list of bugs. Try the new version and give us feedback on our issue tracker. As for every release, don’t forget to review our Migration Guidelines before updating to the latest version.

Your JetBrains MPS team

]]>
MPS Community Meetup 2023 is happening! https://blog.jetbrains.com/mps/2023/02/mps-community-meetup-2023-is-happening/ Thu, 09 Feb 2023 16:24:25 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/02/MPS_community_event_Munich_2023_Email_2_650x325.png https://blog.jetbrains.com/?post_type=mps&p=322857 The MPS Community Meetup is back! Join us for the MPS Community Meetup 2023 in Munich on May 11 and 12. Like previous years, the event will be a series of talks from the community and the MPS team sharing the product’s status.

Register today!

The call for speakers is open! We are accepting talks about MPS-related topics and use cases. Submit your talk here.

Your JetBrains MPS team

]]>
JDK update in MPS 2022.2 https://blog.jetbrains.com/mps/2022/12/jdk-update-in-mps-2022-2/ Thu, 01 Dec 2022 10:55:17 +0000 https://blog.jetbrains.com/wp-content/uploads/2022/11/Release_Preview_image_1280x600_MPS-2x.png https://blog.jetbrains.com/?post_type=mps&p=302569 MPS 2022.2 came with a major change in the Java Development Kit version. It now supports JDK 17, while the previous versions supported and ran on JDK 11. This change may or may not impact your projects, so we decided to cover the areas that could be affected.

The platform update

The JDK change originated in the underlying IntelliJ platform that MPS builds on. The IntelliJ IDEA team listed the benefits of this change in one of their recent blog posts.

In short, JetBrains Runtime 17 (JBR 17) brings significant IDE performance improvements, better security, enhanced rendering performance on macOS thanks to the Metal API, and more.

The project bytecode version

Projects in MPS can define their “Project bytecode version”:

Unless a specific version is selected in your project, the “JDK Default” value now is JDK 17 instead of JDK 11. The project JDK will be changed as soon as you open the project in MPS 2022.2. This change is not likely to affect your project, however.

IDEA plugins with MPS

When building plugins for MPS or IntelliJ IDEA, make sure the Project bytecode version is set to version 17 or earlier, as IDEA will not run plugins compiled with newer versions of the JDK.

Using MPS plugins in IDEA

IntelliJ IDEA projects that use MPS plugins must have the Project JDK in IntelliJ IDEA set to version 11 or newer.

Standalone IDE applications

Standalone applications based on MPS have to be run on JDK 17. You might be able to run them on JDK 11, but this option is not supported.

MPS compilation

MPS itself is compiled using JDK 11. This may be an important piece of information for projects that embed pieces of MPS code. In these cases it is important to know that certain MPS runtime solutions do not need to be re-compiled.

Solve issues with Java reflection

There may be some problems with the visibility of different classes that your code accesses using Java reflection API. You can solve the issues in the same way we did for the JDK classes when running MPS – use the –add-opens JVM argument to add the respective packages. Check out the user guide for more details:

If you encounter any problems, please report them to our issue tracker.

The JetBrains MPS team

]]>
MPS 2022.2 is now available! https://blog.jetbrains.com/mps/2022/11/mps-2022-2-is-now-available/ Tue, 01 Nov 2022 11:17:19 +0000 https://blog.jetbrains.com/wp-content/uploads/2022/11/Release_Preview_image_1280x600_MPS-2x.png https://blog.jetbrains.com/?post_type=mps&p=279765 For this release, we focused on improving support for the functionality introduced in previous releases. Read about all the new features we’ve prepared for you. You can also watch our screencasts (part 1 and part 2) to get better acquainted with the main features.

DOWNLOAD MPS 2022.2


Annotations in Inspector

Annotations are now accessible from the Inspector window, and the annotation process will start for the entire root. This action can be accessed by right-clicking on the left border of the Inspector window. The Annotation will open in both the Inspector editor and the main editor. Watch a demo.

Improved support in MPS Kotlin

A lot of editing issues have been fixed to provide a better typing experience, such as:

  • Lambda literals:
    • Support for the implicit “it” parameter.
    • Lambdas whose type has a receiver (e.g. “Receiver.() -> Unit”) will properly use that receiver type as an implicit “this” inside the body of the lambda.
  • Scopes have been refactored to support more use cases (e.g. custom receiver types) and improve filtering (fewer duplications, access to hidden functions).
  • Support for deconstructing operators by typesystem.
  • Number literals: easier insertion of floats and long, and transition between unsigned and signed numbers.
  • String literals: All strings can be switched from single to multiline by pressing Enter in a string literal; some insertion issues have been fixed.
  • Kotlin stubs support loading of annotations and function types with receiver (e.g. “T.() -> R” which was incorrectly loaded as “(T) -> R”).

Because of some structural changes, several migrations are provided with the language:

  • Statement support has been made generic in the IStatementHolder interface; other concepts using statements on their own have been migrated to use this concept.
  • String literal and multiline literal have been merged into a single string literal concept.
  • Inheritance modifier (final, abstract…) on function declarations is now mandatory because of the usage of the Inheritable interface; declarations will be migrated accordingly.
  • Support for deconstructing variables has been grouped under the IDeconstructingDeclarations interface; for statement and lambda multi-parameter are migrated to use it.
  • Concepts with receiver types no longer use the ReceiverType concept (which is an expression referring to a type) and hold the type directly.
  • The Unsigned, Long, and Integer literal concepts have been grouped under the IntegerLiteral concept (which uses boolean flags). Moreover, negative number literals are no longer supported and must be created using the unary minus concept.

SModel language for MPS Kotlin

SModel support is now available in MPS Kotlin with the new jetbrains.mps.kotlin.smodel language. Along with the enhanced compilation support, it allows for the usage of Kotlin code in language modules (as helper classes, for example).

On top of regular types (node, concept, links, and references), it leverages the increased flexibility of MPS Kotlin to bring concept-type parameters. Functions, variables, and classes can now declare and use such parameters and reuse them in their internal types, which allows for easier typing and leverages Kotlin’s smart casts.

Kotlin compilation updates

Kotlin compilation support has been improved with better persistence. As a result, Kotlin classes are no longer erased when MPS is restarted.

A new option has been added in build scripts to mark a module to be compiled with the Kotlin compiler. Insertion of this flag is manual – no automatic check is currently available to set it to true. The flag should be added when a module containing Kotlin files is going to be compiled to JVM.

Text styles available in BaseLanguage comments

When adding comments to BaseLanguage, it is now possible to customize them further with text style. Comments support bold (Ctrl + B), non-italics (Ctrl + I), underlined (Ctrl + U), and bold-non-italics styles (Ctrl + B -> Ctrl + I).

Post-fix transformation

In BaseLanguage, it is now possible to do post-fix transformations that allow you to transform the code by appending some text to the expression. This saves developers time, as they do not have to move the caret to the front of the expression or select the expression in order to apply a transformation.

Lazy model discovery with SModel

MPS used to discover models the moment they were registered with a repository. Discovering a model in a regular project module meant traversing the file system to find out files and their types, and reading at least the header information about the model.

Now, modules don’t engage in model discovery unless models are requested. There’s a new SModule API (SModule.forEachRegisteredModel()) to access models already known to a module only, without triggering model discovery or loading. If you use SModel API clients, especially SRepositoryContentAdapter subclasses, you may want to adopt the new API to benefit from the improvement.

MPS now comes with a consistent API to create references, as well as an updated internal presentation. These changes aim to improve the model reference/persistence system, which is scheduled for later releases. Nevertheless, the change already allows you to reduce any model’s in-memory storage by approximately 5%.

Java stubs

MPS now respects versioned jar entries and would expose Java classes with a version that matches the actual Java runtime.

Log4j migration to Java Util Logging (JUL)

Although MPS and the IntelliJ Platform were using a stripped-down version of the Log4j library without known security issues, they have both switched logging to the standard java.util.logging package. A compatibility layer is implemented (based on SLF4J) to redirect requests from the Log4j API to a Java Util Logging (JUL) implementation.

Command-line Make

Ant build scripts that MPS generates from lang.build declarations use separate tasks to generate and compile sources (MPS-own <generate> and regular Ant <javac>). There’s now a new <mps.make> task that corresponds to the Make process launched from the IDE. It is responsible for the complete transition of a model down to compiled code. The task combines both code generation and compilation, which saves time as MPS needs compiled classes anyway for its module classloading purposes (as <javac> tasks often duplicate compilation efforts already completed during <generate>). It also makes Ant command-line builds and the Make process launched from the IDE much more similar to each other, thus increasing the reliability of your build process. Watch a demo.

Generator tests

Generator tests have been improved with matching options that allow ignoring node ordering. There’s also a new action to reorder model roots, which helps to bring reference test models to the desired state. Watch a demo.

Timeout setting for TextGen

MPS caps the time spent in the Model-to-Text (M2T) transformation part to address potential errors in TextGen aspects. The limit was previously hard-coded. However, lately some big models have been reaching the limit, causing an undesired timeout exception. So now, there’s an IDE setting that you can define to control the timeout. Support for command-line builds is planned for future releases.

Improved Java BaseLanguage dependency management for the Make process

MPS used to record dependencies between generated BaseLanguage classes in the `dependencies` file. The Java compiler relies on these to figure out whether dependent compilation classes need a refresh. But when ‘dependencies’ were changed in 2021.2 to hold higher-level dependencies, there was no longer a need to collect and store per-root class names. This helped MPS to improve TextGen time for both BaseLanguage code (as it no longer needs to collect individual dependencies) and the Java compile process (as it no longer needs to analyze individual file dependencies, attribute file dependencies to modules and classpath, and propagate ‘dirty’ state).

New file to keep module dependencies

A new `deps.cp` file now stores per-module dependencies to let MPS deduce the module compilation graph. The file keeps the state of the transformation, which makes it ‘sealed’ and tailored (it doesn’t list dependencies that were not used in transformation); this is in contrast to the dependency graph collected at runtime, which is based on actual module dependencies.

UI changes

MPS no longer creates runtime/sandbox solutions nested under a language module. By default, these modules would be siblings to the language module. Renaming the ‘main’ language module would still recognize these modules as ‘related’ and rename them along with the ‘main’ module. Watch a demo.

Composite keys for Label Mappings

To enhance the composite label key functionality introduced in previous releases, MPS supports keeping composite keys in checkpoint models.

Platform features

Cloning repository progress bar

The Cloning repository progress bar now appears on the Welcome screen and is shown right in the projects list, which makes it clearer and easier to use.

New Table of Content Action

It’s now possible to quickly generate tables of contents in Markdown files based on the document headers.

GPG signature

It’s now possible to make a GPG signature in a commit. The signing will appear in the Commit Details section of the Git tool window.

Run commands from Markdown files

When working with Markdown files that contain instructions with commands to execute, you can run those commands directly from the file by using the run icons in the gutter.

That’s it for now. As with every release, we have prepared the Migration guide for a smooth transition from an older version. We have also fixed a bunch of bugs to make the product more stable. If you encounter more bugs, please report them to our issue tracker.

Your JetBrains MPS team

]]>
Early Access Program for MPS 2022.2 https://blog.jetbrains.com/mps/2022/08/early-access-program-for-mps-2022-2/ Tue, 23 Aug 2022 07:44:48 +0000 https://blog.jetbrains.com/wp-content/uploads/2022/08/Blog_Featured_image_1280x600_MPS-2x.png https://blog.jetbrains.com/?post_type=mps&p=274924 As previously mentioned, we decided to skip MPS 2022.1 as we were too busy fixing issues from the last release and didn’t have enough time to prepare the new functionality. Now we have new features to present to give you a glimpse of what’s to come in MPS 2022.2.

DOWNLOAD MPS 2022.2 EAP

Annotations in Inspector

Annotations are now accessible from the Inspector window, and the annotation process will start for the entire root. This action can be accessed by right-clicking on the left border of the Inspector window. The Annotation will open in both the Inspector editor and the main editor.

Improved support in MPS Kotlin

A lot of edition issues have been fixed to provide a better typing experience, such as:

  • Lambda literals:
    • Support of the implicit “it” parameter.
    • Lambdas whose type has a receiver (e.g. “Receiver.() -> Unit”) will properly use that receiver type as an implicit “this” inside the body of the lambda.
  • Scopes have been refactored to support more use cases (e.g. custom receiver types) and improve filtering (fewer duplications, access to hidden functions).
  • Support for deconstructing operators by typesystem.
  • Number literals: easier insertion of floats and long, and transition between unsigned and signed numbers.
  • String literals: All strings can be switched from single to multiline by pressing enter in a string literal; some insertion issues have been fixed.
  • Kotlin stubs support loading of annotations and function types with receiver (eg. “T.() -> R” which were incorrectly loaded as “(T) -> R”, such as the with() function).

Due to some structural changes, several migrations are provided with the language:

  • Statement support has been made generic in theIStatementHolder interface; other concepts using statements on their own have been migrated to use this concept.
  • String literal and multiline literal have been merged into a single string literal concept.
  • Inheritance modifier (final, abstract…) on function declarations is now mandatory because of the usage of the Inheritable interface; declarations will be migrated accordingly.
  • Support for deconstructing variables has been grouped under the IDeconstructingDeclarations interface; for statement and lambda multi-parameter are migrated to use it.
  • Concepts with receiver types no longer use the ReceiverType concept (which is an expression referring to a type) and hold the type directly.
  • Unsigned, Long and Integer literal concepts have been grouped under the IntegerLiteral concept (which uses boolean flags). Moreover, negative number literals are no longer supported and must be created using the unary minus concept.

SModel language for MPS Kotlin

SModel support has been brought to MPS Kotlin, with the new jetbrains.mps.kotlin.smodel language. Along with the increased compilation support, it allows for the usage of Kotlin code in language modules (as helper classes for instance).

On top of regular types (node, concept, links, references), it leverages the increased flexibility of MPS Kotlin to bring concept-type parameters. Functions, variables, and classes can now declare and use such parameters and reuse them in their internal types, which allows for easier typing and leverages Kotlin smart casts.

Kotlin compilation updates

Kotlin compilation support has been improved with better persistence. As a result, Kotlin classes are no longer erased when MPS is restarted.

A new option has been added in build scripts to mark a module to be compiled with the Kotlin compiler. Insertion of this flag is manual – no automatic check is currently available to set it to true. The flag should be added when a module containing Kotlin files is going to be compiled to JVM.

Text styles available in BaseLanguage comments

When adding comments to the BaseLanguage, it is now possible to customize them further with text style. Comments support bold, non-italics, underlined, and bold-non-italics styles.

Post-fix transformation

In BaseLanguage, it is now possible to do post-fix transformations that allow you to transform the code by appending some text to the expression. This saves developers time, as they do not have to navigate the cursor to the front of the expression or select the expression in order to apply a transformation.

That’s it for now. Try the new functionality and feel free to give us feedback. The release of MPS 2022.2 is coming soon, so stay tuned!

Your JetBrains MPS team

]]>
MPS Is Skipping the 2022.1 Release https://blog.jetbrains.com/mps/2022/04/mps-is-skipping-the-2022-1-release/ Wed, 27 Apr 2022 14:26:52 +0000 https://blog.jetbrains.com/?post_type=mps&p=243311 MPS 2022.1 was supposed to be released this month, but we unfortunately have to announce that this is not going to happen. The previous release, MPS 2021.3, was released late, which gave us a shorter time frame for fixing the bugs of the new features, while also developing functionality for MPS 2022.1. Rather than risk falling into a cycle of rushes and delays, we have decided to skip the release of MPS 2022.1 and start working directly on MPS 2022.2, which is scheduled to be released in the third quarter of this year.

We are sorry for any inconvenience that this may cause.

Your JetBrains MPS team

]]>
MPS 2021.3 Released https://blog.jetbrains.com/mps/2022/02/mps-2021-3-released/ https://blog.jetbrains.com/mps/2022/02/mps-2021-3-released/#respond Tue, 15 Feb 2022 13:21:21 +0000 https://blog.jetbrains.com/wp-content/uploads/2022/02/Release_Preview_image_1280x600_MPS-2x.png https://blog.jetbrains.com/?post_type=mps&p=228580 We planned to release this version last year, but we didn’t have the level of functionality we desired, so we postponed the release date. This is a special major release as it contains features that the team has been working on for a long time. Read on for more details or watch our release video.

DOWNLOAD MPS 2021.3

Coderules

It’s no secret that we have been working on a new typesystem for some years. The path to achieving this hasn’t been easy or straightforward, but we finally have something to show. Coderules is still in Beta, which is why it’s not bundled with MPS.

As this is an entire subsystem, we have prepared an online course that walks you through its fundamentals.

GO TO COURSE

Experimental Kotlin language support

An experimental Kotlin implementation is now bundled with MPS. Although it supports most of the structure elements in the language (and their text generation), it remains only partially supported.

Stubs in common Kotlin code are also supported. On the JVM side, baseLanguage constructs (code and stubs) can be referenced in Kotlin through the jetbrains.mps.kotlin.javaRefs language.

The implementation of the typesystem has been externalized to MPS-Kotlin-Typesystem, which can be installed as a plugin. There is also simple support for types (without inference and generics) and overload resolution that can be used for editing.

Hide revision action in annotate

Some revisions may contain low-level migrations, and when they affect the whole root, it might be undesirable to see them in the ‘annotate’ column. The existing action Annotate previous revision opens the editor in a separate tab for a root at the selected commit. The new action Hide Revision allows you to exclude a revision from the annotation result in-place and show the result in both the editor and gutter. The excluded revisions can be restored with the opposite action Restore Hidden Revisions.

Information about hidden revisions is displayed in the notification panel at the top of the editor. It is also possible to restore hidden revisions by clicking on the corresponding link in the notification panel.

Optimization of Annotate revision action results

The Annotate action in MPS is not as fast as the git blame operation for text files since the annotation result is constructed for the models. Annotate revision and Annotate previous revision actions use the same algorithm for constructing the result as the Annotate action and were slow as well. The result for the Annotate revision and Annotate previous revision actions can be constructed instantly using the result obtained from the initial Annotate actions.

Details dialog in merge roots

The Show Details action has been introduced to give more details about the branches during merging. The action is accessible from the Merge revision window.

Short change descriptions in tooltips in Diff dialog

We’ve introduced a new action that can change the description of the changes in the Diff dialog tooltips. The description is shorter and more readable.

Enhanced editor tooltips

Now it’s possible to click on the links inside the tooltips, and the tooltips popup window stays inside the main application window. You can also scroll inside a tooltip if it has a lot of text.

New diff algorithm in the merge process

A new algorithm for calculating changes between two models was introduced in v2020.3. The algorithm allows you to detect node movements and define new change types. Since node movement is often a result of wrapping the node with a new parent node, new change types were introduced for wrapping changes, as well.

The new algorithm was developed to find conflicting, non-conflicting, and symmetric changes for changes of new types. We’ve introduced a UI mechanism for switching between the algorithms with and without node movement tracking in the Merge window.

Nested wrapping and unwrapping changes detected in diff dialog

Even though it was previously possible to detect internal insertions, deletions, and moves inside the wrapping or unwrapping change, nested wrapping changes were not detected. Now it is possible to detect nested wrapping and unwrapping changes.

Reorganized VCS settings

VCS settings have been reorganized to make them more discoverable and usable. In Preferences / Settings | Version Control you will now find a list of the available settings to configure your VCS. Additionally, we’ve added a separate node for Directory mappings, and the background operations are now switched on by default.

If you go to the Git node, you’ll notice that we have divided the settings into sections that account for the most important processes: Commit, Push, and Update.

Generation of compatible closures into Java lambdas

MPS closures are now generated into Java lambda expressions if they are compatible. Incompatibilities include the usage of:

  • Yield operations
  • “Functional” abstract classes
  • Annotations
  • Local variables conflicting with parent scope

Some issues may arise from this change:

  • Ambiguous calls: undetected in MPS, the Java compiler will report such issues with closures generated as lambdas.
  • Closure instances: as a lambda, a closure will create a single instance at runtime, as opposed to anonymous classes that create a new instance every time it’s called (see screenshot below).

Mapping label for tuples

We’ve introduced experimental functionality to use a pair of nodes as a key for the mapping, ‘node<>, node<> –> node<>’. This is useful in situations where you need to support two source concepts. If you would like to give it a try, it’s used the same way you use labels with one key node. You only need to add the second key by typing ‘,’ to get the second field.

Then, restore a reference by get output by label and input, with 2 relevant nodes as shown below:

​​For many years MPS has stuck to labeled ‘node<> –> node<>’ mappings. The whole generator subsystem is built around the idea of passing a single node as an input, and most operations assume a mostly single-node context. With this feature, we aim to explore different ways to make the generator more flexible, so we would really appreciate your feedback on it.

Access all values of two key mappings in generators

Besides the Mapping label for tuples feature, we now support a query to access all known mappings for given two keys, genContext.get output list LABEL for (node1, node2).

Performance trace reports time spent resolving dynamic references

Because of numerous scope evaluations, resolving dynamic references often slows down model-to-model transformation. Performance trace hides this vital piece of information under a vague “restoring references” title. Now, the time spent restoring dynamic references is reported separately from time spent restoring regular or static references.

Project migration improvements

In previous versions of MPS, for project migrations you had to create an ApplicationComponent class and register it in the plugin.xml. This was quite tricky, as you had to modify the folder structure of the plugin folder and copy over some files manually.

We have simplified the process of creating project migrations in this release. You only need to create a plugin solution, write the migration and application plugin root, and include this plugin solution with the build script.

Ant <migrate> task improvements

The Ant <migrate> task now supports multiple project specifications and can migrate several projects at once. You can either use nested <project path=””/> elements or regular Ant’s <dirset> to enumerate project locations for the task.

Method references

You can now use method references for baseLanguage methods with the jetbrains.mps.baseLanguage.methodReferences language. Like closures, they can be used as substitute for functional interfaces, function types, and functional abstract classes.

Closure untyped parameters

Closure parameters’ types can now be specified as “var”, which means the type can be inferred automatically. Partial support for this already existed with SmartClosureParameterDeclaration (for collection language and simple function calls), but the new notation can be used in any context where closures are supported.

Checkout and Rebase onto Current for remote branches

The action to Checkout and Rebase onto Current lets you check out the selected branch and rebase it on top of a branch that is currently checked out. This was possible only for local branches before, but in MPS 2021.3 you can use it with remote branches as well.

New Changes tool window

In MPS 2021.3, the IDE shows the difference between commits in a separate Changes tool window located on the left of the editor.

New Push All up to Here action

This feature allows you to push only the commits you are confident about and leave the rest for later. To use it, pick the commit you want to stop at, right-click on it to call the context menu, and select the new Push All up to Here action.

As with every release, we have prepared the Migration guide for a smooth transition from an older version. And for all newcomers, we have added descriptions to our sample projects. We have also fixed a bunch of bugs to make the product more stable. If you encounter more bugs, please report them to our issue tracker.

Have a great day!

Your JetBrains MPS team

The Drive to Develop

]]>
https://blog.jetbrains.com/mps/2022/02/mps-2021-3-released/feed/ 0
The Early Access Program for MPS 2021.3 is open https://blog.jetbrains.com/mps/2021/12/the-early-access-program-for-mps-2021-3-is-open/ https://blog.jetbrains.com/mps/2021/12/the-early-access-program-for-mps-2021-3-is-open/#respond Thu, 30 Dec 2021 15:39:13 +0000 https://blog.jetbrains.com/wp-content/uploads/2021/12/MPS_blog_featured.png https://blog.jetbrains.com/?post_type=mps&p=215860 Our release of MPS 2021.3 will be delayed until next year. That said, we can’t finish the year without giving you a glimpse of what you can look forward to.

DOWNLOAD MPS 2021.3 EAP

Experimental Kotlin language support

An experimental Kotlin implementation is now bundled with MPS. While it supports most of the structure elements in the language (and their text generation), it still remains only partially supported.

Stubs in common Kotlin code are also supported. On the JVM side, baseLanguage constructs (code and stubs) can be referenced in Kotlin through the jetbrains.mps.kotlin.javaRefs language.

Implementation of the type system has been externalized to MPS-Kotlin-Typesystem, which can be installed as a plugin. There is also simple support for types (without inference and generics) and overload resolution that can be used for editing.

Hide revision action in annotate

Some revisions may contain low-level migrations, and when they affect the whole root, it might be undesirable to see them in the ‘annotate’ column. The existing action Annotate previous revision opens the editor in a separate tab for a root at the selected commit. The new action Hide Revision allows you to exclude a revision from the annotation result in-place and show the result in both the editor and gutter. The excluded revisions can be restored with the opposite action Restore Hidden Revisions.

Information about hidden revisions is displayed in the notification panel at the top of the editor. It is also possible to restore hidden revisions by clicking on the corresponding link in the notification panel.

Optimization of Annotate action results

The Annotate action in MPS is not as fast as the git blame operation for text files since the annotation result is constructed for the models. Annotate revision and Annotate previous revision actions use the same algorithm for constructing the result as the Annotate action and were slow as well. The result for the Annotate revision and Annotate previous revision actions can be constructed instantly using the result obtained from the initial Annotate actions.

Details dialog in merge roots

The Show Details action has been introduced to give more details about the branches during merging. The action is accessible from the Merge revision window.

Short change descriptions in tooltips in Diff dialog

We’ve introduced a new action that can change the description of the Editors of the different branches in the Diff dialog. The description is shorter and more readable.

Generation of compatible closures into Java lambdas

MPS closures are now generated into Java lambda expressions if they are compatible. Incompatibilities include the usage of:

  • Yield operations
  • “Functional” abstract classes
  • Annotations
  • Local variables conflicting with parent scope

Some issues may arise from this change:

  • Ambiguous calls: undetected in MPS, the Java compiler will report such issues with closures generated as lambdas.
  • Closure instances: as a lambda, a closure will create a single instance at runtime, as opposed to anonymous classes that create a new instance every time it’s called (see screenshot below).

Checkout and Rebase onto Current for remote branches

The action to Checkout and Rebase onto Current lets you check out the selected branch and rebase it on top of a branch that is currently checked out. This was possible only for local branches before, while in MPS 2021.3 you can use it with remote branches as well.

Reorganized VCS settings

The VCS settings have been reorganized to make them more discoverable and usable. In Preferences / Settings | Version Control you will now find a list of the available settings to configure your VCS. Additionally, we’ve added a separate node for Directory mappings, and the background operations are now switched on by default.

If you go to the Git node, you’ll notice that we have divided all of the settings into sections that account for the most important processes: Commit, Push, and Update.

New Changes tool window

In MPS 2021.3, the IDE shows the difference between commits in a separate Changes tool window located on the left of the editor.

New Push All up to Here action

This feature allows you to push only the commits you are confident about and leave the rest for later. To use it, pick the commit you want to stop at, right-click on it to call the context menu, and select the new Push All up to Here action.

That’s all for now! We still have more surprises for this release, so stay tuned for more news.

Have a great New Year!

Your JetBrains MPS team

The Drive to Develop

]]>
https://blog.jetbrains.com/mps/2021/12/the-early-access-program-for-mps-2021-3-is-open/feed/ 0
MPS 2021.2.3 Is Available https://blog.jetbrains.com/mps/2021/12/mps-2021-2-3-is-available/ https://blog.jetbrains.com/mps/2021/12/mps-2021-2-3-is-available/#respond Fri, 03 Dec 2021 09:57:54 +0000 https://blog.jetbrains.com/wp-content/uploads/2021/09/BlogFeatured_MPS.png https://blog.jetbrains.com/?post_type=mps&p=210057 This is our third bug-fix release for MPS 2021.2. You can find the complete list of bugs fixed in this version here.

Thanks to the community’s help, we spotted a critical bug in the Version Control / merge subsystem that was causing the generator to break. The problem was happening because the stereotypes (e.g. @generator) were being lost after merging models. The issue is fixed in this version 2021.2.3.

If you encounter this bug while using a previous version of MPS, please add the stereotype manually to fix the issue.

DOWNLOAD MPS 2021.2.3

Please report any issues you find to our issue tracker

Have a great day!

Your JetBrains MPS team

The Drive to Develop

]]>
https://blog.jetbrains.com/mps/2021/12/mps-2021-2-3-is-available/feed/ 0
The MPS 2021.2 Bug Fix Is Here https://blog.jetbrains.com/mps/2021/10/the-mps-2021-2-bug-fix-is-here/ https://blog.jetbrains.com/mps/2021/10/the-mps-2021-2-bug-fix-is-here/#respond Mon, 11 Oct 2021 12:10:12 +0000 https://blog.jetbrains.com/wp-content/uploads/2021/09/BlogFeatured_MPS.png https://blog.jetbrains.com/?post_type=mps&p=191102 This is a special minor release containing primarily fixes that were requested by our support contract clients. In case you haven’t heard about our support program, we provide professional services to our clients to help them use MPS to achieve their goals faster. This business model allows us to keep MPS open source. We are committed and grateful to all of our clients, which is why we give the highest priority to their issues.

DOWNLOAD MPS 2021.2.1

Check out the complete list of bugs fixed in this release. If you encounter any issues that we haven’t addressed, please submit a ticket on our issue tracker.

Have a great day!

Your JetBrains MPS team

The Drive to Develop

]]>
https://blog.jetbrains.com/mps/2021/10/the-mps-2021-2-bug-fix-is-here/feed/ 0
MPS 2021.2 Is Now Available https://blog.jetbrains.com/mps/2021/10/mps-2021-2-is-now-available/ https://blog.jetbrains.com/mps/2021/10/mps-2021-2-is-now-available/#respond Wed, 06 Oct 2021 13:41:03 +0000 https://blog.jetbrains.com/wp-content/uploads/2021/09/BlogFeatured_MPS.png https://blog.jetbrains.com/?post_type=mps&p=178130 MPS 2021.2, our second milestone of the year, is now ready for you to try. Just as we did for the previous release, we have put together a screencast showcasing its main features. Read on to learn about the new functionality.

DOWNLOAD MPS 2021.2

Automatic completion pop-up

Code completion, which is normally invoked by pressing Ctrl/Cmd + Space, now pops up automatically after you stop typing, with a half-second delay by default. It can still be opened manually if needed. Automatic invocation is a bit different from manual invocation in the following ways:
– It never opens in an empty cell.
– It never opens if there are no suggestions to offer.
– It closes automatically if there are no suggestions to offer.
– It closes automatically if you delete all text and leave the cell empty.

This feature can be turned on or off by toggling Show suggestions as you type in the Editor / General / Code completion section. The setting is on by default.

Improvements to wrapping and unwrapping changes in the VCS diff

Wrapping changes are now much more flexible. It is possible to have independent internal changes inside wrapping and unwrapping changes. In addition, it is possible to have several wrapping and unwrapping changes next to each other. The internal moves are now detected inside nodes with changed IDs.

Improved display of node attribute changes

Editor cells for attributes were previously not being correctly highlighted in the Diff dialog. Typically, the whole node with the attribute was highlighted if an attribute was added or deleted, rather than just the attribute in question.

Generic spell-checking mechanism

MPS functionality that employs an IntelliJ IDEA spell-checking mechanism to check comments and string literals for typos and mistakes has been extended to work with any text that may show up in a label cell. To indicate that the text of a cell has to be checked against a dictionary (as configured in Preferences), you just need to add the spellcheck style to the cell in your editor declaration.

For Rich Client Platforms (RCP), don’t forget to include the ’jetbrains.mps.editor.spellcheck’ plugin in a distribution.

Project version for migrations

We’ve addressed the scenario where a project that has been migrated to a newer MPS version is accessed by a developer with an older MPS version. The Migration subsystem now tracks the MPS platform version when applying migrations, and it warns you if a project you try to open has been migrated to a newer version. This helps prevent the unintended corruption of models.

Optimized reference scope

There’s a mechanism for sharing evaluated scope pieces during a single model read. New expressions in j.m.lang.constraints for sharing scopes were introduced: for model [ factory, key], visible roots [concept], and visible nodes [concept] as replacement for new ModelPlusImportedScope(model, rootsOnly, concept). The new expressions are used to save the scope of a model to cache memory, meaning that it only needs to be recorded and calculated once.

No limitations when modifying nodes

Extension authors have to select what type of access to grant when they write code that works with MPS models. For SNode operations (e.g. setProperty, addChild(), etc.), it was only possible to grant command access, even without UI interaction. This limitation has now been lifted, and any code that holds write access for the model can now modify nodes.

Tooltip radar

The Tooltips feature now has a functionality called radar that shows which cells have tooltips. The Tooltip radar can be activated by pressing and holding the Ctrl key.

Diamond operator

It is now possible in baseLanguage to use the Java diamond operator on constructors to infer generic parameters from context. The diamond operator will be enabled by default for newly written code. To enable it on your existing constructors, remove your existing type parameters and set infer type parameters to true in the inspector, or type “<>” again and remove the empty parameter.

BaseLanguage properties improvements

Properties in baseLanguage are now taken into account correctly on type checking. No errors for an unimplemented method will be raised when a property inherits interface or abstract methods. When defining a property with a generic type, the correct type is used for accessing the property on an instance.

Note that the setter exposed for a property of type T will return an object of type T, rather than void.

Unified Show Diff

MPS now displays the difference between the initial and changed versions of files in the editor tab. It doesn’t matter how you invoke the Show Diff action, the IDE will open the diff in the editor by default.

If you find it more convenient to track changes in a separate window, you can drag the desired file from the editor. If you do, the IDE will remember this and will open future diffs in a separate window.

Other improvements

New navigation option in Preferences/Settings

New arrows are located in the top right-hand corner of the window in Preferences/Settings to help you navigate through the sections. They allow you to jump back and forth between the sections.

Drag and drop tool windows

It is now easier to drag and drop a tool window to move it within the main IDE window or to make it a separate window. You can drag a tool window by clicking and holding its name bar and dropping it in any highlighted place.

Terminal enhancements

There are new options for the cursor shape in the built-in terminal. Furthermore, the terminal also offers new support for shortcuts using Option (⌥) as a Meta key. For example, you can use the following shortcuts:

⌥+F – go to the next word

⌥+B – go back a word

⌥+D – delete the next word

Migration Guidelines

We introduced a new section in our documentation to share guidelines for a smooth migration to the new releases. With every major release, we will be updating this section with the latest tips and tricks.

That’s it for now. We hope you can take advantage of all the new features. We’ve also fixed a long list of bugs from our issue tracker. Let us know if you encounter any problems or have questions by leaving a message in the comments below or sending an email to our support address.

Have a great day!

Your JetBrains MPS team

The Drive to Develop

blog_footer_bw@2x

]]>
https://blog.jetbrains.com/mps/2021/10/mps-2021-2-is-now-available/feed/ 0 https://blog.jetbrains.com/ru/mps/2021/10/mps-2021-2-is-now-available/
Try the MPS 2021.2 EAP Build https://blog.jetbrains.com/mps/2021/08/try-the-mps-2021-2-eap-build/ https://blog.jetbrains.com/mps/2021/08/try-the-mps-2021-2-eap-build/#respond Wed, 04 Aug 2021 14:20:06 +0000 https://blog.jetbrains.com/wp-content/uploads/2021/08/Blog_Feature_Image_MPS.png https://blog.jetbrains.com/?post_type=mps&p=170441 We are happy to introduce the first and last EAP release for MPS 2021.2. For this release cycle, we decided to have only one EAP version, as we had blocking issues that were stopping us from publishing more. That didn’t stop us from developing great new features, though! Here’s what you can expect in the next release.

Automatic completion popup

Code completion, which is normally invoked by pressing Ctrl/Cmd + Space, now pops up automatically after you stop typing, with a half-second delay by default. It can still be opened manually if needed. Automatic invocation is a bit different from manual invocation in the following ways:

  • It never opens in an empty cell.
  • It never opens if there are no suggestions to offer.
  • It closes automatically if there are no suggestions to offer.
  • It closes automatically if you delete all text and leave the cell empty.

This feature can be turned on or off by toggling Show suggestions as you type in the Editor / General / Code completion section. The setting is on by default.

Improvements to wrapping and unwrapping changes in the VCS diff

Wrapping changes are now much more flexible. It is possible to have independent internal changes inside wrapping and unwrapping changes. In addition, it is possible to have several wrapping and unwrapping changes next to each other. The internal moves are now detected inside nodes with changed IDs (MPS-33505).

As shown in the following screenshot, the algorithm is smart enough to know that the code was unwrapped and make the changes accordingly.

Improved display of node attribute changes

Editor cells for attributes were previously not being correctly highlighted in the Diff dialog. Typically, the whole node with the attribute was highlighted if an attribute was added or deleted, rather than just the attribute in question.

Generic spell-checking mechanism

MPS functionality that employs an IntelliJ IDEA spell-checking mechanism to check comments and string literals for typos and mistakes has been extended to work with any text that may show up in a label cell (MPS-33261). To indicate that the text of a cell has to be checked against a dictionary (as configured in Preferences), you just need to add the 'spellcheck' style to the cell in your editor declaration.

For Rich Client Platforms (RCP), don’t forget to include the 'jetbrains.mps.editor.spellcheck'plugin in a distribution.

Project version for migrations

We’ve addressed the scenario where a project that has been migrated to a newer MPS version is accessed by a developer with an older MPS version. The Migration subsystem now tracks the MPS platform version when applying migrations, and it warns you if a project you try to open has been migrated to a newer version. This helps prevent the unintended corruption of models.

Optimized reference scope

Functions for building reference scopes share identical logic for a few concepts/references in a language. For example, each ClassifierType:classifier reference has to compute a set of classifiers visible for a given model with respect to its imports.

There’s a mechanism for sharing evaluated scope pieces during a single model read. New expressions in j.m.lang.constraints for sharing scopes were introduced: for model [ factory, key], visible roots [concept], and visible nodes [concept] as replacement for new ModelPlusImportedScope(model, rootsOnly, concept). The new expressions are used to save the scope of a model to cache memory, meaning that it only needs to be recorded and calculated once.

No limitation to modify nodes

Extension authors have to define the proper kind of access when they write code that deals with MPS models. In some operations, only command access was possible, even without UI interaction. The limitation has been lifted, and any code that holds model write access can modify nodes now.

Tooltip radar

The Tooltips feature now has a functionality called radar that shows which cells have tooltips. The Tooltip radar can be activated by pressing and holding CTRL.

Diamond operator

It is now possible in BaseLanguage to use the Java diamond operator on constructors to infer generic parameters from context.

The diamond operator will be enabled by default for newly written code. To enable it on your existing constructors, remove your existing type parameters and set infer type parameters to true in the inspector, or type “<>” again and remove the empty parameter.

BaseLanguage properties improvement

Properties in BaseLanguage are now taken into account correctly on type checking. No errors for an unimplemented method will be raised when a property inherits interface or abstract methods (MPS-17463). When defining a property with a generic type, the correct type is used for accessing the property on an instance (MPS-17069).

Note that the setter exposed for a property of type T will return an object of type T, rather than void.

Unified Show Diff

MPS now displays the difference between the initial and changed versions of files in the editor. It doesn’t matter how you invoke the Show Diff action, the IDE will open the diff in the editor by default.

If you find it more convenient to track changes in a separate window, you can drag the desired file from the editor. If you do, the IDE will remember this and will open future diffs in a separate window.

DOWNLOAD MPS 2021.2 EAP1

That’s it for now! Try the new functionality and give us your feedback in the comments or on our issue tracker.

Have a great day!

Your JetBrains MPS team

The Drive to Develop

]]>
https://blog.jetbrains.com/mps/2021/08/try-the-mps-2021-2-eap-build/feed/ 0