Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Dynamic content assist proposals order(Change the order of proposals as the user types)
Dynamic content assist proposals order [message #1818402] Sat, 14 December 2019 09:29 Go to next message
Eclipse UserFriend
Hi,

I am using Xtext 2.14 and I would like to provide an autocomplete that matches all the proposals that contain what the user typed. For example, if the user types na then the autocomplete should show name and enable.

No problem so far: I extended the generated AbstractMyDslProposalProvider and used a custom PrefixMatcher.

My issue is that I would like to order the proposals so that the proposal which starts with what the user typed is shown first. To continue my example, name should be shown before enable. However by default Xtext orders alphabetically and I can't use ConfigurableCompletionProposal's priority because the order may change as the user types. I hence need to re-order the proposals each time the user types or erases something.

I tried the following:

  1. Provide my own IContentProposalPriorities; it is never used. Actually, by looking at uses of the interface I have the feeling that I am the one supposed to use it, so it cannot provide any dynamic ordering.
  2. Provide my own ICompletionProposalComparator; although I can re-order proposals I do not have access to what the user typed (i.e. what Xtext calls the prefix).
  3. Provide my own ICompletionProposalSorter in the hope that it will be lifted to JFace's CompletionProposalPopup but that didn't work.
  4. Dynamically change proposal's priority in the corresponding PrefixMatcher but the change was ignored.

Note: by "provide" I mean adding a bind*() method in MyDslUiModule.

Would anyone have another idea I could try?
Re: Dynamic content assist proposals order [message #1818404 is a reply to message #1818402] Sat, 14 December 2019 09:41 Go to previous messageGo to next message
Eclipse UserFriend
maybe you can store the information in the configurable completion proposals additonal data
Re: Dynamic content assist proposals order [message #1818405 is a reply to message #1818404] Sat, 14 December 2019 11:26 Go to previous messageGo to next message
Eclipse UserFriend
You mean to access the prefix from the ICompletionProposalComparator? I tried but sadly the comparator seems to be used only once when the content assist popup is shown; it is not called again when the user types. My bad for not having specified it.
Re: Dynamic content assist proposals order [message #1818407 is a reply to message #1818405] Sat, 14 December 2019 11:33 Go to previous message
Eclipse UserFriend
sorry then i have no idea
Previous Topic:Build a language server for DSL
Next Topic:[Newbie Q.] Grammar Failing: Element: -UNKNOWN-
Goto Forum:
  


Current Time: Wed Jul 09 08:42:14 EDT 2025

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

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

Back to the top