src/main/ast-to-doc.js/callPluginPrintFunction
function callPluginPrintFunction(path, options, printPath, args) {
  const node = path.getValue();
  const { printer } = options;

  let doc;
  let printedComments;

  // Escape hatch
  if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
    ({ doc, printedComments } = printPrettierIgnoredNode(node, options));
  } else {
    if (node) {
      try {
        // Potentially switch to a different parser
        doc = multiparser.printSubtree(path, printPath, options, printAstToDoc);
      } catch (error) {
        /* istanbul ignore if */
        if (process.env.PRETTIER_DEBUG) {
          throw error;
        }
        // Continue with current parser
      }
    }

    if (!doc) {
      doc = printer.print(path, options, printPath, args);
    }
  }

  // We let JSXElement print its comments itself because it adds () around
  // UnionTypeAnnotation has to align the child without the comments
  if (
    !printer.willPrintOwnComments ||
    !printer.willPrintOwnComments(path, options)
  ) {
    // printComments will call the plugin print function and check for
    // comments to print
    doc = printComments(path, doc, options, printedComments);
  }

  return doc;
}