forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreviousSuggestionCommand.swift
More file actions
37 lines (32 loc) · 1.04 KB
/
Copy pathPreviousSuggestionCommand.swift
File metadata and controls
37 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Client
import Foundation
import SuggestionBasic
import XcodeKit
import XPCShared
class PreviousSuggestionCommand: NSObject, XCSourceEditorCommand, CommandType {
var name: String { "Previous Suggestion" }
func perform(
with invocation: XCSourceEditorCommandInvocation,
completionHandler: @escaping (Error?) -> Void
) {
completionHandler(nil)
Task {
let service = try getService()
_ = try await service.getPreviousSuggestedCode(editorContent: .init(invocation))
}
}
}
class PreviousSuggestionGroupCommand: NSObject, XCSourceEditorCommand, CommandType {
var name: String { "Previous Suggestion Group" }
func perform(
with invocation: XCSourceEditorCommandInvocation,
completionHandler: @escaping (Error?) -> Void
) {
completionHandler(nil)
Task {
let service = try getService()
_ = try await service
.send(requestBody: ExtensionServiceRequests.PreviousSuggestionGroup())
}
}
}