Skip to content

Commit 151776f

Browse files
committed
Merge branch 'release/0.24.0'
2 parents fb640c7 + dfd69e8 commit 151776f

File tree

84 files changed

+1463
-733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1463
-733
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,5 @@ Python/site-packages/*
132132
!Python/site-packages/install.sh
133133

134134
Python/VERSIONS
135+
Copilot for Xcode Plus.xcworkspace
136+
PLUS

Copilot for Xcode.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@
175175
C861E61F2994F6390056CB02 /* ServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceDelegate.swift; sourceTree = "<group>"; };
176176
C8758E6F29F04BFF00D29C1C /* CustomCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCommand.swift; sourceTree = "<group>"; };
177177
C8758E7129F04CF100D29C1C /* SeparatorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeparatorCommand.swift; sourceTree = "<group>"; };
178-
C87903302A5D2E6400FE6F42 /* Pro */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Pro; sourceTree = "<group>"; };
179178
C87B03A3293B24AB00C77EAE /* Copilot-for-Xcode-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "Copilot-for-Xcode-Info.plist"; sourceTree = SOURCE_ROOT; };
180179
C87B03A4293B261200C77EAE /* AcceptSuggestionCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcceptSuggestionCommand.swift; sourceTree = "<group>"; };
181180
C87B03A6293B261900C77EAE /* RejectSuggestionCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RejectSuggestionCommand.swift; sourceTree = "<group>"; };
@@ -273,7 +272,6 @@
273272
C8CD828229B88006008D044D /* TestPlan.xctestplan */,
274273
C81D181E2A1B509B006C1B70 /* Tool */,
275274
C8189B282938979000C9DCDA /* Core */,
276-
C87903302A5D2E6400FE6F42 /* Pro */,
277275
C8189B182938972F00C9DCDA /* Copilot for Xcode */,
278276
C81458922939EFDC00135263 /* EditorExtension */,
279277
C8216B71298036EC00AD38C7 /* Helper */,

Copilot for Xcode.xcodeproj/xcshareddata/xcschemes/ExtensionService.xcscheme

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
reference = "container:TestPlan.xctestplan"
4747
default = "YES">
4848
</TestPlanReference>
49+
<TestPlanReference
50+
reference = "container:Pro/ProTestPlan.xctestplan">
51+
</TestPlanReference>
4952
</TestPlans>
5053
</TestAction>
5154
<LaunchAction

Copilot for Xcode.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Core/.swiftpm/xcode/xcshareddata/xcschemes/CopilotModelTests.xcscheme

Lines changed: 0 additions & 52 deletions
This file was deleted.

Core/.swiftpm/xcode/xcshareddata/xcschemes/CopilotServiceTests.xcscheme

Lines changed: 0 additions & 52 deletions
This file was deleted.

Core/.swiftpm/xcode/xcshareddata/xcschemes/ServiceTests.xcscheme

Lines changed: 0 additions & 52 deletions
This file was deleted.

Core/Package.swift

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ let package = Package(
171171
name: "ChatService",
172172
dependencies: [
173173
"ChatPlugin",
174-
"ChatContextCollector",
175174

176175
// plugins
177176
"MathChatPlugin",
@@ -183,12 +182,15 @@ let package = Package(
183182
"ActiveDocumentChatContextCollector",
184183
"SystemInfoChatContextCollector",
185184

185+
.product(name: "ChatContextCollector", package: "Tool"),
186186
.product(name: "AppMonitoring", package: "Tool"),
187187
.product(name: "Environment", package: "Tool"),
188188
.product(name: "Parsing", package: "swift-parsing"),
189189
.product(name: "OpenAIService", package: "Tool"),
190190
.product(name: "Preferences", package: "Tool"),
191-
]
191+
].pro([
192+
"ProService",
193+
])
192194
),
193195
.testTarget(name: "ChatServiceTests", dependencies: ["ChatService"]),
194196
.target(
@@ -199,16 +201,6 @@ let package = Package(
199201
.product(name: "Terminal", package: "Tool"),
200202
]
201203
),
202-
.target(
203-
name: "ChatContextCollector",
204-
dependencies: [
205-
.product(name: "SuggestionModel", package: "Tool"),
206-
.product(name: "AppMonitoring", package: "Tool"),
207-
.product(name: "Environment", package: "Tool"),
208-
.product(name: "OpenAIService", package: "Tool"),
209-
.product(name: "Preferences", package: "Tool"),
210-
]
211-
),
212204

213205
.target(
214206
name: "ChatGPTChatTab",
@@ -346,7 +338,7 @@ let package = Package(
346338
.target(
347339
name: "WebChatContextCollector",
348340
dependencies: [
349-
"ChatContextCollector",
341+
.product(name: "ChatContextCollector", package: "Tool"),
350342
.product(name: "LangChain", package: "Tool"),
351343
.product(name: "OpenAIService", package: "Tool"),
352344
.product(name: "ExternalServices", package: "Tool"),
@@ -358,7 +350,7 @@ let package = Package(
358350
.target(
359351
name: "SystemInfoChatContextCollector",
360352
dependencies: [
361-
"ChatContextCollector",
353+
.product(name: "ChatContextCollector", package: "Tool"),
362354
.product(name: "OpenAIService", package: "Tool"),
363355
],
364356
path: "Sources/ChatContextCollectors/SystemInfoChatContextCollector"
@@ -367,10 +359,11 @@ let package = Package(
367359
.target(
368360
name: "ActiveDocumentChatContextCollector",
369361
dependencies: [
370-
"ChatContextCollector",
362+
.product(name: "ChatContextCollector", package: "Tool"),
371363
.product(name: "OpenAIService", package: "Tool"),
372364
.product(name: "Preferences", package: "Tool"),
373365
.product(name: "FocusedCodeFinder", package: "Tool"),
366+
.product(name: "AppMonitoring", package: "Tool"),
374367
],
375368
path: "Sources/ChatContextCollectors/ActiveDocumentChatContextCollector"
376369
),
@@ -412,14 +405,18 @@ func isProIncluded(file: StaticString = #file) -> Bool {
412405
let rootURL = fileURL
413406
.deletingLastPathComponent()
414407
.deletingLastPathComponent()
415-
let folderURL = rootURL.appendingPathComponent("Pro")
416-
if !FileManager.default.fileExists(atPath: folderURL.path) {
408+
let confURL = rootURL.appendingPathComponent("PLUS")
409+
if !FileManager.default.fileExists(atPath: confURL.path) {
417410
return false
418411
}
419-
let packageManifestURL = folderURL.appendingPathComponent("Package.swift")
420-
if !FileManager.default.fileExists(atPath: packageManifestURL.path) {
412+
do {
413+
let content = String(
414+
data: try Data(contentsOf: confURL),
415+
encoding: .utf8
416+
)
417+
return content?.hasPrefix("YES") ?? false
418+
} catch {
421419
return false
422420
}
423-
return true
424421
}
425422

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/ExpandFocusRangeFunction.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
1313
"Editing Document Context is updated to display code at \(range)."
1414
}
1515
}
16-
16+
1717
struct E: Error, LocalizedError {
1818
var errorDescription: String?
1919
}
2020

21-
var reportProgress: (String) async -> Void = { _ in }
22-
2321
var name: String {
2422
"expandFocusRange"
2523
}
@@ -32,18 +30,21 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
3230
.type: "object",
3331
.properties: [:],
3432
] }
35-
33+
3634
weak var contextCollector: ActiveDocumentChatContextCollector?
37-
35+
3836
init(contextCollector: ActiveDocumentChatContextCollector) {
3937
self.contextCollector = contextCollector
4038
}
4139

42-
func prepare() async {
40+
func prepare(reportProgress: @escaping (String) async -> Void) async {
4341
await reportProgress("Finding the focused code..")
4442
}
4543

46-
func call(arguments: Arguments) async throws -> Result {
44+
func call(
45+
arguments: Arguments,
46+
reportProgress: @escaping (String) async -> Void
47+
) async throws -> Result {
4748
await reportProgress("Finding the focused code..")
4849
contextCollector?.activeDocumentContext?.expandFocusedRangeToContextRange()
4950
guard let newContext = contextCollector?.activeDocumentContext?.focusedContext else {
@@ -56,3 +57,4 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
5657
return .init(range: newContext.codeRange)
5758
}
5859
}
60+

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/MoveToCodeAroundLineFunction.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ struct MoveToCodeAroundLineFunction: ChatGPTFunction {
1515
"Editing Document Context is updated to display code at \(range)."
1616
}
1717
}
18-
18+
1919
struct E: Error, LocalizedError {
2020
var errorDescription: String?
2121
}
2222

23-
var reportProgress: (String) async -> Void = { _ in }
24-
2523
var name: String {
2624
"getCodeAtLine"
2725
}
@@ -36,7 +34,7 @@ struct MoveToCodeAroundLineFunction: ChatGPTFunction {
3634
"line": [
3735
.type: "number",
3836
.description: "The line number in the file",
39-
]
37+
],
4038
],
4139
.required: ["line"],
4240
] }
@@ -47,11 +45,14 @@ struct MoveToCodeAroundLineFunction: ChatGPTFunction {
4745
self.contextCollector = contextCollector
4846
}
4947

50-
func prepare() async {
48+
func prepare(reportProgress: @escaping (String) async -> Void) async {
5149
await reportProgress("Finding code around..")
5250
}
5351

54-
func call(arguments: Arguments) async throws -> Result {
52+
func call(
53+
arguments: Arguments,
54+
reportProgress: @escaping (String) async -> Void
55+
) async throws -> Result {
5556
await reportProgress("Finding code around line \(arguments.line)..")
5657
contextCollector?.activeDocumentContext?.moveToCodeAroundLine(arguments.line)
5758
guard let newContext = contextCollector?.activeDocumentContext?.focusedContext else {

0 commit comments

Comments
 (0)