Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
63af3b4
Merge tag '0.27.0' into develop
intitni Nov 9, 2023
651b639
Support retrieval in context aware prompt to code
intitni Nov 16, 2023
ba79efd
Update
intitni Nov 16, 2023
221a034
Merge tag '0.27.1' into develop
intitni Nov 18, 2023
6e0895c
Rename FocusCodeFinder to FocusCodeFinderType
intitni Nov 16, 2023
9c47de5
Simplify interface of focused code finder
intitni Nov 16, 2023
1d89fcc
Remove tree sitter for Swift
intitni Nov 25, 2023
6b040e3
Update syntax tree dump
intitni Nov 25, 2023
71bc6e7
Fix code finder tests
intitni Nov 26, 2023
2b027e9
Update focused code finder
intitni Nov 26, 2023
3516f57
Fix imports
intitni Nov 26, 2023
f9c5301
Add ObjectiveCFocusedCodeFinder
intitni Nov 26, 2023
3e807b0
Update
intitni Nov 26, 2023
975a1df
Fix SwiftFocusedCodeFinderTests
intitni Nov 26, 2023
72035e7
Fix parseSignatureBeforeBody
intitni Nov 26, 2023
7dcd116
Simplify contextContainingNode
intitni Nov 26, 2023
3a0b5e5
Fix super class and protocol conformance parsing
intitni Nov 27, 2023
b17d282
Add parseDeclarationInterfaceNode to parse all declaration contexts
intitni Nov 27, 2023
2749e2e
Fix parsing includes and imports
intitni Nov 27, 2023
f4ea0f6
Fix focused code
intitni Nov 27, 2023
e8c3ba4
Update
intitni Nov 27, 2023
ecfdfc0
Merge branch 'feature/objective-c-code-finder' into develop
intitni Nov 27, 2023
6d22d48
Add AutoresizingCustomTextEditor
intitni Nov 28, 2023
1305c72
Rename SuggestionProvider to CodeSuggestionProvider
intitni Nov 28, 2023
02900cb
Update
intitni Nov 28, 2023
e5967e0
Merge branch 'feature/informative-suggestion-wip' into develop
intitni Nov 30, 2023
03882d7
Update the context system prompt to use role user
intitni Nov 30, 2023
bc39122
Adjust the prompt in chat
intitni Nov 30, 2023
a1c1043
Rename ChatMessage in chat panel to DisplayedChatMessage
intitni Nov 30, 2023
9b22c29
Add references to chat message
intitni Nov 30, 2023
94aaade
Change the definition of a memory
intitni Nov 30, 2023
68ea73b
Update RetrievedContent in ChatContext
intitni Nov 30, 2023
ba592c2
Support displaying references in chat panel
intitni Dec 1, 2023
aac293e
Break ChatPanel.swift into multiple files
intitni Dec 1, 2023
be2376a
Update to stream references to message
intitni Dec 1, 2023
1925397
Support opening references in Xcode
intitni Dec 1, 2023
774216b
Support jump to specific line of reference file
intitni Dec 1, 2023
5d57f90
Fix the UI of reference list
intitni Dec 1, 2023
01bcaad
Fix opening reference
intitni Dec 1, 2023
353c686
Fix cancellation
intitni Dec 2, 2023
9c3840d
Update
intitni Dec 2, 2023
46da74c
Support providing history compose logic from other types
intitni Dec 2, 2023
67221f4
Update
intitni Dec 2, 2023
2b317fd
Update prompt of prompt to code
intitni Dec 2, 2023
b3ae4ec
Fix that context retriever was incorrect when the context is too long
intitni Dec 2, 2023
6c129d7
Fix that multiple function result was added to history
intitni Dec 2, 2023
d117fb1
Fix unit tests
intitni Dec 2, 2023
f4130c9
Merge branch 'feature/prompt-improvements-28' into develop
intitni Dec 2, 2023
966f654
Add SubSection
intitni Dec 2, 2023
ed339b6
Replace wrappers with SubSection
intitni Dec 2, 2023
3aba060
Update style
intitni Dec 2, 2023
b11f49e
Add scope settings to prompt to code
intitni Dec 2, 2023
bc0eb57
Update
intitni Dec 2, 2023
5b3051d
Merge branch 'feature/improve-scope-settings' into develop
intitni Dec 2, 2023
4f1a60b
Add instructions to chat model settings
intitni Dec 2, 2023
c0e8aa0
Handle errors from azure openai
intitni Dec 2, 2023
9f528c6
Update
intitni Dec 2, 2023
81051ab
Add git ignore checker
intitni Dec 3, 2023
a916e14
Update to not generate suggestion if a file is git ignored
intitni Dec 3, 2023
6c4fc82
Update ActiveDocumentChatContextCollector to only include selected co…
intitni Dec 3, 2023
f6ee5b7
Update
intitni Dec 3, 2023
e9dfeb1
Update
intitni Dec 3, 2023
5ca3bf0
Merge branch 'feature/keyword-base-retrieval' into develop
intitni Dec 3, 2023
a00c478
Fix gitignore check
intitni Dec 3, 2023
e43902a
Limit to 15 references
intitni Dec 3, 2023
28ac89c
Limit references token usage
intitni Dec 3, 2023
de6fa08
Update
intitni Dec 4, 2023
c1404c4
Bump version to 0.28.0
intitni Dec 4, 2023
0c55c5d
Merge branch 'main' into release/0.28.0
intitni Dec 4, 2023
0b54d7c
Update README.md
intitni Dec 4, 2023
66a3494
Use fallback solution when it can't find xcode
intitni Dec 4, 2023
ed2a203
Remove a fatalError
intitni Dec 4, 2023
c452fae
Update
intitni Dec 4, 2023
2312248
Adjust UI
intitni Dec 4, 2023
8ccb85f
Update appcast.xml
intitni Dec 4, 2023
28cf55b
Merge tag '0.28.0' into develop
intitni Dec 4, 2023
bd0f17d
Merge branch 'release/0.28.0'
intitni Dec 4, 2023
143c966
Update
intitni Dec 4, 2023
ea61843
Disable git ignore check by default
intitni Dec 4, 2023
c5dd90e
Bump version to 0.28.1
intitni Dec 4, 2023
de2b382
Update appcast.xml
intitni Dec 4, 2023
d426013
Merge tag '0.28.1' into develop
intitni Dec 4, 2023
b3a73bc
Merge branch 'hotfix/0.28.1'
intitni Dec 4, 2023
b5b6019
Fix git ignore check
intitni Dec 4, 2023
95ba0c3
Bump version 0.28.2
intitni Dec 4, 2023
d0e41d2
Update appcast.xml
intitni Dec 4, 2023
8613f35
Merge branch 'release/0.28.2'
intitni Dec 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Sources/ChatService/DynamicContextController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ final class DynamicContextController {
.flatMap(\.retrievedContent)
.filter { !$0.document.content.isEmpty }
.sorted { $0.priority > $1.priority }
.prefix(15)

let contextualSystemPrompt = """
\(language.isEmpty ? "" : "You must always reply in \(language)")
Expand Down
8 changes: 4 additions & 4 deletions Core/Sources/HostApp/DebugView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct DebugSettingsView: View {
Text("Use custom scroll view workaround for smooth scrolling")
}
Toggle(isOn: $settings.triggerActionWithAccessibilityAPI) {
Text("Trigger command with AccessibilityAPI")
Text("Trigger command with Accessibility API")
}
Group {
Toggle(isOn: $settings.alwaysAcceptSuggestionWithAccessibilityAPI) {
Expand All @@ -62,14 +62,14 @@ struct DebugSettingsView: View {
}

Toggle(isOn: $settings.disableEnhancedWorkspace) {
Text("Disable Enhanced Workspace")
Text("Disable enhanced workspace")
}

Toggle(isOn: $settings.disableGitIgnoreCheck) {
Text("Disable Git Ignore Check")
Text("Disable git ignore check")
}

Button("Reset Migration Version to 0") {
Button("Reset migration version to 0") {
UserDefaults.shared.set(nil, forKey: "OldMigrationVersion")
}

Expand Down
2 changes: 1 addition & 1 deletion Pro
Submodule Pro updated from 380038 to 465473
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ For chat and prompt to code features:

> The installation process is a bit complicated. Here is a quick overview:
>
> 1. Install the app into the Applications folder.
> 1. Install the app into the Applications folder, open it once.
> 2. Enable the source editor extension.
> 3. Grant Accessibility API permission to the extension app.
> 4. Setup accounts and models in the host app.
Expand Down Expand Up @@ -180,20 +180,16 @@ You can also set it to quit automatically when the above 2 apps are closed.

## Update

If the app was installed via Homebrew, you can update it by running:

```bash
brew upgrade --cask copilot-for-xcode
```

Alternatively, You can use the in-app updater or download the latest version manually from the latest [release](https://github.com/intitni/CopilotForXcode/releases).
You can use the in-app updater or download the latest version manually from the latest [release](https://github.com/intitni/CopilotForXcode/releases).

After updating, please open Copilot for Xcode.app once and restart Xcode to allow the extension to reload.

If you find that some of the features are no longer working, please first try regranting permissions to the app.

## Feature

> Files in gitignore will not receive suggestion. Both chat and prompt to code feature will not have access to them unless you manually select code from them.

### Suggestion

The app can provide real-time code suggestions based on the files you have opened. It's powered by GitHub Copilot and Codeium.
Expand Down Expand Up @@ -310,6 +306,18 @@ This feature is recommended when you need to update a specific piece of code. So
- Polishing and correcting grammar and spelling errors in the documentation.
- Translating a localizable strings file.

#### Prompt to Code Scope

The chat panel allows for chat scope to temporarily control the context of the conversation for the latest message. To use a scope, simply prefix the message with `@scope`.

| Scope | Description |
| :--------: | ---------------------------------------------------------------------------------------- |
| `@sense` | Experimental. Read the relevant information of the focused code |

To use scopes, you can prefix a message with `@sense`.

You can use shorthand to represent a scope, such as `@sense`, and enable multiple scopes with `@c+web`.

#### Commands

- Prompt to Code: Open a prompt to code window, where you can use natural language to write or edit selected code.
Expand Down Expand Up @@ -342,6 +350,9 @@ These features are included in another repo, and are not open sourced.

The currently available Plus features include:

- `@project` scope in chat.
- Suggestion Cheatsheet that provides relevant content to the suggestion service.
- `@sense` scope in chat and prompt to code.
- Terminal tab in chat panel.
- Unlimited chat/embedding models.
- Tab to accept suggestions.
Expand Down
2 changes: 1 addition & 1 deletion Tool/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ let package = Package(
name: "Environment",
dependencies: [
"ActiveApplicationMonitor",
"XcodeInspector",
"AXExtension",
"Preferences",
]
Expand Down Expand Up @@ -173,7 +174,6 @@ let package = Package(
dependencies: [
"AXExtension",
"SuggestionModel",
"Environment",
"AXNotificationStream",
"Logger",
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
Expand Down
20 changes: 11 additions & 9 deletions Tool/Sources/Environment/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AXExtension
import Foundation
import Logger
import Preferences
import XcodeInspector

public struct NoAccessToAccessibilityAPIError: Error, LocalizedError {
public var errorDescription: String? {
Expand Down Expand Up @@ -149,9 +150,16 @@ public enum Environment {
}

public static var triggerAction: (_ name: String) async throws -> Void = { name in
guard let activeXcode = ActiveApplicationMonitor.shared.activeXcode
?? ActiveApplicationMonitor.shared.latestXcode
else { return }
struct CantRunCommand: Error, LocalizedError {
let name: String
var errorDescription: String? {
"Can't run command \(name)."
}
}

guard let activeXcode = XcodeInspector.shared.latestActiveXcode?.runningApplication
else { throw CantRunCommand(name: name) }

let bundleName = Bundle.main
.object(forInfoDictionaryKey: "EXTENSION_BUNDLE_NAME") as! String

Expand Down Expand Up @@ -186,12 +194,6 @@ public enum Environment {
return
}
}
struct CantRunCommand: Error, LocalizedError {
let name: String
var errorDescription: String? {
"Can't run command \(name)."
}
}

throw CantRunCommand(name: name)
} else {
Expand Down
2 changes: 1 addition & 1 deletion Tool/Sources/OpenAIService/CompletionAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct OpenAICompletionAPI: CompletionAPI {
return try JSONDecoder().decode(CompletionResponseBody.self, from: result)
} catch {
dump(error)
fatalError()
throw error
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public actor AutoManagedChatGPTMemory: ChatGPTMemory {
static let encoder: TokenEncoder = TiktokenCl100kBaseTokenEncoder()

var onHistoryChange: () -> Void = {}

let composeHistory: HistoryComposer

public init(
Expand Down Expand Up @@ -251,14 +251,17 @@ extension AutoManagedChatGPTMemory {
usage: Int,
references: [ChatMessage.Reference]
) {
/// the available tokens count for retrieved content
let thresholdMaxTokenCount = min(maxTokenCount, configuration.maxTokens / 2)

var retrievedContentTokenCount = 0
let separator = String(repeating: "=", count: 32) // only 1 token
var message = ""
var references = [ChatMessage.Reference]()

func appendToMessage(_ text: String) -> Bool {
let tokensCount = encoder.countToken(text: text)
if tokensCount + retrievedContentTokenCount > maxTokenCount { return false }
if tokensCount + retrievedContentTokenCount > thresholdMaxTokenCount { return false }
retrievedContentTokenCount += tokensCount
message += text
return true
Expand Down
4 changes: 2 additions & 2 deletions Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_VERSION = 0.27.1
APP_BUILD = 281
APP_VERSION = 0.28.0
APP_BUILD = 290

12 changes: 12 additions & 0 deletions appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
<channel>
<title>Copilot for Xcode</title>

<item>
<title>0.28.0</title>
<pubDate>Mon, 04 Dec 2023 16:04:23 +0800</pubDate>
<sparkle:version>290</sparkle:version>
<sparkle:shortVersionString>0.28.0</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>12.0</sparkle:minimumSystemVersion>
<sparkle:releaseNotesLink>
https://github.com/intitni/CopilotForXcode/releases/tag/0.28.0
</sparkle:releaseNotesLink>
<enclosure url="https://github.com/intitni/CopilotForXcode/releases/download/0.28.0/Copilot.for.Xcode.app.zip" length="36956518" type="application/octet-stream" sparkle:edSignature="YC5/0zEGAC+COmqpc2FIXt41wkMHRXtoH6NIKfbsu86F7HhwuOEQhieEoxU/MnoASOShuDIUVKWGJqv51azYAw=="/>
</item>

<item>
<title>0.27.1</title>
<pubDate>Sat, 18 Nov 2023 12:46:36 +0800</pubDate>
Expand Down