@@ -954,6 +954,11 @@ export class LaunchpadCommand extends QuickCommand<State> {
954954 createQuickPickSeparator ( 'Actions' ) ,
955955 ] ;
956956
957+ const checkoutable =
958+ state . item . type === 'pullrequest' &&
959+ state . item . headRef != null &&
960+ state . item . repoIdentity ?. remote ?. url != null ;
961+
957962 for ( const action of state . item . suggestedActions ) {
958963 switch ( action ) {
959964 case 'merge' : {
@@ -1001,41 +1006,50 @@ export class LaunchpadCommand extends QuickCommand<State> {
10011006 ) ,
10021007 ) ;
10031008 break ;
1004- case 'switch' :
1005- confirmations . push (
1006- createQuickPickItemOfT (
1007- {
1008- label : 'Switch to Branch' ,
1009- detail : 'Will checkout the branch, create or open a worktree' ,
1010- } ,
1011- action ,
1012- ) ,
1013- ) ;
1009+ case 'switch' : {
1010+ if ( checkoutable ) {
1011+ confirmations . push (
1012+ createQuickPickItemOfT (
1013+ {
1014+ label : 'Switch to Branch' ,
1015+ detail : 'Will checkout the branch, create or open a worktree' ,
1016+ } ,
1017+ action ,
1018+ ) ,
1019+ ) ;
1020+ }
10141021 break ;
1015- case 'open-worktree' :
1016- confirmations . push (
1017- createQuickPickItemOfT (
1018- {
1019- label : 'Open in Worktree' ,
1020- detail : 'Will create or open a worktree in a new window' ,
1021- } ,
1022- action ,
1023- ) ,
1024- ) ;
1022+ }
1023+ case 'open-worktree' : {
1024+ if ( checkoutable ) {
1025+ confirmations . push (
1026+ createQuickPickItemOfT (
1027+ {
1028+ label : 'Open in Worktree' ,
1029+ detail : 'Will create or open a worktree in a new window' ,
1030+ } ,
1031+ action ,
1032+ ) ,
1033+ ) ;
1034+ }
10251035 break ;
1026- case 'switch-and-code-suggest' :
1027- confirmations . push (
1028- createQuickPickItemOfT (
1029- {
1030- label : `Switch & Suggest ${
1031- state . item . viewer . isAuthor ? 'Additional ' : ''
1032- } Code Changes`,
1033- detail : 'Will checkout and start suggesting code changes' ,
1034- } ,
1035- action ,
1036- ) ,
1037- ) ;
1036+ }
1037+ case 'switch-and-code-suggest' : {
1038+ if ( checkoutable ) {
1039+ confirmations . push (
1040+ createQuickPickItemOfT (
1041+ {
1042+ label : `Switch & Suggest ${
1043+ state . item . viewer . isAuthor ? 'Additional ' : ''
1044+ } Code Changes`,
1045+ detail : 'Will checkout and start suggesting code changes' ,
1046+ } ,
1047+ action ,
1048+ ) ,
1049+ ) ;
1050+ }
10381051 break ;
1052+ }
10391053 case 'code-suggest' :
10401054 confirmations . push (
10411055 createQuickPickItemOfT (
@@ -1069,16 +1083,19 @@ export class LaunchpadCommand extends QuickCommand<State> {
10691083 ) ,
10701084 ) ;
10711085 break ;
1072- case 'open-in-graph' :
1073- confirmations . push (
1074- createQuickPickItemOfT (
1075- {
1076- label : 'Open in Commit Graph' ,
1077- } ,
1078- action ,
1079- ) ,
1080- ) ;
1086+ case 'open-in-graph' : {
1087+ if ( checkoutable ) {
1088+ confirmations . push (
1089+ createQuickPickItemOfT (
1090+ {
1091+ label : 'Open in Commit Graph' ,
1092+ } ,
1093+ action ,
1094+ ) ,
1095+ ) ;
1096+ }
10811097 break ;
1098+ }
10821099 }
10831100 }
10841101
0 commit comments