LookupManager not getting all LookupElements

I'm using:

List<LookupElement> lookupItems = LookupManager.getActiveLookup(editor).getItems();

To get handles on the current LookupElements populated in the active lookup. The problem is that for some reason only 44 LookupElements go into lookupItems and I can't get access to the rest of the LookupElements that are available in the Lookup.

Official comment

To improve performance, only first several screens of lookup items are populated and sorted, the rest is loaded dynamically after the user scrolls. The best way to get all items seems to call com.intellij.codeInsight.lookup.impl.LookupImpl#getRelevanceObjects and extract keys from there.

LookupImpl#getRelevanceObjects(Iterable<LookupElement> items, boolean hideSingleValues)

Any idea what to plug into items?


Sorry, totally missed that parameter. It appears there's no public API yet for getting those. BTW why do you need all displayed items?



Ahh I see, thanks for the response. My plugin needs a way to access all methods/fields of object before dot operator and since code completion does this so well with the dot operator I've been using it exclusively.


How about PsiClass#getAllFields/getAllMethods/getVisibleSignatures?


Yea I'll be using that now :)


Please sign in to leave a comment.