@codingame/monaco-vscode-explorer-service-override 4.5.1 → 5.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/explorer.js +1 -1
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +193 -255
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +39 -45
- package/vscode/src/vs/workbench/contrib/files/browser/{files.explorer.contribution.js → files.contribution._explorer.js} +97 -144
|
@@ -40,20 +40,21 @@ import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/p
|
|
|
40
40
|
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
41
41
|
import { IWorkspaceEditingService } from 'vscode/vscode/vs/workbench/services/workspaces/common/workspaceEditing.service';
|
|
42
42
|
import { OPEN_TO_SIDE_COMMAND_ID, COMPARE_WITH_SAVED_COMMAND_ID, SELECT_FOR_COMPARE_COMMAND_ID, ResourceSelectedForCompareContext, COMPARE_SELECTED_COMMAND_ID, COMPARE_RESOURCE_COMMAND_ID, COPY_PATH_COMMAND_ID, COPY_RELATIVE_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID, OPEN_WITH_EXPLORER_COMMAND_ID, REVERT_FILE_COMMAND_ID, REMOVE_ROOT_FOLDER_COMMAND_ID, PREVIOUS_COMPRESSED_FOLDER, NEXT_COMPRESSED_FOLDER, FIRST_COMPRESSED_FOLDER, LAST_COMPRESSED_FOLDER, NEW_UNTITLED_FILE_COMMAND_ID, NEW_UNTITLED_FILE_LABEL, NEW_FILE_COMMAND_ID } from 'vscode/vscode/vs/workbench/contrib/files/browser/fileConstants';
|
|
43
|
-
import 'vscode/vscode/vs/workbench/contrib/files/browser/fileCommands.
|
|
43
|
+
import 'vscode/vscode/vs/workbench/contrib/files/browser/fileCommands._save';
|
|
44
44
|
|
|
45
|
+
const _moduleId = "vs/workbench/contrib/files/browser/fileCommands";
|
|
45
46
|
const openWindowCommand = (accessor, toOpen, options) => {
|
|
46
47
|
if (Array.isArray(toOpen)) {
|
|
47
48
|
const hostService = accessor.get(IHostService);
|
|
48
49
|
const environmentService = accessor.get(IEnvironmentService);
|
|
49
|
-
toOpen = ( toOpen.map(openable => {
|
|
50
|
+
toOpen = ( (toOpen.map(openable => {
|
|
50
51
|
if (isWorkspaceToOpen(openable) && openable.workspaceUri.scheme === Schemas.untitled) {
|
|
51
52
|
return {
|
|
52
53
|
workspaceUri: joinPath(environmentService.untitledWorkspacesHome, openable.workspaceUri.path, UNTITLED_WORKSPACE_NAME)
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
return openable;
|
|
56
|
-
}));
|
|
57
|
+
})));
|
|
57
58
|
hostService.openWindow(toOpen, options);
|
|
58
59
|
}
|
|
59
60
|
};
|
|
@@ -77,27 +78,30 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
|
77
78
|
if (resources.length) {
|
|
78
79
|
const untitledResources = resources.filter(resource => resource.scheme === Schemas.untitled);
|
|
79
80
|
const fileResources = resources.filter(resource => resource.scheme !== Schemas.untitled);
|
|
80
|
-
const items = await Promise.all(( fileResources.map(async (resource) => {
|
|
81
|
+
const items = await Promise.all(( (fileResources.map(async (resource) => {
|
|
81
82
|
const item = explorerService.findClosest(resource);
|
|
82
83
|
if (item) {
|
|
83
84
|
return item;
|
|
84
85
|
}
|
|
85
86
|
return await fileService.stat(resource);
|
|
86
|
-
})));
|
|
87
|
+
}))));
|
|
87
88
|
const files = items.filter(i => !i.isDirectory);
|
|
88
|
-
const editors = ( files.map(f => ({
|
|
89
|
+
const editors = ( (files.map(f => ({
|
|
89
90
|
resource: f.resource,
|
|
90
91
|
options: { pinned: true }
|
|
91
|
-
}))).concat(...( untitledResources.map(
|
|
92
|
+
})))).concat(...( (untitledResources.map(
|
|
92
93
|
untitledResource => ({ resource: untitledResource, options: { pinned: true } })
|
|
93
|
-
)));
|
|
94
|
+
))));
|
|
94
95
|
await editorService.openEditors(editors, SIDE_GROUP);
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
99
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
99
100
|
weight: 200 + 10,
|
|
100
|
-
when: ( ContextKeyExpr.and(
|
|
101
|
+
when: ( (ContextKeyExpr.and(
|
|
102
|
+
FilesExplorerFocusCondition,
|
|
103
|
+
(ExplorerFolderContext.toNegated())
|
|
104
|
+
))),
|
|
101
105
|
primary: 3 ,
|
|
102
106
|
mac: {
|
|
103
107
|
primary: 2048 | 18
|
|
@@ -107,9 +111,9 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
|
107
111
|
const explorerService = accessor.get(IExplorerService);
|
|
108
112
|
const resources = explorerService.getContext(true);
|
|
109
113
|
if (resources.length) {
|
|
110
|
-
await editorService.openEditors(( resources.map(
|
|
114
|
+
await editorService.openEditors(( (resources.map(
|
|
111
115
|
r => ({ resource: r.resource, options: { preserveFocus: false, pinned: true } })
|
|
112
|
-
)));
|
|
116
|
+
))));
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
});
|
|
@@ -135,20 +139,14 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
|
135
139
|
const uri = getResourceForCommand(resource, accessor.get(IListService), editorService);
|
|
136
140
|
if (uri && fileService.hasProvider(uri)) {
|
|
137
141
|
const name = basename(uri);
|
|
138
|
-
const editorLabel = ( localizeWithPath(
|
|
139
|
-
'vs/workbench/contrib/files/browser/fileCommands',
|
|
140
|
-
'modifiedLabel',
|
|
141
|
-
"{0} (in file) ↔ {1}",
|
|
142
|
-
name,
|
|
143
|
-
name
|
|
144
|
-
));
|
|
142
|
+
const editorLabel = ( localizeWithPath(_moduleId, 0, "{0} (in file) ↔ {1}", name, name));
|
|
145
143
|
try {
|
|
146
144
|
await TextFileContentProvider.open(uri, COMPARE_WITH_SAVED_SCHEMA, editorLabel, editorService, { pinned: true });
|
|
147
145
|
if (registerEditorListener) {
|
|
148
146
|
providerDisposables.push(editorService.onDidVisibleEditorsChange(() => {
|
|
149
|
-
if (!( editorService.editors.some(
|
|
147
|
+
if (!( (editorService.editors.some(
|
|
150
148
|
editor => !!EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.SECONDARY, filterByScheme: COMPARE_WITH_SAVED_SCHEMA })
|
|
151
|
-
))) {
|
|
149
|
+
)))) {
|
|
152
150
|
providerDisposables = dispose(providerDisposables);
|
|
153
151
|
}
|
|
154
152
|
}));
|
|
@@ -214,9 +212,9 @@ async function resourcesToClipboard(resources, relative, clipboardService, label
|
|
|
214
212
|
separator = relativeSeparator;
|
|
215
213
|
}
|
|
216
214
|
}
|
|
217
|
-
const text = ( resources.map(
|
|
215
|
+
const text = ( (resources.map(
|
|
218
216
|
resource => labelService.getUriLabel(resource, { relative, noPrefix: true, separator })
|
|
219
|
-
)).join(lineDelimiter);
|
|
217
|
+
))).join(lineDelimiter);
|
|
220
218
|
await clipboardService.writeText(text);
|
|
221
219
|
}
|
|
222
220
|
}
|
|
@@ -226,7 +224,7 @@ const copyPathCommandHandler = async (accessor, resource) => {
|
|
|
226
224
|
};
|
|
227
225
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
228
226
|
weight: 200 ,
|
|
229
|
-
when: ( EditorContextKeys.focus.toNegated()),
|
|
227
|
+
when: ( (EditorContextKeys.focus.toNegated())),
|
|
230
228
|
primary: 2048 | 512 | 33 ,
|
|
231
229
|
win: {
|
|
232
230
|
primary: 1024 | 512 | 33
|
|
@@ -250,7 +248,7 @@ const copyRelativePathCommandHandler = async (accessor, resource) => {
|
|
|
250
248
|
};
|
|
251
249
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
252
250
|
weight: 200 ,
|
|
253
|
-
when: ( EditorContextKeys.focus.toNegated()),
|
|
251
|
+
when: ( (EditorContextKeys.focus.toNegated())),
|
|
254
252
|
primary: 2048 | 1024 | 512 | 33 ,
|
|
255
253
|
win: {
|
|
256
254
|
primary: KeyChord(2048 | 41 , 2048 | 1024 | 33 )
|
|
@@ -341,10 +339,10 @@ CommandsRegistry.registerCommand({
|
|
|
341
339
|
}
|
|
342
340
|
catch (error) {
|
|
343
341
|
notificationService.error(( localizeWithPath(
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
_moduleId,
|
|
343
|
+
1,
|
|
346
344
|
"Failed to revert '{0}': {1}",
|
|
347
|
-
( editors.map(({ editor }) => editor.getName())).join(', '),
|
|
345
|
+
( (editors.map(({ editor }) => editor.getName()))).join(', '),
|
|
348
346
|
toErrorMessage(error, false)
|
|
349
347
|
)));
|
|
350
348
|
}
|
|
@@ -357,7 +355,7 @@ CommandsRegistry.registerCommand({
|
|
|
357
355
|
const contextService = accessor.get(IWorkspaceContextService);
|
|
358
356
|
const uriIdentityService = accessor.get(IUriIdentityService);
|
|
359
357
|
const workspace = contextService.getWorkspace();
|
|
360
|
-
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)))
|
|
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
359
|
);
|
|
362
360
|
if (resources.length === 0) {
|
|
363
361
|
const commandService = accessor.get(ICommandService);
|
|
@@ -368,11 +366,11 @@ CommandsRegistry.registerCommand({
|
|
|
368
366
|
});
|
|
369
367
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
370
368
|
weight: 200 + 10,
|
|
371
|
-
when: ( ContextKeyExpr.and(
|
|
369
|
+
when: ( (ContextKeyExpr.and(
|
|
372
370
|
FilesExplorerFocusCondition,
|
|
373
371
|
ExplorerCompressedFocusContext,
|
|
374
|
-
|
|
375
|
-
)),
|
|
372
|
+
(ExplorerCompressedFirstFocusContext.negate())
|
|
373
|
+
))),
|
|
376
374
|
primary: 15 ,
|
|
377
375
|
id: PREVIOUS_COMPRESSED_FOLDER,
|
|
378
376
|
handler: accessor => {
|
|
@@ -388,11 +386,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
|
388
386
|
});
|
|
389
387
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
390
388
|
weight: 200 + 10,
|
|
391
|
-
when: ( ContextKeyExpr.and(
|
|
389
|
+
when: ( (ContextKeyExpr.and(
|
|
392
390
|
FilesExplorerFocusCondition,
|
|
393
391
|
ExplorerCompressedFocusContext,
|
|
394
|
-
|
|
395
|
-
)),
|
|
392
|
+
(ExplorerCompressedLastFocusContext.negate())
|
|
393
|
+
))),
|
|
396
394
|
primary: 17 ,
|
|
397
395
|
id: NEXT_COMPRESSED_FOLDER,
|
|
398
396
|
handler: accessor => {
|
|
@@ -408,11 +406,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
|
408
406
|
});
|
|
409
407
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
410
408
|
weight: 200 + 10,
|
|
411
|
-
when: ( ContextKeyExpr.and(
|
|
409
|
+
when: ( (ContextKeyExpr.and(
|
|
412
410
|
FilesExplorerFocusCondition,
|
|
413
411
|
ExplorerCompressedFocusContext,
|
|
414
|
-
|
|
415
|
-
)),
|
|
412
|
+
(ExplorerCompressedFirstFocusContext.negate())
|
|
413
|
+
))),
|
|
416
414
|
primary: 14 ,
|
|
417
415
|
id: FIRST_COMPRESSED_FOLDER,
|
|
418
416
|
handler: accessor => {
|
|
@@ -428,11 +426,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
|
428
426
|
});
|
|
429
427
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
430
428
|
weight: 200 + 10,
|
|
431
|
-
when: ( ContextKeyExpr.and(
|
|
429
|
+
when: ( (ContextKeyExpr.and(
|
|
432
430
|
FilesExplorerFocusCondition,
|
|
433
431
|
ExplorerCompressedFocusContext,
|
|
434
|
-
|
|
435
|
-
)),
|
|
432
|
+
(ExplorerCompressedLastFocusContext.negate())
|
|
433
|
+
))),
|
|
436
434
|
primary: 13 ,
|
|
437
435
|
id: LAST_COMPRESSED_FOLDER,
|
|
438
436
|
handler: accessor => {
|
|
@@ -491,11 +489,7 @@ CommandsRegistry.registerCommand({
|
|
|
491
489
|
const editorService = accessor.get(IEditorService);
|
|
492
490
|
const dialogService = accessor.get(IFileDialogService);
|
|
493
491
|
const fileService = accessor.get(IFileService);
|
|
494
|
-
const createFileLocalized = ( localizeWithPath(
|
|
495
|
-
'vs/workbench/contrib/files/browser/fileCommands',
|
|
496
|
-
'newFileCommand.saveLabel',
|
|
497
|
-
"Create File"
|
|
498
|
-
));
|
|
492
|
+
const createFileLocalized = ( localizeWithPath(_moduleId, 2, "Create File"));
|
|
499
493
|
const defaultFileUri = joinPath(await dialogService.defaultFilePath(), args?.fileName ?? 'Untitled.txt');
|
|
500
494
|
const saveUri = await dialogService.showSaveDialog({ saveLabel: createFileLocalized, title: createFileLocalized, defaultUri: defaultFileUri });
|
|
501
495
|
if (!saveUri) {
|