I made a substitute menu which replaces the current node with another node if the child of the current node is of a specific type. To illustrate:
I instantiated two types of nodes, Child1 and Child2 somewhere. My node (let's name it ChildWrapper) contains exactly 1 child, an AbstractChildReference (so in practice, it can either reference a Child1 or a Child2 node). What I want from this substitute menu is that when my ChildWrapper contains Child1, replace it with Child1Wrapper, and if contains Child2, replace it with Child2Wrapper.
I already made this using a substitute menu included in a transformation menu, but I can't figure out how to automatically execute it. Right now I have to press ctrl+space and choose the correct action from the transformation menu, but I want it to happen automagically. Once I choose a Child2 node from the completion menu and press enter, I want to automatically replace my ChildWrapper with a Child2Wrapper.
Can I do this somehow?
(To elaborate a bit on my use case: The children I've declared are either Constants or Functions. However, a statement can't be just a constant, it has to be Constant = Value. So if I start my line with the name of a constant (I store it in a reference), then I want to replace my TermHolderStatement with a ConstantEqualsValue statement. However, if I start the line with a function, then I want to replace it with a FunctionStatement. Obviously, I could just ctrl+space at the beginning of the line and choose which one I want, a ConstantEqualsValue or a FunctionStatement, but that's not exactly comfortable from an editing standpoint. And since both start with a reference name, I can't use aliases to solve this.)