alternative getVariants()

When using PsiReference, the method getVariants() is used for auto
completion, right?
But what if the method is too complex or produces an large amount of
entries? Eq. List of Classes in the project.
There is also PsiJavaReference but there are so many strange methods to
be implemented.

Help, please!

2 comments
Comment actions Permalink

Hello Sven,

SS> When using PsiReference, the method getVariants() is used for auto
SS> completion, right?
SS> But what if the method is too complex or produces an large amount of
SS> entries? Eq. List of Classes in the project.
SS> There is also PsiJavaReference but there are so many strange methods
SS> to be implemented.

For custom languages, PsiReference.getVariants() is the only supported API
for implementing completion. The large amount of entries should not be a
problem.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Umhhh, I am not sure about that.
We have an custom web-language which contains references to
java-classes. So when auto-completion, I have to return
- all classes of the project
- all methods/fields of the related java-class
Should I really return an array with all that stuff in it?

Dmitry Jemerov (JetBrains) schrieb:

Hello Sven,

SS> When using PsiReference, the method getVariants() is used for auto
SS> completion, right?
SS> But what if the method is too complex or produces an large amount of
SS> entries? Eq. List of Classes in the project.
SS> There is also PsiJavaReference but there are so many strange methods
SS> to be implemented.

For custom languages, PsiReference.getVariants() is the only supported
API for implementing completion. The large amount of entries should not
be a problem.

0

Please sign in to leave a comment.