@@ -19,24 +19,27 @@ export class OpenPullRequestTool extends PullRequestTool {
1919 return panelPR ;
2020 }
2121
22- // Check if the active file is a diff view or multidiff view showing PR content
23- const activeEditor = vscode . window . activeTextEditor ;
24- if ( activeEditor ?. document . uri ) {
25- const uri = activeEditor . document . uri ;
22+ // Check if the active tab is a diff editor showing PR content
23+ const activeTab = vscode . window . tabGroups . activeTabGroup . activeTab ;
24+ if ( activeTab ?. input instanceof vscode . TabInputTextDiff ) {
25+ const diffInput = activeTab . input ;
26+ const urisToCheck = [ diffInput . original , diffInput . modified ] ;
2627
27- if ( uri . scheme === Schemes . Pr ) {
28- // This is a PR diff from GitHub
29- const prParams = fromPRUri ( uri ) ;
30- if ( prParams ) {
31- return this . _findPullRequestByNumber ( prParams . prNumber , prParams . remoteName ) ;
32- }
33- } else if ( uri . scheme === Schemes . Review ) {
34- // This is a review diff from a checked out PR
35- const reviewParams = fromReviewUri ( uri . query ) ;
36- if ( reviewParams ) {
37- // For review scheme, find the active/checked out PR
38- const folderManager = this . folderManagers . folderManagers . find ( manager => manager . activePullRequest ) ;
39- return folderManager ?. activePullRequest ;
28+ for ( const uri of urisToCheck ) {
29+ if ( uri . scheme === Schemes . Pr ) {
30+ // This is a PR diff from GitHub
31+ const prParams = fromPRUri ( uri ) ;
32+ if ( prParams ) {
33+ return this . _findPullRequestByNumber ( prParams . prNumber , prParams . remoteName ) ;
34+ }
35+ } else if ( uri . scheme === Schemes . Review ) {
36+ // This is a review diff from a checked out PR
37+ const reviewParams = fromReviewUri ( uri . query ) ;
38+ if ( reviewParams ) {
39+ // For review scheme, find the active/checked out PR
40+ const folderManager = this . folderManagers . folderManagers . find ( manager => manager . activePullRequest ) ;
41+ return folderManager ?. activePullRequest ;
42+ }
4043 }
4144 }
4245 }
0 commit comments