Merged
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reworks “Open Changes” handling in the Agents Sessions Changes view by moving the per-file toolbar action registration to the per-change toolbar menu and by changing how selected resources are mapped to session changes before opening editors.
Changes:
- Register the per-file “Open File/Open Changes” action under
MenuId.ChatEditingSessionChangeToolbar(instead of the session-level changes toolbar). - Rework “Open Changes” to collect matching session changes for the selected resources and open them as editors in a batch.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/changes/browser/changesViewActions.ts | Updates menu placement for per-file actions and refactors the “Open Changes” action to filter session changes and open them in bulk. |
Copilot's findings
Comments suppressed due to low confidence (2)
src/vs/sessions/contrib/changes/browser/changesViewActions.ts:261
editorService.openEditor({ original: { resource: change.originalUri }, modified: { resource: change.modifiedUri } })does not handle added/deleted changes whereoriginalUriormodifiedUrican be undefined (notably forIChatSessionFileChange2). This ends up passingresource: undefinedinto the untyped diff input and can open an unintended untitled editor or otherwise fail. Handle the 3 cases explicitly: (1) both URIs -> diff editor, (2) deletion -> openoriginalUri, (3) addition -> openmodifiedUri/change.urias a normal resource editor (similar toChangesViewPane._openFileItem).
await Promise.all(changes.map(change => editorService.openEditor({
original: { resource: change.originalUri },
modified: { resource: change.modifiedUri }
})));
src/vs/sessions/contrib/changes/browser/changesViewActions.ts:261
- Opening multiple editors via
Promise.all(changes.map(...openEditor))can produce non-deterministic editor activation order (whichever promise resolves last wins) and repeats group/override resolution per editor. PrefereditorService.openEditors(...)for batch opens (it resolves target groups once and opens per-group in a controlled way), or open sequentially if you need deterministic “last opened is active” behavior.
await Promise.all(changes.map(change => editorService.openEditor({
original: { resource: change.originalUri },
modified: { resource: change.modifiedUri }
})));
- Files reviewed: 1/1 changed files
- Comments generated: 1
dmitrivMS
approved these changes
Apr 21, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.