Child pages
  • What's new in MPS 2017.2 PPV
Skip to end of metadata
Go to start of metadata

Public Preview

Running Editor tests in IDEA Plugin

With the new JUnit test suite (jetbrains.mps.idea.core.tests.PluginsTestSuite) it is possible to execute editor tests for your language within MPS plugin for IntelliJ IDEA. To make use of this functionality you have to create simple ANT script installing all necessary plugins into IDEA platform & executing tests by specifying test module name(s). Demo will be provider.

Migration Assistant in Idea Plugin 

Language migrations are now supported in IntelliJ IDEA plugin.

Whether a migration was added to some MPS language used in IDEA project, the Migration Assistant will be shown and models in the projects will be updated to the newer languages.

Migration tests

Testing migration scripts becomes more convenient with Migration test cases. Migration test cases allow testing migration scripts by running them on specified nodes and checking produced result. See documentation page for details.

Two step deletion

Sometimes it is hard to predict what part of the code will be deleted when you press Delete or Backspace. For example, when the caret is on the semicolon of the baseLanguage statement and you press Backspace, the whole statement will be deleted.
With the two step deletion feature, you now can see what part of the code which will be deleted.
Here how it works: you press Delete or Backspace and the part of the code which will be deleted becomes highlighted. If it suits you, you press Delete or Backspace again and the code will be deleted. If after highlighting you realize that you don't want to delete this piece of code you can press Escape or just move the caret and the highlighting will disappear.

Let's see the example:
Put the caret to the statement semicolon.

Press Backspace. The whole statement is highlighted. This means that if you press Backspace again, the statement will be deleted.

Press Backspace again. The statement is deleted.


The same works by default for other nodes.

Note that if the node is selected, it will be removed immediately without highlighting. Also if the caret is on the editable text cell, the text parts will be also removed immediately.

To turn on the two step deletion, check the "two step deletion" checkbox in Preferences > Editor > General

The language designer may include the two step deletion scenario in her custom delete actions.

The ApproveDelete_Operation in jetbrains.mps.lang.editor is introduced for that purpose. This operation is applied to the node:

This operation returns true iff it succeed and the node was approved for deletion, or more formally all the following conditions were met:

1) The two-step deletion preferences option is checked.

2) The node was not fully selected.

3) The node was not approved for deletion already.

In this case, the node approved for deletion is highlighted and the custom delete action may stop.

If the same custom delete action is called immediately after approving the deletion, the operation will return false (because the node is approved already) and the action will proceed with the deletion.

Let's see the typical scenario from the baseLanguage:

This is the part of the delete action for the Dot_Expression's operation.

This action as described before firstly tries to approve the operation for the deletion and if succeed it stops.

If not, that means that either node's operation is already approved (= highlighted), or the operation is selected by the user or the "two step deletion" preferences option is turned off. In this case, we delete the operation and replace it with the node of the abstract concept.

Sometimes the custom delete action is more complicated than just deleting the node. This leads to more complicated changes of the editor. For those cases, we can specify the cell for deletion approving.

Let's see the scenario: we press delete on the "final" keyword on the IncompleteMemberDeclaration. There is the custom action which sets the final property to false. In the editor, there is the cell which is shown only if the final property of the node is true, so after the action, the cell wouldn't be shown.

If we want to highlight the final keyword, we approve it for the deletion:



  • No labels