Skip to content

Commit 4b62459

Browse files
authored
Merge pull request #762 from ahoppen/fix-build-issue
Fix a build issue in swift-format
2 parents d11bc2a + ac7ab23 commit 4b62459

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/SwiftFormat/API/Selection.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public enum Selection {
4949
}
5050
}
5151

52+
extension Range<AbsolutePosition> {
53+
// Returns `true` if the intersection between this range and `other` is non-empty or if the two ranges are directly
54+
/// adjacent to each other.
55+
public func overlapsOrTouches(_ other: Range<AbsolutePosition>) -> Bool {
56+
return self.upperBound >= other.lowerBound && self.lowerBound <= other.upperBound
57+
}
58+
}
59+
5260

5361
public extension Syntax {
5462
/// - Returns: `true` if the node is _completely_ inside any range in the selection

0 commit comments

Comments
 (0)