Skip to content

Commit b634fd3

Browse files
committed
Rename
1 parent c00a944 commit b634fd3

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

Documentation/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ top-level keys and values:
3131
lines that are allowed to be present in a source file. Any number larger
3232
than this will be collapsed down to the maximum.
3333

34-
* `spacesBeforeLineComments` _(number)_: The number of spaces between the last
35-
token on a non-empty line and a line comment starting with `//`.
34+
* `spacesBeforeEndOfLineComments` _(number)_: The number of spaces between
35+
the last token on a non-empty line and a line comment starting with `//`.
3636

3737
* `respectsExistingLineBreaks` _(boolean)_: Indicates whether or not existing
3838
line breaks in the source code should be honored (if they are valid

Sources/SwiftFormat/API/Configuration+Default.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extension Configuration {
2626
self.lineLength = 100
2727
self.tabWidth = 8
2828
self.indentation = .spaces(2)
29-
self.spacesBeforeLineComments = 2
29+
self.spacesBeforeEndOfLineComments = 2
3030
self.respectsExistingLineBreaks = true
3131
self.lineBreakBeforeControlFlowKeywords = false
3232
self.lineBreakBeforeEachArgument = false

Sources/SwiftFormat/API/Configuration.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public struct Configuration: Codable, Equatable {
2828
case version
2929
case maximumBlankLines
3030
case lineLength
31-
case spacesBeforeLineComments
31+
case spacesBeforeEndOfLineComments
3232
case tabWidth
3333
case indentation
3434
case respectsExistingLineBreaks
@@ -68,7 +68,7 @@ public struct Configuration: Codable, Equatable {
6868
public var lineLength: Int
6969

7070
// Number of spaces that preceeds line comments.
71-
public var spacesBeforeLineComments: Int
71+
public var spacesBeforeEndOfLineComments: Int
7272

7373
/// The width of the horizontal tab in spaces.
7474
///
@@ -229,9 +229,9 @@ public struct Configuration: Codable, Equatable {
229229
self.lineLength =
230230
try container.decodeIfPresent(Int.self, forKey: .lineLength)
231231
?? defaults.lineLength
232-
self.spacesBeforeLineComments =
233-
try container.decodeIfPresent(Int.self, forKey: .spacesBeforeLineComments)
234-
?? defaults.spacesBeforeLineComments
232+
self.spacesBeforeEndOfLineComments =
233+
try container.decodeIfPresent(Int.self, forKey: .spacesBeforeEndOfLineComments)
234+
?? defaults.spacesBeforeEndOfLineComments
235235
self.tabWidth =
236236
try container.decodeIfPresent(Int.self, forKey: .tabWidth)
237237
?? defaults.tabWidth
@@ -295,7 +295,7 @@ public struct Configuration: Codable, Equatable {
295295
try container.encode(version, forKey: .version)
296296
try container.encode(maximumBlankLines, forKey: .maximumBlankLines)
297297
try container.encode(lineLength, forKey: .lineLength)
298-
try container.encode(spacesBeforeLineComments, forKey: .spacesBeforeLineComments)
298+
try container.encode(spacesBeforeEndOfLineComments, forKey: .spacesBeforeEndOfLineComments)
299299
try container.encode(tabWidth, forKey: .tabWidth)
300300
try container.encode(indentation, forKey: .indentation)
301301
try container.encode(respectsExistingLineBreaks, forKey: .respectsExistingLineBreaks)

Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3171,7 +3171,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
31713171
return (
31723172
true,
31733173
[
3174-
.space(size: config.spacesBeforeLineComments, flexible: true),
3174+
.space(size: config.spacesBeforeEndOfLineComments, flexible: true),
31753175
.comment(Comment(kind: .line, text: text), wasEndOfLine: true),
31763176
// There must be a break with a soft newline after the comment, but it's impossible to
31773177
// know which kind of break must be used. Adding this newline is deferred until the

Tests/SwiftFormatTests/PrettyPrint/CommentTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ final class CommentTests: PrettyPrintTestCase {
317317
"""
318318

319319
var config = Configuration.forTesting
320-
config.spacesBeforeLineComments = 3
320+
config.spacesBeforeEndOfLineComments = 3
321321
assertPrettyPrintEqual(input: input, expected: expected, linelength: 45, configuration: config)
322322
}
323323

@@ -468,7 +468,7 @@ final class CommentTests: PrettyPrintTestCase {
468468
469469
"""
470470
var config = Configuration.forTesting
471-
config.spacesBeforeLineComments = 1
471+
config.spacesBeforeEndOfLineComments = 1
472472
assertPrettyPrintEqual(input: input, expected: expected, linelength: 80, configuration: config)
473473
}
474474

0 commit comments

Comments
 (0)