@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,511 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import './media/editordroptarget.css.js';
3
- import { DataTransfers } from 'vscode/vscode/vs/base/browser/dnd';
4
- import { DragAndDropObserver, EventHelper, addDisposableListener, EventType, getWindow, isAncestor } from 'vscode/vscode/vs/base/browser/dom';
5
- import { renderFormattedText } from 'vscode/vscode/vs/base/browser/formattedTextRenderer';
6
- import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
7
- import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
8
- import { isMacintosh, isWeb } from 'vscode/vscode/vs/base/common/platform';
9
- import { assertIsDefined, assertAllDefined } from 'vscode/vscode/vs/base/common/types';
10
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
11
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
12
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
13
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
14
- import { activeContrastBorder } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
15
- import { Themable, IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
16
- import { isTemporaryWorkspace, IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
17
- import { LocalSelectionTransfer, Extensions, containsDragType, CodeDataTransfers } from 'vscode/vscode/vs/platform/dnd/browser/dnd';
18
- import { DraggedEditorGroupIdentifier, DraggedEditorIdentifier, extractTreeDropData, ResourcesDropHandler } from 'vscode/vscode/vs/workbench/browser/dnd';
19
- import { fillActiveEditorViewState } from 'vscode/vscode/vs/workbench/browser/parts/editor/editor';
20
- import { EDITOR_DRAG_AND_DROP_BACKGROUND, EDITOR_DROP_INTO_PROMPT_BACKGROUND, EDITOR_DROP_INTO_PROMPT_FOREGROUND, EDITOR_DROP_INTO_PROMPT_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
21
- import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
22
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
23
- import { ITreeViewsDnDService } from 'vscode/vscode/vs/editor/common/services/treeViewsDndService';
24
- import { DraggedTreeItemsIdentifier } from 'vscode/vscode/vs/editor/common/services/treeViewsDnd';
25
-
26
- var DropOverlay_1;
27
- function isDropIntoEditorEnabledGlobally(configurationService) {
28
- return configurationService.getValue('editor.dropIntoEditor.enabled');
29
- }
30
- function isDragIntoEditorEvent(e) {
31
- return e.shiftKey;
32
- }
33
- let DropOverlay = class DropOverlay extends Themable {
34
- static { DropOverlay_1 = this; }
35
- static { this.OVERLAY_ID = 'monaco-workbench-editor-drop-overlay'; }
36
- get disposed() { return !!this._disposed; }
37
- constructor(groupView, themeService, configurationService, instantiationService, editorService, editorGroupService, treeViewsDragAndDropService, contextService) {
38
- super(themeService);
39
- this.groupView = groupView;
40
- this.configurationService = configurationService;
41
- this.instantiationService = instantiationService;
42
- this.editorService = editorService;
43
- this.editorGroupService = editorGroupService;
44
- this.treeViewsDragAndDropService = treeViewsDragAndDropService;
45
- this.contextService = contextService;
46
- this.editorTransfer = LocalSelectionTransfer.getInstance();
47
- this.groupTransfer = LocalSelectionTransfer.getInstance();
48
- this.treeItemsTransfer = LocalSelectionTransfer.getInstance();
49
- this.cleanupOverlayScheduler = this._register(( new RunOnceScheduler(() => this.dispose(), 300)));
50
- this.enableDropIntoEditor = isDropIntoEditorEnabledGlobally(this.configurationService) && this.isDropIntoActiveEditorEnabled();
51
- this.create();
52
- }
53
- create() {
54
- const overlayOffsetHeight = this.getOverlayOffsetHeight();
55
- const container = this.container = document.createElement('div');
56
- container.id = DropOverlay_1.OVERLAY_ID;
57
- container.style.top = `${overlayOffsetHeight}px`;
58
- this.groupView.element.appendChild(container);
59
- this.groupView.element.classList.add('dragged-over');
60
- this._register(toDisposable(() => {
61
- this.groupView.element.removeChild(container);
62
- this.groupView.element.classList.remove('dragged-over');
63
- }));
64
- this.overlay = document.createElement('div');
65
- this.overlay.classList.add('editor-group-overlay-indicator');
66
- container.appendChild(this.overlay);
67
- if (this.enableDropIntoEditor) {
68
- this.dropIntoPromptElement = renderFormattedText(( localizeWithPath(
69
- 'vs/workbench/browser/parts/editor/editorDropTarget',
70
- 'dropIntoEditorPrompt',
71
- "Hold __{0}__ to drop into editor",
72
- isMacintosh ? '⇧' : 'Shift'
73
- )), {});
74
- this.dropIntoPromptElement.classList.add('editor-group-overlay-drop-into-prompt');
75
- this.overlay.appendChild(this.dropIntoPromptElement);
76
- }
77
- this.registerListeners(container);
78
- this.updateStyles();
79
- }
80
- updateStyles() {
81
- const overlay = assertIsDefined(this.overlay);
82
- overlay.style.backgroundColor = this.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND) || '';
83
- const activeContrastBorderColor = this.getColor(activeContrastBorder);
84
- overlay.style.outlineColor = activeContrastBorderColor || '';
85
- overlay.style.outlineOffset = activeContrastBorderColor ? '-2px' : '';
86
- overlay.style.outlineStyle = activeContrastBorderColor ? 'dashed' : '';
87
- overlay.style.outlineWidth = activeContrastBorderColor ? '2px' : '';
88
- if (this.dropIntoPromptElement) {
89
- this.dropIntoPromptElement.style.backgroundColor = this.getColor(EDITOR_DROP_INTO_PROMPT_BACKGROUND) ?? '';
90
- this.dropIntoPromptElement.style.color = this.getColor(EDITOR_DROP_INTO_PROMPT_FOREGROUND) ?? '';
91
- const borderColor = this.getColor(EDITOR_DROP_INTO_PROMPT_BORDER);
92
- if (borderColor) {
93
- this.dropIntoPromptElement.style.borderWidth = '1px';
94
- this.dropIntoPromptElement.style.borderStyle = 'solid';
95
- this.dropIntoPromptElement.style.borderColor = borderColor;
96
- }
97
- else {
98
- this.dropIntoPromptElement.style.borderWidth = '0';
99
- }
100
- }
101
- }
102
- registerListeners(container) {
103
- this._register(( new DragAndDropObserver(container, {
104
- onDragOver: e => {
105
- if (this.enableDropIntoEditor && isDragIntoEditorEvent(e)) {
106
- this.dispose();
107
- return;
108
- }
109
- const isDraggingGroup = this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype);
110
- const isDraggingEditor = this.editorTransfer.hasData(DraggedEditorIdentifier.prototype);
111
- if (!isDraggingEditor && !isDraggingGroup && e.dataTransfer) {
112
- e.dataTransfer.dropEffect = 'copy';
113
- }
114
- let isCopy = true;
115
- if (isDraggingGroup) {
116
- isCopy = this.isCopyOperation(e);
117
- }
118
- else if (isDraggingEditor) {
119
- const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
120
- if (Array.isArray(data)) {
121
- isCopy = this.isCopyOperation(e, data[0].identifier);
122
- }
123
- }
124
- if (!isCopy) {
125
- const sourceGroupView = this.findSourceGroupView();
126
- if (sourceGroupView === this.groupView) {
127
- if (isDraggingGroup || (isDraggingEditor && sourceGroupView.count < 2)) {
128
- this.hideOverlay();
129
- return;
130
- }
131
- }
132
- }
133
- let splitOnDragAndDrop = !!this.editorGroupService.partOptions.splitOnDragAndDrop;
134
- if (this.isToggleSplitOperation(e)) {
135
- splitOnDragAndDrop = !splitOnDragAndDrop;
136
- }
137
- this.positionOverlay(e.offsetX, e.offsetY, isDraggingGroup, splitOnDragAndDrop);
138
- if (this.cleanupOverlayScheduler.isScheduled()) {
139
- this.cleanupOverlayScheduler.cancel();
140
- }
141
- },
142
- onDragLeave: e => this.dispose(),
143
- onDragEnd: e => this.dispose(),
144
- onDrop: e => {
145
- EventHelper.stop(e, true);
146
- this.dispose();
147
- if (this.currentDropOperation) {
148
- this.handleDrop(e, this.currentDropOperation.splitDirection);
149
- }
150
- }
151
- })));
152
- this._register(addDisposableListener(container, EventType.MOUSE_OVER, () => {
153
- if (!this.cleanupOverlayScheduler.isScheduled()) {
154
- this.cleanupOverlayScheduler.schedule();
155
- }
156
- }));
157
- }
158
- isDropIntoActiveEditorEnabled() {
159
- return !!this.groupView.activeEditor?.hasCapability(128 );
160
- }
161
- findSourceGroupView() {
162
- if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
163
- const data = this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype);
164
- if (Array.isArray(data)) {
165
- return this.editorGroupService.getGroup(data[0].identifier);
166
- }
167
- }
168
- else if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
169
- const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
170
- if (Array.isArray(data)) {
171
- return this.editorGroupService.getGroup(data[0].identifier.groupId);
172
- }
173
- }
174
- return undefined;
175
- }
176
- async handleDrop(event, splitDirection) {
177
- const ensureTargetGroup = () => {
178
- let targetGroup;
179
- if (typeof splitDirection === 'number') {
180
- targetGroup = this.editorGroupService.addGroup(this.groupView, splitDirection);
181
- }
182
- else {
183
- targetGroup = this.groupView;
184
- }
185
- return targetGroup;
186
- };
187
- if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
188
- const data = this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype);
189
- if (Array.isArray(data)) {
190
- const sourceGroup = this.editorGroupService.getGroup(data[0].identifier);
191
- if (sourceGroup) {
192
- if (typeof splitDirection !== 'number' && sourceGroup === this.groupView) {
193
- return;
194
- }
195
- let targetGroup;
196
- if (typeof splitDirection === 'number') {
197
- if (this.isCopyOperation(event)) {
198
- targetGroup = this.editorGroupService.copyGroup(sourceGroup, this.groupView, splitDirection);
199
- }
200
- else {
201
- targetGroup = this.editorGroupService.moveGroup(sourceGroup, this.groupView, splitDirection);
202
- }
203
- }
204
- else {
205
- let mergeGroupOptions = undefined;
206
- if (this.isCopyOperation(event)) {
207
- mergeGroupOptions = { mode: 0 };
208
- }
209
- this.editorGroupService.mergeGroup(sourceGroup, this.groupView, mergeGroupOptions);
210
- }
211
- if (targetGroup) {
212
- this.editorGroupService.activateGroup(targetGroup);
213
- }
214
- }
215
- this.groupTransfer.clearData(DraggedEditorGroupIdentifier.prototype);
216
- }
217
- }
218
- else if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
219
- const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
220
- if (Array.isArray(data)) {
221
- const draggedEditor = data[0].identifier;
222
- const sourceGroup = this.editorGroupService.getGroup(draggedEditor.groupId);
223
- if (sourceGroup) {
224
- const copyEditor = this.isCopyOperation(event, draggedEditor);
225
- let targetGroup = undefined;
226
- if (this.editorGroupService.partOptions.closeEmptyGroups && sourceGroup.count === 1 && typeof splitDirection === 'number' && !copyEditor) {
227
- targetGroup = this.editorGroupService.moveGroup(sourceGroup, this.groupView, splitDirection);
228
- }
229
- else {
230
- targetGroup = ensureTargetGroup();
231
- if (sourceGroup === targetGroup) {
232
- return;
233
- }
234
- const options = fillActiveEditorViewState(sourceGroup, draggedEditor.editor, {
235
- pinned: true,
236
- sticky: sourceGroup.isSticky(draggedEditor.editor),
237
- });
238
- if (!copyEditor) {
239
- sourceGroup.moveEditor(draggedEditor.editor, targetGroup, options);
240
- }
241
- else {
242
- sourceGroup.copyEditor(draggedEditor.editor, targetGroup, options);
243
- }
244
- }
245
- targetGroup.focus();
246
- }
247
- this.editorTransfer.clearData(DraggedEditorIdentifier.prototype);
248
- }
249
- }
250
- else if (this.treeItemsTransfer.hasData(DraggedTreeItemsIdentifier.prototype)) {
251
- const data = this.treeItemsTransfer.getData(DraggedTreeItemsIdentifier.prototype);
252
- if (Array.isArray(data)) {
253
- const editors = [];
254
- for (const id of data) {
255
- const dataTransferItem = await this.treeViewsDragAndDropService.removeDragOperationTransfer(id.identifier);
256
- if (dataTransferItem) {
257
- const treeDropData = await extractTreeDropData(dataTransferItem);
258
- editors.push(...( treeDropData.map(editor => ({ ...editor, options: { ...editor.options, pinned: true } }))));
259
- }
260
- }
261
- if (editors.length) {
262
- this.editorService.openEditors(editors, ensureTargetGroup(), { validateTrust: true });
263
- }
264
- }
265
- this.treeItemsTransfer.clearData(DraggedTreeItemsIdentifier.prototype);
266
- }
267
- else {
268
- const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: !isWeb || isTemporaryWorkspace(this.contextService.getWorkspace()) });
269
- dropHandler.handleDrop(event, getWindow(this.groupView.element), () => ensureTargetGroup(), targetGroup => targetGroup?.focus());
270
- }
271
- }
272
- isCopyOperation(e, draggedEditor) {
273
- if (draggedEditor?.editor.hasCapability(8 )) {
274
- return false;
275
- }
276
- return (e.ctrlKey && !isMacintosh) || (e.altKey && isMacintosh);
277
- }
278
- isToggleSplitOperation(e) {
279
- return (e.altKey && !isMacintosh) || (e.shiftKey && isMacintosh);
280
- }
281
- positionOverlay(mousePosX, mousePosY, isDraggingGroup, enableSplitting) {
282
- const preferSplitVertically = this.editorGroupService.partOptions.openSideBySideDirection === 'right';
283
- const editorControlWidth = this.groupView.element.clientWidth;
284
- const editorControlHeight = this.groupView.element.clientHeight - this.getOverlayOffsetHeight();
285
- let edgeWidthThresholdFactor;
286
- let edgeHeightThresholdFactor;
287
- if (enableSplitting) {
288
- if (isDraggingGroup) {
289
- edgeWidthThresholdFactor = preferSplitVertically ? 0.3 : 0.1;
290
- }
291
- else {
292
- edgeWidthThresholdFactor = 0.1;
293
- }
294
- if (isDraggingGroup) {
295
- edgeHeightThresholdFactor = preferSplitVertically ? 0.1 : 0.3;
296
- }
297
- else {
298
- edgeHeightThresholdFactor = 0.1;
299
- }
300
- }
301
- else {
302
- edgeWidthThresholdFactor = 0;
303
- edgeHeightThresholdFactor = 0;
304
- }
305
- const edgeWidthThreshold = editorControlWidth * edgeWidthThresholdFactor;
306
- const edgeHeightThreshold = editorControlHeight * edgeHeightThresholdFactor;
307
- const splitWidthThreshold = editorControlWidth / 3;
308
- const splitHeightThreshold = editorControlHeight / 3;
309
- let splitDirection;
310
- if (mousePosX > edgeWidthThreshold && mousePosX < editorControlWidth - edgeWidthThreshold &&
311
- mousePosY > edgeHeightThreshold && mousePosY < editorControlHeight - edgeHeightThreshold) {
312
- splitDirection = undefined;
313
- }
314
- else {
315
- if (preferSplitVertically) {
316
- if (mousePosX < splitWidthThreshold) {
317
- splitDirection = 2 ;
318
- }
319
- else if (mousePosX > splitWidthThreshold * 2) {
320
- splitDirection = 3 ;
321
- }
322
- else if (mousePosY < editorControlHeight / 2) {
323
- splitDirection = 0 ;
324
- }
325
- else {
326
- splitDirection = 1 ;
327
- }
328
- }
329
- else {
330
- if (mousePosY < splitHeightThreshold) {
331
- splitDirection = 0 ;
332
- }
333
- else if (mousePosY > splitHeightThreshold * 2) {
334
- splitDirection = 1 ;
335
- }
336
- else if (mousePosX < editorControlWidth / 2) {
337
- splitDirection = 2 ;
338
- }
339
- else {
340
- splitDirection = 3 ;
341
- }
342
- }
343
- }
344
- switch (splitDirection) {
345
- case 0 :
346
- this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '50%' });
347
- this.toggleDropIntoPrompt(false);
348
- break;
349
- case 1 :
350
- this.doPositionOverlay({ top: '50%', left: '0', width: '100%', height: '50%' });
351
- this.toggleDropIntoPrompt(false);
352
- break;
353
- case 2 :
354
- this.doPositionOverlay({ top: '0', left: '0', width: '50%', height: '100%' });
355
- this.toggleDropIntoPrompt(false);
356
- break;
357
- case 3 :
358
- this.doPositionOverlay({ top: '0', left: '50%', width: '50%', height: '100%' });
359
- this.toggleDropIntoPrompt(false);
360
- break;
361
- default:
362
- this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '100%' });
363
- this.toggleDropIntoPrompt(true);
364
- }
365
- const overlay = assertIsDefined(this.overlay);
366
- overlay.style.opacity = '1';
367
- setTimeout(() => overlay.classList.add('overlay-move-transition'), 0);
368
- this.currentDropOperation = { splitDirection };
369
- }
370
- doPositionOverlay(options) {
371
- const [container, overlay] = assertAllDefined(this.container, this.overlay);
372
- const offsetHeight = this.getOverlayOffsetHeight();
373
- if (offsetHeight) {
374
- container.style.height = `calc(100% - ${offsetHeight}px)`;
375
- }
376
- else {
377
- container.style.height = '100%';
378
- }
379
- overlay.style.top = options.top;
380
- overlay.style.left = options.left;
381
- overlay.style.width = options.width;
382
- overlay.style.height = options.height;
383
- }
384
- getOverlayOffsetHeight() {
385
- if (!this.groupView.isEmpty && this.editorGroupService.partOptions.showTabs === 'multiple') {
386
- return this.groupView.titleHeight.offset;
387
- }
388
- return 0;
389
- }
390
- hideOverlay() {
391
- const overlay = assertIsDefined(this.overlay);
392
- this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '100%' });
393
- overlay.style.opacity = '0';
394
- overlay.classList.remove('overlay-move-transition');
395
- this.currentDropOperation = undefined;
396
- }
397
- toggleDropIntoPrompt(showing) {
398
- if (!this.dropIntoPromptElement) {
399
- return;
400
- }
401
- this.dropIntoPromptElement.style.opacity = showing ? '1' : '0';
402
- }
403
- contains(element) {
404
- return element === this.container || element === this.overlay;
405
- }
406
- dispose() {
407
- super.dispose();
408
- this._disposed = true;
409
- }
410
- };
411
- DropOverlay = DropOverlay_1 = ( __decorate([
412
- ( __param(1, IThemeService)),
413
- ( __param(2, IConfigurationService)),
414
- ( __param(3, IInstantiationService)),
415
- ( __param(4, IEditorService)),
416
- ( __param(5, IEditorGroupsService)),
417
- ( __param(6, ITreeViewsDnDService)),
418
- ( __param(7, IWorkspaceContextService))
419
- ], DropOverlay));
420
- let EditorDropTarget = class EditorDropTarget extends Themable {
421
- constructor(container, delegate, editorGroupService, themeService, configurationService, instantiationService) {
422
- super(themeService);
423
- this.container = container;
424
- this.delegate = delegate;
425
- this.editorGroupService = editorGroupService;
426
- this.configurationService = configurationService;
427
- this.instantiationService = instantiationService;
428
- this.counter = 0;
429
- this.editorTransfer = LocalSelectionTransfer.getInstance();
430
- this.groupTransfer = LocalSelectionTransfer.getInstance();
431
- this.registerListeners();
432
- }
433
- get overlay() {
434
- if (this._overlay && !this._overlay.disposed) {
435
- return this._overlay;
436
- }
437
- return undefined;
438
- }
439
- registerListeners() {
440
- this._register(addDisposableListener(this.container, EventType.DRAG_ENTER, e => this.onDragEnter(e)));
441
- this._register(addDisposableListener(this.container, EventType.DRAG_LEAVE, () => this.onDragLeave()));
442
- for (const target of [this.container, getWindow(this.container)]) {
443
- this._register(addDisposableListener(target, EventType.DRAG_END, () => this.onDragEnd()));
444
- }
445
- }
446
- onDragEnter(event) {
447
- if (isDropIntoEditorEnabledGlobally(this.configurationService) && isDragIntoEditorEvent(event)) {
448
- return;
449
- }
450
- this.counter++;
451
- if (!this.editorTransfer.hasData(DraggedEditorIdentifier.prototype) &&
452
- !this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype) &&
453
- event.dataTransfer) {
454
- const dndContributions = ( Registry.as(Extensions.DragAndDropContribution)).getAll();
455
- const dndContributionKeys = ( Array.from(dndContributions).map(e => e.dataFormatKey));
456
- if (!containsDragType(event, DataTransfers.FILES, CodeDataTransfers.FILES, DataTransfers.RESOURCES, CodeDataTransfers.EDITORS, ...dndContributionKeys)) {
457
- event.dataTransfer.dropEffect = 'none';
458
- return;
459
- }
460
- }
461
- this.updateContainer(true);
462
- const target = event.target;
463
- if (target) {
464
- if (this.overlay && !this.overlay.contains(target)) {
465
- this.disposeOverlay();
466
- }
467
- if (!this.overlay) {
468
- const targetGroupView = this.findTargetGroupView(target);
469
- if (targetGroupView) {
470
- this._overlay = this.instantiationService.createInstance(DropOverlay, targetGroupView);
471
- }
472
- }
473
- }
474
- }
475
- onDragLeave() {
476
- this.counter--;
477
- if (this.counter === 0) {
478
- this.updateContainer(false);
479
- }
480
- }
481
- onDragEnd() {
482
- this.counter = 0;
483
- this.updateContainer(false);
484
- this.disposeOverlay();
485
- }
486
- findTargetGroupView(child) {
487
- const groups = this.editorGroupService.groups;
488
- return groups.find(groupView => isAncestor(child, groupView.element) || this.delegate.containsGroup?.(groupView));
489
- }
490
- updateContainer(isDraggedOver) {
491
- this.container.classList.toggle('dragged-over', isDraggedOver);
492
- }
493
- dispose() {
494
- super.dispose();
495
- this.disposeOverlay();
496
- }
497
- disposeOverlay() {
498
- if (this.overlay) {
499
- this.overlay.dispose();
500
- this._overlay = undefined;
501
- }
502
- }
503
- };
504
- EditorDropTarget = ( __decorate([
505
- ( __param(2, IEditorGroupsService)),
506
- ( __param(3, IThemeService)),
507
- ( __param(4, IConfigurationService)),
508
- ( __param(5, IInstantiationService))
509
- ], EditorDropTarget));
510
-
511
- export { EditorDropTarget };
@@ -1,112 +0,0 @@
1
- import { Composite } from 'vscode/vscode/vs/workbench/browser/composite';
2
- import { IEditorPane, IEditorOpenContext, IEditorMemento } from 'vscode/vscode/vs/workbench/common/editor';
3
- import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
4
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
5
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
6
- import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
7
- import { IEditorGroup, IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
8
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
9
- import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
10
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
11
- import { IEditorOptions } from 'vscode/vscode/vs/platform/editor/common/editor';
12
- import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
13
- import { IBoundarySashes } from 'vscode/vscode/vs/base/browser/ui/sash/sash';
14
-
15
- /**
16
- * The base class of editors in the workbench. Editors register themselves for specific editor inputs.
17
- * Editors are layed out in the editor part of the workbench in editor groups. Multiple editors can be
18
- * open at the same time. Each editor has a minimized representation that is good enough to provide some
19
- * information about the state of the editor data.
20
- *
21
- * The workbench will keep an editor alive after it has been created and show/hide it based on
22
- * user interaction. The lifecycle of a editor goes in the order:
23
- *
24
- * - `createEditor()`
25
- * - `setEditorVisible()`
26
- * - `layout()`
27
- * - `setInput()`
28
- * - `focus()`
29
- * - `dispose()`: when the editor group the editor is in closes
30
- *
31
- * During use of the workbench, a editor will often receive a `clearInput()`, `setEditorVisible()`, `layout()` and
32
- * `focus()` calls, but only one `create()` and `dispose()` call.
33
- *
34
- * This class is only intended to be subclassed and not instantiated.
35
- */
36
- declare abstract class EditorPane extends Composite implements IEditorPane {
37
- readonly onDidChangeSizeConstraints: Event<any>;
38
- protected readonly _onDidChangeControl: Emitter<void>;
39
- readonly onDidChangeControl: Event<void>;
40
- private static readonly EDITOR_MEMENTOS;
41
- get minimumWidth(): number;
42
- get maximumWidth(): number;
43
- get minimumHeight(): number;
44
- get maximumHeight(): number;
45
- protected _input: EditorInput | undefined;
46
- get input(): EditorInput | undefined;
47
- protected _options: IEditorOptions | undefined;
48
- get options(): IEditorOptions | undefined;
49
- private _group;
50
- get group(): IEditorGroup | undefined;
51
- /**
52
- * Should be overridden by editors that have their own ScopedContextKeyService
53
- */
54
- get scopedContextKeyService(): IContextKeyService | undefined;
55
- constructor(id: string, telemetryService: ITelemetryService, themeService: IThemeService, storageService: IStorageService);
56
- create(parent: HTMLElement): void;
57
- /**
58
- * Called to create the editor in the parent HTMLElement. Subclasses implement
59
- * this method to construct the editor widget.
60
- */
61
- protected abstract createEditor(parent: HTMLElement): void;
62
- /**
63
- * Note: Clients should not call this method, the workbench calls this
64
- * method. Calling it otherwise may result in unexpected behavior.
65
- *
66
- * Sets the given input with the options to the editor. The input is guaranteed
67
- * to be different from the previous input that was set using the `input.matches()`
68
- * method.
69
- *
70
- * The provided context gives more information around how the editor was opened.
71
- *
72
- * The provided cancellation token should be used to test if the operation
73
- * was cancelled.
74
- */
75
- setInput(input: EditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void>;
76
- /**
77
- * Called to indicate to the editor that the input should be cleared and
78
- * resources associated with the input should be freed.
79
- *
80
- * This method can be called based on different contexts, e.g. when opening
81
- * a different input or different editor control or when closing all editors
82
- * in a group.
83
- *
84
- * To monitor the lifecycle of editor inputs, you should not rely on this
85
- * method, rather refer to the listeners on `IEditorGroup` via `IEditorGroupsService`.
86
- */
87
- clearInput(): void;
88
- /**
89
- * Note: Clients should not call this method, the workbench calls this
90
- * method. Calling it otherwise may result in unexpected behavior.
91
- *
92
- * Sets the given options to the editor. Clients should apply the options
93
- * to the current input.
94
- */
95
- setOptions(options: IEditorOptions | undefined): void;
96
- setVisible(visible: boolean, group?: IEditorGroup): void;
97
- /**
98
- * Indicates that the editor control got visible or hidden in a specific group. A
99
- * editor instance will only ever be visible in one editor group.
100
- *
101
- * @param visible the state of visibility of this editor
102
- * @param group the editor group this editor is in.
103
- */
104
- protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void;
105
- setBoundarySashes(_sashes: IBoundarySashes): void;
106
- protected getEditorMemento<T>(editorGroupService: IEditorGroupsService, configurationService: ITextResourceConfigurationService, key: string, limit?: number): IEditorMemento<T>;
107
- getViewState(): object | undefined;
108
- protected saveState(): void;
109
- dispose(): void;
110
- }
111
-
112
- export { EditorPane };