Skip to content

Commit d3f7141

Browse files
committed
add comments for new line decision at the end of SourceUnit
1 parent 9703ff8 commit d3f7141

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/slang-nodes/SourceUnit.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ export class SourceUnit implements SlangNode {
4040
print: PrintFunction,
4141
options: ParserOptions<AstNode>
4242
): Doc {
43-
return [path.call(print, 'members'), options.parentParser ? '' : line];
43+
return [
44+
path.call(print, 'members'),
45+
// Prettier's Markdown formatter already appends a new line on code
46+
// blocks, therefore we avoid trailing with a new line at the end of
47+
// a file in this case.
48+
// https://github.com/prettier-solidity/prettier-plugin-solidity/issues/764
49+
options.parentParser ? '' : line
50+
];
4451
}
4552
}

0 commit comments

Comments
 (0)