@@ -2385,13 +2385,15 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
23852385 }
23862386
23872387 override func visit( _ node: AttributedTypeSyntax ) -> SyntaxVisitorContinueKind {
2388+ before ( node. firstToken ( viewMode: . sourceAccurate) , tokens: . open)
23882389 arrangeAttributeList ( node. attributes)
23892390 for specifier in node. specifiers {
23902391 after (
23912392 specifier. firstToken ( viewMode: . sourceAccurate) ,
23922393 tokens: . break( . continue, newlines: . elective( ignoresDiscretionary: true ) )
23932394 )
23942395 }
2396+ after ( node. lastToken ( viewMode: . sourceAccurate) , tokens: . close)
23952397 return . visitChildren
23962398 }
23972399
@@ -2635,11 +2637,13 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
26352637 emitSegmentTextTokens ( segmentText [ ... ] )
26362638 }
26372639
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) )
26432647 appendToken ( . break( breakKind, newlines: . hard( count: 1 ) ) )
26442648 }
26452649 return . skipChildren
0 commit comments