From 67df0670baef3d9e2b4c53b5ec7db3b47f9545c1 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 23 Oct 2023 08:19:52 +0200 Subject: [PATCH] Git - set action button command argument (#196216) --- extensions/git/src/commitMessageProvider.ts | 18 ++++++++++++++---- .../contrib/scm/browser/scmViewPane.ts | 2 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/extensions/git/src/commitMessageProvider.ts b/extensions/git/src/commitMessageProvider.ts index 29f2da8c8b1..c774ea5dcec 100644 --- a/extensions/git/src/commitMessageProvider.ts +++ b/extensions/git/src/commitMessageProvider.ts @@ -20,7 +20,9 @@ export class TestCommitMessageProvider implements CommitMessageProvider { readonly icon = new ThemeIcon('rocket'); readonly title = 'Generate Commit Message (Test)'; - async provideCommitMessage(_: ApiRepository, __: string[], token: CancellationToken): Promise { + async provideCommitMessage(repository: ApiRepository, _: string[], token: CancellationToken): Promise { + console.log('Repository: ', repository.rootUri.fsPath); + if (token.isCancellationRequested) { return undefined; } @@ -62,12 +64,20 @@ export class GenerateCommitMessageActionButton { return this.state.isGenerating ? { icon: new ThemeIcon('debug-stop'), - command: { title: l10n.t('Cancel'), command: 'git.generateCommitMessageCancel' }, - enabled: this.state.enabled + command: { + title: l10n.t('Cancel'), + command: 'git.generateCommitMessageCancel', + arguments: [this.repository.sourceControl] + }, + enabled: this.state.enabled, } : { icon: this.commitMessageProviderRegistry.commitMessageProvider.icon ?? new ThemeIcon('sparkle'), - command: { title: this.commitMessageProviderRegistry.commitMessageProvider.title, command: 'git.generateCommitMessage' }, + command: { + title: this.commitMessageProviderRegistry.commitMessageProvider.title, + command: 'git.generateCommitMessage', + arguments: [this.repository.sourceControl] + }, enabled: this.state.enabled }; } diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index a9cb19a3718..ce8d71d993e 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -1959,8 +1959,6 @@ class SCMInputWidget { updateEnablement(input.enabled); // ActionBar - this.actionBar.context = input.repository.provider; - const onDidChangeActionButton = () => { this.actionBar.clear(); if (!input.actionButton) {