@@ -32,6 +32,7 @@ public struct Configuration: Codable, Equatable {
3232 case lineBreakBeforeFuncBodies
3333 case lineBreakBeforeEachGenericRequirement
3434 case lineBreakBeforeSwitchCaseOrDefaultBodies
35+ case lineBreakBeforeTypeBodies
3536 case prioritizeKeepingFunctionOutputTogether
3637 case indentConditionalCompilationBlocks
3738 case lineBreakAroundMultilineExpressionChainComponents
@@ -126,6 +127,14 @@ public struct Configuration: Codable, Equatable {
126127 /// when the line length would be exceeded.
127128 public var lineBreakBeforeSwitchCaseOrDefaultBodies = false
128129
130+ /// Determines the line-breaking behavior for the bodies of types: `class`, `enum`, `extension`,
131+ /// `protocol`, and `struct`.
132+ ///
133+ /// If true, a line break will be added after the opening brace for all non-empty types. If false
134+ /// (the default), these bodies will be laid out on the same line as the type declaration, with
135+ /// line breaks only being added when the line length would be exceeded.
136+ public var lineBreakBeforeTypeBodies = false
137+
129138 /// Determines if function-like declaration outputs should be prioritized to be together with the
130139 /// function signature right (closing) parenthesis.
131140 ///
@@ -222,6 +231,8 @@ public struct Configuration: Codable, Equatable {
222231 = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeFuncBodies) ?? false
223232 self . lineBreakBeforeSwitchCaseOrDefaultBodies
224233 = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies) ?? false
234+ self . lineBreakBeforeTypeBodies
235+ = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeTypeBodies) ?? false
225236 self . prioritizeKeepingFunctionOutputTogether
226237 = try container. decodeIfPresent ( Bool . self, forKey: . prioritizeKeepingFunctionOutputTogether) ?? false
227238 self . indentConditionalCompilationBlocks
@@ -259,6 +270,7 @@ public struct Configuration: Codable, Equatable {
259270 try container. encode ( lineBreakBeforeEachGenericRequirement, forKey: . lineBreakBeforeEachGenericRequirement)
260271 try container. encode ( lineBreakBeforeFuncBodies, forKey: . lineBreakBeforeFuncBodies)
261272 try container. encode ( lineBreakBeforeSwitchCaseOrDefaultBodies, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies)
273+ try container. encode ( lineBreakBeforeTypeBodies, forKey: . lineBreakBeforeTypeBodies)
262274 try container. encode ( prioritizeKeepingFunctionOutputTogether, forKey: . prioritizeKeepingFunctionOutputTogether)
263275 try container. encode ( indentConditionalCompilationBlocks, forKey: . indentConditionalCompilationBlocks)
264276 try container. encode (
0 commit comments