strange completion [message #844060] |
Fri, 13 April 2012 12:39  |
Eclipse User |
|
|
|
Hello,
I have little problem, when completion is "too late"...
My grammar:
Model:
elements += Elements*
;
Elements:
EntityA|FinalEntity
;
EntityA:
'A' name=ID '{'
entityCs+=EntityC+
'}'
;
EntityC:
'C' name=ID '{'
entityDs+=EntityD+
'}'
;
EntityD:
'D' name=ID
;
FinalEntity:
'X' a=[EntityA] '{'
assignments += Assignments+
'}'
;
Assignments:
AssignmentA|AssignmentB
;
AssignmentA:
c=[EntityC] refs=DRef? '=' v=INT
;
AssignmentB:
c=[EntityC] refs=DRef? '==' v=INT
;
DRef:
'.' d=[EntityD]
;
My scope functions:
IScope scope_Assignments_c(FinalEntity fe, EReference reference){
return Scopes.scopeFor(fe.getA().getEntityCs());
}
IScope scope_Assignments_c(Assignments asgn, EReference reference){
EntityA a = EcoreUtil2.getContainerOfType(asgn, FinalEntity.class).getA();
return Scopes.scopeFor(a.getEntityCs());
}
IScope scope_DRef_d(DRef dref, EReference reference){
EntityC c = EcoreUtil2.getContainerOfType(dref, Assignments.class).getC();
return Scopes.scopeFor(c.getEntityDs());
}
IScope scope_DRef_d(Assignments asgn, EReference reference){
DRef refs = asgn.getRefs();
if(refs!=null){
DRef dref = (DRef) refs;
EntityC c = EcoreUtil2.getContainerOfType(dref, Assignments.class).getC();
return Scopes.scopeFor(c.getEntityDs());
}
return IScope.NULLSCOPE;
}
My model:
A aa {
C cc {
D dd
}
}
X aa {
cc.dd = 5
}
Everything works perfect, there is a problem only when I try to complete "dd" in DRef. If I write "." and Ctrl+Space, no completion is offered. If I write one more letter, it offers the completion very well.
What am I doing wrong?
Thank you,
Michal
[Updated on: Fri, 13 April 2012 12:41] by Moderator
|
|
|
|
Re: strange completion [message #844406 is a reply to message #844112] |
Fri, 13 April 2012 21:00   |
Eclipse User |
|
|
|
Hello Christian,
thank you for your answer.
I was afraid that you give me this solution... It forces me to make changes in the validator, generator, etc., but I will manage 
Additional question: I understand, why the context is an FinalEntity. But: Why does it not recognize '.' as it does with normal keyword? (Basically, when any entity is being defined, the model is invalid, isn't it? -> but completion works... There is no other alternative for '.' starting rule in the grammar available at this place.)
Thank you & Best regards,
Michal
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04739 seconds