@@ -28,6 +28,7 @@ public struct Configuration: Codable, Equatable {
2828 case respectsExistingLineBreaks
2929 case lineBreakBeforeControlFlowKeywords
3030 case lineBreakBeforeEachArgument
31+ case lineBreakBeforeFuncBodies
3132 case lineBreakBeforeEachGenericRequirement
3233 case lineBreakBeforeSwitchCaseOrDefaultBodies
3334 case prioritizeKeepingFunctionOutputTogether
@@ -98,6 +99,15 @@ public struct Configuration: Codable, Equatable {
9899 /// horizontally first, with line breaks only being fired when the line length would be exceeded.
99100 public var lineBreakBeforeEachGenericRequirement = false
100101
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+
101111 /// Determines the line-breaking behavior for the bodies of `case` and `default` items within
102112 /// a `switch` statement.
103113 ///
@@ -197,6 +207,8 @@ public struct Configuration: Codable, Equatable {
197207 = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeEachArgument) ?? false
198208 self . lineBreakBeforeEachGenericRequirement
199209 = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeEachGenericRequirement) ?? false
210+ self . lineBreakBeforeFuncBodies
211+ = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeFuncBodies) ?? false
200212 self . lineBreakBeforeSwitchCaseOrDefaultBodies
201213 = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies) ?? false
202214 self . prioritizeKeepingFunctionOutputTogether
@@ -233,6 +245,7 @@ public struct Configuration: Codable, Equatable {
233245 try container. encode ( lineBreakBeforeControlFlowKeywords, forKey: . lineBreakBeforeControlFlowKeywords)
234246 try container. encode ( lineBreakBeforeEachArgument, forKey: . lineBreakBeforeEachArgument)
235247 try container. encode ( lineBreakBeforeEachGenericRequirement, forKey: . lineBreakBeforeEachGenericRequirement)
248+ try container. encode ( lineBreakBeforeFuncBodies, forKey: . lineBreakBeforeFuncBodies)
236249 try container. encode ( lineBreakBeforeSwitchCaseOrDefaultBodies, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies)
237250 try container. encode ( prioritizeKeepingFunctionOutputTogether, forKey: . prioritizeKeepingFunctionOutputTogether)
238251 try container. encode ( indentConditionalCompilationBlocks, forKey: . indentConditionalCompilationBlocks)
0 commit comments