
If you would like to order one mug with the most useful MPS Shortcuts printed on it, like the one in the image, Send an e-mail to us with the button below.
JetBrains MPS is a large and complex system that has been developed for approximately 15 years. It has a lot of windows, toolboxes, settings and tabs. A skilled user can work with it almost entirely with a keyboard in a very fast manner by using keybinds. Learning all of these shortcuts and trying to use them looks daunting to newcomers and that’s why we decided to write a post where we will go through the most useful shortcuts and explain how they are used and in what context.
Before we start it’s very important to understand nodes and their structure. Almost everything in MPS is a node. Therefore it is vital to learn how nodes work so we understand what is happening in the editor and why sometimes the application works in ways that we are not expecting it to. For further explanation refer to our getting started with MPS post.
Node hierarchy works in a tree structure. |
The following three things define the Project structure, presented in the logical view. |
Root nodes are the top-most elements of a model. They are things like classes, enums, concepts and concept editors, but they can also be custom root nodes that are from concepts of our creation, like the "The Bookshelf" Library one in the following image.
Models are what organizes the root nodes. They hold meta information about what models they use, languages that they are written in, information about the model file and special generator parameters. For example - the structure aspect is a model of the Library language Module. In it we group all root nodes relating to the language structure.
Modules organize models into higher level entities. There are four types of modules in MPS: solutions, languages, devkits and generators.
For more information on the project structure see the MPS documentation. |
Move node up |
Move node down |
|
![]() |
Ctrl+Shift+↑ |
Ctrl+Shift+↓ |
![]() |
⌘+Shift+↑ |
⌘+Shift+↓ |
This shortcut is used to move selected nodes backwards and forwards in a list in their respected level (see Tree structure).
If we select parent 2
and move it with this shortcut we will move it in the Level 2
layer not up or down to Level 1
or Level 3
.
Nodes do not need to be selected. The cursor pointing to the node in question is also enough to move chosen node. |
This works for any node — it works in BaseLanguage and in language editing tabs like concepts, editors, generators etc.
![]() |
Ctrl+/ |
![]() |
⌘+/ |
This action helps with faster commenting of multiple selected lines. If we want to comment out just one line we could also write "//" at the beginning of the line but the shortcut is better because the cursor doesn’t need to be at a specific place. If the line is already commented out we can use the shortcut again to uncomment it.
![]() |
Ctrl+D |
![]() |
⌘+D |
This action duplicates selected nodes or the node at the current cursor.
Previous entry |
Next entry |
|
![]() |
Shift+↹ (Tab key) |
↹ (Tab key) |
![]() |
⇧+↹ (Tab key) |
↹ (Tab key) |
These actions help us with navigation inside the main editor. With them we move the cursor to next or previous node that can be edited.
Select sibling |
Deselect sibling |
|
![]() |
Shift+↑ |
Shift+↓ |
![]() |
⇧+↑ |
⇧+↓ |
With these actions we can (De)Select Siblings of the current selected node or cursor location. They select nodes sideways in the Tree structure.
Select parent |
Deselect parent |
|
![]() |
Ctrl+↑ |
Ctrl+↓ |
![]() |
⌥+↑ |
⌥+↓ |
With these actions we can (de)select parents of the current selected node or cursor location. They select nodes up or down in the Tree structure.
These actions help us with project navigation (more information can be found in the docs).
![]() |
Ctrl+B or Ctrl+left-Click |
![]() |
⌘+B or ⌘+left-Click |
With them we can go to node and code definitions. They are very useful when we need to check out definitions from our project and the modules pool.
Navigate back |
Navigate forward |
|
![]() |
Ctrl+Alt+← |
Ctrl+Alt+→ |
![]() |
⌘+⌥+← |
⌘+⌥+→ |
These actions move through the history of the current open tab in the main editor. It works like a browsers back and forward buttons.
This toolbar can be opened from the menu at
.![]() |
![]() |
Esc |
This action brings back the focus to the main editor if we have clicked somewhere else or used another MPS window or menu.
![]() |
Ctrl+F4 |
![]() |
⌘+W |
Closes the currently focused window in MPS e.g. a tab in the main editor, the logical view or the inspector.
Switch previous editor |
Switch next editor |
|
![]() |
Ctrl+Shift+↹ (Tab key) |
Ctrl+↹ (Tab key) |
![]() |
⌃+⇧+↹ (Tab key) |
⌃+↹ (Tab key) |
This opens the Switcher window that cycles through various windows and open main editor tabs. (JetBrains Switcher)
Switch previous tab |
Switch next tab |
|
![]() |
Alt+Shift+← |
Alt+Shift+→ |
![]() |
⌃+⇧+← |
⌃+⇧+→ |
This switches the tabs in multi-editor tabs like the Language structure editors.
Switch left editor |
Switch right editor |
|
![]() |
Alt+← |
Alt+→ |
![]() |
⌃+← |
⌃+→ |
This switches to the left or right open editors in the main window. With them we navigate the tabs inside the orange rectangle.
![]() |
Ctrl+E |
![]() |
⌘+E |
Opens the Recent Files window that has links to useful windows and recently used files.
For more information about editor navigation see the MPS documentation. |
![]() |
Ctrl+F |
![]() |
⌘+F |
Opens the find menu that allows us to search for strings in the current editor.
Find previous text |
Find next text |
||
![]() |
![]() |
Shift+F3 |
F3 |
When the main editor is focused and a find dialog is set up to search for a string, these shortcuts move the cursor to the previous or next occurences relative to the cursor position.
![]() |
Alt+F7 |
![]() |
⌥+F7 |
Finds project-wide usages of the currently selected node.
![]() |
Ctrl+Alt+Shift+F7 |
![]() |
⌘+⌥+⇧+F7 |
Opens the find usages popup window that has options for searching usages of the currently selected node.
![]() |
Alt+F6 |
![]() |
⌥+F6 |
Finds all instances of currently selected concept. This works with concept and class declarations in most language editors.
Go to previous find result |
Go to next find result |
|
![]() |
Ctrl+Alt+↑ |
Ctrl+Alt+↓ |
![]() |
⌘+⌥+↑ |
⌘+⌥+↓ |
When a find usages or find instances task is open and executed we can move through the search results with these shortcuts.
For more information on finders see MPS documentation. |
![]() |
Ctrl+Alt+Shift+M |
![]() |
⌘+⇧+O |
Opens a small window that asks for a model name and displays search results in a drop-down list. User can navigate with ↑/↓ and Enter to select destination.
![]() |
Ctrl+Alt+Shift+S |
![]() |
⌘+⌥+O |
Opens a small window that asks for a module name and displays search results in a drop-down list. User can navigate with ↑/↓ and Enter to select destination.
![]() |
Ctrl+N |
![]() |
⌘+O |
Opens a small window that asks for a root node name and displays search results in a drop-down list. User can navigate with ↑/↓ and Enter to select destination.
![]() |
![]() |
F5 |
Refreshes error at current cursor location. This is useful when you’ve fixed an error but it still shows up in the editor.
![]() |
Ctrl+F1 |
![]() |
⌃+F1 |
Shows the error message in a popup bubble at the currently selected node, if there is an error.
Go to previous error |
Go to next error |
||
![]() |
![]() |
Shift+F2 |
F2 |
Jump to next/previous error relative to the current cursor location inside the main editor.
![]() |
Ctrl+Alt+R |
![]() |
⌘+⌥+R |
Go to the definition of the error that is at the current cursor location. This can be a constraint or typesystem root node. It’s usefulness is in tracking constraints in our project and/or rules that are defined by the Modules pool node, that we use in our DSLs.
![]() |
Ctrl+Space |
![]() |
⌃+Space |
This is one of the most used shortcuts. It’s going to be used everywhere we write code. It opens the Auto-complete popup and gives context specific suggestions. Use ↑/↓ and Enter to select entry for the current cursor location.
![]() |
Ctrl+Space |
![]() |
⌃+Space |
Use this to restart the auto-complete function so we start writing from the beginning of the node.
![]() |
Alt+Space |
![]() |
⌥+Space |
This is also one shortcut that is used a lot. It opens the Intentions popup that has context specific actions we can take with the current node.
![]() |
Ctrl+L |
![]() |
⌃+L |
Opens a popup window that allows us to search for languages that we can add to the current model’s Used Languages
inside the Model properties.
Use ↑/↓ and Enter to select the language dependency.
![]() |
Ctrl+M |
![]() |
⌃+M |
Opens a popup window that allows us to search for models that we can add to the current model’s Dependencies
list.
Use ↑/↓ and Enter to select the model dependency.
![]() |
Ctrl+R |
![]() |
⌃+R |
Opens a popup window that allows us to search for root nodes and add the model that contains it to the current model’s Dependencies
list.
Use ↑/↓ and Enter to select the model dependency.
![]() |
Ctrl+Shift+P |
![]() |
⌃+⇧+P |
This works on every node with a defined typesystem.
Opens the Type Explorer
window that shows the type of the currently selected node.
![]() |
Ctrl+P |
![]() |
⌘+P |
Opens a buble popup that shows possible method parameters that can be input in the method call at the current node. The cursor has to point to a method call for this to work.
![]() |
Ctrl+Shift+S |
![]() |
⌥+⇧+S |
Opens the concept declaration of the current node. This is useful to track down concepts from our project and the modules pool.
![]() |
Alt+Shift+E |
![]() |
⌥+⇧+E |
Opens the editor declaration of the currently selected node. This is useful to track down editor declarations from our project and the modules pool.
![]() |
Ctrl+H |
![]() |
⌃+H |
This works for BaseLanguage editors and concept node editors.
Opens the Hierarchy
window that allows us to track the inheritance of the currently selected node.
This is useful to inspect inheritance from our project and the modules pool.
![]() |
Ctrl+F10 |
![]() |
⌘+F10 |
Opens a pop-up window that shows the root nodes in relation to the currently selected root node. Works with Language root nodes.
![]() |
Ctrl+F12 |
![]() |
⌘+F12 |
Similar to the show structure shortcut but works with most nodes. It’s created from the root node’s descendants.
![]() |
Alt+2 |
![]() |
⌘+2 |
Opens the Inspector window or focuses on it if it’s already opened.
![]() |
Alt+F1, Enter |
![]() |
⌥+F1, Enter |
Alt+F1 opens the Select in
popup window that allows us to see the path of current node in various IDE locations.
Enter is to select the entry.
This is useful to track down nodes from our project and the modules pool.
![]() |
Alt+F2 |
![]() |
⌥+F2 |
Works similarly to the Select root in project pane but skips opening the Select in
popup window and directly points at the location of the node in the logical view.
The main difference is it jumps to the selected nodes, if we have activated the Show Members option in the Logical view.
This is useful to track down nodes from our project and the modules pool.
![]() |
Ctrl+Shift+A |
![]() |
⌘+⇧+A |
This is an exceptionally useful shortcut.
It opens the Actions
window that can show us context sensitive actions we can take.
It allows us to search for actions by name or by keybinding.
We can also remove the context sensitivity so we can search all MPS actions.
![]() |
Ctrl+F9 |
![]() |
⌘+F9 |
A very useful shortcut. This calls the make action. We will use this action very often because most of the time when we edit models we have to build them to see the difference they make in other models that are using them.
![]() |
Ctrl+Shift+F9 |
![]() |
⌘+⇧+F9 |
A very useful shortcut. This calls the rebuild action.
The difference between this shortcut and the previous one is that the make action builds only the selected models changed items, while the rebuild action recompiles everything, regarding the target, from scratch. Inside the Logical View next to the names of items we see (generation required).
If we were to run the make action inside the Library language only the structure and editor aspects would be recompiled. If we were to run the rebuild action everything inside the Library language would be recompiled.
Both make and rebuild actions are available on the model and module levels. |
Use the rebuild action in case make doesn’t build properly or something breaks after it. |
![]() |
Ctrl+Alt+T |
![]() |
⌘+⌥+T |
This action works with BaseLanguage in specific circumstances.
It opens the Surround with
popup window.
It allows us to define logic or loops fast.
We can call this action when the cursor has selected some code, at the end and the beginning of a node.
![]() |
![]() |
F6 |
Opens the Move nodes
window in which we can select a model that the currently opened node will be moved to.
![]() |
![]() |
Shift+F6 |
Opens the Rename node
dialog in which we can specify a new name for our node.
![]() |
Ctrl+Alt+V |
![]() |
⌘+⌥+V |
Works in BaseLanguage and is used for expressions. Moves the currently selected node to a variable definition.
![]() |
Ctrl+Alt+N |
![]() |
⌘+⌥+N |
Works in BaseLanguage. Does the opposite of the extract variable shortcut — Moves the currently selected node to an inline variable where it is being used.
![]() |
Ctrl+Alt+M |
![]() |
⌘+⌥+M |
Opens the Extract Method window that allows us to extract the selected nodes into a separate method inside the root node.
![]() |
Ctrl+I |
![]() |
⌃+I |
Opens the Select methods to Implement window. In it, we can choose methods that we can implement in the root node. It’s useful to quickly get a method header. Works when our node is implementing an interface or inheriting methods that must be implemented.
![]() |
Ctrl+O |
![]() |
⌃+O |
Opens the Select methods to Override/Implement window. In it, we can choose methods that we can override in the root node. It’s useful to quickly get a method header so we can override it. Works when our node is implementing an interface or inheriting methods that can be overridden.