How to control the completion order by custom algorithm instead of arranged by alphabetic order?

Answered

Hello, I am trying to use a custom algorithm(not machine learning) to decide the order of completion list. Is there some extension point available? I found the extension point `com.intellij.completion.ml.ranking` on the official website, but I just wanna to rearrange the completions order and I have no model , I would be appriciate if there is some resolution to my situation.Thank you!

0
1 comment

Each LookupElement can have a priority so you can create certain groups (or even giving each element unique priority number?) - check PrioritizedLookupElement

https://github.com/JetBrains/intellij-community/blob/idea/222.4345.14/platform/analysis-api/src/com/intellij/codeInsight/completion/PrioritizedLookupElement.java

It seems though that you are trying to alter completion of an existing language plugin? I've never done that, but there's a Decorator that might be used for it... as it state in doc: "Please decorate only when necessary, e.g. when intercepting other contributors"

https://github.com/JetBrains/intellij-community/blob/idea/222.4345.14/platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java 

0

Please sign in to leave a comment.