Dynamic content assist proposals order [message #1818402] |
Sat, 14 December 2019 09:29  |
Eclipse User |
|
|
|
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:
- 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.
- 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).
- Provide my own ICompletionProposalSorter in the hope that it will be lifted to JFace's CompletionProposalPopup but that didn't work.
- 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?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05263 seconds