Community
Participate
Working Groups
Build Identifier: 2.3.0 if one customized IDefaultResourceDescriptionStrategy this changes will not be reflected in the local resource since scoping uses org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.internalGetAllDescriptions(Resource) which calls Scopes.scopedElementsFor(allContents, qualifiedNameProvider) => you have to customize the ImportedNamespaceAwareLocalScopeProvider too if you e.g. add user data to the index. it would be nice to have a default/optional shipped implementation that does this out of the box e.g. @Inject private IDefaultResourceDescriptionStrategy rds; @Override protected ISelectable internalGetAllDescriptions(final Resource resource) { Iterable<EObject> allContents = new Iterable<EObject>(){ public Iterator<EObject> iterator() { return EcoreUtil.getAllContents(resource, false); } }; final List<IEObjectDescription> allDescriptions = new ArrayList<IEObjectDescription>(); IAcceptor<IEObjectDescription> acceptor = new IAcceptor<IEObjectDescription>() { @Override public void accept(IEObjectDescription t) { allDescriptions.add(t); } }; for (EObject o : allContents) { rds.createEObjectDescriptions(o, acceptor); } return new MultimapBasedSelectable(allDescriptions); } Reproducible: Always
I agree the user data should be there for local elements, too. OTOH, the IDefaultResourceDescriptionStrategy.createEObjectDescription() also determines which elements should be indexed at all, i.e. referrable from the outside, by retrunning null. Local elements are by default always referrable. So your approach would only make the globally visible elements referrable locally. Feels like the IDefaultResourceDescriptionStrategy.createEObjectDescription is a bit overloaded.
So maybe we need a generic IEObjectDescriptionUserDataStrategy
I'd prefer a method boolean isIndexed(EObject) on the IDefaultResourceDescriptionStrategy.