Skip to content

Commit

Permalink
Require Swift 5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Nov 30, 2023
1 parent d24ff83 commit 3bef8f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.9

import PackageDescription

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@ import JSONRPC

extension DataChannel {
/// Wrap http message framing on an existing data channel
public func withMessageFraming(
) -> DataChannel {

public func withMessageFraming() -> DataChannel {
let writeHandler: DataChannel.WriteHandler = { data in
let data = MessageFraming.frame(data)

try await self.writeHandler(data)
}

#if compiler(>=5.9)
let (stream, continuation) = DataSequence.makeStream()
#else
var escapedContinuation: DataSequence.Continuation?

let stream = DataSequence { escapedContinuation = $0 }
let continuation = escapedContinuation!
#endif

Task {
let byteStream = AsyncByteSequence(base: dataSequence)
Expand All @@ -33,6 +24,6 @@ extension DataChannel {
}

return DataChannel(writeHandler: writeHandler,
dataSequence: stream)
dataSequence: stream)
}
}
45 changes: 0 additions & 45 deletions Sources/LanguageServerProtocol/AsyncStreamPolyfill.swift

This file was deleted.

0 comments on commit 3bef8f4

Please sign in to comment.