mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Use disposableStore for some actions
This commit is contained in:
parent
2aa587600d
commit
4a3ed6c71f
|
@ -18,7 +18,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
|||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachInputBoxStyler, attachStylerCallback, attachCheckboxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IMarkersWorkbenchService } from 'vs/workbench/contrib/markers/browser/markers';
|
||||
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { BaseActionViewItem, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { badgeBackground, badgeForeground, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { localize } from 'vs/nls';
|
||||
|
@ -296,9 +296,7 @@ export class QuickFixAction extends Action {
|
|||
private static readonly CLASS: string = 'markers-panel-action-quickfix';
|
||||
private static readonly AUTO_FIX_CLASS: string = QuickFixAction.CLASS + ' autofixable';
|
||||
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
private readonly _onShowQuickFixes: Emitter<void> = new Emitter<void>();
|
||||
private readonly _onShowQuickFixes = this._register(new Emitter<void>());
|
||||
readonly onShowQuickFixes: Event<void> = this._onShowQuickFixes.event;
|
||||
|
||||
private _quickFixes: IAction[] = [];
|
||||
|
@ -324,11 +322,6 @@ export class QuickFixAction extends Action {
|
|||
this._onShowQuickFixes.fire();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
dispose(this.disposables);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export class QuickFixActionViewItem extends ActionViewItem {
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as nls from 'vs/nls';
|
|||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IDisposable, toDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, toDisposable, dispose, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { getDomNodePagePosition, createStyleSheet, createCSSRule, append, $ } from 'vs/base/browser/dom';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { Context } from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
|
@ -60,10 +60,10 @@ export class InspectContextKeysAction extends Action {
|
|||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
const disposables: IDisposable[] = [];
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
const stylesheet = createStyleSheet();
|
||||
disposables.push(toDisposable(() => {
|
||||
disposables.add(toDisposable(() => {
|
||||
if (stylesheet.parentNode) {
|
||||
stylesheet.parentNode.removeChild(stylesheet);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export class InspectContextKeysAction extends Action {
|
|||
|
||||
const hoverFeedback = document.createElement('div');
|
||||
document.body.appendChild(hoverFeedback);
|
||||
disposables.push(toDisposable(() => document.body.removeChild(hoverFeedback)));
|
||||
disposables.add(toDisposable(() => document.body.removeChild(hoverFeedback)));
|
||||
|
||||
hoverFeedback.style.position = 'absolute';
|
||||
hoverFeedback.style.pointerEvents = 'none';
|
||||
|
@ -80,7 +80,7 @@ export class InspectContextKeysAction extends Action {
|
|||
hoverFeedback.style.zIndex = '1000';
|
||||
|
||||
const onMouseMove = domEvent(document.body, 'mousemove', true);
|
||||
disposables.push(onMouseMove(e => {
|
||||
disposables.add(onMouseMove(e => {
|
||||
const target = e.target as HTMLElement;
|
||||
const position = getDomNodePagePosition(target);
|
||||
|
||||
|
|
Loading…
Reference in a new issue