Skip to content

Commit fcbe6ef

Browse files
committed
Add missing import
1 parent 0c09a2d commit fcbe6ef

File tree

7 files changed

+37
-22
lines changed

7 files changed

+37
-22
lines changed

Copilot for Xcode/ContentView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import AppKit
2+
import GitHubCopilotService
23
import SuggestionModel
34
import SwiftUI
45

@@ -45,3 +46,4 @@ struct ContentView_Previews: PreviewProvider {
4546
.frame(height: 1200)
4647
}
4748
}
49+

Copilot for Xcode/CopilotView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import AppKit
22
import Client
3+
import GitHubCopilotService
34
import SuggestionModel
45
import SwiftUI
56

@@ -183,3 +184,4 @@ struct CopilotView_Previews: PreviewProvider {
183184
.background(Color.black)
184185
}
185186
}
187+

Core/Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ let package = Package(
2222
name: "Client",
2323
targets: [
2424
"SuggestionModel",
25+
"GitHubCopilotService",
2526
"Client",
2627
"XPCShared",
2728
"Preferences",

Core/Sources/Client/AsyncXPCService.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import SuggestionModel
21
import Foundation
2+
import GitHubCopilotService
33
import Logger
4+
import SuggestionModel
45
import XPCShared
56

67
public struct AsyncXPCService {
@@ -89,7 +90,10 @@ public struct AsyncXPCService {
8990
return
9091
}
9192
continuation
92-
.resume(finishstatus.flatMap(GitHubCopilotAccountStatus.init(rawValue:)) ?? .notSignedIn)
93+
.resume(
94+
finishstatus
95+
.flatMap(GitHubCopilotAccountStatus.init(rawValue:)) ?? .notSignedIn
96+
)
9397
}
9498
}
9599
}
@@ -257,3 +261,4 @@ func suggestionRequest(
257261
}
258262
}
259263
}
264+

Core/Sources/PromptToCodeService/CopilotPromptToCodeAPI.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import SuggestionModel
2-
import GitHubCopilotService
31
import Foundation
2+
import GitHubCopilotService
43
import OpenAIService
4+
import SuggestionModel
55

66
final class CopilotPromptToCodeAPI: PromptToCodeAPI {
77
var task: Task<Void, Never>?
@@ -36,11 +36,11 @@ final class CopilotPromptToCodeAPI: PromptToCodeAPI {
3636
}
3737
return filePath
3838
}()
39-
39+
4040
func convertToComment(_ s: String) -> String {
4141
s.split(separator: "\n").map { "// \($0)" }.joined(separator: "\n")
4242
}
43-
43+
4444
let comment = """
4545
// A file to refactor the following code
4646
//
@@ -52,9 +52,9 @@ final class CopilotPromptToCodeAPI: PromptToCodeAPI {
5252
// Requirements:
5353
\(convertToComment((extraSystemPrompt ?? "\n") + requirement))
5454
//
55-
56-
57-
55+
56+
57+
5858
// end of file
5959
"""
6060
let lineCount = comment.breakLines().count
@@ -98,3 +98,4 @@ extension String {
9898
return all
9999
}
100100
}
101+

Core/Sources/Service/XPCService.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import AppKit
2-
import GitHubCopilotService
32
import Environment
43
import Foundation
4+
import GitHubCopilotService
55
import LanguageServerProtocol
66
import Logger
77
import Preferences
@@ -48,7 +48,8 @@ public class XPCService: NSObject, XPCServiceProtocol {
4848
public func signInInitiate(withReply reply: @escaping (String?, String?, Error?) -> Void) {
4949
Task { @ServiceActor in
5050
do {
51-
let (verificationLink, userCode) = try await gitHubCopilotAuthService.signInInitiate()
51+
let (verificationLink, userCode) = try await gitHubCopilotAuthService
52+
.signInInitiate()
5253
reply(verificationLink, userCode, nil)
5354
} catch {
5455
reply(nil, nil, NSError.from(error))
@@ -62,7 +63,8 @@ public class XPCService: NSObject, XPCServiceProtocol {
6263
) {
6364
Task { @ServiceActor in
6465
do {
65-
let (username, status) = try await gitHubCopilotAuthService.signInConfirm(userCode: userCode)
66+
let (username, status) = try await gitHubCopilotAuthService
67+
.signInConfirm(userCode: userCode)
6668
reply(username, status.rawValue, nil)
6769
} catch {
6870
reply(nil, nil, NSError.from(error))
@@ -260,3 +262,4 @@ public class XPCService: NSObject, XPCServiceProtocol {
260262
}
261263
}
262264
}
265+

Core/Sources/SuggestionService/SuggestionService.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
2-
import SuggestionModel
32
import GitHubCopilotService
3+
import SuggestionModel
44

55
public protocol SuggestionServiceType {
66
func getSuggestions(
@@ -13,7 +13,7 @@ public protocol SuggestionServiceType {
1313
ignoreSpaceOnlySuggestions: Bool,
1414
referenceFileURL: [URL]
1515
) async throws -> [CodeSuggestion]
16-
16+
1717
func notifyAccepted(_ suggestion: CodeSuggestion) async
1818
func notifyRejected(_ suggestions: [CodeSuggestion]) async
1919
func notifyOpenTextDocument(fileURL: URL, content: String) async throws
@@ -24,11 +24,11 @@ public protocol SuggestionServiceType {
2424

2525
public final class SuggestionService: SuggestionServiceType {
2626
let gitHubCopilotService: GitHubCopilotSuggestionServiceType
27-
27+
2828
public init(projectRootURL: URL) {
2929
gitHubCopilotService = GitHubCopilotSuggestionService(projectRootURL: projectRootURL)
3030
}
31-
31+
3232
public func getSuggestions(
3333
fileURL: URL,
3434
content: String,
@@ -49,28 +49,29 @@ public final class SuggestionService: SuggestionServiceType {
4949
ignoreSpaceOnlySuggestions: ignoreSpaceOnlySuggestions
5050
)
5151
}
52-
52+
5353
public func notifyAccepted(_ suggestion: SuggestionModel.CodeSuggestion) async {
5454
await gitHubCopilotService.notifyAccepted(suggestion)
5555
}
56-
56+
5757
public func notifyRejected(_ suggestions: [SuggestionModel.CodeSuggestion]) async {
5858
await gitHubCopilotService.notifyRejected(suggestions)
5959
}
60-
60+
6161
public func notifyOpenTextDocument(fileURL: URL, content: String) async throws {
6262
try await gitHubCopilotService.notifyOpenTextDocument(fileURL: fileURL, content: content)
6363
}
64-
64+
6565
public func notifyChangeTextDocument(fileURL: URL, content: String) async throws {
6666
try await gitHubCopilotService.notifyChangeTextDocument(fileURL: fileURL, content: content)
6767
}
68-
68+
6969
public func notifyCloseTextDocument(fileURL: URL) async throws {
7070
try await gitHubCopilotService.notifyCloseTextDocument(fileURL: fileURL)
7171
}
72-
72+
7373
public func notifySaveTextDocument(fileURL: URL) async throws {
7474
try await gitHubCopilotService.notifySaveTextDocument(fileURL: fileURL)
7575
}
7676
}
77+

0 commit comments

Comments
 (0)