How to use Substitute menu (default) for removing an Item from (Ctrl + Space) options

As per MPS 3.4 documentation "The Side-transformation actions as well as Node substitute actions have been deprecated in MPS 3.4 and replaced by the new Transformation Menu Language".

I am trying to remove an item from code completion menu(Ctrl + Space). How to achieve it using Transformation Menu Language.
As per documentation "Substitute menu (default)" option should do the job, but not sure i am quite not able to achieve it.


Just define an empty default substitute menu for the concept, this should work. What do you mean by "not able to achieve it"? What have you done, what did you expect and what happened?


Also, just in case: you can only use either the (new) menus or the (old) actions. If you define both then only the actions will work and the menus will be ignored (that's for backward compatibility).


Thanks @Sergej for your responce.
I followed these steps:

1- Right click on editor of RobotKaja project --> j.m.s.Kaja language

2- New --> Substitute Menu (Default)  --> Click

3- For the newly created node it is showing:

default substitute menu for concept EmptyLine(The Concept where i want to filter) 
<< ... >>(Which option i suppose to select here out of thegiven)

I still don't know what you are trying to achieve, so here are some general notes.

Menus are looked up on a per-cell basis. The editor of EmptyLine defines a menu that has "replace with AbstractCommand", meaning that this cell's menu will show all descendants of AbstractCommand. You have to remove that menu (called "cell menu" in the editor). However, if a cell doesn't have neither a "cell menu" nor "transformation menu" specified, it is assumed that this cell is a simple decorative constant and no menu will appear when pressing Ctrl-Space on that cell.

You can explicitly specify e.g. "default menu for EmptyLine" for that cell, then that menu will appear on Ctrl+Space. Or you can create a named menu, fill it with whatever actions you want, and set it for the cell.

Now, some advanced stuff.

If you look in the default menu for empty line (EmptyLine_TransformationMenu) you'll find that it actually only defines items for the context assistant (location 'context assistant'). This means that the built-in behavior is used for the completion menu, but you can override it by adding to EmptyLine_TransformationMenu a new section with location 'completion'.

The built-in behavior is to include the menu(s) of superconcepts, so by default MPS will look for AbstractCommand_TransformationMenu and so on, until BaseConcept_TransformationMenu. BaseConcept_TransformationMenu actually exists and contains an instruction to include the appropriate substitute menu for the current link, so that's how a substitute menu gets included. Note that I said link: substitute menus are a bit different because they are looked up based not on the existing nodes and their concepts but based on the target link's concept.

In our case, an EmptyLine is part of a CommandList.commands collection, which is a collection of AbstractCommands. This means, that BaseConcept_TransformationMenu will include the substitute menu for AbstractCommand.

Substitute menus are similar to transformation menus but implicitly they work in the other direction: where transformation menu for AbstractCommand includes menus of its superconcepts (up to BaseConcept), i.e. walks up the hierarchy, the substitute menu for AbstractCommands includes menus for its subconcepts, including, for example, the substitute menu for EmptyLine.

If you want to change how one specific concept appears in substitute menus, for example, if you want to remove it or replace it with additional actions, then change that concept's substitute menu. For example, to remove EmptyLine from completion menus, add/edit the default substitute menu for EmptyLine and make it empty.

I hope this makes the inner workings of the menu system a bit more clear. If you have more questions, please ask.


Also, in the sample EmptyLine already has a default substitute menu, the fact that MPS lets you create a second one without displaying any errors is a bug and I have created an issue in our tracker to have it fixed.


Hi @Sergej, Thanks for giving an details explanation about the Menus. But let me put my question more specifically.

What i am doing prior to MPS 3.4 (Again i am taking the robot Kaja project):

- Going to the j.m.s.Kaja project right click on actions aspect new >> Node SubstituteActions

- Opening the newly created action item filling details

node substitute actions RemoveDrop 

substituted node: EmptyLine // <no description>
condition :

common initializer :
<no common variables>
<no supplemental initializer>

actions :
remove concept Drop

"This will remove the drop option from the code completion menu(Ctrl+Space) under the EmptyLine concept"

Now my question is how can i do the same with new MPS 3.4's Transformation Menu Language.



Create a default substitute menu for concept Drop and leave it empty.


Note that this will remove Drop from every substitute menu, not just for EmptyLine. If you want to remove it only from one specific menu for one specific cell, create a named transformation menu for that cell (cells cannot directly reference substitute menus, only transformation menus), create a section for location 'completion' and define what you want to have there.

It's no longer possible to simply remove actions from existing menus, you have to define a new menu that only contains actions you want.


@Sergej: Thanks for the answer, this is now quite clear to me.

It is not working as you directed. I mean the drop option does not got removed from EmptyLine code completion menu.

default substitute menu for concept Drop
<< ... >>


Sanjit, did you make(rebuild) the Kaja language?


Yes @Semen i did the rebuild:

I have this code for the Substitute menu

default substitute menu for concept Drop 
<< ... >>

With reference jetbrains.mps.samples.Kaja.editor.Drop_SubstituteMenu

It is strange if it is not working only for me alone:
Please find the image in the place i want to filter


Sanjit, I guess you're working with Kaja language which is not migrated.

Could you please check if the actions aspect of Kaja language you're working with contains not commented action builder in "WrapLogicalExpression".

If it does, it means that language should be migrated before new Substitute Menus start working.

If it does not, could you please send me the project to


Thanks for the help everyone i am able to do it using can substitute option available under default substitute menu .


Please sign in to leave a comment.