Skip to content

Commit b61980c

Browse files
committed
Use base class's existing _register method
1 parent b893fd1 commit b61980c

2 files changed

Lines changed: 4 additions & 19 deletions

File tree

src/vs/workbench/contrib/experiments/electron-browser/experimentService.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/
1010
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1111
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
1212
import { language } from 'vs/base/common/platform';
13-
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
13+
import { Disposable } from 'vs/base/common/lifecycle';
1414
import { match } from 'vs/base/common/glob';
1515
import { IRequestService, asJson } from 'vs/platform/request/common/request';
1616
import { Emitter, Event } from 'vs/base/common/event';
@@ -60,7 +60,6 @@ export class ExperimentService extends Disposable implements IExperimentService
6060
private _experiments: IExperiment[] = [];
6161
private _loadExperimentsPromise: Promise<void>;
6262
private _curatedMapping = Object.create(null);
63-
private _disposables: IDisposable[] = [];
6463

6564
private readonly _onExperimentEnabled = this._register(new Emitter<IExperiment>());
6665
onExperimentEnabled: Event<IExperiment> = this._onExperimentEnabled.event;
@@ -392,14 +391,10 @@ export class ExperimentService extends Disposable implements IExperimentService
392391
}
393392
}
394393
});
395-
this._disposables.push(onSaveHandler);
394+
this._register(onSaveHandler);
396395
return ExperimentState.Evaluating;
397396
});
398397
}
399-
400-
dispose() {
401-
this._disposables = dispose(this._disposables);
402-
}
403398
}
404399

405400

src/vs/workbench/contrib/output/browser/outputActions.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { SelectActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
1111
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
1212
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
1313
import { TogglePanelAction } from 'vs/workbench/browser/panel';
14-
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
1514
import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
1615
import { IThemeService } from 'vs/platform/theme/common/themeService';
1716
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
@@ -67,11 +66,9 @@ export class ToggleOrSetOutputScrollLockAction extends Action {
6766
public static readonly ID = 'workbench.output.action.toggleOutputScrollLock';
6867
public static readonly LABEL = nls.localize({ key: 'toggleOutputScrollLock', comment: ['Turn on / off automatic output scrolling'] }, "Toggle Output Scroll Lock");
6968

70-
private toDispose: IDisposable[] = [];
71-
7269
constructor(id: string, label: string, @IOutputService private readonly outputService: IOutputService) {
7370
super(id, label, 'output-action output-scroll-unlock');
74-
this.toDispose.push(this.outputService.onActiveOutputChannel(channel => {
71+
this._register(this.outputService.onActiveOutputChannel(channel => {
7572
const activeChannel = this.outputService.getActiveChannel();
7673
if (activeChannel) {
7774
this.setClassAndLabel(activeChannel.scrollLock);
@@ -104,11 +101,6 @@ export class ToggleOrSetOutputScrollLockAction extends Action {
104101
this.label = nls.localize('outputScrollOff', "Turn Auto Scrolling Off");
105102
}
106103
}
107-
108-
public dispose() {
109-
super.dispose();
110-
this.toDispose = dispose(this.toDispose);
111-
}
112104
}
113105

114106
export class SwitchOutputAction extends Action {
@@ -188,15 +180,13 @@ export class OpenLogOutputFile extends Action {
188180
public static readonly ID = 'workbench.output.action.openLogOutputFile';
189181
public static readonly LABEL = nls.localize('openInLogViewer', "Open Log File");
190182

191-
private disposables: IDisposable[] = [];
192-
193183
constructor(
194184
@IOutputService private readonly outputService: IOutputService,
195185
@IEditorService private readonly editorService: IEditorService,
196186
@IInstantiationService private readonly instantiationService: IInstantiationService
197187
) {
198188
super(OpenLogOutputFile.ID, OpenLogOutputFile.LABEL, 'output-action open-log-file');
199-
this.outputService.onActiveOutputChannel(this.update, this, this.disposables);
189+
this._register(this.outputService.onActiveOutputChannel(this.update, this));
200190
this.update();
201191
}
202192

0 commit comments

Comments
 (0)