public static @Nullable PsiElement toPsi(Object o) {
    if (o instanceof PsiItemWithSimilarity<?> itemWithSimilarity) return toPsi(itemWithSimilarity.getValue());
    if (o instanceof PsiElement) return (PsiElement)o;
    if (o instanceof ItemWithPresentation<?> wp) return toPsi(wp.getItem());
    if (o instanceof PsiElementNavigationItem en) return en.getTargetElement();
    return null;
  }
public static @Nullable PsiElement toPsi(Object o)