Skip to content

Commit 7142cd5

Browse files
committed
Fix deprecated ByteSourceRange
1 parent 1658cd9 commit 7142cd5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Sources/SourceKitLSP/Swift/SemanticTokens.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ extension SwiftLanguageService {
5858
if let range = range.flatMap({ snapshot.byteSourceRange(of: $0) }) {
5959
range
6060
} else {
61-
ByteSourceRange(offset: 0, length: await tree.totalLength.utf8Length)
61+
Range<AbsolutePosition>(
62+
position: AbsolutePosition(utf8Offset: 0),
63+
length: SourceLength(utf8Length: await tree.totalLength.utf8Length)
64+
)
6265
}
6366

6467
let tokens =

Sources/SourceKitLSP/Swift/SwiftLanguageService.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,9 +1165,12 @@ extension DocumentSnapshot {
11651165
of range: Range<Position>,
11661166
callerFile: StaticString = #fileID,
11671167
callerLine: UInt = #line
1168-
) -> ByteSourceRange {
1168+
) -> Range<AbsolutePosition> {
11691169
let utf8OffsetRange = utf8OffsetRange(of: range, callerFile: callerFile, callerLine: callerLine)
1170-
return ByteSourceRange(offset: utf8OffsetRange.startIndex, length: utf8OffsetRange.count)
1170+
return Range<AbsolutePosition>(
1171+
position: AbsolutePosition(utf8Offset: utf8OffsetRange.startIndex),
1172+
length: SourceLength(utf8Length: utf8OffsetRange.count)
1173+
)
11711174
}
11721175

11731176
// MARK: Position <-> RenameLocation

0 commit comments

Comments
 (0)