Skip to content

Commit

Permalink
Lots more Sendable comformance
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Apr 14, 2023
1 parent 4ae3b11 commit 192bcfd
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 78 deletions.
7 changes: 5 additions & 2 deletions Sources/LanguageServerProtocol/BaseProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ public extension ValueSet where T: CaseIterable {
}
}

public enum LanguageIdentifier: String, Codable, CaseIterable {
extension ValueSet: Sendable where T: Sendable {
}

public enum LanguageIdentifier: String, Codable, CaseIterable, Sendable {
case abap
case windowsbat = "bat"
case bibtex
Expand Down Expand Up @@ -131,7 +134,7 @@ public enum LanguageIdentifier: String, Codable, CaseIterable {
case yaml
}

public struct DocumentFilter: Codable, Hashable {
public struct DocumentFilter: Codable, Hashable, Sendable {
public let language: LanguageIdentifier?
public let scheme: String?
public let pattern: String?
Expand Down
6 changes: 3 additions & 3 deletions Sources/LanguageServerProtocol/BasicStructures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ extension VersionedTextDocumentIdentifier: CustomStringConvertible {
}
}

public struct Location: Codable, Hashable {
public struct Location: Codable, Hashable, Sendable {
public let uri: DocumentUri
public let range: LSPRange
}

public struct Command: Codable, Hashable {
public struct Command: Codable, Hashable, Sendable {
public let title: String
public let command: String
public let arguments: [LSPAny]?
Expand Down Expand Up @@ -148,7 +148,7 @@ public enum SymbolKind: Int, CaseIterable, Hashable, Codable, Sendable {
case typeParameter = 26
}

public enum MarkupKind: String, Codable, Hashable {
public enum MarkupKind: String, Codable, Hashable, Sendable {
case plaintext
case markdown
}
Expand Down
34 changes: 17 additions & 17 deletions Sources/LanguageServerProtocol/ClientCapabilities.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Foundation

public struct DynamicRegistrationClientCapabilities: Codable, Hashable {
public struct DynamicRegistrationClientCapabilities: Codable, Hashable, Sendable {
public var dynamicRegistration: Bool?

public init(dynamicRegistration: Bool) {
self.dynamicRegistration = dynamicRegistration
}
}

public struct DynamicRegistrationLinkSupportClientCapabilities: Codable, Hashable {
public struct DynamicRegistrationLinkSupportClientCapabilities: Codable, Hashable, Sendable {
public var dynamicRegistration: Bool?
public var linkSupport: Bool?

Expand All @@ -18,20 +18,20 @@ public struct DynamicRegistrationLinkSupportClientCapabilities: Codable, Hashabl
}
}

public enum ResourceOperationKind: String, Codable, Hashable {
public enum ResourceOperationKind: String, Codable, Hashable, Sendable {
case create
case rename
case delete
}

public enum FailureHandlingKind: String, Codable, Hashable {
public enum FailureHandlingKind: String, Codable, Hashable, Sendable {
case abort
case transactional
case textOnlyTransactional
case undo
}

public struct WorkspaceClientCapabilityEdit: Codable, Hashable {
public struct WorkspaceClientCapabilityEdit: Codable, Hashable, Sendable {
public let documentChanges: Bool?
public let resourceOperations: [ResourceOperationKind]
public let failureHandling: FailureHandlingKind?
Expand All @@ -47,12 +47,12 @@ public typealias DidChangeConfigurationClientCapabilities = GenericDynamicRegist

public typealias DidChangeWatchedFilesClientCapabilities = GenericDynamicRegistration

public struct ShowDocumentClientCapabilities: Hashable, Codable {
public struct ShowDocumentClientCapabilities: Hashable, Codable, Sendable {
public var support: Bool
}

public struct ShowMessageRequestClientCapabilities: Hashable, Codable {
public struct MessageActionItemCapabilities: Hashable, Codable {
public struct ShowMessageRequestClientCapabilities: Hashable, Codable, Sendable {
public struct MessageActionItemCapabilities: Hashable, Codable, Sendable {
public var additionalPropertiesSupport: Bool
}

Expand All @@ -63,7 +63,7 @@ public struct ShowMessageRequestClientCapabilities: Hashable, Codable {
}
}

public struct WindowClientCapabilities: Hashable, Codable {
public struct WindowClientCapabilities: Hashable, Codable, Sendable {
public var workDoneProgress: Bool
public var showMessage: ShowMessageRequestClientCapabilities
public var showDocument: ShowDocumentClientCapabilities
Expand All @@ -75,7 +75,7 @@ public struct WindowClientCapabilities: Hashable, Codable {
}
}

public struct RegularExpressionsClientCapabilities: Hashable, Codable {
public struct RegularExpressionsClientCapabilities: Hashable, Codable, Sendable {
public var engine: String
public var version: String?

Expand All @@ -85,7 +85,7 @@ public struct RegularExpressionsClientCapabilities: Hashable, Codable {
}
}

public struct MarkdownClientCapabilities: Hashable, Codable {
public struct MarkdownClientCapabilities: Hashable, Codable, Sendable {
public var parser: String
public var version: String?
public var allowedTags: [String]?
Expand All @@ -97,7 +97,7 @@ public struct MarkdownClientCapabilities: Hashable, Codable {
}
}

public struct GeneralClientCapabilities: Hashable, Codable {
public struct GeneralClientCapabilities: Hashable, Codable, Sendable {
public var regularExpressions: RegularExpressionsClientCapabilities?
public var markdown: MarkdownClientCapabilities?

Expand All @@ -107,7 +107,7 @@ public struct GeneralClientCapabilities: Hashable, Codable {
}
}

public struct TextDocumentSyncClientCapabilities: Codable, Hashable {
public struct TextDocumentSyncClientCapabilities: Codable, Hashable, Sendable {
public let dynamicRegistration: Bool?
public let willSave: Bool?
public let willSaveWaitUntil: Bool?
Expand All @@ -121,7 +121,7 @@ public struct TextDocumentSyncClientCapabilities: Codable, Hashable {
}
}

public struct TextDocumentClientCapabilities: Codable, Hashable {
public struct TextDocumentClientCapabilities: Codable, Hashable, Sendable {
public var synchronization: TextDocumentSyncClientCapabilities?
public var completion: CompletionClientCapabilities?
public var hover: HoverClientCapabilities?
Expand Down Expand Up @@ -204,9 +204,9 @@ public struct TextDocumentClientCapabilities: Codable, Hashable {
}
}

public struct ClientCapabilities: Codable, Hashable {
public struct Workspace: Codable, Hashable {
public struct FileOperations: Codable, Hashable {
public struct ClientCapabilities: Codable, Hashable, Sendable {
public struct Workspace: Codable, Hashable, Sendable {
public struct FileOperations: Codable, Hashable, Sendable {
public var dynamicRegistration: Bool?
public var didCreate: Bool?
public var willCreate: Bool?
Expand Down
4 changes: 2 additions & 2 deletions Sources/LanguageServerProtocol/General.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Foundation

public enum Tracing: String, Codable, Hashable {
public enum Tracing: String, Codable, Hashable, Sendable {
case off
case messages
case verbose
}

public struct InitializeParams: Codable {
public struct InitializeParams: Codable, Hashable, Sendable {
public struct ClientInfo: Codable, Hashable, Sendable {
public let name: String
public let version: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ extension CodeActionKind {
public static var SourceOrganizeImports: CodeActionKind = "source.organizeImports"
}

public struct CodeActionClientCapabilities: Codable, Hashable {
public struct CodeActionLiteralSupport: Codable, Hashable {
public struct CodeActionClientCapabilities: Codable, Hashable, Sendable {
public struct CodeActionLiteralSupport: Codable, Hashable, Sendable {
public var codeActionKind: ValueSet<CodeActionKind>

public init(codeActionKind: ValueSet<CodeActionKind>) {
self.codeActionKind = codeActionKind
}
}

public struct ResolveSupport: Codable, Hashable {
public struct ResolveSupport: Codable, Hashable, Sendable {
public var properties: [String]

public init(properties: [String]) {
Expand Down
10 changes: 5 additions & 5 deletions Sources/LanguageServerProtocol/LanguageFeatures/CodeLens.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ import Foundation

public typealias CodeLensClientCapabilities = DynamicRegistrationClientCapabilities

public struct CodeLensWorkspaceClientCapabilities: Codable, Hashable {
public struct CodeLensWorkspaceClientCapabilities: Codable, Hashable, Sendable {
public var refreshSupport: Bool?

public init(refreshSupport: Bool? = nil) {
self.refreshSupport = refreshSupport
}
}

public struct CodeLensOptions: Codable, Hashable {
public struct CodeLensOptions: Codable, Hashable, Sendable {
public var workDoneProgress: Bool?
public var resolveProvider: Bool?
}

public struct CodeLensRegistrationOptions: Codable, Hashable {
public struct CodeLensRegistrationOptions: Codable, Hashable, Sendable {
public var documentSelector: DocumentSelector?
public var workDoneProgress: Bool?
public var resolveProvider: Bool?
}

public struct CodeLensParams: Codable, Hashable {
public struct CodeLensParams: Codable, Hashable, Sendable {
public var textDocument: TextDocumentIdentifier
public var workDoneToken: ProgressToken?
public var partialResultToken: ProgressToken?
Expand All @@ -33,7 +33,7 @@ public struct CodeLensParams: Codable, Hashable {
}
}

public struct CodeLens: Codable {
public struct CodeLens: Codable, Sendable {
public var range: LSPRange
public var command: Command?
public var data: LSPAny?
Expand Down
14 changes: 7 additions & 7 deletions Sources/LanguageServerProtocol/LanguageFeatures/Completion.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Foundation
import JSONRPC

public struct CompletionClientCapabilities: Codable, Hashable {
public struct CompletionItem: Codable, Hashable {
public struct ResolveSupport: Codable, Hashable {
public struct CompletionClientCapabilities: Codable, Hashable, Sendable {
public struct CompletionItem: Codable, Hashable, Sendable {
public struct ResolveSupport: Codable, Hashable, Sendable {
public var properties: [String]

public init(properties: [String]) {
Expand Down Expand Up @@ -45,7 +45,7 @@ public struct CompletionClientCapabilities: Codable, Hashable {
}
}

public struct CompletionList: Codable, Hashable {
public struct CompletionList: Codable, Hashable, Sendable {
public var itemDefaults: [String]?

public init(itemDefaults: [String]? = nil) {
Expand Down Expand Up @@ -81,7 +81,7 @@ public enum CompletionTriggerKind: Int, Codable, Hashable {
case triggerForIncompleteCompletions = 3
}

public enum CompletionItemKind: Int, CaseIterable, Codable, Hashable {
public enum CompletionItemKind: Int, CaseIterable, Codable, Hashable, Sendable {
case text = 1
case method = 2
case function = 3
Expand Down Expand Up @@ -109,7 +109,7 @@ public enum CompletionItemKind: Int, CaseIterable, Codable, Hashable {
case typeParameter = 25
}

public enum CompletionItemTag: Int, CaseIterable, Codable, Hashable {
public enum CompletionItemTag: Int, CaseIterable, Codable, Hashable, Sendable {
case deprecated = 1
}

Expand Down Expand Up @@ -235,7 +235,7 @@ public struct CompletionRegistrationOptions: Codable {
public let resolveProvider: Bool?
}

public enum InsertTextMode: Int, CaseIterable, Codable, Hashable {
public enum InsertTextMode: Int, CaseIterable, Codable, Hashable, Sendable {
case asIs = 1
case adjustIndentation = 2
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public struct PublishDiagnosticsClientCapabilities: Codable, Hashable {
public struct PublishDiagnosticsClientCapabilities: Codable, Hashable, Sendable {
public var relatedInformation: Bool?
public var tagSupport: ValueSet<DiagnosticTag>?
public var versionSupport: Bool?
Expand All @@ -16,26 +16,26 @@ public struct PublishDiagnosticsClientCapabilities: Codable, Hashable {
}
}

public struct DiagnosticRelatedInformation: Codable, Hashable {
public struct DiagnosticRelatedInformation: Codable, Hashable, Sendable {
public let location: Location
public let message: String
}

public typealias DiagnosticCode = TwoTypeOption<Int, String>

public enum DiagnosticSeverity: Int, CaseIterable, Codable, Hashable {
public enum DiagnosticSeverity: Int, CaseIterable, Codable, Hashable, Sendable {
case error = 1
case warning = 2
case information = 3
case hint = 4
}

public enum DiagnosticTag: Int, CaseIterable, Codable, Hashable {
public enum DiagnosticTag: Int, CaseIterable, Codable, Hashable, Sendable {
case unnecessary = 1
case deprecated = 2
}

public struct Diagnostic: Codable, Hashable {
public struct Diagnostic: Codable, Hashable, Sendable {
public let range: LSPRange
public let severity: DiagnosticSeverity?
public let code: DiagnosticCode?
Expand All @@ -45,7 +45,7 @@ public struct Diagnostic: Codable, Hashable {
public let relatedInformation: [DiagnosticRelatedInformation]?
}

public struct PublishDiagnosticsParams: Codable, Hashable {
public struct PublishDiagnosticsParams: Codable, Hashable, Sendable {
public let uri: DocumentUri
public let version: Int?
public let diagnostics: [Diagnostic]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

public struct DocumentLinkClientCapabilities: Codable, Hashable {
public struct DocumentLinkClientCapabilities: Codable, Hashable, Sendable {
public var dynamicRegistration: Bool?
public var tooltipSupport: Bool?

Expand All @@ -17,12 +17,12 @@ public struct DocumentLinkClientCapabilities: Codable, Hashable {
}
}

public struct DocumentLinkOptions: Codable, Hashable {
public struct DocumentLinkOptions: Codable, Hashable, Sendable {
public var workDoneProgress: Bool?
public var resolveProvider: Bool?
}

public struct DocumentLinkRegistrationOptions: Codable, Hashable {
public struct DocumentLinkRegistrationOptions: Codable, Hashable, Sendable {
public var workDoneProgress: Bool?
public var documentSelector: DocumentSelector?
public var resolveProvider: Bool?
Expand All @@ -34,12 +34,12 @@ public struct DocumentLinkRegistrationOptions: Codable, Hashable {
}
}

public struct DocumentLinkParams: Codable, Hashable {
public struct DocumentLinkParams: Codable, Hashable, Sendable {
public var workDoneToken: ProgressToken?
public var partialResultToken: ProgressToken?
}

public struct DocumentLink: Codable, Hashable {
public struct DocumentLink: Codable, Hashable, Sendable {
public var range: LSPRange
public var target: DocumentUri?
public var tooltip: String?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public struct DocumentSymbolClientCapabilities: Codable, Hashable {
public struct DocumentSymbolClientCapabilities: Codable, Hashable, Sendable {
public var dynamicRegistration: Bool?
public var symbolKind: ValueSet<SymbolKind>?
public var hierarchicalDocumentSymbolSupport: Bool?
Expand Down
Loading

0 comments on commit 192bcfd

Please sign in to comment.