You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Determines how multiline string literals should reflow when formatted.
199
+
publicenumMultilineStringReflowBehavior:Codable{
200
+
/// Never reflow multiline string literals.
201
+
case never
202
+
/// Reflow lines in string literal that exceed the maximum line length. For example with a line length of 10:
203
+
/// ```swift
204
+
/// """
205
+
/// an escape\
206
+
/// line break
207
+
/// a hard line break
208
+
/// """
209
+
/// ```
210
+
/// will be formatted as:
211
+
/// ```swift
212
+
/// """
213
+
/// an esacpe\
214
+
/// line break
215
+
/// a hard \
216
+
/// line break
217
+
/// """
218
+
/// ```
219
+
/// The existing `\` is left in place, but the line over line length is broken.
220
+
case onlyLinesOverLength
221
+
/// Always reflow multiline string literals, this will ignore existing escaped newlines in the literal and reflow each line. Hard linebreaks are still respected.
Copy file name to clipboardExpand all lines: Sources/SwiftFormat/PrettyPrint/Token.swift
+4
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,10 @@ enum NewlineBehavior {
147
147
/// newlines and the configured maximum number of blank lines.
148
148
case hard(count:Int)
149
149
150
+
/// Break onto a new line is allowed if neccessary. If a line break is emitted, it will be escaped with a '\', and this breaks whitespace will be printed prior to the
151
+
/// escaped line break. This is useful in multiline strings where we don't want newlines printed in syntax to appear in the literal.
152
+
case escaped
153
+
150
154
/// An elective newline that respects discretionary newlines from the user-entered text.
0 commit comments