File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Sources/SwiftSyntaxBuilder Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,18 @@ extension CodeBlockItemListBuilder {
4040 public static func buildExpression( _ expression: some Sequence < DeclSyntaxProtocol > ) -> Component {
4141 buildExpression ( expression. map { CodeBlockItemSyntax ( item: . decl( DeclSyntax ( $0) ) ) } )
4242 }
43+
44+ public static func buildFinalResult( _ component: Component ) -> CodeBlockItemListSyntax {
45+ . init(
46+ component. enumerated ( ) . map { ( index, expression) in
47+ if index > component. startIndex, !expression. leadingTrivia. contains ( where: \. isNewline) {
48+ expression. with ( \. leadingTrivia, . newline. merging ( expression. leadingTrivia) )
49+ } else {
50+ expression
51+ }
52+ }
53+ )
54+ }
4355}
4456
4557extension ConditionElementListBuilder {
You can’t perform that action at this time.
0 commit comments