I used the newly introduced great feature of xtext 2.8.3, the synthetic tokens, but what I'm facing is
- a lag with the proposals
- a validation error
Couldn't resolve reference to EStructuralFeature 'name'.
the problem is that the proposal didn't show up unless I typed the first character. I've overridden the method below but does not work very well
complete_BEGIN(EObject model, RuleCall ruleCall, ContentAssistContext context,
ICompletionProposalAcceptor acceptor)
and my scope
override getScope(EObject context, EReference reference) {
if (reference.name == "eType") {
val elements = Lists.newArrayList(EcoreUtil2.getRootContainer(context).eAllContents.filter(EClassifier))
return Scopes::scopeFor(elements)
} else if (reference.name == "feature" && context.eContainer instanceof Instance) {
var eClass = (context.eContainer as Instance).getEType()
Scopes::scopeFor((eClass as EClass).EStructuralFeatures)
}
super.getScope(context, reference)
}
and my grammar that uses them is
InstaceFeature:
feature+=[ecore::EStructuralFeature] value=ValueLiteral;
//
Instance returns ecore::EClass:
{Instance}
name=ID '=' 'new' eType=[ecore::EClass]
(BEGIN
features+=InstaceFeature*
END)?;
what I want to perform is the feature
in InstanceFeature
would contain the list of the structured features of the eType=[ecore::EClass]
in the Instance
object.