private static void psiToBuffer(Appendable buffer,
                                  PsiElement root,
                                  boolean showWhitespaces,
                                  boolean showRanges,
                                  boolean showClassNames,
                                  @Nullable PairConsumer<? super PsiElement, ? super Consumer<? super PsiElement>> extra) {
    ASTNode node = root.getNode();
    if (node == null) {
      psiToBuffer(buffer, root, 0, showWhitespaces, showRanges, showRanges, showClassNames, extra);
    }
    else {
      treeToBuffer(buffer, node, 0, showWhitespaces, showRanges, showRanges, showClassNames, true, extra);
    }
  }
private static void psiToBuffer(Appendable buffer,
                                  PsiElement root,
                                  boolean showWhitespaces,
                                  boolean showRanges,
                                  boolean showClassNames,
                                  @Nullable PairConsumer<? super PsiElement, ? super Consumer<? super PsiElement>> extra)