Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

In multi-root workspaces, temporary file URIs for PR diffs used the first workspace folder path instead of the correct one matching the repository.

Example:

Workspace with roots A and B, viewing PR from repo B:
- Expected: vscode-userdata:/.../temp/B/file.png
- Actual:   vscode-userdata:/.../temp/A/file.png  ❌

Changes

  • src/common/uri.ts: Pass repository.rootUri to TemporaryState.write() in asTempStorageURI()
  • src/common/temporaryState.ts:
    • Add optional repositoryUri parameter to writeState() and write()
    • Match workspace folder by comparing URIs instead of always using first folder
    • Fall back to first folder if no match (preserves single-root behavior)
Original prompt

This section details on the original issue you should resolve

<issue_title>Wrong file URIs with multiple roots</issue_title>
<issue_description>Type: Bug

File URIs are wrong when you have a multiple root workspace.

For example:
I have a workspace with roots A an B and a PR for root B

  • A (master)
  • B (PR branch)

When I open a file from the PR branch the vscode-userdata URI for the non-local file contains the path with root A.

URIs of both files in diff view:

  • file:///home/username/B/file.png
  • vscode-userdata:/home/username/.config/Code/User/globalStorage/github.vscode-pull-request-github/temp/A/filename.png

I'd expect the vscode-userdata file to have B in the root path instead of A:

  • vscode-userdata:/home/username/.config/Code/User/globalStorage/github.vscode-pull-request-github/temp/B/filename.png

I've only checked with image files, but I assume this could happen with other files as well.

Extension version: 0.94.0
VS Code version: Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Linux x64 5.14.0-1048-oem
Modes:

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 10, 2025 11:19
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
…lder

Pass repository rootUri to TemporaryState.write so it can find the correct
workspace folder name instead of always using the first one.

Fixes issue where vscode-userdata URIs contained the wrong workspace folder
path in multi-root workspace scenarios.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Added a comment to readState noting that it currently only supports the
first workspace folder, and that it should accept a repositoryUri parameter
if multi-root support is needed in the future.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix wrong file URIs with multiple roots Fix file URIs using wrong workspace folder in multi-root workspaces Dec 10, 2025
Copilot AI requested a review from alexr00 December 10, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong file URIs with multiple roots

2 participants