We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d11bc2a + ac7ab23 commit 4b62459Copy full SHA for 4b62459
Sources/SwiftFormat/API/Selection.swift
@@ -49,6 +49,14 @@ public enum Selection {
49
}
50
51
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
+
60
61
public extension Syntax {
62
/// - Returns: `true` if the node is _completely_ inside any range in the selection
0 commit comments