4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import { reset } from 'vs/base/browser/dom' ;
7
- import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems' ;
8
7
import { IHoverDelegate } from 'vs/base/browser/ui/iconLabel/iconHoverDelegate' ;
9
8
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels' ;
10
9
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar' ;
11
- import { Action , IAction } from 'vs/base/common/actions' ;
10
+ import { IAction } from 'vs/base/common/actions' ;
12
11
import { Codicon } from 'vs/base/common/codicons' ;
13
12
import { Emitter , Event } from 'vs/base/common/event' ;
14
13
import { DisposableStore } from 'vs/base/common/lifecycle' ;
15
14
import { assertType } from 'vs/base/common/types' ;
16
15
import { localize } from 'vs/nls' ;
17
16
import { createActionViewItem , createAndFillInContextMenuActions , MenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem' ;
18
- import { IMenuService , MenuId , MenuItemAction } from 'vs/platform/actions/common/actions' ;
17
+ import { Action2 , IMenuService , MenuId , MenuItemAction , registerAction2 } from 'vs/platform/actions/common/actions' ;
19
18
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
20
19
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
21
- import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
20
+ import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
22
21
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
23
22
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput' ;
24
23
import * as colors from 'vs/platform/theme/common/colorRegistry' ;
@@ -57,7 +56,7 @@ export class CommandCenterControl {
57
56
58
57
override render ( container : HTMLElement ) : void {
59
58
super . render ( container ) ;
60
- container . classList . add ( 'quickopen' ) ;
59
+ container . classList . add ( 'quickopen' , 'left' ) ;
61
60
62
61
assertType ( this . label ) ;
63
62
this . label . classList . add ( 'search' ) ;
@@ -68,7 +67,7 @@ export class CommandCenterControl {
68
67
this . workspaceTitle . classList . add ( 'search-label' ) ;
69
68
this . _updateFromWindowTitle ( ) ;
70
69
reset ( this . label , searchIcon , this . workspaceTitle ) ;
71
- this . _renderAllQuickPickItem ( container ) ;
70
+ // this._renderAllQuickPickItem(container);
72
71
73
72
this . _store . add ( windowTitle . onDidChange ( this . _updateFromWindowTitle , this ) ) ;
74
73
}
@@ -96,24 +95,23 @@ export class CommandCenterControl {
96
95
: localize ( 'title2' , "Search {0} \u2014 {1}" , windowTitle . workspaceName , windowTitle . value ) ;
97
96
this . _applyUpdateTooltip ( title ) ;
98
97
}
98
+ }
99
+ return instantiationService . createInstance ( InputLikeViewItem , action , { hoverDelegate } ) ;
99
100
100
- private _renderAllQuickPickItem ( parent : HTMLElement ) : void {
101
- const container = document . createElement ( 'span' ) ;
102
- container . classList . add ( 'all-options' ) ;
103
- parent . appendChild ( container ) ;
104
- const action = new Action ( 'all' , localize ( 'all' , "Show Search Modes..." ) , Codicon . chevronDown . classNames , true , ( ) => {
105
- quickInputService . quickAccess . show ( '?' ) ;
106
- } ) ;
107
- const dropdown = new ActionViewItem ( undefined , action , { icon : true , label : false , hoverDelegate } ) ;
108
- dropdown . render ( container ) ;
109
- this . _store . add ( dropdown ) ;
110
- this . _store . add ( action ) ;
101
+ } else if ( action instanceof MenuItemAction && action . id === 'commandCenter.help' ) {
102
+
103
+ class ExtraClass extends MenuEntryActionViewItem {
104
+ override render ( container : HTMLElement ) : void {
105
+ super . render ( container ) ;
106
+ container . classList . add ( 'quickopen' , 'right' ) ;
111
107
}
112
108
}
113
- return instantiationService . createInstance ( InputLikeViewItem , action , { hoverDelegate } ) ;
114
- }
115
109
116
- return createActionViewItem ( instantiationService , action , { hoverDelegate } ) ;
110
+ return instantiationService . createInstance ( ExtraClass , action , { hoverDelegate } ) ;
111
+
112
+ } else {
113
+ return createActionViewItem ( instantiationService , action , { hoverDelegate } ) ;
114
+ }
117
115
}
118
116
} ) ;
119
117
const menu = this . _disposables . add ( menuService . createMenu ( MenuId . CommandCenter , contextKeyService ) ) ;
@@ -143,6 +141,21 @@ export class CommandCenterControl {
143
141
}
144
142
}
145
143
144
+ registerAction2 ( class extends Action2 {
145
+
146
+ constructor ( ) {
147
+ super ( {
148
+ id : 'commandCenter.help' ,
149
+ title : localize ( 'all' , "Show Search Modes..." ) ,
150
+ icon : Codicon . chevronDown ,
151
+ menu : { id : MenuId . CommandCenter , order : 100 }
152
+ } ) ;
153
+ }
154
+ run ( accessor : ServicesAccessor ) : void {
155
+ accessor . get ( IQuickInputService ) . quickAccess . show ( '?' ) ;
156
+ }
157
+ } ) ;
158
+
146
159
// --- theme colors
147
160
148
161
// foreground (inactive and active)
0 commit comments