Skip to content

Commit 02f4d29

Browse files
authored
Merge pull request #1144 from ahoppen/ahoppen/remove-sync-option
Remove --sync option
2 parents 847524d + 6edc462 commit 02f4d29

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ public final class JSONRPCConnection: Connection {
4646
private let sendIO: DispatchIO
4747
private let messageRegistry: MessageRegistry
4848

49-
/// *For Testing* Whether to wait for requests to finish before handling the next message.
50-
private let syncRequests: Bool
51-
5249
enum State {
5350
case created, running, closed
5451
}
@@ -108,8 +105,7 @@ public final class JSONRPCConnection: Connection {
108105
name: String,
109106
protocol messageRegistry: MessageRegistry,
110107
inFD: FileHandle,
111-
outFD: FileHandle,
112-
syncRequests: Bool = false
108+
outFD: FileHandle
113109
) {
114110
self.name = name
115111
self.receiveHandler = nil
@@ -122,7 +118,6 @@ public final class JSONRPCConnection: Connection {
122118
#endif
123119
state = .created
124120
self.messageRegistry = messageRegistry
125-
self.syncRequests = syncRequests
126121

127122
let ioGroup = DispatchGroup()
128123

@@ -330,12 +325,9 @@ public final class JSONRPCConnection: Connection {
330325
case .notification(let notification):
331326
notification._handle(self.receiveHandler!)
332327
case .request(let request, id: let id):
333-
let semaphore: DispatchSemaphore? = syncRequests ? .init(value: 0) : nil
334328
request._handle(self.receiveHandler!, id: id) { (response, id) in
335329
self.sendReply(response, id: id)
336-
semaphore?.signal()
337330
}
338-
semaphore?.wait()
339331
case .response(let response, id: let id):
340332
guard let outstanding = outstandingRequests.removeValue(forKey: id) else {
341333
logger.error("No outstanding requests for response ID \(id, privacy: .public)")

Sources/sourcekit-lsp/SourceKitLSP.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ struct SourceKitLSP: AsyncParsableCommand {
111111
]
112112
)
113113

114-
/// Whether to wait for a response before handling the next request.
115-
/// Used for testing.
116-
@Flag(name: .customLong("sync"))
117-
var syncRequests = false
118-
119114
@Option(
120115
name: [.customLong("configuration")],
121116
help: "Build with configuration [debug|release]"
@@ -243,8 +238,7 @@ struct SourceKitLSP: AsyncParsableCommand {
243238
name: "client",
244239
protocol: MessageRegistry.lspProtocol,
245240
inFD: FileHandle.standardInput,
246-
outFD: realStdoutHandle,
247-
syncRequests: syncRequests
241+
outFD: realStdoutHandle
248242
)
249243

250244
let installPath = try AbsolutePath(validating: Bundle.main.bundlePath)

0 commit comments

Comments
 (0)