MPS 2022.3 Help

Finding your way out

This document should give you instant step-by-step advice on what to do and where to look to get over a problem with MPS. It is an organized collection of patterns and how-tos fed with our own experience.

Reflective editor

Projectional editor by its nature presents the model to the user in a controlled way. Depending on the intent of the language designer the language may hide some information or some nodes from the user and prohibit some ways to manipulate the code. Also, if the editor definition is broken or incomplete in some sense, the editor may not allow the user to modify the code in a way she desires. Reflective editor provides the means to suppress the language editor and instead show the model in a default tree-like form. This way the developer has full and direct access to the model.

Ref1

Ref2

F5 returns the editor to the normal.

Node Explorer

The Alt/Control + X keyboard shortcut gives the user a way to visualise the AST that represents the piece of code that has been selected in the editor.

Exp1

Check out the type of the node

Knowing the type of the element you are looking at may give you very useful insight. All you need to do is pressing Ctrl+Shift+P and MPS will pop up a dialog window with the type of the element under caret.

Type

Check the concept of the node under carret

The Control/Cmd + Shift + S keyboard shortcut will get you to the definition of the concept of the node you are currently looking at or that you have selected.

Check the editor of the node under carret

The Control/Cmd + Shoft + E keyboard shortcut will get you to the definition of the editor for the concept you are currently looking at or that you have selected. This may be in particular useful if you want to familiarize yourself with the concrete syntax of a concept and all the options it gives you. 

Gte

Type-system Trace

When you run into problems with types, the Type-system Trace tool will give you an insight into how the types are being calculated and so could help you discover the root of the issues. Check out the details in Type-system Debugging.

Investigate the structure

When you are learning a new language, the structure aspect of the language is most often the best place to start investigating. The shortcuts for easy navigation around concepts and searching for usages will certainly come in handy.

Go to

You should definitely familiarize youself with Ctrl+Space (Go To Definition), Control/Cmd + N (Go To Root Node), Control/Cmd + Shift + S (Go To Concept Declaration) and Alt+F7 (Find usages) to make your investigation smooth and efficient.

Go to concept

Before you learn the shortcuts by heart, you can find most of them in the Navigate menu:

Navigate menu

Importing elements

You are trying to use an element or a language feature, however, MPS doesn't recognize the language construct or doesn't offer that element in the code completion dialog. So you cannot update your code the way you want. This is a simptom of a typical beginer's problem - missing imports and used languages.

  • In order to use language constructs from a language, the language has to listed among Used Languages.

  • To be able to enter elements from a model, the model must be imported first.

  • Also, for your languages to enhance capabilities of another language, the language must be listed among the Extended Languages.

Prop1

To quickly and conveniently add models or languages to the lists, you may use a couple of handy keyboard shortcuts in addition to the Properties dialog:

Model shortcuts

Save transient models

If you are getting errors from the generator, you may consider turning the Save Transient Models functionality on. This will preserve all intermediate stages of code generation for your inspection.

Transient on off
Transient

Why the heck do I get this error/warning?

Warning report

You see that MPS is unhappy about some piece of code and you want to find out why. Use Control + Alt + Click / Cmd + Alt + Click to open up a dialog with the details.

Warning dialog

The Go To Rule button will get you to the rule that triggers the error/warning.

Last modified: 10 September 2021