Skip to content

Commit 36fbbbc

Browse files
committed
Add DEVELOPMENT.md
1 parent 569a4fb commit 36fbbbc

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

Copilot for Xcode.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
C87B03B3293B393100C77EAE /* ServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceDelegate.swift; sourceTree = "<group>"; };
168168
C87F3E5F293DC600008523E8 /* Section.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
169169
C87F3E61293DD004008523E8 /* Styles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Styles.swift; sourceTree = "<group>"; };
170+
C887BC832965D96000931567 /* DEVELOPMENT.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = DEVELOPMENT.md; sourceTree = "<group>"; };
170171
/* End PBXFileReference section */
171172

172173
/* Begin PBXFrameworksBuildPhase section */
@@ -244,6 +245,7 @@
244245
children = (
245246
C832A47B2940C71D000989F2 /* copilot */,
246247
C8520308293D805800460097 /* README.md */,
248+
C887BC832965D96000931567 /* DEVELOPMENT.md */,
247249
C81458AD293A009600135263 /* Config.xcconfig */,
248250
C81458AE293A009800135263 /* Config.debug.xcconfig */,
249251
C8189B282938979000C9DCDA /* Core */,

DEVELOPMENT.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Development
2+
3+
## Targets
4+
5+
### Copilot for Xcode
6+
7+
Copilot for Xcode is the app containing both the XPCService and the editor extension.
8+
9+
### EditorExtension
10+
11+
As its name suggests, the editor extension. Since an editor extension must be sandboxed, it will need to talk to a trusted non-sandboxed XPCService to break out the limitations. The identifier of the XPCService must be listed under `com.apple.security.temporary-exception.mach-lookup.global-name` in entitlements.
12+
13+
### XPCService
14+
15+
The XPCService is a program that runs in the background and does basically everything. It redirects the requests from EditorExtension to `CopilotService` and returns the updated code back to the extension.
16+
17+
Since the Xcode source editor extension only allows its commands to be triggered manually, the XPCService has to use Apple Scripts to trigger the menu items to generate real-time suggestions.
18+
19+
The XPCService is also using a lot of Apple Script tricks to get the file paths and project/workspace paths of the active Xcode window because Xcode is not providing this information.
20+
21+
## Building and Archiving the App
22+
23+
This project contains a Git submodule `copilot.vim`, so you will have to initialize the submodule or download it from [copilot.vim](https://github.com/github/copilot.vim).
24+
25+
Then archive the target Copilot for Xcode.
26+
27+
## Testing Extension
28+
29+
### Testing Real-time Suggestions Commands
30+
31+
Testing Real-time Suggestions is a little bit different because the Apple Script can't find the commands when debugging the extension in Xcode. Instead, you will have to archive the debug version of the app, run the XPCService target simultaneously and use them against each other.
32+
33+
### Testing Other Commands
34+
35+
Just run both the XPCService and the EditorExtension Target.
36+
37+

0 commit comments

Comments
 (0)