Description
Describe the bug
The "Add Context" menu in GitHub Copilot for Xcode is failing to display any files from my workspace. My workspace is primarily organized using Xcode's built-in group feature, and it appears Copilot cannot properly search files when the workspace is structured this way.
While I haven't thoroughly investigated the root cause, I suspect the issue might be related to the parsing logic for contents.xcworkspacedata, specifically the WorkspaceFile.getSubprojectURLs(workspaceURL: URL, data: Data)
function, which doesn't seem to be working as expected.
Here's a sample contents.xcworkspacedata that Copilot seems to have trouble parsing
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<Group
location = "group:Group1"
name = "Group1">
<Group
location = "group:Group2"
name = "Group2">
<Group
location = "group:SomeProject3"
name = "SomeProject3">
<FileRef
location = "group:SomeProject3.xcodeproj">
</FileRef>
</Group>
</Group>
</Group>
</Group>
</Workspace>
My observation is that the WorkspaceFile.getSubprojectURLs(workspaceURL: URL, data: Data) function only strips the 'group:' prefix. This indicates it might not be considering the full parent group path, which is crucial for resolving nested files.
Versions
- Copilot for Xcode: 0.36
- Xcode: 16.2
- macOS: 15.4
Steps to reproduce
- Set up your Xcode workspace using Xcode groups.
- Open this workspace in Xcode.
- Attempt to use the "Add Context" menu from the GitHub Copilot for Xcode extension.
- Observe that no files from the workspace are listed.