File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 971971 "category" : " %command.pull.request.category%" ,
972972 "icon" : " $(globe)"
973973 },
974+ {
975+ "command" : " pr.pickOnCodespaces" ,
976+ "title" : " %command.pr.pickOnCodespaces.title%" ,
977+ "category" : " %command.pull.request.category%" ,
978+ "icon" : " $(cloud)"
979+ },
974980 {
975981 "command" : " pr.exit" ,
976982 "title" : " %command.pr.exit.title%" ,
20552061 "command" : " pr.pickOnVscodeDev" ,
20562062 "when" : " false"
20572063 },
2064+ {
2065+ "command" : " pr.pickOnCodespaces" ,
2066+ "when" : " false"
2067+ },
20582068 {
20592069 "command" : " pr.exit" ,
20602070 "when" : " github:inReviewMode"
28542864 "when" : " view == pr:github && viewItem =~ /pullrequest(:local)?:nonactive/ && (!isWeb || remoteName != codespaces && virtualWorkspace != vscode-vfs)" ,
28552865 "group" : " 1_pullrequest@2"
28562866 },
2867+ {
2868+ "command" : " pr.pickOnCodespaces" ,
2869+ "when" : " view == pr:github && viewItem =~ /pullrequest(:local)?:nonactive/ && (!isWeb || remoteName != codespaces && virtualWorkspace != vscode-vfs)" ,
2870+ "group" : " 1_pullrequest@3"
2871+ },
28572872 {
28582873 "command" : " pr.openChanges" ,
28592874 "when" : " view =~ /(pr|prStatus):github/ && viewItem =~ /(pullrequest|description)/ && config.multiDiffEditor.experimental.enabled" ,
Original file line number Diff line number Diff line change 189189 "command.pr.pick.title" : " Checkout Pull Request" ,
190190 "command.pr.openChanges.title" : " Open Changes" ,
191191 "command.pr.pickOnVscodeDev.title" : " Checkout Pull Request on vscode.dev" ,
192+ "command.pr.pickOnCodespaces.title" : " Checkout Pull Request in Codespaces" ,
192193 "command.pr.exit.title" : " Checkout Default Branch" ,
193194 "command.pr.dismissNotification.title" : " Dismiss Notification" ,
194195 "command.pr.markAllCopilotNotificationsAsRead.title" : " Dismiss All Copilot Notifications" ,
Original file line number Diff line number Diff line change @@ -714,6 +714,30 @@ export function registerCommands(
714714 } ) ,
715715 ) ;
716716
717+ context . subscriptions . push (
718+ vscode . commands . registerCommand ( 'pr.pickOnCodespaces' , async ( pr : PRNode | RepositoryChangesNode | PullRequestModel ) => {
719+ if ( pr === undefined ) {
720+ // This is unexpected, but has happened a few times.
721+ Logger . error ( 'Unexpectedly received undefined when picking a PR.' , logId ) ;
722+ return vscode . window . showErrorMessage ( vscode . l10n . t ( 'No pull request was selected to checkout, please try again.' ) ) ;
723+ }
724+
725+ let pullRequestModel : PullRequestModel ;
726+
727+ if ( pr instanceof PRNode || pr instanceof RepositoryChangesNode ) {
728+ pullRequestModel = pr . pullRequestModel ;
729+ } else {
730+ pullRequestModel = pr ;
731+ }
732+
733+ if ( ! pullRequestModel . head ) {
734+ return vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to checkout pull request: missing head branch information.' ) ) ;
735+ }
736+
737+ return vscode . env . openExternal ( vscode . Uri . parse ( codespacesPrLink ( pullRequestModel ) ) ) ;
738+ } ) ,
739+ ) ;
740+
717741 context . subscriptions . push ( vscode . commands . registerCommand ( 'pr.checkoutOnVscodeDevFromDescription' , async ( context : OverviewContext | undefined ) => {
718742 if ( ! context ) {
719743 return vscode . window . showErrorMessage ( vscode . l10n . t ( 'No pull request context provided for checkout.' ) ) ;
You can’t perform that action at this time.
0 commit comments