This repository was archived by the owner on May 20, 2026. It is now read-only.
Fix file changes URI generation for multi-file changes in pull requests#1593
Draft
Copilot wants to merge 2 commits into
Draft
Fix file changes URI generation for multi-file changes in pull requests#1593Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Co-authored-by: rebornix <876920+rebornix@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Check if proper file changes URIs can be generated
Fix file changes URI generation for multi-file changes in pull requests
Oct 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
PullRequestFileChangesServicewas not properly generating URIs for different file change types when creating multi-diff views for pull requests. The previous implementation always set bothoriginalUriandmodifiedUrito valid file paths, which violated theChatResponseDiffEntryAPI specification and resulted in incorrect visual representation of added and deleted files.According to the VS Code
ChatResponseDiffEntryinterface:originalUriset toundefined(no original version exists)modifiedUriset toundefined(no modified version exists)The previous implementation treated all file types the same way, causing the multi-diff view to display incorrect diff information for these special cases.
Solution
Updated
pullRequestFileChangesService.tsto properly handle all GitHub PR file status types using an explicit switch statement:added: Sets onlymodifiedUri(new file location), leavesoriginalUriasundefinedremoved: Sets onlyoriginalUri(deleted file location), leavesmodifiedUriasundefinedrenamed: SetsoriginalUrito old filename (fromprevious_filename) andmodifiedUrito new filenamemodified/changed: Sets both URIs to the same file path (standard diff)copied: SetsoriginalUrito source file andmodifiedUrito target file (usingprevious_filename)Example
For a PR with an added file:
Before:
After:
Benefits
ChatResponseDiffEntryinterface specificationTesting
Original prompt
Created from VS Code via the GitHub Pull Request extension.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.