| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Copilot for Xcode is an Xcode Source Editor Extension that provides GitHub Copilot, Codeium and ChatGPT support for Xcode.
Get a Plus License Key to unlock more features and support this project
For frequently asked questions, check FAQ.
For development instruction, check Development.md.
For more information, check the wiki
For suggestion features:
For chat and prompt to code features:
If you are concerned about key logging and cannot trust the binary, we recommend examining the code and building it yourself. To address any concerns, you can specifically search for CGEvent.tapCreate, AXObserver, AX___ within the code.
You can install it via Homebrew:
brew install --cask copilot-for-xcodeOr install it manually, by downloading the Copilot for Xcode.app from the latest release, and extract it to the Applications folder.
Open the app, the app will create a launch agent to setup a background running Service that does the real job.
Enable the extension in System Settings.app.
From the Apple menu located in the top-left corner of your screen click System Settings. Navigate to Privacy & Security then toward the bottom click Extensions. Click Xcode Source Editor and tick Copilot.
If you are using macOS Monterey, enter the Extensions menu in System Preferences.app with its dedicated icon.
The first time the app is open and command run, the extension will ask for the necessary permissions.
Alternatively, you may manually grant the required permissions by navigating to the Privacy & Security tab in the System Settings.app.
If you encounter an alert requesting permission that you have previously granted, please remove the permission from the list and add it again to re-grant the necessary permissions.
The extension will work better if you use key bindings.
It looks like there is no way to add default key bindings to commands, but you can set them up in Xcode settings > Key Bindings. You can filter the list by typing copilot in the search bar.
A recommended setup that should cause no conflict is
| Command | Key Binding |
|---|---|
| Accept Suggestions | ⌥} (Or accept with Tab if Plus license is available) |
| Reject Suggestion | ⌥{ |
| Next Suggestion | ⌥> |
| Previous Suggestion | ⌥< |
| Open Chat | ⌥" |
| Explain Selection | ⌥| |
Essentially using ⌥⇧ as the "access" key combination for all bindings.
Another convenient method to access commands is by using the ⇧⌘/ shortcut to search for a command in the menu bar.
The installed language server is located at ~/Library/Application Support/com.intii.CopilotForXcode/GitHub Copilot/executable/.
The key is stored in the keychain. When the helper app tries to access the key for the first time, it will prompt you to enter the password to access the keychain. Please select "Always Allow" to let the helper app access the key.
The installed language server is located at ~/Library/Application Support/com.intii.CopilotForXcode/Codeium/executable/.
This app runs whenever you open Copilot for Xcode.app or Xcode.app. You can quit it with its menu bar item that looks like a steering wheel.
You can also set it to quit automatically when the above 2 apps are closed.
If the app was installed via Homebrew, you can update it by running:
brew upgrade --cask copilot-for-xcodeAlternatively, You can use the in-app updater or download the latest version manually from the latest release.
After updating, please restart Xcode to allow the extension to reload.
If you are upgrading from a version lower than 0.7.0, please run Copilot for Xcode.app at least once to let it set up the new launch agent for you and re-grant the permissions according to the new rules.
If you find that some of the features are no longer working, please first try regranting permissions to the app.
The app can provide real-time code suggestions based on the files you have opened. It's powered by GitHub Copilot and Codeium.
The feature provides two presentation modes:
When using the "Nearby Text Cursor" mode, it is recommended to set the real-time suggestion debounce to 0.1.
If you're working on a company project and don't want the suggestion feature to be triggered, you can globally disable it and choose to enable it only for specific projects.
Whenever your code is updated, the app will automatically fetch suggestions for you, you can cancel this by pressing Escape.
*: If a file is already open before the helper app launches, you will need to switch to those files in order to send the open file notification.
This feature is powered by ChatGPT. Please ensure that you have set up your OpenAI account before using it.
The chat knows the following information:
There are currently two tabs in the chat panel: one is available shared across Xcode, and the other is only available in the current file.
You can detach the chat panel by simply dragging it away. Once detached, the chat panel will remain visible even if Xcode is inactive. To re-attach it to the widget, click the message bubble button located next to the circular widget.
| Shortcut | Description |
|---|---|
| ⌘W | Close the chat tab. |
| ⌘M | Minimize the chat, you can bring it back with any chat commands or by clicking the circular widget. |
| ⇧↩︎ | Add new line. |
| ⇧⌘] | Move to next tab |
| ⇧⌘[ | Move to previous tab |
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 |
|---|---|
| @file | Includes the metadata of the editing document and line annotations in the system prompt. |
| @code | Includes the focused/selected code and everything from @file in the system prompt. |
| @web | Allow the bot to search on Bing or query from a web page |
@code is on by default, if Use @code scope by default in chat context. is on. Otherwise, @file will be on by default.
To use scopes, you can prefix a message with @code.
You can use shorthand to represent a scope, such as @c, and enable multiple scopes with @c+web.
The chat panel supports chat plugins that may not require an OpenAI API key. For example, if you need to use the /run plugin, you just type
/run echo hello
If you need to end a plugin, you can just type
/exit
| Command | Description |
|---|---|
| /run | Runs the command under the project root. |
| Environment variable: - PROJECT_ROOT to get the project root. - FILE_PATH to get the editing file path. |
|
| /math | Solves a math problem in natural language |
| /search | Search on Bing and summarize the results. You have to setup the Bing Search API in the host app before using it. |
| /shortcut(name) | Run a shortcut from the Shortcuts.app, and use the following message as the input. |
| If the message is empty, it will use the previous message as input. The output of the shortcut will be printed as a reply from the bot. | |
| /shortcutInput(name) | Run a shortcut from the Shortcuts.app, and use the following message as the input. |
| If the message is empty, it will use the previous message as input. The output of the shortcut will be send to the bot as a user message. |
Refactor existing code or write new code using natural language.
This feature is recommended when you need to update a specific piece of code. Some example use cases include:
You can create custom commands that run Chat and Prompt to Code with personalized prompts. These commands are easily accessible from both the Xcode menu bar and the context menu of the circular widget. There are 3 types of custom commands:
For Send Message, Single Round Dialog and Custom Chat commands, you can use the following template arguments:
| Argument | Description |
|---|---|
| {{selected_code}} | The currently selected code in the editor. |
| {{active_editor_language}} | The programming language of the active editor. |
| {{active_editor_file_url}} | The URL of the active file in the editor. |
| {{active_editor_file_name}} | The name of the active file in the editor. |
The pre-built binary contains a set of exclusive features that can only be accessed with a Plus license key. To obtain a license key, please visit this link.
These features are included in another repo, and are not open sourced.
The currently available Plus features include:
Since the app needs to manage license keys, it will send network request to https://copilotforxcode-license.intii.com,
The request contains only the license key, the email address (only on activation), and an instance id. You are free to MITM the request to see what data is sent.
Please check LICENSE for details.
| Back | FazBrowse Home | New Git URL |