Child pages
  • MPS plugin for IntelliJ IDEA

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

MPS 2.5 can be run as a plugin for IntelliJ IDEA enabling MPS-based DSLs to be used directly in a Java IDE and so interoperate , interoperating tightly with other elements of the project.

Integration with IDEA Project structure.

To enable MPS features inside particular java project module one can simply add MPS facet to this module using Module Settings dialog:

Image Removed

It is recommended to create dedicated java source root for storing model files and specify it using Add Model Root button on Soures tab of MPS Facet configuration page:

Image Removed

Model root folders looks just like any other source roots in IDEA, but in addition to regular source root content it is possible to create models there:

Image Removed

It's necessary to specify model name and choose one of available model kinds inside New Model dialog:

Image Removed

Model kind in this case means a set of preconfigured used languages for new model. Used languages list can be always modified by pressing Alt+Enter on model node inside Project Tree:

Image Removed

Model Node in Project View represents MPS model contents and just like in MPS this it is similar to java package, so you can create model elements (Roots) inside it:

Image Removed

Similar to new model dialog you can specify new root name and kind (Concept) here:

Image Removed

Model root nodes are represented in Project View and looks very similar to other files in IDEA. Projectional editor can be opened by double-click on root node:

Image Removed

Code Generation.

The code will be generated for MPS models as a part of make/rebuild project actions:

Image Removed

It's possible to configure where to store generated sources inside MPS facet settings. Generated code can be used only during the compilation process and not saved on local disk, saved in another source folder of this module or saved in any other directory:

Image Removed

All generation-time errors are prorated into the Messages view just like any other compilation problems with possibility to navigate to corresponding model elements:

<create screenshot here>

Debugger.

Unfortunately it's not possible to run program using MPS nodes right node - generated code should be used to execute program, but it is possible to set a breakpoint directly inside DSL so IDEA debugger will be stopped in appropriate place to explore stack trace and variables:

Image Removed

Version Control

Just like in MPS you can use structural diff/merge tool working upon MPS models and rendering model content in domain specific rather then Although you need MPS in its entirety to create languages, IntelliJ IDEA represents a convenient additional channel for DSL distribution.

Image Added

Editor

Enabling MPS inside a Java module is as simple as adding the MPS facet to it. Just like in MPS you can create models, import any MPS languages and start instantiating the root nodes. The root nodes are displayed in the Project View together with the other project sources and files. The projectional editor for the root nodes opens directly in IntelliJ IDEA so all your code stays within a single IDE.

Image Added

Code Generation

The code generation process of MPS models is tied to the IntelliJ IDEA's make/rebuild project actions and so will be triggerred automatically. You hit Compile in IDEA and your MPS code gets generated and compiled as well. No need for extra steps.

The generation-time errors are propagated into the Messages View alongside all other compilation problems. You also have the possibility to navigate to the corresponding model elements by clicking on the displayed error:

Image Added

Version Control

When comparing versions or resolving conflicts in MPS models, you can rely on the MPS structural diff/merge tool, just like in MPS. The tool will render the model content in a domain specific rather then the persistence-specific way:

Actions

Most of the common MPS actions/refactorings/intentions are available in IDEA plugin from now and accessible with usual shortcuts like Ctrl+L for importing language:

Image Removed

Distribution

Debugger Integration

The MPS debugger has been integrated into IntelliJ IDEA as well. When debugging your Java code you can set breakpoints directly inside the DSL code and so the IntelliJ IDEA debugger will be stopped at the appropriate place allowing you to explore the stack trace and the variables.

Distribution

The MPS plugin distribution contains 4 separate plugins now, so some at the moment. Some of the MPS functionality can be easily switched off by disabling the corresponding plugins in the Plugins configuration dialog. At the same time, user-specific DSLs can also be packaged as a separate plugins and potentially distributed together with the MPS plugins to provide IDEA developers with deliver your own powerful DSL features to the IntelliJ IDEA developers.

Image Removed