Skip to content

Commit

Permalink
Remove unused enum/protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed May 17, 2024
1 parent 5fc0106 commit 1f5f818
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Sources/LanguageServerProtocol/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extension Registration {

func decodeServerRegistration() throws -> ServerRegistration {
guard let regMethod = ServerRegistration.Method(rawValue: method) else {
throw ServerError.unhandledRegistrationMethod(method)
throw ProtocolError.unhandledRegistrationMethod(method)
}

switch regMethod {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public actor JSONRPCServerConnection: ServerConnection {
let note = try JSONDecoder().decode(JSONRPCNotification<Params>.self, from: data)

guard let params = note.params else {
throw ServerError.missingParams
throw ProtocolError.missingParams
}

return params
Expand All @@ -213,7 +213,7 @@ public actor JSONRPCServerConnection: ServerConnection {

do {
guard let method = ServerNotification.Method(rawValue: methodName) else {
throw ServerError.unrecognizedMethod(methodName)
throw ProtocolError.unrecognizedMethod(methodName)
}

switch method {
Expand Down Expand Up @@ -257,7 +257,7 @@ public actor JSONRPCServerConnection: ServerConnection {
let req = try JSONDecoder().decode(JSONRPCRequest<Params>.self, from: data)

guard let params = req.params else {
throw ServerError.missingParams
throw ProtocolError.missingParams
}

return params
Expand Down
2 changes: 1 addition & 1 deletion Sources/LanguageServerProtocol/Client/MockServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public actor MockServer: ServerConnection {
sentMessageContinuation.yield(.request(request))

if mockResponses.isEmpty {
throw ServerError.missingReply
throw ProtocolError.missingReply
}

let data = mockResponses.removeFirst()
Expand Down
14 changes: 0 additions & 14 deletions Sources/LanguageServerProtocol/LanguageServerProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ public enum ProtocolError: Error {
case missingReply
}

// NOTE: We should remove these and only use `ProtocolError`?
public typealias ServerError = ProtocolError
public typealias ClientError = ProtocolError

public enum ClientEvent: Sendable {
public typealias RequestResult = Result<Encodable & Sendable, AnyJSONRPCResponseError>
public typealias RequestHandler = @Sendable (RequestResult) async -> Void

case request(id: JSONId, request: ClientRequest)
case notification(ClientNotification)
case error(Error)
// case error(ClientError)
}

public enum ServerEvent: Sendable {
public typealias RequestResult = Result<Encodable & Sendable, AnyJSONRPCResponseError>
public typealias RequestHandler = @Sendable (RequestResult) async -> Void
Expand Down

0 comments on commit 1f5f818

Please sign in to comment.