Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 55x 4096x 4096x 10918x 10918x 10918x 6887x 10918x 6912x 40x 10918x 10918x 3784x 4096x 581x 4096x 55x | const { doc: { builders: { hardline } }, util: { isNextLineEmptyAfterIndex } } = require('prettier'); function printPreservingEmptyLines(path, key, options, print) { const parts = []; path.each((childPath) => { const node = childPath.getValue(); const nodeType = node.type; if ( // Avoid adding a hardline at the beginning of the document. parts.length !== 0 && // LabelDefinition adds a dedented line so we don't have to prepend a // hardline. nodeType !== 'LabelDefinition' ) { parts.push(hardline); } if (childPath.getName() > 0) { if ( ['ContractDefinition', 'FunctionDefinition'].includes(nodeType) && parts[parts.length - 2] !== hardline ) { parts.push(hardline); } } parts.push(print(childPath)); if ( isNextLineEmptyAfterIndex( options.originalText, options.locEnd(node) + 1 ) || nodeType === 'FunctionDefinition' ) { parts.push(hardline); } }, key); if (parts.length > 1 && parts[parts.length - 1] === hardline) { parts.pop(); } return parts; } module.exports = printPreservingEmptyLines; |