@codingame/monaco-vscode-explorer-service-override 11.1.2 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,831 +0,0 @@
1
- import { localize, localize2 } from 'vscode/vscode/vs/nls';
2
- import { GlobalCompareResourcesAction, FocusFilesExplorer, ShowActiveFileInExplorer, CompareWithClipboardAction, CompareNewUntitledTextFilesAction, ToggleAutoSaveAction, OpenActiveFileInEmptyWorkspace, SetActiveEditorReadonlyInSession, SetActiveEditorWriteableInSession, ToggleActiveEditorReadonlyInSession, ResetActiveEditorReadonlyInSession, renameHandler, moveFileToTrashHandler, deleteFileHandler, cutFileHandler, copyFileHandler, pasteFileHandler, openFilePreserveFocusHandler, NEW_FILE_COMMAND_ID, NEW_FILE_LABEL, NEW_FOLDER_COMMAND_ID, NEW_FOLDER_LABEL, COPY_FILE_LABEL, PASTE_FILE_LABEL, FileCopiedContext, DOWNLOAD_COMMAND_ID, DOWNLOAD_LABEL, UPLOAD_COMMAND_ID, UPLOAD_LABEL, TRIGGER_RENAME_LABEL, MOVE_FILE_TO_TRASH_LABEL } from 'vscode/vscode/vs/workbench/contrib/files/browser/fileActions';
3
- import { acceptLocalChangesCommand, revertLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler';
4
- import { registerAction2, MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
5
- import { openWindowCommand, newWindowCommand } from './fileCommands.js';
6
- import { COPY_PATH_COMMAND_ID, COPY_RELATIVE_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID, SAVE_FILE_COMMAND_ID, SAVE_FILE_LABEL, SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID, SAVE_FILE_WITHOUT_FORMATTING_LABEL, SAVE_ALL_IN_GROUP_COMMAND_ID, SAVE_FILES_COMMAND_ID, REVERT_FILE_COMMAND_ID, COMPARE_WITH_SAVED_COMMAND_ID, SAVE_FILE_AS_COMMAND_ID, SAVE_FILE_AS_LABEL, NEW_UNTITLED_FILE_COMMAND_ID, NEW_UNTITLED_FILE_LABEL, OPEN_TO_SIDE_COMMAND_ID, OpenEditorsGroupContext, OpenEditorsDirtyEditorContext, OpenEditorsReadonlyEditorContext, COMPARE_RESOURCE_COMMAND_ID, ResourceSelectedForCompareContext, SELECT_FOR_COMPARE_COMMAND_ID, COMPARE_SELECTED_COMMAND_ID, OpenEditorsSelectedFileOrUntitledContext, OPEN_WITH_EXPLORER_COMMAND_ID, REMOVE_ROOT_FOLDER_COMMAND_ID, REMOVE_ROOT_FOLDER_LABEL, SAVE_ALL_COMMAND_ID } from 'vscode/vscode/vs/workbench/contrib/files/browser/fileConstants';
7
- import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
8
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
9
- import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
10
- import { FilesExplorerFocusCondition, ExplorerRootContext, ExplorerResourceNotReadonlyContext, ExplorerResourceMoveableToTrash, ExplorerResourceCut, ExplorerFolderContext, ExplorerResourceAvailableEditorIdsContext, FoldersViewVisibleContext } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
11
- import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL } from 'vscode/vscode/vs/workbench/browser/actions/workspaceCommands';
12
- import { REOPEN_WITH_COMMAND_ID, CLOSE_EDITOR_COMMAND_ID, CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, CLOSE_SAVED_EDITORS_COMMAND_ID, CLOSE_EDITORS_IN_GROUP_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
13
- import { AutoSaveAfterShortDelayContext } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
14
- import { WorkbenchTreeFindOpen, WorkbenchListDoubleSelection } from 'vscode/vscode/vs/platform/list/browser/listService';
15
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
16
- import { ResourceContextKey, MultipleEditorsSelectedInGroupContext, WorkspaceFolderCountContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, TwoEditorsSelectedInGroupContext, SelectedEditorsInGroupFileOrUntitledResourceContextKey, HasWebFileSystemAccess, EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext, ActiveEditorContext, SidebarFocusContext, ActiveEditorCanRevertContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
17
- import { IsWebContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
18
- import { IExplorerService } from 'vscode/vscode/vs/workbench/contrib/files/browser/files.service';
19
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
20
- import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
21
-
22
- registerAction2(GlobalCompareResourcesAction);
23
- registerAction2(FocusFilesExplorer);
24
- registerAction2(ShowActiveFileInExplorer);
25
- registerAction2(CompareWithClipboardAction);
26
- registerAction2(CompareNewUntitledTextFilesAction);
27
- registerAction2(ToggleAutoSaveAction);
28
- registerAction2(OpenActiveFileInEmptyWorkspace);
29
- registerAction2(SetActiveEditorReadonlyInSession);
30
- registerAction2(SetActiveEditorWriteableInSession);
31
- registerAction2(ToggleActiveEditorReadonlyInSession);
32
- registerAction2(ResetActiveEditorReadonlyInSession);
33
- CommandsRegistry.registerCommand('_files.windowOpen', openWindowCommand);
34
- CommandsRegistry.registerCommand('_files.newWindow', newWindowCommand);
35
- const explorerCommandsWeightBonus = 10;
36
- const RENAME_ID = 'renameFile';
37
- KeybindingsRegistry.registerCommandAndKeybindingRule({
38
- id: RENAME_ID,
39
- weight: 200 + explorerCommandsWeightBonus,
40
- when: ( (ContextKeyExpr.and(
41
- FilesExplorerFocusCondition,
42
- (ExplorerRootContext.toNegated()),
43
- ExplorerResourceNotReadonlyContext
44
- ))),
45
- primary: 60 ,
46
- mac: {
47
- primary: 3
48
- },
49
- handler: renameHandler
50
- });
51
- const MOVE_FILE_TO_TRASH_ID = 'moveFileToTrash';
52
- KeybindingsRegistry.registerCommandAndKeybindingRule({
53
- id: MOVE_FILE_TO_TRASH_ID,
54
- weight: 200 + explorerCommandsWeightBonus,
55
- when: ( (ContextKeyExpr.and(
56
- FilesExplorerFocusCondition,
57
- ExplorerResourceNotReadonlyContext,
58
- ExplorerResourceMoveableToTrash,
59
- (WorkbenchTreeFindOpen.toNegated())
60
- ))),
61
- primary: 20 ,
62
- mac: {
63
- primary: 2048 | 1 ,
64
- secondary: [20 ]
65
- },
66
- handler: moveFileToTrashHandler
67
- });
68
- const DELETE_FILE_ID = 'deleteFile';
69
- KeybindingsRegistry.registerCommandAndKeybindingRule({
70
- id: DELETE_FILE_ID,
71
- weight: 200 + explorerCommandsWeightBonus,
72
- when: ( (ContextKeyExpr.and(
73
- FilesExplorerFocusCondition,
74
- ExplorerResourceNotReadonlyContext,
75
- (WorkbenchTreeFindOpen.toNegated())
76
- ))),
77
- primary: 1024 | 20 ,
78
- mac: {
79
- primary: 2048 | 512 | 1
80
- },
81
- handler: deleteFileHandler
82
- });
83
- KeybindingsRegistry.registerCommandAndKeybindingRule({
84
- id: DELETE_FILE_ID,
85
- weight: 200 + explorerCommandsWeightBonus,
86
- when: ( (ContextKeyExpr.and(
87
- FilesExplorerFocusCondition,
88
- ExplorerResourceNotReadonlyContext,
89
- (ExplorerResourceMoveableToTrash.toNegated()),
90
- (WorkbenchTreeFindOpen.toNegated())
91
- ))),
92
- primary: 20 ,
93
- mac: {
94
- primary: 2048 | 1
95
- },
96
- handler: deleteFileHandler
97
- });
98
- const CUT_FILE_ID = 'filesExplorer.cut';
99
- KeybindingsRegistry.registerCommandAndKeybindingRule({
100
- id: CUT_FILE_ID,
101
- weight: 200 + explorerCommandsWeightBonus,
102
- when: ( (ContextKeyExpr.and(
103
- FilesExplorerFocusCondition,
104
- (ExplorerRootContext.toNegated()),
105
- ExplorerResourceNotReadonlyContext,
106
- (WorkbenchTreeFindOpen.toNegated())
107
- ))),
108
- primary: 2048 | 54 ,
109
- handler: cutFileHandler,
110
- });
111
- const COPY_FILE_ID = 'filesExplorer.copy';
112
- KeybindingsRegistry.registerCommandAndKeybindingRule({
113
- id: COPY_FILE_ID,
114
- weight: 200 + explorerCommandsWeightBonus,
115
- when: ( (ContextKeyExpr.and(
116
- FilesExplorerFocusCondition,
117
- (ExplorerRootContext.toNegated())
118
- ))),
119
- primary: 2048 | 33 ,
120
- handler: copyFileHandler,
121
- });
122
- const PASTE_FILE_ID = 'filesExplorer.paste';
123
- CommandsRegistry.registerCommand(PASTE_FILE_ID, pasteFileHandler);
124
- KeybindingsRegistry.registerKeybindingRule({
125
- id: `^${PASTE_FILE_ID}`,
126
- weight: 200 + explorerCommandsWeightBonus,
127
- when: ( (ContextKeyExpr.and(
128
- FilesExplorerFocusCondition,
129
- ExplorerResourceNotReadonlyContext,
130
- (WorkbenchTreeFindOpen.toNegated())
131
- ))),
132
- primary: 2048 | 52 ,
133
- });
134
- KeybindingsRegistry.registerCommandAndKeybindingRule({
135
- id: 'filesExplorer.cancelCut',
136
- weight: 200 + explorerCommandsWeightBonus,
137
- when: ( (ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceCut))),
138
- primary: 9 ,
139
- handler: async (accessor) => {
140
- const explorerService = accessor.get(IExplorerService);
141
- await explorerService.setToCopy([], true);
142
- }
143
- });
144
- KeybindingsRegistry.registerCommandAndKeybindingRule({
145
- id: 'filesExplorer.openFilePreserveFocus',
146
- weight: 200 + explorerCommandsWeightBonus,
147
- when: ( (ContextKeyExpr.and(
148
- FilesExplorerFocusCondition,
149
- (ExplorerFolderContext.toNegated())
150
- ))),
151
- primary: 10 ,
152
- handler: openFilePreserveFocusHandler
153
- });
154
- const copyPathCommand = {
155
- id: COPY_PATH_COMMAND_ID,
156
- title: ( localize(2156, "Copy Path"))
157
- };
158
- const copyRelativePathCommand = {
159
- id: COPY_RELATIVE_PATH_COMMAND_ID,
160
- title: ( localize(2157, "Copy Relative Path"))
161
- };
162
- const revealInsideBarCommand = {
163
- id: REVEAL_IN_EXPLORER_COMMAND_ID,
164
- title: ( localize(2158, "Reveal in Explorer View"))
165
- };
166
- appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste', true);
167
- appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste', true);
168
- appendEditorTitleContextMenuItem(revealInsideBarCommand.id, revealInsideBarCommand.title, ResourceContextKey.IsFileSystemResource, '2_files', false, 1);
169
- function appendEditorTitleContextMenuItem(id, title, when, group, supportsMultiSelect, order) {
170
- const precondition = supportsMultiSelect !== true ? ( (MultipleEditorsSelectedInGroupContext.negate())) : undefined;
171
- MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
172
- command: { id, title, precondition },
173
- when,
174
- group,
175
- order,
176
- });
177
- }
178
- appendSaveConflictEditorTitleAction('workbench.files.action.acceptLocalChanges', ( localize(2159, "Use your changes and overwrite file contents")), Codicon.check, -10, acceptLocalChangesCommand);
179
- appendSaveConflictEditorTitleAction('workbench.files.action.revertLocalChanges', ( localize(2160, "Discard your changes and revert to file contents")), Codicon.discard, -9, revertLocalChangesCommand);
180
- function appendSaveConflictEditorTitleAction(id, title, icon, order, command) {
181
- CommandsRegistry.registerCommand(id, command);
182
- MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
183
- command: { id, title, icon },
184
- when: ( (ContextKeyExpr.equals(CONFLICT_RESOLUTION_CONTEXT, true))),
185
- group: 'navigation',
186
- order
187
- });
188
- }
189
- function appendToCommandPalette({ id, title, category, metadata }, when) {
190
- MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
191
- command: {
192
- id,
193
- title,
194
- category,
195
- metadata
196
- },
197
- when
198
- });
199
- }
200
- appendToCommandPalette({
201
- id: COPY_PATH_COMMAND_ID,
202
- title: ( localize2(2161, "Copy Path of Active File")),
203
- category: Categories.File
204
- });
205
- appendToCommandPalette({
206
- id: COPY_RELATIVE_PATH_COMMAND_ID,
207
- title: ( localize2(2162, "Copy Relative Path of Active File")),
208
- category: Categories.File
209
- });
210
- appendToCommandPalette({
211
- id: SAVE_FILE_COMMAND_ID,
212
- title: SAVE_FILE_LABEL,
213
- category: Categories.File
214
- });
215
- appendToCommandPalette({
216
- id: SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID,
217
- title: SAVE_FILE_WITHOUT_FORMATTING_LABEL,
218
- category: Categories.File
219
- });
220
- appendToCommandPalette({
221
- id: SAVE_ALL_IN_GROUP_COMMAND_ID,
222
- title: ( localize2(2163, "Save All in Group")),
223
- category: Categories.File
224
- });
225
- appendToCommandPalette({
226
- id: SAVE_FILES_COMMAND_ID,
227
- title: ( localize2(2164, "Save All Files")),
228
- category: Categories.File
229
- });
230
- appendToCommandPalette({
231
- id: REVERT_FILE_COMMAND_ID,
232
- title: ( localize2(2165, "Revert File")),
233
- category: Categories.File
234
- });
235
- appendToCommandPalette({
236
- id: COMPARE_WITH_SAVED_COMMAND_ID,
237
- title: ( localize2(2166, "Compare Active File with Saved")),
238
- category: Categories.File,
239
- metadata: {
240
- description: ( localize2(
241
- 2167,
242
- "Opens a new diff editor to compare the active file with the version on disk."
243
- ))
244
- }
245
- });
246
- appendToCommandPalette({
247
- id: SAVE_FILE_AS_COMMAND_ID,
248
- title: SAVE_FILE_AS_LABEL,
249
- category: Categories.File
250
- });
251
- appendToCommandPalette({
252
- id: NEW_FILE_COMMAND_ID,
253
- title: NEW_FILE_LABEL,
254
- category: Categories.File
255
- }, ( (WorkspaceFolderCountContext.notEqualsTo('0'))));
256
- appendToCommandPalette({
257
- id: NEW_FOLDER_COMMAND_ID,
258
- title: NEW_FOLDER_LABEL,
259
- category: Categories.File,
260
- metadata: { description: ( localize2(2168, "Create a new folder or directory")) }
261
- }, ( (WorkspaceFolderCountContext.notEqualsTo('0'))));
262
- appendToCommandPalette({
263
- id: NEW_UNTITLED_FILE_COMMAND_ID,
264
- title: NEW_UNTITLED_FILE_LABEL,
265
- category: Categories.File
266
- });
267
- const isFileOrUntitledResourceContextKey = ( (ContextKeyExpr.or(
268
- ResourceContextKey.IsFileSystemResource,
269
- (ResourceContextKey.Scheme.isEqualTo(Schemas.untitled))
270
- )));
271
- const openToSideCommand = {
272
- id: OPEN_TO_SIDE_COMMAND_ID,
273
- title: ( localize(2169, "Open to the Side"))
274
- };
275
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
276
- group: 'navigation',
277
- order: 10,
278
- command: openToSideCommand,
279
- when: isFileOrUntitledResourceContextKey
280
- });
281
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
282
- group: '1_open',
283
- order: 10,
284
- command: {
285
- id: REOPEN_WITH_COMMAND_ID,
286
- title: ( localize(2170, "Reopen Editor With..."))
287
- },
288
- when: ( (ContextKeyExpr.and(
289
- ActiveEditorAvailableEditorIdsContext,
290
- (OpenEditorsGroupContext.toNegated()))))
291
- });
292
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
293
- group: '1_cutcopypaste',
294
- order: 10,
295
- command: copyPathCommand,
296
- when: ResourceContextKey.IsFileSystemResource
297
- });
298
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
299
- group: '1_cutcopypaste',
300
- order: 20,
301
- command: copyRelativePathCommand,
302
- when: ResourceContextKey.IsFileSystemResource
303
- });
304
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
305
- group: '2_save',
306
- order: 10,
307
- command: {
308
- id: SAVE_FILE_COMMAND_ID,
309
- title: SAVE_FILE_LABEL,
310
- precondition: OpenEditorsDirtyEditorContext
311
- },
312
- when: ( (ContextKeyExpr.or(
313
- (ResourceContextKey.Scheme.isEqualTo(Schemas.untitled)),
314
- (ContextKeyExpr.and(
315
- (OpenEditorsGroupContext.toNegated()),
316
- (OpenEditorsReadonlyEditorContext.toNegated()),
317
- (AutoSaveAfterShortDelayContext.toNegated()))))))
318
- });
319
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
320
- group: '2_save',
321
- order: 20,
322
- command: {
323
- id: REVERT_FILE_COMMAND_ID,
324
- title: ( localize(2165, "Revert File")),
325
- precondition: OpenEditorsDirtyEditorContext
326
- },
327
- when: ( (ContextKeyExpr.and(
328
- (OpenEditorsGroupContext.toNegated()),
329
- (OpenEditorsReadonlyEditorContext.toNegated()),
330
- (ResourceContextKey.Scheme.notEqualsTo(Schemas.untitled)),
331
- (AutoSaveAfterShortDelayContext.toNegated()))))
332
- });
333
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
334
- group: '2_save',
335
- order: 30,
336
- command: {
337
- id: SAVE_ALL_IN_GROUP_COMMAND_ID,
338
- title: ( localize(2171, "Save All")),
339
- precondition: DirtyWorkingCopiesContext
340
- },
341
- when: OpenEditorsGroupContext
342
- });
343
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
344
- group: '3_compare',
345
- order: 10,
346
- command: {
347
- id: COMPARE_WITH_SAVED_COMMAND_ID,
348
- title: ( localize(2172, "Compare with Saved")),
349
- precondition: OpenEditorsDirtyEditorContext
350
- },
351
- when: ( (ContextKeyExpr.and(
352
- ResourceContextKey.IsFileSystemResource,
353
- (AutoSaveAfterShortDelayContext.toNegated()),
354
- (WorkbenchListDoubleSelection.toNegated())
355
- )))
356
- });
357
- const compareResourceCommand = {
358
- id: COMPARE_RESOURCE_COMMAND_ID,
359
- title: ( localize(2173, "Compare with Selected"))
360
- };
361
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
362
- group: '3_compare',
363
- order: 20,
364
- command: compareResourceCommand,
365
- when: ( (ContextKeyExpr.and(
366
- ResourceContextKey.HasResource,
367
- ResourceSelectedForCompareContext,
368
- isFileOrUntitledResourceContextKey,
369
- (WorkbenchListDoubleSelection.toNegated())
370
- )))
371
- });
372
- const selectForCompareCommand = {
373
- id: SELECT_FOR_COMPARE_COMMAND_ID,
374
- title: ( localize(2174, "Select for Compare"))
375
- };
376
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
377
- group: '3_compare',
378
- order: 30,
379
- command: selectForCompareCommand,
380
- when: ( (ContextKeyExpr.and(
381
- ResourceContextKey.HasResource,
382
- isFileOrUntitledResourceContextKey,
383
- (WorkbenchListDoubleSelection.toNegated())
384
- )))
385
- });
386
- const compareSelectedCommand = {
387
- id: COMPARE_SELECTED_COMMAND_ID,
388
- title: ( localize(2175, "Compare Selected"))
389
- };
390
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
391
- group: '3_compare',
392
- order: 30,
393
- command: compareSelectedCommand,
394
- when: ( (ContextKeyExpr.and(
395
- ResourceContextKey.HasResource,
396
- WorkbenchListDoubleSelection,
397
- OpenEditorsSelectedFileOrUntitledContext
398
- )))
399
- });
400
- MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
401
- group: '1_compare',
402
- order: 30,
403
- command: compareSelectedCommand,
404
- when: ( (ContextKeyExpr.and(
405
- ResourceContextKey.HasResource,
406
- TwoEditorsSelectedInGroupContext,
407
- SelectedEditorsInGroupFileOrUntitledResourceContextKey
408
- )))
409
- });
410
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
411
- group: '4_close',
412
- order: 10,
413
- command: {
414
- id: CLOSE_EDITOR_COMMAND_ID,
415
- title: ( localize(2176, "Close"))
416
- },
417
- when: ( (OpenEditorsGroupContext.toNegated()))
418
- });
419
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
420
- group: '4_close',
421
- order: 20,
422
- command: {
423
- id: CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID,
424
- title: ( localize(2177, "Close Others"))
425
- },
426
- when: ( (OpenEditorsGroupContext.toNegated()))
427
- });
428
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
429
- group: '4_close',
430
- order: 30,
431
- command: {
432
- id: CLOSE_SAVED_EDITORS_COMMAND_ID,
433
- title: ( localize(2178, "Close Saved"))
434
- }
435
- });
436
- MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
437
- group: '4_close',
438
- order: 40,
439
- command: {
440
- id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
441
- title: ( localize(2179, "Close All"))
442
- }
443
- });
444
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
445
- group: 'navigation',
446
- order: 4,
447
- command: {
448
- id: NEW_FILE_COMMAND_ID,
449
- title: NEW_FILE_LABEL,
450
- precondition: ( (ContextKeyExpr.and(
451
- ExplorerResourceNotReadonlyContext,
452
- (WorkbenchTreeFindOpen.toNegated())
453
- )))
454
- },
455
- when: ExplorerFolderContext
456
- });
457
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
458
- group: 'navigation',
459
- order: 6,
460
- command: {
461
- id: NEW_FOLDER_COMMAND_ID,
462
- title: NEW_FOLDER_LABEL,
463
- precondition: ( (ContextKeyExpr.and(
464
- ExplorerResourceNotReadonlyContext,
465
- (WorkbenchTreeFindOpen.toNegated())
466
- )))
467
- },
468
- when: ExplorerFolderContext
469
- });
470
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
471
- group: 'navigation',
472
- order: 10,
473
- command: openToSideCommand,
474
- when: ( (ContextKeyExpr.and(
475
- (ExplorerFolderContext.toNegated()),
476
- ResourceContextKey.HasResource
477
- )))
478
- });
479
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
480
- group: 'navigation',
481
- order: 20,
482
- command: {
483
- id: OPEN_WITH_EXPLORER_COMMAND_ID,
484
- title: ( localize(2180, "Open With...")),
485
- },
486
- when: ( (ContextKeyExpr.and(
487
- (ExplorerFolderContext.toNegated()),
488
- ExplorerResourceAvailableEditorIdsContext
489
- ))),
490
- });
491
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
492
- group: '3_compare',
493
- order: 20,
494
- command: compareResourceCommand,
495
- when: ( (ContextKeyExpr.and(
496
- (ExplorerFolderContext.toNegated()),
497
- ResourceContextKey.HasResource,
498
- ResourceSelectedForCompareContext,
499
- (WorkbenchListDoubleSelection.toNegated())
500
- )))
501
- });
502
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
503
- group: '3_compare',
504
- order: 30,
505
- command: selectForCompareCommand,
506
- when: ( (ContextKeyExpr.and(
507
- (ExplorerFolderContext.toNegated()),
508
- ResourceContextKey.HasResource,
509
- (WorkbenchListDoubleSelection.toNegated())
510
- )))
511
- });
512
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
513
- group: '3_compare',
514
- order: 30,
515
- command: compareSelectedCommand,
516
- when: ( (ContextKeyExpr.and(
517
- (ExplorerFolderContext.toNegated()),
518
- ResourceContextKey.HasResource,
519
- WorkbenchListDoubleSelection
520
- )))
521
- });
522
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
523
- group: '5_cutcopypaste',
524
- order: 8,
525
- command: {
526
- id: CUT_FILE_ID,
527
- title: ( localize(2181, "Cut")),
528
- precondition: ( (WorkbenchTreeFindOpen.toNegated()))
529
- },
530
- when: ( (ContextKeyExpr.and(
531
- (ExplorerRootContext.toNegated()),
532
- ExplorerResourceNotReadonlyContext
533
- )))
534
- });
535
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
536
- group: '5_cutcopypaste',
537
- order: 10,
538
- command: {
539
- id: COPY_FILE_ID,
540
- title: COPY_FILE_LABEL,
541
- },
542
- when: ( (ExplorerRootContext.toNegated()))
543
- });
544
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
545
- group: '5_cutcopypaste',
546
- order: 20,
547
- command: {
548
- id: PASTE_FILE_ID,
549
- title: PASTE_FILE_LABEL,
550
- precondition: ( (ContextKeyExpr.and(
551
- ExplorerResourceNotReadonlyContext,
552
- FileCopiedContext,
553
- (WorkbenchTreeFindOpen.toNegated())
554
- )))
555
- },
556
- when: ExplorerFolderContext
557
- });
558
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({
559
- group: '5b_importexport',
560
- order: 10,
561
- command: {
562
- id: DOWNLOAD_COMMAND_ID,
563
- title: DOWNLOAD_LABEL
564
- },
565
- when: ( (ContextKeyExpr.or(
566
- (ContextKeyExpr.and(
567
- (IsWebContext.toNegated()),
568
- (ResourceContextKey.Scheme.notEqualsTo(Schemas.file))
569
- )),
570
- (ContextKeyExpr.and(
571
- IsWebContext,
572
- (ExplorerFolderContext.toNegated()),
573
- (ExplorerRootContext.toNegated())
574
- )),
575
- (ContextKeyExpr.and(IsWebContext, HasWebFileSystemAccess)))))
576
- }));
577
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({
578
- group: '5b_importexport',
579
- order: 20,
580
- command: {
581
- id: UPLOAD_COMMAND_ID,
582
- title: UPLOAD_LABEL,
583
- },
584
- when: ( (ContextKeyExpr.and(
585
- IsWebContext,
586
- ExplorerFolderContext,
587
- ExplorerResourceNotReadonlyContext)))
588
- }));
589
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
590
- group: '6_copypath',
591
- order: 10,
592
- command: copyPathCommand,
593
- when: ResourceContextKey.IsFileSystemResource
594
- });
595
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
596
- group: '6_copypath',
597
- order: 20,
598
- command: copyRelativePathCommand,
599
- when: ResourceContextKey.IsFileSystemResource
600
- });
601
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
602
- group: '2_workspace',
603
- order: 10,
604
- command: {
605
- id: ADD_ROOT_FOLDER_COMMAND_ID,
606
- title: ADD_ROOT_FOLDER_LABEL,
607
- precondition: ( (WorkbenchTreeFindOpen.toNegated()))
608
- },
609
- when: ( (ContextKeyExpr.and(ExplorerRootContext, (ContextKeyExpr.or(
610
- EnterMultiRootWorkspaceSupportContext,
611
- (WorkbenchStateContext.isEqualTo('workspace'))
612
- )))))
613
- });
614
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
615
- group: '2_workspace',
616
- order: 30,
617
- command: {
618
- id: REMOVE_ROOT_FOLDER_COMMAND_ID,
619
- title: REMOVE_ROOT_FOLDER_LABEL,
620
- precondition: ( (WorkbenchTreeFindOpen.toNegated()))
621
- },
622
- when: ( (ContextKeyExpr.and(
623
- ExplorerRootContext,
624
- ExplorerFolderContext,
625
- (ContextKeyExpr.and(
626
- (WorkspaceFolderCountContext.notEqualsTo('0')),
627
- (ContextKeyExpr.or(
628
- EnterMultiRootWorkspaceSupportContext,
629
- (WorkbenchStateContext.isEqualTo('workspace'))
630
- ))
631
- ))
632
- )))
633
- });
634
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
635
- group: '7_modification',
636
- order: 10,
637
- command: {
638
- id: RENAME_ID,
639
- title: TRIGGER_RENAME_LABEL,
640
- precondition: ( (ContextKeyExpr.and(
641
- ExplorerResourceNotReadonlyContext,
642
- (WorkbenchTreeFindOpen.toNegated())
643
- ))),
644
- },
645
- when: ( (ExplorerRootContext.toNegated()))
646
- });
647
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
648
- group: '7_modification',
649
- order: 20,
650
- command: {
651
- id: MOVE_FILE_TO_TRASH_ID,
652
- title: MOVE_FILE_TO_TRASH_LABEL,
653
- precondition: ( (ContextKeyExpr.and(
654
- ExplorerResourceNotReadonlyContext,
655
- (WorkbenchTreeFindOpen.toNegated())
656
- ))),
657
- },
658
- alt: {
659
- id: DELETE_FILE_ID,
660
- title: ( localize(2182, "Delete Permanently")),
661
- precondition: ( (ContextKeyExpr.and(
662
- ExplorerResourceNotReadonlyContext,
663
- (WorkbenchTreeFindOpen.toNegated())
664
- ))),
665
- },
666
- when: ( (ContextKeyExpr.and(
667
- (ExplorerRootContext.toNegated()),
668
- ExplorerResourceMoveableToTrash
669
- )))
670
- });
671
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
672
- group: '7_modification',
673
- order: 20,
674
- command: {
675
- id: DELETE_FILE_ID,
676
- title: ( localize(2182, "Delete Permanently")),
677
- precondition: ( (ContextKeyExpr.and(
678
- ExplorerResourceNotReadonlyContext,
679
- (WorkbenchTreeFindOpen.toNegated())
680
- ))),
681
- },
682
- when: ( (ContextKeyExpr.and(
683
- (ExplorerRootContext.toNegated()),
684
- (ExplorerResourceMoveableToTrash.toNegated())
685
- )))
686
- });
687
- for (const menuId of [MenuId.EmptyEditorGroupContext, MenuId.EditorTabsBarContext]) {
688
- MenuRegistry.appendMenuItem(menuId, { command: { id: NEW_UNTITLED_FILE_COMMAND_ID, title: ( localize(2183, "New Text File")) }, group: '1_file', order: 10 });
689
- MenuRegistry.appendMenuItem(menuId, { command: { id: 'workbench.action.quickOpen', title: ( localize(2184, "Open File...")) }, group: '1_file', order: 20 });
690
- }
691
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
692
- group: '1_new',
693
- command: {
694
- id: NEW_UNTITLED_FILE_COMMAND_ID,
695
- title: ( localize(2185, "&&New Text File"))
696
- },
697
- order: 1
698
- });
699
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
700
- group: '4_save',
701
- command: {
702
- id: SAVE_FILE_COMMAND_ID,
703
- title: ( localize(2186, "&&Save")),
704
- precondition: ( (ContextKeyExpr.or(
705
- ActiveEditorContext,
706
- (ContextKeyExpr.and(FoldersViewVisibleContext, SidebarFocusContext))
707
- )))
708
- },
709
- order: 1
710
- });
711
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
712
- group: '4_save',
713
- command: {
714
- id: SAVE_FILE_AS_COMMAND_ID,
715
- title: ( localize(2187, "Save &&As...")),
716
- precondition: ( (ContextKeyExpr.or(
717
- ActiveEditorContext,
718
- (ContextKeyExpr.and(FoldersViewVisibleContext, SidebarFocusContext))
719
- )))
720
- },
721
- order: 2
722
- });
723
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
724
- group: '4_save',
725
- command: {
726
- id: SAVE_ALL_COMMAND_ID,
727
- title: ( localize(2188, "Save A&&ll")),
728
- precondition: DirtyWorkingCopiesContext
729
- },
730
- order: 3
731
- });
732
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
733
- group: '5_autosave',
734
- command: {
735
- id: ToggleAutoSaveAction.ID,
736
- title: ( localize(2189, "A&&uto Save")),
737
- toggled: ( (ContextKeyExpr.notEquals('config.files.autoSave', 'off')))
738
- },
739
- order: 1
740
- });
741
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
742
- group: '6_close',
743
- command: {
744
- id: REVERT_FILE_COMMAND_ID,
745
- title: ( localize(2190, "Re&&vert File")),
746
- precondition: ( (ContextKeyExpr.or(
747
- (ContextKeyExpr.and(ActiveEditorCanRevertContext)),
748
- (ContextKeyExpr.and(
749
- (ResourceContextKey.Scheme.notEqualsTo(Schemas.untitled)),
750
- FoldersViewVisibleContext,
751
- SidebarFocusContext
752
- ))))),
753
- },
754
- order: 1
755
- });
756
- MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
757
- group: '6_close',
758
- command: {
759
- id: CLOSE_EDITOR_COMMAND_ID,
760
- title: ( localize(2191, "&&Close Editor")),
761
- precondition: ( (ContextKeyExpr.or(
762
- ActiveEditorContext,
763
- (ContextKeyExpr.and(FoldersViewVisibleContext, SidebarFocusContext))
764
- )))
765
- },
766
- order: 2
767
- });
768
- MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
769
- group: '3_global_nav',
770
- command: {
771
- id: 'workbench.action.quickOpen',
772
- title: ( localize(2192, "Go to &&File..."))
773
- },
774
- order: 1
775
- });
776
- MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
777
- group: 'navigation',
778
- order: 10,
779
- command: openToSideCommand,
780
- when: ( (ContextKeyExpr.and(
781
- ResourceContextKey.HasResource,
782
- (ExplorerFolderContext.toNegated())
783
- )))
784
- });
785
- MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
786
- group: 'navigation',
787
- order: 20,
788
- command: revealInsideBarCommand,
789
- when: ResourceContextKey.IsFileSystemResource
790
- });
791
- MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
792
- group: '1_cutcopypaste',
793
- order: 10,
794
- command: copyPathCommand,
795
- when: ResourceContextKey.IsFileSystemResource
796
- });
797
- MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
798
- group: '1_cutcopypaste',
799
- order: 20,
800
- command: copyRelativePathCommand,
801
- when: ResourceContextKey.IsFileSystemResource
802
- });
803
- MenuRegistry.appendMenuItem(MenuId.ChatInlineResourceAnchorContext, {
804
- group: 'navigation',
805
- order: 10,
806
- command: openToSideCommand,
807
- when: ( (ContextKeyExpr.and(
808
- ResourceContextKey.HasResource,
809
- (ExplorerFolderContext.toNegated())
810
- )))
811
- });
812
- MenuRegistry.appendMenuItem(MenuId.ChatInlineResourceAnchorContext, {
813
- group: 'navigation',
814
- order: 20,
815
- command: revealInsideBarCommand,
816
- when: ResourceContextKey.IsFileSystemResource
817
- });
818
- MenuRegistry.appendMenuItem(MenuId.ChatInlineResourceAnchorContext, {
819
- group: '1_cutcopypaste',
820
- order: 10,
821
- command: copyPathCommand,
822
- when: ResourceContextKey.IsFileSystemResource
823
- });
824
- MenuRegistry.appendMenuItem(MenuId.ChatInlineResourceAnchorContext, {
825
- group: '1_cutcopypaste',
826
- order: 20,
827
- command: copyRelativePathCommand,
828
- when: ResourceContextKey.IsFileSystemResource
829
- });
830
-
831
- export { appendEditorTitleContextMenuItem, appendToCommandPalette, revealInsideBarCommand };