Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Plan: Close multidiff editors when outdated ✅

Understanding the Problem

  • When opening the same PR again, multidiff editors can become outdated as the left side (base) can be out of date
  • These outdated multidiff editors should be closed when the PR is opened

Implementation Plan

  • Understand the codebase and how multidiff editors are opened
  • Identify that multidiff editors are opened via vscode.commands.executeCommand('vscode.changes', ...)
  • Implement solution to close outdated multidiff editors
    • Added _closeOutdatedMultiDiffEditors method using TabInputTextMultiDiff API
    • Identifies multidiff tabs by checking instanceof vscode.TabInputTextMultiDiff
    • Matches tabs by label pattern: "Changes in Pull Request #{prNumber}"
  • Close tracked multidiff editors when a PR is validated/opened
    • Added call to _closeOutdatedMultiDiffEditors in _upgradePullRequestEditors
    • Multidiff editors are closed when PR editors are upgraded
  • Run linters and hygiene checks
    • All checks pass ✅
  • Address code review feedback
    • Reverted formatting/whitespace changes
    • Updated to use proper TabInputTextMultiDiff API
  • Run security checks
    • CodeQL analysis passed with 0 alerts ✅
  • Implementation complete and ready for final review

Technical Approach

Uses the TabInputTextMultiDiff API (added via proposed API in commit 793ea80):

  1. Check if tab input is instanceof vscode.TabInputTextMultiDiff to identify multidiff tabs
  2. Match tabs by their label pattern ("Changes in Pull Request #{number}") to identify the specific PR
  3. Close matching tabs when _upgradePullRequestEditors is called

Implementation Details

  • Added _closeOutdatedMultiDiffEditors() method to ReviewManager class
    • Uses proper TabInputTextMultiDiff API for type checking
    • Matches tab label to identify the specific PR
  • This method is called at the start of _upgradePullRequestEditors()
  • Logs when closing outdated multidiff editors for debugging purposes
  • Clean, simple implementation using the proper VS Code API

Security Summary

CodeQL security analysis completed successfully with 0 vulnerabilities found.

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
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot revert all the whitespace/formating only changes. I can't read the diff.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot revert all the whitespace/formating only changes. I can't read the diff.

Reverted all formatting and whitespace changes in commit 05e8420. The diff now shows only the functional changes (39 lines added) without any formatting modifications.

Copilot AI requested a review from alexr00 December 18, 2025 10:26
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot With commit 793ea80 I have given you access tot he tab input multi diff api. Take that into consideration in your solution.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot With commit 793ea80 I have given you access tot he tab input multi diff api. Take that into consideration in your solution.

Updated in commit c453eae to use the TabInputTextMultiDiff API. Removed the workaround with isKnownTabInputType() helper and simplified the implementation to directly check instanceof vscode.TabInputTextMultiDiff.

Copilot AI requested a review from alexr00 December 18, 2025 14:57
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