File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
CodeGeneration/Sources/Utils Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,14 @@ public class CodeGenerationFormat: BasicFormat {
158
158
}
159
159
formattedChildren = formattedChildren. map { child in
160
160
var child = child
161
- child. trailingTrivia = Trivia ( pieces: child. trailingTrivia. drop ( while: \. isSpaceOrTab) )
161
+
162
+ if let firstNonSpaceOrTabIndex = child. trailingTrivia. firstIndex ( where: { !$0. isSpaceOrTab } ) {
163
+ if child. trailingTrivia [ firstNonSpaceOrTabIndex] . isNewline {
164
+ child. trailingTrivia = Trivia ( pieces: child. trailingTrivia. suffix ( from: firstNonSpaceOrTabIndex) )
165
+ }
166
+ } else {
167
+ child. trailingTrivia = Trivia ( )
168
+ }
162
169
163
170
if !child. startsOnNewline {
164
171
child. leadingTrivia = indentedNewline + child. leadingTrivia
You can’t perform that action at this time.
0 commit comments