How to firstly suggest own list of annotations on after typing @ before java field
Answered
Hi community!
I want to have in a completion list my platform annotations first after typing '@' symbol before java field. They are already in the completion list by some out-of-the-box logic.
How can I change priority of my annotations on the suggestion list?
Thank you in advance!
Please sign in to leave a comment.
I found the solution in extending of com.intellij.psi.util.proximity.ProximityWeigher class. It allows to set weight of suggestion based on element and location.
Note that completion also "learns" from usage over time.
Do you mean I need to implement com.intellij.codeInsight.completion.CompletionConfidence?
No, that EP is unrelated to “sorting”. Your solution will work - most probably. Unless some other
Weigher
acts against it.Got it, thank you very much!