Skip to content

Commit 151ac12

Browse files
add target name to command arguments
1 parent 96d8dd0 commit 151ac12

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/SourceKitLSP/Swift/SwiftCodeLensScanner.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ final class SwiftCodeLensScanner: SyntaxVisitor {
7070
if attribute.trimmedDescription == "@main" {
7171
let range = self.snapshot.absolutePositionRange(of: attribute.trimmedRange)
7272
var targetNameToAppend: String = ""
73+
var arguments: [LSPAny] = []
7374
if let targetName {
7475
targetNameToAppend = " \(targetName)"
76+
arguments.append(.string(targetName))
7577
}
7678

7779
if let runCommand = supportedCommands[SupportedCodeLensCommand.run] {
@@ -80,7 +82,7 @@ final class SwiftCodeLensScanner: SyntaxVisitor {
8082
self.result.append(
8183
CodeLens(
8284
range: range,
83-
command: Command(title: "Run" + targetNameToAppend, command: runCommand, arguments: nil)
85+
command: Command(title: "Run" + targetNameToAppend, command: runCommand, arguments: arguments)
8486
)
8587
)
8688
}
@@ -89,7 +91,7 @@ final class SwiftCodeLensScanner: SyntaxVisitor {
8991
self.result.append(
9092
CodeLens(
9193
range: range,
92-
command: Command(title: "Debug" + targetNameToAppend, command: debugCommand, arguments: nil)
94+
command: Command(title: "Debug" + targetNameToAppend, command: debugCommand, arguments: arguments)
9395
)
9496
)
9597
}

0 commit comments

Comments
 (0)