public static @Nullable PsiElement getNextSibling(PsiElement element) {
    if (element instanceof PsiFile) {
      FileViewProvider viewProvider = ((PsiFile)element).getViewProvider();
      element = viewProvider.getPsi(viewProvider.getBaseLanguage());
    }
    if (element == null) return null;
    PsiElement parent = element.getParent();
    if (parent == null) return null;

    PsiElement[] children = parent.getChildren();
    int index = getChildIndex(children, element);
    return 0 <= index && index < children.length - 1 ? children[index + 1] : null;
  }
public static @Nullable PsiElement getNextSibling(PsiElement element)