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 18
18
/// - Returns: Void.
19
19
public struct ShutdownRequest : RequestType , Hashable {
20
20
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
+ }
22
32
23
33
public init ( ) { }
24
34
}
25
-
26
- @available ( * , deprecated, renamed: " ShutdownRequest " )
27
- public typealias Shutdown = ShutdownRequest
Original file line number Diff line number Diff line change @@ -1138,7 +1138,7 @@ extension SourceKitLSPServer {
1138
1138
}
1139
1139
}
1140
1140
1141
- func shutdown( _ request: ShutdownRequest ) async throws -> VoidResponse {
1141
+ func shutdown( _ request: ShutdownRequest ) async throws -> ShutdownRequest . Response {
1142
1142
await prepareForExit ( )
1143
1143
1144
1144
await withTaskGroup ( of: Void . self) { taskGroup in
@@ -1169,7 +1169,7 @@ extension SourceKitLSPServer {
1169
1169
// Otherwise we might terminate sourcekit-lsp while it still has open
1170
1170
// connections to the toolchain servers, which could send messages to
1171
1171
// sourcekit-lsp while it is being deallocated, causing crashes.
1172
- return VoidResponse ( )
1172
+ return ShutdownRequest . Response ( )
1173
1173
}
1174
1174
1175
1175
func exit( _ notification: ExitNotification ) async {
Original file line number Diff line number Diff line change @@ -1343,6 +1343,10 @@ final class CodingTests: XCTestCase {
1343
1343
"""
1344
1344
)
1345
1345
}
1346
+
1347
+ func testShutdownResponse( ) {
1348
+ checkCoding ( ShutdownRequest . Response ( ) , json: " null " )
1349
+ }
1346
1350
}
1347
1351
1348
1352
func 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 {
141
141
" Received unexpected version: \( versionContentsBefore. first? . lastPathComponent ?? " <nil> " ) "
142
142
)
143
143
144
- try await project. testClient. send ( ShutdownRequest ( ) )
144
+ _ = try await project. testClient. send ( ShutdownRequest ( ) )
145
145
return versionedPath
146
146
}
147
147
You can’t perform that action at this time.
0 commit comments