Skip to content

Commit 2610172

Browse files
committed
Allow enabling experimental features in the debug index subcommand
1 parent aa17664 commit 2610172

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Sources/Diagnose/IndexCommand.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,23 @@ public struct IndexCommand: AsyncParsableCommand {
6868
)
6969
var toolchainOverride: String?
7070

71+
@Option(
72+
name: .customLong("experimental-index-feature"),
73+
help: """
74+
Enable an experimental sourcekit-lsp feature.
75+
Available features are: \(ExperimentalFeature.allCases.map(\.rawValue).joined(separator: ", "))
76+
"""
77+
)
78+
var experimentalFeatures: [ExperimentalFeature] = []
79+
7180
@Option(help: "The path to the project that should be indexed")
7281
var project: String
7382

7483
public init() {}
7584

7685
public func run() async throws {
7786
var serverOptions = SourceKitLSPServer.Options()
87+
serverOptions.experimentalFeatures = Set(experimentalFeatures)
7888
serverOptions.experimentalFeatures.insert(.backgroundIndexing)
7989

8090
let installPath =
@@ -109,3 +119,9 @@ fileprivate extension SourceKitLSPServer {
109119
}
110120
}
111121
}
122+
123+
#if compiler(>=6)
124+
extension ExperimentalFeature: @retroactive ExpressibleByArgument {}
125+
#else
126+
extension ExperimentalFeature: ExpressibleByArgument {}
127+
#endif

Sources/sourcekit-lsp/SourceKitLSP.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,3 @@ struct SourceKitLSP: AsyncParsableCommand {
289289
}
290290
}
291291
}
292-
293-
#if compiler(>=6)
294-
extension ExperimentalFeature: @retroactive ExpressibleByArgument {}
295-
#else
296-
extension ExperimentalFeature: ExpressibleByArgument {}
297-
#endif

0 commit comments

Comments
 (0)