Weird Scope provider behavior [message #1053622] |
Mon, 06 May 2013 18:16  |
Eclipse User |
|
|
|
Hi all,
I have a grammar like this:
Model:
(CLass)* (Inst)*
;
Class:
'class' '{'
(variables += Variable ';')*
'}'
;
Variable:
'INT' name = ID ';'
;
Inst:
class = [Class] name=ID ';'
(variableSettings += VariableSettings ';')*
';'
VariableSettings :
instance = [Inst] '.' variable=[Variable] '=' value = INT ';'
;
I am trying to write a scope provider for variables referenced in VariableSettings to be scoped to the defined variables in the class of the instance.
My scope provider is:
IScope scope_Variable_variable (Variable var, ERefrence ref){
if(var.eContainer() instanceof VariableSettings){
return Scopes.scopeFor(((VariableSettings)var.eContainer()).getClass().getVariables())
}
return null;
}
The weired behavior I see is that when I try to use context helper (Ctrl+Space) the function call to scope_Variable_variable() gets called and in the popup box correct variables are displaying. But if I write any undefined variable after '.' the error doesn't get caught and the scope function is not called.
I tried moving VariableSettings to a level higher and writing it under Model, this works fine and the scope method gets called after I put '.'!
I really don't know how to solve this problem. My model is fixed so it is not possible for me to move VariableSettings under model. Do you know how to debug this? Where are these methods get called??
Thanks!
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08540 seconds