Skip to content

Commit 1b25494

Browse files
author
Richard Howell
committed
add file options request
1 parent f99bc4d commit 1b25494

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
import LanguageServerProtocol
13+
14+
/// The SourceKitOptions request is sent from the client to the server
15+
/// to query for the list of compiler options necessary to compile this file.
16+
public struct SourceKitOptions: RequestType, Hashable {
17+
public static let method: String = "textDocument/sourceKitOptions"
18+
public typealias Response = SourceKitOptionsResult
19+
20+
/// The URL of the document to get options for
21+
public var uri: URL
22+
23+
public init(uri: URL) {
24+
self.uri = uri
25+
}
26+
}
27+
28+
public struct SourceKitOptionsResult: ResponseType, Hashable {
29+
/// The compiler options required for the requested file.
30+
public var options: [String]
31+
32+
/// The working directory for the compile command.
33+
public var workingDirectory: String?
34+
}

Sources/BuildServerProtocol/Messages.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ import LanguageServerProtocol
1414
fileprivate let requestTypes: [_RequestType.Type] = [
1515
InitializeBuild.self,
1616
ShutdownBuild.self,
17+
SourceKitOptions.self,
1718
]
1819

1920
fileprivate let notificationTypes: [NotificationType.Type] = [
20-
InitializedBuildNotification.self,
2121
ExitBuildNotification.self,
22+
InitializedBuildNotification.self,
2223
]
2324

2425
public let bspRegistry = MessageRegistry(requests: requestTypes, notifications: notificationTypes)

0 commit comments

Comments
 (0)