Skip to content

Commit 1db021a

Browse files
committed
Update README.md
1 parent ecb9090 commit 1db021a

1 file changed

Lines changed: 45 additions & 5 deletions

File tree

README.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Thanks to [LSP-copilot](https://github.com/TerminalFi/LSP-copilot) for showing t
1212
- Public network connection.
1313
- Active GitHub Copilot subscription.
1414

15+
## Permissions Required
16+
17+
- Accessibility
18+
- Folder Access
19+
- Input Monitoring (Realtime Suggestions Only)
20+
1521
## Installation and Setup
1622

1723
1. Download the Copilot for Xcode.app from the latest release, and extract it to the Applications folder.
@@ -25,6 +31,39 @@ The first time the actions run, the extension will ask for 2 types of permission
2531
1. Accessibility API: which the extension uses to get the editing file path.
2632
2. Folder Access: the extension needs, to run some Apple Scripts to get the project/workspace path.
2733

34+
## Actions
35+
36+
- Get Suggestions: Get suggestions for the editing file at the current cursor position.
37+
- Next Suggestion: If there is more than 1 suggestion, switch to the next one.
38+
- Previous Suggestion: If there is more than 1 suggestion, switch to the previous one.
39+
- Accept Suggestion: Add the suggestion to the code.
40+
- Reject Suggestion: Remove the suggestion comments.
41+
- Turn On Realtime Suggestions: When turn on, Copilot will auto-insert suggestion comments to your code while editing. You have to manually turn it on for every open window of Xcode.
42+
- Turn Off Realtime Suggestions: Turns the real-time suggestions off.
43+
- Realtime Suggestions: It is an entry point only for Copilot for Xcode. In the background, Copilot for Xcode will occasionally run this action to bring you real-time suggestions.
44+
45+
**About realtime suggestions**
46+
47+
The implementation feels fragile to me.
48+
49+
The magic behind it is that it will keep calling the action from the menu when you are not typing, clicking or moving your mouse. So it will have to listen to those events, I am not sure if people like it.
50+
51+
Hope that next year, Apple can spend some time on Xcode Extensions.
52+
53+
## Prevent Suggestions Being Committed
54+
55+
Since the suggestions are presented as comments, they are in your code. If you are not careful enough, they can be committed to your git repo. To avoid that, I would recommend adding a pre-commit git hook to prevent this from happening. Maybe later I will add an action for that.
56+
57+
```sh
58+
#!/bin/sh
59+
60+
# Check if the commit message contains the string
61+
if git diff --cached --diff-filter=A | grep -q "/*========== Copilot Suggestion"; then
62+
echo "Error: Commit contains Copilot suggestions."
63+
exit 1
64+
fi
65+
```
66+
2867
## Limitations
2968

3069
- The first run of the extension will be slow. Be patient.
@@ -37,15 +76,19 @@ The first time the actions run, the extension will ask for 2 types of permission
3776

3877
> A: Please make sure it's turned on in `Settings.app > Privacy & Security > Extensions > Xcode Source Editor Extension`.
3978
40-
**Q: The extension says it can't connect to the XPC service / helper.**
79+
**Q: The extension says it can't connect to the XPC service/helper.**
4180

4281
> A: Please make sure you have set up Launch Agents, try running `launchctl list | grep com.intii` from the terminal, and see if `com.intii.CopilotForXcode.XPCService` exists. If not, check `~/Library/LaunchAgents` to see if `com.intii.CopilotForXcode.XPCService.plist` exists. If they don't, and the button in the app fails to create them, please try to do it by hand.
4382
4483
**Q: The extension complains that it has no access to the Accessibility API**
4584

4685
> A: Check the list in `Settings.app > Privacy & Security > Accessibility`. Turn the toggle on for `Copilot for Xcode`. If it's not on the list, add it manually.
4786
>
48-
> If you have just **updated the app**, consider trying removing the Launch Agents and set it up again!
87+
> If you have just **updated the app**, consider reloading XPCService in app or trying removing the Launch Agents and set it up again!
88+
89+
**Q: I turned on realtime suggestions, but nothing happens**
90+
91+
> A: Check the list in `Settings.app > Privacy & Security > Input Monitoring`. Turn the toggle on for `Copilot for Xcode`. If it's not on the list, add it manually. After that, you may have to reload the XPC Service.
4992
5093
**Q: Will it work in future Xcode updates?**
5194

@@ -54,6 +97,3 @@ The first time the actions run, the extension will ask for 2 types of permission
5497
## How It Works
5598
Check my [other extension](https://github.com/intitni/XccurateFormatter), you can find a short introduction there.
5699

57-
## Todo
58-
59-
- [ ] Auto trigger Copilot while editing (I have some ideas but not sure if they will work).

0 commit comments

Comments
 (0)