Cross Referenced Objects not initialized in ProposalProvider [message #1839429] |
Sun, 21 March 2021 09:07 |
Alfredo Aldundi Messages: 38 Registered: July 2009 |
Member |
|
|
I have been trying to restrict content assist as described in:
http://xtextcasts.org/episodes/17-restricting-scope?autoplay=true
It works perfectly fine, if I am in the same file. As soon as I start to place the "byes" into another file the greetings have no properties set (name = null and honest = false).
Grammar
Model:
greetings+=Greeting*
byes+=Bye*;
Greeting:
'Hello' name=ID honest?='!'?;
Bye:
'Bye' greeting=[Greeting]
;
ProposalProvider
public void completeBye_Greeting(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
lookupCrossReference(model, FooDslPackage.Literals.BYE__GREETING, acceptor, e -> {
Greeting greeting = (Greeting) e.getEObjectOrProxy();
// greeting.name is also null, honest always false if placed in another file
return greeting.isHonest();
}, getProposalFactory("ID", context));
}
What am I missing?!
I am using Xtext 2.24.0 and EMF 2.24.
|
|
|
Re: Cross Referenced Objects not initialized in ProposalProvider [message #1839430 is a reply to message #1839429] |
Sun, 21 March 2021 09:14 |
|
For the other files you just have the index entries there and thus Proxies
So you have two options
Add more information to the userdata map of the index entries (adapting IDefaultResourceDescriptionStrategy) And then us the userdata to filter in the proposal provider
Or resolve the Proxies in the context of the given context eobjects resource(set) (see ECoreUtil.resolve methods) but this will become terribly slow with bigger models
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Powered by
FUDForum. Page generated in 0.03552 seconds