Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions Sources/Diagnose/SourcekitdRequestCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ public struct SourceKitdRequestCommand: AsyncParsableCommand {
let requestInfo = try RequestInfo(request: requestString)

let lineTable = LineTable(requestInfo.fileContents)
if let offset = lineTable.utf8OffsetOf(line: line - 1, utf8Column: column - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's worth it, but maybe we should keep a nil returning variant? In this case in particular, it would make sense to display an error about invalid line/col (though... we're currently just ignoring it anyway).

print("Adjusting request offset to \(offset)")
requestString.replace(#/key.offset: [0-9]+/#, with: "key.offset: \(offset)")
}
let offset = lineTable.utf8OffsetOf(line: line - 1, utf8Column: column - 1)
print("Adjusting request offset to \(offset)")
requestString.replace(#/key.offset: [0-9]+/#, with: "key.offset: \(offset)")
}

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