Skip to content

Commit b4eb1e2

Browse files
authored
Merge pull request swiftlang#1168 from ahoppen/never-fail-position-conversions
Never return `nil` for position conversions
2 parents e99892b + 08f1595 commit b4eb1e2

22 files changed

+429
-561
lines changed

Sources/Diagnose/SourcekitdRequestCommand.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ public struct SourceKitdRequestCommand: AsyncParsableCommand {
5656
let requestInfo = try RequestInfo(request: requestString)
5757

5858
let lineTable = LineTable(requestInfo.fileContents)
59-
if let offset = lineTable.utf8OffsetOf(line: line - 1, utf8Column: column - 1) {
60-
print("Adjusting request offset to \(offset)")
61-
requestString.replace(#/key.offset: [0-9]+/#, with: "key.offset: \(offset)")
62-
}
59+
let offset = lineTable.utf8OffsetOf(line: line - 1, utf8Column: column - 1)
60+
print("Adjusting request offset to \(offset)")
61+
requestString.replace(#/key.offset: [0-9]+/#, with: "key.offset: \(offset)")
6362
}
6463

6564
let request = try requestString.cString(using: .utf8)!.withUnsafeBufferPointer { buffer in

0 commit comments

Comments
 (0)