@codingame/monaco-vscode-view-common-service-override 4.5.0-improve-code-splitting.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/assets/fake.html +10 -0
- package/assets/index-no-csp.html +1230 -0
- package/assets/index.html +1231 -0
- package/assets/service-worker.js +457 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.js +5 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +11 -0
- package/package.json +32 -0
- package/tools/editorAssets.js +4 -0
- package/tools/url.js +10 -0
- package/viewCommon.d.ts +5 -0
- package/viewCommon.js +105 -0
- package/vscode/src/vs/base/browser/deviceAccess.js +61 -0
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +180 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +494 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1113 -0
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +12 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +24 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +64 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +907 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +764 -0
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +301 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +671 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +229 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +606 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +346 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +246 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1403 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +188 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +523 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1030 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +391 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +472 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +68 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +160 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarActions.js +39 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +238 -0
- package/vscode/src/vs/workbench/browser/style.js +54 -0
- package/vscode/src/vs/workbench/browser/window.js +381 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +300 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +367 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +135 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +18 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +146 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +215 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +78 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +56 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +63 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +183 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +8 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +147 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +635 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +230 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +75 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +42 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +81 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +350 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +100 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +148 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +106 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +403 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +199 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +41 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +128 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +619 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +161 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +266 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +173 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +195 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +38 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +41 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +283 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +362 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +314 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +96 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +98 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +656 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +65 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +59 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +143 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +121 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +234 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewService.js +45 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +145 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +341 -0
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +186 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorPaneService.js +13 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +676 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1516 -0
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +6 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +527 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +102 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +133 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +603 -0
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/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.service';
|
|
12
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
14
|
+
import 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
15
|
+
import { activeContrastBorder } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
16
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
17
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
18
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
19
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
20
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
21
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
22
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
23
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
24
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
25
|
+
import { Themable } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
26
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
27
|
+
import { isTemporaryWorkspace } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
28
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
29
|
+
import { LocalSelectionTransfer, Extensions, containsDragType, CodeDataTransfers } from 'vscode/vscode/vs/platform/dnd/browser/dnd';
|
|
30
|
+
import { DraggedEditorGroupIdentifier, DraggedEditorIdentifier, extractTreeDropData, ResourcesDropHandler } from 'vscode/vscode/vs/workbench/browser/dnd';
|
|
31
|
+
import { fillActiveEditorViewState } from 'vscode/vscode/vs/workbench/browser/parts/editor/editor';
|
|
32
|
+
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';
|
|
33
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
34
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
35
|
+
import { ITreeViewsDnDService } from 'vscode/vscode/vs/editor/common/services/treeViewsDndService';
|
|
36
|
+
import { DraggedTreeItemsIdentifier } from 'vscode/vscode/vs/editor/common/services/treeViewsDnd';
|
|
37
|
+
|
|
38
|
+
var DropOverlay_1;
|
|
39
|
+
function isDropIntoEditorEnabledGlobally(configurationService) {
|
|
40
|
+
return configurationService.getValue('editor.dropIntoEditor.enabled');
|
|
41
|
+
}
|
|
42
|
+
function isDragIntoEditorEvent(e) {
|
|
43
|
+
return e.shiftKey;
|
|
44
|
+
}
|
|
45
|
+
let DropOverlay = class DropOverlay extends Themable {
|
|
46
|
+
static { DropOverlay_1 = this; }
|
|
47
|
+
static { this.OVERLAY_ID = 'monaco-workbench-editor-drop-overlay'; }
|
|
48
|
+
get disposed() { return !!this._disposed; }
|
|
49
|
+
constructor(groupView, themeService, configurationService, instantiationService, editorService, editorGroupService, treeViewsDragAndDropService, contextService) {
|
|
50
|
+
super(themeService);
|
|
51
|
+
this.groupView = groupView;
|
|
52
|
+
this.configurationService = configurationService;
|
|
53
|
+
this.instantiationService = instantiationService;
|
|
54
|
+
this.editorService = editorService;
|
|
55
|
+
this.editorGroupService = editorGroupService;
|
|
56
|
+
this.treeViewsDragAndDropService = treeViewsDragAndDropService;
|
|
57
|
+
this.contextService = contextService;
|
|
58
|
+
this.editorTransfer = LocalSelectionTransfer.getInstance();
|
|
59
|
+
this.groupTransfer = LocalSelectionTransfer.getInstance();
|
|
60
|
+
this.treeItemsTransfer = LocalSelectionTransfer.getInstance();
|
|
61
|
+
this.cleanupOverlayScheduler = this._register(( new RunOnceScheduler(() => this.dispose(), 300)));
|
|
62
|
+
this.enableDropIntoEditor = isDropIntoEditorEnabledGlobally(this.configurationService) && this.isDropIntoActiveEditorEnabled();
|
|
63
|
+
this.create();
|
|
64
|
+
}
|
|
65
|
+
create() {
|
|
66
|
+
const overlayOffsetHeight = this.getOverlayOffsetHeight();
|
|
67
|
+
const container = this.container = document.createElement('div');
|
|
68
|
+
container.id = DropOverlay_1.OVERLAY_ID;
|
|
69
|
+
container.style.top = `${overlayOffsetHeight}px`;
|
|
70
|
+
this.groupView.element.appendChild(container);
|
|
71
|
+
this.groupView.element.classList.add('dragged-over');
|
|
72
|
+
this._register(toDisposable(() => {
|
|
73
|
+
this.groupView.element.removeChild(container);
|
|
74
|
+
this.groupView.element.classList.remove('dragged-over');
|
|
75
|
+
}));
|
|
76
|
+
this.overlay = document.createElement('div');
|
|
77
|
+
this.overlay.classList.add('editor-group-overlay-indicator');
|
|
78
|
+
container.appendChild(this.overlay);
|
|
79
|
+
if (this.enableDropIntoEditor) {
|
|
80
|
+
this.dropIntoPromptElement = renderFormattedText(( localizeWithPath(
|
|
81
|
+
'vs/workbench/browser/parts/editor/editorDropTarget',
|
|
82
|
+
'dropIntoEditorPrompt',
|
|
83
|
+
"Hold __{0}__ to drop into editor",
|
|
84
|
+
isMacintosh ? '⇧' : 'Shift'
|
|
85
|
+
)), {});
|
|
86
|
+
this.dropIntoPromptElement.classList.add('editor-group-overlay-drop-into-prompt');
|
|
87
|
+
this.overlay.appendChild(this.dropIntoPromptElement);
|
|
88
|
+
}
|
|
89
|
+
this.registerListeners(container);
|
|
90
|
+
this.updateStyles();
|
|
91
|
+
}
|
|
92
|
+
updateStyles() {
|
|
93
|
+
const overlay = assertIsDefined(this.overlay);
|
|
94
|
+
overlay.style.backgroundColor = this.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND) || '';
|
|
95
|
+
const activeContrastBorderColor = this.getColor(activeContrastBorder);
|
|
96
|
+
overlay.style.outlineColor = activeContrastBorderColor || '';
|
|
97
|
+
overlay.style.outlineOffset = activeContrastBorderColor ? '-2px' : '';
|
|
98
|
+
overlay.style.outlineStyle = activeContrastBorderColor ? 'dashed' : '';
|
|
99
|
+
overlay.style.outlineWidth = activeContrastBorderColor ? '2px' : '';
|
|
100
|
+
if (this.dropIntoPromptElement) {
|
|
101
|
+
this.dropIntoPromptElement.style.backgroundColor = this.getColor(EDITOR_DROP_INTO_PROMPT_BACKGROUND) ?? '';
|
|
102
|
+
this.dropIntoPromptElement.style.color = this.getColor(EDITOR_DROP_INTO_PROMPT_FOREGROUND) ?? '';
|
|
103
|
+
const borderColor = this.getColor(EDITOR_DROP_INTO_PROMPT_BORDER);
|
|
104
|
+
if (borderColor) {
|
|
105
|
+
this.dropIntoPromptElement.style.borderWidth = '1px';
|
|
106
|
+
this.dropIntoPromptElement.style.borderStyle = 'solid';
|
|
107
|
+
this.dropIntoPromptElement.style.borderColor = borderColor;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.dropIntoPromptElement.style.borderWidth = '0';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
registerListeners(container) {
|
|
115
|
+
this._register(( new DragAndDropObserver(container, {
|
|
116
|
+
onDragOver: e => {
|
|
117
|
+
if (this.enableDropIntoEditor && isDragIntoEditorEvent(e)) {
|
|
118
|
+
this.dispose();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const isDraggingGroup = this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype);
|
|
122
|
+
const isDraggingEditor = this.editorTransfer.hasData(DraggedEditorIdentifier.prototype);
|
|
123
|
+
if (!isDraggingEditor && !isDraggingGroup && e.dataTransfer) {
|
|
124
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
125
|
+
}
|
|
126
|
+
let isCopy = true;
|
|
127
|
+
if (isDraggingGroup) {
|
|
128
|
+
isCopy = this.isCopyOperation(e);
|
|
129
|
+
}
|
|
130
|
+
else if (isDraggingEditor) {
|
|
131
|
+
const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
|
|
132
|
+
if (Array.isArray(data)) {
|
|
133
|
+
isCopy = this.isCopyOperation(e, data[0].identifier);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (!isCopy) {
|
|
137
|
+
const sourceGroupView = this.findSourceGroupView();
|
|
138
|
+
if (sourceGroupView === this.groupView) {
|
|
139
|
+
if (isDraggingGroup || (isDraggingEditor && sourceGroupView.count < 2)) {
|
|
140
|
+
this.hideOverlay();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
let splitOnDragAndDrop = !!this.editorGroupService.partOptions.splitOnDragAndDrop;
|
|
146
|
+
if (this.isToggleSplitOperation(e)) {
|
|
147
|
+
splitOnDragAndDrop = !splitOnDragAndDrop;
|
|
148
|
+
}
|
|
149
|
+
this.positionOverlay(e.offsetX, e.offsetY, isDraggingGroup, splitOnDragAndDrop);
|
|
150
|
+
if (this.cleanupOverlayScheduler.isScheduled()) {
|
|
151
|
+
this.cleanupOverlayScheduler.cancel();
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
onDragLeave: e => this.dispose(),
|
|
155
|
+
onDragEnd: e => this.dispose(),
|
|
156
|
+
onDrop: e => {
|
|
157
|
+
EventHelper.stop(e, true);
|
|
158
|
+
this.dispose();
|
|
159
|
+
if (this.currentDropOperation) {
|
|
160
|
+
this.handleDrop(e, this.currentDropOperation.splitDirection);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
})));
|
|
164
|
+
this._register(addDisposableListener(container, EventType.MOUSE_OVER, () => {
|
|
165
|
+
if (!this.cleanupOverlayScheduler.isScheduled()) {
|
|
166
|
+
this.cleanupOverlayScheduler.schedule();
|
|
167
|
+
}
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
isDropIntoActiveEditorEnabled() {
|
|
171
|
+
return !!this.groupView.activeEditor?.hasCapability(128 );
|
|
172
|
+
}
|
|
173
|
+
findSourceGroupView() {
|
|
174
|
+
if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
|
|
175
|
+
const data = this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype);
|
|
176
|
+
if (Array.isArray(data)) {
|
|
177
|
+
return this.editorGroupService.getGroup(data[0].identifier);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
|
|
181
|
+
const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
|
|
182
|
+
if (Array.isArray(data)) {
|
|
183
|
+
return this.editorGroupService.getGroup(data[0].identifier.groupId);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
async handleDrop(event, splitDirection) {
|
|
189
|
+
const ensureTargetGroup = () => {
|
|
190
|
+
let targetGroup;
|
|
191
|
+
if (typeof splitDirection === 'number') {
|
|
192
|
+
targetGroup = this.editorGroupService.addGroup(this.groupView, splitDirection);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
targetGroup = this.groupView;
|
|
196
|
+
}
|
|
197
|
+
return targetGroup;
|
|
198
|
+
};
|
|
199
|
+
if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
|
|
200
|
+
const data = this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype);
|
|
201
|
+
if (Array.isArray(data)) {
|
|
202
|
+
const sourceGroup = this.editorGroupService.getGroup(data[0].identifier);
|
|
203
|
+
if (sourceGroup) {
|
|
204
|
+
if (typeof splitDirection !== 'number' && sourceGroup === this.groupView) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
let targetGroup;
|
|
208
|
+
if (typeof splitDirection === 'number') {
|
|
209
|
+
if (this.isCopyOperation(event)) {
|
|
210
|
+
targetGroup = this.editorGroupService.copyGroup(sourceGroup, this.groupView, splitDirection);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
targetGroup = this.editorGroupService.moveGroup(sourceGroup, this.groupView, splitDirection);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
let mergeGroupOptions = undefined;
|
|
218
|
+
if (this.isCopyOperation(event)) {
|
|
219
|
+
mergeGroupOptions = { mode: 0 };
|
|
220
|
+
}
|
|
221
|
+
this.editorGroupService.mergeGroup(sourceGroup, this.groupView, mergeGroupOptions);
|
|
222
|
+
}
|
|
223
|
+
if (targetGroup) {
|
|
224
|
+
this.editorGroupService.activateGroup(targetGroup);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this.groupTransfer.clearData(DraggedEditorGroupIdentifier.prototype);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
|
|
231
|
+
const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
|
|
232
|
+
if (Array.isArray(data)) {
|
|
233
|
+
const draggedEditor = data[0].identifier;
|
|
234
|
+
const sourceGroup = this.editorGroupService.getGroup(draggedEditor.groupId);
|
|
235
|
+
if (sourceGroup) {
|
|
236
|
+
const copyEditor = this.isCopyOperation(event, draggedEditor);
|
|
237
|
+
let targetGroup = undefined;
|
|
238
|
+
if (this.editorGroupService.partOptions.closeEmptyGroups && sourceGroup.count === 1 && typeof splitDirection === 'number' && !copyEditor) {
|
|
239
|
+
targetGroup = this.editorGroupService.moveGroup(sourceGroup, this.groupView, splitDirection);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
targetGroup = ensureTargetGroup();
|
|
243
|
+
if (sourceGroup === targetGroup) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const options = fillActiveEditorViewState(sourceGroup, draggedEditor.editor, {
|
|
247
|
+
pinned: true,
|
|
248
|
+
sticky: sourceGroup.isSticky(draggedEditor.editor),
|
|
249
|
+
});
|
|
250
|
+
if (!copyEditor) {
|
|
251
|
+
sourceGroup.moveEditor(draggedEditor.editor, targetGroup, options);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
sourceGroup.copyEditor(draggedEditor.editor, targetGroup, options);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
targetGroup.focus();
|
|
258
|
+
}
|
|
259
|
+
this.editorTransfer.clearData(DraggedEditorIdentifier.prototype);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else if (this.treeItemsTransfer.hasData(DraggedTreeItemsIdentifier.prototype)) {
|
|
263
|
+
const data = this.treeItemsTransfer.getData(DraggedTreeItemsIdentifier.prototype);
|
|
264
|
+
if (Array.isArray(data)) {
|
|
265
|
+
const editors = [];
|
|
266
|
+
for (const id of data) {
|
|
267
|
+
const dataTransferItem = await this.treeViewsDragAndDropService.removeDragOperationTransfer(id.identifier);
|
|
268
|
+
if (dataTransferItem) {
|
|
269
|
+
const treeDropData = await extractTreeDropData(dataTransferItem);
|
|
270
|
+
editors.push(...( treeDropData.map(editor => ({ ...editor, options: { ...editor.options, pinned: true } }))));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (editors.length) {
|
|
274
|
+
this.editorService.openEditors(editors, ensureTargetGroup(), { validateTrust: true });
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
this.treeItemsTransfer.clearData(DraggedTreeItemsIdentifier.prototype);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: !isWeb || isTemporaryWorkspace(this.contextService.getWorkspace()) });
|
|
281
|
+
dropHandler.handleDrop(event, getWindow(this.groupView.element), () => ensureTargetGroup(), targetGroup => targetGroup?.focus());
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
isCopyOperation(e, draggedEditor) {
|
|
285
|
+
if (draggedEditor?.editor.hasCapability(8 )) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
return (e.ctrlKey && !isMacintosh) || (e.altKey && isMacintosh);
|
|
289
|
+
}
|
|
290
|
+
isToggleSplitOperation(e) {
|
|
291
|
+
return (e.altKey && !isMacintosh) || (e.shiftKey && isMacintosh);
|
|
292
|
+
}
|
|
293
|
+
positionOverlay(mousePosX, mousePosY, isDraggingGroup, enableSplitting) {
|
|
294
|
+
const preferSplitVertically = this.editorGroupService.partOptions.openSideBySideDirection === 'right';
|
|
295
|
+
const editorControlWidth = this.groupView.element.clientWidth;
|
|
296
|
+
const editorControlHeight = this.groupView.element.clientHeight - this.getOverlayOffsetHeight();
|
|
297
|
+
let edgeWidthThresholdFactor;
|
|
298
|
+
let edgeHeightThresholdFactor;
|
|
299
|
+
if (enableSplitting) {
|
|
300
|
+
if (isDraggingGroup) {
|
|
301
|
+
edgeWidthThresholdFactor = preferSplitVertically ? 0.3 : 0.1;
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
edgeWidthThresholdFactor = 0.1;
|
|
305
|
+
}
|
|
306
|
+
if (isDraggingGroup) {
|
|
307
|
+
edgeHeightThresholdFactor = preferSplitVertically ? 0.1 : 0.3;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
edgeHeightThresholdFactor = 0.1;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
edgeWidthThresholdFactor = 0;
|
|
315
|
+
edgeHeightThresholdFactor = 0;
|
|
316
|
+
}
|
|
317
|
+
const edgeWidthThreshold = editorControlWidth * edgeWidthThresholdFactor;
|
|
318
|
+
const edgeHeightThreshold = editorControlHeight * edgeHeightThresholdFactor;
|
|
319
|
+
const splitWidthThreshold = editorControlWidth / 3;
|
|
320
|
+
const splitHeightThreshold = editorControlHeight / 3;
|
|
321
|
+
let splitDirection;
|
|
322
|
+
if (mousePosX > edgeWidthThreshold && mousePosX < editorControlWidth - edgeWidthThreshold &&
|
|
323
|
+
mousePosY > edgeHeightThreshold && mousePosY < editorControlHeight - edgeHeightThreshold) {
|
|
324
|
+
splitDirection = undefined;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
if (preferSplitVertically) {
|
|
328
|
+
if (mousePosX < splitWidthThreshold) {
|
|
329
|
+
splitDirection = 2 ;
|
|
330
|
+
}
|
|
331
|
+
else if (mousePosX > splitWidthThreshold * 2) {
|
|
332
|
+
splitDirection = 3 ;
|
|
333
|
+
}
|
|
334
|
+
else if (mousePosY < editorControlHeight / 2) {
|
|
335
|
+
splitDirection = 0 ;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
splitDirection = 1 ;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
if (mousePosY < splitHeightThreshold) {
|
|
343
|
+
splitDirection = 0 ;
|
|
344
|
+
}
|
|
345
|
+
else if (mousePosY > splitHeightThreshold * 2) {
|
|
346
|
+
splitDirection = 1 ;
|
|
347
|
+
}
|
|
348
|
+
else if (mousePosX < editorControlWidth / 2) {
|
|
349
|
+
splitDirection = 2 ;
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
splitDirection = 3 ;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
switch (splitDirection) {
|
|
357
|
+
case 0 :
|
|
358
|
+
this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '50%' });
|
|
359
|
+
this.toggleDropIntoPrompt(false);
|
|
360
|
+
break;
|
|
361
|
+
case 1 :
|
|
362
|
+
this.doPositionOverlay({ top: '50%', left: '0', width: '100%', height: '50%' });
|
|
363
|
+
this.toggleDropIntoPrompt(false);
|
|
364
|
+
break;
|
|
365
|
+
case 2 :
|
|
366
|
+
this.doPositionOverlay({ top: '0', left: '0', width: '50%', height: '100%' });
|
|
367
|
+
this.toggleDropIntoPrompt(false);
|
|
368
|
+
break;
|
|
369
|
+
case 3 :
|
|
370
|
+
this.doPositionOverlay({ top: '0', left: '50%', width: '50%', height: '100%' });
|
|
371
|
+
this.toggleDropIntoPrompt(false);
|
|
372
|
+
break;
|
|
373
|
+
default:
|
|
374
|
+
this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '100%' });
|
|
375
|
+
this.toggleDropIntoPrompt(true);
|
|
376
|
+
}
|
|
377
|
+
const overlay = assertIsDefined(this.overlay);
|
|
378
|
+
overlay.style.opacity = '1';
|
|
379
|
+
setTimeout(() => overlay.classList.add('overlay-move-transition'), 0);
|
|
380
|
+
this.currentDropOperation = { splitDirection };
|
|
381
|
+
}
|
|
382
|
+
doPositionOverlay(options) {
|
|
383
|
+
const [container, overlay] = assertAllDefined(this.container, this.overlay);
|
|
384
|
+
const offsetHeight = this.getOverlayOffsetHeight();
|
|
385
|
+
if (offsetHeight) {
|
|
386
|
+
container.style.height = `calc(100% - ${offsetHeight}px)`;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
container.style.height = '100%';
|
|
390
|
+
}
|
|
391
|
+
overlay.style.top = options.top;
|
|
392
|
+
overlay.style.left = options.left;
|
|
393
|
+
overlay.style.width = options.width;
|
|
394
|
+
overlay.style.height = options.height;
|
|
395
|
+
}
|
|
396
|
+
getOverlayOffsetHeight() {
|
|
397
|
+
if (!this.groupView.isEmpty && this.editorGroupService.partOptions.showTabs === 'multiple') {
|
|
398
|
+
return this.groupView.titleHeight.offset;
|
|
399
|
+
}
|
|
400
|
+
return 0;
|
|
401
|
+
}
|
|
402
|
+
hideOverlay() {
|
|
403
|
+
const overlay = assertIsDefined(this.overlay);
|
|
404
|
+
this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '100%' });
|
|
405
|
+
overlay.style.opacity = '0';
|
|
406
|
+
overlay.classList.remove('overlay-move-transition');
|
|
407
|
+
this.currentDropOperation = undefined;
|
|
408
|
+
}
|
|
409
|
+
toggleDropIntoPrompt(showing) {
|
|
410
|
+
if (!this.dropIntoPromptElement) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.dropIntoPromptElement.style.opacity = showing ? '1' : '0';
|
|
414
|
+
}
|
|
415
|
+
contains(element) {
|
|
416
|
+
return element === this.container || element === this.overlay;
|
|
417
|
+
}
|
|
418
|
+
dispose() {
|
|
419
|
+
super.dispose();
|
|
420
|
+
this._disposed = true;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
DropOverlay = DropOverlay_1 = ( __decorate([
|
|
424
|
+
( __param(1, IThemeService)),
|
|
425
|
+
( __param(2, IConfigurationService)),
|
|
426
|
+
( __param(3, IInstantiationService)),
|
|
427
|
+
( __param(4, IEditorService)),
|
|
428
|
+
( __param(5, IEditorGroupsService)),
|
|
429
|
+
( __param(6, ITreeViewsDnDService)),
|
|
430
|
+
( __param(7, IWorkspaceContextService))
|
|
431
|
+
], DropOverlay));
|
|
432
|
+
let EditorDropTarget = class EditorDropTarget extends Themable {
|
|
433
|
+
constructor(container, delegate, editorGroupService, themeService, configurationService, instantiationService) {
|
|
434
|
+
super(themeService);
|
|
435
|
+
this.container = container;
|
|
436
|
+
this.delegate = delegate;
|
|
437
|
+
this.editorGroupService = editorGroupService;
|
|
438
|
+
this.configurationService = configurationService;
|
|
439
|
+
this.instantiationService = instantiationService;
|
|
440
|
+
this.counter = 0;
|
|
441
|
+
this.editorTransfer = LocalSelectionTransfer.getInstance();
|
|
442
|
+
this.groupTransfer = LocalSelectionTransfer.getInstance();
|
|
443
|
+
this.registerListeners();
|
|
444
|
+
}
|
|
445
|
+
get overlay() {
|
|
446
|
+
if (this._overlay && !this._overlay.disposed) {
|
|
447
|
+
return this._overlay;
|
|
448
|
+
}
|
|
449
|
+
return undefined;
|
|
450
|
+
}
|
|
451
|
+
registerListeners() {
|
|
452
|
+
this._register(addDisposableListener(this.container, EventType.DRAG_ENTER, e => this.onDragEnter(e)));
|
|
453
|
+
this._register(addDisposableListener(this.container, EventType.DRAG_LEAVE, () => this.onDragLeave()));
|
|
454
|
+
for (const target of [this.container, getWindow(this.container)]) {
|
|
455
|
+
this._register(addDisposableListener(target, EventType.DRAG_END, () => this.onDragEnd()));
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
onDragEnter(event) {
|
|
459
|
+
if (isDropIntoEditorEnabledGlobally(this.configurationService) && isDragIntoEditorEvent(event)) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
this.counter++;
|
|
463
|
+
if (!this.editorTransfer.hasData(DraggedEditorIdentifier.prototype) &&
|
|
464
|
+
!this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype) &&
|
|
465
|
+
event.dataTransfer) {
|
|
466
|
+
const dndContributions = ( Registry.as(Extensions.DragAndDropContribution)).getAll();
|
|
467
|
+
const dndContributionKeys = ( Array.from(dndContributions).map(e => e.dataFormatKey));
|
|
468
|
+
if (!containsDragType(event, DataTransfers.FILES, CodeDataTransfers.FILES, DataTransfers.RESOURCES, CodeDataTransfers.EDITORS, ...dndContributionKeys)) {
|
|
469
|
+
event.dataTransfer.dropEffect = 'none';
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
this.updateContainer(true);
|
|
474
|
+
const target = event.target;
|
|
475
|
+
if (target) {
|
|
476
|
+
if (this.overlay && !this.overlay.contains(target)) {
|
|
477
|
+
this.disposeOverlay();
|
|
478
|
+
}
|
|
479
|
+
if (!this.overlay) {
|
|
480
|
+
const targetGroupView = this.findTargetGroupView(target);
|
|
481
|
+
if (targetGroupView) {
|
|
482
|
+
this._overlay = this.instantiationService.createInstance(DropOverlay, targetGroupView);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
onDragLeave() {
|
|
488
|
+
this.counter--;
|
|
489
|
+
if (this.counter === 0) {
|
|
490
|
+
this.updateContainer(false);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
onDragEnd() {
|
|
494
|
+
this.counter = 0;
|
|
495
|
+
this.updateContainer(false);
|
|
496
|
+
this.disposeOverlay();
|
|
497
|
+
}
|
|
498
|
+
findTargetGroupView(child) {
|
|
499
|
+
const groups = this.editorGroupService.groups;
|
|
500
|
+
return groups.find(groupView => isAncestor(child, groupView.element) || this.delegate.containsGroup?.(groupView));
|
|
501
|
+
}
|
|
502
|
+
updateContainer(isDraggedOver) {
|
|
503
|
+
this.container.classList.toggle('dragged-over', isDraggedOver);
|
|
504
|
+
}
|
|
505
|
+
dispose() {
|
|
506
|
+
super.dispose();
|
|
507
|
+
this.disposeOverlay();
|
|
508
|
+
}
|
|
509
|
+
disposeOverlay() {
|
|
510
|
+
if (this.overlay) {
|
|
511
|
+
this.overlay.dispose();
|
|
512
|
+
this._overlay = undefined;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
EditorDropTarget = ( __decorate([
|
|
517
|
+
( __param(2, IEditorGroupsService)),
|
|
518
|
+
( __param(3, IThemeService)),
|
|
519
|
+
( __param(4, IConfigurationService)),
|
|
520
|
+
( __param(5, IInstantiationService))
|
|
521
|
+
], EditorDropTarget));
|
|
522
|
+
|
|
523
|
+
export { EditorDropTarget };
|