@@ -46,6 +46,7 @@ public struct Configuration: Codable, Equatable {
46
46
case noAssignmentInExpressions
47
47
case multiElementCollectionTrailingCommas
48
48
case reflowMultilineStringLiterals
49
+ case indentBlankLines
49
50
}
50
51
51
52
/// A dictionary containing the default enabled/disabled states of rules, keyed by the rules'
@@ -260,6 +261,13 @@ public struct Configuration: Codable, Equatable {
260
261
261
262
public var reflowMultilineStringLiterals : MultilineStringReflowBehavior
262
263
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
+
263
271
/// Creates a new `Configuration` by loading it from a configuration file.
264
272
public init ( contentsOf url: URL ) throws {
265
273
let data = try Data ( contentsOf: url)
@@ -368,6 +376,12 @@ public struct Configuration: Codable, Equatable {
368
376
self . reflowMultilineStringLiterals =
369
377
try container. decodeIfPresent ( MultilineStringReflowBehavior . self, forKey: . reflowMultilineStringLiterals)
370
378
?? defaults. reflowMultilineStringLiterals
379
+ self . indentBlankLines =
380
+ try container. decodeIfPresent (
381
+ Bool . self,
382
+ forKey: . indentBlankLines
383
+ )
384
+ ?? defaults. indentBlankLines
371
385
372
386
// If the `rules` key is not present at all, default it to the built-in set
373
387
// so that the behavior is the same as if the configuration had been
0 commit comments