private static @Nullable PsiElement getParentWithinFile(@NotNull PsiElement element) {
    PsiElement parent = element.getParent();
    return parent == null || parent instanceof PsiFile ? null : parent;
  }
private static @Nullable PsiElement getParentWithinFile(@NotNull PsiElement element)