@NotNull
  private static Comparator<ItemWithPresentation> wrapPsiComparator(Comparator<PsiElement> result) {
    Comparator<ItemWithPresentation> comparator = (o1, o2) -> {
      if (o1.getItem() instanceof SmartPsiElementPointer<?> && o2.getItem() instanceof SmartPsiElementPointer<?>) {
        return ReadAction.compute(() -> result.compare(((SmartPsiElementPointer<?>)o1.getItem()).getElement(), ((SmartPsiElementPointer<?>)o2.getItem()).getElement()));
      }
      return 0;
    };
    return comparator;
  }
@NotNull
  private static Comparator<ItemWithPresentation> wrapPsiComparator(Comparator<PsiElement> result)