File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,12 @@ func generateLines(codeBlockItemList: CodeBlockItemListSyntax) -> [Line] {
230
230
var afterNewline = false
231
231
var isFirstBlock = true
232
232
233
+ func appendNewLine( ) {
234
+ lines. append ( currentLine)
235
+ currentLine = Line ( )
236
+ afterNewline = true // Note: trailing line comments always come before any newlines.
237
+ }
238
+
233
239
for block in codeBlockItemList {
234
240
235
241
if let leadingTrivia = block. leadingTrivia {
@@ -240,9 +246,7 @@ func generateLines(codeBlockItemList: CodeBlockItemListSyntax) -> [Line] {
240
246
// Create new Line objects when we encounter newlines.
241
247
case . newlines( let N) :
242
248
for _ in 0 ..< N {
243
- lines. append ( currentLine)
244
- currentLine = Line ( )
245
- afterNewline = true // Note: trailing line comments always come before any newlines.
249
+ appendNewLine ( )
246
250
}
247
251
default :
248
252
if afterNewline || isFirstBlock {
@@ -252,6 +256,8 @@ func generateLines(codeBlockItemList: CodeBlockItemListSyntax) -> [Line] {
252
256
}
253
257
}
254
258
}
259
+ } else if currentLine. codeBlock != nil {
260
+ appendNewLine ( )
255
261
}
256
262
currentLine. codeBlock = block // This represents actual code: imports and otherwise.
257
263
isFirstBlock = false
You can’t perform that action at this time.
0 commit comments