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
1 change: 1 addition & 0 deletions Sources/LanguageServerProtocolTransport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_library(LanguageServerProtocolTransport
BuildServerMessageDependencyTracker.swift
Connection+Send.swift
DisableSigpipe.swift
DocumentURI+CustomLogStringConvertible.swift
JSONRPCConnection.swift
Expand Down
26 changes: 26 additions & 0 deletions Sources/LanguageServerProtocolTransport/Connection+Send.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

public import LanguageServerProtocol
@_spi(SourceKitLSP) private import ToolsProtocolsSwiftExtensions

extension Connection {
public func send<R: RequestType>(_ request: R) async throws -> R.Response {
return try await withCancellableCheckedThrowingContinuation { continuation in
return self.send(request) { result in
continuation.resume(with: result)
}
} cancel: { requestID in
self.send(CancelRequestNotification(id: requestID))
}
}
}