|
4 | 4 |
|
5 | 5 | ### Copilot for Xcode |
6 | 6 |
|
7 | | -Copilot for Xcode is the host app containing both the XPCService and the editor extension. |
| 7 | +Copilot for Xcode is the host app containing both the XPCService and the editor extension. It provides the settings UI. |
8 | 8 |
|
9 | 9 | ### EditorExtension |
10 | 10 |
|
11 | | -As its name suggests, the editor extension. Its sole purpose is to forward editor content to the XPCService for processing, and update the editor with the returned content. Due to the sandboxing requirements for editor extensions, it has to communicate with a trusted, non-sandboxed XPCService to bypass the limitations. The XPCService identifier must be included in the `com.apple.security.temporary-exception.mach-lookup.global-name` entitlements. |
| 11 | +As its name suggests, the Xcode source editor extension. Its sole purpose is to forward editor content to the XPCService for processing, and update the editor with the returned content. Due to the sandboxing requirements for editor extensions, it has to communicate with a trusted, non-sandboxed XPCService (CommunicationBridge and ExtensionService) to bypass the limitations. The XPCService service name must be included in the `com.apple.security.temporary-exception.mach-lookup.global-name` entitlements. |
12 | 12 |
|
13 | 13 | ### ExtensionService |
14 | 14 |
|
15 | | -The `ExtensionService` is a program that operates in the background and performs a wide range of tasks. It redirects requests from the `EditorExtension` to the `CopilotService` and returns the updated code back to the extension, or presents it in a GUI outside of Xcode. |
| 15 | +The `ExtensionService` is a program that operates in the background. All features are implemented in this target. |
| 16 | + |
| 17 | +### CommunicationBridge |
| 18 | + |
| 19 | +It's responsible for maintaining the communication between the Copilot for Xcode/EditorExtension and ExtensionService. |
16 | 20 |
|
17 | 21 | ### Core and Tool |
18 | 22 |
|
19 | 23 | Most of the logics are implemented inside the package `Core` and `Tool`. |
20 | 24 |
|
21 | | -- The `Service` is responsible for handling the requests from the `EditorExtension`, communicating with the `CopilotService`, update the code blocks and present the GUI. |
22 | | -- The `Client` is basically just a wrapper around the XPCService |
23 | | -- The `SuggestionInjector` is responsible for injecting the suggestions into the code. Used in comment mode to present the suggestions, and all modes to accept suggestions. |
24 | | -- The `SuggestionWidget` is responsible for the UI of the widgets. |
| 25 | +- The `Service` contains the implementations of the ExtensionService target. |
| 26 | +- The `HostApp` contains the implementations of the Copilot for Xcode target. |
25 | 27 |
|
26 | 28 | ## Building and Archiving the App |
27 | 29 |
|
28 | | -1. Update the xcconfig files, launchAgent.plist, and Tool/Configs/Configurations.swift. |
| 30 | +1. Update the xcconfig files, bridgeLaunchAgent.plist, and Tool/Configs/Configurations.swift. |
29 | 31 | 2. Build or archive the Copilot for Xcode target. |
30 | | -3. If Xcode complains that the pro package doesn't exist, please remove the package from the project, and update the last function in Core/Package.swift to return false. |
| 32 | +3. If Xcode complains that the pro package doesn't exist, please remove the package from the project. |
31 | 33 |
|
32 | 34 | ## Testing Source Editor Extension |
33 | 35 |
|
34 | | -Just run both the `ExtensionService` and the `EditorExtension` Target. Read [Testing Your Source Editor Extension](https://developer.apple.com/documentation/xcodekit/testing_your_source_editor_extension) for more details. |
| 36 | +Just run both the `ExtensionService`, `CommunicationBridge` and the `EditorExtension` Target. Read [Testing Your Source Editor Extension](https://developer.apple.com/documentation/xcodekit/testing_your_source_editor_extension) for more details. |
35 | 37 |
|
36 | 38 | ## SwiftUI Previews |
37 | 39 |
|
|
0 commit comments