mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Git - Update CommitMessageProvider git extension API (#196170)
Update CommitMessageProvider git extension API
This commit is contained in:
2
extensions/git/src/api/git.d.ts
vendored
2
extensions/git/src/api/git.d.ts
vendored
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user