Following to my question: here I am trying to customize the scoping. I want that in scope of 'Predicate' in my language some of objects will be visible in the scope, types like 'typeDef'.
Predicate:
'predicate' name=ID ('(' params=TypedParamList ')')?
(':' body=TemporalExpression TOK_SEMI)
| ('{' body=TemporalExpression '}');
TypeDef:
'type' name=ID '=' type=VarType TOK_SEMI;
Here is some example of my language:
type
move = {left, right};
predicate stop(move m1, move m2) :
m1=left and m2=right;
It's not recognize left and right.(can't resolve reference)
I tried something like this:
val allContentsCurrFile = EcoreUtil2.eAllOfType(context,TypeDef)
val allContentsCurrFile2 = EcoreUtil2.getAllContentsOfType(context,TypeDef)
I putted this as parameters to the Scopes.scopeFor method (in addition to the params of Predicate) and this isn't worked for me. I don't know how to do it, how to find all the instances of specific type in current file so the cross reference will work in the Predicate scope.
Thanks.