mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Small cleanup to ActionWidgetService (#172028)
- Take readonly array - `show` does not return a promise - add `_` prefix
This commit is contained in:
parent
c4887a04d8
commit
b7189522d7
|
@ -10,9 +10,9 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
|||
import { Disposable, DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
import 'vs/css!./actionWidget';
|
||||
import { localize } from 'vs/nls';
|
||||
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
|
||||
import { acceptSelectedActionCommand, ActionList, IListMenuItem, previewSelectedActionCommand } from 'vs/platform/actionWidget/browser/actionList';
|
||||
import { IActionItem } from 'vs/platform/actionWidget/common/actionWidget';
|
||||
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
@ -34,7 +34,7 @@ export const IActionWidgetService = createDecorator<IActionWidgetService>('actio
|
|||
export interface IActionWidgetService {
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
show(user: string, supportsPreview: boolean, items: IListMenuItem<IActionItem>[], delegate: IRenderDelegate<any>, anchor: IAnchor, container: HTMLElement | undefined, actionBarActions?: readonly IAction[]): Promise<void>;
|
||||
show(user: string, supportsPreview: boolean, items: readonly IListMenuItem<IActionItem>[], delegate: IRenderDelegate<any>, anchor: IAnchor, container: HTMLElement | undefined, actionBarActions?: readonly IAction[]): void;
|
||||
|
||||
hide(): void;
|
||||
|
||||
|
@ -51,18 +51,18 @@ class ActionWidgetService extends Disposable implements IActionWidgetService {
|
|||
private readonly _list = this._register(new MutableDisposable<ActionList<any>>());
|
||||
|
||||
constructor(
|
||||
@IContextViewService private readonly contextViewService: IContextViewService,
|
||||
@IContextViewService private readonly _contextViewService: IContextViewService,
|
||||
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
async show(user: string, supportsPreview: boolean, items: IListMenuItem<IActionItem>[], delegate: IRenderDelegate<any>, anchor: IAnchor, container: HTMLElement | undefined, actionBarActions?: readonly IAction[]): Promise<void> {
|
||||
show(user: string, supportsPreview: boolean, items: readonly IListMenuItem<IActionItem>[], delegate: IRenderDelegate<any>, anchor: IAnchor, container: HTMLElement | undefined, actionBarActions?: readonly IAction[]): void {
|
||||
const visibleContext = ActionWidgetContextKeys.Visible.bindTo(this._contextKeyService);
|
||||
|
||||
const list = this._instantiationService.createInstance(ActionList, user, supportsPreview, items, delegate);
|
||||
this.contextViewService.showContextView({
|
||||
this._contextViewService.showContextView({
|
||||
getAnchor: () => anchor,
|
||||
render: (container: HTMLElement) => {
|
||||
visibleContext.set(true);
|
||||
|
@ -70,7 +70,7 @@ class ActionWidgetService extends Disposable implements IActionWidgetService {
|
|||
},
|
||||
onHide: (didCancel) => {
|
||||
visibleContext.reset();
|
||||
return this._onWidgetClosed(didCancel);
|
||||
this._onWidgetClosed(didCancel);
|
||||
},
|
||||
}, container, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue