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 @@ -1138,7 +1138,7 @@ extension SourceKitLSPServer {
11381138 }
11391139 }
11401140
1141- func shutdown( _ request: ShutdownRequest ) async throws -> VoidResponse {
1141+ func shutdown( _ request: ShutdownRequest ) async throws -> ShutdownRequest . Response {
11421142 await prepareForExit ( )
11431143
11441144 await withTaskGroup ( of: Void . self) { taskGroup in
@@ -1169,7 +1169,7 @@ extension SourceKitLSPServer {
11691169 // Otherwise we might terminate sourcekit-lsp while it still has open
11701170 // connections to the toolchain servers, which could send messages to
11711171 // sourcekit-lsp while it is being deallocated, causing crashes.
1172- return VoidResponse ( )
1172+ return ShutdownRequest . Response ( )
11731173 }
11741174
11751175 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