@Nullable
  protected static PsiElement findElementToSelect(PsiElement element, PsiElement candidate) {
    PsiElement toSelect = candidate;

    if (toSelect == null) {
      if (element instanceof PsiFile || element instanceof PsiDirectory) {
        toSelect = element;
        if (SelectInProjectViewImplKt.getLOG().isDebugEnabled()) {
          SelectInProjectViewImplKt.getLOG().debug("Will select PSI file/dir " + toSelect);
        }
      }
      else {
        PsiFile containingFile = element.getContainingFile();
        if (containingFile != null) {
          FileViewProvider viewProvider = containingFile.getViewProvider();
          toSelect = viewProvider.getPsi(viewProvider.getBaseLanguage());
          if (SelectInProjectViewImplKt.getLOG().isDebugEnabled()) {
            SelectInProjectViewImplKt.getLOG().debug("Will select PSI element " + toSelect + " provided by " + viewProvider);
          }
        }
      }
    }

    if (toSelect != null) {
      PsiElement originalElement = null;
      try {
        originalElement = toSelect.getOriginalElement();
        if (SelectInProjectViewImplKt.getLOG().isDebugEnabled()) {
          SelectInProjectViewImplKt.getLOG().debug("Original element to select is " + originalElement);
        }
      }
      catch (IndexNotReadyException ignored) { }
      if (originalElement != null) {
        toSelect = originalElement;
      }
    }

    return toSelect;
  }
@Nullable
  protected static PsiElement findElementToSelect(PsiElement element, PsiElement candidate)