Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » content assist
content assist [message #1770274] Wed, 09 August 2017 14:48 Go to next message
Susie Agerholm is currently offline Susie AgerholmFriend
Messages: 54
Registered: April 2017
Member
I have a grammar element, that look like this:

Joint:
	'Joint' name=ID
	(('def'  'ChildOf' childOf=[Link] 
			 'ParentOf' parentOf=[Link] 
			 'Type' type=JointType) 
			 ( origin=Origin | axis=Axis | limit=Limit | calibration=Calibration | dynamics=Dynamics | safetycontroller=SafetyController)* | 
	 
	 ('reuse' isReuseOf=[Joint] 
	 	'ChildOf' childOf=[Link] 
		'ParentOf' parentOf=[Link] 
	 	(reuse=Reuse)?
	 )
	)
;


origin, axis, limit, calibration, dynamics and safetycontroller are all optional, but if they are defined, they should not be repeated for a joint. I guess I need to define these optionals like an alternative in the grammar, so the user can define the optionals out of order and still get all available options suggested.


I don't want the content assist to keep suggesting keyword in the case, that particular assignment has already been made - e.g. if the joint already have an origin assigned, origin should not appear in content asssist suggestion box while defining the joint.

I have tried to make a custom proposal provider to override this method in the AbstractPropoposal provider. The method adds my proposal to the content assist, but it does not override the original suggestion - the Origin keyword still appears in the content assist?

override completeJoint_Origin(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val proposal="test adding stuff";
		
		val completionProposal = createCompletionProposal(proposal, context);
		acceptor.accept(completionProposal);
		
}

Re: content assist [message #1770276 is a reply to message #1770274] Wed, 09 August 2017 15:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
to you know the concept of unordered groups?

for your approach: you would have to override completeKeyword and dont call super to remove suggestions.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: content assist [message #1770292 is a reply to message #1770276] Wed, 09 August 2017 16:42 Go to previous messageGo to next message
Susie Agerholm is currently offline Susie AgerholmFriend
Messages: 54
Registered: April 2017
Member
thanks :) would like to use unordered group , is a lot nicer and cleaner, but ran into problems with it. The solution below seems to require at least one optional be present...and if I make the whole group optional I run into ambiguity problems...
origin=Origin? & axis=Axis? & limit=Limit? & calibration=Calibration? & dynamics=Dynamics? & safetycontroller=SafetyController?
Re: content assist [message #1770293 is a reply to message #1770292] Wed, 09 August 2017 16:58 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Can you share a complete but minimal grammar

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Expression Parser
Next Topic:Xtext 2.12 migration issue (ComputationExceptionStackOverflow)
Goto Forum:
  


Current Time: Thu Apr 25 15:07:56 GMT 2024

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

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

Back to the top