Skip to content

Commit 0e05bca

Browse files
remove isHeader from SourceKitSourceItemData
1 parent 0ea0e00 commit 0e05bca

File tree

3 files changed

+9
-32
lines changed

3 files changed

+9
-32
lines changed

Contributor Documentation/BSP Extensions.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,13 @@ export interface PrepareParams {
7676
```ts
7777
export interface SourceKitSourceItemData {
7878
/** The language of the source file. If `nil`, the language is inferred from the file extension. */
79-
language? LanguageId;
79+
language?: LanguageId;
8080

81-
/** Whether the file is a header file that is clearly associated with one target.
82-
*
83-
* For example header files in SwiftPM projects are always associated to one target and SwiftPM can provide build
84-
* settings for that header file.
85-
*
86-
* In general, build systems don't need to list all header files in the `buildTarget/sources` request: Semantic
87-
* functionality for header files is usually provided by finding a main file that includes the header file and
88-
* inferring build settings from it. Listing header files in `buildTarget/sources` allows SourceKit-LSP to provide
89-
* semantic functionality for header files if they haven't been included by any main file. **/
90-
isHeader?: bool;
81+
/**
82+
* The kind of source file that this source item represents. If omitted, the item is assumed to be a normal source
83+
* file, ie. omitting this key is equivalent to specifying it as `source`.
84+
*/
85+
kind?: "source" | "header" | "doccCatalog";
9186

9287
/**
9388
* The output path that is during indexing for this file, ie. the `-index-unit-output-path`, if it is specified

Sources/BuildServerProtocol/Messages/BuildTargetSourcesRequest.swift

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,8 @@ public struct SourceKitSourceItemData: LSPAnyCodable, Codable {
143143
/// The language of the source file. If `nil`, the language is inferred from the file extension.
144144
public var language: Language?
145145

146-
/// Whether the file is a header file that is clearly associated with one target.
147-
///
148-
/// For example header files in SwiftPM projects are always associated to one target and SwiftPM can provide build
149-
/// settings for that header file.
150-
///
151-
/// In general, build systems don't need to list all header files in the `buildTarget/sources` request: Semantic
152-
/// functionality for header files is usually provided by finding a main file that includes the header file and
153-
/// inferring build settings from it. Listing header files in `buildTarget/sources` allows SourceKit-LSP to provide
154-
/// semantic functionality for header files if they haven't been included by any main file.
155-
public var isHeader: Bool? {
156-
guard let kind else {
157-
return nil
158-
}
159-
return kind == .header
160-
}
161-
146+
/// The kind of source file that this source item represents. If omitted, the item is assumed to be a normal source file,
147+
/// ie. omitting this key is equivalent to specifying it as `source`.
162148
public var kind: SourceKitSourceItemKind?
163149

164150
/// The output path that is used during indexing for this file, ie. the `-index-unit-output-path`, if it is specified
@@ -201,10 +187,6 @@ public struct SourceKitSourceItemData: LSPAnyCodable, Codable {
201187
if let kind {
202188
result[CodingKeys.kind.stringValue] = .string(kind.rawValue)
203189
}
204-
// Backwards compatibility for isHeader
205-
if let isHeader {
206-
result["isHeader"] = .bool(isHeader)
207-
}
208190
if let outputPath {
209191
result[CodingKeys.outputPath.stringValue] = .string(outputPath)
210192
}

Sources/BuildSystemIntegration/BuildSystemManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
12661266
isPartOfRootProject: isPartOfRootProject,
12671267
mayContainTests: mayContainTests,
12681268
isBuildable: !(target?.tags.contains(.notBuildable) ?? false)
1269-
&& !(sourceKitData?.isHeader ?? false)
1269+
&& (sourceKitData?.kind ?? .source) == .source
12701270
)
12711271
switch sourceItem.kind {
12721272
case .file:

0 commit comments

Comments
 (0)