File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 13201320 {
13211321 "command" : " pr.checkoutFromDescription" ,
13221322 "title" : " %command.pr.checkoutFromDescription.title%" ,
1323- "category" : " %command.pull.request.category%"
1323+ "category" : " %command.pull.request.category%" ,
1324+ "icon" : " $(git-compare)"
13241325 },
13251326 {
13261327 "command" : " pr.checkoutOnVscodeDevFromDescription" ,
34103411 "when" : " chatSessionType == copilot-swe-agent" ,
34113412 "group" : " context"
34123413 }
3414+ ],
3415+ "chat/multiDiff/context" : [
3416+ {
3417+ "command" : " pr.checkoutFromDescription" ,
3418+ "when" : " chatSessionType == copilot-swe-agent"
3419+ }
34133420 ]
34143421 },
34153422 "colors" : [
Original file line number Diff line number Diff line change @@ -651,11 +651,27 @@ export function registerCommands(
651651 return { folderManager, pr } ;
652652 } ;
653653
654- context . subscriptions . push ( vscode . commands . registerCommand ( 'pr.checkoutFromDescription' , async ( context : OverviewContext | undefined ) => {
655- if ( ! context ) {
654+ context . subscriptions . push ( vscode . commands . registerCommand ( 'pr.checkoutFromDescription' , async ( ctx : OverviewContext | { path : string } | undefined ) => {
655+ if ( ! ctx ) {
656656 return vscode . window . showErrorMessage ( vscode . l10n . t ( 'No pull request context provided for checkout.' ) ) ;
657657 }
658- const resolved = await resolvePr ( context ) ;
658+
659+ if ( 'path' in ctx ) {
660+ const { path } = ctx ;
661+ const prNumber = Number ( Buffer . from ( path . substring ( 1 ) , 'base64' ) . toString ( 'utf8' ) ) ;
662+ if ( Number . isNaN ( prNumber ) ) {
663+ return vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to parse pull request number.' ) ) ;
664+ }
665+ const folderManager = reposManager . folderManagers [ 0 ] ;
666+ const pullRequest = await folderManager . fetchById ( folderManager . gitHubRepositories [ 0 ] , Number ( prNumber ) ) ;
667+ if ( ! pullRequest ) {
668+ return vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to find pull request #{0}' , prNumber . toString ( ) ) ) ;
669+ }
670+
671+ return switchToPr ( folderManager , pullRequest , folderManager . repository , true ) ;
672+ }
673+
674+ const resolved = await resolvePr ( ctx ) ;
659675 if ( ! resolved ) {
660676 return vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to resolve pull request for checkout.' ) ) ;
661677 }
You can’t perform that action at this time.
0 commit comments