@@ -33,6 +33,7 @@ public struct Configuration: Codable, Equatable {
3333 case indentConditionalCompilationBlocks
3434 case lineBreakAroundMultilineExpressionChainComponents
3535 case fileScopedDeclarationPrivacy
36+ case indentSwitchCaseLabels
3637 case rules
3738 }
3839
@@ -120,6 +121,27 @@ public struct Configuration: Codable, Equatable {
120121 /// declarations whose effective access level is private to the containing file.
121122 public var fileScopedDeclarationPrivacy = FileScopedDeclarationPrivacyConfiguration ( )
122123
124+ /// Determines if `case` statements should be indented compared to the containing `switch` block.
125+ ///
126+ /// When `false`, the correct form is:
127+ /// ```swift
128+ /// switch someValue {
129+ /// case someCase:
130+ /// someStatement
131+ /// ...
132+ /// }
133+ /// ```
134+ ///
135+ /// When `true`, the correct form is:
136+ /// ```swift
137+ /// switch someValue {
138+ /// case someCase:
139+ /// someStatement
140+ /// ...
141+ /// }
142+ ///```
143+ public var indentSwitchCaseLabels = false
144+
123145 /// Constructs a Configuration with all default values.
124146 public init ( ) {
125147 self . version = highestSupportedConfigurationVersion
@@ -176,6 +198,8 @@ public struct Configuration: Codable, Equatable {
176198 try container. decodeIfPresent (
177199 FileScopedDeclarationPrivacyConfiguration . self, forKey: . fileScopedDeclarationPrivacy)
178200 ?? FileScopedDeclarationPrivacyConfiguration ( )
201+ self . indentSwitchCaseLabels
202+ = try container. decodeIfPresent ( Bool . self, forKey: . indentSwitchCaseLabels) ?? false
179203
180204 // If the `rules` key is not present at all, default it to the built-in set
181205 // so that the behavior is the same as if the configuration had been
@@ -203,6 +227,7 @@ public struct Configuration: Codable, Equatable {
203227 lineBreakAroundMultilineExpressionChainComponents,
204228 forKey: . lineBreakAroundMultilineExpressionChainComponents)
205229 try container. encode ( fileScopedDeclarationPrivacy, forKey: . fileScopedDeclarationPrivacy)
230+ try container. encode ( indentSwitchCaseLabels, forKey: . indentSwitchCaseLabels)
206231 try container. encode ( rules, forKey: . rules)
207232 }
208233
0 commit comments