@codingame/monaco-vscode-explorer-service-override 5.3.0 → 6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-explorer-service-override",
3
- "version": "5.3.0",
3
+ "version": "6.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@5.3.0"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@6.0.0"
30
30
  }
31
31
  }
@@ -2,7 +2,9 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { Event } from 'vscode/vscode/vs/base/common/event';
3
3
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
4
4
  import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
5
+ import { SortOrder, LexicographicOptions } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
5
6
  import { ExplorerModel, ExplorerItem } from 'vscode/vscode/vs/workbench/contrib/files/common/explorerModel';
7
+ import { FileChangeType, FileOperation } from 'vscode/vscode/vs/platform/files/common/files';
6
8
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
7
9
  import { dirname, basename } from 'vscode/vscode/vs/base/common/resources';
8
10
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
@@ -11,6 +13,7 @@ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/commo
11
13
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
12
14
  import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
13
15
  import { UndoRedoSource } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
16
+ import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
14
17
  import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
15
18
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
16
19
  import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
@@ -50,9 +53,9 @@ let ExplorerService = class ExplorerService {
50
53
  this.onFileChangesScheduler = ( new RunOnceScheduler(async () => {
51
54
  const events = this.fileChangeEvents;
52
55
  this.fileChangeEvents = [];
53
- const types = [2 ];
54
- if (this.config.sortOrder === "modified" ) {
55
- types.push(0 );
56
+ const types = [FileChangeType.DELETED];
57
+ if (this.config.sortOrder === SortOrder.Modified) {
58
+ types.push(FileChangeType.UPDATED);
56
59
  }
57
60
  let shouldRefresh = false;
58
61
  this.roots.forEach(r => {
@@ -148,12 +151,24 @@ let ExplorerService = class ExplorerService {
148
151
  }
149
152
  async applyBulkEdit(edit, options) {
150
153
  const cancellationTokenSource = ( new CancellationTokenSource());
151
- const promise = this.progressService.withProgress({
152
- location: options.progressLocation || 10 ,
153
- title: options.progressLabel,
154
- cancellable: edit.length > 1,
155
- delay: 500,
156
- }, async (progress) => {
154
+ const location = options.progressLocation ?? ProgressLocation.Window;
155
+ let progressOptions;
156
+ if (location === ProgressLocation.Window) {
157
+ progressOptions = {
158
+ location: location,
159
+ title: options.progressLabel,
160
+ cancellable: edit.length > 1,
161
+ };
162
+ }
163
+ else {
164
+ progressOptions = {
165
+ location: location,
166
+ title: options.progressLabel,
167
+ cancellable: edit.length > 1,
168
+ delay: 500,
169
+ };
170
+ }
171
+ const promise = this.progressService.withProgress(progressOptions, async (progress) => {
157
172
  await this.bulkEditService.apply(edit, {
158
173
  undoRedoSource: UNDO_REDO_SOURCE,
159
174
  label: options.undoLabel,
@@ -163,7 +178,7 @@ let ExplorerService = class ExplorerService {
163
178
  confirmBeforeUndo: options.confirmBeforeUndo
164
179
  });
165
180
  }, () => cancellationTokenSource.cancel());
166
- await this.progressService.withProgress({ location: 1 , delay: 500 }, () => promise);
181
+ await this.progressService.withProgress({ location: ProgressLocation.Explorer, delay: 500 }, () => promise);
167
182
  cancellationTokenSource.dispose();
168
183
  }
169
184
  hasViewFocus() {
@@ -243,7 +258,7 @@ let ExplorerService = class ExplorerService {
243
258
  await this.view.selectResource(fileStat.resource, reveal);
244
259
  return Promise.resolve(undefined);
245
260
  }
246
- const options = { resolveTo: [resource], resolveMetadata: this.config.sortOrder === "modified" };
261
+ const options = { resolveTo: [resource], resolveMetadata: this.config.sortOrder === SortOrder.Modified };
247
262
  const root = this.findClosestRoot(resource);
248
263
  if (!root) {
249
264
  return undefined;
@@ -277,7 +292,7 @@ let ExplorerService = class ExplorerService {
277
292
  }
278
293
  async onDidRunOperation(e) {
279
294
  const shouldDeepRefresh = this.config.fileNesting.enabled;
280
- if (e.isOperation(0 ) || e.isOperation(3 )) {
295
+ if (e.isOperation(FileOperation.CREATE) || e.isOperation(FileOperation.COPY)) {
281
296
  const addedElement = e.target;
282
297
  const parentResource = dirname(addedElement.resource);
283
298
  const parents = this.model.findAll(parentResource);
@@ -298,7 +313,7 @@ let ExplorerService = class ExplorerService {
298
313
  })));
299
314
  }
300
315
  }
301
- else if (e.isOperation(2 )) {
316
+ else if (e.isOperation(FileOperation.MOVE)) {
302
317
  const oldResource = e.resource;
303
318
  const newElement = e.target;
304
319
  const oldParentResource = dirname(oldResource);
@@ -327,7 +342,7 @@ let ExplorerService = class ExplorerService {
327
342
  }
328
343
  }
329
344
  }
330
- else if (e.isOperation(1 )) {
345
+ else if (e.isOperation(FileOperation.DELETE)) {
331
346
  const modelElements = this.model.findAll(e.resource);
332
347
  await Promise.all(( modelElements.map(async (modelElement) => {
333
348
  if (modelElement.parent) {
@@ -376,11 +391,11 @@ let ExplorerService = class ExplorerService {
376
391
  shouldRefresh = true;
377
392
  }
378
393
  const configuration = this.configurationService.getValue();
379
- const configSortOrder = configuration?.explorer?.sortOrder || "default" ;
394
+ const configSortOrder = configuration?.explorer?.sortOrder || SortOrder.Default;
380
395
  if (this.config.sortOrder !== configSortOrder) {
381
396
  shouldRefresh = this.config.sortOrder !== undefined;
382
397
  }
383
- const configLexicographicOptions = configuration?.explorer?.sortOrderLexicographicOptions || "default" ;
398
+ const configLexicographicOptions = configuration?.explorer?.sortOrderLexicographicOptions || LexicographicOptions.Default;
384
399
  if (this.config.sortOrderLexicographicOptions !== configLexicographicOptions) {
385
400
  shouldRefresh = shouldRefresh || this.config.sortOrderLexicographicOptions !== undefined;
386
401
  }
@@ -2,18 +2,19 @@ import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
2
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
3
  import { acceptLocalChangesCommand, revertLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler';
4
4
  import { registerAction2, MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
5
+ import { KeyCode, KeyMod } from 'vscode/vscode/vs/base/common/keyCodes';
5
6
  import { openWindowCommand, newWindowCommand } from './fileCommands.js';
6
7
  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, OpenEditorsDirtyEditorContext, OpenEditorsGroupContext, OpenEditorsReadonlyEditorContext, COMPARE_RESOURCE_COMMAND_ID, ResourceSelectedForCompareContext, SELECT_FOR_COMPARE_COMMAND_ID, COMPARE_SELECTED_COMMAND_ID, 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
8
  import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
8
9
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
9
- import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
10
+ import { KeybindingsRegistry, KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
10
11
  import { FilesExplorerFocusCondition, ExplorerRootContext, ExplorerResourceNotReadonlyContext, ExplorerResourceMoveableToTrash, ExplorerResourceCut, ExplorerFolderContext, ExplorerResourceAvailableEditorIdsContext, FoldersViewVisibleContext } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
11
12
  import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL } from 'vscode/vscode/vs/workbench/browser/actions/workspaceCommands';
12
13
  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
14
  import { AutoSaveAfterShortDelayContext } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
14
15
  import { WorkbenchListDoubleSelection } from 'vscode/vscode/vs/platform/list/browser/listService';
15
16
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
16
- import { ResourceContextKey, WorkspaceFolderCountContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, HasWebFileSystemAccess, EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext, ActiveEditorContext, SidebarFocusContext, ActiveEditorCanRevertContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
17
+ import { ResourceContextKey, MultipleEditorsSelectedInGroupContext, WorkspaceFolderCountContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, TwoEditorsSelectedInGroupContext, HasWebFileSystemAccess, EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext, ActiveEditorContext, SidebarFocusContext, ActiveEditorCanRevertContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
17
18
  import { IsWebContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
18
19
  import { IExplorerService } from 'vscode/vscode/vs/workbench/contrib/files/browser/files.service';
19
20
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
@@ -37,95 +38,95 @@ const explorerCommandsWeightBonus = 10;
37
38
  const RENAME_ID = 'renameFile';
38
39
  KeybindingsRegistry.registerCommandAndKeybindingRule({
39
40
  id: RENAME_ID,
40
- weight: 200 + explorerCommandsWeightBonus,
41
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
41
42
  when: ( (ContextKeyExpr.and(
42
43
  FilesExplorerFocusCondition,
43
44
  (ExplorerRootContext.toNegated()),
44
45
  ExplorerResourceNotReadonlyContext
45
46
  ))),
46
- primary: 60 ,
47
+ primary: KeyCode.F2,
47
48
  mac: {
48
- primary: 3
49
+ primary: KeyCode.Enter
49
50
  },
50
51
  handler: renameHandler
51
52
  });
52
53
  const MOVE_FILE_TO_TRASH_ID = 'moveFileToTrash';
53
54
  KeybindingsRegistry.registerCommandAndKeybindingRule({
54
55
  id: MOVE_FILE_TO_TRASH_ID,
55
- weight: 200 + explorerCommandsWeightBonus,
56
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
56
57
  when: ( (ContextKeyExpr.and(
57
58
  FilesExplorerFocusCondition,
58
59
  ExplorerResourceNotReadonlyContext,
59
60
  ExplorerResourceMoveableToTrash
60
61
  ))),
61
- primary: 20 ,
62
+ primary: KeyCode.Delete,
62
63
  mac: {
63
- primary: 2048 | 1 ,
64
- secondary: [20 ]
64
+ primary: KeyMod.CtrlCmd | KeyCode.Backspace,
65
+ secondary: [KeyCode.Delete]
65
66
  },
66
67
  handler: moveFileToTrashHandler
67
68
  });
68
69
  const DELETE_FILE_ID = 'deleteFile';
69
70
  KeybindingsRegistry.registerCommandAndKeybindingRule({
70
71
  id: DELETE_FILE_ID,
71
- weight: 200 + explorerCommandsWeightBonus,
72
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
72
73
  when: ( (ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext))),
73
- primary: 1024 | 20 ,
74
+ primary: KeyMod.Shift | KeyCode.Delete,
74
75
  mac: {
75
- primary: 2048 | 512 | 1
76
+ primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Backspace
76
77
  },
77
78
  handler: deleteFileHandler
78
79
  });
79
80
  KeybindingsRegistry.registerCommandAndKeybindingRule({
80
81
  id: DELETE_FILE_ID,
81
- weight: 200 + explorerCommandsWeightBonus,
82
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
82
83
  when: ( (ContextKeyExpr.and(
83
84
  FilesExplorerFocusCondition,
84
85
  ExplorerResourceNotReadonlyContext,
85
86
  (ExplorerResourceMoveableToTrash.toNegated())
86
87
  ))),
87
- primary: 20 ,
88
+ primary: KeyCode.Delete,
88
89
  mac: {
89
- primary: 2048 | 1
90
+ primary: KeyMod.CtrlCmd | KeyCode.Backspace
90
91
  },
91
92
  handler: deleteFileHandler
92
93
  });
93
94
  const CUT_FILE_ID = 'filesExplorer.cut';
94
95
  KeybindingsRegistry.registerCommandAndKeybindingRule({
95
96
  id: CUT_FILE_ID,
96
- weight: 200 + explorerCommandsWeightBonus,
97
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
97
98
  when: ( (ContextKeyExpr.and(
98
99
  FilesExplorerFocusCondition,
99
100
  (ExplorerRootContext.toNegated()),
100
101
  ExplorerResourceNotReadonlyContext
101
102
  ))),
102
- primary: 2048 | 54 ,
103
+ primary: KeyMod.CtrlCmd | KeyCode.KeyX,
103
104
  handler: cutFileHandler,
104
105
  });
105
106
  const COPY_FILE_ID = 'filesExplorer.copy';
106
107
  KeybindingsRegistry.registerCommandAndKeybindingRule({
107
108
  id: COPY_FILE_ID,
108
- weight: 200 + explorerCommandsWeightBonus,
109
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
109
110
  when: ( (ContextKeyExpr.and(
110
111
  FilesExplorerFocusCondition,
111
112
  (ExplorerRootContext.toNegated())
112
113
  ))),
113
- primary: 2048 | 33 ,
114
+ primary: KeyMod.CtrlCmd | KeyCode.KeyC,
114
115
  handler: copyFileHandler,
115
116
  });
116
117
  const PASTE_FILE_ID = 'filesExplorer.paste';
117
118
  CommandsRegistry.registerCommand(PASTE_FILE_ID, pasteFileHandler);
118
119
  KeybindingsRegistry.registerKeybindingRule({
119
120
  id: `^${PASTE_FILE_ID}`,
120
- weight: 200 + explorerCommandsWeightBonus,
121
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
121
122
  when: ( (ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceNotReadonlyContext))),
122
- primary: 2048 | 52 ,
123
+ primary: KeyMod.CtrlCmd | KeyCode.KeyV,
123
124
  });
124
125
  KeybindingsRegistry.registerCommandAndKeybindingRule({
125
126
  id: 'filesExplorer.cancelCut',
126
- weight: 200 + explorerCommandsWeightBonus,
127
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
127
128
  when: ( (ContextKeyExpr.and(FilesExplorerFocusCondition, ExplorerResourceCut))),
128
- primary: 9 ,
129
+ primary: KeyCode.Escape,
129
130
  handler: async (accessor) => {
130
131
  const explorerService = accessor.get(IExplorerService);
131
132
  await explorerService.setToCopy([], true);
@@ -133,12 +134,12 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
133
134
  });
134
135
  KeybindingsRegistry.registerCommandAndKeybindingRule({
135
136
  id: 'filesExplorer.openFilePreserveFocus',
136
- weight: 200 + explorerCommandsWeightBonus,
137
+ weight: KeybindingWeight.WorkbenchContrib + explorerCommandsWeightBonus,
137
138
  when: ( (ContextKeyExpr.and(
138
139
  FilesExplorerFocusCondition,
139
140
  (ExplorerFolderContext.toNegated())
140
141
  ))),
141
- primary: 10 ,
142
+ primary: KeyCode.Space,
142
143
  handler: openFilePreserveFocusHandler
143
144
  });
144
145
  const copyPathCommand = {
@@ -149,15 +150,16 @@ const copyRelativePathCommand = {
149
150
  id: COPY_RELATIVE_PATH_COMMAND_ID,
150
151
  title: ( localizeWithPath(_moduleId, 1, "Copy Relative Path"))
151
152
  };
152
- appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste');
153
- appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste');
154
- appendEditorTitleContextMenuItem(REVEAL_IN_EXPLORER_COMMAND_ID, ( localizeWithPath(_moduleId, 2, "Reveal in Explorer View")), ResourceContextKey.IsFileSystemResource, '2_files', 1);
155
- function appendEditorTitleContextMenuItem(id, title, when, group, order) {
153
+ appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste', true);
154
+ appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste', true);
155
+ appendEditorTitleContextMenuItem(REVEAL_IN_EXPLORER_COMMAND_ID, ( localizeWithPath(_moduleId, 2, "Reveal in Explorer View")), ResourceContextKey.IsFileSystemResource, '2_files', false, 1);
156
+ function appendEditorTitleContextMenuItem(id, title, when, group, supportsMultiSelect, order) {
157
+ const precondition = supportsMultiSelect !== true ? ( (MultipleEditorsSelectedInGroupContext.negate())) : undefined;
156
158
  MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
157
- command: { id, title },
159
+ command: { id, title, precondition },
158
160
  when,
159
161
  group,
160
- order
162
+ order,
161
163
  });
162
164
  }
163
165
  appendSaveConflictEditorTitleAction('workbench.files.action.acceptLocalChanges', ( localizeWithPath(_moduleId, 3, "Use your changes and overwrite file contents")), Codicon.check, -10, acceptLocalChangesCommand);
@@ -381,6 +383,16 @@ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
381
383
  isFileOrUntitledResourceContextKey
382
384
  )))
383
385
  });
386
+ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
387
+ group: '3_compare',
388
+ order: 30,
389
+ command: compareSelectedCommand,
390
+ when: ( (ContextKeyExpr.and(
391
+ ResourceContextKey.HasResource,
392
+ TwoEditorsSelectedInGroupContext,
393
+ isFileOrUntitledResourceContextKey
394
+ )))
395
+ });
384
396
  MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
385
397
  group: '4_close',
386
398
  order: 10,
@@ -1,5 +1,5 @@
1
1
  import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
2
- import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
2
+ import { KeyMod, KeyCode, KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
3
3
  import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
4
4
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
5
5
  import { isWindows, isWeb } from 'vscode/vscode/vs/base/common/platform';
@@ -18,7 +18,7 @@ import { EditorResolution, EditorOpenSource } from 'vscode/vscode/vs/platform/ed
18
18
  import { IEnvironmentService } from 'vscode/vscode/vs/platform/environment/common/environment.service';
19
19
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
20
20
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
21
- import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
21
+ import { KeybindingsRegistry, KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
22
22
  import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
23
23
  import { IListService } from 'vscode/vscode/vs/platform/list/browser/listService.service';
24
24
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
@@ -27,7 +27,8 @@ import { isWorkspaceToOpen } from 'vscode/vscode/vs/platform/window/common/windo
27
27
  import { UNTITLED_WORKSPACE_NAME } from 'vscode/vscode/vs/platform/workspace/common/workspace';
28
28
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
29
29
  import { RemoveRootFolderAction } from 'vscode/vscode/vs/workbench/browser/actions/workspaceActions';
30
- import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
30
+ import { EditorResourceAccessor, SideBySideEditor, EditorInputCapabilities } from 'vscode/vscode/vs/workbench/common/editor';
31
+ import { ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
31
32
  import { getMultiSelectedResources, getResourceForCommand, getOpenEditorsViewMultiSelection } from 'vscode/vscode/vs/workbench/contrib/files/browser/files';
32
33
  import { IExplorerService } from 'vscode/vscode/vs/workbench/contrib/files/browser/files.service';
33
34
  import { OpenEditorsView } from 'vscode/vscode/vs/workbench/contrib/files/browser/views/openEditorsView';
@@ -63,18 +64,19 @@ const newWindowCommand = (accessor, options) => {
63
64
  hostService.openWindow(options);
64
65
  };
65
66
  KeybindingsRegistry.registerCommandAndKeybindingRule({
66
- weight: 200 ,
67
+ weight: KeybindingWeight.WorkbenchContrib,
67
68
  when: ExplorerFocusCondition,
68
- primary: 2048 | 3 ,
69
+ primary: KeyMod.CtrlCmd | KeyCode.Enter,
69
70
  mac: {
70
- primary: 256 | 3
71
+ primary: KeyMod.WinCtrl | KeyCode.Enter
71
72
  },
72
73
  id: OPEN_TO_SIDE_COMMAND_ID, handler: async (accessor, resource) => {
73
74
  const editorService = accessor.get(IEditorService);
75
+ const editorGroupService = accessor.get(IEditorGroupsService);
74
76
  const listService = accessor.get(IListService);
75
77
  const fileService = accessor.get(IFileService);
76
78
  const explorerService = accessor.get(IExplorerService);
77
- const resources = getMultiSelectedResources(resource, listService, editorService, explorerService);
79
+ const resources = getMultiSelectedResources(resource, listService, editorService, editorGroupService, explorerService);
78
80
  if (resources.length) {
79
81
  const untitledResources = resources.filter(resource => resource.scheme === Schemas.untitled);
80
82
  const fileResources = resources.filter(resource => resource.scheme !== Schemas.untitled);
@@ -97,14 +99,14 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
97
99
  }
98
100
  });
99
101
  KeybindingsRegistry.registerCommandAndKeybindingRule({
100
- weight: 200 + 10,
102
+ weight: KeybindingWeight.WorkbenchContrib + 10,
101
103
  when: ( (ContextKeyExpr.and(
102
104
  FilesExplorerFocusCondition,
103
105
  (ExplorerFolderContext.toNegated())
104
106
  ))),
105
- primary: 3 ,
107
+ primary: KeyCode.Enter,
106
108
  mac: {
107
- primary: 2048 | 18
109
+ primary: KeyMod.CtrlCmd | KeyCode.DownArrow
108
110
  },
109
111
  id: 'explorer.openAndPassFocus', handler: async (accessor, _resource) => {
110
112
  const editorService = accessor.get(IEditorService);
@@ -122,8 +124,8 @@ let providerDisposables = [];
122
124
  KeybindingsRegistry.registerCommandAndKeybindingRule({
123
125
  id: COMPARE_WITH_SAVED_COMMAND_ID,
124
126
  when: undefined,
125
- weight: 200 ,
126
- primary: KeyChord(2048 | 41 , 34 ),
127
+ weight: KeybindingWeight.WorkbenchContrib,
128
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyD),
127
129
  handler: async (accessor, resource) => {
128
130
  const instantiationService = accessor.get(IInstantiationService);
129
131
  const textModelService = accessor.get(ITextModelService);
@@ -175,8 +177,9 @@ CommandsRegistry.registerCommand({
175
177
  id: COMPARE_SELECTED_COMMAND_ID,
176
178
  handler: async (accessor, resource) => {
177
179
  const editorService = accessor.get(IEditorService);
180
+ const editorGroupService = accessor.get(IEditorGroupsService);
178
181
  const explorerService = accessor.get(IExplorerService);
179
- const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService, explorerService);
182
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService, editorGroupService, explorerService);
180
183
  if (resources.length === 2) {
181
184
  return editorService.openEditor({
182
185
  original: { resource: resources[0] },
@@ -219,57 +222,57 @@ async function resourcesToClipboard(resources, relative, clipboardService, label
219
222
  }
220
223
  }
221
224
  const copyPathCommandHandler = async (accessor, resource) => {
222
- const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService));
225
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IEditorGroupsService), accessor.get(IExplorerService));
223
226
  await resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
224
227
  };
225
228
  KeybindingsRegistry.registerCommandAndKeybindingRule({
226
- weight: 200 ,
229
+ weight: KeybindingWeight.WorkbenchContrib,
227
230
  when: ( (EditorContextKeys.focus.toNegated())),
228
- primary: 2048 | 512 | 33 ,
231
+ primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC,
229
232
  win: {
230
- primary: 1024 | 512 | 33
233
+ primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KeyC
231
234
  },
232
235
  id: COPY_PATH_COMMAND_ID,
233
236
  handler: copyPathCommandHandler
234
237
  });
235
238
  KeybindingsRegistry.registerCommandAndKeybindingRule({
236
- weight: 200 ,
239
+ weight: KeybindingWeight.WorkbenchContrib,
237
240
  when: EditorContextKeys.focus,
238
- primary: KeyChord(2048 | 41 , 2048 | 512 | 33 ),
241
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC),
239
242
  win: {
240
- primary: 1024 | 512 | 33
243
+ primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KeyC
241
244
  },
242
245
  id: COPY_PATH_COMMAND_ID,
243
246
  handler: copyPathCommandHandler
244
247
  });
245
248
  const copyRelativePathCommandHandler = async (accessor, resource) => {
246
- const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService));
249
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IEditorGroupsService), accessor.get(IExplorerService));
247
250
  await resourcesToClipboard(resources, true, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
248
251
  };
249
252
  KeybindingsRegistry.registerCommandAndKeybindingRule({
250
- weight: 200 ,
253
+ weight: KeybindingWeight.WorkbenchContrib,
251
254
  when: ( (EditorContextKeys.focus.toNegated())),
252
- primary: 2048 | 1024 | 512 | 33 ,
255
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KeyC,
253
256
  win: {
254
- primary: KeyChord(2048 | 41 , 2048 | 1024 | 33 )
257
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyC)
255
258
  },
256
259
  id: COPY_RELATIVE_PATH_COMMAND_ID,
257
260
  handler: copyRelativePathCommandHandler
258
261
  });
259
262
  KeybindingsRegistry.registerCommandAndKeybindingRule({
260
- weight: 200 ,
263
+ weight: KeybindingWeight.WorkbenchContrib,
261
264
  when: EditorContextKeys.focus,
262
- primary: KeyChord(2048 | 41 , 2048 | 1024 | 512 | 33 ),
265
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KeyC),
263
266
  win: {
264
- primary: KeyChord(2048 | 41 , 2048 | 1024 | 33 )
267
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyC)
265
268
  },
266
269
  id: COPY_RELATIVE_PATH_COMMAND_ID,
267
270
  handler: copyRelativePathCommandHandler
268
271
  });
269
272
  KeybindingsRegistry.registerCommandAndKeybindingRule({
270
- weight: 200 ,
273
+ weight: KeybindingWeight.WorkbenchContrib,
271
274
  when: undefined,
272
- primary: KeyChord(2048 | 41 , 46 ),
275
+ primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyP),
273
276
  id: 'workbench.action.files.copyPathOfActiveFile',
274
277
  handler: async (accessor) => {
275
278
  const editorService = accessor.get(IEditorService);
@@ -335,7 +338,7 @@ CommandsRegistry.registerCommand({
335
338
  return;
336
339
  }
337
340
  try {
338
- await editorService.revert(editors.filter(({ editor }) => !editor.hasCapability(4 ) ), { force: true });
341
+ await editorService.revert(editors.filter(({ editor }) => !editor.hasCapability(EditorInputCapabilities.Untitled) ), { force: true });
339
342
  }
340
343
  catch (error) {
341
344
  notificationService.error(( localizeWithPath(
@@ -355,7 +358,7 @@ CommandsRegistry.registerCommand({
355
358
  const contextService = accessor.get(IWorkspaceContextService);
356
359
  const uriIdentityService = accessor.get(IUriIdentityService);
357
360
  const workspace = contextService.getWorkspace();
358
- const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService)).filter(resource => ( (workspace.folders.some(folder => uriIdentityService.extUri.isEqual(folder.uri, resource))))
361
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IEditorGroupsService), accessor.get(IExplorerService)).filter(resource => ( (workspace.folders.some(folder => uriIdentityService.extUri.isEqual(folder.uri, resource))))
359
362
  );
360
363
  if (resources.length === 0) {
361
364
  const commandService = accessor.get(ICommandService);
@@ -365,17 +368,17 @@ CommandsRegistry.registerCommand({
365
368
  }
366
369
  });
367
370
  KeybindingsRegistry.registerCommandAndKeybindingRule({
368
- weight: 200 + 10,
371
+ weight: KeybindingWeight.WorkbenchContrib + 10,
369
372
  when: ( (ContextKeyExpr.and(
370
373
  FilesExplorerFocusCondition,
371
374
  ExplorerCompressedFocusContext,
372
375
  (ExplorerCompressedFirstFocusContext.negate())
373
376
  ))),
374
- primary: 15 ,
377
+ primary: KeyCode.LeftArrow,
375
378
  id: PREVIOUS_COMPRESSED_FOLDER,
376
379
  handler: accessor => {
377
380
  const paneCompositeService = accessor.get(IPaneCompositePartService);
378
- const viewlet = paneCompositeService.getActivePaneComposite(0 );
381
+ const viewlet = paneCompositeService.getActivePaneComposite(ViewContainerLocation.Sidebar);
379
382
  if (viewlet?.getId() !== VIEWLET_ID) {
380
383
  return;
381
384
  }
@@ -385,17 +388,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
385
388
  }
386
389
  });
387
390
  KeybindingsRegistry.registerCommandAndKeybindingRule({
388
- weight: 200 + 10,
391
+ weight: KeybindingWeight.WorkbenchContrib + 10,
389
392
  when: ( (ContextKeyExpr.and(
390
393
  FilesExplorerFocusCondition,
391
394
  ExplorerCompressedFocusContext,
392
395
  (ExplorerCompressedLastFocusContext.negate())
393
396
  ))),
394
- primary: 17 ,
397
+ primary: KeyCode.RightArrow,
395
398
  id: NEXT_COMPRESSED_FOLDER,
396
399
  handler: accessor => {
397
400
  const paneCompositeService = accessor.get(IPaneCompositePartService);
398
- const viewlet = paneCompositeService.getActivePaneComposite(0 );
401
+ const viewlet = paneCompositeService.getActivePaneComposite(ViewContainerLocation.Sidebar);
399
402
  if (viewlet?.getId() !== VIEWLET_ID) {
400
403
  return;
401
404
  }
@@ -405,17 +408,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
405
408
  }
406
409
  });
407
410
  KeybindingsRegistry.registerCommandAndKeybindingRule({
408
- weight: 200 + 10,
411
+ weight: KeybindingWeight.WorkbenchContrib + 10,
409
412
  when: ( (ContextKeyExpr.and(
410
413
  FilesExplorerFocusCondition,
411
414
  ExplorerCompressedFocusContext,
412
415
  (ExplorerCompressedFirstFocusContext.negate())
413
416
  ))),
414
- primary: 14 ,
417
+ primary: KeyCode.Home,
415
418
  id: FIRST_COMPRESSED_FOLDER,
416
419
  handler: accessor => {
417
420
  const paneCompositeService = accessor.get(IPaneCompositePartService);
418
- const viewlet = paneCompositeService.getActivePaneComposite(0 );
421
+ const viewlet = paneCompositeService.getActivePaneComposite(ViewContainerLocation.Sidebar);
419
422
  if (viewlet?.getId() !== VIEWLET_ID) {
420
423
  return;
421
424
  }
@@ -425,17 +428,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
425
428
  }
426
429
  });
427
430
  KeybindingsRegistry.registerCommandAndKeybindingRule({
428
- weight: 200 + 10,
431
+ weight: KeybindingWeight.WorkbenchContrib + 10,
429
432
  when: ( (ContextKeyExpr.and(
430
433
  FilesExplorerFocusCondition,
431
434
  ExplorerCompressedFocusContext,
432
435
  (ExplorerCompressedLastFocusContext.negate())
433
436
  ))),
434
- primary: 13 ,
437
+ primary: KeyCode.End,
435
438
  id: LAST_COMPRESSED_FOLDER,
436
439
  handler: accessor => {
437
440
  const paneCompositeService = accessor.get(IPaneCompositePartService);
438
- const viewlet = paneCompositeService.getActivePaneComposite(0 );
441
+ const viewlet = paneCompositeService.getActivePaneComposite(ViewContainerLocation.Sidebar);
439
442
  if (viewlet?.getId() !== VIEWLET_ID) {
440
443
  return;
441
444
  }
@@ -445,10 +448,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
445
448
  }
446
449
  });
447
450
  KeybindingsRegistry.registerCommandAndKeybindingRule({
448
- weight: 200 ,
451
+ weight: KeybindingWeight.WorkbenchContrib,
449
452
  when: null,
450
- primary: isWeb ? ((isWindows ? KeyChord(2048 | 41 , 44 ) : 2048 | 512 | 44) ) : 2048 | 44 ,
451
- secondary: isWeb ? [2048 | 44 ] : undefined,
453
+ primary: isWeb ? (isWindows ? KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyN) : KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyN) : KeyMod.CtrlCmd | KeyCode.KeyN,
454
+ secondary: isWeb ? [KeyMod.CtrlCmd | KeyCode.KeyN] : undefined,
452
455
  id: NEW_UNTITLED_FILE_COMMAND_ID,
453
456
  metadata: {
454
457
  description: NEW_UNTITLED_FILE_LABEL,
@@ -1,19 +1,21 @@
1
1
  import { UndoCommand, RedoCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
2
2
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
3
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
4
- import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
4
+ import { Extensions, ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
5
+ import 'vscode/vscode/vs/platform/instantiation/common/extensions';
5
6
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
6
7
  import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
7
- import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
8
+ import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
8
9
  import { UNDO_REDO_SOURCE } from './explorerService.js';
9
10
  import { ExplorerViewletViewsContribution } from 'vscode/vscode/vs/workbench/contrib/files/browser/explorerViewlet';
10
11
  import { IExplorerService } from 'vscode/vscode/vs/workbench/contrib/files/browser/files.service';
12
+ import { UndoConfirmLevel, SortOrder, LexicographicOptions } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
11
13
  import 'vscode/vscode/vs/workbench/contrib/files/browser/files.contribution._configuration';
12
14
  import 'vscode/vscode/vs/workbench/contrib/files/browser/files.contribution._editorPane';
13
15
  import 'vscode/vscode/vs/workbench/contrib/files/browser/files.contribution._fileEditorFactory';
14
16
 
15
17
  const _moduleId = "vs/workbench/contrib/files/browser/files.contribution";
16
- registerWorkbenchContribution2(ExplorerViewletViewsContribution.ID, ExplorerViewletViewsContribution, 1 );
18
+ registerWorkbenchContribution2(ExplorerViewletViewsContribution.ID, ExplorerViewletViewsContribution, WorkbenchPhase.BlockStartup);
17
19
  const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
18
20
  configurationRegistry.registerConfiguration({
19
21
  'id': 'explorer',
@@ -170,13 +172,13 @@ configurationRegistry.registerConfiguration({
170
172
  },
171
173
  'explorer.confirmUndo': {
172
174
  'type': 'string',
173
- 'enum': ["verbose" , "default" , "light" ],
175
+ 'enum': [UndoConfirmLevel.Verbose, UndoConfirmLevel.Default, UndoConfirmLevel.Light],
174
176
  'description': ( localizeWithPath(
175
177
  _moduleId,
176
178
  69,
177
179
  "Controls whether the Explorer should ask for confirmation when undoing."
178
180
  )),
179
- 'default': "default" ,
181
+ 'default': UndoConfirmLevel.Default,
180
182
  'enumDescriptions': [
181
183
  ( localizeWithPath(_moduleId, 70, 'Explorer will prompt before all undo operations.')),
182
184
  ( localizeWithPath(_moduleId, 71, 'Explorer will prompt before destructive undo operations.')),
@@ -198,8 +200,8 @@ configurationRegistry.registerConfiguration({
198
200
  },
199
201
  'explorer.sortOrder': {
200
202
  'type': 'string',
201
- 'enum': ["default" , "mixed" , "filesFirst" , "type" , "modified" , "foldersNestsFiles" ],
202
- 'default': "default" ,
203
+ 'enum': [SortOrder.Default, SortOrder.Mixed, SortOrder.FilesFirst, SortOrder.Type, SortOrder.Modified, SortOrder.FoldersNestsFiles],
204
+ 'default': SortOrder.Default,
203
205
  'enumDescriptions': [
204
206
  ( localizeWithPath(
205
207
  _moduleId,
@@ -240,8 +242,8 @@ configurationRegistry.registerConfiguration({
240
242
  },
241
243
  'explorer.sortOrderLexicographicOptions': {
242
244
  'type': 'string',
243
- 'enum': ["default" , "upper" , "lower" , "unicode" ],
244
- 'default': "default" ,
245
+ 'enum': [LexicographicOptions.Default, LexicographicOptions.Upper, LexicographicOptions.Lower, LexicographicOptions.Unicode],
246
+ 'default': LexicographicOptions.Default,
245
247
  'enumDescriptions': [
246
248
  ( localizeWithPath(_moduleId, 81, 'Uppercase and lowercase names are mixed together.')),
247
249
  ( localizeWithPath(
@@ -336,11 +338,11 @@ configurationRegistry.registerConfiguration({
336
338
  '`#files.exclude#`'
337
339
  )),
338
340
  default: false,
339
- scope: 4
341
+ scope: ConfigurationScope.RESOURCE
340
342
  },
341
343
  'explorer.fileNesting.enabled': {
342
344
  'type': 'boolean',
343
- scope: 4 ,
345
+ scope: ConfigurationScope.RESOURCE,
344
346
  'markdownDescription': ( localizeWithPath(
345
347
  _moduleId,
346
348
  98,
@@ -360,7 +362,7 @@ configurationRegistry.registerConfiguration({
360
362
  },
361
363
  'explorer.fileNesting.patterns': {
362
364
  'type': 'object',
363
- scope: 4 ,
365
+ scope: ConfigurationScope.RESOURCE,
364
366
  'markdownDescription': ( localizeWithPath(
365
367
  _moduleId,
366
368
  100,