File tree Expand file tree Collapse file tree 4 files changed +18
-7
lines changed
LanguageServerProtocol/Requests
LanguageServerProtocolTests Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 1818/// - Returns: Void.
1919public struct ShutdownRequest : RequestType , Hashable {
2020 public static let method : String = " shutdown "
21- public typealias Response = VoidResponse
21+
22+ public struct Response : ResponseType , Equatable {
23+ public init ( ) { }
24+
25+ public init ( from decoder: any Decoder ) throws { }
26+
27+ public func encode( to encoder: any Encoder ) throws {
28+ var container = encoder. singleValueContainer ( )
29+ try container. encodeNil ( )
30+ }
31+ }
2232
2333 public init ( ) { }
2434}
25-
26- @available ( * , deprecated, renamed: " ShutdownRequest " )
27- public typealias Shutdown = ShutdownRequest
Original file line number Diff line number Diff line change @@ -1128,7 +1128,7 @@ extension SourceKitLSPServer {
11281128 }
11291129 }
11301130
1131- func shutdown( _ request: ShutdownRequest ) async throws -> VoidResponse {
1131+ func shutdown( _ request: ShutdownRequest ) async throws -> ShutdownRequest . Response {
11321132 await prepareForExit ( )
11331133
11341134 await withTaskGroup ( of: Void . self) { taskGroup in
@@ -1159,7 +1159,7 @@ extension SourceKitLSPServer {
11591159 // Otherwise we might terminate sourcekit-lsp while it still has open
11601160 // connections to the toolchain servers, which could send messages to
11611161 // sourcekit-lsp while it is being deallocated, causing crashes.
1162- return VoidResponse ( )
1162+ return ShutdownRequest . Response ( )
11631163 }
11641164
11651165 func exit( _ notification: ExitNotification ) async {
Original file line number Diff line number Diff line change @@ -1343,6 +1343,10 @@ final class CodingTests: XCTestCase {
13431343 """
13441344 )
13451345 }
1346+
1347+ func testShutdownResponse( ) {
1348+ checkCoding ( ShutdownRequest . Response ( ) , json: " null " )
1349+ }
13461350}
13471351
13481352func with< T> ( _ value: T , mutate: ( inout T ) -> Void ) -> T {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ final class IndexTests: XCTestCase {
141141 " Received unexpected version: \( versionContentsBefore. first? . lastPathComponent ?? " <nil> " ) "
142142 )
143143
144- try await project. testClient. send ( ShutdownRequest ( ) )
144+ _ = try await project. testClient. send ( ShutdownRequest ( ) )
145145 return versionedPath
146146 }
147147
You can’t perform that action at this time.
0 commit comments