protected static <T> void addCompletionElements(final CompletionResultSet result,
                                                  final TextCompletionValueDescriptor<T> descriptor,
                                                  final Collection<? extends 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--));
    }
  }
protected static <T> void addCompletionElements(final CompletionResultSet result,
                                                  final TextCompletionValueDescriptor<T> descriptor,
                                                  final Collection<? extends T> items,
                                                  final int index)