Skip to content

Commit 36e45cb

Browse files
committed
Rename Copilot to GitHubCopilot
1 parent 122420d commit 36e45cb

File tree

10 files changed

+98
-67
lines changed

10 files changed

+98
-67
lines changed

Core/Sources/Environment/Environment.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ public enum Environment {
124124
return try await fetchCurrentFileURL()
125125
}
126126

127-
public static var createAuthService: () -> CopilotAuthServiceType = {
128-
CopilotAuthService()
127+
public static var createAuthService: () -> GitHubCopilotAuthServiceType = {
128+
GitHubCopilotAuthService()
129129
}
130130

131131
public static var createSuggestionService: (_ projectRootURL: URL)
132-
-> CopilotSuggestionServiceType = { projectRootURL in
133-
CopilotSuggestionService(projectRootURL: projectRootURL)
132+
-> GitHubCopilotSuggestionServiceType = { projectRootURL in
133+
GitHubCopilotSuggestionService(projectRootURL: projectRootURL)
134134
}
135135

136136
public static var triggerAction: (_ name: String) async throws -> Void = { name in

Core/Sources/GitHubCopilotService/CopilotLocalProcessServer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import ProcessEnv
77

88
/// A clone of the `LocalProcessServer`.
99
/// We need it because the original one does not allow us to handle custom notifications.
10-
public class CopilotLocalProcessServer {
10+
class CopilotLocalProcessServer {
1111
private let transport: StdioDataTransport
1212
private let process: Process
1313
private var wrappedServer: CustomJSONRPCLanguageServer?
14-
public var terminationHandler: (() -> Void)?
14+
var terminationHandler: (() -> Void)?
1515

1616
public convenience init(
1717
path: String,
@@ -27,7 +27,7 @@ public class CopilotLocalProcessServer {
2727
self.init(executionParameters: params)
2828
}
2929

30-
public init(executionParameters parameters: Process.ExecutionParameters) {
30+
init(executionParameters parameters: Process.ExecutionParameters) {
3131
transport = StdioDataTransport()
3232
wrappedServer = CustomJSONRPCLanguageServer(dataTransport: transport)
3333

@@ -61,7 +61,7 @@ public class CopilotLocalProcessServer {
6161
terminationHandler?()
6262
}
6363

64-
public var logMessages: Bool {
64+
var logMessages: Bool {
6565
get { return wrappedServer?.logMessages ?? false }
6666
set { wrappedServer?.logMessages = newValue }
6767
}

Core/Sources/GitHubCopilotService/CopilotService.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import Logger
66
import Preferences
77
import 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
}

Core/Sources/GitHubCopilotService/CopilotRequest.swift renamed to Core/Sources/GitHubCopilotService/GitHubCopilotRequest.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Foundation
33
import JSONRPC
44
import LanguageServerProtocol
55

6-
struct CopilotDoc: Codable {
6+
struct GitHubCopilotDoc: Codable {
77
var source: String
88
var tabSize: Int
99
var indentSize: Int
@@ -17,13 +17,13 @@ struct CopilotDoc: Codable {
1717
var version: Int = 0
1818
}
1919

20-
protocol CopilotRequestType {
20+
protocol GitHubCopilotRequestType {
2121
associatedtype Response: Codable
2222
var request: ClientRequest { get }
2323
}
2424

25-
enum CopilotRequest {
26-
struct SetEditorInfo: CopilotRequestType {
25+
enum GitHubCopilotRequest {
26+
struct SetEditorInfo: GitHubCopilotRequestType {
2727
struct Response: Codable {}
2828

2929
var request: ClientRequest {
@@ -40,7 +40,7 @@ enum CopilotRequest {
4040
}
4141
}
4242

43-
struct GetVersion: CopilotRequestType {
43+
struct GetVersion: GitHubCopilotRequestType {
4444
struct Response: Codable {
4545
var version: String
4646
}
@@ -50,7 +50,7 @@ enum CopilotRequest {
5050
}
5151
}
5252

53-
struct CheckStatus: CopilotRequestType {
53+
struct CheckStatus: GitHubCopilotRequestType {
5454
struct Response: Codable {
5555
var status: GitHubCopilotAccountStatus
5656
}
@@ -60,7 +60,7 @@ enum CopilotRequest {
6060
}
6161
}
6262

63-
struct SignInInitiate: CopilotRequestType {
63+
struct SignInInitiate: GitHubCopilotRequestType {
6464
struct Response: Codable {
6565
var verificationUri: String
6666
var status: String
@@ -74,7 +74,7 @@ enum CopilotRequest {
7474
}
7575
}
7676

77-
struct SignInConfirm: CopilotRequestType {
77+
struct SignInConfirm: GitHubCopilotRequestType {
7878
struct Response: Codable {
7979
var status: GitHubCopilotAccountStatus
8080
var user: String
@@ -89,7 +89,7 @@ enum CopilotRequest {
8989
}
9090
}
9191

92-
struct SignOut: CopilotRequestType {
92+
struct SignOut: GitHubCopilotRequestType {
9393
struct Response: Codable {
9494
var status: GitHubCopilotAccountStatus
9595
}
@@ -99,12 +99,12 @@ enum CopilotRequest {
9999
}
100100
}
101101

102-
struct GetCompletions: CopilotRequestType {
102+
struct GetCompletions: GitHubCopilotRequestType {
103103
struct Response: Codable {
104104
var completions: [CodeSuggestion]
105105
}
106106

107-
var doc: CopilotDoc
107+
var doc: GitHubCopilotDoc
108108

109109
var request: ClientRequest {
110110
let data = (try? JSONEncoder().encode(doc)) ?? Data()
@@ -115,12 +115,12 @@ enum CopilotRequest {
115115
}
116116
}
117117

118-
struct GetCompletionsCycling: CopilotRequestType {
118+
struct GetCompletionsCycling: GitHubCopilotRequestType {
119119
struct Response: Codable {
120120
var completions: [CodeSuggestion]
121121
}
122122

123-
var doc: CopilotDoc
123+
var doc: GitHubCopilotDoc
124124

125125
var request: ClientRequest {
126126
let data = (try? JSONEncoder().encode(doc)) ?? Data()
@@ -131,12 +131,12 @@ enum CopilotRequest {
131131
}
132132
}
133133

134-
struct GetPanelCompletions: CopilotRequestType {
134+
struct GetPanelCompletions: GitHubCopilotRequestType {
135135
struct Response: Codable {
136136
var completions: [CodeSuggestion]
137137
}
138138

139-
var doc: CopilotDoc
139+
var doc: GitHubCopilotDoc
140140

141141
var request: ClientRequest {
142142
let data = (try? JSONEncoder().encode(doc)) ?? Data()
@@ -147,7 +147,7 @@ enum CopilotRequest {
147147
}
148148
}
149149

150-
struct NotifyAccepted: CopilotRequestType {
150+
struct NotifyAccepted: GitHubCopilotRequestType {
151151
struct Response: Codable {}
152152

153153
var completionUUID: String
@@ -159,7 +159,7 @@ enum CopilotRequest {
159159
}
160160
}
161161

162-
struct NotifyRejected: CopilotRequestType {
162+
struct NotifyRejected: GitHubCopilotRequestType {
163163
struct Response: Codable {}
164164

165165
var completionUUIDs: [String]

Core/Sources/PromptToCodeService/CopilotPromptToCodeAPI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class CopilotPromptToCodeAPI: PromptToCodeAPI {
2121
allCode: String,
2222
extraSystemPrompt: String?
2323
) async throws -> AsyncThrowingStream<(code: String, description: String), Error> {
24-
let copilotService = CopilotSuggestionService(projectRootURL: projectRootURL)
24+
let copilotService = GitHubCopilotSuggestionService(projectRootURL: projectRootURL)
2525
let relativePath = {
2626
let filePath = fileURL.path
2727
let rootPath = projectRootURL.path

Core/Sources/Service/Workspace.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ final class Workspace {
9191
], context: nil
9292
)
9393

94-
private var _copilotSuggestionService: CopilotSuggestionServiceType?
94+
private var _copilotSuggestionService: GitHubCopilotSuggestionServiceType?
9595

96-
private var copilotSuggestionService: CopilotSuggestionServiceType? {
96+
private var copilotSuggestionService: GitHubCopilotSuggestionServiceType? {
9797
// Check if the workspace is disabled.
9898
let isSuggestionDisabledGlobally = UserDefaults.shared
9999
.value(for: \.disableSuggestionFeatureGlobally)

Core/Sources/Service/XPCService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class XPCService: NSObject, XPCServiceProtocol {
3232
// MARK: - Copilot Auth
3333

3434
@ServiceActor
35-
lazy var authService: CopilotAuthServiceType = Environment.createAuthService()
35+
lazy var authService: GitHubCopilotAuthServiceType = Environment.createAuthService()
3636

3737
public func checkStatus(withReply reply: @escaping (String?, Error?) -> Void) {
3838
Task { @ServiceActor in

0 commit comments

Comments
 (0)