forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphicalUserInterfaceController.swift.swift
More file actions
41 lines (37 loc) · 1.38 KB
/
GraphicalUserInterfaceController.swift.swift
File metadata and controls
41 lines (37 loc) · 1.38 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
37
38
39
40
41
import AppKit
import Environment
import SuggestionWidget
@MainActor
public final class GraphicalUserInterfaceController {
public nonisolated static let shared = GraphicalUserInterfaceController()
nonisolated let realtimeSuggestionIndicatorController = RealtimeSuggestionIndicatorController()
nonisolated let suggestionWidget = SuggestionWidgetController()
private nonisolated init() {
Task { @MainActor in
suggestionWidget.onNextButtonTapped = {
Task { @ServiceActor in
let handler = PseudoCommandHandler()
await handler.presentNextSuggestion()
}
}
suggestionWidget.onPreviousButtonTapped = {
Task { @ServiceActor in
let handler = PseudoCommandHandler()
await handler.presentPreviousSuggestion()
}
}
suggestionWidget.onRejectButtonTapped = {
Task { @ServiceActor in
let handler = PseudoCommandHandler()
await handler.rejectSuggestions()
}
}
suggestionWidget.onAcceptButtonTapped = {
Task { @ServiceActor in
let handler = PseudoCommandHandler()
await handler.acceptSuggestion()
}
}
}
}
}