forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSuggestionWidgetDataSource.swift
More file actions
35 lines (30 loc) · 943 Bytes
/
SuggestionWidgetDataSource.swift
File metadata and controls
35 lines (30 loc) · 943 Bytes
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
import ChatTab
import Foundation
public protocol SuggestionWidgetDataSource {
func suggestionForFile(at url: URL) async -> SuggestionProvider?
func chatForFile(at url: URL) async -> ChatProvider?
func promptToCodeForFile(at url: URL) async -> PromptToCodeProvider?
}
struct MockWidgetDataSource: SuggestionWidgetDataSource {
func suggestionForFile(at url: URL) async -> SuggestionProvider? {
return SuggestionProvider(
code: """
func test() {
let x = 1
let y = 2
let z = x + y
}
""",
language: "swift",
startLineIndex: 1,
suggestionCount: 3,
currentSuggestionIndex: 0
)
}
func chatForFile(at url: URL) async -> ChatProvider? {
return nil
}
func promptToCodeForFile(at url: URL) async -> PromptToCodeProvider? {
return nil
}
}