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