Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to change order of proposals
How to change order of proposals [message #1127838] Mon, 07 October 2013 04:18 Go to next message
Yen Mai is currently offline Yen MaiFriend
Messages: 1
Registered: October 2013
Junior Member
Hi all,

I'm trying to make some changes in ordering of proposals when using Ctrl + Space.

Basically, I don't want to filter any elements - i.e. all the elements that are accepted by grammar will be showed. What I want to change is the ordering of those elements, so that I can have all the valid elements will be displayed on top (very similar with Java's CA in Eclipse)

There is a set of conditions like check constant elements, type-compatible to decide the priority of element in suggested list. Base on the current context, the complete model and proposed element, I need to adjust the priority.

Problem came: I cannot find any good way to adjust the default priority.
I've tried to follow this post
http:// malubu.wordpress.com/2011/05/30/my-proposals-my-order/
but it seems the ordering is based on text, it will be the same for every model and context.
(** Sorry I have fewer then 5 messages, so I cannot use external links)

Recently, I tried another way, to extend ReferenceProposalCreator and change the priority when lookupCrossReference(). By this way, I got the model and able to do some logic check for type compatible... But I still cannot get the context. Something like the following now bother me:

methodReturnArray(|)[]
methodReturnArray(arg1)[|]

The model I got from both case above is the same, but you can see they are different context. First case, all integer variables need to be on top. Second case, all variables that match with method arguments need to be on top.

Is there anybody experience with something similar? I really appreciate any comment and suggestion...
Re: How to change order of proposals [message #1129580 is a reply to message #1127838] Tue, 08 October 2013 19:46 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
HI,

what do you mean: i dont get the context?

depending on your grammar it can occur that the object passed as a param may be a parent parent parent so you wont be
able to get stuff from contect.getCurrentModel

maybe it helps to work with the node model (getCurrentNode, ....)

therefore you may have to hook in earlier at a point there the contentassistcontext is still available.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:How to translate a .g file (ANTLR grammar file) into xtext file automatically
Next Topic:How does one report errors in an IGenerator implementation?
Goto Forum:
  


Current Time: Fri Apr 19 19:57:53 GMT 2024

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

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

Back to the top