UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

18 lines 764 B
import { doc } from 'prettier'; import { printComment } from '../slang-comments/printer.js'; import { isBlockComment } from '../slang-utils/is-comment.js'; import { joinExisting } from '../slang-utils/join-existing.js'; const { breakParent, line } = doc.builders; export function printComments(path) { const document = joinExisting(line, path.map((commentPath) => { const comment = commentPath.getNode(); if (comment.trailing || comment.leading || comment.printed) { return ''; } comment.printed = true; const printed = printComment(commentPath); return isBlockComment(comment) ? printed : [printed, breakParent]; }, 'comments')); return document; } //# sourceMappingURL=print-comments.js.map