Skip to main content



      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 06:14 Go to next message
Eclipse UserFriend
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 11:36 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067797 is a reply to message #1067795] Wed, 10 July 2013 11:43 Go to previous messageGo to next message
Eclipse UserFriend
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 11:44 Go to previous messageGo to next message
Eclipse UserFriend
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 11:55 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067811 is a reply to message #1067803] Wed, 10 July 2013 12:39 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Content Assist for JvmTypeReference stops working when redefining its syntax [message #1067996 is a reply to message #1067811] Thu, 11 July 2013 11:28 Go to previous message
Eclipse UserFriend
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: Mon Jun 30 23:18:59 EDT 2025

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

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

Back to the top