@codingame/monaco-vscode-api 3.0.0 → 3.1.1
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/api.js +1 -1
- package/assets/continue-tb.png +0 -0
- package/assets/pause-tb.png +0 -0
- package/assets/restart-tb.png +0 -0
- package/assets/run-with-debugging-tb.png +0 -0
- package/assets/stepinto-tb.png +0 -0
- package/assets/stepout-tb.png +0 -0
- package/assets/stepover-tb.png +0 -0
- package/assets/stop-tb.png +0 -0
- package/contributions.js +2 -0
- package/l10n.js +4 -1
- package/missing-services.js +17 -2
- package/package.json +8 -8
- package/service-override/tools/editorAssets.js +3 -0
- package/services.d.ts +6 -3
- package/services.js +17 -3
- package/vscode/src/vs/base/common/lifecycle.js +158 -1
- package/vscode/src/vs/base/common/observableInternal/autorun.js +3 -1
- package/vscode/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -0
- package/vscode/src/vs/nls.js +8 -1
- package/vscode/src/vs/platform/tunnel/common/tunnel.js +267 -1
- package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostNotebookDocument.js +1 -11
- package/vscode/src/vs/workbench/browser/actions/developerActions.js +703 -0
- package/vscode/src/vs/workbench/browser/actions/media/actions.css.js +4 -0
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +300 -0
- package/vscode/src/vs/workbench/browser/actions/textInputActions.js +83 -0
- package/vscode/src/vs/workbench/browser/dnd.js +2 -1
- package/vscode/src/vs/workbench/browser/parts/globalCompositeBar.js +323 -8
- package/vscode/src/vs/workbench/common/contributions.d.ts +44 -1
- package/vscode/src/vs/workbench/common/contributions.js +8 -1
- package/vscode/src/vs/workbench/common/views.js +1 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/media/all.png.js +11 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.editorPane.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/logs/common/defaultLogLevels.js +140 -0
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceIdentityService.js +102 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -430
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -510
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
|
@@ -1,510 +0,0 @@
|
|
|
1
|
-
import { toErrorMessage } from '../../../../base/common/errorMessage.js';
|
|
2
|
-
import { KeyChord } from '../../../../base/common/keyCodes.js';
|
|
3
|
-
import { dispose } from '../../../../base/common/lifecycle.js';
|
|
4
|
-
import { Schemas } from '../../../../base/common/network.js';
|
|
5
|
-
import { isWeb, isWindows } from '../../../../base/common/platform.js';
|
|
6
|
-
import { basename, joinPath } from '../../../../base/common/resources.js';
|
|
7
|
-
import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js';
|
|
8
|
-
import { ITextModelService } from '../../../../editor/common/services/resolverService.js';
|
|
9
|
-
import { localizeWithPath } from '../../../../nls.js';
|
|
10
|
-
import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
|
|
11
|
-
import { CommandsRegistry, ICommandService } from '../../../../platform/commands/common/commands.js';
|
|
12
|
-
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
|
13
|
-
import { ContextKeyExpr, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
14
|
-
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
15
|
-
import { EditorResolution, EditorOpenSource } from '../../../../platform/editor/common/editor.js';
|
|
16
|
-
import { IEnvironmentService } from '../../../../platform/environment/common/environment.js';
|
|
17
|
-
import { IFileService } from '../../../../platform/files/common/files.js';
|
|
18
|
-
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
19
|
-
import { KeybindingsRegistry } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
|
|
20
|
-
import { ILabelService } from '../../../../platform/label/common/label.js';
|
|
21
|
-
import { IListService } from '../../../../platform/list/browser/listService.js';
|
|
22
|
-
import { INotificationService } from '../../../../platform/notification/common/notification.js';
|
|
23
|
-
import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
|
|
24
|
-
import { isWorkspaceToOpen } from '../../../../platform/window/common/window.js';
|
|
25
|
-
import { IWorkspaceContextService, UNTITLED_WORKSPACE_NAME } from '../../../../platform/workspace/common/workspace.js';
|
|
26
|
-
import { RemoveRootFolderAction } from '../../../browser/actions/workspaceActions.js';
|
|
27
|
-
import { EditorResourceAccessor, SideBySideEditor } from '../../../common/editor.js';
|
|
28
|
-
import { IExplorerService, getMultiSelectedResources, getResourceForCommand, getOpenEditorsViewMultiSelection } from './files.js';
|
|
29
|
-
import { OpenEditorsView } from './views/openEditorsView.js';
|
|
30
|
-
import { ExplorerFocusCondition, FilesExplorerFocusCondition, ExplorerFolderContext, TextFileContentProvider, VIEW_ID, ExplorerCompressedFocusContext, ExplorerCompressedFirstFocusContext, VIEWLET_ID, ExplorerCompressedLastFocusContext } from '../common/files.js';
|
|
31
|
-
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
|
|
32
|
-
import { IEditorService, SIDE_GROUP } from '../../../services/editor/common/editorService.js';
|
|
33
|
-
import { IHostService } from '../../../services/host/browser/host.js';
|
|
34
|
-
import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js';
|
|
35
|
-
import { IViewsService } from '../../../services/views/common/viewsService.js';
|
|
36
|
-
import { IWorkspaceEditingService } from '../../../services/workspaces/common/workspaceEditing.js';
|
|
37
|
-
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 './fileConstants.js';
|
|
38
|
-
import './fileCommands.save.js';
|
|
39
|
-
import { IFileDialogService } from '../../../../platform/dialogs/common/dialogs.js';
|
|
40
|
-
const openWindowCommand = (accessor, toOpen, options) => {
|
|
41
|
-
if (Array.isArray(toOpen)) {
|
|
42
|
-
const hostService = accessor.get(IHostService);
|
|
43
|
-
const environmentService = accessor.get(IEnvironmentService);
|
|
44
|
-
toOpen = ( toOpen.map(openable => {
|
|
45
|
-
if (isWorkspaceToOpen(openable) && openable.workspaceUri.scheme === Schemas.untitled) {
|
|
46
|
-
return {
|
|
47
|
-
workspaceUri: joinPath(environmentService.untitledWorkspacesHome, openable.workspaceUri.path, UNTITLED_WORKSPACE_NAME)
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return openable;
|
|
51
|
-
}));
|
|
52
|
-
hostService.openWindow(toOpen, options);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const newWindowCommand = (accessor, options) => {
|
|
56
|
-
const hostService = accessor.get(IHostService);
|
|
57
|
-
hostService.openWindow(options);
|
|
58
|
-
};
|
|
59
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
60
|
-
weight: 200 ,
|
|
61
|
-
when: ExplorerFocusCondition,
|
|
62
|
-
primary: 2048 | 3 ,
|
|
63
|
-
mac: {
|
|
64
|
-
primary: 256 | 3
|
|
65
|
-
},
|
|
66
|
-
id: OPEN_TO_SIDE_COMMAND_ID, handler: async (accessor, resource) => {
|
|
67
|
-
const editorService = accessor.get(IEditorService);
|
|
68
|
-
const listService = accessor.get(IListService);
|
|
69
|
-
const fileService = accessor.get(IFileService);
|
|
70
|
-
const explorerService = accessor.get(IExplorerService);
|
|
71
|
-
const resources = getMultiSelectedResources(resource, listService, editorService, explorerService);
|
|
72
|
-
if (resources.length) {
|
|
73
|
-
const untitledResources = resources.filter(resource => resource.scheme === Schemas.untitled);
|
|
74
|
-
const fileResources = resources.filter(resource => resource.scheme !== Schemas.untitled);
|
|
75
|
-
const items = await Promise.all(( fileResources.map(async (resource) => {
|
|
76
|
-
const item = explorerService.findClosest(resource);
|
|
77
|
-
if (item) {
|
|
78
|
-
return item;
|
|
79
|
-
}
|
|
80
|
-
return await fileService.stat(resource);
|
|
81
|
-
})));
|
|
82
|
-
const files = items.filter(i => !i.isDirectory);
|
|
83
|
-
const editors = ( files.map(f => ({
|
|
84
|
-
resource: f.resource,
|
|
85
|
-
options: { pinned: true }
|
|
86
|
-
}))).concat(...( untitledResources.map(
|
|
87
|
-
untitledResource => ({ resource: untitledResource, options: { pinned: true } })
|
|
88
|
-
)));
|
|
89
|
-
await editorService.openEditors(editors, SIDE_GROUP);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
94
|
-
weight: 200 + 10,
|
|
95
|
-
when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ( ExplorerFolderContext.toNegated()))),
|
|
96
|
-
primary: 3 ,
|
|
97
|
-
mac: {
|
|
98
|
-
primary: 2048 | 18
|
|
99
|
-
},
|
|
100
|
-
id: 'explorer.openAndPassFocus', handler: async (accessor, _resource) => {
|
|
101
|
-
const editorService = accessor.get(IEditorService);
|
|
102
|
-
const explorerService = accessor.get(IExplorerService);
|
|
103
|
-
const resources = explorerService.getContext(true);
|
|
104
|
-
if (resources.length) {
|
|
105
|
-
await editorService.openEditors(( resources.map(
|
|
106
|
-
r => ({ resource: r.resource, options: { preserveFocus: false, pinned: true } })
|
|
107
|
-
)));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const COMPARE_WITH_SAVED_SCHEMA = 'showModifications';
|
|
112
|
-
let providerDisposables = [];
|
|
113
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
114
|
-
id: COMPARE_WITH_SAVED_COMMAND_ID,
|
|
115
|
-
when: undefined,
|
|
116
|
-
weight: 200 ,
|
|
117
|
-
primary: KeyChord(2048 | 41 , 34 ),
|
|
118
|
-
handler: async (accessor, resource) => {
|
|
119
|
-
const instantiationService = accessor.get(IInstantiationService);
|
|
120
|
-
const textModelService = accessor.get(ITextModelService);
|
|
121
|
-
const editorService = accessor.get(IEditorService);
|
|
122
|
-
const fileService = accessor.get(IFileService);
|
|
123
|
-
let registerEditorListener = false;
|
|
124
|
-
if (providerDisposables.length === 0) {
|
|
125
|
-
registerEditorListener = true;
|
|
126
|
-
const provider = instantiationService.createInstance(TextFileContentProvider);
|
|
127
|
-
providerDisposables.push(provider);
|
|
128
|
-
providerDisposables.push(textModelService.registerTextModelContentProvider(COMPARE_WITH_SAVED_SCHEMA, provider));
|
|
129
|
-
}
|
|
130
|
-
const uri = getResourceForCommand(resource, accessor.get(IListService), editorService);
|
|
131
|
-
if (uri && fileService.hasProvider(uri)) {
|
|
132
|
-
const name = basename(uri);
|
|
133
|
-
const editorLabel = ( localizeWithPath(
|
|
134
|
-
'vs/workbench/contrib/files/browser/fileCommands',
|
|
135
|
-
'modifiedLabel',
|
|
136
|
-
"{0} (in file) ↔ {1}",
|
|
137
|
-
name,
|
|
138
|
-
name
|
|
139
|
-
));
|
|
140
|
-
try {
|
|
141
|
-
await TextFileContentProvider.open(uri, COMPARE_WITH_SAVED_SCHEMA, editorLabel, editorService, { pinned: true });
|
|
142
|
-
if (registerEditorListener) {
|
|
143
|
-
providerDisposables.push(editorService.onDidVisibleEditorsChange(() => {
|
|
144
|
-
if (!( editorService.editors.some(
|
|
145
|
-
editor => !!EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.SECONDARY, filterByScheme: COMPARE_WITH_SAVED_SCHEMA })
|
|
146
|
-
))) {
|
|
147
|
-
providerDisposables = dispose(providerDisposables);
|
|
148
|
-
}
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
providerDisposables = dispose(providerDisposables);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
let globalResourceToCompare;
|
|
159
|
-
let resourceSelectedForCompareContext;
|
|
160
|
-
CommandsRegistry.registerCommand({
|
|
161
|
-
id: SELECT_FOR_COMPARE_COMMAND_ID,
|
|
162
|
-
handler: (accessor, resource) => {
|
|
163
|
-
const listService = accessor.get(IListService);
|
|
164
|
-
globalResourceToCompare = getResourceForCommand(resource, listService, accessor.get(IEditorService));
|
|
165
|
-
if (!resourceSelectedForCompareContext) {
|
|
166
|
-
resourceSelectedForCompareContext = ResourceSelectedForCompareContext.bindTo(accessor.get(IContextKeyService));
|
|
167
|
-
}
|
|
168
|
-
resourceSelectedForCompareContext.set(true);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
CommandsRegistry.registerCommand({
|
|
172
|
-
id: COMPARE_SELECTED_COMMAND_ID,
|
|
173
|
-
handler: async (accessor, resource) => {
|
|
174
|
-
const editorService = accessor.get(IEditorService);
|
|
175
|
-
const explorerService = accessor.get(IExplorerService);
|
|
176
|
-
const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService, explorerService);
|
|
177
|
-
if (resources.length === 2) {
|
|
178
|
-
return editorService.openEditor({
|
|
179
|
-
original: { resource: resources[0] },
|
|
180
|
-
modified: { resource: resources[1] },
|
|
181
|
-
options: { pinned: true }
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
CommandsRegistry.registerCommand({
|
|
188
|
-
id: COMPARE_RESOURCE_COMMAND_ID,
|
|
189
|
-
handler: (accessor, resource) => {
|
|
190
|
-
const editorService = accessor.get(IEditorService);
|
|
191
|
-
const listService = accessor.get(IListService);
|
|
192
|
-
const rightResource = getResourceForCommand(resource, listService, editorService);
|
|
193
|
-
if (globalResourceToCompare && rightResource) {
|
|
194
|
-
editorService.openEditor({
|
|
195
|
-
original: { resource: globalResourceToCompare },
|
|
196
|
-
modified: { resource: rightResource },
|
|
197
|
-
options: { pinned: true }
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
async function resourcesToClipboard(resources, relative, clipboardService, labelService, configurationService) {
|
|
203
|
-
if (resources.length) {
|
|
204
|
-
const lineDelimiter = isWindows ? '\r\n' : '\n';
|
|
205
|
-
let separator = undefined;
|
|
206
|
-
if (relative) {
|
|
207
|
-
const relativeSeparator = configurationService.getValue('explorer.copyRelativePathSeparator');
|
|
208
|
-
if (relativeSeparator === '/' || relativeSeparator === '\\') {
|
|
209
|
-
separator = relativeSeparator;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
const text = ( resources.map(
|
|
213
|
-
resource => labelService.getUriLabel(resource, { relative, noPrefix: true, separator })
|
|
214
|
-
)).join(lineDelimiter);
|
|
215
|
-
await clipboardService.writeText(text);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
const copyPathCommandHandler = async (accessor, resource) => {
|
|
219
|
-
const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService));
|
|
220
|
-
await resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
|
|
221
|
-
};
|
|
222
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
223
|
-
weight: 200 ,
|
|
224
|
-
when: ( EditorContextKeys.focus.toNegated()),
|
|
225
|
-
primary: 2048 | 512 | 33 ,
|
|
226
|
-
win: {
|
|
227
|
-
primary: 1024 | 512 | 33
|
|
228
|
-
},
|
|
229
|
-
id: COPY_PATH_COMMAND_ID,
|
|
230
|
-
handler: copyPathCommandHandler
|
|
231
|
-
});
|
|
232
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
233
|
-
weight: 200 ,
|
|
234
|
-
when: EditorContextKeys.focus,
|
|
235
|
-
primary: KeyChord(2048 | 41 , 2048 | 512 | 33 ),
|
|
236
|
-
win: {
|
|
237
|
-
primary: 1024 | 512 | 33
|
|
238
|
-
},
|
|
239
|
-
id: COPY_PATH_COMMAND_ID,
|
|
240
|
-
handler: copyPathCommandHandler
|
|
241
|
-
});
|
|
242
|
-
const copyRelativePathCommandHandler = async (accessor, resource) => {
|
|
243
|
-
const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService));
|
|
244
|
-
await resourcesToClipboard(resources, true, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
|
|
245
|
-
};
|
|
246
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
247
|
-
weight: 200 ,
|
|
248
|
-
when: ( EditorContextKeys.focus.toNegated()),
|
|
249
|
-
primary: 2048 | 1024 | 512 | 33 ,
|
|
250
|
-
win: {
|
|
251
|
-
primary: KeyChord(2048 | 41 , 2048 | 1024 | 33 )
|
|
252
|
-
},
|
|
253
|
-
id: COPY_RELATIVE_PATH_COMMAND_ID,
|
|
254
|
-
handler: copyRelativePathCommandHandler
|
|
255
|
-
});
|
|
256
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
257
|
-
weight: 200 ,
|
|
258
|
-
when: EditorContextKeys.focus,
|
|
259
|
-
primary: KeyChord(2048 | 41 , 2048 | 1024 | 512 | 33 ),
|
|
260
|
-
win: {
|
|
261
|
-
primary: KeyChord(2048 | 41 , 2048 | 1024 | 33 )
|
|
262
|
-
},
|
|
263
|
-
id: COPY_RELATIVE_PATH_COMMAND_ID,
|
|
264
|
-
handler: copyRelativePathCommandHandler
|
|
265
|
-
});
|
|
266
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
267
|
-
weight: 200 ,
|
|
268
|
-
when: undefined,
|
|
269
|
-
primary: KeyChord(2048 | 41 , 46 ),
|
|
270
|
-
id: 'workbench.action.files.copyPathOfActiveFile',
|
|
271
|
-
handler: async (accessor) => {
|
|
272
|
-
const editorService = accessor.get(IEditorService);
|
|
273
|
-
const activeInput = editorService.activeEditor;
|
|
274
|
-
const resource = EditorResourceAccessor.getOriginalUri(activeInput, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
275
|
-
const resources = resource ? [resource] : [];
|
|
276
|
-
await resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
CommandsRegistry.registerCommand({
|
|
280
|
-
id: REVEAL_IN_EXPLORER_COMMAND_ID,
|
|
281
|
-
handler: async (accessor, resource) => {
|
|
282
|
-
const viewService = accessor.get(IViewsService);
|
|
283
|
-
const contextService = accessor.get(IWorkspaceContextService);
|
|
284
|
-
const explorerService = accessor.get(IExplorerService);
|
|
285
|
-
const uri = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IEditorService));
|
|
286
|
-
if (uri && contextService.isInsideWorkspace(uri)) {
|
|
287
|
-
const explorerView = await viewService.openView(VIEW_ID, false);
|
|
288
|
-
if (explorerView) {
|
|
289
|
-
const oldAutoReveal = explorerView.autoReveal;
|
|
290
|
-
explorerView.autoReveal = false;
|
|
291
|
-
explorerView.setExpanded(true);
|
|
292
|
-
await explorerService.select(uri, 'force');
|
|
293
|
-
explorerView.focus();
|
|
294
|
-
explorerView.autoReveal = oldAutoReveal;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
const openEditorsView = await viewService.openView(OpenEditorsView.ID, false);
|
|
299
|
-
if (openEditorsView) {
|
|
300
|
-
openEditorsView.setExpanded(true);
|
|
301
|
-
openEditorsView.focus();
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
CommandsRegistry.registerCommand({
|
|
307
|
-
id: OPEN_WITH_EXPLORER_COMMAND_ID,
|
|
308
|
-
handler: async (accessor, resource) => {
|
|
309
|
-
const editorService = accessor.get(IEditorService);
|
|
310
|
-
const uri = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IEditorService));
|
|
311
|
-
if (uri) {
|
|
312
|
-
return editorService.openEditor({ resource: uri, options: { override: EditorResolution.PICK, source: EditorOpenSource.USER } });
|
|
313
|
-
}
|
|
314
|
-
return undefined;
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
CommandsRegistry.registerCommand({
|
|
318
|
-
id: REVERT_FILE_COMMAND_ID,
|
|
319
|
-
handler: async (accessor) => {
|
|
320
|
-
const notificationService = accessor.get(INotificationService);
|
|
321
|
-
const listService = accessor.get(IListService);
|
|
322
|
-
const editorGroupService = accessor.get(IEditorGroupsService);
|
|
323
|
-
const editorService = accessor.get(IEditorService);
|
|
324
|
-
let editors = getOpenEditorsViewMultiSelection(listService);
|
|
325
|
-
if (!editors) {
|
|
326
|
-
const activeGroup = editorGroupService.activeGroup;
|
|
327
|
-
if (activeGroup.activeEditor) {
|
|
328
|
-
editors = [{ groupId: activeGroup.id, editor: activeGroup.activeEditor }];
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
if (!editors || editors.length === 0) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
try {
|
|
335
|
-
await editorService.revert(editors.filter(({ editor }) => !editor.hasCapability(4 ) ), { force: true });
|
|
336
|
-
}
|
|
337
|
-
catch (error) {
|
|
338
|
-
notificationService.error(( localizeWithPath(
|
|
339
|
-
'vs/workbench/contrib/files/browser/fileCommands',
|
|
340
|
-
'genericRevertError',
|
|
341
|
-
"Failed to revert '{0}': {1}",
|
|
342
|
-
( editors.map(({ editor }) => editor.getName())).join(', '),
|
|
343
|
-
toErrorMessage(error, false)
|
|
344
|
-
)));
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
CommandsRegistry.registerCommand({
|
|
349
|
-
id: REMOVE_ROOT_FOLDER_COMMAND_ID,
|
|
350
|
-
handler: (accessor, resource) => {
|
|
351
|
-
const workspaceEditingService = accessor.get(IWorkspaceEditingService);
|
|
352
|
-
const contextService = accessor.get(IWorkspaceContextService);
|
|
353
|
-
const uriIdentityService = accessor.get(IUriIdentityService);
|
|
354
|
-
const workspace = contextService.getWorkspace();
|
|
355
|
-
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)))
|
|
356
|
-
);
|
|
357
|
-
if (resources.length === 0) {
|
|
358
|
-
const commandService = accessor.get(ICommandService);
|
|
359
|
-
return commandService.executeCommand(RemoveRootFolderAction.ID);
|
|
360
|
-
}
|
|
361
|
-
return workspaceEditingService.removeFolders(resources);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
365
|
-
weight: 200 + 10,
|
|
366
|
-
when: ( ContextKeyExpr.and(
|
|
367
|
-
FilesExplorerFocusCondition,
|
|
368
|
-
ExplorerCompressedFocusContext,
|
|
369
|
-
( ExplorerCompressedFirstFocusContext.negate())
|
|
370
|
-
)),
|
|
371
|
-
primary: 15 ,
|
|
372
|
-
id: PREVIOUS_COMPRESSED_FOLDER,
|
|
373
|
-
handler: accessor => {
|
|
374
|
-
const paneCompositeService = accessor.get(IPaneCompositePartService);
|
|
375
|
-
const viewlet = paneCompositeService.getActivePaneComposite(0 );
|
|
376
|
-
if (viewlet?.getId() !== VIEWLET_ID) {
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
const explorer = viewlet.getViewPaneContainer();
|
|
380
|
-
const view = explorer.getExplorerView();
|
|
381
|
-
view.previousCompressedStat();
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
385
|
-
weight: 200 + 10,
|
|
386
|
-
when: ( ContextKeyExpr.and(
|
|
387
|
-
FilesExplorerFocusCondition,
|
|
388
|
-
ExplorerCompressedFocusContext,
|
|
389
|
-
( ExplorerCompressedLastFocusContext.negate())
|
|
390
|
-
)),
|
|
391
|
-
primary: 17 ,
|
|
392
|
-
id: NEXT_COMPRESSED_FOLDER,
|
|
393
|
-
handler: accessor => {
|
|
394
|
-
const paneCompositeService = accessor.get(IPaneCompositePartService);
|
|
395
|
-
const viewlet = paneCompositeService.getActivePaneComposite(0 );
|
|
396
|
-
if (viewlet?.getId() !== VIEWLET_ID) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
const explorer = viewlet.getViewPaneContainer();
|
|
400
|
-
const view = explorer.getExplorerView();
|
|
401
|
-
view.nextCompressedStat();
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
405
|
-
weight: 200 + 10,
|
|
406
|
-
when: ( ContextKeyExpr.and(
|
|
407
|
-
FilesExplorerFocusCondition,
|
|
408
|
-
ExplorerCompressedFocusContext,
|
|
409
|
-
( ExplorerCompressedFirstFocusContext.negate())
|
|
410
|
-
)),
|
|
411
|
-
primary: 14 ,
|
|
412
|
-
id: FIRST_COMPRESSED_FOLDER,
|
|
413
|
-
handler: accessor => {
|
|
414
|
-
const paneCompositeService = accessor.get(IPaneCompositePartService);
|
|
415
|
-
const viewlet = paneCompositeService.getActivePaneComposite(0 );
|
|
416
|
-
if (viewlet?.getId() !== VIEWLET_ID) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
const explorer = viewlet.getViewPaneContainer();
|
|
420
|
-
const view = explorer.getExplorerView();
|
|
421
|
-
view.firstCompressedStat();
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
425
|
-
weight: 200 + 10,
|
|
426
|
-
when: ( ContextKeyExpr.and(
|
|
427
|
-
FilesExplorerFocusCondition,
|
|
428
|
-
ExplorerCompressedFocusContext,
|
|
429
|
-
( ExplorerCompressedLastFocusContext.negate())
|
|
430
|
-
)),
|
|
431
|
-
primary: 13 ,
|
|
432
|
-
id: LAST_COMPRESSED_FOLDER,
|
|
433
|
-
handler: accessor => {
|
|
434
|
-
const paneCompositeService = accessor.get(IPaneCompositePartService);
|
|
435
|
-
const viewlet = paneCompositeService.getActivePaneComposite(0 );
|
|
436
|
-
if (viewlet?.getId() !== VIEWLET_ID) {
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
const explorer = viewlet.getViewPaneContainer();
|
|
440
|
-
const view = explorer.getExplorerView();
|
|
441
|
-
view.lastCompressedStat();
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
445
|
-
weight: 200 ,
|
|
446
|
-
when: null,
|
|
447
|
-
primary: isWeb ? ((isWindows ? KeyChord(2048 | 41 , 44 ) : 2048 | 512 | 44) ) : 2048 | 44 ,
|
|
448
|
-
secondary: isWeb ? [2048 | 44 ] : undefined,
|
|
449
|
-
id: NEW_UNTITLED_FILE_COMMAND_ID,
|
|
450
|
-
metadata: {
|
|
451
|
-
description: NEW_UNTITLED_FILE_LABEL,
|
|
452
|
-
args: [
|
|
453
|
-
{
|
|
454
|
-
isOptional: true,
|
|
455
|
-
name: 'New Untitled Text File arguments',
|
|
456
|
-
description: 'The editor view type or language ID if known',
|
|
457
|
-
schema: {
|
|
458
|
-
'type': 'object',
|
|
459
|
-
'properties': {
|
|
460
|
-
'viewType': {
|
|
461
|
-
'type': 'string'
|
|
462
|
-
},
|
|
463
|
-
'languageId': {
|
|
464
|
-
'type': 'string'
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
]
|
|
470
|
-
},
|
|
471
|
-
handler: async (accessor, args) => {
|
|
472
|
-
const editorService = accessor.get(IEditorService);
|
|
473
|
-
await editorService.openEditor({
|
|
474
|
-
resource: undefined,
|
|
475
|
-
options: {
|
|
476
|
-
override: args?.viewType,
|
|
477
|
-
pinned: true
|
|
478
|
-
},
|
|
479
|
-
languageId: args?.languageId,
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
CommandsRegistry.registerCommand({
|
|
484
|
-
id: NEW_FILE_COMMAND_ID,
|
|
485
|
-
handler: async (accessor, args) => {
|
|
486
|
-
const editorService = accessor.get(IEditorService);
|
|
487
|
-
const dialogService = accessor.get(IFileDialogService);
|
|
488
|
-
const fileService = accessor.get(IFileService);
|
|
489
|
-
const createFileLocalized = ( localizeWithPath(
|
|
490
|
-
'vs/workbench/contrib/files/browser/fileCommands',
|
|
491
|
-
'newFileCommand.saveLabel',
|
|
492
|
-
"Create File"
|
|
493
|
-
));
|
|
494
|
-
const defaultFileUri = joinPath(await dialogService.defaultFilePath(), args?.fileName ?? 'Untitled.txt');
|
|
495
|
-
const saveUri = await dialogService.showSaveDialog({ saveLabel: createFileLocalized, title: createFileLocalized, defaultUri: defaultFileUri });
|
|
496
|
-
if (!saveUri) {
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
await fileService.createFile(saveUri, undefined, { overwrite: true });
|
|
500
|
-
await editorService.openEditor({
|
|
501
|
-
resource: saveUri,
|
|
502
|
-
options: {
|
|
503
|
-
override: args?.viewType,
|
|
504
|
-
pinned: true
|
|
505
|
-
},
|
|
506
|
-
languageId: args?.languageId,
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
export { newWindowCommand, openWindowCommand };
|