1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import LanguageServerProtocol
/// Like the language server protocol, the initialize request is sent
/// as the first request from the client to the server. If the server
/// receives a request or notification before the initialize request
/// it should act as follows:
///
/// - For a request the response should be an error with code: -32002.
/// The message can be picked by the server.
///
/// - Notifications should be dropped, except for the exit notification.
/// This will allow the exit of a server without an initialize request.
///
/// Until the server has responded to the initialize request with an
/// InitializeBuildResult, the client must not send any additional
/// requests or notifications to the server.
public struct InitializeBuild: RequestType, Hashable {
public static let method: String = "build/initialize"
public typealias Response = InitializeBuildResult
/// Name of the client
public var displayName: String
/// The version of the client
public var version: String
/// The BSP version that the client speaks=
public var bspVersion: String
/// The rootUri of the workspace
public var rootUri: URI
/// The capabilities of the client
public var capabilities: BuildClientCapabilities
public init(
displayName: String,
version: String,
bspVersion: String,
rootUri: URI,
capabilities: BuildClientCapabilities
) {
self.displayName = displayName
self.version = version
self.bspVersion = bspVersion
self.rootUri = rootUri
self.capabilities = capabilities
}
}
public struct BuildClientCapabilities: Codable, Hashable, Sendable {
/// The languages that this client supports.
/// The ID strings for each language is defined in the LSP.
/// The server must never respond with build targets for other
/// languages than those that appear in this list.
public var languageIds: [Language]
public init(languageIds: [Language]) {
self.languageIds = languageIds
}
}
public struct InitializeBuildResult: ResponseType, Hashable {
/// Name of the server
public var displayName: String
/// The version of the server
public var version: String
/// The BSP version that the server speaks
public var bspVersion: String
/// The capabilities of the build server
public var capabilities: BuildServerCapabilities
/// Optional metadata about the server
public var data: LSPAny?
public init(
displayName: String,
version: String,
bspVersion: String,
capabilities: BuildServerCapabilities,
data: LSPAny? = nil
) {
self.displayName = displayName
self.version = version
self.bspVersion = bspVersion
self.capabilities = capabilities
self.data = data
}
}
public struct BuildServerCapabilities: Codable, Hashable, Sendable {
/// The languages the server supports compilation via method buildTarget/compile.
public var compileProvider: CompileProvider? = nil
/// The languages the server supports test execution via method buildTarget/test
public var testProvider: TestProvider? = nil
/// The languages the server supports run via method buildTarget/run
public var runProvider: RunProvider? = nil
/// The server can provide a list of targets that contain a
/// single text document via the method buildTarget/inverseSources
public var inverseSourcesProvider: Bool? = nil
/// The server provides sources for library dependencies
/// via method buildTarget/dependencySources
public var dependencySourcesProvider: Bool? = nil
/// The server provides all the resource dependencies
/// via method buildTarget/resources
public var resourcesProvider: Bool? = nil
/// The server sends notifications to the client on build
/// target change events via buildTarget/didChange
public var buildTargetChangedProvider: Bool? = nil
}
public struct CompileProvider: Codable, Hashable, Sendable {
public var languageIds: [Language]
public init(languageIds: [Language]) {
self.languageIds = languageIds
}
}
public struct RunProvider: Codable, Hashable, Sendable {
public var languageIds: [Language]
public init(languageIds: [Language]) {
self.languageIds = languageIds
}
}
public struct TestProvider: Codable, Hashable, Sendable {
public var languageIds: [Language]
public init(languageIds: [Language]) {
self.languageIds = languageIds
}
}
public struct InitializedBuildNotification: NotificationType {
public static let method: String = "build/initialized"
public init() {}
}
|