Closed Nivru closed 1 week ago
That means you have not enabled the Xcode Source Editor Extension.
From the Apple menu located in the top-left corner of your screen click System Settings. Navigate to General then Login Items & Extensions. Click Xcode Source Editor and tick Copilot for Xcode.
For more information about it, please check the faq
Thanks for quick reply.
Now I have enabled it and can see Copilot option however still not getting code suggestion. Please refer attached snap for exact error/warning message.
What is inside the Copilot menu?
If I click on Accept and nothing in coming over
That's weird. I would suggest you restart the Mac. If the restart doesn't help, answer the following questions:
Restart doesn't helped.
No
No but one confusion. In Mac finder/search if I type Copilot two different suggestions are coming. Are they both same?
If either Xcode or Copilot for Xcode can't bring the service app up, it basically means the launch agent is not correctly setup. Please try clicking the "Setup Launch Agent" button and try again.
If it doesn't work, you may have to do it manually.
Copilot for Xcode is the host app, extension service is the service app that does the real jobs.
The service app is not meant to be launched manually.
You should also check if the login item is disabled in the system settings.
Copilot for Xcode is enabled in Login items.
Please do the following:
category:CommunicationBridge
.If you don't see any log, please check if CommunicationBridge is running from the Activity Monitor.app.
Also let me know if you can see any warnings on the top of the Xcode editor after triggering the menu items.
Another thing that I want to confirm is, can Copilot for Xcode.app start the CopilotForXcodeExtensionService automatically?
After triggering the menu items does not see any warning in Xcode editor.
Don't see any logs in Console app.
CommunicationBridge is running:
Can Copilot for Xcode.app start the CopilotForXcodeExtensionService automatically? -> No
Everything is so weird in your case. Who is launching the CommunicationBrdige after all? Please try removing the launch agent and try to set it up manually.
Any chance the binary is not released by me?
Any chance the binary is not released by me? -> Yeah, Could be possibility of this.
Are we missing anything related to API key?
I am opening below window from Editor -> Copilot -> Write of Modify code and there I am getting below error. Where I need to add API key?
You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username).
That would be another story that you have to set up the chat model before you can chat.
I am almost sure that the issue is that the launch agent is not correctly set up, which is required to launch the CommunicationBridge to enable communication between the source editor extension and the service app.
It seems like in your case the CommunicationBridge is launched but no one is talking to it, therefore the service app is not launched automatically and the source editor extension can't get information from the service app.
I honestly don't know why. All I can suggest now is to try reinstalling the app, resetting the launch agent, or setup the launch agent manually following the FAQ.
If the binary is released by someone else, they may have messed up with the identifiers but who knows.
Wait. It looks like the menu is already working for you. I think I miss read you messages.
No Problem. Please suggest next steps
Please go to Console.app again, this time set the filter to category:Service any:CopilotForXcodeExtensionService
. Accept Suggestion from the suggestion panel again, let me kown if there is any error that looks like Trigger menu item XXX Failed
.
Below are the Console logs
Not these error, anything starts with "Trigger menu item"? also the filter is incorrect. It looks like copy pasting all at once will break the format, please paste one by one.
category:Service
any:CopilotForXcodeExtensionService
Now Applied correct filter and don't see anything related to "Trigger Menu items"
All logs are : The operation couldn’t be completed. (Swift.CancellationError error 1.)
These errors are not actually errors.
You can give this version a try and turn off "Trigger command with Accessibility API" to use a fallback solution to trigger menu items.
But the experience is definitly not as good as the default behavior. You can add a keybinding to the Accept Suggestion menu item in Xcode and use that instead.
It's hard to tell what is going on if we can't see the logs. If you want to help by building the app, you can add a break point to XcodeInspector+TriggerCommand.swift
between line 51 to 95 and run the ExtensionService target. The code will try to click the menu item in Xcode menu when you tab to accept a suggestion or accept a suggestion from the UI. If the above workround works for you, the issue should be in this few lines of code.
I would suggest overriding the path
argument to ["Editor", "Copilot", "Write or Modify Code"]
so you will know it's triggered when you see the modification window appears.
Not sure what's wrong.
Tried with above version by turning Off "Trigger command with Accessibility API" but still same issue.
It's simply running the apple script:
tell application "System Events"
set theprocs to every process whose unix id is 74496 // replace it with the pid of Xcode
repeat with proc in theprocs
tell proc
repeat with theMenu in menus of menu bar 1
set theValue to value of attribute "AXVisibleChildren" of theMenu
if theValue is not {} then
return
end if
end repeat
click menu item "Write or Modify Code" of menu 1 of menu item "Copilot" of menu 1 of menu bar item "Editor" of menu bar 1
end tell
end repeat
end tell
Other than calling click
, you can return the value of the menu item to see if it exists.
When the toggle is on, it will do the similar thing in a more efficient way. You can try running in from the Script Editor.app to see if it works. If it doesn't, it's probably some mystery macOS bugs that only happens for some users.
It's still highly recommended to build the app and see if func triggerMenuItem(path: [String], activateApp: Bool) async throws
fails for other reasons.
Oh sorry you have to activate the Xcode too, here is the updated script:
tell application "System Events"
set theprocs to every process whose unix id is 20622 // update the id
repeat with proc in theprocs
tell proc
set frontmost of proc to 1
repeat with theMenu in menus of menu bar 1
set theValue to value of attribute "AXVisibleChildren" of theMenu
if theValue is not {} then
return
end if
end repeat
click menu item "Write or Modify Code" of menu 1 of menu item "Copilot" of menu 1 of menu bar item "Editor" of menu bar 1
end tell
end repeat
end tell
I noticed that it won't work without Xcode been activated. It could also be that the activation of Xcode failed in triggerMenuItem()
.
This version will use another method to activate Xcode:
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Before Reporting
What happened?
I have installed Copilot for Xcode (Version: 0.34.1) and my MacOS version is 15.0 and Xcode 16.0 When I type for code suggestion and click on "Accept" then not getting any output. Have restarted Xcode and system.
Please refer attached screenshots for more details
How to reproduce the bug.
It just happened!
Relevant log output
No response
macOS version
15.0
Xcode version
16.0
Copilot for Xcode version
0.34.1