UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

21 lines 848 B
import { TerminalKind } from '@nomicfoundation/slang/cst'; import { doc } from 'prettier'; import { getNodeMetadata } from '../slang-utils/metadata.js'; import { isIndentableBlockComment } from '../slang-utils/is-indentable-block-comment.js'; import { printIndentableBlockComment } from '../slang-printers/print-indentable-block-comment.js'; const { join, literalline } = doc.builders; export class MultiLineComment { constructor(ast) { this.kind = TerminalKind.MultiLineComment; const metadata = getNodeMetadata(ast); this.value = ast.unparse(); this.loc = metadata.loc; } print() { if (isIndentableBlockComment(this)) { return printIndentableBlockComment(this); } return join(literalline, this.value.split('\n')); } } //# sourceMappingURL=MultiLineComment.js.map