Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Content Assist for JvmTypeReference stops working when redefining its syntax
Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067727] Wed, 10 July 2013 10:14 Go to next message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Hi,

In a grammar using org.eclipse.xtext.xbase.Xbase, I redefine JvmParameterizedTypeReference as following:

JvmParameterizedTypeReference:
type=[JvmType|QualifiedName] (=>'[' arguments+=JvmArgumentTypeReference (',' arguments+=JvmArgumentTypeReference)* ']')?;

In order to change how are specified type parameters in JvmTypeReference.

When I do that, content assist stops working for references...

Is there something I should override for it to work?

Thanks
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067795 is a reply to message #1067727] Wed, 10 July 2013 15:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi how do your imports look like?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067797 is a reply to message #1067795] Wed, 10 July 2013 15:43 Go to previous messageGo to next message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
My imports are classical, since they are not using type references, I'm using the XImportSection, and it works well actually.

I think I may have found a reason for why content assist does not work: the generated AbstractProposalProvider contains methods that override those that were redefined in XbaseProposalProvider concerning completeJvmParameterizedTypeReference_Type!
If I re-override it with the content of the method from XbaseProposalProvider, content assist work but in a slightly different way than if I didn't had redefined JvmParameterizedTypeReference.

For example when completing String, the proposal contains first some inner class starting with String (in classes not starting with String), then the classes starting with String...
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067798 is a reply to message #1067797] Wed, 10 July 2013 15:44 Go to previous messageGo to next message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Or you meant in my grammar?

Like that:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.xbase.Xbase

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

import "http://www.eclipse.org/xtext/common/JavaVMTypes"
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067803 is a reply to message #1067798] Wed, 10 July 2013 15:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Yes I meant this will have a look later in the evening

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067811 is a reply to message #1067803] Wed, 10 July 2013 16:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi,

hi i am not sure what proposals you are missing.
a simple look at the proposalprovider would have shown that magic in the xbaseproposalprovider is hidden.
(completeJvmParameterizedTypeReference_Type)

so you have to copy and paste

override void completeJvmParameterizedTypeReference_Type(EObject model, Assignment assignment,
			ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
		if (getXbaseCrossReferenceProposalCreator().isShowTypeProposals() || getXbaseCrossReferenceProposalCreator().isShowSmartProposals()) {
			completeJavaTypes(context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, acceptor);
		}
	}


for [] you may have to customize isKeywordWorthyToPropose too

i am not sure if this is a bug or not.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067996 is a reply to message #1067811] Thu, 11 July 2013 15:28 Go to previous message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Hi, thanks for your answer, and the solution you propose is the one I talked about in my previous answer Wink

I'm wondering if it is a bug that by default it gets hidden...

For the [ ], the only thing I had to be careful of is to disable support for arrays as they use the same characters (but I don't need them so it's ok).
Now is that good idea to have started using []? Maybe not Smile
Previous Topic:Namespace Imports in Embedded Editor
Next Topic:Post-processing the generated genmodel?
Goto Forum:
  


Current Time: Wed Sep 25 15:57:51 GMT 2024

Powered by FUDForum. Page generated in 0.02415 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top