private static @Nullable Pair<PsiElement, Navigatable> getNavigatable(SmartPsiElementPointer<?> pointer) {
    Navigatable element = getNavigationElement(pointer);
    if (element != null) return new Pair<>(pointer.getElement(), element);

    VirtualFile virtualFile = pointer.getVirtualFile();
    Segment actualRange = pointer.getRange();
    if (virtualFile != null && actualRange != null && virtualFile.isValid() && actualRange.getStartOffset() >= 0) {
      return new Pair<>(pointer.getElement(), new OpenFileDescriptor(pointer.getProject(), virtualFile, actualRange.getStartOffset()));
    }

    return null;
  }
private static @Nullable Pair<PsiElement, Navigatable> getNavigatable(SmartPsiElementPointer<?> pointer)