prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
18 lines • 952 B
JavaScript
import { NonterminalKind } from '@nomicfoundation/slang/cst';
import addCollectionFirstComment from './add-collection-first-comment.js';
import addCollectionLastComment from './add-collection-last-comment.js';
export default function handleBlockComments({ precedingNode, enclosingNode, followingNode, comment }) {
if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.kind) !== NonterminalKind.Block) {
return false;
}
if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.kind) === NonterminalKind.Statements) {
addCollectionLastComment(precedingNode, comment);
return true;
}
if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.kind) === NonterminalKind.Statements) {
addCollectionFirstComment(followingNode, comment);
return true;
}
return false;
}
//# sourceMappingURL=handle-block-comments.js.map