Skip to content

Commit 61dd3c6

Browse files
authored
Revert "Drop-down buttons to also go to next (microsoft#226619)" (microsoft#226672)
This reverts commit 90c3e49.
1 parent ea1d863 commit 61dd3c6

File tree

4 files changed

+10
-30
lines changed

4 files changed

+10
-30
lines changed

src/vs/workbench/contrib/comments/browser/commentFormActions.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Button, ButtonWithDropdown } from 'vs/base/browser/ui/button/button';
7-
import { ActionRunner, IAction } from 'vs/base/common/actions';
6+
import { Button } from 'vs/base/browser/ui/button/button';
7+
import { IAction } from 'vs/base/common/actions';
88
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
99
import { IMenu } from 'vs/platform/actions/common/actions';
1010
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
11-
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
1211
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1312
import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
1413
import { CommentCommandId } from 'vs/workbench/contrib/comments/common/commentCommandIds';
@@ -21,7 +20,6 @@ export class CommentFormActions implements IDisposable {
2120
constructor(
2221
private readonly keybindingService: IKeybindingService,
2322
private readonly contextKeyService: IContextKeyService,
24-
private readonly contextMenuService: IContextMenuService,
2523
private container: HTMLElement,
2624
private actionHandler: (action: IAction) => void,
2725
private readonly maxActions?: number
@@ -36,30 +34,16 @@ export class CommentFormActions implements IDisposable {
3634
const groups = menu.getActions({ shouldForwardArgs: true });
3735
let isPrimary: boolean = !hasOnlySecondaryActions;
3836
for (const group of groups) {
39-
const [groupId, actions] = group;
37+
const [, actions] = group;
4038

4139
this._actions = actions;
42-
for (const current of groupId === 'inline' ? actions : [actions]) {
43-
const [action, dropDownActions] = Array.isArray(current) ? [current[0], current.slice(1)] : [current, []];
40+
for (const action of actions) {
4441
let keybinding = this.keybindingService.lookupKeybinding(action.id, this.contextKeyService)?.getLabel();
4542
if (!keybinding && isPrimary) {
4643
keybinding = this.keybindingService.lookupKeybinding(CommentCommandId.Submit, this.contextKeyService)?.getLabel();
4744
}
4845
const title = keybinding ? `${action.label} (${keybinding})` : action.label;
49-
const actionHandler = this.actionHandler;
50-
const button = dropDownActions.length ? new ButtonWithDropdown(this.container, {
51-
contextMenuProvider: this.contextMenuService,
52-
actions: dropDownActions,
53-
actionRunner: new class extends ActionRunner {
54-
protected override async runAction(action: IAction, context?: unknown): Promise<void> {
55-
return actionHandler(action);
56-
}
57-
},
58-
secondary: !isPrimary,
59-
title,
60-
addPrimaryActionToDropdown: false,
61-
...defaultButtonStyles
62-
}) : new Button(this.container, { secondary: !isPrimary, title, ...defaultButtonStyles });
46+
const button = new Button(this.container, { secondary: !isPrimary, title, ...defaultButtonStyles });
6347

6448
isPrimary = false;
6549
this._buttonElements.push(button.element);

src/vs/workbench/contrib/comments/browser/commentNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
633633
this._commentFormActions?.setActions(menu);
634634
}));
635635

636-
this._commentFormActions = new CommentFormActions(this.keybindingService, this._contextKeyService, this.contextMenuService, container, (action: IAction): void => {
636+
this._commentFormActions = new CommentFormActions(this.keybindingService, this._contextKeyService, container, (action: IAction): void => {
637637
const text = this._commentEditor!.getValue();
638638

639639
action.run({
@@ -659,7 +659,7 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
659659
this._commentEditorActions?.setActions(menu);
660660
}));
661661

662-
this._commentEditorActions = new CommentFormActions(this.keybindingService, this._contextKeyService, this.contextMenuService, container, (action: IAction): void => {
662+
this._commentEditorActions = new CommentFormActions(this.keybindingService, this._contextKeyService, container, (action: IAction): void => {
663663
const text = this._commentEditor!.getValue();
664664

665665
action.run({

src/vs/workbench/contrib/comments/browser/commentReply.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { ICommentThreadWidget } from 'vs/workbench/contrib/comments/common/comme
3030
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';
3131
import { LayoutableEditor, MIN_EDITOR_HEIGHT, SimpleCommentEditor, calculateEditorHeight } from './simpleCommentEditor';
3232
import { IHoverService } from 'vs/platform/hover/browser/hover';
33-
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
3433

3534
let INMEM_MODEL_ID = 0;
3635
export const COMMENTEDITOR_DECORATION_KEY = 'commenteditordecoration';
@@ -64,7 +63,6 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
6463
@ICommentService private commentService: ICommentService,
6564
@IConfigurationService configurationService: IConfigurationService,
6665
@IKeybindingService private keybindingService: IKeybindingService,
67-
@IContextMenuService private contextMenuService: IContextMenuService,
6866
@IHoverService private hoverService: IHoverService,
6967
@ITextModelService private readonly textModelService: ITextModelService
7068
) {
@@ -275,7 +273,7 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
275273
this._commentFormActions.setActions(menu);
276274
}));
277275

278-
this._commentFormActions = new CommentFormActions(this.keybindingService, this._contextKeyService, this.contextMenuService, container, async (action: IAction) => {
276+
this._commentFormActions = new CommentFormActions(this.keybindingService, this._contextKeyService, container, async (action: IAction) => {
279277
await this._actionRunDelegate?.();
280278

281279
await action.run({
@@ -298,7 +296,7 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
298296
this._commentEditorActions.setActions(editorMenu);
299297
}));
300298

301-
this._commentEditorActions = new CommentFormActions(this.keybindingService, this._contextKeyService, this.contextMenuService, container, async (action: IAction) => {
299+
this._commentEditorActions = new CommentFormActions(this.keybindingService, this._contextKeyService, container, async (action: IAction) => {
302300
this._actionRunDelegate?.();
303301

304302
action.run({

src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { CommentFormActions } from 'vs/workbench/contrib/comments/browser/commen
1616
import { CommentMenus } from 'vs/workbench/contrib/comments/browser/commentMenus';
1717
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';
1818
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
19-
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
2019

2120
export class CommentThreadAdditionalActions<T extends IRange | ICellRange> extends Disposable {
2221
private _container: HTMLElement | null;
@@ -30,7 +29,6 @@ export class CommentThreadAdditionalActions<T extends IRange | ICellRange> exten
3029
private _commentMenus: CommentMenus,
3130
private _actionRunDelegate: (() => void) | null,
3231
@IKeybindingService private _keybindingService: IKeybindingService,
33-
@IContextMenuService private _contextMenuService: IContextMenuService,
3432
) {
3533
super();
3634

@@ -82,7 +80,7 @@ export class CommentThreadAdditionalActions<T extends IRange | ICellRange> exten
8280
this._enableDisableMenu(menu);
8381
}));
8482

85-
this._commentFormActions = new CommentFormActions(this._keybindingService, this._contextKeyService, this._contextMenuService, container, async (action: IAction) => {
83+
this._commentFormActions = new CommentFormActions(this._keybindingService, this._contextKeyService, container, async (action: IAction) => {
8684
this._actionRunDelegate?.();
8785

8886
action.run({

0 commit comments

Comments
 (0)