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.
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.
F5 returns the editor to the normal.
The 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.
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 Control + Shift + P and MPS will pop-up a dialog window with the type of the element under carret.
Check the concept of the node under carret
The Control + Shift + S/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 + Shift + E/Cmd + Shift + 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.
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.
You should definitely familiarize youself with Control + B / Cmd + B (Go To Definition), Control + N / Cmd + N (Go To Concept), Control + Shift + S / Cmd + Shift + S (Go To Concept Declaration) and Alt + F7 (Find usages) to make your investigation smooth and effitient.
Before you learn the shortcuts by heart, you can find most of them in the Navigate menu:
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.
To quickly and conveniently add models or languages to the lists, you may use a couple of handly keyboard shortcuts in addition to the Properties dialog:
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.
Why the heck do I get this error/warning?
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.
The Go To Rule button will get you to the rule that triggers the error/warning.