@@ -6,15 +6,15 @@ import Logger
66import Preferences
77import XPCShared
88
9- public protocol CopilotAuthServiceType {
9+ public protocol GitHubCopilotAuthServiceType {
1010 func checkStatus( ) async throws -> GitHubCopilotAccountStatus
1111 func signInInitiate( ) async throws -> ( verificationUri: String , userCode: String )
1212 func signInConfirm( userCode: String ) async throws -> ( username: String , status: GitHubCopilotAccountStatus )
1313 func signOut( ) async throws -> GitHubCopilotAccountStatus
1414 func version( ) async throws -> String
1515}
1616
17- public protocol CopilotSuggestionServiceType {
17+ public protocol GitHubCopilotSuggestionServiceType {
1818 func getCompletions(
1919 fileURL: URL ,
2020 content: String ,
@@ -32,16 +32,16 @@ public protocol CopilotSuggestionServiceType {
3232 func notifySaveTextDocument( fileURL: URL ) async throws
3333}
3434
35- protocol CopilotLSP {
36- func sendRequest< E: CopilotRequestType > ( _ endpoint: E ) async throws -> E . Response
35+ protocol GitHubCopilotLSP {
36+ func sendRequest< E: GitHubCopilotRequestType > ( _ endpoint: E ) async throws -> E . Response
3737 func sendNotification( _ notif: ClientNotification ) async throws
3838}
3939
40- public class CopilotBaseService {
40+ public class GitHubCopilotBaseService {
4141 let projectRootURL : URL
42- var server : CopilotLSP
42+ var server : GitHubCopilotLSP
4343
44- init ( designatedServer: CopilotLSP ) {
44+ init ( designatedServer: GitHubCopilotLSP ) {
4545 projectRootURL = URL ( fileURLWithPath: " / " )
4646 server = designatedServer
4747 }
@@ -151,46 +151,46 @@ public class CopilotBaseService {
151151 }
152152}
153153
154- public final class CopilotAuthService : CopilotBaseService , CopilotAuthServiceType {
154+ public final class GitHubCopilotAuthService : GitHubCopilotBaseService , GitHubCopilotAuthServiceType {
155155 public init ( ) {
156156 let home = FileManager . default. homeDirectoryForCurrentUser
157157 super. init ( projectRootURL: home)
158158 Task {
159- try ? await server. sendRequest ( CopilotRequest . SetEditorInfo ( ) )
159+ try ? await server. sendRequest ( GitHubCopilotRequest . SetEditorInfo ( ) )
160160 }
161161 }
162162
163163 public func checkStatus( ) async throws -> GitHubCopilotAccountStatus {
164- try await server. sendRequest ( CopilotRequest . CheckStatus ( ) ) . status
164+ try await server. sendRequest ( GitHubCopilotRequest . CheckStatus ( ) ) . status
165165 }
166166
167167 public func signInInitiate( ) async throws -> ( verificationUri: String , userCode: String ) {
168- let result = try await server. sendRequest ( CopilotRequest . SignInInitiate ( ) )
168+ let result = try await server. sendRequest ( GitHubCopilotRequest . SignInInitiate ( ) )
169169 return ( result. verificationUri, result. userCode)
170170 }
171171
172172 public func signInConfirm( userCode: String ) async throws
173173 -> ( username: String , status: GitHubCopilotAccountStatus )
174174 {
175- let result = try await server. sendRequest ( CopilotRequest . SignInConfirm ( userCode: userCode) )
175+ let result = try await server. sendRequest ( GitHubCopilotRequest . SignInConfirm ( userCode: userCode) )
176176 return ( result. user, result. status)
177177 }
178178
179179 public func signOut( ) async throws -> GitHubCopilotAccountStatus {
180- try await server. sendRequest ( CopilotRequest . SignOut ( ) ) . status
180+ try await server. sendRequest ( GitHubCopilotRequest . SignOut ( ) ) . status
181181 }
182182
183183 public func version( ) async throws -> String {
184- try await server. sendRequest ( CopilotRequest . GetVersion ( ) ) . version
184+ try await server. sendRequest ( GitHubCopilotRequest . GetVersion ( ) ) . version
185185 }
186186}
187187
188- public final class CopilotSuggestionService : CopilotBaseService , CopilotSuggestionServiceType {
188+ public final class GitHubCopilotSuggestionService : GitHubCopilotBaseService , GitHubCopilotSuggestionServiceType {
189189 override public init ( projectRootURL: URL = URL ( fileURLWithPath: " / " ) ) {
190190 super. init ( projectRootURL: projectRootURL)
191191 }
192192
193- override init ( designatedServer: CopilotLSP ) {
193+ override init ( designatedServer: GitHubCopilotLSP ) {
194194 super. init ( designatedServer: designatedServer)
195195 }
196196
@@ -221,7 +221,7 @@ public final class CopilotSuggestionService: CopilotBaseService, CopilotSuggesti
221221 } ( )
222222
223223 let completions = try await server
224- . sendRequest ( CopilotRequest . GetCompletionsCycling ( doc: . init(
224+ . sendRequest ( GitHubCopilotRequest . GetCompletionsCycling ( doc: . init(
225225 source: content,
226226 tabSize: tabSize,
227227 indentSize: indentSize,
@@ -245,13 +245,13 @@ public final class CopilotSuggestionService: CopilotBaseService, CopilotSuggesti
245245
246246 public func notifyAccepted( _ completion: CodeSuggestion ) async {
247247 _ = try ? await server. sendRequest (
248- CopilotRequest . NotifyAccepted ( completionUUID: completion. uuid)
248+ GitHubCopilotRequest . NotifyAccepted ( completionUUID: completion. uuid)
249249 )
250250 }
251251
252252 public func notifyRejected( _ completions: [ CodeSuggestion ] ) async {
253253 _ = try ? await server. sendRequest (
254- CopilotRequest . NotifyRejected ( completionUUIDs: completions. map ( \. uuid) )
254+ GitHubCopilotRequest . NotifyRejected ( completionUUIDs: completions. map ( \. uuid) )
255255 )
256256 }
257257
@@ -307,8 +307,8 @@ public final class CopilotSuggestionService: CopilotBaseService, CopilotSuggesti
307307 }
308308}
309309
310- extension InitializingServer : CopilotLSP {
311- func sendRequest< E: CopilotRequestType > ( _ endpoint: E ) async throws -> E . Response {
310+ extension InitializingServer : GitHubCopilotLSP {
311+ func sendRequest< E: GitHubCopilotRequestType > ( _ endpoint: E ) async throws -> E . Response {
312312 try await sendRequest ( endpoint. request)
313313 }
314314}
0 commit comments