@@ -704,7 +704,7 @@ export function registerCommands(
704704 } ) ) ;
705705
706706 context . subscriptions . push (
707- vscode . commands . registerCommand ( 'pr.openChanges' , async ( pr : PRNode | RepositoryChangesNode | PullRequestModel | OverviewContext | ChatSessionWithPR | undefined ) => {
707+ vscode . commands . registerCommand ( 'pr.openChanges' , async ( pr : PRNode | RepositoryChangesNode | PullRequestModel | OverviewContext | ChatSessionWithPR | { path : string } | undefined ) => {
708708 if ( pr === undefined ) {
709709 // This is unexpected, but has happened a few times.
710710 Logger . error ( 'Unexpectedly received undefined when picking a PR.' , logId ) ;
@@ -727,7 +727,22 @@ export function registerCommands(
727727 preventDefaultContextMenuItems : true ,
728728 } ) ;
729729 pullRequestModel = resolved ?. pr ;
730- } else {
730+ }
731+ else if ( contextHasPath ( pr ) ) {
732+ // looks like '/123' where 123 is the PR number
733+ const { path } = pr ;
734+ const prNumber = Number ( path . startsWith ( '/' ) ? path . substring ( 1 ) : path ) ;
735+ if ( Number . isNaN ( prNumber ) ) {
736+ return vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to parse pull request number.' ) ) ;
737+ }
738+ const folderManager = reposManager . folderManagers [ 0 ] ;
739+ const pullRequest = await folderManager . fetchById ( folderManager . gitHubRepositories [ 0 ] , Number ( prNumber ) ) ;
740+ if ( ! pullRequest ) {
741+ return vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to find pull request #{0}' , prNumber . toString ( ) ) ) ;
742+ }
743+ pullRequestModel = pullRequest ;
744+ }
745+ else {
731746 const resolved = await resolvePr ( pr as OverviewContext ) ;
732747 pullRequestModel = resolved ?. pr ;
733748 }
0 commit comments