private static @Nullable PsiElement findNextSibling(PsiElement element) {
    PsiElement nextSibling = element.getNextSibling();
    if (nextSibling == null) {
      element = element.getParent();
      if (element == null || element instanceof PsiFile) {
        return null;
      }
      nextSibling = element.getNextSibling();
      if (nextSibling == null) {
        return null;
      }
    }
    return nextSibling;
  }
private static @Nullable PsiElement findNextSibling(PsiElement element)