diff --git a/CHANGELOG.md b/CHANGELOG.md index 3924346..59a10a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Changed - Improves accuracy, performance, and memory usage related to parsing diffs, used in _Changes_ hovers, _Changes_ file annotations, etc +- Improves confirmation messaging in the _Git Command Palette_ - Refines merge/rebase messaging when there is nothing to do — refs [#1660](https://github.com/gitkraken/vscode-gitlens/issues/1660) ### Fixed diff --git a/src/commands/gitCommands.ts b/src/commands/gitCommands.ts index 3aea410..75c29cb 100644 --- a/src/commands/gitCommands.ts +++ b/src/commands/gitCommands.ts @@ -249,22 +249,26 @@ export class GitCommandsCommand extends Command { if (command?.canConfirm) { if (command.canSkipConfirm) { - const willConfirmToggle = new WillConfirmToggleQuickInputButton(command.confirm(), async () => { - if (command?.skipConfirmKey == null) return; + const willConfirmToggle = new WillConfirmToggleQuickInputButton( + command.confirm(), + step?.isConfirmationStep ?? false, + async () => { + if (command?.skipConfirmKey == null) return; - const skipConfirmations = configuration.get('gitCommands.skipConfirmations') ?? []; + const skipConfirmations = configuration.get('gitCommands.skipConfirmations') ?? []; - const index = skipConfirmations.indexOf(command.skipConfirmKey); - if (index !== -1) { - skipConfirmations.splice(index, 1); - } else { - skipConfirmations.push(command.skipConfirmKey); - } + const index = skipConfirmations.indexOf(command.skipConfirmKey); + if (index !== -1) { + skipConfirmations.splice(index, 1); + } else { + skipConfirmations.push(command.skipConfirmKey); + } - await configuration.updateEffective('gitCommands.skipConfirmations', skipConfirmations); - }); + await configuration.updateEffective('gitCommands.skipConfirmations', skipConfirmations); + }, + ); buttons.push(willConfirmToggle); - } else { + } else if (!step?.isConfirmationStep) { buttons.push(WillConfirmForcedQuickInputButton); } } diff --git a/src/commands/quickCommand.buttons.ts b/src/commands/quickCommand.buttons.ts index 67895c6..131d48b 100644 --- a/src/commands/quickCommand.buttons.ts +++ b/src/commands/quickCommand.buttons.ts @@ -149,27 +149,25 @@ export const ShowTagsToggleQuickInputButton = class extends SelectableQuickInput }; export const WillConfirmForcedQuickInputButton: QuickInputButton = { - iconPath: new ThemeIcon('check'), - tooltip: 'Will always confirm', + iconPath: new ThemeIcon('gitlens-confirm-checked'), + tooltip: 'You will be presented with a required confirmation step before the action is performed', }; export const WillConfirmToggleQuickInputButton = class extends ToggleQuickInputButton { - constructor(on = false, onDidClick?: (quickInput: QuickInput) => void) { + constructor(on = false, isConfirmationStep: boolean, onDidClick?: (quickInput: QuickInput) => void) { super( () => ({ on: { - tooltip: 'Will confirm', - icon: { - dark: Uri.file(Container.instance.context.asAbsolutePath('images/dark/icon-check.svg')), - light: Uri.file(Container.instance.context.asAbsolutePath('images/light/icon-check.svg')), - }, + tooltip: isConfirmationStep + ? 'For future actions, you will be presented with confirmation step before the action is performed\nClick to toggle' + : 'You will be presented with confirmation step before the action is performed\nClick to toggle', + icon: new ThemeIcon('gitlens-confirm-checked'), }, off: { - tooltip: 'Skips confirm', - icon: { - dark: Uri.file(Container.instance.context.asAbsolutePath('images/dark/icon-no-check.svg')), - light: Uri.file(Container.instance.context.asAbsolutePath('images/light/icon-no-check.svg')), - }, + tooltip: isConfirmationStep + ? "For future actions, you won't be presented with confirmation step before the action is performed\nClick to toggle" + : "You won't be presented with confirmation step before the action is performed\nClick to toggle", + icon: new ThemeIcon('gitlens-confirm-unchecked'), }, }), on, diff --git a/src/commands/quickCommand.ts b/src/commands/quickCommand.ts index 5badeb3..d4c6bd3 100644 --- a/src/commands/quickCommand.ts +++ b/src/commands/quickCommand.ts @@ -21,6 +21,7 @@ export interface QuickInputStep { additionalButtons?: QuickInputButton[]; buttons?: QuickInputButton[]; ignoreFocusOut?: boolean; + isConfirmationStep?: boolean; keys?: StepNavigationKeys[]; placeholder?: string; prompt?: string; @@ -43,6 +44,7 @@ export interface QuickPickStep { allowEmpty?: boolean; buttons?: QuickInputButton[]; ignoreFocusOut?: boolean; + isConfirmationStep?: boolean; items: (DirectiveQuickPickItem | T)[]; // | DirectiveQuickPickItem[]; keys?: StepNavigationKeys[]; matchOnDescription?: boolean; @@ -323,15 +325,16 @@ export function createConfirmStep> = {}, + options?: Partial>, ): QuickPickStep { return createPickStep({ + isConfirmationStep: true, placeholder: `Confirm ${context.title}`, title: title, ignoreFocusOut: true, items: [...confirmations, cancel ?? createDirectiveQuickPickItem(Directive.Cancel)], selectedItems: [confirmations.find(c => c.picked) ?? confirmations[0]], - ...options, + ...(options ?? {}), }); }