diff --git a/src/plus/launchpad/launchpad.ts b/src/plus/launchpad/launchpad.ts index 25115f0079320..1e9fac390f219 100644 --- a/src/plus/launchpad/launchpad.ts +++ b/src/plus/launchpad/launchpad.ts @@ -767,6 +767,11 @@ export class LaunchpadCommand extends QuickCommand { createQuickPickSeparator('Actions'), ]; + const checkoutable = + state.item.type === 'pullrequest' && + state.item.headRef != null && + state.item.repoIdentity?.remote?.url != null; + for (const action of state.item.suggestedActions) { switch (action) { case 'merge': { @@ -814,41 +819,50 @@ export class LaunchpadCommand extends QuickCommand { ), ); break; - case 'switch': - confirmations.push( - createQuickPickItemOfT( - { - label: 'Switch to Branch', - detail: 'Will checkout the branch, create or open a worktree', - }, - action, - ), - ); + case 'switch': { + if (checkoutable) { + confirmations.push( + createQuickPickItemOfT( + { + label: 'Switch to Branch', + detail: 'Will checkout the branch, create or open a worktree', + }, + action, + ), + ); + } break; - case 'open-worktree': - confirmations.push( - createQuickPickItemOfT( - { - label: 'Open in Worktree', - detail: 'Will create or open a worktree in a new window', - }, - action, - ), - ); + } + case 'open-worktree': { + if (checkoutable) { + confirmations.push( + createQuickPickItemOfT( + { + label: 'Open in Worktree', + detail: 'Will create or open a worktree in a new window', + }, + action, + ), + ); + } break; - case 'switch-and-code-suggest': - confirmations.push( - createQuickPickItemOfT( - { - label: `Switch & Suggest ${ - state.item.viewer.isAuthor ? 'Additional ' : '' - }Code Changes`, - detail: 'Will checkout and start suggesting code changes', - }, - action, - ), - ); + } + case 'switch-and-code-suggest': { + if (checkoutable) { + confirmations.push( + createQuickPickItemOfT( + { + label: `Switch & Suggest ${ + state.item.viewer.isAuthor ? 'Additional ' : '' + }Code Changes`, + detail: 'Will checkout and start suggesting code changes', + }, + action, + ), + ); + } break; + } case 'code-suggest': confirmations.push( createQuickPickItemOfT( @@ -882,16 +896,19 @@ export class LaunchpadCommand extends QuickCommand { ), ); break; - case 'open-in-graph': - confirmations.push( - createQuickPickItemOfT( - { - label: 'Open in Commit Graph', - }, - action, - ), - ); + case 'open-in-graph': { + if (checkoutable) { + confirmations.push( + createQuickPickItemOfT( + { + label: 'Open in Commit Graph', + }, + action, + ), + ); + } break; + } } }