diff --git a/src/commands/git/stash.ts b/src/commands/git/stash.ts index d319773..64c33d1 100644 --- a/src/commands/git/stash.ts +++ b/src/commands/git/stash.ts @@ -108,12 +108,16 @@ export class StashGitCommand extends QuickCommandBase { }; } + get canConfirm(): boolean { + return this._subcommand !== undefined; + } + get canSkipConfirm(): boolean { return this._subcommand === 'drop' ? false : super.canSkipConfirm; } get skipConfirmKey() { - return this._subcommand === undefined ? undefined : `${this.key}-${this._subcommand}:${this.pickedVia}`; + return `${this.key}${this._subcommand === undefined ? '' : `-${this._subcommand}`}:${this.pickedVia}`; } protected async *steps(): StepAsyncGenerator { diff --git a/src/commands/gitCommands.ts b/src/commands/gitCommands.ts index a78596e..58beee2 100644 --- a/src/commands/gitCommands.ts +++ b/src/commands/gitCommands.ts @@ -461,9 +461,8 @@ export class GitCommandsCommand extends Command { } } + if (!command.canConfirm) return buttons; if (command.canSkipConfirm) { - if (command.skipConfirmKey === undefined) return buttons; - buttons.push( command.confirm() ? this.GitQuickInputButtons.WillConfirm : this.GitQuickInputButtons.WillSkipConfirm ); diff --git a/src/commands/quickCommand.ts b/src/commands/quickCommand.ts index bc3e1b2..bde2a31 100644 --- a/src/commands/quickCommand.ts +++ b/src/commands/quickCommand.ts @@ -83,6 +83,10 @@ export abstract class QuickCommandBase implements QuickPickItem { this.detail = options.detail; } + get canConfirm(): boolean { + return true; + } + get canSkipConfirm(): boolean { return true; } @@ -106,12 +110,12 @@ export abstract class QuickCommandBase implements QuickPickItem { this._pickedVia = value; } - get skipConfirmKey(): string | undefined { + get skipConfirmKey(): string { return `${this.key}:${this.pickedVia}`; } confirm(override?: boolean) { - if (!this.canSkipConfirm || this.skipConfirmKey === undefined) return true; + if (!this.canConfirm || !this.canSkipConfirm) return true; return override !== undefined ? override