Child pages
  • MPS plugin for IntelliJ IDEA
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

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 tightly with other elements of the project. This document will guide you through the details of how to setup IntelliJ IDEA so that you can use the MPS plugin aongside your Java code.

Integration with the IntelliJ IDEA Project structure.

To enable the MPS features inside a particular java project module, you simply add the MPS facet to the module through the Module Settings dialog:

We recommend you to create a dedicated Java Source Root folder to store the MPS model files.  Use the Add Model Root button on the Soures tab of the MPS Facet configuration page:

Model root folders look just like any other source roots in IntelliJ IDEA. In addition to the the regular source roots it is possible to create MPS models in Model Roots:

When creating a new model, you have to specify its name and choose one of the available model Kinds through the Create New Model dialog:

Each model Kind in this case represents a preconfigured set of used languages for the model. This is a convenient shorthand that still allows you to tune the list of used languages manually at any time through the Model Properties dialog by pressing Alt+Enter on the model node inside the Project Tree:

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:

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

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:

Code Generation.

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

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:

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>


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:

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 persistence-specific way:


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:


MPS plugin distribution contains 4 separate plugins now, so some MPS functionality can be easily switched off by disabling corresponding plugins in the same time user-specific DSLs can be packaged as a separate plugins and distributed together with MPS plugins to provide IDEA developers with your own powerful DSL features.

  • No labels