Assignment action

Hey forum!

I have a custom assignment named Instruction. Instruction has a left and a right child. I want to create the right child and focus the right node when the operator "=" is typed. So my editor should look like this:

%left% = %right%

Then I created an edit an side transform action for instruction. Then I added a custom item with matching text "=". But unfortunately, the editor doesn't focus %right% when "=" is typed.

What's wrong here? Thanks!

Regards

msch95

3 comments

Is the side transform action called?

If not , you might have to add a constraint, so that "=" can't be part of the name of the left left child. Because as long as "=" can be part of a name the editor is just going to add "=" to the name instead of calling the sidetransformation.

Look under Constraint -> property Constraint  of the concept of the left child.

0

If the side-transform gets triggered and the problem is in the focus only, then you probably need to explicitly set the desired cell to focus. After importing the jetbrains.mps.lang.editor language, add something like this to your handler:

sourceNode.select[in: editorContext, cell: LAST_EDITABLE];

Vaclav

 

0

Thanks guys! The editor context did the trick!

0

Please sign in to leave a comment.