private static PsiElement getDocumentationElement(PsiElement element, PsiElement originalElement) {
    if (element instanceof GrGdkMethod method) {
      element = method.getStaticMethod();
    }

    final GrDocComment doc = PsiTreeUtil.getParentOfType(originalElement, GrDocComment.class);
    if (doc != null) {
      element = GrDocCommentUtil.findDocOwner(doc);
    }

    if (element instanceof GrLightVariable var) {
      PsiElement navigationElement = var.getNavigationElement();

      element = navigationElement;

      if (element.getContainingFile() instanceof PsiCompiledFile) {
        navigationElement = element.getNavigationElement();
        if (navigationElement != null) {
          element = navigationElement;
        }
      }

      if (element instanceof GrAccessorMethod method) {
        element = method.getProperty();
      }
    }

    if (element instanceof GrPropertyForCompletion property) {
      element = property.getOriginalAccessor();
    }

    return element;
  }
private static PsiElement getDocumentationElement(PsiElement element, PsiElement originalElement)