@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.2

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