Git - Update CommitMessageProvider git extension API (#196170)

Update CommitMessageProvider git extension API
This commit is contained in:
Ladislau Szomoru
2023-10-21 18:15:39 +02:00
committed by GitHub
parent c05b49710b
commit b8c3c75f5d
3 changed files with 4 additions and 4 deletions

View File

@@ -303,7 +303,7 @@ export interface BranchProtectionProvider {
export interface CommitMessageProvider {
readonly title: string;
readonly icon?: Uri | { light: Uri, dark: Uri } | ThemeIcon;
provideCommitMessage(changes: string[], cancellationToken?: CancellationToken): Promise<string | undefined>;
provideCommitMessage(repository: Repository, changes: string[], cancellationToken?: CancellationToken): Promise<string | undefined>;
}
export type APIState = 'uninitialized' | 'initialized';

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { CancellationToken, Disposable, Event, EventEmitter, Uri, workspace, SourceControlInputBoxActionButton, ThemeIcon, l10n } from 'vscode';
import { CommitMessageProvider, Status } from './api/git';
import { CommitMessageProvider, Status, Repository as ApiRepository } from './api/git';
import { Repository } from './repository';
import { dispose } from './util';
@@ -20,7 +20,7 @@ export class TestCommitMessageProvider implements CommitMessageProvider {
readonly icon = new ThemeIcon('rocket');
readonly title = 'Generate Commit Message (Test)';
async provideCommitMessage(_: string[], token: CancellationToken): Promise<string | undefined> {
async provideCommitMessage(_: ApiRepository, __: string[], token: CancellationToken): Promise<string | undefined> {
if (token.isCancellationRequested) {
return undefined;
}

View File

@@ -2048,7 +2048,7 @@ export class Repository implements Disposable {
const token = this.generateCommitMessageCancellationTokenSource.token;
const provider = this.commitMessageProviderRegistry.commitMessageProvider;
const commitMessage = await provider.provideCommitMessage(diff, token);
const commitMessage = await provider.provideCommitMessage(new ApiRepository(this), diff, token);
if (commitMessage) {
this.inputBox.value = commitMessage;
}