Odd behaviour with references in MPS editor

Hello forum!

I've got following setup (concepts -> editor):

foreach (child: condition[1]) -> [- foreach ( % condition % ) -]
condition (reference: person[1]) -> [- ( % person % -> { name } ) -]
person (property: name:string)

Now when I want to choose my condition (picture underneath), MPS says that Error: no reference in role "person" (declared cardinality is 1).

Unfortunately, I the editor doesn't let me choose in the intellisense menu from the persons, which I've defined. Yes I've defined an alias for my condition -> myCondition. I also tried to set the attracts focus property of the person child in the editor aspect. I had no luck with that.

How can I let MPS replace that condition intellisense menu with the person intellisense menu?

Update: when I add a constant to my condition editor, it works as expected.

[- condition: ( % person % -> { name } ) -]

Regards

msch95

 

6 comments

Have you tried removing the alias from your condition concept?

0

Yeah, but I don't want that, because I've multiple conditions to choose from. I know that it works without an alias, I just want to figure out how to do it with an alias..

This is just a simple example, which describes my problem.

0

Do you want to first choose myCondition and then press a second time ctrl+space and choose the person?

0

That's right, Sascha! :]

I never get to choose a person from the person intellisense menu. I can't figure out why.

0

In the editor of your condition you can place an empty constant (selectable: false, punctuation-right: true) in front of the reference cell. The problem is, that otherwise you are both, at the beginning of the condition node and at the reference cell. MPS then has to make a decision which menu is shown (for replacing the node or for changing the reference target).

1

That's the hack I've been looking for! Thanks Sascha!

0

Please sign in to leave a comment.