From c1b930aaa3ba2f4fafa3e78725ee0289fd7c5059 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 13 May 2025 10:56:27 +0000 Subject: [PATCH] =?UTF-8?q?SCM=20-=20=F0=9F=92=84=20show=20cancel=20action?= =?UTF-8?q?=20while=20generating=20commit=20message=20(#248813)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workbench/contrib/scm/browser/scmViewPane.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index 625c6d3f0a1..bad104c327f 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -1327,7 +1327,8 @@ registerAction2(CollapseAllRepositoriesAction); registerAction2(ExpandAllRepositoriesAction); const enum SCMInputWidgetCommandId { - CancelAction = 'scm.input.cancelAction' + CancelAction = 'scm.input.cancelAction', + SetupAction = 'scm.input.triggerSetup' } const enum SCMInputWidgetStorageKey { @@ -1337,7 +1338,7 @@ const enum SCMInputWidgetStorageKey { registerAction2(class extends Action2 { constructor() { super({ - id: 'workbench.action.chat.triggerSetupFromSCMInput', + id: SCMInputWidgetCommandId.SetupAction, title: localize('scmInputGenerateCommitMessage', "Generate Commit Message with Copilot"), icon: Codicon.sparkle, f1: false, @@ -1416,7 +1417,10 @@ class SCMInputWidgetActionRunner extends ActionRunner { // Save last action if (this._runningActions.size === 0) { - this.storageService.store(SCMInputWidgetStorageKey.LastActionId, action.id, StorageScope.PROFILE, StorageTarget.USER); + const actionId = action.id === SCMInputWidgetCommandId.SetupAction + ? product.defaultChatAgent?.generateCommitMessageCommand ?? action.id + : action.id; + this.storageService.store(SCMInputWidgetStorageKey.LastActionId, actionId, StorageScope.PROFILE, StorageTarget.USER); } } } @@ -1488,7 +1492,9 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar { let primaryAction: IAction | undefined = undefined; - if (actions.length === 1) { + if ((this.actionRunner as SCMInputWidgetActionRunner).runningActions.size !== 0) { + primaryAction = this._cancelAction; + } else if (actions.length === 1) { primaryAction = actions[0]; } else if (actions.length > 1) { const lastActionId = this.storageService.get(SCMInputWidgetStorageKey.LastActionId, StorageScope.PROFILE, '');