Skip to content

Commit 5df19cc

Browse files
authored
Merge pull request #1688 from ahoppen/reply-to-requests-on-jsonrpc-closure
When a JSON-RPC connection is closed, send an error response to all outstanding requests
2 parents 4782273 + 8cdda32 commit 5df19cc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ public final class JSONRPCConnection: Connection {
165165
ioGroup.notify(queue: queue) { [weak self] in
166166
guard let self = self else { return }
167167
Task {
168+
for outstandingRequest in outstandingRequests.values {
169+
outstandingRequest.replyHandler(LSPResult.failure(ResponseError.internalError("JSON-RPC Connection closed")))
170+
}
168171
await self.closeHandler?()
169172
self.receiveHandler = nil // break retain cycle
170173
}

0 commit comments

Comments
 (0)