Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Opening the same PR multiple times can leave outdated multidiff editors open with stale base content. These editors should be closed when the PR is refreshed.

Implementation

Since TabInputMultiDiff is not yet available in the VS Code API (upstream: microsoft/vscode#206411), this uses label-based matching:

  • Added isKnownTabInputType() helper - Checks if tab input is one of the known types (Text, TextDiff, Custom, Webview, Notebook, NotebookDiff, Terminal). Includes maintenance note for future TabInput types.

  • Added _closeOutdatedMultiDiffEditors() - Identifies multidiff tabs by matching label pattern "Changes in Pull Request #{number}" and verifying tab input is not a known type. Uses for-loops to avoid intermediate arrays.

  • Integrated into _upgradePullRequestEditors() - Closes outdated multidiff editors before upgrading other PR editors.

Example

When a PR is reopened after base branch changes:

// Before: Outdated multidiff editor remains open showing stale diff
// After: Outdated multidiff editor is automatically closed
await this._closeOutdatedMultiDiffEditors(pullRequest);

The label matching depends on the localization key format from PullRequestModel.openChanges() remaining consistent.

Original prompt

This section details on the original issue you should resolve

<issue_title>Close multidiff editors when outdated</issue_title>
<issue_description>Opening the same PR again can result in outdated multidiff editors as the left can become out of date. These should be closed when the PR is opened. </issue_description>

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

@alexr00 This requires some work in VS Code core to expose a `TabInputMultiDiff` type in the tabs API, otherwise an extension can't find which tab to close. @alexr00 Upstream issue: https://github.com/microsoft/vscode/issues/206411

✨ 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 4 commits December 10, 2025 10:13
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Close multidiff editors when outdated Close outdated multidiff editors when PR is reopened Dec 10, 2025
Copilot AI requested a review from alexr00 December 10, 2025 10:35
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.

Close multidiff editors when outdated

2 participants