Skip to content
Merged
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
14 changes: 11 additions & 3 deletions Sources/SKTestSupport/TestSourceKitLSPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import InProcessClient
package import LanguageServerProtocol
import LanguageServerProtocolExtensions
import LanguageServerProtocolJSONRPC
import SKLogging
package import SKOptions
import SKUtilities
import SourceKitD
Expand Down Expand Up @@ -217,14 +218,21 @@ package final class TestSourceKitLSPClient: MessageHandler, Sendable {
deinit {
// It's really unfortunate that there are no async deinits. If we had async
// deinits, we could await the sending of a ShutdownRequest.
let sema = WrappedSemaphore(name: "Shutdown")
let shutdownSemaphore = WrappedSemaphore(name: "Shutdown")
server.handle(ShutdownRequest(), id: .number(Int(nextRequestID.fetchAndIncrement()))) { result in
sema.signal()
shutdownSemaphore.signal()
}
sema.waitOrXCTFail()
shutdownSemaphore.waitOrXCTFail()
self.send(ExitNotification())

cleanUp()

let flushSemaphore = WrappedSemaphore(name: "Flush log")
Task {
await NonDarwinLogger.flush()
flushSemaphore.signal()
}
flushSemaphore.waitOrXCTFail()
}

// MARK: - Sending messages
Expand Down