@@ -46,6 +46,7 @@ public struct Configuration: Codable, Equatable {
4646 case noAssignmentInExpressions
4747 case multiElementCollectionTrailingCommas
4848 case reflowMultilineStringLiterals
49+ case indentBlankLines
4950 }
5051
5152 /// A dictionary containing the default enabled/disabled states of rules, keyed by the rules'
@@ -260,6 +261,13 @@ public struct Configuration: Codable, Equatable {
260261
261262 public var reflowMultilineStringLiterals : MultilineStringReflowBehavior
262263
264+ /// Determines whether to add indentation whitespace to blank lines or remove it entirely.
265+ ///
266+ /// If true, blank lines will be modified to match the current indentation level:
267+ /// if they contain whitespace, the existing whitespace will be adjusted, and if they are empty, spaces will be added to match the indentation.
268+ /// If false (the default), the whitespace in blank lines will be removed entirely.
269+ public var indentBlankLines : Bool
270+
263271 /// Creates a new `Configuration` by loading it from a configuration file.
264272 public init ( contentsOf url: URL ) throws {
265273 let data = try Data ( contentsOf: url)
@@ -368,6 +376,12 @@ public struct Configuration: Codable, Equatable {
368376 self . reflowMultilineStringLiterals =
369377 try container. decodeIfPresent ( MultilineStringReflowBehavior . self, forKey: . reflowMultilineStringLiterals)
370378 ?? defaults. reflowMultilineStringLiterals
379+ self . indentBlankLines =
380+ try container. decodeIfPresent (
381+ Bool . self,
382+ forKey: . indentBlankLines
383+ )
384+ ?? defaults. indentBlankLines
371385
372386 // If the `rules` key is not present at all, default it to the built-in set
373387 // so that the behavior is the same as if the configuration had been
0 commit comments