src/main/comments.js/printCommentsSeparately
function printCommentsSeparately(path, options, ignored) {
  const value = path.getValue();
  if (!value) {
    return {};
  }

  let comments = value.comments || [];
  if (ignored) {
    comments = comments.filter((comment) => !ignored.has(comment));
  }
  const isCursorNode = value === options.cursorNode;

  if (comments.length === 0) {
    const maybeCursor = isCursorNode ? cursor : "";
    return { leading: maybeCursor, trailing: maybeCursor };
  }

  const leadingParts = [];
  const trailingParts = [];
  path.each(() => {
    const comment = path.getValue();
    if (ignored && ignored.has(comment)) {
      return;
    }

    const { leading, trailing } = comment;
    if (leading) {
      leadingParts.push(printLeadingComment(path, options));
    } else if (trailing) {
      trailingParts.push(printTrailingComment(path, options));
    }
  }, "comments");

  if (isCursorNode) {
    leadingParts.unshift(cursor);
    trailingParts.push(cursor);
  }

  return { leading: leadingParts, trailing: trailingParts };
}