@codingame/monaco-vscode-ac93482b-2178-52df-a200-ba0d1a4963fb-common 20.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.
Files changed (22) hide show
  1. package/empty.js +1 -0
  2. package/package.json +50 -0
  3. package/vscode/src/vs/workbench/browser/parts/editor/binaryEditor.d.ts +23 -0
  4. package/vscode/src/vs/workbench/browser/parts/editor/binaryEditor.js +58 -0
  5. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution._autosave.d.ts +1 -0
  6. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution._autosave.js +5 -0
  7. package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.d.ts +42 -0
  8. package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.js +222 -0
  9. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.d.ts +32 -0
  10. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +398 -0
  11. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.d.ts +8 -0
  12. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +700 -0
  13. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.d.ts +4 -0
  14. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +474 -0
  15. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._fileEditorFactory.d.ts +1 -0
  16. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._fileEditorFactory.js +15 -0
  17. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.d.ts +1 -0
  18. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +72 -0
  19. package/vscode/src/vs/workbench/services/textfile/common/textEditorService.d.ts +32 -0
  20. package/vscode/src/vs/workbench/services/textfile/common/textEditorService.js +194 -0
  21. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorInput.d.ts +45 -0
  22. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorInput.js +159 -0
@@ -0,0 +1,700 @@
1
+
2
+ import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
3
+ import { GlobalCompareResourcesAction, FocusFilesExplorer, ShowActiveFileInExplorer, CompareWithClipboardAction, CompareNewUntitledTextFilesAction, ToggleAutoSaveAction, OpenActiveFileInEmptyWorkspace, SetActiveEditorReadonlyInSession, SetActiveEditorWriteableInSession, ToggleActiveEditorReadonlyInSession, ResetActiveEditorReadonlyInSession, renameHandler, moveFileToTrashHandler, deleteFileHandler, cutFileHandler, copyFileHandler, pasteFileHandler, openFilePreserveFocusHandler, NEW_FILE_LABEL, NEW_FILE_COMMAND_ID, NEW_FOLDER_LABEL, NEW_FOLDER_COMMAND_ID, COPY_FILE_LABEL, FileCopiedContext, PASTE_FILE_LABEL, DOWNLOAD_LABEL, DOWNLOAD_COMMAND_ID, UPLOAD_LABEL, UPLOAD_COMMAND_ID, TRIGGER_RENAME_LABEL, MOVE_FILE_TO_TRASH_LABEL } from '@codingame/monaco-vscode-bd0792ac-6043-5ec3-a41a-54ccb922a1f4-common/vscode/vs/workbench/contrib/files/browser/fileActions';
4
+ import { acceptLocalChangesCommand, revertLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from './editors/textFileSaveErrorHandler.js';
5
+ import { registerAction2, MenuRegistry, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
6
+ import { KeyCode, KeyMod } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
7
+ import { openWindowCommand, newWindowCommand } from './fileCommands.js';
8
+ import { COPY_PATH_COMMAND_ID, COPY_RELATIVE_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID, SAVE_FILE_LABEL, SAVE_FILE_COMMAND_ID, SAVE_FILE_WITHOUT_FORMATTING_LABEL, SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID, SAVE_ALL_IN_GROUP_COMMAND_ID, SAVE_FILES_COMMAND_ID, REVERT_FILE_COMMAND_ID, COMPARE_WITH_SAVED_COMMAND_ID, SAVE_FILE_AS_LABEL, SAVE_FILE_AS_COMMAND_ID, NEW_UNTITLED_FILE_LABEL, NEW_UNTITLED_FILE_COMMAND_ID, OPEN_TO_SIDE_COMMAND_ID, OpenEditorsGroupContext, OpenEditorsReadonlyEditorContext, OpenEditorsDirtyEditorContext, COMPARE_RESOURCE_COMMAND_ID, ResourceSelectedForCompareContext, SELECT_FOR_COMPARE_COMMAND_ID, COMPARE_SELECTED_COMMAND_ID, OpenEditorsSelectedFileOrUntitledContext, OPEN_WITH_EXPLORER_COMMAND_ID, REMOVE_ROOT_FOLDER_LABEL, REMOVE_ROOT_FOLDER_COMMAND_ID, SAVE_ALL_COMMAND_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/files/browser/fileConstants';
9
+ import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
10
+ import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
11
+ import { KeybindingsRegistry, KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
12
+ import { FilesExplorerFocusCondition, ExplorerRootContext, ExplorerResourceWritableContext, ExplorerResourceMoveableToTrash, ExplorerResourceCut, ExplorerFolderContext, ExplorerResourceAvailableEditorIdsContext, FoldersViewVisibleContext } from '@codingame/monaco-vscode-f24e325c-2ce0-5bba-8236-bfc4f53180ab-common/vscode/vs/workbench/contrib/files/common/files';
13
+ import { ADD_ROOT_FOLDER_LABEL, ADD_ROOT_FOLDER_COMMAND_ID } from '@codingame/monaco-vscode-f24e325c-2ce0-5bba-8236-bfc4f53180ab-common/vscode/vs/workbench/browser/actions/workspaceCommands';
14
+ 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 '@codingame/monaco-vscode-dbfe5f85-b426-55ed-a79b-5f811b395762-common/vscode/vs/workbench/browser/parts/editor/editorCommands';
15
+ import { AutoSaveAfterShortDelayContext } from '@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
16
+ import { WorkbenchListDoubleSelection } from '@codingame/monaco-vscode-api/vscode/vs/platform/list/browser/listService';
17
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
18
+ import { ResourceContextKey, MultipleEditorsSelectedInGroupContext, WorkspaceFolderCountContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, TwoEditorsSelectedInGroupContext, SelectedEditorsInGroupFileOrUntitledResourceContextKey, IsSandboxWorkspaceContext, HasWebFileSystemAccess, EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext, ActiveEditorContext, SidebarFocusContext, ActiveEditorCanRevertContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
19
+ import { IsWebContext } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkeys';
20
+ import { IExplorerService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/files/browser/files.service';
21
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
22
+ import { Categories } from '@codingame/monaco-vscode-api/vscode/vs/platform/action/common/actionCommonCategories';
23
+
24
+ registerAction2(GlobalCompareResourcesAction);
25
+ registerAction2(FocusFilesExplorer);
26
+ registerAction2(ShowActiveFileInExplorer);
27
+ registerAction2(CompareWithClipboardAction);
28
+ registerAction2(CompareNewUntitledTextFilesAction);
29
+ registerAction2(ToggleAutoSaveAction);
30
+ registerAction2(OpenActiveFileInEmptyWorkspace);
31
+ registerAction2(SetActiveEditorReadonlyInSession);
32
+ registerAction2(SetActiveEditorWriteableInSession);
33
+ registerAction2(ToggleActiveEditorReadonlyInSession);
34
+ registerAction2(ResetActiveEditorReadonlyInSession);
35
+ CommandsRegistry.registerCommand('_files.windowOpen', openWindowCommand);
36
+ CommandsRegistry.registerCommand('_files.newWindow', newWindowCommand);
37
+ const explorerCommandsWeightBonus = 10;
38
+ const RENAME_ID = 'renameFile';
39
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
40
+ id: RENAME_ID,
41
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
42
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ( ExplorerRootContext.toNegated()), ExplorerResourceWritableContext)),
43
+ primary: KeyCode.F2,
44
+ mac: {
45
+ primary: KeyCode.Enter
46
+ },
47
+ handler: renameHandler
48
+ });
49
+ const MOVE_FILE_TO_TRASH_ID = 'moveFileToTrash';
50
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
51
+ id: MOVE_FILE_TO_TRASH_ID,
52
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
53
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceMoveableToTrash)),
54
+ primary: KeyCode.Delete,
55
+ mac: {
56
+ primary: KeyMod.CtrlCmd | KeyCode.Backspace,
57
+ secondary: [KeyCode.Delete]
58
+ },
59
+ handler: moveFileToTrashHandler
60
+ });
61
+ const DELETE_FILE_ID = 'deleteFile';
62
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
63
+ id: DELETE_FILE_ID,
64
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
65
+ when: FilesExplorerFocusCondition,
66
+ primary: KeyMod.Shift | KeyCode.Delete,
67
+ mac: {
68
+ primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Backspace
69
+ },
70
+ handler: deleteFileHandler
71
+ });
72
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
73
+ id: DELETE_FILE_ID,
74
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
75
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ( ExplorerResourceMoveableToTrash.toNegated()))),
76
+ primary: KeyCode.Delete,
77
+ mac: {
78
+ primary: KeyMod.CtrlCmd | KeyCode.Backspace
79
+ },
80
+ handler: deleteFileHandler
81
+ });
82
+ const CUT_FILE_ID = 'filesExplorer.cut';
83
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
84
+ id: CUT_FILE_ID,
85
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
86
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ( ExplorerRootContext.toNegated()), ExplorerResourceWritableContext)),
87
+ primary: KeyMod.CtrlCmd | KeyCode.KeyX,
88
+ handler: cutFileHandler,
89
+ });
90
+ const COPY_FILE_ID = 'filesExplorer.copy';
91
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
92
+ id: COPY_FILE_ID,
93
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
94
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ( ExplorerRootContext.toNegated()))),
95
+ primary: KeyMod.CtrlCmd | KeyCode.KeyC,
96
+ handler: copyFileHandler,
97
+ });
98
+ const PASTE_FILE_ID = 'filesExplorer.paste';
99
+ CommandsRegistry.registerCommand(PASTE_FILE_ID, pasteFileHandler);
100
+ KeybindingsRegistry.registerKeybindingRule({
101
+ id: `^${PASTE_FILE_ID}`,
102
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
103
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceWritableContext)),
104
+ primary: KeyMod.CtrlCmd | KeyCode.KeyV,
105
+ });
106
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
107
+ id: 'filesExplorer.cancelCut',
108
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
109
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceCut)),
110
+ primary: KeyCode.Escape,
111
+ handler: async (accessor) => {
112
+ const explorerService = accessor.get(IExplorerService);
113
+ await explorerService.setToCopy([], true);
114
+ }
115
+ });
116
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
117
+ id: 'filesExplorer.openFilePreserveFocus',
118
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
119
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ( ExplorerFolderContext.toNegated()))),
120
+ primary: KeyCode.Space,
121
+ handler: openFilePreserveFocusHandler
122
+ });
123
+ const copyPathCommand = {
124
+ id: COPY_PATH_COMMAND_ID,
125
+ title: ( localize(7276, "Copy Path"))
126
+ };
127
+ const copyRelativePathCommand = {
128
+ id: COPY_RELATIVE_PATH_COMMAND_ID,
129
+ title: ( localize(7277, "Copy Relative Path"))
130
+ };
131
+ const revealInSideBarCommand = {
132
+ id: REVEAL_IN_EXPLORER_COMMAND_ID,
133
+ title: ( localize(7278, "Reveal in Explorer View"))
134
+ };
135
+ appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste', true);
136
+ appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste', true);
137
+ appendEditorTitleContextMenuItem(revealInSideBarCommand.id, revealInSideBarCommand.title, ResourceContextKey.IsFileSystemResource, '2_files', false, 1);
138
+ function appendEditorTitleContextMenuItem(id, title, when, group, supportsMultiSelect, order) {
139
+ const precondition = supportsMultiSelect !== true ? ( MultipleEditorsSelectedInGroupContext.negate()) : undefined;
140
+ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
141
+ command: { id, title, precondition },
142
+ when,
143
+ group,
144
+ order,
145
+ });
146
+ }
147
+ appendSaveConflictEditorTitleAction('workbench.files.action.acceptLocalChanges', ( localize(7279, "Use your changes and overwrite file contents")), Codicon.check, -10, acceptLocalChangesCommand);
148
+ appendSaveConflictEditorTitleAction('workbench.files.action.revertLocalChanges', ( localize(7280, "Discard your changes and revert to file contents")), Codicon.discard, -9, revertLocalChangesCommand);
149
+ function appendSaveConflictEditorTitleAction(id, title, icon, order, command) {
150
+ CommandsRegistry.registerCommand(id, command);
151
+ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
152
+ command: { id, title, icon },
153
+ when: ( ContextKeyExpr.equals(CONFLICT_RESOLUTION_CONTEXT, true)),
154
+ group: 'navigation',
155
+ order
156
+ });
157
+ }
158
+ function appendToCommandPalette({ id, title, category, metadata }, when) {
159
+ MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
160
+ command: {
161
+ id,
162
+ title,
163
+ category,
164
+ metadata
165
+ },
166
+ when
167
+ });
168
+ }
169
+ appendToCommandPalette({
170
+ id: COPY_PATH_COMMAND_ID,
171
+ title: ( localize2(7281, "Copy Path of Active File")),
172
+ category: Categories.File
173
+ });
174
+ appendToCommandPalette({
175
+ id: COPY_RELATIVE_PATH_COMMAND_ID,
176
+ title: ( localize2(7282, "Copy Relative Path of Active File")),
177
+ category: Categories.File
178
+ });
179
+ appendToCommandPalette({
180
+ id: SAVE_FILE_COMMAND_ID,
181
+ title: SAVE_FILE_LABEL,
182
+ category: Categories.File
183
+ });
184
+ appendToCommandPalette({
185
+ id: SAVE_FILE_WITHOUT_FORMATTING_COMMAND_ID,
186
+ title: SAVE_FILE_WITHOUT_FORMATTING_LABEL,
187
+ category: Categories.File
188
+ });
189
+ appendToCommandPalette({
190
+ id: SAVE_ALL_IN_GROUP_COMMAND_ID,
191
+ title: ( localize2(7283, "Save All in Group")),
192
+ category: Categories.File
193
+ });
194
+ appendToCommandPalette({
195
+ id: SAVE_FILES_COMMAND_ID,
196
+ title: ( localize2(7284, "Save All Files")),
197
+ category: Categories.File
198
+ });
199
+ appendToCommandPalette({
200
+ id: REVERT_FILE_COMMAND_ID,
201
+ title: ( localize2(7285, "Revert File")),
202
+ category: Categories.File
203
+ });
204
+ appendToCommandPalette({
205
+ id: COMPARE_WITH_SAVED_COMMAND_ID,
206
+ title: ( localize2(7286, "Compare Active File with Saved")),
207
+ category: Categories.File,
208
+ metadata: {
209
+ description: ( localize2(
210
+ 7287,
211
+ "Opens a new diff editor to compare the active file with the version on disk."
212
+ ))
213
+ }
214
+ });
215
+ appendToCommandPalette({
216
+ id: SAVE_FILE_AS_COMMAND_ID,
217
+ title: SAVE_FILE_AS_LABEL,
218
+ category: Categories.File
219
+ });
220
+ appendToCommandPalette({
221
+ id: NEW_FILE_COMMAND_ID,
222
+ title: NEW_FILE_LABEL,
223
+ category: Categories.File
224
+ }, ( WorkspaceFolderCountContext.notEqualsTo('0')));
225
+ appendToCommandPalette({
226
+ id: NEW_FOLDER_COMMAND_ID,
227
+ title: NEW_FOLDER_LABEL,
228
+ category: Categories.File,
229
+ metadata: { description: ( localize2(7288, "Create a new folder or directory")) }
230
+ }, ( WorkspaceFolderCountContext.notEqualsTo('0')));
231
+ appendToCommandPalette({
232
+ id: NEW_UNTITLED_FILE_COMMAND_ID,
233
+ title: NEW_UNTITLED_FILE_LABEL,
234
+ category: Categories.File
235
+ });
236
+ const isFileOrUntitledResourceContextKey = ( ContextKeyExpr.or(ResourceContextKey.IsFileSystemResource, ( ResourceContextKey.Scheme.isEqualTo(Schemas.untitled))));
237
+ const openToSideCommand = {
238
+ id: OPEN_TO_SIDE_COMMAND_ID,
239
+ title: ( localize(7289, "Open to the Side"))
240
+ };
241
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
242
+ group: 'navigation',
243
+ order: 10,
244
+ command: openToSideCommand,
245
+ when: isFileOrUntitledResourceContextKey
246
+ });
247
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
248
+ group: '1_open',
249
+ order: 10,
250
+ command: {
251
+ id: REOPEN_WITH_COMMAND_ID,
252
+ title: ( localize(7290, "Reopen Editor With..."))
253
+ },
254
+ when: ( ContextKeyExpr.and(
255
+ ActiveEditorAvailableEditorIdsContext, (
256
+ OpenEditorsGroupContext.toNegated())))
257
+ });
258
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
259
+ group: '1_cutcopypaste',
260
+ order: 10,
261
+ command: copyPathCommand,
262
+ when: ResourceContextKey.IsFileSystemResource
263
+ });
264
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
265
+ group: '1_cutcopypaste',
266
+ order: 20,
267
+ command: copyRelativePathCommand,
268
+ when: ResourceContextKey.IsFileSystemResource
269
+ });
270
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
271
+ group: '2_save',
272
+ order: 10,
273
+ command: {
274
+ id: SAVE_FILE_COMMAND_ID,
275
+ title: SAVE_FILE_LABEL,
276
+ precondition: OpenEditorsDirtyEditorContext
277
+ },
278
+ when: ( ContextKeyExpr.or((
279
+ ResourceContextKey.Scheme.isEqualTo(Schemas.untitled)), (
280
+ ContextKeyExpr.and((
281
+ OpenEditorsGroupContext.toNegated()), (
282
+ OpenEditorsReadonlyEditorContext.toNegated()), (
283
+ AutoSaveAfterShortDelayContext.toNegated())))))
284
+ });
285
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
286
+ group: '2_save',
287
+ order: 20,
288
+ command: {
289
+ id: REVERT_FILE_COMMAND_ID,
290
+ title: ( localize(7285, "Revert File")),
291
+ precondition: OpenEditorsDirtyEditorContext
292
+ },
293
+ when: ( ContextKeyExpr.and((
294
+ OpenEditorsGroupContext.toNegated()), (
295
+ OpenEditorsReadonlyEditorContext.toNegated()), (
296
+ ResourceContextKey.Scheme.notEqualsTo(Schemas.untitled)), (
297
+ AutoSaveAfterShortDelayContext.toNegated())))
298
+ });
299
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
300
+ group: '2_save',
301
+ order: 30,
302
+ command: {
303
+ id: SAVE_ALL_IN_GROUP_COMMAND_ID,
304
+ title: ( localize(7291, "Save All")),
305
+ precondition: DirtyWorkingCopiesContext
306
+ },
307
+ when: OpenEditorsGroupContext
308
+ });
309
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
310
+ group: '3_compare',
311
+ order: 10,
312
+ command: {
313
+ id: COMPARE_WITH_SAVED_COMMAND_ID,
314
+ title: ( localize(7292, "Compare with Saved")),
315
+ precondition: OpenEditorsDirtyEditorContext
316
+ },
317
+ when: ( ContextKeyExpr.and(ResourceContextKey.IsFileSystemResource, ( AutoSaveAfterShortDelayContext.toNegated()), ( WorkbenchListDoubleSelection.toNegated())))
318
+ });
319
+ const compareResourceCommand = {
320
+ id: COMPARE_RESOURCE_COMMAND_ID,
321
+ title: ( localize(7293, "Compare with Selected"))
322
+ };
323
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
324
+ group: '3_compare',
325
+ order: 20,
326
+ command: compareResourceCommand,
327
+ when: ( ContextKeyExpr.and(
328
+ ResourceContextKey.HasResource,
329
+ ResourceSelectedForCompareContext,
330
+ isFileOrUntitledResourceContextKey,
331
+ ( WorkbenchListDoubleSelection.toNegated())
332
+ ))
333
+ });
334
+ const selectForCompareCommand = {
335
+ id: SELECT_FOR_COMPARE_COMMAND_ID,
336
+ title: ( localize(7294, "Select for Compare"))
337
+ };
338
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
339
+ group: '3_compare',
340
+ order: 30,
341
+ command: selectForCompareCommand,
342
+ when: ( ContextKeyExpr.and(
343
+ ResourceContextKey.HasResource,
344
+ isFileOrUntitledResourceContextKey,
345
+ ( WorkbenchListDoubleSelection.toNegated())
346
+ ))
347
+ });
348
+ const compareSelectedCommand = {
349
+ id: COMPARE_SELECTED_COMMAND_ID,
350
+ title: ( localize(7295, "Compare Selected"))
351
+ };
352
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
353
+ group: '3_compare',
354
+ order: 30,
355
+ command: compareSelectedCommand,
356
+ when: ( ContextKeyExpr.and(
357
+ ResourceContextKey.HasResource,
358
+ WorkbenchListDoubleSelection,
359
+ OpenEditorsSelectedFileOrUntitledContext
360
+ ))
361
+ });
362
+ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
363
+ group: '1_compare',
364
+ order: 30,
365
+ command: compareSelectedCommand,
366
+ when: ( ContextKeyExpr.and(
367
+ ResourceContextKey.HasResource,
368
+ TwoEditorsSelectedInGroupContext,
369
+ SelectedEditorsInGroupFileOrUntitledResourceContextKey
370
+ ))
371
+ });
372
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
373
+ group: '4_close',
374
+ order: 10,
375
+ command: {
376
+ id: CLOSE_EDITOR_COMMAND_ID,
377
+ title: ( localize(7296, "Close"))
378
+ },
379
+ when: ( OpenEditorsGroupContext.toNegated())
380
+ });
381
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
382
+ group: '4_close',
383
+ order: 20,
384
+ command: {
385
+ id: CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID,
386
+ title: ( localize(7297, "Close Others"))
387
+ },
388
+ when: ( OpenEditorsGroupContext.toNegated())
389
+ });
390
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
391
+ group: '4_close',
392
+ order: 30,
393
+ command: {
394
+ id: CLOSE_SAVED_EDITORS_COMMAND_ID,
395
+ title: ( localize(7298, "Close Saved"))
396
+ }
397
+ });
398
+ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
399
+ group: '4_close',
400
+ order: 40,
401
+ command: {
402
+ id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
403
+ title: ( localize(7299, "Close All"))
404
+ }
405
+ });
406
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
407
+ group: 'navigation',
408
+ order: 4,
409
+ command: {
410
+ id: NEW_FILE_COMMAND_ID,
411
+ title: NEW_FILE_LABEL,
412
+ precondition: ExplorerResourceWritableContext
413
+ },
414
+ when: ExplorerFolderContext
415
+ });
416
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
417
+ group: 'navigation',
418
+ order: 6,
419
+ command: {
420
+ id: NEW_FOLDER_COMMAND_ID,
421
+ title: NEW_FOLDER_LABEL,
422
+ precondition: ExplorerResourceWritableContext
423
+ },
424
+ when: ExplorerFolderContext
425
+ });
426
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
427
+ group: 'navigation',
428
+ order: 10,
429
+ command: openToSideCommand,
430
+ when: ( ContextKeyExpr.and(( ExplorerFolderContext.toNegated()), ResourceContextKey.HasResource))
431
+ });
432
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
433
+ group: 'navigation',
434
+ order: 20,
435
+ command: {
436
+ id: OPEN_WITH_EXPLORER_COMMAND_ID,
437
+ title: ( localize(7300, "Open With...")),
438
+ },
439
+ when: ( ContextKeyExpr.and(( ExplorerFolderContext.toNegated()), ExplorerResourceAvailableEditorIdsContext)),
440
+ });
441
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
442
+ group: '3_compare',
443
+ order: 20,
444
+ command: compareResourceCommand,
445
+ when: ( ContextKeyExpr.and(( ExplorerFolderContext.toNegated()), ResourceContextKey.HasResource, ResourceSelectedForCompareContext, ( WorkbenchListDoubleSelection.toNegated())))
446
+ });
447
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
448
+ group: '3_compare',
449
+ order: 30,
450
+ command: selectForCompareCommand,
451
+ when: ( ContextKeyExpr.and(( ExplorerFolderContext.toNegated()), ResourceContextKey.HasResource, ( WorkbenchListDoubleSelection.toNegated())))
452
+ });
453
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
454
+ group: '3_compare',
455
+ order: 30,
456
+ command: compareSelectedCommand,
457
+ when: ( ContextKeyExpr.and(( ExplorerFolderContext.toNegated()), ResourceContextKey.HasResource, WorkbenchListDoubleSelection))
458
+ });
459
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
460
+ group: '5_cutcopypaste',
461
+ order: 8,
462
+ command: {
463
+ id: CUT_FILE_ID,
464
+ title: ( localize(7301, "Cut")),
465
+ },
466
+ when: ( ContextKeyExpr.and(( ExplorerRootContext.toNegated()), ExplorerResourceWritableContext))
467
+ });
468
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
469
+ group: '5_cutcopypaste',
470
+ order: 10,
471
+ command: {
472
+ id: COPY_FILE_ID,
473
+ title: COPY_FILE_LABEL,
474
+ },
475
+ when: ( ExplorerRootContext.toNegated())
476
+ });
477
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
478
+ group: '5_cutcopypaste',
479
+ order: 20,
480
+ command: {
481
+ id: PASTE_FILE_ID,
482
+ title: PASTE_FILE_LABEL,
483
+ precondition: ( ContextKeyExpr.and(ExplorerResourceWritableContext, FileCopiedContext))
484
+ },
485
+ when: ExplorerFolderContext
486
+ });
487
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({
488
+ group: '5b_importexport',
489
+ order: 10,
490
+ command: {
491
+ id: DOWNLOAD_COMMAND_ID,
492
+ title: DOWNLOAD_LABEL
493
+ },
494
+ when: ( ContextKeyExpr.and(( IsSandboxWorkspaceContext.toNegated()), ( ContextKeyExpr.or((
495
+ ContextKeyExpr.and(( IsWebContext.toNegated()), ( ResourceContextKey.Scheme.notEqualsTo(Schemas.file)))), (
496
+ ContextKeyExpr.and(IsWebContext, ( ExplorerFolderContext.toNegated()), ( ExplorerRootContext.toNegated()))), (
497
+ ContextKeyExpr.and(IsWebContext, HasWebFileSystemAccess))))))
498
+ }));
499
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({
500
+ group: '5b_importexport',
501
+ order: 20,
502
+ command: {
503
+ id: UPLOAD_COMMAND_ID,
504
+ title: UPLOAD_LABEL,
505
+ },
506
+ when: ( ContextKeyExpr.and(
507
+ IsWebContext,
508
+ ExplorerFolderContext,
509
+ ExplorerResourceWritableContext))
510
+ }));
511
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
512
+ group: '6_copypath',
513
+ order: 10,
514
+ command: copyPathCommand,
515
+ when: ResourceContextKey.IsFileSystemResource
516
+ });
517
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
518
+ group: '6_copypath',
519
+ order: 20,
520
+ command: copyRelativePathCommand,
521
+ when: ResourceContextKey.IsFileSystemResource
522
+ });
523
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
524
+ group: '2_workspace',
525
+ order: 10,
526
+ command: {
527
+ id: ADD_ROOT_FOLDER_COMMAND_ID,
528
+ title: ADD_ROOT_FOLDER_LABEL,
529
+ },
530
+ when: ( ContextKeyExpr.and(ExplorerRootContext, ( ContextKeyExpr.or(EnterMultiRootWorkspaceSupportContext, ( WorkbenchStateContext.isEqualTo('workspace'))))))
531
+ });
532
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
533
+ group: '2_workspace',
534
+ order: 30,
535
+ command: {
536
+ id: REMOVE_ROOT_FOLDER_COMMAND_ID,
537
+ title: REMOVE_ROOT_FOLDER_LABEL,
538
+ },
539
+ when: ( ContextKeyExpr.and(ExplorerRootContext, ExplorerFolderContext, ( ContextKeyExpr.and(( WorkspaceFolderCountContext.notEqualsTo('0')), ( ContextKeyExpr.or(EnterMultiRootWorkspaceSupportContext, ( WorkbenchStateContext.isEqualTo('workspace'))))))))
540
+ });
541
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
542
+ group: '7_modification',
543
+ order: 10,
544
+ command: {
545
+ id: RENAME_ID,
546
+ title: TRIGGER_RENAME_LABEL,
547
+ precondition: ExplorerResourceWritableContext,
548
+ },
549
+ when: ( ExplorerRootContext.toNegated())
550
+ });
551
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
552
+ group: '7_modification',
553
+ order: 20,
554
+ command: {
555
+ id: MOVE_FILE_TO_TRASH_ID,
556
+ title: MOVE_FILE_TO_TRASH_LABEL
557
+ },
558
+ alt: {
559
+ id: DELETE_FILE_ID,
560
+ title: ( localize(7302, "Delete Permanently"))
561
+ },
562
+ when: ( ContextKeyExpr.and(( ExplorerRootContext.toNegated()), ExplorerResourceMoveableToTrash))
563
+ });
564
+ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
565
+ group: '7_modification',
566
+ order: 20,
567
+ command: {
568
+ id: DELETE_FILE_ID,
569
+ title: ( localize(7302, "Delete Permanently"))
570
+ },
571
+ when: ( ContextKeyExpr.and(( ExplorerRootContext.toNegated()), ( ExplorerResourceMoveableToTrash.toNegated())))
572
+ });
573
+ for (const menuId of [MenuId.EmptyEditorGroupContext, MenuId.EditorTabsBarContext]) {
574
+ MenuRegistry.appendMenuItem(menuId, { command: { id: NEW_UNTITLED_FILE_COMMAND_ID, title: ( localize(7303, "New Text File")) }, group: '1_file', order: 10 });
575
+ MenuRegistry.appendMenuItem(menuId, { command: { id: 'workbench.action.quickOpen', title: ( localize(7304, "Open File...")) }, group: '1_file', order: 20 });
576
+ }
577
+ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
578
+ group: '1_new',
579
+ command: {
580
+ id: NEW_UNTITLED_FILE_COMMAND_ID,
581
+ title: ( localize(7305, "&&New Text File"))
582
+ },
583
+ order: 1
584
+ });
585
+ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
586
+ group: '4_save',
587
+ command: {
588
+ id: SAVE_FILE_COMMAND_ID,
589
+ title: ( localize(7306, "&&Save")),
590
+ precondition: ( ContextKeyExpr.or(ActiveEditorContext, ( ContextKeyExpr.and(FoldersViewVisibleContext, SidebarFocusContext))))
591
+ },
592
+ order: 1
593
+ });
594
+ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
595
+ group: '4_save',
596
+ command: {
597
+ id: SAVE_FILE_AS_COMMAND_ID,
598
+ title: ( localize(7307, "Save &&As...")),
599
+ precondition: ( ContextKeyExpr.or(ActiveEditorContext, ( ContextKeyExpr.and(FoldersViewVisibleContext, SidebarFocusContext))))
600
+ },
601
+ order: 2
602
+ });
603
+ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
604
+ group: '4_save',
605
+ command: {
606
+ id: SAVE_ALL_COMMAND_ID,
607
+ title: ( localize(7308, "Save A&&ll")),
608
+ precondition: DirtyWorkingCopiesContext
609
+ },
610
+ order: 3
611
+ });
612
+ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
613
+ group: '5_autosave',
614
+ command: {
615
+ id: ToggleAutoSaveAction.ID,
616
+ title: ( localize(7309, "A&&uto Save")),
617
+ toggled: ( ContextKeyExpr.notEquals('config.files.autoSave', 'off'))
618
+ },
619
+ order: 1
620
+ });
621
+ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
622
+ group: '6_close',
623
+ command: {
624
+ id: REVERT_FILE_COMMAND_ID,
625
+ title: ( localize(7310, "Re&&vert File")),
626
+ precondition: ( ContextKeyExpr.or((
627
+ ContextKeyExpr.and(ActiveEditorCanRevertContext)), (
628
+ ContextKeyExpr.and(( ResourceContextKey.Scheme.notEqualsTo(Schemas.untitled)), FoldersViewVisibleContext, SidebarFocusContext)))),
629
+ },
630
+ order: 1
631
+ });
632
+ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
633
+ group: '6_close',
634
+ command: {
635
+ id: CLOSE_EDITOR_COMMAND_ID,
636
+ title: ( localize(7311, "&&Close Editor")),
637
+ precondition: ( ContextKeyExpr.or(ActiveEditorContext, ( ContextKeyExpr.and(FoldersViewVisibleContext, SidebarFocusContext))))
638
+ },
639
+ order: 2
640
+ });
641
+ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
642
+ group: '3_global_nav',
643
+ command: {
644
+ id: 'workbench.action.quickOpen',
645
+ title: ( localize(7312, "Go to &&File..."))
646
+ },
647
+ order: 1
648
+ });
649
+ MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
650
+ group: 'navigation',
651
+ order: 10,
652
+ command: openToSideCommand,
653
+ when: ( ContextKeyExpr.and(ResourceContextKey.IsFileSystemResource, ( ExplorerFolderContext.toNegated())))
654
+ });
655
+ MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
656
+ group: 'navigation',
657
+ order: 20,
658
+ command: revealInSideBarCommand,
659
+ when: ResourceContextKey.IsFileSystemResource
660
+ });
661
+ MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
662
+ group: '1_cutcopypaste',
663
+ order: 10,
664
+ command: copyPathCommand,
665
+ when: ResourceContextKey.IsFileSystemResource
666
+ });
667
+ MenuRegistry.appendMenuItem(MenuId.ChatAttachmentsContext, {
668
+ group: '1_cutcopypaste',
669
+ order: 20,
670
+ command: copyRelativePathCommand,
671
+ when: ResourceContextKey.IsFileSystemResource
672
+ });
673
+ for (const menuId of [MenuId.ChatInlineResourceAnchorContext, MenuId.ChatInputResourceAttachmentContext]) {
674
+ MenuRegistry.appendMenuItem(menuId, {
675
+ group: 'navigation',
676
+ order: 10,
677
+ command: openToSideCommand,
678
+ when: ( ContextKeyExpr.and(ResourceContextKey.HasResource, ( ExplorerFolderContext.toNegated())))
679
+ });
680
+ MenuRegistry.appendMenuItem(menuId, {
681
+ group: 'navigation',
682
+ order: 20,
683
+ command: revealInSideBarCommand,
684
+ when: ResourceContextKey.IsFileSystemResource
685
+ });
686
+ MenuRegistry.appendMenuItem(menuId, {
687
+ group: '1_cutcopypaste',
688
+ order: 10,
689
+ command: copyPathCommand,
690
+ when: ResourceContextKey.IsFileSystemResource
691
+ });
692
+ MenuRegistry.appendMenuItem(menuId, {
693
+ group: '1_cutcopypaste',
694
+ order: 20,
695
+ command: copyRelativePathCommand,
696
+ when: ResourceContextKey.IsFileSystemResource
697
+ });
698
+ }
699
+
700
+ export { appendEditorTitleContextMenuItem, appendToCommandPalette, revealInSideBarCommand };