Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Content Assist not displaying icon before keyword
Content Assist not displaying icon before keyword [message #1764926] Sat, 03 June 2017 22:09 Go to next message
Francisco Gonçalves is currently offline Francisco GonçalvesFriend
Messages: 5
Registered: May 2017
Junior Member
Hello,

In my grammar I have the need of having keywords with spaces, therefore I solved the warning this need creates by doing the following:
Status:
      value = (NotPlan | 'Plan');
	  
NotPlan:
	'Not' 'Plan';


This works fine, but the content assist shows the following:
https://image.prntscr.com/image/70aa4451ae9d436bb1596926169af4f9.png

That is, displaying an icon before 'Plan' but not before 'Not Plan'.
But on the outline view, the icon is displayed before 'Not Plan'.

Does anyone know how to 'add' this icon for 'Not Plan' on the content assist suggestions?

Also, how do I sort these suggestions? e.g., 'Plan' before 'Not Plan'.

Thanks in advance!
Re: Content Assist not displaying icon before keyword [message #1764929 is a reply to message #1764926] Sun, 04 June 2017 06:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi,

since Xtext does no do any proposals on datatype rules i assume you badly implemented the proposal provider / label provider for that rule
(simple impl - for better implement the label provider)
class MyDslProposalProvider extends AbstractMyDslProposalProvider {
	
	@Inject
	private MyDslGrammarAccess ga;
	
	override complete_NotPlan(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
		super.complete_NotPlan(model, ruleCall, context, acceptor)
		val ICompletionProposal proposal = createCompletionProposal("Not Plan", "Not Plan",
				getImage(ga.notPlanRule), context);
		getPriorityHelper().adjustKeywordPriority(proposal, context.getPrefix());
		acceptor.accept(proposal)
	}
	
}



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Content Assist not displaying icon before keyword [message #1764932 is a reply to message #1764929] Sun, 04 June 2017 09:18 Go to previous messageGo to next message
Francisco Gonçalves is currently offline Francisco GonçalvesFriend
Messages: 5
Registered: May 2017
Junior Member
Good morning Christian,

It worked like a charm!

Thank you so much for your help!

Do you know how can I change the proposal for cross-references?

For example, I want to reference a WorkComponent named 'WorkComponent1', and the content assist suggests the following:
https://image.prntscr.com/image/661acc91ab4546918a89863c8c15da08.png

Is it possible to change this, to, for example, 'WorkComponent1 - nameAlias of WorkComponent1'?

Thank you once again!
Re: Content Assist not displaying icon before keyword [message #1764933 is a reply to message #1764932] Sun, 04 June 2017 09:29 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
am not sure what you mean, but the place where these proposals are created is as

org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.DefaultProposalCreator.apply(IEObjectDescription)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Content Assist not acting as expected
Next Topic:Content Sensitive Autocomplete
Goto Forum:
  


Current Time: Wed Sep 25 18:37:27 GMT 2024

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

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

Back to the top