Skip to content

Commit

Permalink
SCM - 💄 cleanup old field + event (#214761)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored Jun 10, 2024
1 parent db4e4ff commit 03fedcd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
11 changes: 3 additions & 8 deletions src/vs/workbench/api/browser/mainThreadSCM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,19 @@ class MainThreadSCMProvider implements ISCMProvider, QuickDiffProvider {
get historyProvider(): ISCMHistoryProvider | undefined { return this._historyProvider; }
get acceptInputCommand(): Command | undefined { return this.features.acceptInputCommand; }
get actionButton(): ISCMActionButtonDescriptor | undefined { return this.features.actionButton ?? undefined; }
get statusBarCommands(): Command[] | undefined { return this.features.statusBarCommands; }

private readonly _count = observableValue<number | undefined>(this, undefined);
get count() { return this._count; }

private readonly _statusBarCommandsObs = observableValue<readonly Command[] | undefined>(this, undefined);
get statusBarCommandsObs() { return this._statusBarCommandsObs; }
private readonly _statusBarCommands = observableValue<readonly Command[] | undefined>(this, undefined);
get statusBarCommands() { return this._statusBarCommands; }

private readonly _name: string | undefined;
get name(): string { return this._name ?? this._label; }

private readonly _commitTemplate = observableValue<string>(this, '');
get commitTemplate() { return this._commitTemplate; }

private readonly _onDidChangeStatusBarCommands = new Emitter<readonly Command[]>();
get onDidChangeStatusBarCommands(): Event<readonly Command[]> { return this._onDidChangeStatusBarCommands.event; }

private readonly _onDidChangeHistoryProvider = new Emitter<void>();
readonly onDidChangeHistoryProvider: Event<void> = this._onDidChangeHistoryProvider.event;

Expand Down Expand Up @@ -299,8 +295,7 @@ class MainThreadSCMProvider implements ISCMProvider, QuickDiffProvider {
}

if (typeof features.statusBarCommands !== 'undefined') {
this._statusBarCommandsObs.set(features.statusBarCommands, undefined);
this._onDidChangeStatusBarCommands.fire(this.statusBarCommands!);
this._statusBarCommands.set(features.statusBarCommands, undefined);
}

if (features.hasQuickDiffProvider && !this._quickDiff) {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/scm/browser/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class SCMActiveRepositoryController extends Disposable implements IWorkbe

this._register(autorunWithStore((reader, store) => {
const repository = this._activeRepository.read(reader);
const commands = repository?.provider.statusBarCommandsObs.read(reader) ?? [];
const commands = repository?.provider.statusBarCommands.read(reader) ?? [];

this._updateStatusBar(repository, commands, store);
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class RepositoryRenderer implements ICompressibleTreeRenderer<ISCMReposit
};

templateData.elementDisposables.add(autorun(reader => {
const commands = repository.provider.statusBarCommandsObs.read(reader) ?? [];
const commands = repository.provider.statusBarCommands.read(reader) ?? [];
statusPrimaryActions = commands.map(c => new StatusBarAction(c, this.commandService));
updateToolbar();
}));
Expand Down
4 changes: 1 addition & 3 deletions src/vs/workbench/contrib/scm/common/scm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ export interface ISCMProvider extends IDisposable {
readonly historyProvider?: ISCMHistoryProvider;
readonly historyProviderObs: IObservable<ISCMHistoryProvider | undefined>;
readonly onDidChangeHistoryProvider: Event<void>;
readonly onDidChangeStatusBarCommands?: Event<readonly Command[]>;
readonly acceptInputCommand?: Command;
readonly actionButton?: ISCMActionButtonDescriptor;
readonly statusBarCommands?: readonly Command[];
readonly statusBarCommandsObs: IObservable<readonly Command[] | undefined>;
readonly statusBarCommands: IObservable<readonly Command[] | undefined>;
readonly onDidChange: Event<void>;

getOriginalResource(uri: URI): Promise<URI | null>;
Expand Down

0 comments on commit 03fedcd

Please sign in to comment.