MPS 2021.1 Help

Building MPS language plugins

Distributing languages as plugins for MPS is very similar to packaging languages for IntelliJ IDEA.You follow the same instructions described in Building IntelliJ IDEA language plugins with two important differences:

  1. Your build script should depend on mps as you can see in the attached screen-shot.

    Build15

    Additionally, by depending on mps your languages can leverage the whole MPS infrastructure and the whole set of languages, while mpsPlugin restricts IDEA plugins to only the subset of functionality that is available in IntelliJ IDEA.

  2. When running your Ant build script from the command line, you set an artifacts.mps property (instead of artifacts.mpsPlugin) and make it point to an MPS installation home directory.

    Build16

    Note: Since in the example build script above we set the artifacts location for mps to $mps_home , we may set -Dmps_home instead (necessary only if the MPS location on the build machine differs from the path set in the build script).

The generated plugin can then be imported into MPS. You can install the plugin either manually or through the MPS plugin manager. If installing manually, the downloaded plugin zip file must be unzipped into the MPS plugin folder.

  • Windows and Linux: typically USER_HOME/MPS_version/config/plugins or MPS_HOME/plugins

  • MacOS: ~/Library/Application Support/MPS_version/ or MPS_HOME/plugins

After restart the imported languages will become available in MPS.

Control visibility of modules in a plugin

By default, MPS assumes that all modules coming from language plugins should be visible to the end user. This is, however, not always the optimal strategy. With the number of languages growing and also with the complexity of the plugins rising, there are cases when the language designers want to hide certain modules from the end user. These modules will still be present and working, but the end user will not be shown these in the dialogs when selecting modules to import. This is useful in order not to confuse/overwhelm the end user with huge number of unrelated languages or solutions.

The plugins tell MPS about modules that they contribute by the means of the com.intellij.mps.LanguageLibrary extension point. Extensions to that extension point may provide an optional hide="true" attribute. This will make all modules of the plugin eligible to potential filtering. To enable filtering, a pattern must be specified using com.intellij.mps.VisibleModuleMask and the extension point that it defines.

Last modified: 29 April 2021