@@ -28,6 +28,7 @@ public struct Configuration: Codable, Equatable {
28
28
case respectsExistingLineBreaks
29
29
case lineBreakBeforeControlFlowKeywords
30
30
case lineBreakBeforeEachArgument
31
+ case lineBreakBeforeFuncBodies
31
32
case lineBreakBeforeEachGenericRequirement
32
33
case lineBreakBeforeSwitchCaseOrDefaultBodies
33
34
case prioritizeKeepingFunctionOutputTogether
@@ -98,6 +99,15 @@ public struct Configuration: Codable, Equatable {
98
99
/// horizontally first, with line breaks only being fired when the line length would be exceeded.
99
100
public var lineBreakBeforeEachGenericRequirement = false
100
101
102
+ /// Determins the line-breaking behavior for the bodies of functions declared with `func`, as
103
+ /// well as "`func`-like" declarations: initializers, deinitializers, and subscripts.
104
+ ///
105
+ /// If true, a line break will be added after the opening brace of function bodies, forcing the
106
+ /// body to be on a separate line from the function. If false (the default), these bodies will be
107
+ /// laid out on the same line as the declaration, with line breaks only being added when the line
108
+ /// length would be exceeded.
109
+ public var lineBreakBeforeFuncBodies = false
110
+
101
111
/// Determines the line-breaking behavior for the bodies of `case` and `default` items within
102
112
/// a `switch` statement.
103
113
///
@@ -197,6 +207,8 @@ public struct Configuration: Codable, Equatable {
197
207
= try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeEachArgument) ?? false
198
208
self . lineBreakBeforeEachGenericRequirement
199
209
= try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeEachGenericRequirement) ?? false
210
+ self . lineBreakBeforeFuncBodies
211
+ = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeFuncBodies) ?? false
200
212
self . lineBreakBeforeSwitchCaseOrDefaultBodies
201
213
= try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies) ?? false
202
214
self . prioritizeKeepingFunctionOutputTogether
@@ -233,6 +245,7 @@ public struct Configuration: Codable, Equatable {
233
245
try container. encode ( lineBreakBeforeControlFlowKeywords, forKey: . lineBreakBeforeControlFlowKeywords)
234
246
try container. encode ( lineBreakBeforeEachArgument, forKey: . lineBreakBeforeEachArgument)
235
247
try container. encode ( lineBreakBeforeEachGenericRequirement, forKey: . lineBreakBeforeEachGenericRequirement)
248
+ try container. encode ( lineBreakBeforeFuncBodies, forKey: . lineBreakBeforeFuncBodies)
236
249
try container. encode ( lineBreakBeforeSwitchCaseOrDefaultBodies, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies)
237
250
try container. encode ( prioritizeKeepingFunctionOutputTogether, forKey: . prioritizeKeepingFunctionOutputTogether)
238
251
try container. encode ( indentConditionalCompilationBlocks, forKey: . indentConditionalCompilationBlocks)
0 commit comments