3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
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' ;
8
8
import { DisposableStore , IDisposable } from 'vs/base/common/lifecycle' ;
9
9
import { IMenu } from 'vs/platform/actions/common/actions' ;
10
10
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
11
- import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
12
11
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
13
12
import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles' ;
14
13
import { CommentCommandId } from 'vs/workbench/contrib/comments/common/commentCommandIds' ;
@@ -21,7 +20,6 @@ export class CommentFormActions implements IDisposable {
21
20
constructor (
22
21
private readonly keybindingService : IKeybindingService ,
23
22
private readonly contextKeyService : IContextKeyService ,
24
- private readonly contextMenuService : IContextMenuService ,
25
23
private container : HTMLElement ,
26
24
private actionHandler : ( action : IAction ) => void ,
27
25
private readonly maxActions ?: number
@@ -36,30 +34,16 @@ export class CommentFormActions implements IDisposable {
36
34
const groups = menu . getActions ( { shouldForwardArgs : true } ) ;
37
35
let isPrimary : boolean = ! hasOnlySecondaryActions ;
38
36
for ( const group of groups ) {
39
- const [ groupId , actions ] = group ;
37
+ const [ , actions ] = group ;
40
38
41
39
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 ) {
44
41
let keybinding = this . keybindingService . lookupKeybinding ( action . id , this . contextKeyService ) ?. getLabel ( ) ;
45
42
if ( ! keybinding && isPrimary ) {
46
43
keybinding = this . keybindingService . lookupKeybinding ( CommentCommandId . Submit , this . contextKeyService ) ?. getLabel ( ) ;
47
44
}
48
45
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 } ) ;
63
47
64
48
isPrimary = false ;
65
49
this . _buttonElements . push ( button . element ) ;
0 commit comments