@@ -2385,13 +2385,15 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
2385
2385
}
2386
2386
2387
2387
override func visit( _ node: AttributedTypeSyntax ) -> SyntaxVisitorContinueKind {
2388
+ before ( node. firstToken ( viewMode: . sourceAccurate) , tokens: . open)
2388
2389
arrangeAttributeList ( node. attributes)
2389
2390
for specifier in node. specifiers {
2390
2391
after (
2391
2392
specifier. firstToken ( viewMode: . sourceAccurate) ,
2392
2393
tokens: . break( . continue, newlines: . elective( ignoresDiscretionary: true ) )
2393
2394
)
2394
2395
}
2396
+ after ( node. lastToken ( viewMode: . sourceAccurate) , tokens: . close)
2395
2397
return . visitChildren
2396
2398
}
2397
2399
@@ -2635,11 +2637,13 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
2635
2637
emitSegmentTextTokens ( segmentText [ ... ] )
2636
2638
}
2637
2639
2638
- if node. trailingTrivia. containsBackslashes && !config. reflowMultilineStringLiterals. isAlways {
2639
- // Segments with trailing backslashes won't end with a literal newline; the backslash is
2640
- // considered trivia. To preserve the original text and wrapping, we need to manually render
2641
- // the backslash and a break into the token stream.
2642
- appendToken ( . syntax( " \\ " ) )
2640
+ if !config. reflowMultilineStringLiterals. isAlways,
2641
+ let continuation = node. trailingTrivia. multilineStringContinuation
2642
+ {
2643
+ // Segments with trailing backslashes won't end with a literal newline; the backslash and any
2644
+ // `#` delimiters for raw strings are considered trivia. To preserve the original text and
2645
+ // wrapping, we need to manually render them break into the token stream.
2646
+ appendToken ( . syntax( continuation) )
2643
2647
appendToken ( . break( breakKind, newlines: . hard( count: 1 ) ) )
2644
2648
}
2645
2649
return . skipChildren
0 commit comments