From 06f6f8f17b7797367c6286744da2a9761e34b3e5 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 2 Oct 2024 09:07:19 -0700 Subject: [PATCH] Remove references to the `LanguageServerProtocol` modules in that module itself --- .../LanguageServerProtocol/Connection.swift | 6 ++-- .../SupportTypes/ClientCapabilities.swift | 28 +++++++++---------- Tests/SourceKitLSPTests/CodeActionTests.swift | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Sources/LanguageServerProtocol/Connection.swift b/Sources/LanguageServerProtocol/Connection.swift index 8061ad182..c15cc1402 100644 --- a/Sources/LanguageServerProtocol/Connection.swift +++ b/Sources/LanguageServerProtocol/Connection.swift @@ -61,14 +61,14 @@ public final class WeakMessageHandler: MessageHandler, Sendable { self.handler = handler } - public func handle(_ params: some LanguageServerProtocol.NotificationType) { + public func handle(_ params: some NotificationType) { handler?.handle(params) } public func handle( _ params: Request, - id: LanguageServerProtocol.RequestID, - reply: @Sendable @escaping (LanguageServerProtocol.LSPResult) -> Void + id: RequestID, + reply: @Sendable @escaping (LSPResult) -> Void ) { guard let handler = handler else { reply(.failure(.unknown("Handler has been deallocated"))) diff --git a/Sources/LanguageServerProtocol/SupportTypes/ClientCapabilities.swift b/Sources/LanguageServerProtocol/SupportTypes/ClientCapabilities.swift index 95c6af3ea..a4ad6df7c 100644 --- a/Sources/LanguageServerProtocol/SupportTypes/ClientCapabilities.swift +++ b/Sources/LanguageServerProtocol/SupportTypes/ClientCapabilities.swift @@ -86,16 +86,16 @@ public struct WorkspaceClientCapabilities: Hashable, Codable, Sendable { public struct Symbol: Hashable, Codable, Sendable { /// Capabilities specific to `SymbolKind`. - public struct SymbolKind: Hashable, Codable, Sendable { + public struct SymbolKindValueSet: Hashable, Codable, Sendable { /// The symbol kind values that the client can support. /// /// If not specified, the client support only the kinds from `File` to `Array` from LSP 1. /// /// If specified, the client *also* guarantees that it will handle unknown kinds gracefully. - public var valueSet: [LanguageServerProtocol.SymbolKind]? = nil + public var valueSet: [SymbolKind]? = nil - public init(valueSet: [LanguageServerProtocol.SymbolKind]? = nil) { + public init(valueSet: [SymbolKind]? = nil) { self.valueSet = valueSet } } @@ -103,9 +103,9 @@ public struct WorkspaceClientCapabilities: Hashable, Codable, Sendable { /// Whether the client supports dynamic registration of this request. public var dynamicRegistration: Bool? = nil - public var symbolKind: SymbolKind? = nil + public var symbolKind: SymbolKindValueSet? = nil - public init(dynamicRegistration: Bool? = nil, symbolKind: SymbolKind? = nil) { + public init(dynamicRegistration: Bool? = nil, symbolKind: SymbolKindValueSet? = nil) { self.dynamicRegistration = dynamicRegistration self.symbolKind = symbolKind } @@ -296,9 +296,9 @@ public struct TextDocumentClientCapabilities: Hashable, Codable, Sendable { /// If not specified, the client support only the kinds from `Text` to `Reference` from LSP 1. /// /// If specified, the client *also* guarantees that it will handle unknown kinds gracefully. - public var valueSet: [LanguageServerProtocol.CompletionItemKind]? = nil + public var valueSet: [CompletionItemKind]? = nil - public init(valueSet: [LanguageServerProtocol.CompletionItemKind]? = nil) { + public init(valueSet: [CompletionItemKind]? = nil) { self.valueSet = valueSet } } @@ -390,9 +390,9 @@ public struct TextDocumentClientCapabilities: Hashable, Codable, Sendable { /// If not specified, the client support only the kinds from `File` to `Array` from LSP 1. /// /// If specified, the client *also* guarantees that it will handle unknown kinds gracefully. - public var valueSet: [LanguageServerProtocol.SymbolKind]? = nil + public var valueSet: [SymbolKind]? = nil - public init(valueSet: [LanguageServerProtocol.SymbolKind]? = nil) { + public init(valueSet: [SymbolKind]? = nil) { self.valueSet = valueSet } } @@ -434,21 +434,21 @@ public struct TextDocumentClientCapabilities: Hashable, Codable, Sendable { /// Literals accepted by the client in response to a `textDocument/codeAction` request. public struct CodeActionLiteralSupport: Hashable, Codable, Sendable { /// Accepted code action kinds. - public struct CodeActionKind: Hashable, Codable, Sendable { + public struct CodeActionKindValueSet: Hashable, Codable, Sendable { /// The code action kind values that the client can support. /// /// If specified, the client *also* guarantees that it will handle unknown kinds gracefully. - public var valueSet: [LanguageServerProtocol.CodeActionKind] + public var valueSet: [CodeActionKind] - public init(valueSet: [LanguageServerProtocol.CodeActionKind]) { + public init(valueSet: [CodeActionKind]) { self.valueSet = valueSet } } - public var codeActionKind: CodeActionKind + public var codeActionKind: CodeActionKindValueSet - public init(codeActionKind: CodeActionKind) { + public init(codeActionKind: CodeActionKindValueSet) { self.codeActionKind = codeActionKind } } diff --git a/Tests/SourceKitLSPTests/CodeActionTests.swift b/Tests/SourceKitLSPTests/CodeActionTests.swift index 7d610e138..c0afa178f 100644 --- a/Tests/SourceKitLSPTests/CodeActionTests.swift +++ b/Tests/SourceKitLSPTests/CodeActionTests.swift @@ -17,7 +17,7 @@ import XCTest private typealias CodeActionCapabilities = TextDocumentClientCapabilities.CodeAction private typealias CodeActionLiteralSupport = CodeActionCapabilities.CodeActionLiteralSupport -private typealias CodeActionKindCapabilities = CodeActionLiteralSupport.CodeActionKind +private typealias CodeActionKindCapabilities = CodeActionLiteralSupport.CodeActionKindValueSet private let clientCapabilitiesWithCodeActionSupport: ClientCapabilities = { var documentCapabilities = TextDocumentClientCapabilities()