Skip to content

Commit f0e92f2

Browse files
committed
Update command
1 parent 5256c3a commit f0e92f2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

EditorExtension/CustomCommand.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class CustomCommand: NSObject, XCSourceEditorCommand, CommandType {
1717
Task {
1818
do {
1919
let service = try getService()
20-
if let content = try await service.explainSelection(
20+
if let content = try await service.customCommand(
21+
name: name,
2122
editorContent: .init(invocation)
2223
) {
2324
invocation.accept(content)

EditorExtension/SourceEditorExtension.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Client
22
import Foundation
33
import XcodeKit
4+
import Preferences
45

56
class SourceEditorExtension: NSObject, XCSourceEditorExtension {
67
var commandDefinitions: [[XCSourceEditorCommandDefinitionKey: Any]] {
@@ -65,5 +66,7 @@ func makeCommandDefinition(_ commandType: CommandType)
6566
}
6667

6768
func customCommands() -> [CustomCommand] {
68-
return customCommands()
69+
UserDefaults.shared.value(for: \.customCommands).map {
70+
CustomCommand(name: $0.name)
71+
}
6972
}

0 commit comments

Comments
 (0)