Skip to content

Commit 71c205d

Browse files
authored
Merge pull request #2124 from MahdiBM/fix-experimenta-features-flag
Fix `experimentalFeatures` command line flag and description
2 parents d97b005 + efe6c7f commit 71c205d

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Sources/Diagnose/IndexCommand.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ package struct IndexCommand: AsyncParsableCommand {
6969
var toolchainOverride: String?
7070

7171
@Option(
72-
name: .customLong("experimental-index-feature"),
72+
name: .customLong("experimental-feature"),
7373
help: """
7474
Enable an experimental sourcekit-lsp feature.
75-
Available features are: \(ExperimentalFeature.allCases.map(\.rawValue).joined(separator: ", "))
75+
Available features are: \(ExperimentalFeature.allNonInternalCases.map(\.rawValue).joined(separator: ", "))
7676
"""
7777
)
7878
var experimentalFeatures: [ExperimentalFeature] = []

Sources/SKOptions/ExperimentalFeatures.swift

+25
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,29 @@ public enum ExperimentalFeature: String, Codable, Sendable, CaseIterable {
4444
///
4545
/// - Note: Internal option, for testing only
4646
case synchronizeForBuildSystemUpdates = "synchronize-for-build-system-updates"
47+
48+
/// All non-internal experimental features.
49+
public static var allNonInternalCases: [ExperimentalFeature] {
50+
allCases.filter { !$0.isInternal }
51+
}
52+
53+
/// Whether the feature is internal.
54+
var isInternal: Bool {
55+
switch self {
56+
case .onTypeFormatting:
57+
return false
58+
case .setOptionsRequest:
59+
return true
60+
case .sourceKitOptionsRequest:
61+
return true
62+
case .isIndexingRequest:
63+
return true
64+
case .structuredLogs:
65+
return false
66+
case .outputPathsRequest:
67+
return true
68+
case .synchronizeForBuildSystemUpdates:
69+
return true
70+
}
71+
}
4772
}

Sources/sourcekit-lsp/SourceKitLSP.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct SourceKitLSP: AsyncParsableCommand {
136136
name: .customLong("experimental-feature"),
137137
help: """
138138
Enable an experimental sourcekit-lsp feature.
139-
Available features are: \(ExperimentalFeature.allCases.map(\.rawValue).joined(separator: ", "))
139+
Available features are: \(ExperimentalFeature.allNonInternalCases.map(\.rawValue).joined(separator: ", "))
140140
"""
141141
)
142142
var experimentalFeatures: [String] = []

0 commit comments

Comments
 (0)