forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSuggestionProvider.swift
More file actions
47 lines (42 loc) · 1.5 KB
/
Copy pathSuggestionProvider.swift
File metadata and controls
47 lines (42 loc) · 1.5 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
42
43
44
45
46
import AppKit
import Foundation
import Preferences
import SuggestionModel
import UserDefaultsObserver
public struct SuggestionRequest {
public var fileURL: URL
public var content: String
public var cursorPosition: CursorPosition
public var tabSize: Int
public var indentSize: Int
public var usesTabsForIndentation: Bool
public var ignoreSpaceOnlySuggestions: Bool
public init(
fileURL: URL,
content: String,
cursorPosition: CursorPosition,
tabSize: Int,
indentSize: Int,
usesTabsForIndentation: Bool,
ignoreSpaceOnlySuggestions: Bool
) {
self.fileURL = fileURL
self.content = content
self.cursorPosition = cursorPosition
self.tabSize = tabSize
self.indentSize = indentSize
self.usesTabsForIndentation = usesTabsForIndentation
self.ignoreSpaceOnlySuggestions = ignoreSpaceOnlySuggestions
}
}
public protocol SuggestionServiceProvider {
func getSuggestions(_ request: SuggestionRequest) async throws -> [CodeSuggestion]
func notifyAccepted(_ suggestion: CodeSuggestion) async
func notifyRejected(_ suggestions: [CodeSuggestion]) async
func notifyOpenTextDocument(fileURL: URL, content: String) async throws
func notifyChangeTextDocument(fileURL: URL, content: String) async throws
func notifyCloseTextDocument(fileURL: URL) async throws
func notifySaveTextDocument(fileURL: URL) async throws
func cancelRequest() async
func terminate() async
}