1- import AppKit
1+ import AppKit
2+ import struct CopilotForXcodeKit. SuggestionServiceConfiguration
23import Foundation
34import Preferences
45import SuggestionModel
@@ -13,7 +14,8 @@ public struct SuggestionRequest {
1314 public var tabSize : Int
1415 public var indentSize : Int
1516 public var usesTabsForIndentation : Bool
16- public var ignoreSpaceOnlySuggestions : Bool
17+ public var ignoreSpaceOnlySuggestions : Bool
18+ public var relevantCodeSnippets : [ RelevantCodeSnippet ]
1719
1820 public init (
1921 fileURL: URL ,
@@ -24,7 +26,8 @@ public struct SuggestionRequest {
2426 tabSize: Int ,
2527 indentSize: Int ,
2628 usesTabsForIndentation: Bool ,
27- ignoreSpaceOnlySuggestions: Bool
29+ ignoreSpaceOnlySuggestions: Bool ,
30+ relevantCodeSnippets: [ RelevantCodeSnippet ]
2831 ) {
2932 self . fileURL = fileURL
3033 self . relativePath = relativePath
@@ -35,12 +38,24 @@ public struct SuggestionRequest {
3538 self . indentSize = indentSize
3639 self . usesTabsForIndentation = usesTabsForIndentation
3740 self . ignoreSpaceOnlySuggestions = ignoreSpaceOnlySuggestions
41+ self . relevantCodeSnippets = relevantCodeSnippets
42+ }
43+ }
44+
45+ public struct RelevantCodeSnippet : Codable {
46+ public var content : String
47+ public var priority : Int
48+ public var filePath : String
49+
50+ public init ( content: String , priority: Int , filePath: String ) {
51+ self . content = content
52+ self . priority = priority
53+ self . filePath = filePath
3854 }
3955}
4056
4157public protocol SuggestionServiceProvider {
4258 func getSuggestions( _ request: SuggestionRequest ) async throws -> [ CodeSuggestion ]
43-
4459 func notifyAccepted( _ suggestion: CodeSuggestion ) async
4560 func notifyRejected( _ suggestions: [ CodeSuggestion ] ) async
4661 func notifyOpenTextDocument( fileURL: URL , content: String ) async throws
@@ -49,5 +64,8 @@ public protocol SuggestionServiceProvider {
4964 func notifySaveTextDocument( fileURL: URL ) async throws
5065 func cancelRequest( ) async
5166 func terminate( ) async
67+
68+ var configuration : SuggestionServiceConfiguration { get async }
5269}
5370
71+ public typealias SuggestionServiceConfiguration = CopilotForXcodeKit . SuggestionServiceConfiguration
0 commit comments