@codingame/monaco-vscode-api 1.79.0 → 1.79.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 +7 -5
- package/dist/activity.d.ts +8 -108
- package/dist/api.js +3 -3
- package/dist/colorRegistry.d.ts +2 -2
- package/dist/contextkey.d.ts +2 -2
- package/dist/default-extension.js +23 -0
- package/dist/editor.d.ts +4 -320
- package/dist/editorBrowser.d.ts +327 -10
- package/dist/event.d.ts +1 -1
- package/dist/{extension-tools-d0cfdea1.js → extension-tools-0c4c1ad7.js} +345 -210
- package/dist/extensions.d.ts +3 -4
- package/dist/extensions.d2.ts +1 -1
- package/dist/extensions.js +4 -37
- package/dist/extensionsRegistry.d.ts +1 -1
- package/dist/files.d.ts +2 -2
- package/dist/keybinding.d.ts +1 -1
- package/dist/languageFeatures.d.ts +6 -7
- package/dist/log.d.ts +1 -1
- package/dist/monaco.d.ts +31 -32
- package/dist/monaco.js +62 -6
- package/dist/node_modules/rollup-plugin-styles/dist/runtime/inject-css.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +4 -0
- package/dist/rollup-extension-directory-plugin.js +1 -2
- package/dist/rollup-vsix-plugin.js +1 -2
- package/dist/service-override/configuration.d.ts +2 -2
- package/dist/service-override/editor.d.ts +13 -0
- package/dist/service-override/{modelEditor.js → editor.js} +6 -62
- package/dist/service-override/files.d.ts +5 -5
- package/dist/service-override/files.js +14 -2
- package/dist/service-override/keybindings.js +3 -79
- package/dist/service-override/layout.js +6 -2
- package/dist/service-override/model.d.ts +7 -0
- package/dist/service-override/model.js +10 -0
- package/dist/service-override/quickaccess.d.ts +7 -0
- package/dist/service-override/quickaccess.js +80 -0
- package/dist/service-override/snippets.js +5 -1
- package/dist/service-override/textmate.js +7 -2
- package/dist/service-override/theme.d.ts +1 -1
- package/dist/service-override/tools/editor.js +73 -0
- package/dist/service-override/views.d.ts +63 -201
- package/dist/service-override/views.js +102 -8
- package/dist/services.d.ts +116 -19
- package/dist/vscode/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
- package/dist/vscode/vs/base/browser/ui/grid/grid.js +452 -0
- package/dist/vscode/vs/base/browser/ui/grid/gridview.css.js +4 -0
- package/dist/vscode/vs/base/browser/ui/grid/gridview.js +999 -0
- package/dist/vscode/vs/base/browser/ui/iconLabel/simpleIconLabel.js +14 -0
- package/dist/vscode/vs/base/browser/ui/menu/menubar.css.js +4 -0
- package/dist/vscode/vs/base/browser/ui/menu/menubar.js +1 -1
- package/dist/vscode/vs/base/browser/ui/splitview/paneview.css.js +4 -0
- package/dist/vscode/vs/base/browser/ui/splitview/paneview.js +1 -1
- package/dist/vscode/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
- package/dist/vscode/vs/platform/extensionManagement/common/extensionStorage.js +1 -1
- package/dist/vscode/vs/platform/product/common/product.js +48 -0
- package/dist/vscode/vs/platform/quickinput/browser/quickPickPin.js +94 -0
- package/dist/vscode/vs/platform/terminal/common/terminal.js +3 -0
- package/dist/vscode/vs/platform/update/common/update.js +11 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadStatusBar.js +68 -0
- package/dist/vscode/vs/workbench/api/common/extHostStatusBar.js +234 -0
- package/dist/vscode/vs/workbench/api/common/extHostTypes.js +6 -1
- package/dist/vscode/vs/workbench/browser/actions/layoutActions.js +20 -17
- package/dist/vscode/vs/workbench/browser/actions/quickAccessActions.js +204 -0
- package/dist/vscode/vs/workbench/browser/dnd.js +27 -2
- package/dist/vscode/vs/workbench/browser/editor.js +94 -0
- package/dist/vscode/vs/workbench/browser/labels.js +23 -2
- package/dist/vscode/vs/workbench/browser/media/part.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/part.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/activitybar/activitybarActions.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/activitybar/activitybarPart.js +3 -3
- package/dist/vscode/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions.js +14 -26
- package/dist/vscode/vs/workbench/browser/parts/compositePart.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/binaryDiffEditor.js +43 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/binaryEditor.js +55 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbs.js +330 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsControl.js +690 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsModel.js +142 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsPicker.js +414 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.contribution.js +800 -6
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.js +56 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorActions.js +1484 -107
- package/dist/vscode/vs/workbench/browser/parts/editor/editorCommands.js +1121 -4
- package/dist/vscode/vs/workbench/browser/parts/editor/editorDropTarget.js +499 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupView.js +1219 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupWatermark.js +137 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPane.js +242 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPanes.js +297 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPart.js +841 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPlaceholder.js +235 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorQuickAccess.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorStatus.js +1152 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorWithViewState.js +139 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorsObserver.js +339 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/breadcrumbscontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorplaceholder.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorquickaccess.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorstatus.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/sidebysideeditor.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/media/titlecontrol.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/noTabsTitleControl.js +243 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/sideBySideEditor.js +387 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/tabFocus.js +77 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/tabsTitleControl.js +1504 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textCodeEditor.js +79 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textDiffEditor.js +304 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textEditor.js +220 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/textResourceEditor.js +149 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/titleControl.js +284 -0
- package/dist/vscode/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsActions.js +8 -8
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsCenter.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsList.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsToasts.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/panel/media/basepanelpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/panel/media/panelpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/panel/panelActions.js +19 -5
- package/dist/vscode/vs/workbench/browser/parts/panel/panelPart.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/sidebar/sidebarPart.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarActions.js +109 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarItem.js +224 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarModel.js +251 -0
- package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarPart.js +439 -0
- package/dist/vscode/vs/workbench/browser/parts/titlebar/media/menubarControl.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/titlebar/menubarControl.js +76 -3
- package/dist/vscode/vs/workbench/browser/parts/views/media/paneviewlet.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/views/media/views.css.js +4 -0
- package/dist/vscode/vs/workbench/browser/parts/views/treeView.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/views/viewPane.js +5 -5
- package/dist/vscode/vs/workbench/browser/parts/views/viewPaneContainer.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/views/viewsService.js +4 -4
- package/dist/vscode/vs/workbench/browser/quickaccess.js +6 -2
- package/dist/vscode/vs/workbench/browser/workbench.contribution.js +1108 -0
- package/dist/vscode/vs/workbench/common/contextkeys.js +34 -1
- package/dist/vscode/vs/workbench/common/editor/editorGroupModel.js +674 -0
- package/dist/vscode/vs/workbench/common/editor.js +57 -1
- package/dist/vscode/vs/workbench/common/theme.js +35 -35
- package/dist/vscode/vs/workbench/common/views.js +1 -1
- package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +4 -4
- package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +1 -1
- package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +77 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +217 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.js +24 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/breakpointWidget.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debug.contribution.js +30 -4
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugCommands.js +13 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugIcons.js +77 -127
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugToolBar.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugViewlet.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/disassemblyView.js +620 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/exceptionWidget.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugHover.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/media/repl.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/repl.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/common/debug.js +2 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +71 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/textFileEditor.js +225 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/explorerViewlet.js +5 -4
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.contribution.js +270 -4
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.js +4 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/fileCommands.js +24 -6
- package/dist/vscode/vs/workbench/contrib/files/browser/fileConstants.js +8 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/files.contribution.js +10 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/media/explorerviewlet.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/views/media/openeditors.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/views/openEditorsView.js +608 -0
- package/dist/vscode/vs/workbench/contrib/files/common/files.js +2 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionInputPart.js +1 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionWidget.js +1 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/media/interactiveSession.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionContextKeys.js +9 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionModel.js +305 -0
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionService.js +6 -1
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionServiceImpl.js +379 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser.js +2 -2
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +33 -1
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +130 -0
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +225 -0
- package/dist/vscode/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/remote/browser/remoteIcons.js +21 -17
- package/dist/vscode/vs/workbench/contrib/remote/browser/tunnelView.js +1 -1
- package/dist/vscode/vs/workbench/contrib/search/browser/anythingQuickAccess.js +757 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/search.contribution.js +428 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +219 -0
- package/dist/vscode/vs/workbench/contrib/search/common/cacheState.js +85 -0
- package/dist/vscode/vs/workbench/contrib/search/common/constants.js +2 -0
- package/dist/vscode/vs/workbench/contrib/search/common/search.js +119 -1
- package/dist/vscode/vs/workbench/contrib/tasks/browser/taskQuickPick.js +385 -0
- package/dist/vscode/vs/workbench/contrib/tasks/browser/tasksQuickAccess.js +108 -0
- package/dist/vscode/vs/workbench/contrib/tasks/common/tasks.js +351 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcon.js +44 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +147 -1
- package/dist/vscode/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +1 -1
- package/dist/vscode/vs/workbench/services/editor/browser/editorDropService.js +3 -0
- package/dist/vscode/vs/workbench/services/editor/browser/editorResolverService.js +619 -0
- package/dist/vscode/vs/workbench/services/editor/browser/editorService.js +720 -0
- package/dist/vscode/vs/workbench/services/editor/common/editorGroupFinder.js +116 -0
- package/dist/vscode/vs/workbench/services/editor/common/editorGroupsService.js +6 -1
- package/dist/vscode/vs/workbench/services/editor/common/editorResolverService.js +34 -1
- package/dist/vscode/vs/workbench/services/history/browser/historyService.js +1451 -0
- package/dist/vscode/vs/workbench/services/hover/browser/hoverService.js +1 -1
- package/dist/vscode/vs/workbench/services/hover/browser/media/hover.css.js +4 -0
- package/dist/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.js +2 -1
- package/dist/vscode/vs/workbench/services/outline/browser/outline.js +3 -0
- package/dist/vscode/vs/workbench/services/progress/browser/progressIndicator.js +72 -1
- package/dist/vscode/vs/workbench/services/quickinput/browser/quickInputService.js +67 -0
- package/dist/vscode/vs/workbench/services/search/common/search.js +2 -112
- package/dist/vscode/vs/workbench/services/semanticSimilarity/common/semanticSimilarityService.js +54 -1
- package/dist/vscode/vs/workbench/services/statusbar/browser/statusbar.js +15 -0
- package/dist/vscode/vs/workbench/services/textMate/browser/worker/textMate.worker.js +90 -0
- package/dist/vscode/vs/workbench/services/textMate/browser/worker/textMateWorkerModel.js +133 -0
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.js +110 -3
- package/dist/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.js +1 -1
- package/dist/vscode-services/extHost.js +12 -5
- package/dist/vscode-services/missing-services.js +117 -3
- package/dist/vscode-services/window.js +21 -2
- package/dist/vscode-services/workspace.js +2 -1
- package/dist/workbenchThemeService.d.ts +1 -1
- package/dist/workers/textMate.worker.d.ts +2 -0
- package/dist/workers/textMate.worker.js +3 -0
- package/dist/workspace.d.ts +1 -1
- package/monaco-editor-treemending.patch +535 -535
- package/package.json +42 -22
- package/dist/assets/activityaction.css +0 -224
- package/dist/assets/activitybarpart.css +0 -65
- package/dist/assets/basepanelpart.css +0 -221
- package/dist/assets/breakpointWidget.css +0 -31
- package/dist/assets/callHierarchy.css +0 -62
- package/dist/assets/callStackEditorContribution.css +0 -12
- package/dist/assets/compositepart.css +0 -17
- package/dist/assets/debug.contribution.css +0 -138
- package/dist/assets/debugHover.css +0 -80
- package/dist/assets/debugToolBar.css +0 -49
- package/dist/assets/debugViewlet.css +0 -337
- package/dist/assets/editorquickaccess.css +0 -8
- package/dist/assets/exceptionWidget.css +0 -52
- package/dist/assets/explorerviewlet.css +0 -129
- package/dist/assets/hover.css +0 -127
- package/dist/assets/interactiveSession.css +0 -340
- package/dist/assets/menubar.css +0 -111
- package/dist/assets/menubarControl.css +0 -61
- package/dist/assets/notificationsActions.css +0 -14
- package/dist/assets/notificationsCenter.css +0 -69
- package/dist/assets/notificationsList.css +0 -152
- package/dist/assets/notificationsToasts.css +0 -63
- package/dist/assets/panelpart.css +0 -75
- package/dist/assets/paneview.css +0 -148
- package/dist/assets/paneviewlet.css +0 -79
- package/dist/assets/part.css +0 -109
- package/dist/assets/repl.css +0 -145
- package/dist/assets/sidebarpart.css +0 -61
- package/dist/assets/tunnelView.css +0 -107
- package/dist/assets/typeHierarchy.css +0 -62
- package/dist/assets/views.css +0 -297
- package/dist/override/vs/workbench/browser/parts/editor/textEditor.js +0 -2
- package/dist/override/vs/workbench/contrib/files/browser/views/openEditorsView.js +0 -2
- package/dist/service-override/modelEditor.d.ts +0 -14
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -249
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookService.js +0 -10
- package/dist/vscode/vs/workbench/services/search/common/searchHelpers.js +0 -72
- package/dist/vscode/vs/workbench/services/search/common/searchService.js +0 -355
|
@@ -0,0 +1,1504 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import './media/tabstitlecontrol.css.js';
|
|
3
|
+
import { isWindows, isMacintosh } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
4
|
+
import { shorten } from 'monaco-editor/esm/vs/base/common/labels.js';
|
|
5
|
+
import { DEFAULT_EDITOR_ASSOCIATION, EditorResourceAccessor, SideBySideEditor } from '../../../common/editor.js';
|
|
6
|
+
import { computeEditorAriaLabel } from '../../editor.js';
|
|
7
|
+
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
8
|
+
import { Gesture, EventType as EventType$1 } from 'monaco-editor/esm/vs/base/browser/touch.js';
|
|
9
|
+
import { ResourceLabels, DEFAULT_LABELS_CONTAINER } from '../../labels.js';
|
|
10
|
+
import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
|
|
11
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
12
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
13
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
14
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
15
|
+
import { MenuId, IMenuService } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
16
|
+
import { TitleControl, EditorCommandsContextActionRunner } from './titleControl.js';
|
|
17
|
+
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
18
|
+
import { MutableDisposable, dispose, combinedDisposable, toDisposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
19
|
+
import { ScrollableElement } from 'monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js';
|
|
20
|
+
import { getOrSet } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
21
|
+
import { registerThemingParticipant, IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
22
|
+
import { TAB_BORDER, TAB_HOVER_BACKGROUND, TAB_UNFOCUSED_HOVER_BACKGROUND, TAB_HOVER_FOREGROUND, TAB_UNFOCUSED_HOVER_FOREGROUND, TAB_HOVER_BORDER, TAB_UNFOCUSED_HOVER_BORDER, EDITOR_GROUP_HEADER_TABS_BACKGROUND, EDITOR_DRAG_AND_DROP_BACKGROUND, TAB_ACTIVE_BACKGROUND, TAB_UNFOCUSED_ACTIVE_BACKGROUND, TAB_INACTIVE_BACKGROUND, TAB_UNFOCUSED_INACTIVE_BACKGROUND, EDITOR_GROUP_HEADER_TABS_BORDER, TAB_ACTIVE_BORDER, TAB_UNFOCUSED_ACTIVE_BORDER, TAB_ACTIVE_BORDER_TOP, TAB_UNFOCUSED_ACTIVE_BORDER_TOP, TAB_ACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND, TAB_INACTIVE_FOREGROUND, TAB_UNFOCUSED_INACTIVE_FOREGROUND, TAB_ACTIVE_MODIFIED_BORDER, TAB_INACTIVE_MODIFIED_BORDER, TAB_UNFOCUSED_ACTIVE_MODIFIED_BORDER, TAB_UNFOCUSED_INACTIVE_MODIFIED_BORDER, TAB_LAST_PINNED_BORDER, WORKBENCH_BACKGROUND } from '../../../common/theme.js';
|
|
23
|
+
import { activeContrastBorder, contrastBorder, editorBackground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
24
|
+
import { DraggedEditorIdentifier, DraggedEditorGroupIdentifier, extractTreeDropData, ResourcesDropHandler } from '../../dnd.js';
|
|
25
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
26
|
+
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
|
|
27
|
+
import { Dimension, addDisposableListener, EventType, EventHelper, DragAndDropObserver, clearNode, scheduleAtNextAnimationFrame, findParentWithClass } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
28
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
29
|
+
import { CloseOneEditorAction, UnpinEditorAction } from './editorActions.js';
|
|
30
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
31
|
+
import { BreadcrumbsControl } from './breadcrumbsControl.js';
|
|
32
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
33
|
+
import { assertAllDefined, assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
34
|
+
import { IEditorService } from '../../../services/editor/common/editorService.js';
|
|
35
|
+
import { basenameOrAuthority } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
36
|
+
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
37
|
+
import { IPathService } from '../../../services/path/common/pathService.js';
|
|
38
|
+
import { win32, posix } from 'monaco-editor/esm/vs/base/common/path.js';
|
|
39
|
+
import { insert, coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
40
|
+
import { isHighContrast } from 'monaco-editor/esm/vs/platform/theme/common/theme.js';
|
|
41
|
+
import { isSafari } from 'monaco-editor/esm/vs/base/browser/browser.js';
|
|
42
|
+
import { equals } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
43
|
+
import { EditorActivation } from 'monaco-editor/esm/vs/platform/editor/common/editor.js';
|
|
44
|
+
import { UNLOCK_GROUP_COMMAND_ID } from './editorCommands.js';
|
|
45
|
+
import { StandardMouseEvent } from 'monaco-editor/esm/vs/base/browser/mouseEvent.js';
|
|
46
|
+
import { ITreeViewsDnDService } from 'monaco-editor/esm/vs/editor/common/services/treeViewsDndService.js';
|
|
47
|
+
import { DraggedTreeItemsIdentifier } from 'monaco-editor/esm/vs/editor/common/services/treeViewsDnd.js';
|
|
48
|
+
let TabsTitleControl = class TabsTitleControl extends TitleControl {
|
|
49
|
+
constructor(parent, accessor, group, contextMenuService, instantiationService, contextKeyService, keybindingService, notificationService, menuService, quickInputService, themeService, configurationService, fileService, editorService, pathService, editorGroupService, treeViewsDragAndDropService) {
|
|
50
|
+
super(parent, accessor, group, contextMenuService, instantiationService, contextKeyService, keybindingService, notificationService, menuService, quickInputService, themeService, configurationService, fileService);
|
|
51
|
+
this.editorService = editorService;
|
|
52
|
+
this.pathService = pathService;
|
|
53
|
+
this.editorGroupService = editorGroupService;
|
|
54
|
+
this.treeViewsDragAndDropService = treeViewsDragAndDropService;
|
|
55
|
+
this.closeEditorAction = this._register(this.instantiationService.createInstance(CloseOneEditorAction, CloseOneEditorAction.ID, CloseOneEditorAction.LABEL));
|
|
56
|
+
this.unpinEditorAction = this._register(this.instantiationService.createInstance(UnpinEditorAction, UnpinEditorAction.ID, UnpinEditorAction.LABEL));
|
|
57
|
+
this.tabResourceLabels = this._register(this.instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER));
|
|
58
|
+
this.tabLabels = [];
|
|
59
|
+
this.tabActionBars = [];
|
|
60
|
+
this.tabDisposables = [];
|
|
61
|
+
this.dimensions = {
|
|
62
|
+
container: Dimension.None,
|
|
63
|
+
available: Dimension.None
|
|
64
|
+
};
|
|
65
|
+
this.layoutScheduler = this._register(( new MutableDisposable()));
|
|
66
|
+
this.path = isWindows ? win32 : posix;
|
|
67
|
+
this.lastMouseWheelEventTime = 0;
|
|
68
|
+
this.updateEditorLabelScheduler = this._register(( new RunOnceScheduler(() => this.doUpdateEditorLabels(), 0)));
|
|
69
|
+
(async () => this.path = await this.pathService.path)();
|
|
70
|
+
this._register(this.tabResourceLabels.onDidChangeDecorations(() => this.doHandleDecorationsChange()));
|
|
71
|
+
}
|
|
72
|
+
create(parent) {
|
|
73
|
+
this.titleContainer = parent;
|
|
74
|
+
this.tabsAndActionsContainer = document.createElement('div');
|
|
75
|
+
this.tabsAndActionsContainer.classList.add('tabs-and-actions-container');
|
|
76
|
+
this.titleContainer.appendChild(this.tabsAndActionsContainer);
|
|
77
|
+
this.tabsContainer = document.createElement('div');
|
|
78
|
+
this.tabsContainer.setAttribute('role', 'tablist');
|
|
79
|
+
this.tabsContainer.draggable = true;
|
|
80
|
+
this.tabsContainer.classList.add('tabs-container');
|
|
81
|
+
this._register(Gesture.addTarget(this.tabsContainer));
|
|
82
|
+
this.tabsScrollbar = this._register(this.createTabsScrollbar(this.tabsContainer));
|
|
83
|
+
this.tabsAndActionsContainer.appendChild(this.tabsScrollbar.getDomNode());
|
|
84
|
+
this.registerTabsContainerListeners(this.tabsContainer, this.tabsScrollbar);
|
|
85
|
+
this.editorToolbarContainer = document.createElement('div');
|
|
86
|
+
this.editorToolbarContainer.classList.add('editor-actions');
|
|
87
|
+
this.tabsAndActionsContainer.appendChild(this.editorToolbarContainer);
|
|
88
|
+
this.createEditorActionsToolBar(this.editorToolbarContainer);
|
|
89
|
+
const breadcrumbsContainer = document.createElement('div');
|
|
90
|
+
breadcrumbsContainer.classList.add('tabs-breadcrumbs');
|
|
91
|
+
this.titleContainer.appendChild(breadcrumbsContainer);
|
|
92
|
+
this.createBreadcrumbsControl(breadcrumbsContainer, { showFileIcons: true, showSymbolIcons: true, showDecorationColors: false, showPlaceholder: true });
|
|
93
|
+
}
|
|
94
|
+
createTabsScrollbar(scrollable) {
|
|
95
|
+
const tabsScrollbar = ( new ScrollableElement(scrollable, {
|
|
96
|
+
horizontal: 1 ,
|
|
97
|
+
horizontalScrollbarSize: this.getTabsScrollbarSizing(),
|
|
98
|
+
vertical: 2 ,
|
|
99
|
+
scrollYToX: true,
|
|
100
|
+
useShadows: false
|
|
101
|
+
}));
|
|
102
|
+
tabsScrollbar.onScroll(e => {
|
|
103
|
+
if (e.scrollLeftChanged) {
|
|
104
|
+
scrollable.scrollLeft = e.scrollLeft;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return tabsScrollbar;
|
|
108
|
+
}
|
|
109
|
+
updateTabsScrollbarSizing() {
|
|
110
|
+
this.tabsScrollbar?.updateOptions({
|
|
111
|
+
horizontalScrollbarSize: this.getTabsScrollbarSizing()
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
getTabsScrollbarSizing() {
|
|
115
|
+
if (this.accessor.partOptions.titleScrollbarSizing !== 'large') {
|
|
116
|
+
return TabsTitleControl.SCROLLBAR_SIZES.default;
|
|
117
|
+
}
|
|
118
|
+
return TabsTitleControl.SCROLLBAR_SIZES.large;
|
|
119
|
+
}
|
|
120
|
+
registerTabsContainerListeners(tabsContainer, tabsScrollbar) {
|
|
121
|
+
this.enableGroupDragging(tabsContainer);
|
|
122
|
+
this._register(addDisposableListener(tabsContainer, EventType.SCROLL, () => {
|
|
123
|
+
if (tabsContainer.classList.contains('scroll')) {
|
|
124
|
+
tabsScrollbar.setScrollPosition({
|
|
125
|
+
scrollLeft: tabsContainer.scrollLeft
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
for (const eventType of [EventType$1.Tap, EventType.DBLCLICK]) {
|
|
130
|
+
this._register(addDisposableListener(tabsContainer, eventType, (e) => {
|
|
131
|
+
if (eventType === EventType.DBLCLICK) {
|
|
132
|
+
if (e.target !== tabsContainer) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
if (e.tapCount !== 2) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (e.initialTarget !== tabsContainer) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
EventHelper.stop(e);
|
|
145
|
+
this.editorService.openEditor({
|
|
146
|
+
resource: undefined,
|
|
147
|
+
options: {
|
|
148
|
+
pinned: true,
|
|
149
|
+
index: this.group.count,
|
|
150
|
+
override: DEFAULT_EDITOR_ASSOCIATION.id
|
|
151
|
+
}
|
|
152
|
+
}, this.group.id);
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
this._register(addDisposableListener(tabsContainer, EventType.MOUSE_DOWN, e => {
|
|
156
|
+
if (e.button === 1) {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
this._register(( new DragAndDropObserver(tabsContainer, {
|
|
161
|
+
onDragEnter: e => {
|
|
162
|
+
tabsContainer.classList.add('scroll');
|
|
163
|
+
if (e.target !== tabsContainer) {
|
|
164
|
+
this.updateDropFeedback(tabsContainer, false);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!this.isSupportedDropTransfer(e)) {
|
|
168
|
+
if (e.dataTransfer) {
|
|
169
|
+
e.dataTransfer.dropEffect = 'none';
|
|
170
|
+
}
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
let isLocalDragAndDrop = false;
|
|
174
|
+
if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
|
|
175
|
+
isLocalDragAndDrop = true;
|
|
176
|
+
const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
|
|
177
|
+
if (Array.isArray(data)) {
|
|
178
|
+
const localDraggedEditor = data[0].identifier;
|
|
179
|
+
if (this.group.id === localDraggedEditor.groupId && this.group.getIndexOfEditor(localDraggedEditor.editor) === this.group.count - 1) {
|
|
180
|
+
if (e.dataTransfer) {
|
|
181
|
+
e.dataTransfer.dropEffect = 'none';
|
|
182
|
+
}
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (!isLocalDragAndDrop) {
|
|
188
|
+
if (e.dataTransfer) {
|
|
189
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
this.updateDropFeedback(tabsContainer, true);
|
|
193
|
+
},
|
|
194
|
+
onDragLeave: e => {
|
|
195
|
+
this.updateDropFeedback(tabsContainer, false);
|
|
196
|
+
tabsContainer.classList.remove('scroll');
|
|
197
|
+
},
|
|
198
|
+
onDragEnd: e => {
|
|
199
|
+
this.updateDropFeedback(tabsContainer, false);
|
|
200
|
+
tabsContainer.classList.remove('scroll');
|
|
201
|
+
},
|
|
202
|
+
onDrop: e => {
|
|
203
|
+
this.updateDropFeedback(tabsContainer, false);
|
|
204
|
+
tabsContainer.classList.remove('scroll');
|
|
205
|
+
if (e.target === tabsContainer) {
|
|
206
|
+
this.onDrop(e, this.group.count, tabsContainer);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
})));
|
|
210
|
+
this._register(addDisposableListener(tabsContainer, EventType.MOUSE_WHEEL, (e) => {
|
|
211
|
+
const activeEditor = this.group.activeEditor;
|
|
212
|
+
if (!activeEditor || this.group.count < 2) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (this.accessor.partOptions.scrollToSwitchTabs === true) {
|
|
216
|
+
if (e.shiftKey) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
if (!e.shiftKey) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const now = Date.now();
|
|
226
|
+
if (now - this.lastMouseWheelEventTime < TabsTitleControl.MOUSE_WHEEL_EVENT_THRESHOLD - 2 * (Math.abs(e.deltaX) + Math.abs(e.deltaY))) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
this.lastMouseWheelEventTime = now;
|
|
230
|
+
let tabSwitchDirection;
|
|
231
|
+
if (e.deltaX + e.deltaY < -TabsTitleControl.MOUSE_WHEEL_DISTANCE_THRESHOLD) {
|
|
232
|
+
tabSwitchDirection = -1;
|
|
233
|
+
}
|
|
234
|
+
else if (e.deltaX + e.deltaY > TabsTitleControl.MOUSE_WHEEL_DISTANCE_THRESHOLD) {
|
|
235
|
+
tabSwitchDirection = 1;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const nextEditor = this.group.getEditorByIndex(this.group.getIndexOfEditor(activeEditor) + tabSwitchDirection);
|
|
241
|
+
if (!nextEditor) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
this.group.openEditor(nextEditor);
|
|
245
|
+
EventHelper.stop(e, true);
|
|
246
|
+
}));
|
|
247
|
+
const showContextMenu = (e) => {
|
|
248
|
+
EventHelper.stop(e);
|
|
249
|
+
let anchor = tabsContainer;
|
|
250
|
+
if (e instanceof MouseEvent) {
|
|
251
|
+
const event = ( new StandardMouseEvent(e));
|
|
252
|
+
anchor = { x: event.posx, y: event.posy };
|
|
253
|
+
}
|
|
254
|
+
this.contextMenuService.showContextMenu({
|
|
255
|
+
getAnchor: () => anchor,
|
|
256
|
+
menuId: MenuId.EditorTabsBarContext,
|
|
257
|
+
contextKeyService: this.contextKeyService,
|
|
258
|
+
menuActionOptions: { shouldForwardArgs: true },
|
|
259
|
+
getActionsContext: () => ({ groupId: this.group.id }),
|
|
260
|
+
getKeyBinding: action => this.getKeybinding(action),
|
|
261
|
+
onHide: () => this.group.focus()
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
this._register(addDisposableListener(tabsContainer, EventType$1.Contextmenu, e => showContextMenu(e)));
|
|
265
|
+
this._register(addDisposableListener(tabsContainer, EventType.CONTEXT_MENU, e => showContextMenu(e)));
|
|
266
|
+
}
|
|
267
|
+
doHandleDecorationsChange() {
|
|
268
|
+
this.layout(this.dimensions);
|
|
269
|
+
}
|
|
270
|
+
updateEditorActionsToolbar() {
|
|
271
|
+
super.updateEditorActionsToolbar();
|
|
272
|
+
this.layout(this.dimensions);
|
|
273
|
+
}
|
|
274
|
+
openEditor(editor) {
|
|
275
|
+
this.handleOpenedEditors();
|
|
276
|
+
}
|
|
277
|
+
openEditors(editors) {
|
|
278
|
+
this.handleOpenedEditors();
|
|
279
|
+
}
|
|
280
|
+
handleOpenedEditors() {
|
|
281
|
+
const [tabsContainer, tabsScrollbar] = assertAllDefined(this.tabsContainer, this.tabsScrollbar);
|
|
282
|
+
for (let i = tabsContainer.children.length; i < this.group.count; i++) {
|
|
283
|
+
tabsContainer.appendChild(this.createTab(i, tabsContainer, tabsScrollbar));
|
|
284
|
+
}
|
|
285
|
+
const activeEditorChanged = this.didActiveEditorChange();
|
|
286
|
+
const oldActiveTabLabel = this.activeTabLabel;
|
|
287
|
+
const oldTabLabelsLength = this.tabLabels.length;
|
|
288
|
+
this.computeTabLabels();
|
|
289
|
+
if (activeEditorChanged ||
|
|
290
|
+
oldTabLabelsLength !== this.tabLabels.length ||
|
|
291
|
+
!this.equalsEditorInputLabel(oldActiveTabLabel, this.activeTabLabel)
|
|
292
|
+
) {
|
|
293
|
+
this.redraw({ forceRevealActiveTab: true });
|
|
294
|
+
this.breadcrumbsControl?.update();
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.layout(this.dimensions, { forceRevealActiveTab: true });
|
|
298
|
+
this.breadcrumbsControl?.revealLast();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
didActiveEditorChange() {
|
|
302
|
+
if (!this.activeTabLabel?.editor && this.group.activeEditor ||
|
|
303
|
+
this.activeTabLabel?.editor && !this.group.activeEditor ||
|
|
304
|
+
(!this.activeTabLabel?.editor || !this.group.isActive(this.activeTabLabel.editor))
|
|
305
|
+
) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
equalsEditorInputLabel(labelA, labelB) {
|
|
311
|
+
if (labelA === labelB) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
if (!labelA || !labelB) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
return labelA.name === labelB.name &&
|
|
318
|
+
labelA.description === labelB.description &&
|
|
319
|
+
labelA.forceDescription === labelB.forceDescription &&
|
|
320
|
+
labelA.title === labelB.title &&
|
|
321
|
+
labelA.ariaLabel === labelB.ariaLabel;
|
|
322
|
+
}
|
|
323
|
+
closeEditor(editor, index) {
|
|
324
|
+
this.handleClosedEditors(index);
|
|
325
|
+
}
|
|
326
|
+
closeEditors(editors) {
|
|
327
|
+
this.handleClosedEditors();
|
|
328
|
+
}
|
|
329
|
+
handleClosedEditors(index) {
|
|
330
|
+
if (this.group.activeEditor) {
|
|
331
|
+
const tabsContainer = assertIsDefined(this.tabsContainer);
|
|
332
|
+
while (tabsContainer.children.length > this.group.count) {
|
|
333
|
+
tabsContainer.lastChild?.remove();
|
|
334
|
+
dispose(this.tabDisposables.pop());
|
|
335
|
+
}
|
|
336
|
+
this.computeTabLabels();
|
|
337
|
+
this.redraw({ forceRevealActiveTab: true });
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
if (this.tabsContainer) {
|
|
341
|
+
clearNode(this.tabsContainer);
|
|
342
|
+
}
|
|
343
|
+
this.tabDisposables = dispose(this.tabDisposables);
|
|
344
|
+
this.tabResourceLabels.clear();
|
|
345
|
+
this.tabLabels = [];
|
|
346
|
+
this.activeTabLabel = undefined;
|
|
347
|
+
this.tabActionBars = [];
|
|
348
|
+
this.clearEditorActionsToolbar();
|
|
349
|
+
this.breadcrumbsControl?.update();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
moveEditor(editor, fromIndex, targetIndex) {
|
|
353
|
+
const editorLabel = this.tabLabels[fromIndex];
|
|
354
|
+
this.tabLabels.splice(fromIndex, 1);
|
|
355
|
+
this.tabLabels.splice(targetIndex, 0, editorLabel);
|
|
356
|
+
this.forEachTab((editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) => {
|
|
357
|
+
this.redrawTab(editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar);
|
|
358
|
+
}, Math.min(fromIndex, targetIndex),
|
|
359
|
+
Math.max(fromIndex, targetIndex)
|
|
360
|
+
);
|
|
361
|
+
this.layout(this.dimensions, { forceRevealActiveTab: true });
|
|
362
|
+
}
|
|
363
|
+
pinEditor(editor) {
|
|
364
|
+
this.withTab(editor, (editor, index, tabContainer, tabLabelWidget, tabLabel) => this.redrawTabLabel(editor, index, tabContainer, tabLabelWidget, tabLabel));
|
|
365
|
+
}
|
|
366
|
+
stickEditor(editor) {
|
|
367
|
+
this.doHandleStickyEditorChange(editor);
|
|
368
|
+
}
|
|
369
|
+
unstickEditor(editor) {
|
|
370
|
+
this.doHandleStickyEditorChange(editor);
|
|
371
|
+
}
|
|
372
|
+
doHandleStickyEditorChange(editor) {
|
|
373
|
+
this.withTab(editor, (editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) => this.redrawTab(editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar));
|
|
374
|
+
this.forEachTab((editor, index, tabContainer, tabLabelWidget, tabLabel) => {
|
|
375
|
+
this.redrawTabBorders(index, tabContainer);
|
|
376
|
+
});
|
|
377
|
+
this.layout(this.dimensions, { forceRevealActiveTab: true });
|
|
378
|
+
}
|
|
379
|
+
setActive(isGroupActive) {
|
|
380
|
+
this.forEachTab((editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) => {
|
|
381
|
+
this.redrawTabActiveAndDirty(isGroupActive, editor, tabContainer, tabActionBar);
|
|
382
|
+
});
|
|
383
|
+
this.updateEditorActionsToolbar();
|
|
384
|
+
this.layout(this.dimensions, { forceRevealActiveTab: true });
|
|
385
|
+
}
|
|
386
|
+
updateEditorLabel(editor) {
|
|
387
|
+
this.updateEditorLabelScheduler.schedule();
|
|
388
|
+
}
|
|
389
|
+
doUpdateEditorLabels() {
|
|
390
|
+
this.computeTabLabels();
|
|
391
|
+
this.forEachTab((editor, index, tabContainer, tabLabelWidget, tabLabel) => {
|
|
392
|
+
this.redrawTabLabel(editor, index, tabContainer, tabLabelWidget, tabLabel);
|
|
393
|
+
});
|
|
394
|
+
this.layout(this.dimensions);
|
|
395
|
+
}
|
|
396
|
+
updateEditorDirty(editor) {
|
|
397
|
+
this.withTab(editor, (editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) => this.redrawTabActiveAndDirty(this.accessor.activeGroup === this.group, editor, tabContainer, tabActionBar));
|
|
398
|
+
}
|
|
399
|
+
updateOptions(oldOptions, newOptions) {
|
|
400
|
+
if (oldOptions.labelFormat !== newOptions.labelFormat) {
|
|
401
|
+
this.computeTabLabels();
|
|
402
|
+
}
|
|
403
|
+
if (oldOptions.titleScrollbarSizing !== newOptions.titleScrollbarSizing) {
|
|
404
|
+
this.updateTabsScrollbarSizing();
|
|
405
|
+
}
|
|
406
|
+
if (oldOptions.labelFormat !== newOptions.labelFormat ||
|
|
407
|
+
oldOptions.tabCloseButton !== newOptions.tabCloseButton ||
|
|
408
|
+
oldOptions.tabSizing !== newOptions.tabSizing ||
|
|
409
|
+
oldOptions.pinnedTabSizing !== newOptions.pinnedTabSizing ||
|
|
410
|
+
oldOptions.showIcons !== newOptions.showIcons ||
|
|
411
|
+
oldOptions.hasIcons !== newOptions.hasIcons ||
|
|
412
|
+
oldOptions.highlightModifiedTabs !== newOptions.highlightModifiedTabs ||
|
|
413
|
+
oldOptions.wrapTabs !== newOptions.wrapTabs ||
|
|
414
|
+
!equals(oldOptions.decorations, newOptions.decorations)) {
|
|
415
|
+
this.redraw();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
updateStyles() {
|
|
419
|
+
this.redraw();
|
|
420
|
+
}
|
|
421
|
+
forEachTab(fn, fromIndex, toIndex) {
|
|
422
|
+
this.group.editors.forEach((editor, index) => {
|
|
423
|
+
if (typeof fromIndex === 'number' && fromIndex > index) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (typeof toIndex === 'number' && toIndex < index) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
this.doWithTab(index, editor, fn);
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
withTab(editor, fn) {
|
|
433
|
+
this.doWithTab(this.group.getIndexOfEditor(editor), editor, fn);
|
|
434
|
+
}
|
|
435
|
+
doWithTab(index, editor, fn) {
|
|
436
|
+
const tabsContainer = assertIsDefined(this.tabsContainer);
|
|
437
|
+
const tabContainer = tabsContainer.children[index];
|
|
438
|
+
const tabResourceLabel = this.tabResourceLabels.get(index);
|
|
439
|
+
const tabLabel = this.tabLabels[index];
|
|
440
|
+
const tabActionBar = this.tabActionBars[index];
|
|
441
|
+
if (tabContainer && tabResourceLabel && tabLabel) {
|
|
442
|
+
fn(editor, index, tabContainer, tabResourceLabel, tabLabel, tabActionBar);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
createTab(index, tabsContainer, tabsScrollbar) {
|
|
446
|
+
const tabContainer = document.createElement('div');
|
|
447
|
+
tabContainer.draggable = true;
|
|
448
|
+
tabContainer.setAttribute('role', 'tab');
|
|
449
|
+
tabContainer.classList.add('tab');
|
|
450
|
+
this._register(Gesture.addTarget(tabContainer));
|
|
451
|
+
const tabBorderTopContainer = document.createElement('div');
|
|
452
|
+
tabBorderTopContainer.classList.add('tab-border-top-container');
|
|
453
|
+
tabContainer.appendChild(tabBorderTopContainer);
|
|
454
|
+
const editorLabel = this.tabResourceLabels.create(tabContainer);
|
|
455
|
+
const tabActionsContainer = document.createElement('div');
|
|
456
|
+
tabActionsContainer.classList.add('tab-actions');
|
|
457
|
+
tabContainer.appendChild(tabActionsContainer);
|
|
458
|
+
const tabActionRunner = ( new EditorCommandsContextActionRunner({ groupId: this.group.id, editorIndex: index }));
|
|
459
|
+
const tabActionBar = ( new ActionBar(tabActionsContainer, { ariaLabel: ( localize('ariaLabelTabActions', "Tab actions")), actionRunner: tabActionRunner }));
|
|
460
|
+
tabActionBar.onWillRun(e => {
|
|
461
|
+
if (e.action.id === this.closeEditorAction.id) {
|
|
462
|
+
this.blockRevealActiveTabOnce();
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
const tabActionBarDisposable = combinedDisposable(tabActionBar, toDisposable(insert(this.tabActionBars, tabActionBar)));
|
|
466
|
+
const tabBorderBottomContainer = document.createElement('div');
|
|
467
|
+
tabBorderBottomContainer.classList.add('tab-border-bottom-container');
|
|
468
|
+
tabContainer.appendChild(tabBorderBottomContainer);
|
|
469
|
+
const eventsDisposable = this.registerTabListeners(tabContainer, index, tabsContainer, tabsScrollbar);
|
|
470
|
+
this.tabDisposables.push(combinedDisposable(eventsDisposable, tabActionBarDisposable, tabActionRunner, editorLabel));
|
|
471
|
+
return tabContainer;
|
|
472
|
+
}
|
|
473
|
+
registerTabListeners(tab, index, tabsContainer, tabsScrollbar) {
|
|
474
|
+
const disposables = ( new DisposableStore());
|
|
475
|
+
const handleClickOrTouch = (e, preserveFocus) => {
|
|
476
|
+
tab.blur();
|
|
477
|
+
if (e instanceof MouseEvent && (e.button !== 0 || ((isMacintosh && e.ctrlKey) ))) {
|
|
478
|
+
if (e.button === 1) {
|
|
479
|
+
e.preventDefault();
|
|
480
|
+
}
|
|
481
|
+
return undefined;
|
|
482
|
+
}
|
|
483
|
+
if (this.originatesFromTabActionBar(e)) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const input = this.group.getEditorByIndex(index);
|
|
487
|
+
if (input) {
|
|
488
|
+
this.group.openEditor(input, { preserveFocus, activation: EditorActivation.ACTIVATE });
|
|
489
|
+
}
|
|
490
|
+
return undefined;
|
|
491
|
+
};
|
|
492
|
+
const showContextMenu = (e) => {
|
|
493
|
+
EventHelper.stop(e);
|
|
494
|
+
const input = this.group.getEditorByIndex(index);
|
|
495
|
+
if (input) {
|
|
496
|
+
this.onContextMenu(input, e, tab);
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
disposables.add(addDisposableListener(tab, EventType.MOUSE_DOWN, e => handleClickOrTouch(e, false)));
|
|
500
|
+
disposables.add(addDisposableListener(tab, EventType$1.Tap, (e) => handleClickOrTouch(e, true)));
|
|
501
|
+
disposables.add(addDisposableListener(tab, EventType$1.Change, (e) => {
|
|
502
|
+
tabsScrollbar.setScrollPosition({ scrollLeft: tabsScrollbar.getScrollPosition().scrollLeft - e.translationX });
|
|
503
|
+
}));
|
|
504
|
+
disposables.add(addDisposableListener(tab, EventType.MOUSE_UP, e => {
|
|
505
|
+
EventHelper.stop(e);
|
|
506
|
+
tab.blur();
|
|
507
|
+
}));
|
|
508
|
+
disposables.add(addDisposableListener(tab, EventType.AUXCLICK, e => {
|
|
509
|
+
if (e.button === 1 ) {
|
|
510
|
+
EventHelper.stop(e, true );
|
|
511
|
+
this.blockRevealActiveTabOnce();
|
|
512
|
+
this.closeEditorAction.run({ groupId: this.group.id, editorIndex: index });
|
|
513
|
+
}
|
|
514
|
+
}));
|
|
515
|
+
disposables.add(addDisposableListener(tab, EventType.KEY_DOWN, e => {
|
|
516
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
517
|
+
if (event.shiftKey && event.keyCode === 68 ) {
|
|
518
|
+
showContextMenu(e);
|
|
519
|
+
}
|
|
520
|
+
}));
|
|
521
|
+
disposables.add(addDisposableListener(tab, EventType$1.Contextmenu, (e) => {
|
|
522
|
+
showContextMenu(e);
|
|
523
|
+
}));
|
|
524
|
+
disposables.add(addDisposableListener(tab, EventType.KEY_UP, e => {
|
|
525
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
526
|
+
let handled = false;
|
|
527
|
+
if (event.equals(3 ) || event.equals(10 )) {
|
|
528
|
+
handled = true;
|
|
529
|
+
const input = this.group.getEditorByIndex(index);
|
|
530
|
+
if (input) {
|
|
531
|
+
this.group.openEditor(input);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
else if (( [15 , 17 , 16 , 18 , 14 , 13 ].some(kb => event.equals(kb)))) {
|
|
535
|
+
let targetIndex;
|
|
536
|
+
if (event.equals(15 ) || event.equals(16 )) {
|
|
537
|
+
targetIndex = index - 1;
|
|
538
|
+
}
|
|
539
|
+
else if (event.equals(17 ) || event.equals(18 )) {
|
|
540
|
+
targetIndex = index + 1;
|
|
541
|
+
}
|
|
542
|
+
else if (event.equals(14 )) {
|
|
543
|
+
targetIndex = 0;
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
targetIndex = this.group.count - 1;
|
|
547
|
+
}
|
|
548
|
+
const target = this.group.getEditorByIndex(targetIndex);
|
|
549
|
+
if (target) {
|
|
550
|
+
handled = true;
|
|
551
|
+
this.group.openEditor(target, { preserveFocus: true });
|
|
552
|
+
tabsContainer.childNodes[targetIndex].focus();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if (handled) {
|
|
556
|
+
EventHelper.stop(e, true);
|
|
557
|
+
}
|
|
558
|
+
tabsScrollbar.setScrollPosition({
|
|
559
|
+
scrollLeft: tabsContainer.scrollLeft
|
|
560
|
+
});
|
|
561
|
+
}));
|
|
562
|
+
for (const eventType of [EventType$1.Tap, EventType.DBLCLICK]) {
|
|
563
|
+
disposables.add(addDisposableListener(tab, eventType, (e) => {
|
|
564
|
+
if (eventType === EventType.DBLCLICK) {
|
|
565
|
+
EventHelper.stop(e);
|
|
566
|
+
}
|
|
567
|
+
else if (e.tapCount !== 2) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
const editor = this.group.getEditorByIndex(index);
|
|
571
|
+
if (editor && this.group.isPinned(editor)) {
|
|
572
|
+
this.accessor.arrangeGroups(2 , this.group);
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
this.group.pinEditor(editor);
|
|
576
|
+
}
|
|
577
|
+
}));
|
|
578
|
+
}
|
|
579
|
+
disposables.add(addDisposableListener(tab, EventType.CONTEXT_MENU, e => {
|
|
580
|
+
EventHelper.stop(e, true);
|
|
581
|
+
const input = this.group.getEditorByIndex(index);
|
|
582
|
+
if (input) {
|
|
583
|
+
this.onContextMenu(input, e, tab);
|
|
584
|
+
}
|
|
585
|
+
}, true ));
|
|
586
|
+
disposables.add(addDisposableListener(tab, EventType.DRAG_START, e => {
|
|
587
|
+
const editor = this.group.getEditorByIndex(index);
|
|
588
|
+
if (!editor) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
this.editorTransfer.setData([( new DraggedEditorIdentifier({ editor, groupId: this.group.id }))], DraggedEditorIdentifier.prototype);
|
|
592
|
+
if (e.dataTransfer) {
|
|
593
|
+
e.dataTransfer.effectAllowed = 'copyMove';
|
|
594
|
+
}
|
|
595
|
+
this.doFillResourceDataTransfers([editor], e);
|
|
596
|
+
tab.classList.add('dragged');
|
|
597
|
+
scheduleAtNextAnimationFrame(() => tab.classList.remove('dragged'));
|
|
598
|
+
}));
|
|
599
|
+
disposables.add(( new DragAndDropObserver(tab, {
|
|
600
|
+
onDragEnter: e => {
|
|
601
|
+
tab.classList.add('dragged-over');
|
|
602
|
+
if (!this.isSupportedDropTransfer(e)) {
|
|
603
|
+
if (e.dataTransfer) {
|
|
604
|
+
e.dataTransfer.dropEffect = 'none';
|
|
605
|
+
}
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
let isLocalDragAndDrop = false;
|
|
609
|
+
if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
|
|
610
|
+
isLocalDragAndDrop = true;
|
|
611
|
+
const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
|
|
612
|
+
if (Array.isArray(data)) {
|
|
613
|
+
const localDraggedEditor = data[0].identifier;
|
|
614
|
+
if (localDraggedEditor.editor === this.group.getEditorByIndex(index) && localDraggedEditor.groupId === this.group.id) {
|
|
615
|
+
if (e.dataTransfer) {
|
|
616
|
+
e.dataTransfer.dropEffect = 'none';
|
|
617
|
+
}
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
if (!isLocalDragAndDrop) {
|
|
623
|
+
if (e.dataTransfer) {
|
|
624
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
this.updateDropFeedback(tab, true, index);
|
|
628
|
+
},
|
|
629
|
+
onDragOver: (_, dragDuration) => {
|
|
630
|
+
if (dragDuration >= TabsTitleControl.DRAG_OVER_OPEN_TAB_THRESHOLD) {
|
|
631
|
+
const draggedOverTab = this.group.getEditorByIndex(index);
|
|
632
|
+
if (draggedOverTab && this.group.activeEditor !== draggedOverTab) {
|
|
633
|
+
this.group.openEditor(draggedOverTab, { preserveFocus: true });
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
onDragLeave: () => {
|
|
638
|
+
tab.classList.remove('dragged-over');
|
|
639
|
+
this.updateDropFeedback(tab, false, index);
|
|
640
|
+
},
|
|
641
|
+
onDragEnd: () => {
|
|
642
|
+
tab.classList.remove('dragged-over');
|
|
643
|
+
this.updateDropFeedback(tab, false, index);
|
|
644
|
+
this.editorTransfer.clearData(DraggedEditorIdentifier.prototype);
|
|
645
|
+
},
|
|
646
|
+
onDrop: e => {
|
|
647
|
+
tab.classList.remove('dragged-over');
|
|
648
|
+
this.updateDropFeedback(tab, false, index);
|
|
649
|
+
this.onDrop(e, index, tabsContainer);
|
|
650
|
+
}
|
|
651
|
+
})));
|
|
652
|
+
return disposables;
|
|
653
|
+
}
|
|
654
|
+
isSupportedDropTransfer(e) {
|
|
655
|
+
if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
|
|
656
|
+
const data = this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype);
|
|
657
|
+
if (Array.isArray(data)) {
|
|
658
|
+
const group = data[0];
|
|
659
|
+
if (group.identifier === this.group.id) {
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return true;
|
|
664
|
+
}
|
|
665
|
+
if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
if (e.dataTransfer && e.dataTransfer.types.length > 0) {
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
updateDropFeedback(element, isDND, index) {
|
|
674
|
+
const isTab = (typeof index === 'number');
|
|
675
|
+
const editor = typeof index === 'number' ? this.group.getEditorByIndex(index) : undefined;
|
|
676
|
+
const isActiveTab = isTab && !!editor && this.group.isActive(editor);
|
|
677
|
+
const noDNDBackgroundColor = isTab ? this.getColor(isActiveTab ? TAB_ACTIVE_BACKGROUND : TAB_INACTIVE_BACKGROUND) : '';
|
|
678
|
+
element.style.backgroundColor = (isDND ? this.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND) : noDNDBackgroundColor) || '';
|
|
679
|
+
const activeContrastBorderColor = this.getColor(activeContrastBorder);
|
|
680
|
+
if (activeContrastBorderColor && isDND) {
|
|
681
|
+
element.style.outlineWidth = '2px';
|
|
682
|
+
element.style.outlineStyle = 'dashed';
|
|
683
|
+
element.style.outlineColor = activeContrastBorderColor;
|
|
684
|
+
element.style.outlineOffset = isTab ? '-5px' : '-3px';
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
element.style.outlineWidth = '';
|
|
688
|
+
element.style.outlineStyle = '';
|
|
689
|
+
element.style.outlineColor = activeContrastBorderColor || '';
|
|
690
|
+
element.style.outlineOffset = '';
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
computeTabLabels() {
|
|
694
|
+
const { labelFormat } = this.accessor.partOptions;
|
|
695
|
+
const { verbosity, shortenDuplicates } = this.getLabelConfigFlags(labelFormat);
|
|
696
|
+
const labels = [];
|
|
697
|
+
let activeEditorIndex = -1;
|
|
698
|
+
for (let i = 0; i < this.group.editors.length; i++) {
|
|
699
|
+
const editor = this.group.editors[i];
|
|
700
|
+
labels.push({
|
|
701
|
+
editor,
|
|
702
|
+
name: editor.getName(),
|
|
703
|
+
description: editor.getDescription(verbosity),
|
|
704
|
+
forceDescription: editor.hasCapability(64 ),
|
|
705
|
+
title: editor.getTitle(2 ),
|
|
706
|
+
ariaLabel: computeEditorAriaLabel(editor, i, this.group, this.editorGroupService.count)
|
|
707
|
+
});
|
|
708
|
+
if (editor === this.group.activeEditor) {
|
|
709
|
+
activeEditorIndex = i;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (shortenDuplicates) {
|
|
713
|
+
this.shortenTabLabels(labels);
|
|
714
|
+
}
|
|
715
|
+
this.tabLabels = labels;
|
|
716
|
+
this.activeTabLabel = labels[activeEditorIndex];
|
|
717
|
+
}
|
|
718
|
+
shortenTabLabels(labels) {
|
|
719
|
+
const mapNameToDuplicates = ( new Map());
|
|
720
|
+
for (const label of labels) {
|
|
721
|
+
if (typeof label.description === 'string') {
|
|
722
|
+
getOrSet(mapNameToDuplicates, label.name, []).push(label);
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
label.description = '';
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
for (const [, duplicateLabels] of mapNameToDuplicates) {
|
|
729
|
+
if (duplicateLabels.length === 1 && !duplicateLabels[0].forceDescription) {
|
|
730
|
+
duplicateLabels[0].description = '';
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
const mapDescriptionToDuplicates = ( new Map());
|
|
734
|
+
for (const duplicateLabel of duplicateLabels) {
|
|
735
|
+
getOrSet(mapDescriptionToDuplicates, duplicateLabel.description, []).push(duplicateLabel);
|
|
736
|
+
}
|
|
737
|
+
let useLongDescriptions = false;
|
|
738
|
+
for (const [, duplicateLabels] of mapDescriptionToDuplicates) {
|
|
739
|
+
if (!useLongDescriptions && duplicateLabels.length > 1) {
|
|
740
|
+
const [first, ...rest] = ( duplicateLabels.map(({ editor }) => editor.getDescription(2 )));
|
|
741
|
+
useLongDescriptions = ( rest.some(description => description !== first));
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
if (useLongDescriptions) {
|
|
745
|
+
mapDescriptionToDuplicates.clear();
|
|
746
|
+
for (const duplicateLabel of duplicateLabels) {
|
|
747
|
+
duplicateLabel.description = duplicateLabel.editor.getDescription(2 );
|
|
748
|
+
getOrSet(mapDescriptionToDuplicates, duplicateLabel.description, []).push(duplicateLabel);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
const descriptions = [];
|
|
752
|
+
for (const [description] of mapDescriptionToDuplicates) {
|
|
753
|
+
descriptions.push(description);
|
|
754
|
+
}
|
|
755
|
+
if (descriptions.length === 1) {
|
|
756
|
+
for (const label of mapDescriptionToDuplicates.get(descriptions[0]) || []) {
|
|
757
|
+
if (!label.forceDescription) {
|
|
758
|
+
label.description = '';
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
const shortenedDescriptions = shorten(descriptions, this.path.sep);
|
|
764
|
+
descriptions.forEach((description, index) => {
|
|
765
|
+
for (const label of mapDescriptionToDuplicates.get(description) || []) {
|
|
766
|
+
label.description = shortenedDescriptions[index];
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
getLabelConfigFlags(value) {
|
|
772
|
+
switch (value) {
|
|
773
|
+
case 'short':
|
|
774
|
+
return { verbosity: 0 , shortenDuplicates: false };
|
|
775
|
+
case 'medium':
|
|
776
|
+
return { verbosity: 1 , shortenDuplicates: false };
|
|
777
|
+
case 'long':
|
|
778
|
+
return { verbosity: 2 , shortenDuplicates: false };
|
|
779
|
+
default:
|
|
780
|
+
return { verbosity: 1 , shortenDuplicates: true };
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
redraw(options) {
|
|
784
|
+
if (this.tabsAndActionsContainer) {
|
|
785
|
+
let tabsContainerBorderColor = this.getColor(EDITOR_GROUP_HEADER_TABS_BORDER);
|
|
786
|
+
if (!tabsContainerBorderColor && isHighContrast(this.theme.type)) {
|
|
787
|
+
tabsContainerBorderColor = this.getColor(TAB_BORDER) || this.getColor(contrastBorder);
|
|
788
|
+
}
|
|
789
|
+
if (tabsContainerBorderColor) {
|
|
790
|
+
this.tabsAndActionsContainer.classList.add('tabs-border-bottom');
|
|
791
|
+
this.tabsAndActionsContainer.style.setProperty('--tabs-border-bottom-color', ( tabsContainerBorderColor.toString()));
|
|
792
|
+
}
|
|
793
|
+
else {
|
|
794
|
+
this.tabsAndActionsContainer.classList.remove('tabs-border-bottom');
|
|
795
|
+
this.tabsAndActionsContainer.style.removeProperty('--tabs-border-bottom-color');
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
this.forEachTab((editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) => {
|
|
799
|
+
this.redrawTab(editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar);
|
|
800
|
+
});
|
|
801
|
+
this.updateEditorActionsToolbar();
|
|
802
|
+
this.layout(this.dimensions, options);
|
|
803
|
+
}
|
|
804
|
+
redrawTab(editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) {
|
|
805
|
+
const isTabSticky = this.group.isSticky(index);
|
|
806
|
+
const options = this.accessor.partOptions;
|
|
807
|
+
this.redrawTabLabel(editor, index, tabContainer, tabLabelWidget, tabLabel);
|
|
808
|
+
const tabAction = isTabSticky ? this.unpinEditorAction : this.closeEditorAction;
|
|
809
|
+
if (!tabActionBar.hasAction(tabAction)) {
|
|
810
|
+
if (!tabActionBar.isEmpty()) {
|
|
811
|
+
tabActionBar.clear();
|
|
812
|
+
}
|
|
813
|
+
tabActionBar.push(tabAction, { icon: true, label: false, keybinding: this.getKeybindingLabel(tabAction) });
|
|
814
|
+
}
|
|
815
|
+
const tabActionsVisibility = isTabSticky && options.pinnedTabSizing === 'compact' ? 'off' : options.tabCloseButton;
|
|
816
|
+
for (const option of ['off', 'left', 'right']) {
|
|
817
|
+
tabContainer.classList.toggle(`tab-actions-${option}`, tabActionsVisibility === option);
|
|
818
|
+
}
|
|
819
|
+
const tabSizing = isTabSticky && options.pinnedTabSizing === 'shrink' ? 'shrink' : options.tabSizing;
|
|
820
|
+
for (const option of ['fit', 'shrink']) {
|
|
821
|
+
tabContainer.classList.toggle(`sizing-${option}`, tabSizing === option);
|
|
822
|
+
}
|
|
823
|
+
tabContainer.classList.toggle('has-icon', options.showIcons && options.hasIcons);
|
|
824
|
+
tabContainer.classList.toggle('sticky', isTabSticky);
|
|
825
|
+
for (const option of ['normal', 'compact', 'shrink']) {
|
|
826
|
+
tabContainer.classList.toggle(`sticky-${option}`, isTabSticky && options.pinnedTabSizing === option);
|
|
827
|
+
}
|
|
828
|
+
if (!options.wrapTabs && isTabSticky && options.pinnedTabSizing !== 'normal') {
|
|
829
|
+
let stickyTabWidth = 0;
|
|
830
|
+
switch (options.pinnedTabSizing) {
|
|
831
|
+
case 'compact':
|
|
832
|
+
stickyTabWidth = TabsTitleControl.TAB_WIDTH.compact;
|
|
833
|
+
break;
|
|
834
|
+
case 'shrink':
|
|
835
|
+
stickyTabWidth = TabsTitleControl.TAB_WIDTH.shrink;
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
tabContainer.style.left = `${index * stickyTabWidth}px`;
|
|
839
|
+
}
|
|
840
|
+
else {
|
|
841
|
+
tabContainer.style.left = 'auto';
|
|
842
|
+
}
|
|
843
|
+
this.redrawTabBorders(index, tabContainer);
|
|
844
|
+
this.redrawTabActiveAndDirty(this.accessor.activeGroup === this.group, editor, tabContainer, tabActionBar);
|
|
845
|
+
}
|
|
846
|
+
redrawTabLabel(editor, index, tabContainer, tabLabelWidget, tabLabel) {
|
|
847
|
+
const options = this.accessor.partOptions;
|
|
848
|
+
let name;
|
|
849
|
+
let forceLabel = false;
|
|
850
|
+
let fileDecorationBadges = Boolean(options.decorations?.badges);
|
|
851
|
+
let description;
|
|
852
|
+
if (options.pinnedTabSizing === 'compact' && this.group.isSticky(index)) {
|
|
853
|
+
const isShowingIcons = options.showIcons && options.hasIcons;
|
|
854
|
+
name = isShowingIcons ? '' : tabLabel.name?.charAt(0).toUpperCase();
|
|
855
|
+
description = '';
|
|
856
|
+
forceLabel = true;
|
|
857
|
+
fileDecorationBadges = false;
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
name = tabLabel.name;
|
|
861
|
+
description = tabLabel.description || '';
|
|
862
|
+
}
|
|
863
|
+
if (tabLabel.ariaLabel) {
|
|
864
|
+
tabContainer.setAttribute('aria-label', tabLabel.ariaLabel);
|
|
865
|
+
tabContainer.setAttribute('aria-description', '');
|
|
866
|
+
}
|
|
867
|
+
const title = tabLabel.title || '';
|
|
868
|
+
tabContainer.title = title;
|
|
869
|
+
tabLabelWidget.setResource({ name, description, resource: EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.BOTH }) }, {
|
|
870
|
+
title,
|
|
871
|
+
extraClasses: coalesce(['tab-label', fileDecorationBadges ? 'tab-label-has-badge' : undefined].concat(editor.getLabelExtraClasses())),
|
|
872
|
+
italic: !this.group.isPinned(editor),
|
|
873
|
+
forceLabel,
|
|
874
|
+
fileDecorations: {
|
|
875
|
+
colors: Boolean(options.decorations?.colors),
|
|
876
|
+
badges: fileDecorationBadges
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
const resource = EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
880
|
+
if (resource) {
|
|
881
|
+
tabContainer.setAttribute('data-resource-name', basenameOrAuthority(resource));
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
884
|
+
tabContainer.removeAttribute('data-resource-name');
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
redrawTabActiveAndDirty(isGroupActive, editor, tabContainer, tabActionBar) {
|
|
888
|
+
const isTabActive = this.group.isActive(editor);
|
|
889
|
+
const hasModifiedBorderTop = this.doRedrawTabDirty(isGroupActive, isTabActive, editor, tabContainer);
|
|
890
|
+
this.doRedrawTabActive(isGroupActive, !hasModifiedBorderTop, editor, tabContainer, tabActionBar);
|
|
891
|
+
}
|
|
892
|
+
doRedrawTabActive(isGroupActive, allowBorderTop, editor, tabContainer, tabActionBar) {
|
|
893
|
+
if (this.group.isActive(editor)) {
|
|
894
|
+
tabContainer.classList.add('active');
|
|
895
|
+
tabContainer.setAttribute('aria-selected', 'true');
|
|
896
|
+
tabContainer.tabIndex = 0;
|
|
897
|
+
tabContainer.style.backgroundColor = this.getColor(isGroupActive ? TAB_ACTIVE_BACKGROUND : TAB_UNFOCUSED_ACTIVE_BACKGROUND) || '';
|
|
898
|
+
const activeTabBorderColorBottom = this.getColor(isGroupActive ? TAB_ACTIVE_BORDER : TAB_UNFOCUSED_ACTIVE_BORDER);
|
|
899
|
+
if (activeTabBorderColorBottom) {
|
|
900
|
+
tabContainer.classList.add('tab-border-bottom');
|
|
901
|
+
tabContainer.style.setProperty('--tab-border-bottom-color', ( activeTabBorderColorBottom.toString()));
|
|
902
|
+
}
|
|
903
|
+
else {
|
|
904
|
+
tabContainer.classList.remove('tab-border-bottom');
|
|
905
|
+
tabContainer.style.removeProperty('--tab-border-bottom-color');
|
|
906
|
+
}
|
|
907
|
+
const activeTabBorderColorTop = allowBorderTop ? this.getColor(isGroupActive ? TAB_ACTIVE_BORDER_TOP : TAB_UNFOCUSED_ACTIVE_BORDER_TOP) : undefined;
|
|
908
|
+
if (activeTabBorderColorTop) {
|
|
909
|
+
tabContainer.classList.add('tab-border-top');
|
|
910
|
+
tabContainer.style.setProperty('--tab-border-top-color', ( activeTabBorderColorTop.toString()));
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
tabContainer.classList.remove('tab-border-top');
|
|
914
|
+
tabContainer.style.removeProperty('--tab-border-top-color');
|
|
915
|
+
}
|
|
916
|
+
tabContainer.style.color = this.getColor(isGroupActive ? TAB_ACTIVE_FOREGROUND : TAB_UNFOCUSED_ACTIVE_FOREGROUND) || '';
|
|
917
|
+
tabActionBar.setFocusable(true);
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
tabContainer.classList.remove('active');
|
|
921
|
+
tabContainer.setAttribute('aria-selected', 'false');
|
|
922
|
+
tabContainer.tabIndex = -1;
|
|
923
|
+
tabContainer.style.backgroundColor = this.getColor(isGroupActive ? TAB_INACTIVE_BACKGROUND : TAB_UNFOCUSED_INACTIVE_BACKGROUND) || '';
|
|
924
|
+
tabContainer.style.boxShadow = '';
|
|
925
|
+
tabContainer.style.color = this.getColor(isGroupActive ? TAB_INACTIVE_FOREGROUND : TAB_UNFOCUSED_INACTIVE_FOREGROUND) || '';
|
|
926
|
+
tabActionBar.setFocusable(false);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
doRedrawTabDirty(isGroupActive, isTabActive, editor, tabContainer) {
|
|
930
|
+
let hasModifiedBorderColor = false;
|
|
931
|
+
if (editor.isDirty() && !editor.isSaving()) {
|
|
932
|
+
tabContainer.classList.add('dirty');
|
|
933
|
+
if (this.accessor.partOptions.highlightModifiedTabs) {
|
|
934
|
+
let modifiedBorderColor;
|
|
935
|
+
if (isGroupActive && isTabActive) {
|
|
936
|
+
modifiedBorderColor = this.getColor(TAB_ACTIVE_MODIFIED_BORDER);
|
|
937
|
+
}
|
|
938
|
+
else if (isGroupActive && !isTabActive) {
|
|
939
|
+
modifiedBorderColor = this.getColor(TAB_INACTIVE_MODIFIED_BORDER);
|
|
940
|
+
}
|
|
941
|
+
else if (!isGroupActive && isTabActive) {
|
|
942
|
+
modifiedBorderColor = this.getColor(TAB_UNFOCUSED_ACTIVE_MODIFIED_BORDER);
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
945
|
+
modifiedBorderColor = this.getColor(TAB_UNFOCUSED_INACTIVE_MODIFIED_BORDER);
|
|
946
|
+
}
|
|
947
|
+
if (modifiedBorderColor) {
|
|
948
|
+
hasModifiedBorderColor = true;
|
|
949
|
+
tabContainer.classList.add('dirty-border-top');
|
|
950
|
+
tabContainer.style.setProperty('--tab-dirty-border-top-color', modifiedBorderColor);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
tabContainer.classList.remove('dirty-border-top');
|
|
955
|
+
tabContainer.style.removeProperty('--tab-dirty-border-top-color');
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
tabContainer.classList.remove('dirty', 'dirty-border-top');
|
|
960
|
+
tabContainer.style.removeProperty('--tab-dirty-border-top-color');
|
|
961
|
+
}
|
|
962
|
+
return hasModifiedBorderColor;
|
|
963
|
+
}
|
|
964
|
+
redrawTabBorders(index, tabContainer) {
|
|
965
|
+
const isTabSticky = this.group.isSticky(index);
|
|
966
|
+
const isTabLastSticky = isTabSticky && this.group.stickyCount === index + 1;
|
|
967
|
+
const borderRightColor = ((isTabLastSticky ? this.getColor(TAB_LAST_PINNED_BORDER) : undefined) || this.getColor(TAB_BORDER) || this.getColor(contrastBorder));
|
|
968
|
+
tabContainer.style.borderRight = borderRightColor ? `1px solid ${borderRightColor}` : '';
|
|
969
|
+
tabContainer.style.outlineColor = this.getColor(activeContrastBorder) || '';
|
|
970
|
+
}
|
|
971
|
+
prepareEditorActions(editorActions) {
|
|
972
|
+
const isGroupActive = this.accessor.activeGroup === this.group;
|
|
973
|
+
if (isGroupActive) {
|
|
974
|
+
return editorActions;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
return {
|
|
978
|
+
primary: editorActions.primary.filter(action => action.id === UNLOCK_GROUP_COMMAND_ID),
|
|
979
|
+
secondary: editorActions.secondary
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
getHeight() {
|
|
984
|
+
const showsBreadcrumbs = this.breadcrumbsControl && !this.breadcrumbsControl.isHidden();
|
|
985
|
+
if (this.dimensions.used) {
|
|
986
|
+
return {
|
|
987
|
+
total: this.dimensions.used.height,
|
|
988
|
+
offset: showsBreadcrumbs ? this.dimensions.used.height - BreadcrumbsControl.HEIGHT : this.dimensions.used.height
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
else {
|
|
992
|
+
return this.computeHeight();
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
computeHeight() {
|
|
996
|
+
let total;
|
|
997
|
+
if (this.accessor.partOptions.wrapTabs && this.tabsAndActionsContainer?.classList.contains('wrapping')) {
|
|
998
|
+
total = this.tabsAndActionsContainer.offsetHeight;
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
total = TabsTitleControl.TAB_HEIGHT;
|
|
1002
|
+
}
|
|
1003
|
+
const offset = total;
|
|
1004
|
+
if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
|
|
1005
|
+
total += BreadcrumbsControl.HEIGHT;
|
|
1006
|
+
}
|
|
1007
|
+
return { total, offset };
|
|
1008
|
+
}
|
|
1009
|
+
layout(dimensions, options) {
|
|
1010
|
+
Object.assign(this.dimensions, dimensions);
|
|
1011
|
+
if (!this.layoutScheduler.value) {
|
|
1012
|
+
const scheduledLayout = scheduleAtNextAnimationFrame(() => {
|
|
1013
|
+
this.doLayout(this.dimensions, this.layoutScheduler.value?.options );
|
|
1014
|
+
this.layoutScheduler.clear();
|
|
1015
|
+
});
|
|
1016
|
+
this.layoutScheduler.value = { options, dispose: () => scheduledLayout.dispose() };
|
|
1017
|
+
}
|
|
1018
|
+
if (options?.forceRevealActiveTab) {
|
|
1019
|
+
this.layoutScheduler.value.options = {
|
|
1020
|
+
...this.layoutScheduler.value.options,
|
|
1021
|
+
forceRevealActiveTab: true
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
if (!this.dimensions.used) {
|
|
1025
|
+
this.dimensions.used = ( new Dimension(dimensions.container.width, this.computeHeight().total));
|
|
1026
|
+
}
|
|
1027
|
+
return this.dimensions.used;
|
|
1028
|
+
}
|
|
1029
|
+
doLayout(dimensions, options) {
|
|
1030
|
+
const activeTabAndIndex = this.group.activeEditor ? this.getTabAndIndex(this.group.activeEditor) : undefined;
|
|
1031
|
+
if (activeTabAndIndex && dimensions.container !== Dimension.None && dimensions.available !== Dimension.None) {
|
|
1032
|
+
this.doLayoutBreadcrumbs(dimensions);
|
|
1033
|
+
const [activeTab, activeIndex] = activeTabAndIndex;
|
|
1034
|
+
this.doLayoutTabs(activeTab, activeIndex, dimensions, options);
|
|
1035
|
+
}
|
|
1036
|
+
const oldDimension = this.dimensions.used;
|
|
1037
|
+
const newDimension = this.dimensions.used = ( new Dimension(dimensions.container.width, this.computeHeight().total));
|
|
1038
|
+
if (oldDimension && oldDimension.height !== newDimension.height) {
|
|
1039
|
+
this.group.relayout();
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
handleBreadcrumbsEnablementChange() {
|
|
1043
|
+
this.group.relayout();
|
|
1044
|
+
}
|
|
1045
|
+
doLayoutBreadcrumbs(dimensions) {
|
|
1046
|
+
if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
|
|
1047
|
+
this.breadcrumbsControl.layout(( new Dimension(dimensions.container.width, BreadcrumbsControl.HEIGHT)));
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
doLayoutTabs(activeTab, activeIndex, dimensions, options) {
|
|
1051
|
+
const tabsWrapMultiLine = this.doLayoutTabsWrapping(dimensions);
|
|
1052
|
+
if (!tabsWrapMultiLine) {
|
|
1053
|
+
this.doLayoutTabsNonWrapping(activeTab, activeIndex, options);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
doLayoutTabsWrapping(dimensions) {
|
|
1057
|
+
const [tabsAndActionsContainer, tabsContainer, editorToolbarContainer, tabsScrollbar] = assertAllDefined(this.tabsAndActionsContainer, this.tabsContainer, this.editorToolbarContainer, this.tabsScrollbar);
|
|
1058
|
+
const didTabsWrapMultiLine = tabsAndActionsContainer.classList.contains('wrapping');
|
|
1059
|
+
let tabsWrapMultiLine = didTabsWrapMultiLine;
|
|
1060
|
+
function updateTabsWrapping(enabled) {
|
|
1061
|
+
tabsWrapMultiLine = enabled;
|
|
1062
|
+
tabsAndActionsContainer.classList.toggle('wrapping', tabsWrapMultiLine);
|
|
1063
|
+
tabsContainer.style.setProperty('--last-tab-margin-right', tabsWrapMultiLine ? `${editorToolbarContainer.offsetWidth}px` : '0');
|
|
1064
|
+
}
|
|
1065
|
+
if (this.accessor.partOptions.wrapTabs) {
|
|
1066
|
+
const visibleTabsWidth = tabsContainer.offsetWidth;
|
|
1067
|
+
const allTabsWidth = tabsContainer.scrollWidth;
|
|
1068
|
+
const lastTabFitsWrapped = () => {
|
|
1069
|
+
const lastTab = this.getLastTab();
|
|
1070
|
+
if (!lastTab) {
|
|
1071
|
+
return true;
|
|
1072
|
+
}
|
|
1073
|
+
const lastTabOverlapWithToolbarWidth = lastTab.offsetWidth + editorToolbarContainer.offsetWidth - dimensions.available.width;
|
|
1074
|
+
if (lastTabOverlapWithToolbarWidth > 1) {
|
|
1075
|
+
return false;
|
|
1076
|
+
}
|
|
1077
|
+
return true;
|
|
1078
|
+
};
|
|
1079
|
+
if (tabsWrapMultiLine || (allTabsWidth > visibleTabsWidth && lastTabFitsWrapped())) {
|
|
1080
|
+
updateTabsWrapping(true);
|
|
1081
|
+
}
|
|
1082
|
+
if (tabsWrapMultiLine) {
|
|
1083
|
+
if ((tabsContainer.offsetHeight > dimensions.available.height) ||
|
|
1084
|
+
(allTabsWidth === visibleTabsWidth && tabsContainer.offsetHeight === TabsTitleControl.TAB_HEIGHT) ||
|
|
1085
|
+
(!lastTabFitsWrapped())
|
|
1086
|
+
) {
|
|
1087
|
+
updateTabsWrapping(false);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
else if (didTabsWrapMultiLine) {
|
|
1092
|
+
updateTabsWrapping(false);
|
|
1093
|
+
}
|
|
1094
|
+
if (tabsWrapMultiLine && !didTabsWrapMultiLine) {
|
|
1095
|
+
const visibleTabsWidth = tabsContainer.offsetWidth;
|
|
1096
|
+
tabsScrollbar.setScrollDimensions({
|
|
1097
|
+
width: visibleTabsWidth,
|
|
1098
|
+
scrollWidth: visibleTabsWidth
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
if (tabsWrapMultiLine) {
|
|
1102
|
+
const tabs = ( new Map());
|
|
1103
|
+
let currentTabsPosY = undefined;
|
|
1104
|
+
let lastTab = undefined;
|
|
1105
|
+
for (const child of tabsContainer.children) {
|
|
1106
|
+
const tab = child;
|
|
1107
|
+
const tabPosY = tab.offsetTop;
|
|
1108
|
+
if (tabPosY !== currentTabsPosY) {
|
|
1109
|
+
currentTabsPosY = tabPosY;
|
|
1110
|
+
if (lastTab) {
|
|
1111
|
+
tabs.set(lastTab, true);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
lastTab = tab;
|
|
1115
|
+
tabs.set(tab, false);
|
|
1116
|
+
}
|
|
1117
|
+
if (lastTab) {
|
|
1118
|
+
tabs.set(lastTab, true);
|
|
1119
|
+
}
|
|
1120
|
+
for (const [tab, lastInRow] of tabs) {
|
|
1121
|
+
tab.classList.toggle('last-in-row', lastInRow);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
return tabsWrapMultiLine;
|
|
1125
|
+
}
|
|
1126
|
+
doLayoutTabsNonWrapping(activeTab, activeIndex, options) {
|
|
1127
|
+
const [tabsContainer, tabsScrollbar] = assertAllDefined(this.tabsContainer, this.tabsScrollbar);
|
|
1128
|
+
const visibleTabsWidth = tabsContainer.offsetWidth;
|
|
1129
|
+
const allTabsWidth = tabsContainer.scrollWidth;
|
|
1130
|
+
let stickyTabsWidth = 0;
|
|
1131
|
+
if (this.group.stickyCount > 0) {
|
|
1132
|
+
let stickyTabWidth = 0;
|
|
1133
|
+
switch (this.accessor.partOptions.pinnedTabSizing) {
|
|
1134
|
+
case 'compact':
|
|
1135
|
+
stickyTabWidth = TabsTitleControl.TAB_WIDTH.compact;
|
|
1136
|
+
break;
|
|
1137
|
+
case 'shrink':
|
|
1138
|
+
stickyTabWidth = TabsTitleControl.TAB_WIDTH.shrink;
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
stickyTabsWidth = this.group.stickyCount * stickyTabWidth;
|
|
1142
|
+
}
|
|
1143
|
+
let activeTabPositionStatic = this.accessor.partOptions.pinnedTabSizing !== 'normal' && this.group.isSticky(activeIndex);
|
|
1144
|
+
let availableTabsContainerWidth = visibleTabsWidth - stickyTabsWidth;
|
|
1145
|
+
if (this.group.stickyCount > 0 && availableTabsContainerWidth < TabsTitleControl.TAB_WIDTH.fit) {
|
|
1146
|
+
tabsContainer.classList.add('disable-sticky-tabs');
|
|
1147
|
+
availableTabsContainerWidth = visibleTabsWidth;
|
|
1148
|
+
stickyTabsWidth = 0;
|
|
1149
|
+
activeTabPositionStatic = false;
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
tabsContainer.classList.remove('disable-sticky-tabs');
|
|
1153
|
+
}
|
|
1154
|
+
let activeTabPosX;
|
|
1155
|
+
let activeTabWidth;
|
|
1156
|
+
if (!this.blockRevealActiveTab) {
|
|
1157
|
+
activeTabPosX = activeTab.offsetLeft;
|
|
1158
|
+
activeTabWidth = activeTab.offsetWidth;
|
|
1159
|
+
}
|
|
1160
|
+
const { width: oldVisibleTabsWidth, scrollWidth: oldAllTabsWidth } = tabsScrollbar.getScrollDimensions();
|
|
1161
|
+
tabsScrollbar.setScrollDimensions({
|
|
1162
|
+
width: visibleTabsWidth,
|
|
1163
|
+
scrollWidth: allTabsWidth
|
|
1164
|
+
});
|
|
1165
|
+
const dimensionsChanged = oldVisibleTabsWidth !== visibleTabsWidth || oldAllTabsWidth !== allTabsWidth;
|
|
1166
|
+
if (this.blockRevealActiveTab ||
|
|
1167
|
+
typeof activeTabPosX !== 'number' ||
|
|
1168
|
+
typeof activeTabWidth !== 'number' ||
|
|
1169
|
+
activeTabPositionStatic ||
|
|
1170
|
+
(!dimensionsChanged && !options?.forceRevealActiveTab)
|
|
1171
|
+
) {
|
|
1172
|
+
this.blockRevealActiveTab = false;
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
const tabsContainerScrollPosX = tabsScrollbar.getScrollPosition().scrollLeft;
|
|
1176
|
+
const activeTabFits = activeTabWidth <= availableTabsContainerWidth;
|
|
1177
|
+
const adjustedActiveTabPosX = activeTabPosX - stickyTabsWidth;
|
|
1178
|
+
if (activeTabFits && tabsContainerScrollPosX + availableTabsContainerWidth < adjustedActiveTabPosX + activeTabWidth) {
|
|
1179
|
+
tabsScrollbar.setScrollPosition({
|
|
1180
|
+
scrollLeft: tabsContainerScrollPosX + (((adjustedActiveTabPosX + activeTabWidth) - (tabsContainerScrollPosX + availableTabsContainerWidth)) )
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
else if (tabsContainerScrollPosX > adjustedActiveTabPosX || !activeTabFits) {
|
|
1184
|
+
tabsScrollbar.setScrollPosition({
|
|
1185
|
+
scrollLeft: adjustedActiveTabPosX
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
getTabAndIndex(editor) {
|
|
1190
|
+
const editorIndex = this.group.getIndexOfEditor(editor);
|
|
1191
|
+
const tab = this.getTabAtIndex(editorIndex);
|
|
1192
|
+
if (tab) {
|
|
1193
|
+
return [tab, editorIndex];
|
|
1194
|
+
}
|
|
1195
|
+
return undefined;
|
|
1196
|
+
}
|
|
1197
|
+
getTabAtIndex(editorIndex) {
|
|
1198
|
+
if (editorIndex >= 0) {
|
|
1199
|
+
const tabsContainer = assertIsDefined(this.tabsContainer);
|
|
1200
|
+
return tabsContainer.children[editorIndex];
|
|
1201
|
+
}
|
|
1202
|
+
return undefined;
|
|
1203
|
+
}
|
|
1204
|
+
getLastTab() {
|
|
1205
|
+
return this.getTabAtIndex(this.group.count - 1);
|
|
1206
|
+
}
|
|
1207
|
+
blockRevealActiveTabOnce() {
|
|
1208
|
+
this.blockRevealActiveTab = true;
|
|
1209
|
+
}
|
|
1210
|
+
originatesFromTabActionBar(e) {
|
|
1211
|
+
let element;
|
|
1212
|
+
if (e instanceof MouseEvent) {
|
|
1213
|
+
element = (e.target || e.srcElement);
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
element = e.initialTarget;
|
|
1217
|
+
}
|
|
1218
|
+
return !!findParentWithClass(element, 'action-item', 'tab');
|
|
1219
|
+
}
|
|
1220
|
+
async onDrop(e, targetIndex, tabsContainer) {
|
|
1221
|
+
EventHelper.stop(e, true);
|
|
1222
|
+
this.updateDropFeedback(tabsContainer, false);
|
|
1223
|
+
tabsContainer.classList.remove('scroll');
|
|
1224
|
+
if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
|
|
1225
|
+
const data = this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype);
|
|
1226
|
+
if (Array.isArray(data)) {
|
|
1227
|
+
const sourceGroup = this.accessor.getGroup(data[0].identifier);
|
|
1228
|
+
if (sourceGroup) {
|
|
1229
|
+
const mergeGroupOptions = { index: targetIndex };
|
|
1230
|
+
if (!this.isMoveOperation(e, sourceGroup.id)) {
|
|
1231
|
+
mergeGroupOptions.mode = 0 ;
|
|
1232
|
+
}
|
|
1233
|
+
this.accessor.mergeGroup(sourceGroup, this.group, mergeGroupOptions);
|
|
1234
|
+
}
|
|
1235
|
+
this.group.focus();
|
|
1236
|
+
this.groupTransfer.clearData(DraggedEditorGroupIdentifier.prototype);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
else if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
|
|
1240
|
+
const data = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
|
|
1241
|
+
if (Array.isArray(data)) {
|
|
1242
|
+
const draggedEditor = data[0].identifier;
|
|
1243
|
+
const sourceGroup = this.accessor.getGroup(draggedEditor.groupId);
|
|
1244
|
+
if (sourceGroup) {
|
|
1245
|
+
if (this.isMoveOperation(e, draggedEditor.groupId, draggedEditor.editor)) {
|
|
1246
|
+
sourceGroup.moveEditor(draggedEditor.editor, this.group, { index: targetIndex });
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
sourceGroup.copyEditor(draggedEditor.editor, this.group, { index: targetIndex });
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
this.group.focus();
|
|
1253
|
+
this.editorTransfer.clearData(DraggedEditorIdentifier.prototype);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
else if (this.treeItemsTransfer.hasData(DraggedTreeItemsIdentifier.prototype)) {
|
|
1257
|
+
const data = this.treeItemsTransfer.getData(DraggedTreeItemsIdentifier.prototype);
|
|
1258
|
+
if (Array.isArray(data)) {
|
|
1259
|
+
const editors = [];
|
|
1260
|
+
for (const id of data) {
|
|
1261
|
+
const dataTransferItem = await this.treeViewsDragAndDropService.removeDragOperationTransfer(id.identifier);
|
|
1262
|
+
if (dataTransferItem) {
|
|
1263
|
+
const treeDropData = await extractTreeDropData(dataTransferItem);
|
|
1264
|
+
editors.push(...( treeDropData.map(
|
|
1265
|
+
editor => ({ ...editor, options: { ...editor.options, pinned: true, index: targetIndex } })
|
|
1266
|
+
)));
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
this.editorService.openEditors(editors, this.group, { validateTrust: true });
|
|
1270
|
+
}
|
|
1271
|
+
this.treeItemsTransfer.clearData(DraggedTreeItemsIdentifier.prototype);
|
|
1272
|
+
}
|
|
1273
|
+
else {
|
|
1274
|
+
const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: false });
|
|
1275
|
+
dropHandler.handleDrop(e, () => this.group, () => this.group.focus(), targetIndex);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
isMoveOperation(e, sourceGroup, sourceEditor) {
|
|
1279
|
+
if (sourceEditor?.hasCapability(8 )) {
|
|
1280
|
+
return true;
|
|
1281
|
+
}
|
|
1282
|
+
const isCopy = (e.ctrlKey && !isMacintosh) || (e.altKey && isMacintosh);
|
|
1283
|
+
return !isCopy || sourceGroup === this.group.id;
|
|
1284
|
+
}
|
|
1285
|
+
dispose() {
|
|
1286
|
+
super.dispose();
|
|
1287
|
+
this.tabDisposables = dispose(this.tabDisposables);
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
TabsTitleControl.SCROLLBAR_SIZES = {
|
|
1291
|
+
default: 3,
|
|
1292
|
+
large: 10
|
|
1293
|
+
};
|
|
1294
|
+
TabsTitleControl.TAB_WIDTH = {
|
|
1295
|
+
compact: 38,
|
|
1296
|
+
shrink: 80,
|
|
1297
|
+
fit: 120
|
|
1298
|
+
};
|
|
1299
|
+
TabsTitleControl.TAB_HEIGHT = 35;
|
|
1300
|
+
TabsTitleControl.DRAG_OVER_OPEN_TAB_THRESHOLD = 1500;
|
|
1301
|
+
TabsTitleControl.MOUSE_WHEEL_EVENT_THRESHOLD = 150;
|
|
1302
|
+
TabsTitleControl.MOUSE_WHEEL_DISTANCE_THRESHOLD = 1.5;
|
|
1303
|
+
TabsTitleControl = ( __decorate([
|
|
1304
|
+
( __param(3, IContextMenuService)),
|
|
1305
|
+
( __param(4, IInstantiationService)),
|
|
1306
|
+
( __param(5, IContextKeyService)),
|
|
1307
|
+
( __param(6, IKeybindingService)),
|
|
1308
|
+
( __param(7, INotificationService)),
|
|
1309
|
+
( __param(8, IMenuService)),
|
|
1310
|
+
( __param(9, IQuickInputService)),
|
|
1311
|
+
( __param(10, IThemeService)),
|
|
1312
|
+
( __param(11, IConfigurationService)),
|
|
1313
|
+
( __param(12, IFileService)),
|
|
1314
|
+
( __param(13, IEditorService)),
|
|
1315
|
+
( __param(14, IPathService)),
|
|
1316
|
+
( __param(15, IEditorGroupsService)),
|
|
1317
|
+
( __param(16, ITreeViewsDnDService))
|
|
1318
|
+
], TabsTitleControl));
|
|
1319
|
+
registerThemingParticipant((theme, collector) => {
|
|
1320
|
+
const borderColor = theme.getColor(TAB_BORDER);
|
|
1321
|
+
if (borderColor) {
|
|
1322
|
+
collector.addRule(`
|
|
1323
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.wrapping .tabs-container > .tab {
|
|
1324
|
+
border-bottom: 1px solid ${borderColor};
|
|
1325
|
+
}
|
|
1326
|
+
`);
|
|
1327
|
+
}
|
|
1328
|
+
const activeContrastBorderColor = theme.getColor(activeContrastBorder);
|
|
1329
|
+
if (activeContrastBorderColor) {
|
|
1330
|
+
collector.addRule(`
|
|
1331
|
+
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active,
|
|
1332
|
+
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover {
|
|
1333
|
+
outline: 1px solid;
|
|
1334
|
+
outline-offset: -5px;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active {
|
|
1338
|
+
outline: 1px dotted;
|
|
1339
|
+
outline-offset: -5px;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
|
|
1343
|
+
outline: 1px dashed;
|
|
1344
|
+
outline-offset: -5px;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-actions .action-label,
|
|
1348
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-actions .action-label,
|
|
1349
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-actions .action-label,
|
|
1350
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky > .tab-actions .action-label,
|
|
1351
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-actions .action-label {
|
|
1352
|
+
opacity: 1 !important;
|
|
1353
|
+
}
|
|
1354
|
+
`);
|
|
1355
|
+
}
|
|
1356
|
+
const contrastBorderColor = theme.getColor(contrastBorder);
|
|
1357
|
+
if (contrastBorderColor) {
|
|
1358
|
+
collector.addRule(`
|
|
1359
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions {
|
|
1360
|
+
outline: 1px solid ${contrastBorderColor}
|
|
1361
|
+
}
|
|
1362
|
+
`);
|
|
1363
|
+
}
|
|
1364
|
+
const tabHoverBackground = theme.getColor(TAB_HOVER_BACKGROUND);
|
|
1365
|
+
if (tabHoverBackground) {
|
|
1366
|
+
collector.addRule(`
|
|
1367
|
+
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover {
|
|
1368
|
+
background-color: ${tabHoverBackground} !important;
|
|
1369
|
+
}
|
|
1370
|
+
`);
|
|
1371
|
+
}
|
|
1372
|
+
const tabUnfocusedHoverBackground = theme.getColor(TAB_UNFOCUSED_HOVER_BACKGROUND);
|
|
1373
|
+
if (tabUnfocusedHoverBackground) {
|
|
1374
|
+
collector.addRule(`
|
|
1375
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
|
|
1376
|
+
background-color: ${tabUnfocusedHoverBackground} !important;
|
|
1377
|
+
}
|
|
1378
|
+
`);
|
|
1379
|
+
}
|
|
1380
|
+
const tabHoverForeground = theme.getColor(TAB_HOVER_FOREGROUND);
|
|
1381
|
+
if (tabHoverForeground) {
|
|
1382
|
+
collector.addRule(`
|
|
1383
|
+
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover {
|
|
1384
|
+
color: ${tabHoverForeground} !important;
|
|
1385
|
+
}
|
|
1386
|
+
`);
|
|
1387
|
+
}
|
|
1388
|
+
const tabUnfocusedHoverForeground = theme.getColor(TAB_UNFOCUSED_HOVER_FOREGROUND);
|
|
1389
|
+
if (tabUnfocusedHoverForeground) {
|
|
1390
|
+
collector.addRule(`
|
|
1391
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
|
|
1392
|
+
color: ${tabUnfocusedHoverForeground} !important;
|
|
1393
|
+
}
|
|
1394
|
+
`);
|
|
1395
|
+
}
|
|
1396
|
+
const tabHoverBorder = theme.getColor(TAB_HOVER_BORDER);
|
|
1397
|
+
if (tabHoverBorder) {
|
|
1398
|
+
collector.addRule(`
|
|
1399
|
+
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
|
|
1400
|
+
display: block;
|
|
1401
|
+
position: absolute;
|
|
1402
|
+
left: 0;
|
|
1403
|
+
pointer-events: none;
|
|
1404
|
+
width: 100%;
|
|
1405
|
+
z-index: 10;
|
|
1406
|
+
bottom: 0;
|
|
1407
|
+
height: 1px;
|
|
1408
|
+
background-color: ${tabHoverBorder};
|
|
1409
|
+
}
|
|
1410
|
+
`);
|
|
1411
|
+
}
|
|
1412
|
+
const tabUnfocusedHoverBorder = theme.getColor(TAB_UNFOCUSED_HOVER_BORDER);
|
|
1413
|
+
if (tabUnfocusedHoverBorder) {
|
|
1414
|
+
collector.addRule(`
|
|
1415
|
+
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
|
|
1416
|
+
display: block;
|
|
1417
|
+
position: absolute;
|
|
1418
|
+
left: 0;
|
|
1419
|
+
pointer-events: none;
|
|
1420
|
+
width: 100%;
|
|
1421
|
+
z-index: 10;
|
|
1422
|
+
bottom: 0;
|
|
1423
|
+
height: 1px;
|
|
1424
|
+
background-color: ${tabUnfocusedHoverBorder};
|
|
1425
|
+
}
|
|
1426
|
+
`);
|
|
1427
|
+
}
|
|
1428
|
+
if (isHighContrast(theme.type) && !isSafari && !activeContrastBorderColor) {
|
|
1429
|
+
const workbenchBackground = WORKBENCH_BACKGROUND(theme);
|
|
1430
|
+
const editorBackgroundColor = theme.getColor(editorBackground);
|
|
1431
|
+
const editorGroupHeaderTabsBackground = theme.getColor(EDITOR_GROUP_HEADER_TABS_BACKGROUND);
|
|
1432
|
+
const editorDragAndDropBackground = theme.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND);
|
|
1433
|
+
let adjustedTabBackground;
|
|
1434
|
+
if (editorGroupHeaderTabsBackground && editorBackgroundColor) {
|
|
1435
|
+
adjustedTabBackground = editorGroupHeaderTabsBackground.flatten(editorBackgroundColor, editorBackgroundColor, workbenchBackground);
|
|
1436
|
+
}
|
|
1437
|
+
let adjustedTabDragBackground;
|
|
1438
|
+
if (editorGroupHeaderTabsBackground && editorBackgroundColor && editorDragAndDropBackground && editorBackgroundColor) {
|
|
1439
|
+
adjustedTabDragBackground = editorGroupHeaderTabsBackground.flatten(editorBackgroundColor, editorDragAndDropBackground, editorBackgroundColor, workbenchBackground);
|
|
1440
|
+
}
|
|
1441
|
+
const makeTabHoverBackgroundRule = (color, colorDrag, hasFocus = false) => `
|
|
1442
|
+
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${hasFocus ? '.active' : ''} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
|
|
1443
|
+
background: linear-gradient(to left, ${color}, transparent) !important;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${hasFocus ? '.active' : ''} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
|
|
1447
|
+
background: linear-gradient(to left, ${colorDrag}, transparent) !important;
|
|
1448
|
+
}
|
|
1449
|
+
`;
|
|
1450
|
+
if (tabHoverBackground && adjustedTabBackground && adjustedTabDragBackground) {
|
|
1451
|
+
const adjustedColor = tabHoverBackground.flatten(adjustedTabBackground);
|
|
1452
|
+
const adjustedColorDrag = tabHoverBackground.flatten(adjustedTabDragBackground);
|
|
1453
|
+
collector.addRule(makeTabHoverBackgroundRule(adjustedColor, adjustedColorDrag, true));
|
|
1454
|
+
}
|
|
1455
|
+
if (tabUnfocusedHoverBackground && adjustedTabBackground && adjustedTabDragBackground) {
|
|
1456
|
+
const adjustedColor = tabUnfocusedHoverBackground.flatten(adjustedTabBackground);
|
|
1457
|
+
const adjustedColorDrag = tabUnfocusedHoverBackground.flatten(adjustedTabDragBackground);
|
|
1458
|
+
collector.addRule(makeTabHoverBackgroundRule(adjustedColor, adjustedColorDrag));
|
|
1459
|
+
}
|
|
1460
|
+
if (editorDragAndDropBackground && adjustedTabDragBackground) {
|
|
1461
|
+
const adjustedColorDrag = editorDragAndDropBackground.flatten(adjustedTabDragBackground);
|
|
1462
|
+
collector.addRule(`
|
|
1463
|
+
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
|
|
1464
|
+
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
|
|
1465
|
+
background: linear-gradient(to left, ${adjustedColorDrag}, transparent) !important;
|
|
1466
|
+
}
|
|
1467
|
+
`);
|
|
1468
|
+
}
|
|
1469
|
+
const makeTabBackgroundRule = (color, colorDrag, focused, active) => `
|
|
1470
|
+
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${focused ? '.active' : ':not(.active)'} > .title .tabs-container > .tab.sizing-shrink${active ? '.active' : ''}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
|
|
1471
|
+
background: linear-gradient(to left, ${color}, transparent);
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${focused ? '.active' : ':not(.active)'} > .title .tabs-container > .tab.sizing-shrink${active ? '.active' : ''}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
|
|
1475
|
+
background: linear-gradient(to left, ${colorDrag}, transparent);
|
|
1476
|
+
}
|
|
1477
|
+
`;
|
|
1478
|
+
const tabActiveBackground = theme.getColor(TAB_ACTIVE_BACKGROUND);
|
|
1479
|
+
if (tabActiveBackground && adjustedTabBackground && adjustedTabDragBackground) {
|
|
1480
|
+
const adjustedColor = tabActiveBackground.flatten(adjustedTabBackground);
|
|
1481
|
+
const adjustedColorDrag = tabActiveBackground.flatten(adjustedTabDragBackground);
|
|
1482
|
+
collector.addRule(makeTabBackgroundRule(adjustedColor, adjustedColorDrag, true, true));
|
|
1483
|
+
}
|
|
1484
|
+
const tabUnfocusedActiveBackground = theme.getColor(TAB_UNFOCUSED_ACTIVE_BACKGROUND);
|
|
1485
|
+
if (tabUnfocusedActiveBackground && adjustedTabBackground && adjustedTabDragBackground) {
|
|
1486
|
+
const adjustedColor = tabUnfocusedActiveBackground.flatten(adjustedTabBackground);
|
|
1487
|
+
const adjustedColorDrag = tabUnfocusedActiveBackground.flatten(adjustedTabDragBackground);
|
|
1488
|
+
collector.addRule(makeTabBackgroundRule(adjustedColor, adjustedColorDrag, false, true));
|
|
1489
|
+
}
|
|
1490
|
+
const tabInactiveBackground = theme.getColor(TAB_INACTIVE_BACKGROUND);
|
|
1491
|
+
if (tabInactiveBackground && adjustedTabBackground && adjustedTabDragBackground) {
|
|
1492
|
+
const adjustedColor = tabInactiveBackground.flatten(adjustedTabBackground);
|
|
1493
|
+
const adjustedColorDrag = tabInactiveBackground.flatten(adjustedTabDragBackground);
|
|
1494
|
+
collector.addRule(makeTabBackgroundRule(adjustedColor, adjustedColorDrag, true, false));
|
|
1495
|
+
}
|
|
1496
|
+
const tabUnfocusedInactiveBackground = theme.getColor(TAB_UNFOCUSED_INACTIVE_BACKGROUND);
|
|
1497
|
+
if (tabUnfocusedInactiveBackground && adjustedTabBackground && adjustedTabDragBackground) {
|
|
1498
|
+
const adjustedColor = tabUnfocusedInactiveBackground.flatten(adjustedTabBackground);
|
|
1499
|
+
const adjustedColorDrag = tabUnfocusedInactiveBackground.flatten(adjustedTabDragBackground);
|
|
1500
|
+
collector.addRule(makeTabBackgroundRule(adjustedColor, adjustedColorDrag, false, false));
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
export { TabsTitleControl };
|