diff --git a/extensions/git/src/artifactProvider.ts b/extensions/git/src/artifactProvider.ts index 4344d60d929..355a8641b9d 100644 --- a/extensions/git/src/artifactProvider.ts +++ b/extensions/git/src/artifactProvider.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { LogOutputChannel, SourceControlArtifactProvider, SourceControlArtifactGroup, SourceControlArtifact, Event, EventEmitter, ThemeIcon, l10n, workspace, Uri } from 'vscode'; -import { IDisposable } from './util'; +import { LogOutputChannel, SourceControlArtifactProvider, SourceControlArtifactGroup, SourceControlArtifact, Event, EventEmitter, ThemeIcon, l10n, workspace, Uri, Disposable } from 'vscode'; +import { dispose, IDisposable } from './util'; import { Repository } from './repository'; export class GitArtifactProvider implements SourceControlArtifactProvider, IDisposable { @@ -12,6 +12,7 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp readonly onDidChangeArtifacts: Event = this._onDidChangeArtifacts.event; private readonly _groups: SourceControlArtifactGroup[]; + private readonly _disposables: Disposable[] = []; constructor( private readonly repository: Repository, @@ -21,7 +22,10 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp { id: 'branches', name: l10n.t('Branches'), icon: new ThemeIcon('git-branch') }, { id: 'tags', name: l10n.t('Tags'), icon: new ThemeIcon('tag') } ]; + + this._disposables.push(this._onDidChangeArtifacts); } + provideArtifactGroups(): SourceControlArtifactGroup[] { return this._groups; } @@ -58,5 +62,7 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp return []; } - dispose(): void { } + dispose(): void { + dispose(this._disposables); + } } diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index ce59f9919be..5e60b8de373 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -5184,7 +5184,6 @@ export class CommandCenter { @command('git.repositories.checkout', { repository: true }) async artifactCheckout(repository: Repository, artifact: SourceControlArtifact): Promise { - console.log(repository, artifact); if (!repository || !artifact) { return; } diff --git a/src/vs/workbench/api/browser/mainThreadSCM.ts b/src/vs/workbench/api/browser/mainThreadSCM.ts index f73d726c720..ce1cd1578ba 100644 --- a/src/vs/workbench/api/browser/mainThreadSCM.ts +++ b/src/vs/workbench/api/browser/mainThreadSCM.ts @@ -547,27 +547,30 @@ class MainThreadSCMProvider implements ISCMProvider { } $onDidChangeHistoryProviderCurrentHistoryItemRefs(historyItemRef?: SCMHistoryItemRefDto, historyItemRemoteRef?: SCMHistoryItemRefDto, historyItemBaseRef?: SCMHistoryItemRefDto): void { - if (!this.historyProvider.get()) { + const provider = this.historyProvider.get(); + if (!provider) { return; } - this._historyProvider.get()?.$onDidChangeCurrentHistoryItemRefs(historyItemRef, historyItemRemoteRef, historyItemBaseRef); + provider.$onDidChangeCurrentHistoryItemRefs(historyItemRef, historyItemRemoteRef, historyItemBaseRef); } $onDidChangeHistoryProviderHistoryItemRefs(historyItemRefs: SCMHistoryItemRefsChangeEventDto): void { - if (!this.historyProvider.get()) { + const provider = this.historyProvider.get(); + if (!provider) { return; } - this._historyProvider.get()?.$onDidChangeHistoryItemRefs(historyItemRefs); + provider.$onDidChangeHistoryItemRefs(historyItemRefs); } $onDidChangeArtifacts(group: string): void { - if (!this.artifactProvider.get()) { + const provider = this.artifactProvider.get(); + if (!provider) { return; } - this._artifactProvider.get()?.$onDidChangeArtifacts(group); + provider.$onDidChangeArtifacts(group); } toJSON() {