@@ -11,16 +11,13 @@ import { localize } from '../../../../nls.js';
11
11
import { IEditorGroupView } from './editor.js' ;
12
12
import { Emitter } from '../../../../base/common/event.js' ;
13
13
import { ThemeIcon } from '../../../../base/common/themables.js' ;
14
- import { ICommandService } from '../../../../platform/commands/common/commands.js' ;
15
- import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js' ;
16
14
import { Disposable , DisposableStore } from '../../../../base/common/lifecycle.js' ;
17
15
import { IAction , Separator , SubmenuAction } from '../../../../base/common/actions.js' ;
18
16
import { actionTooltip } from '../../../../platform/positronActionBar/common/helpers.js' ;
19
17
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js' ;
18
+ import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js' ;
20
19
import { PositronActionBar } from '../../../../platform/positronActionBar/browser/positronActionBar.js' ;
21
- import { ContextKeyExpr , IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js' ;
22
20
import { ActionBarRegion } from '../../../../platform/positronActionBar/browser/components/actionBarRegion.js' ;
23
- import { ActionBarButton } from '../../../../platform/positronActionBar/browser/components/actionBarButton.js' ;
24
21
import { ActionBarSeparator } from '../../../../platform/positronActionBar/browser/components/actionBarSeparator.js' ;
25
22
import { ActionBarMenuButton } from '../../../../platform/positronActionBar/browser/components/actionBarMenuButton.js' ;
26
23
import { ActionBarActionButton } from '../../../../platform/positronActionBar/browser/components/actionBarActionButton.js' ;
@@ -37,14 +34,6 @@ const PADDING_RIGHT = 8;
37
34
/**
38
35
* Localized strings.
39
36
*/
40
- const positronFormatDocumentAriaLabel = localize (
41
- 'positronFormatDocumentAriaLabel' ,
42
- "Format Document"
43
- ) ;
44
- const positronFormatDocumentTooltip = localize (
45
- 'positronFormatDocumentTooltip' ,
46
- "Format Document"
47
- ) ;
48
37
const positronMoveIntoNewWindowAriaLabel = localize (
49
38
'positronMoveIntoNewWindowAriaLabel' ,
50
39
"Move into new window"
@@ -77,15 +66,6 @@ interface SubmenuDescriptor {
77
66
export class EditorActionBarFactory extends Disposable {
78
67
//#region Private Properties
79
68
80
- /**
81
- * The context key expression for showing the format document action.
82
- */
83
- private readonly _showFormatDocumentContextKeyExpr = ContextKeyExpr . and (
84
- EditorContextKeys . notInCompositeEditor ,
85
- EditorContextKeys . writable ,
86
- EditorContextKeys . hasDocumentFormattingProvider
87
- ) ;
88
-
89
69
/**
90
70
* Gets the menu disposable stores.
91
71
*/
@@ -131,14 +111,12 @@ export class EditorActionBarFactory extends Disposable {
131
111
/**
132
112
* Constructor.
133
113
* @param _editorGroup The editor group.
134
- * @param _commandService The command service.
135
114
* @param _contextKeyService The context key service.
136
115
* @param _keybindingService The keybinding service.
137
116
* @param _menuService The menu service.
138
117
*/
139
118
constructor (
140
119
private readonly _editorGroup : IEditorGroupView ,
141
- private readonly _commandService : ICommandService ,
142
120
private readonly _contextKeyService : IContextKeyService ,
143
121
private readonly _keybindingService : IKeybindingService ,
144
122
private readonly _menuService : IMenuService ,
@@ -181,35 +159,23 @@ export class EditorActionBarFactory extends Disposable {
181
159
// Create the set of processed actions.
182
160
const processedActions = new Set < string > ( ) ;
183
161
184
- // Create the left action bar elements from the editor title menu's EditorTitleRun action.
185
- const leftActionBarElements = this . buildActionBarElements (
186
- processedActions ,
187
- false ,
188
- MenuId . EditorTitle ,
189
- new Set ( [ 'submenuitem.EditorTitleRun' ] ) ,
190
- ) ;
191
-
192
- // Append the format document action to the left action bar elements, if applicable.
193
- const activeEditorContextKeyService = this . _editorGroup . activeEditorPane ?. scopedContextKeyService ;
194
- if ( activeEditorContextKeyService && activeEditorContextKeyService . contextMatchesRules ( this . _showFormatDocumentContextKeyExpr ) ) {
195
- leftActionBarElements . push (
196
- < ActionBarButton
197
- ariaLabel = { positronFormatDocumentAriaLabel }
198
- icon = { ThemeIcon . fromId ( 'positron-format-document' ) }
199
- tooltip = { positronFormatDocumentTooltip }
200
- onPressed = { ( ) => {
201
- this . _commandService . executeCommand ( 'editor.action.formatDocument' ) ;
202
- } }
203
- />
204
- ) ;
205
- }
206
-
207
- // Append the editor actions left menu's EditorActionsLeft action to the left action bar elements.
208
- leftActionBarElements . push ( ...this . buildActionBarElements (
209
- processedActions ,
210
- false ,
211
- MenuId . EditorActionsLeft ,
212
- ) ) ;
162
+ // Create the left action bar elements from the editor title menu's editor title run submenu
163
+ // item and the editor actions left menu.
164
+ const leftActionBarElements = [
165
+ // Build action bar elements from the editor title run submenu item.
166
+ ...this . buildActionBarElements (
167
+ processedActions ,
168
+ false ,
169
+ MenuId . EditorTitle ,
170
+ new Set ( [ 'submenuitem.EditorTitleRun' ] ) ,
171
+ ) ,
172
+ // Build action bar elements from the editor actions left menu.
173
+ ...this . buildActionBarElements (
174
+ processedActions ,
175
+ false ,
176
+ MenuId . EditorActionsLeft ,
177
+ )
178
+ ] ;
213
179
214
180
// Build the right action bar elements from the editor actions right menu and the remaining
215
181
// actions on the editor title menu.
0 commit comments