Restricting scope to variables in the current file + keep a crossfile scope for another type [message #1810472] |
Mon, 12 August 2019 10:09  |
Eclipse User |
|
|
|
Hello,
So here's my grammar :
{VariableStatement} ('data') name=Variable ('TYPE') ('PACKAGE') varPack=package
| {VariableStatement} ('data') name=PackageVariable ('TYPE') (ServicePackage)?
Now i have lots of cross reference to this in multiple case whether it's used as a data: SingleData:
{SingleData} number
|=>VariableArray
| var=[VariableStatement]
or in statements :
ForeachStatement: ('FOREACH') (packVar=[VariableStatement] ('INTO') var=VariableName
Statements
('ENDFOR') ;
So far, the problem is that it references to all the variable of the project and i would like to have it restricted to only the variables declared in the current file.
I've tried multiple way like overriding the getScope but the problem is that it prevents my other typeof having a scope across files which i need.
I've also tried defining this kind of method : def IScope scope_VariableName(Model ctx,EReference r){
val root = EcoreUtil2.getContainerOfType(ctx, Model)
val allContentsCurrFile = EcoreUtil2.getAllContentsOfType(root,VariableStatement)
return Scopes.scopeFor(allContentsCurrFile)
}
but there are no changes to my issue which means variable will be validated even if they're declared in other files. And all variables of the project are in the content assist while i'd just like to have the local ones.
Does someone know how can i correct this issue?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04632 seconds