Skip to content

Commit b45d975

Browse files
authored
Merge pull request #1635 from lokesh-tr/remove-experimental-feature-flag-for-macro-expansions
Remove `ExperimentalFeature.showMacroExpansions` flag for macro expansions
2 parents 1f6bfce + a616fc1 commit b45d975

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

Sources/Diagnose/ActiveRequestsCommand.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import ArgumentParser
1414
import Foundation
1515
import RegexBuilder
16+
1617
import class TSCBasic.Process
1718

1819
package struct ActiveRequestsCommand: AsyncParsableCommand {

Sources/SKSupport/ExperimentalFeatures.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
/// An experimental feature that can be enabled by passing `--experimental-feature` to `sourcekit-lsp` on the command
1414
/// line. The raw value of this feature is how it is named on the command line.
1515
public enum ExperimentalFeature: String, Codable, Sendable, CaseIterable {
16-
/// Enable showing macro expansions via `ShowDocumentRequest`
17-
case showMacroExpansions = "show-macro-expansions"
16+
/* This is here to silence the errors when the enum doesn't have any cases */
17+
case exampleCase = "example-case"
1818
}

Sources/SourceKitLSP/Swift/SwiftLanguageService.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -847,12 +847,9 @@ extension SwiftLanguageService {
847847

848848
var canInlineMacro = false
849849

850-
let showMacroExpansionsIsEnabled =
851-
await self.sourceKitLSPServer?.options.hasExperimentalFeature(.showMacroExpansions) ?? false
852-
853850
var refactorActions = cursorInfoResponse.refactorActions.compactMap {
854851
let lspCommand = $0.asCommand()
855-
if !canInlineMacro, showMacroExpansionsIsEnabled {
852+
if !canInlineMacro {
856853
canInlineMacro = $0.actionString == "source.refactoring.kind.inline.macro"
857854
}
858855

@@ -996,10 +993,7 @@ extension SwiftLanguageService {
996993
package func executeCommand(_ req: ExecuteCommandRequest) async throws -> LSPAny? {
997994
if let command = req.swiftCommand(ofType: SemanticRefactorCommand.self) {
998995
try await semanticRefactoring(command)
999-
} else if let command = req.swiftCommand(ofType: ExpandMacroCommand.self),
1000-
let experimentalFeatures = await self.sourceKitLSPServer?.options.experimentalFeatures,
1001-
experimentalFeatures.contains(.showMacroExpansions)
1002-
{
996+
} else if let command = req.swiftCommand(ofType: ExpandMacroCommand.self) {
1003997
try await expandMacro(command)
1004998
} else {
1005999
throw ResponseError.unknown("unknown command \(req.command)")

Tests/SourceKitLSPTests/ExpandMacroTests.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ final class ExpandMacroTests: XCTestCase {
5959
""",
6060
]
6161

62-
let options = SourceKitLSPOptions.testDefault(experimentalFeatures: [.showMacroExpansions])
63-
6462
for (getReferenceDocument, peekDocuments) in cartesianProduct([true], [true]) {
6563
let project = try await SwiftPMTestProject(
6664
files: files,
@@ -69,7 +67,7 @@ final class ExpandMacroTests: XCTestCase {
6967
"workspace/peekDocuments": .bool(peekDocuments),
7068
"workspace/getReferenceDocument": .bool(getReferenceDocument),
7169
]),
72-
options: options,
70+
options: SourceKitLSPOptions.testDefault(),
7371
enableBackgroundIndexing: true
7472
)
7573

@@ -236,8 +234,6 @@ final class ExpandMacroTests: XCTestCase {
236234
"""#,
237235
]
238236

239-
let options = SourceKitLSPOptions.testDefault(experimentalFeatures: [.showMacroExpansions])
240-
241237
for (getReferenceDocument, peekDocuments) in cartesianProduct([true, false], [true, false]) {
242238
let project = try await SwiftPMTestProject(
243239
files: files,
@@ -246,7 +242,7 @@ final class ExpandMacroTests: XCTestCase {
246242
"workspace/peekDocuments": .bool(peekDocuments),
247243
"workspace/getReferenceDocument": .bool(getReferenceDocument),
248244
]),
249-
options: options,
245+
options: SourceKitLSPOptions.testDefault(),
250246
enableBackgroundIndexing: true
251247
)
252248

@@ -443,7 +439,7 @@ final class ExpandMacroTests: XCTestCase {
443439
"workspace/peekDocuments": .bool(true),
444440
"workspace/getReferenceDocument": .bool(true),
445441
]),
446-
options: SourceKitLSPOptions.testDefault(experimentalFeatures: [.showMacroExpansions]),
442+
options: SourceKitLSPOptions.testDefault(),
447443
enableBackgroundIndexing: true
448444
)
449445

0 commit comments

Comments
 (0)