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
36 lines (35 loc) · 1.34 KB
/
GraphicalUserInterfaceController.swift.swift
File metadata and controls
36 lines (35 loc) · 1.34 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 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.dataSource = WidgetDataSource.shared
suggestionWidget.onOpenChatClicked = {
Task {
let commandHandler = WindowBaseCommandHandler()
_ = try await commandHandler.chatWithSelection(editor: .init(
content: "",
lines: [],
uti: "",
cursorPosition: .outOfScope,
selections: [],
tabSize: 0,
indentSize: 0,
usesTabsForIndentation: false
))
}
}
suggestionWidget.onCustomCommandClicked = { command in
Task {
let commandHandler = PseudoCommandHandler()
await commandHandler.handleCustomCommand(command)
}
}
}
}
}