| ParserBasedContentAssistContextFactory.StatefulFactory mixing instances of the same grammar [message #1005785] |
Mon, 28 January 2013 12:41  |
Romain Bioteau Messages: 59 Registered: August 2009 Location: Grenoble |
Member |
|
|
Hello,
I have an issue with the content assist failing to lookup for cross references when I use an EmbeddedEditor. It works well in a classic editor part.
After some hours of debugging it seems to be an issue with the ParserBasedContentAssistContextFactory.StatefulFactory.
The parser is dealing with EObject of my grammar but from two different instances of my grammar model which lead to parsing issue and failed to create a proper ContentAssistContext ( with a non null current model).
To be more precise when the doCreateContexts(
INode lastCompleteNode, INode currentNode,
String prefix, EObject previousModel,
Collection<FollowElement> followElements) is called :
the followElements are contained in a Grammar with instance id @1919ef, but the currentNode.getGrammarElement() is contained in a Grammar with another instance id. Thus, during the parsing, when doing all the switches with eobject comparaisons it fails.
This is happening with the content assist of the embedded editor only !
As I'm not friendly at all with injection stuff, I'm not able to understand how I can end up with this strange behavior.
Does someone can help me with this ?
Best regards
Romain
R&D Engineer at BonitaSoft
|
|
|
| Re: ParserBasedContentAssistContextFactory.StatefulFactory mixing instances of the same grammar [message #1005874 is a reply to message #1005785] |
Tue, 29 January 2013 02:24   |
Sebastian Zarnekow Messages: 2788 Registered: July 2009 |
Senior Member |
|
|
Hi Romain,
please make sure that you do not (and never) use the STandalone setup of
your language within Eclipse.
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 28.01.13 18:41, schrieb Romain Bioteau:
> Hello,
> I have an issue with the content assist failing to lookup for cross
> references when I use an EmbeddedEditor. It works well in a classic
> editor part.
>
> After some hours of debugging it seems to be an issue with the
> ParserBasedContentAssistContextFactory.StatefulFactory.
> The parser is dealing with EObject of my grammar but from two different
> instances of my grammar model which lead to parsing issue and failed to
> create a proper ContentAssistContext ( with a non null current model).
>
> To be more precise when the doCreateContexts(
> INode lastCompleteNode, INode currentNode,
> String prefix, EObject previousModel,
> Collection<FollowElement> followElements) is called :
>
> the followElements are contained in a Grammar with instance id @1919ef,
> but the currentNode.getGrammarElement() is contained in a Grammar with
> another instance id. Thus, during the parsing, when doing all the
> switches with eobject comparaisons it fails.
>
> This is happening with the content assist of the embedded editor only !
>
> As I'm not friendly at all with injection stuff, I'm not able to
> understand how I can end up with this strange behavior.
> Does someone can help me with this ?
>
> Best regards
> Romain
>
>
|
|
|
|
| Re: ParserBasedContentAssistContextFactory.StatefulFactory mixing instances of the same grammar [message #1005884 is a reply to message #1005877] |
Tue, 29 January 2013 03:30   |
Romain Bioteau Messages: 59 Registered: August 2009 Location: Grenoble |
Member |
|
|
It solves the problem !
But it's really disturbing since the few doc I found on how to use the Embbed editor suggest to call the doSetup in the IEditedResourceProvider.
Thanks Sebastian, you save my day. But Ed is right, there should a protection or at least a bold line in documentation about this.
By the way, how can I access the injected fields such as the XTextResourceSetProvider ? I was directly calling the injector.getInstance(XTextResourceSetProvider.class) but it seems not to be the correct way.
Regards.
R&D Engineer at BonitaSoft
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01599 seconds