Skip to content

Commit

Permalink
refs #106358
Browse files Browse the repository at this point in the history
  • Loading branch information
sbatten committed Sep 10, 2020
1 parent 7fdda46 commit 4c67705
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/vs/base/browser/ui/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ export interface IActionProvider {

export interface IDropdownMenuOptions extends IBaseDropdownOptions {
contextMenuProvider: IContextMenuProvider;
actions?: IAction[];
actionProvider?: IActionProvider;
readonly actions?: IAction[];
readonly actionProvider?: IActionProvider;
menuClassName?: string;
menuAsChild?: boolean; // scope down for #99448
}
Expand Down
12 changes: 4 additions & 8 deletions src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,15 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
return null;
};

const isActionsArray = Array.isArray(this.menuActionsOrProvider);
const options: IDropdownMenuOptions = {
contextMenuProvider: this.contextMenuProvider,
labelRenderer: labelRenderer,
menuAsChild: this.options.menuAsChild
menuAsChild: this.options.menuAsChild,
actions: isActionsArray ? this.menuActionsOrProvider as IAction[] : undefined,
actionProvider: isActionsArray ? undefined : this.menuActionsOrProvider as IActionProvider
};

// Render the DropdownMenu around a simple action to toggle it
if (Array.isArray(this.menuActionsOrProvider)) {
options.actions = this.menuActionsOrProvider;
} else {
options.actionProvider = this.menuActionsOrProvider as IActionProvider;
}

this.dropdownMenu = this._register(new DropdownMenu(container, options));
this._register(this.dropdownMenu.onDidChangeVisibility(visible => {
this.element?.setAttribute('aria-expanded', `${visible}`);
Expand Down
7 changes: 6 additions & 1 deletion src/vs/workbench/browser/actions/layoutActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,12 @@ export class MoveViewAction extends Action {
return new Promise((resolve, reject) => {
quickPick.onDidAccept(() => {
const viewId = quickPick.selectedItems[0];
resolve(viewId.id);
if (viewId.id) {
resolve(viewId.id);
} else {
reject();

This comment has been minimized.

Copy link
@bpasero

bpasero Dec 2, 2021

Member

@sbatten suggest to not reject without error, if the promise is unhandled, it will be impossible to figure out

}

quickPick.hide();
});

Expand Down

0 comments on commit 4c67705

Please sign in to comment.