use of com.intellij.codeInsight.lookup.AutoCompletionPolicy in project intellij-community by JetBrains.
the class TextFieldWithAutoCompletionListProvider method addCompletionElements.
private static <T> void addCompletionElements(final CompletionResultSet result, final TextCompletionValueDescriptor<T> descriptor, final Collection<T> items, final int index) {
final AutoCompletionPolicy completionPolicy = ApplicationManager.getApplication().isUnitTestMode() ? AutoCompletionPolicy.ALWAYS_AUTOCOMPLETE : AutoCompletionPolicy.NEVER_AUTOCOMPLETE;
int grouping = index;
for (final T item : items) {
if (item == null) {
LOG.error("Null item from " + descriptor);
continue;
}
LookupElementBuilder builder = descriptor.createLookupBuilder(item);
result.addElement(PrioritizedLookupElement.withGrouping(builder.withAutoCompletionPolicy(completionPolicy), grouping--));
}
}
Aggregations