Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/LanguageServerProtocol/BasicStructures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ public struct LSPRange: Codable, Hashable, Sendable {
self.end = other.upperBound
}

/// Returns whether the position is in [start, end).
public func contains(_ position: Position) -> Bool {
return position > start && position < end
return position >= start && position < end
}

/// Returns true iff there is any position contained both in `self` and `other`.
public func intersects(_ other: LSPRange) -> Bool {
return contains(other.start) || contains(other.end)
}
Expand Down