@@ -32,6 +32,7 @@ public struct Configuration: Codable, Equatable {
32
32
case lineBreakBeforeFuncBodies
33
33
case lineBreakBeforeEachGenericRequirement
34
34
case lineBreakBeforeSwitchCaseOrDefaultBodies
35
+ case lineBreakBeforeTypeBodies
35
36
case prioritizeKeepingFunctionOutputTogether
36
37
case indentConditionalCompilationBlocks
37
38
case lineBreakAroundMultilineExpressionChainComponents
@@ -126,6 +127,14 @@ public struct Configuration: Codable, Equatable {
126
127
/// when the line length would be exceeded.
127
128
public var lineBreakBeforeSwitchCaseOrDefaultBodies = false
128
129
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
+
129
138
/// Determines if function-like declaration outputs should be prioritized to be together with the
130
139
/// function signature right (closing) parenthesis.
131
140
///
@@ -222,6 +231,8 @@ public struct Configuration: Codable, Equatable {
222
231
= try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeFuncBodies) ?? false
223
232
self . lineBreakBeforeSwitchCaseOrDefaultBodies
224
233
= try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies) ?? false
234
+ self . lineBreakBeforeTypeBodies
235
+ = try container. decodeIfPresent ( Bool . self, forKey: . lineBreakBeforeTypeBodies) ?? false
225
236
self . prioritizeKeepingFunctionOutputTogether
226
237
= try container. decodeIfPresent ( Bool . self, forKey: . prioritizeKeepingFunctionOutputTogether) ?? false
227
238
self . indentConditionalCompilationBlocks
@@ -259,6 +270,7 @@ public struct Configuration: Codable, Equatable {
259
270
try container. encode ( lineBreakBeforeEachGenericRequirement, forKey: . lineBreakBeforeEachGenericRequirement)
260
271
try container. encode ( lineBreakBeforeFuncBodies, forKey: . lineBreakBeforeFuncBodies)
261
272
try container. encode ( lineBreakBeforeSwitchCaseOrDefaultBodies, forKey: . lineBreakBeforeSwitchCaseOrDefaultBodies)
273
+ try container. encode ( lineBreakBeforeTypeBodies, forKey: . lineBreakBeforeTypeBodies)
262
274
try container. encode ( prioritizeKeepingFunctionOutputTogether, forKey: . prioritizeKeepingFunctionOutputTogether)
263
275
try container. encode ( indentConditionalCompilationBlocks, forKey: . indentConditionalCompilationBlocks)
264
276
try container. encode (
0 commit comments