Git - set action button command argument (#196216)

This commit is contained in:
Ladislau Szomoru
2023-10-23 08:19:52 +02:00
committed by GitHub
parent f9bfb89b73
commit 67df0670ba
2 changed files with 14 additions and 6 deletions
+14 -4
View File
@@ -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<string | undefined> {
async provideCommitMessage(repository: ApiRepository, _: string[], token: CancellationToken): Promise<string | undefined> {
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
};
}