Skip to content

Commit

Permalink
Merge branch 'release/0.24.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
intitni committed Sep 28, 2023
2 parents fb640c7 + dfd69e8 commit 151776f
Show file tree
Hide file tree
Showing 84 changed files with 1,463 additions and 733 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ Python/site-packages/*
!Python/site-packages/install.sh

Python/VERSIONS
Copilot for Xcode Plus.xcworkspace
PLUS
2 changes: 0 additions & 2 deletions Copilot for Xcode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@
C861E61F2994F6390056CB02 /* ServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceDelegate.swift; sourceTree = "<group>"; };
C8758E6F29F04BFF00D29C1C /* CustomCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCommand.swift; sourceTree = "<group>"; };
C8758E7129F04CF100D29C1C /* SeparatorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeparatorCommand.swift; sourceTree = "<group>"; };
C87903302A5D2E6400FE6F42 /* Pro */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Pro; sourceTree = "<group>"; };
C87B03A3293B24AB00C77EAE /* Copilot-for-Xcode-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "Copilot-for-Xcode-Info.plist"; sourceTree = SOURCE_ROOT; };
C87B03A4293B261200C77EAE /* AcceptSuggestionCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcceptSuggestionCommand.swift; sourceTree = "<group>"; };
C87B03A6293B261900C77EAE /* RejectSuggestionCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RejectSuggestionCommand.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -273,7 +272,6 @@
C8CD828229B88006008D044D /* TestPlan.xctestplan */,
C81D181E2A1B509B006C1B70 /* Tool */,
C8189B282938979000C9DCDA /* Core */,
C87903302A5D2E6400FE6F42 /* Pro */,
C8189B182938972F00C9DCDA /* Copilot for Xcode */,
C81458922939EFDC00135263 /* EditorExtension */,
C8216B71298036EC00AD38C7 /* Helper */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
reference = "container:TestPlan.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:Pro/ProTestPlan.xctestplan">
</TestPlanReference>
</TestPlans>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "4af50b38daf0037cfbab15514a241224c3f62f98",
"version" : "0.8.5"
"revision" : "50843cbb8551db836adec2290bb4bc6bac5c1865",
"version" : "0.9.0"
}
}
],
Expand Down

This file was deleted.

This file was deleted.

52 changes: 0 additions & 52 deletions Core/.swiftpm/xcode/xcshareddata/xcschemes/ServiceTests.xcscheme

This file was deleted.

37 changes: 17 additions & 20 deletions Core/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ let package = Package(
name: "ChatService",
dependencies: [
"ChatPlugin",
"ChatContextCollector",

// plugins
"MathChatPlugin",
Expand All @@ -183,12 +182,15 @@ let package = Package(
"ActiveDocumentChatContextCollector",
"SystemInfoChatContextCollector",

.product(name: "ChatContextCollector", package: "Tool"),
.product(name: "AppMonitoring", package: "Tool"),
.product(name: "Environment", package: "Tool"),
.product(name: "Parsing", package: "swift-parsing"),
.product(name: "OpenAIService", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
]
].pro([
"ProService",
])
),
.testTarget(name: "ChatServiceTests", dependencies: ["ChatService"]),
.target(
Expand All @@ -199,16 +201,6 @@ let package = Package(
.product(name: "Terminal", package: "Tool"),
]
),
.target(
name: "ChatContextCollector",
dependencies: [
.product(name: "SuggestionModel", package: "Tool"),
.product(name: "AppMonitoring", package: "Tool"),
.product(name: "Environment", package: "Tool"),
.product(name: "OpenAIService", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
]
),

.target(
name: "ChatGPTChatTab",
Expand Down Expand Up @@ -346,7 +338,7 @@ let package = Package(
.target(
name: "WebChatContextCollector",
dependencies: [
"ChatContextCollector",
.product(name: "ChatContextCollector", package: "Tool"),
.product(name: "LangChain", package: "Tool"),
.product(name: "OpenAIService", package: "Tool"),
.product(name: "ExternalServices", package: "Tool"),
Expand All @@ -358,7 +350,7 @@ let package = Package(
.target(
name: "SystemInfoChatContextCollector",
dependencies: [
"ChatContextCollector",
.product(name: "ChatContextCollector", package: "Tool"),
.product(name: "OpenAIService", package: "Tool"),
],
path: "Sources/ChatContextCollectors/SystemInfoChatContextCollector"
Expand All @@ -367,10 +359,11 @@ let package = Package(
.target(
name: "ActiveDocumentChatContextCollector",
dependencies: [
"ChatContextCollector",
.product(name: "ChatContextCollector", package: "Tool"),
.product(name: "OpenAIService", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
.product(name: "FocusedCodeFinder", package: "Tool"),
.product(name: "AppMonitoring", package: "Tool"),
],
path: "Sources/ChatContextCollectors/ActiveDocumentChatContextCollector"
),
Expand Down Expand Up @@ -412,14 +405,18 @@ func isProIncluded(file: StaticString = #file) -> Bool {
let rootURL = fileURL
.deletingLastPathComponent()
.deletingLastPathComponent()
let folderURL = rootURL.appendingPathComponent("Pro")
if !FileManager.default.fileExists(atPath: folderURL.path) {
let confURL = rootURL.appendingPathComponent("PLUS")
if !FileManager.default.fileExists(atPath: confURL.path) {
return false
}
let packageManifestURL = folderURL.appendingPathComponent("Package.swift")
if !FileManager.default.fileExists(atPath: packageManifestURL.path) {
do {
let content = String(
data: try Data(contentsOf: confURL),
encoding: .utf8
)
return content?.hasPrefix("YES") ?? false
} catch {
return false
}
return true
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
"Editing Document Context is updated to display code at \(range)."
}
}

struct E: Error, LocalizedError {
var errorDescription: String?
}

var reportProgress: (String) async -> Void = { _ in }

var name: String {
"expandFocusRange"
}
Expand All @@ -32,18 +30,21 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
.type: "object",
.properties: [:],
] }

weak var contextCollector: ActiveDocumentChatContextCollector?

init(contextCollector: ActiveDocumentChatContextCollector) {
self.contextCollector = contextCollector
}

func prepare() async {
func prepare(reportProgress: @escaping (String) async -> Void) async {
await reportProgress("Finding the focused code..")
}

func call(arguments: Arguments) async throws -> Result {
func call(
arguments: Arguments,
reportProgress: @escaping (String) async -> Void
) async throws -> Result {
await reportProgress("Finding the focused code..")
contextCollector?.activeDocumentContext?.expandFocusedRangeToContextRange()
guard let newContext = contextCollector?.activeDocumentContext?.focusedContext else {
Expand All @@ -56,3 +57,4 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
return .init(range: newContext.codeRange)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ struct MoveToCodeAroundLineFunction: ChatGPTFunction {
"Editing Document Context is updated to display code at \(range)."
}
}

struct E: Error, LocalizedError {
var errorDescription: String?
}

var reportProgress: (String) async -> Void = { _ in }

var name: String {
"getCodeAtLine"
}
Expand All @@ -36,7 +34,7 @@ struct MoveToCodeAroundLineFunction: ChatGPTFunction {
"line": [
.type: "number",
.description: "The line number in the file",
]
],
],
.required: ["line"],
] }
Expand All @@ -47,11 +45,14 @@ struct MoveToCodeAroundLineFunction: ChatGPTFunction {
self.contextCollector = contextCollector
}

func prepare() async {
func prepare(reportProgress: @escaping (String) async -> Void) async {
await reportProgress("Finding code around..")
}

func call(arguments: Arguments) async throws -> Result {
func call(
arguments: Arguments,
reportProgress: @escaping (String) async -> Void
) async throws -> Result {
await reportProgress("Finding code around line \(arguments.line)..")
contextCollector?.activeDocumentContext?.moveToCodeAroundLine(arguments.line)
guard let newContext = contextCollector?.activeDocumentContext?.focusedContext else {
Expand Down
Loading

0 comments on commit 151776f

Please sign in to comment.