Child pages
  • What's new in MPS 2.5 M1

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Section 1 - IntelliJ IDEA integration

Include Page
MPS:MPS plugin for IntelliJ IDEA
MPS:MPS plugin for IntelliJ IDEA

Section 2 - New Build Language

Build Language

Build Language is an extensible build automation DSL for defining builds in a declarative way. Generated into Ant, it leverages Ant execution power while keeping your sources clean and free from clutter. Organized as a stack of MPS languages with ANT at the bottom, it allows each part of your build procedure to be expressed at a different abstraction level. Building a complex artifact (like an MPS plug-in) could be specified in just one line of code, if you follow the language conventions, but, at the same time, nothing prevents you from diving deeper and customize the details like file management or manifest properties.

Image Added

Modular builds

Build script dependencies allow you to organize your build as a sequence of steps, each of which may potentially run on a different machine. At generation time, a sophisticated resolution mechanism transforms the high-level dependencies into the appropriate ANT tasks. For example, a dependency on a java module is replaced with its compiled jar location. Referring to and depending on the elements packaged inside existing archives will implicitly extracts them without any extra effort on your side.

Image Added

Plug-ins packaging

Distributing languages as plug-ins for either IntelliJ IDEA, MPS or as your own standalone IDE has become an extremely easy task. The functionality has been packaged into an extension to Build Language, which knows how to build MPS modules and supports all kinds of packaging. You can either write the whole script by hand or rely on the Build Solution Wizard, which helps you start with a new script.

Image Added
Image Added
Image Added

You can refer to the User Guide and to the Build Language documentation for more details.

Section 3 - IDE enhancements

Dependencies analyzer

The Dependencies Analyzer can report dependencies among modules or models. It can be called from the main menu or from the popup menu of modules/models:

...

For some types of dependencies the pop-up menu offers the possibility to invoke convenience actions such as Show Usages or Safe Delete. For the "depends on" dependencies (those without re-export) Dependencies Analyzer will be invoked for the Show Usages action.
Anchorrefactoringsrefactorings

Changes in the Refactoring language

In order to make the structure of MPS core languages more consistent and clear, the Refactoring language has been changes considerably. Several new and easy-to-use constructs have been added and parts of the functionality was deprecated and moved into the Actions language.

The UI for retrieving the refactoring parameters has been removed from the refactoring language. Choosers for parameters are no longer called, it is not allowed to show UI in init (e.g. ask and ask boolean) and keystroke has no effect. All this functionality should be moved to an action corresponding to the refactoring.

The following constructs have been added to the refactoring language. These new constructs are intended to to be used from code, typically from within the actions:

  • is applicable refactoring<Refactoring>(target)
    returns true if the refactoring target corresponds to the current target (type, single/multiple) and applicable as in refactoring isApplicable method, and there is no refactoring that overrides current refactoring for this target.
  • execute refactoring<Refactoring>(target : project, parameters );
    executes the refactoring for the target with parameters
  • create refcontext<Refactoring>(target : project, parameters )
    create a refactoring context for the refactoring, target and fill parameters in context, this context then can be used for refactoring execution or for further work with parameters; UI is not shown during this call

It is necessary to manually migrate existing user refactorings. The migration consists of several steps:

  • create a UI action for the refactoring
  • copy the caption, create context parameters
  • add a refactoring keystroke with the newly created action to KeymapChangesDeclaration
  • create ActionGroupDeclaration for the refactoring that modifies the jetbrains.mps.ide.actions.NodeRefactoring action group at the default position
  • add an isApplicable clause to the action created; usually it is just is applicable refactoring< >() call
  • add an execute clause to the action created; all the parameter preparations that were in init of the refactoring should be moved here; at the end it is necessary to execute the refactoring with the prepared parameters (with execute refactoring< >(); statement)
  • remove all parameter preparation code from init of the refactoring, they are now prepared before the entry to init; you can still validate parameters and return false if the validation fails

Suppressing errors

One of very effective ways to maintain high quality of code in MPS is the instant on-the-fly code analysis that highlights errors, warnings or potential problems directly in code. Just like with other code quality reporting tools, it is essential for the user to be able to mark false positives so that they are not reported repeatedly. MPS now enables the developers to suppress the reported problems directly in the editor (and in the model checker).

...

The popup notification can be disabled in Settings -> IDE Settings -> Notifications -> Saving Transient Models Is On.

New XML language

A new language named jetbrains.mps.core.xml was introduced in MPS 2.5. This XML language has been designed in accordance to the XML specification. We recommend that you use this new language instead of the old ones, if you need to work with XML in MPS. All the other XML languages will be deprecated in the future.

Image Removed

Custom persistence for MPS models through stubs

...

mps.* ANT tasks were reimplemented to eliminate dependencies on the IntelliJ platform modules. This reduced the loading time and so speeded-up execution of mps.* tasks.

Build Language

Build Language is an extensible build automation DSL for defining builds in a declarative way. Generated into Ant, it leverages Ant execution power while keeping your sources clean and free from clutter. Organized as a stack of MPS languages with ANT at the bottom, it allows each part of your build procedure to be expressed at a different abstraction level. Building a complex artifact (like an MPS plug-in) could be specified in just one line of code, if you follow the language conventions, but, at the same time, nothing prevents you from diving deeper and customize the details like file management or manifest properties.

Image Removed

Modular builds

Build script dependencies allow you to organize your build as a sequence of steps, each of which may potentially run on a different machine. At generation time, a sophisticated resolution mechanism transforms the high-level dependencies into the appropriate ANT tasks. For example, a dependency on a java module is replaced with its compiled jar location. Referring to and depending on the elements packaged inside existing archives will implicitly extracts them without any extra effort on your side.

Image Removed

Plug-ins packaging

Distributing languages as plug-ins for either IntelliJ IDEA, MPS or as your own standalone IDE has become an extremely easy task. The functionality has been packaged into an extension to Build Language, which knows how to build MPS modules and supports all kinds of packaging. You can either write the whole script by hand or rely on the Build Solution Wizard, which helps you start with a new script.

Image Removed
Image Removed
Image Removed

You can refer to the User Guide and to the Build Language documentation for more details.

Version control

More reliable merge conflict handling with the MPS merge driver:

  • Automatic merge of project and .msd/.mpl files.
  • The merge driver tries to leave the models in the working directory in a readable state during conflict resolution
  • Conflicted models cannot be opened from project tree in a normal way. When you first try to open a conflicted model, the merge dialog for this model will show up.

Image Added

Debugger

In order to make MPS more modular, the debugger API and the Java debugger itself were moved into separate MPS plugins. This allows the user to completely turn the functionality off when not needed. A migration script to upgrade code to the new debugger API has been included in the MPS 2.5 migration wizard. Additionally, a migration script named "Fix references to debugger classes" is available for manual execution.

New debugger features introduced in MPS 2.5:

  1. In the generic debugger:
    • Cell-based highlighting in tables.
      Image Added
    • Toolbar with stepping actions in the Debugger Tool.
      Image Added
  2. In the Java debugger:
    • "Copy value" action in the variables tree.
      Image Added
    • Special highligting for breakpoints on which the debugger is not able to stop.
      Image Added
    • Evaluate selection: Alt+F8 copies the selected code to the Evaluate window.
      Image Added
    • High-level types and variable names are calculated for variables in the evaluation and watches windows. Low-level types (i.e. types from the generated Java code) are shown in brackets.
      Image Added
  3. For developers of debugger extension:
    • isApplicable function is available in the breakpoints creators.
      Image Added

A New option in Run Configuration for running MPS from MPS

A Run Configuration, which starts another instance of MPS from MPS, can now automatically open a selected project on start. You can either choose an arbitrary project path or open the current project that is already open in the current MPS instance. In the Latter case, the project file is copied into a temporary directory to avoid collisions between the two running instances.
Image Added

Section 4 - Improvements to the out-of-the-box languages

New XML language

A new language named jetbrains.mps.core.xml was introduced in MPS 2.5. This XML language has been designed in accordance to the XML specification. We recommend that you use this new language instead of the old ones, if you need to work with XML in MPS. All the other XML languages will be deprecated in the future.

Image Added

Anchor
refactorings
refactorings

Changes in the Refactoring language

In order to make the structure of MPS core languages more consistent and clear, the Refactoring language has been changes considerably. Several new and easy-to-use constructs have been added and parts of the functionality was deprecated and moved into the Actions language.

The UI for retrieving the refactoring parameters has been removed from the refactoring language. Choosers for parameters are no longer called, it is not allowed to show UI in init (e.g. ask and ask boolean) and keystroke has no effect. All this functionality should be moved to an action corresponding to the refactoring.

The following constructs have been added to the refactoring language. These new constructs are intended to to be used from code, typically from within the actions:

  • is applicable refactoring<Refactoring>(target)
    returns true if the refactoring target corresponds to the current target (type, single/multiple) and applicable as in refactoring isApplicable method, and there is no refactoring that overrides current refactoring for this target.
  • execute refactoring<Refactoring>(target : project, parameters );
    executes the refactoring for the target with parameters
  • create refcontext<Refactoring>(target : project, parameters )
    create a refactoring context for the refactoring, target and fill parameters in context, this context then can be used for refactoring execution or for further work with parameters; UI is not shown during this call

It is necessary to manually migrate existing user refactorings. The migration consists of several steps:

  • create a UI action for the refactoring
  • copy the caption, create context parameters
  • add a refactoring keystroke with the newly created action to KeymapChangesDeclaration
  • create ActionGroupDeclaration for the refactoring that modifies the jetbrains.mps.ide.actions.NodeRefactoring action group at the default position
  • add an isApplicable clause to the action created; usually it is just is applicable refactoring< >() call
  • add an execute clause to the action created; all the parameter preparations that were in init of the refactoring should be moved here; at the end it is necessary to execute the refactoring with the prepared parameters (with execute refactoring< >(); statement)
  • remove all parameter preparation code from init of the refactoring, they are now prepared before the entry to init; you can still validate parameters and return false if the validation fails

Customizable scopes

An element that contains a reference to some other element typically knows nothing about the scope applicable to the reference. In such cases the best solution for finding applicable elements is to forward the request upwards in the AST. By implementing the ScopeProvider interface you can intercept such requests coming from your descendants and have full control over their scopes. Since BaseLanguage itself now also follows this strategy, you can easily restrict visible elements in embedded statements or expressions.

...

The reference representation can now vary depending on the reference location, as it is in many existing textual languages. It allows languages to support the notion of qualified reference when simple name of the target element is not enough. The new API requires developers to provide the referenceText value as a part of the Scope implementation (see jetbrains.mps.scope.Scope). All references in BaseLanguage now support java-style resolving. Also, in case of broken references the referenceText serves as a hint to the developer to fix it easily.

TODO: a screen-shot ?

Version control

More reliable merge conflict handling with the MPS merge driver:

  • Automatic merge of project and .msd/.mpl files.
  • The merge driver tries to leave the models in the working directory in a readable state during conflict resolution
  • Conflicted models cannot be opened from project tree in a normal way. When you first try to open a conflicted model, the merge dialog for this model will show up.

Image Removed

Section 5 - Other

New Productivity Guide

Good command of the tools is undoubtedly one of the attributes of an efficient developer. MPS 2.5 can monitor your actions and give you statistics on how frequently you use its most prominent editing and refactoring capabilities. Go to Help | Productivity Guide to see how well you do:

...

One of the goals for MPS 2.5 release was making our platform modular. By exploring Plugins page in setting dialog it's easy to see increased number of plugin forming MPS 2.5 platform. If some plugins are not necessary for current tasks those plugins can be simply switched of increasing performance of the platform. Same trick can be used to create reduced IDE for some specific DSLs based on MPS.

Debugger

In order to make MPS more modular, the debugger API and the Java debugger itself were moved into separate MPS plugins. This allows the user to completely turn the functionality off when not needed. A migration script to upgrade code to the new debugger API has been included in the MPS 2.5 migration wizard. Additionally, a migration script named "Fix references to debugger classes" is available for manual execution.

New debugger features introduced in MPS 2.5:

  1. In the generic debugger:
    • Cell-based highlighting in tables.
      Image Removed
    • Toolbar with stepping actions in the Debugger Tool.
      Image Removed
  2. In the Java debugger:
    • "Copy value" action in the variables tree.
      Image Removed
    • Special highligting for breakpoints on which the debugger is not able to stop.
      Image Removed
    • Evaluate selection: Alt+F8 copies the selected code to the Evaluate window.
      Image Removed
    • High-level types and variable names are calculated for variables in the evaluation and watches windows. Low-level types (i.e. types from the generated Java code) are shown in brackets.
      Image Removed
  3. For developers of debugger extension:
    • isApplicable function is available in the breakpoints creators.
      Image Removed

A New option in Run Configuration for running MPS from MPS

A Run Configuration, which starts another instance of MPS from MPS, can now automatically open a selected project on start. You can either choose an arbitrary project path or open the current project that is already open in the current MPS instance. In the Latter case, the project file is copied into a temporary directory to avoid collisions between the two running instances.
Image Removed

Migration

If you already use MPS in your projects, you may benefit from reading our migration guide with detailed description of the migration process.