Skip to content

Commit 607f040

Browse files
committed
Remove tracking of RequestCancelKey to CancellationToken
We want to implement cancellation on top of Swift concurrency’s cancellation, which will most likely need a completely different paradigm.
1 parent ea20e19 commit 607f040

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

Sources/SourceKitLSP/SourceKitServer.swift

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,6 @@ public actor SourceKitServer {
136136
/// The queue on which we communicate with the client.
137137
public let clientCommunicationQueue: DispatchQueue = DispatchQueue(label: "language-server-queue", qos: .userInitiated)
138138

139-
public struct RequestCancelKey: Hashable {
140-
public var client: ObjectIdentifier
141-
public var request: RequestID
142-
public init(client: ObjectIdentifier, request: RequestID) {
143-
self.client = client
144-
self.request = request
145-
}
146-
}
147-
148-
/// The set of outstanding requests that may be cancelled.
149-
public var requestCancellation: [RequestCancelKey: CancellationToken] = [:]
150139

151140
/// The connection to the editor.
152141
public let client: Connection
@@ -527,16 +516,7 @@ extension SourceKitServer: MessageHandler {
527516

528517
public func handle<R: RequestType>(_ params: R, id: RequestID, from clientID: ObjectIdentifier, reply: @escaping (LSPResult<R.Response >) -> Void) async {
529518
let cancellationToken = CancellationToken()
530-
let key = RequestCancelKey(client: clientID, request: id)
531-
532-
self.requestCancellation[key] = cancellationToken
533-
534519
let request = Request(params, id: id, clientID: clientID, cancellation: cancellationToken, reply: { [weak self] result in
535-
if let self {
536-
Task {
537-
await self.stopTrackingCancellationKey(key)
538-
}
539-
}
540520
reply(result)
541521
if let self {
542522
Task {
@@ -1011,13 +991,7 @@ extension SourceKitServer {
1011991
}
1012992

1013993
func cancelRequest(_ notification: Notification<CancelRequestNotification>) {
1014-
let key = RequestCancelKey(client: notification.clientID, request: notification.params.id)
1015-
requestCancellation[key]?.cancel()
1016-
}
1017-
1018-
/// Stop keeping track of the cancellation handler for the given cancellation key.
1019-
func stopTrackingCancellationKey(_ key: RequestCancelKey) {
1020-
requestCancellation[key] = nil
994+
// TODO: Implement cancellation
1021995
}
1022996

1023997
/// The server is about to exit, and the server should flush any buffered state.

0 commit comments

Comments
 (0)