diff --git a/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts b/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts index 3f5cb8f648e1b136e69fb243ff526582fb1b936f..4845284aa69d11169f2c11de1302cf1b62a537c4 100644 --- a/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts +++ b/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts @@ -252,7 +252,7 @@ export class MarkerNavigationWidget extends PeekViewWidget { container.appendChild(this._container); this._message = new MessageWidget(this._container, this.editor, related => this._onDidSelectRelatedInformation.fire(related)); - this._disposables.push(this._message); + this._disposables.add(this._message); } show(where: Position, heightInLines: number): void { diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts index 9fddc606303dbc309452743ef7e4de181002cd0b..a244ae259cf2aac7c984c74cc9e94defe34edf10 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts @@ -117,7 +117,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { this.create(); this._peekViewService.addExclusiveWidget(editor, this); this._applyTheme(themeService.getTheme()); - themeService.onThemeChange(this._applyTheme, this, this._disposables); + this._disposables.add(themeService.onThemeChange(this._applyTheme, this)); } dispose(): void { @@ -230,18 +230,18 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { } }, Sizing.Distribute); - this._splitView.onDidSashChange(() => { + this._disposables.add(this._splitView.onDidSashChange(() => { if (this._dim.width) { this._layoutInfo.ratio = this._splitView.getViewSize(0) / this._dim.width; } - }, undefined, this._disposables); + })); // session state let localDispose: IDisposable[] = []; - this._disposables.push({ dispose() { dispose(localDispose); } }); + this._disposables.add({ dispose() { dispose(localDispose); } }); // update editor - this._tree.onDidChangeFocus(e => { + this._disposables.add(this._tree.onDidChangeFocus(e => { const [element] = e.elements; if (element && isNonEmptyArray(element.locations)) { @@ -287,9 +287,9 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { } this.setMetaTitle(localize('meta', " – {0}", names.join(' → '))); } - }, undefined, this._disposables); + })); - this._editor.onMouseDown(e => { + this._disposables.add(this._editor.onMouseDown(e => { const { event, target } = e; if (event.detail !== 2) { return; @@ -304,9 +304,9 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { options: { selection: target.range! } }); - }, undefined, this._disposables); + })); - this._tree.onMouseDblClick(e => { + this._disposables.add(this._tree.onMouseDblClick(e => { if (e.element && isNonEmptyArray(e.element.locations)) { this.dispose(); this._editorService.openEditor({ @@ -314,9 +314,9 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { options: { selection: e.element.locations[0].range } }); } - }, undefined, this._disposables); + })); - this._tree.onDidChangeSelection(e => { + this._disposables.add(this._tree.onDidChangeSelection(e => { const [element] = e.elements; // don't close on click if (element && isNonEmptyArray(element.locations) && e.browserEvent instanceof KeyboardEvent) { @@ -326,7 +326,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { options: { selection: element.locations[0].range } }); } - }, undefined, this._disposables); + })); } showLoading(): void { @@ -380,7 +380,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { } }; this._changeDirectionAction = new ChangeHierarchyDirectionAction(this._direction, changeDirection); - this._disposables.push(this._changeDirectionAction); + this._disposables.add(this._changeDirectionAction); this._actionbarWidget.push(this._changeDirectionAction, { icon: true, label: false }); } } diff --git a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts index e8eada1700778f02686ac4ddb8d6d2f38b4f1f7f..027282343b16b9dee4de60e3db2a3bb2e7be36f0 100644 --- a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts @@ -184,7 +184,7 @@ class DirtyDiffWidget extends PeekViewWidget { ) { super(editor, { isResizeable: true, frameWidth: 1, keepEditorSelection: true }); - themeService.onThemeChange(this._applyTheme, this, this._disposables); + this._disposables.add(themeService.onThemeChange(this._applyTheme, this)); this._applyTheme(themeService.getTheme()); this.contextKeyService = contextKeyService.createScoped(); @@ -199,7 +199,7 @@ class DirtyDiffWidget extends PeekViewWidget { } this.setTitle(this.title); - model.onDidChange(this.renderTitle, this, this._disposables); + this._disposables.add(model.onDidChange(this.renderTitle, this)); } showChange(index: number): void { @@ -253,8 +253,8 @@ class DirtyDiffWidget extends PeekViewWidget { const previous = this.instantiationService.createInstance(UIEditorAction, this.editor, new ShowPreviousChangeAction(), 'show-previous-change chevron-up'); const next = this.instantiationService.createInstance(UIEditorAction, this.editor, new ShowNextChangeAction(), 'show-next-change chevron-down'); - this._disposables.push(previous); - this._disposables.push(next); + this._disposables.add(previous); + this._disposables.add(next); this._actionbarWidget.push([previous, next], { label: false, icon: true }); const actions: IAction[] = [];