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!

0
5 comments

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.

0

Note that completion also "learns" from usage over time.

1

Do you mean I need to implement com.intellij.codeInsight.completion.CompletionConfidence?

0

No, that EP is unrelated to “sorting”. Your solution will work - most probably. Unless some other Weigher acts against it.

1

Got it, thank you very much!

0

Please sign in to leave a comment.