Copilot hangs and offers to add all files on my computer in Add Context
Describe the bug GitHub Copilot for xcode appears to be searching my entire computer when I try to add additional files as context, instead of the workspace, which I'd expect. This causes a massive hang and makes the entire system unresponsive for a second or two, then the copilot window for an additional more than 10 seconds.
Versions
- Copilot for Xcode: 0.36.0
- Xcode: 16.3 (16E140)
- macOS: 15.5 (24F74)
Steps to reproduce
- Open Copilot Chat Window
- Press "Add Context..." button
There's a huge hang, then the dropdown seems like it contains all files on my computer instead of just those in the workspace.
Screenshots
Logs None outputted when doing this
Additional context
I have two xcode projects open, both in ~/Developer/{projectname}.
@apexskier thank you for reaching out. Would you mind describing your project file structure? If it's organized by *.xcworkspace, could you share the structure of contents.xcworkspacedata under your *.xcworkspace?
It's pretty standard, just a standard project created from the "App" template when using xcode's New > Project..., with files in folders, not groups. No package dependencies or non swift packages dependencies, no manually added symlinks or git submodules or anything.
It's using an .xcodeproj, not .xcworkspacedata at the root of the project, but there is a contents.xcworkspacedata file.
❯ cat homecamera.xcodeproj/project.xcworkspace/contents.xcworkspacedata
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
It's pretty standard, just a standard project created from the "App" template when using xcode's New > Project..., with files in folders, not groups. No package dependencies or non swift packages dependencies, no manually added symlinks or git submodules or anything.
@apexskier, I followed the steps above to create a new test project named “bug326” using the "App" template in the ~/Library/Developer directory, and then opened the project in Xcode. When I choose “Add Context”, it only lists files under ~/Library/Developer/bug326. This is the expected behavior — it takes the parent folder containing the *.xcodeproj metadata as the project root.
In your case, it seems to be using ../../your_project as the project root, which is a bit unusual. Could there be a missing step needed to reproduce the issue? thanks.
Could there be a missing step needed to reproduce the issue? thanks.
Here's a video showing the bug - same steps as you and it's showing files from my entire computer.
https://github.com/user-attachments/assets/6370a88c-4981-4bc9-9472-e55a8fff20b2
In your case, it seems to be using ../../your_project as the project root, which is a bit unusual.
I'm not sure where you're seeing this?
One other thought - I'm using xcodes to manage xcode versions, but I don't have any thoughts about why that would cause this issue.
would you mind sharing the log at ~/Library/Logs/GitHubCopilot/github-copilot-for-xcode.log? thanks.
Whole file:
This is the log cropped to only during a reproduction of the bug (after creating the project)...
I also have this issue. Are there any updates? If it helps, when I try to use the @workspace command in the chat, I get a "No project context available" error. When I open the Xcode project in another IDE like VSCode, the GitHub copilot extension there does not have this issue. I also use xcodes to manage Xcode versions.
Update (8/21/2025): So I had to re-image my Mac and re-install Xcode and the Xcode Github Copilot extension and I no longer experience the issue. I no longer see all of my mac's files when adding additional context. I still use Xcodes to manage Xcode versions. I did notice that for larger projects, I still sometimes see the "No project context available" error when using @workspace command, but I think it's because copilot wasn't finished indexing the workspace. I'm wondering if I was always getting that before because copilot was trying to index my entire machine.