@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,674 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
+
import { EditorCloseContext, SideBySideEditor, EditorExtensions } from '../editor.js';
|
|
4
|
+
import { EditorInput } from './editorInput.js';
|
|
5
|
+
import { SideBySideEditorInput } from './sideBySideEditorInput.js';
|
|
6
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
7
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
8
|
+
import { Disposable, dispose, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
9
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
10
|
+
import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
11
|
+
const EditorOpenPositioning = {
|
|
12
|
+
LEFT: 'left',
|
|
13
|
+
RIGHT: 'right',
|
|
14
|
+
FIRST: 'first',
|
|
15
|
+
LAST: 'last'
|
|
16
|
+
};
|
|
17
|
+
function isSerializedEditorGroupModel(group) {
|
|
18
|
+
const candidate = group;
|
|
19
|
+
return !!(candidate && typeof candidate === 'object' && Array.isArray(candidate.editors) && Array.isArray(candidate.mru));
|
|
20
|
+
}
|
|
21
|
+
function isGroupEditorOpenEvent(e) {
|
|
22
|
+
const candidate = e;
|
|
23
|
+
return candidate.kind === 3 && candidate.editorIndex !== undefined;
|
|
24
|
+
}
|
|
25
|
+
function isGroupEditorCloseEvent(e) {
|
|
26
|
+
const candidate = e;
|
|
27
|
+
return candidate.kind === 4 && candidate.editorIndex !== undefined && candidate.context !== undefined && candidate.sticky !== undefined;
|
|
28
|
+
}
|
|
29
|
+
let EditorGroupModel = class EditorGroupModel extends Disposable {
|
|
30
|
+
get id() { return this._id; }
|
|
31
|
+
constructor(labelOrSerializedGroup, instantiationService, configurationService) {
|
|
32
|
+
super();
|
|
33
|
+
this.instantiationService = instantiationService;
|
|
34
|
+
this.configurationService = configurationService;
|
|
35
|
+
this._onDidModelChange = this._register(( new Emitter()));
|
|
36
|
+
this.onDidModelChange = this._onDidModelChange.event;
|
|
37
|
+
this.editors = [];
|
|
38
|
+
this.mru = [];
|
|
39
|
+
this.locked = false;
|
|
40
|
+
this.preview = null;
|
|
41
|
+
this.active = null;
|
|
42
|
+
this.sticky = -1;
|
|
43
|
+
if (isSerializedEditorGroupModel(labelOrSerializedGroup)) {
|
|
44
|
+
this._id = this.deserialize(labelOrSerializedGroup);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this._id = EditorGroupModel.IDS++;
|
|
48
|
+
}
|
|
49
|
+
this.onConfigurationUpdated();
|
|
50
|
+
this.registerListeners();
|
|
51
|
+
}
|
|
52
|
+
registerListeners() {
|
|
53
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
|
|
54
|
+
}
|
|
55
|
+
onConfigurationUpdated(e) {
|
|
56
|
+
if (e && !e.affectsConfiguration('workbench.editor.openPositioning') && !e.affectsConfiguration('workbench.editor.focusRecentEditorAfterClose')) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.editorOpenPositioning = this.configurationService.getValue('workbench.editor.openPositioning');
|
|
60
|
+
this.focusRecentEditorAfterClose = this.configurationService.getValue('workbench.editor.focusRecentEditorAfterClose');
|
|
61
|
+
}
|
|
62
|
+
get count() {
|
|
63
|
+
return this.editors.length;
|
|
64
|
+
}
|
|
65
|
+
get stickyCount() {
|
|
66
|
+
return this.sticky + 1;
|
|
67
|
+
}
|
|
68
|
+
getEditors(order, options) {
|
|
69
|
+
const editors = order === 0 ? this.mru.slice(0) : this.editors.slice(0);
|
|
70
|
+
if (options?.excludeSticky) {
|
|
71
|
+
if (order === 0 ) {
|
|
72
|
+
return editors.filter(editor => !this.isSticky(editor));
|
|
73
|
+
}
|
|
74
|
+
return editors.slice(this.sticky + 1);
|
|
75
|
+
}
|
|
76
|
+
return editors;
|
|
77
|
+
}
|
|
78
|
+
getEditorByIndex(index) {
|
|
79
|
+
return this.editors[index];
|
|
80
|
+
}
|
|
81
|
+
get activeEditor() {
|
|
82
|
+
return this.active;
|
|
83
|
+
}
|
|
84
|
+
isActive(editor) {
|
|
85
|
+
return this.matches(this.active, editor);
|
|
86
|
+
}
|
|
87
|
+
get previewEditor() {
|
|
88
|
+
return this.preview;
|
|
89
|
+
}
|
|
90
|
+
openEditor(candidate, options) {
|
|
91
|
+
const makeSticky = options?.sticky || (typeof options?.index === 'number' && this.isSticky(options.index));
|
|
92
|
+
const makePinned = options?.pinned || options?.sticky;
|
|
93
|
+
const makeActive = options?.active || !this.activeEditor || (!makePinned && this.matches(this.preview, this.activeEditor));
|
|
94
|
+
const existingEditorAndIndex = this.findEditor(candidate, options);
|
|
95
|
+
if (!existingEditorAndIndex) {
|
|
96
|
+
const newEditor = candidate;
|
|
97
|
+
const indexOfActive = this.indexOf(this.active);
|
|
98
|
+
let targetIndex;
|
|
99
|
+
if (options && typeof options.index === 'number') {
|
|
100
|
+
targetIndex = options.index;
|
|
101
|
+
}
|
|
102
|
+
else if (this.editorOpenPositioning === EditorOpenPositioning.FIRST) {
|
|
103
|
+
targetIndex = 0;
|
|
104
|
+
if (!makeSticky && this.isSticky(targetIndex)) {
|
|
105
|
+
targetIndex = this.sticky + 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else if (this.editorOpenPositioning === EditorOpenPositioning.LAST) {
|
|
109
|
+
targetIndex = this.editors.length;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
if (this.editorOpenPositioning === EditorOpenPositioning.LEFT) {
|
|
113
|
+
if (indexOfActive === 0 || !this.editors.length) {
|
|
114
|
+
targetIndex = 0;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
targetIndex = indexOfActive;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
targetIndex = indexOfActive + 1;
|
|
122
|
+
}
|
|
123
|
+
if (!makeSticky && this.isSticky(targetIndex)) {
|
|
124
|
+
targetIndex = this.sticky + 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (makeSticky) {
|
|
128
|
+
this.sticky++;
|
|
129
|
+
if (!this.isSticky(targetIndex)) {
|
|
130
|
+
targetIndex = this.sticky;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (makePinned || !this.preview) {
|
|
134
|
+
this.splice(targetIndex, false, newEditor);
|
|
135
|
+
}
|
|
136
|
+
if (!makePinned) {
|
|
137
|
+
if (this.preview) {
|
|
138
|
+
const indexOfPreview = this.indexOf(this.preview);
|
|
139
|
+
if (targetIndex > indexOfPreview) {
|
|
140
|
+
targetIndex--;
|
|
141
|
+
}
|
|
142
|
+
this.replaceEditor(this.preview, newEditor, targetIndex, !makeActive);
|
|
143
|
+
}
|
|
144
|
+
this.preview = newEditor;
|
|
145
|
+
}
|
|
146
|
+
this.registerEditorListeners(newEditor);
|
|
147
|
+
const event = {
|
|
148
|
+
kind: 3 ,
|
|
149
|
+
editor: newEditor,
|
|
150
|
+
editorIndex: targetIndex
|
|
151
|
+
};
|
|
152
|
+
this._onDidModelChange.fire(event);
|
|
153
|
+
if (makeActive) {
|
|
154
|
+
this.doSetActive(newEditor, targetIndex);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
editor: newEditor,
|
|
158
|
+
isNew: true
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
const [existingEditor, existingEditorIndex] = existingEditorAndIndex;
|
|
163
|
+
if (makePinned) {
|
|
164
|
+
this.doPin(existingEditor, existingEditorIndex);
|
|
165
|
+
}
|
|
166
|
+
if (makeActive) {
|
|
167
|
+
this.doSetActive(existingEditor, existingEditorIndex);
|
|
168
|
+
}
|
|
169
|
+
if (options && typeof options.index === 'number') {
|
|
170
|
+
this.moveEditor(existingEditor, options.index);
|
|
171
|
+
}
|
|
172
|
+
if (makeSticky) {
|
|
173
|
+
this.doStick(existingEditor, this.indexOf(existingEditor));
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
editor: existingEditor,
|
|
177
|
+
isNew: false
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
registerEditorListeners(editor) {
|
|
182
|
+
const listeners = ( new DisposableStore());
|
|
183
|
+
listeners.add(Event.once(editor.onWillDispose)(() => {
|
|
184
|
+
const editorIndex = this.editors.indexOf(editor);
|
|
185
|
+
if (editorIndex >= 0) {
|
|
186
|
+
const event = {
|
|
187
|
+
kind: 12 ,
|
|
188
|
+
editor,
|
|
189
|
+
editorIndex
|
|
190
|
+
};
|
|
191
|
+
this._onDidModelChange.fire(event);
|
|
192
|
+
}
|
|
193
|
+
}));
|
|
194
|
+
listeners.add(editor.onDidChangeDirty(() => {
|
|
195
|
+
const event = {
|
|
196
|
+
kind: 11 ,
|
|
197
|
+
editor,
|
|
198
|
+
editorIndex: this.editors.indexOf(editor)
|
|
199
|
+
};
|
|
200
|
+
this._onDidModelChange.fire(event);
|
|
201
|
+
}));
|
|
202
|
+
listeners.add(editor.onDidChangeLabel(() => {
|
|
203
|
+
const event = {
|
|
204
|
+
kind: 7 ,
|
|
205
|
+
editor,
|
|
206
|
+
editorIndex: this.editors.indexOf(editor)
|
|
207
|
+
};
|
|
208
|
+
this._onDidModelChange.fire(event);
|
|
209
|
+
}));
|
|
210
|
+
listeners.add(editor.onDidChangeCapabilities(() => {
|
|
211
|
+
const event = {
|
|
212
|
+
kind: 8 ,
|
|
213
|
+
editor,
|
|
214
|
+
editorIndex: this.editors.indexOf(editor)
|
|
215
|
+
};
|
|
216
|
+
this._onDidModelChange.fire(event);
|
|
217
|
+
}));
|
|
218
|
+
listeners.add(this.onDidModelChange(event => {
|
|
219
|
+
if (event.kind === 4 && event.editor?.matches(editor)) {
|
|
220
|
+
dispose(listeners);
|
|
221
|
+
}
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
replaceEditor(toReplace, replaceWith, replaceIndex, openNext = true) {
|
|
225
|
+
const closeResult = this.doCloseEditor(toReplace, EditorCloseContext.REPLACE, openNext);
|
|
226
|
+
this.splice(replaceIndex, false, replaceWith);
|
|
227
|
+
if (closeResult) {
|
|
228
|
+
const event = {
|
|
229
|
+
kind: 4 ,
|
|
230
|
+
...closeResult
|
|
231
|
+
};
|
|
232
|
+
this._onDidModelChange.fire(event);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
closeEditor(candidate, context = EditorCloseContext.UNKNOWN, openNext = true) {
|
|
236
|
+
const closeResult = this.doCloseEditor(candidate, context, openNext);
|
|
237
|
+
if (closeResult) {
|
|
238
|
+
const event = {
|
|
239
|
+
kind: 4 ,
|
|
240
|
+
...closeResult
|
|
241
|
+
};
|
|
242
|
+
this._onDidModelChange.fire(event);
|
|
243
|
+
return closeResult;
|
|
244
|
+
}
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
doCloseEditor(candidate, context, openNext) {
|
|
248
|
+
const index = this.indexOf(candidate);
|
|
249
|
+
if (index === -1) {
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
const editor = this.editors[index];
|
|
253
|
+
const sticky = this.isSticky(index);
|
|
254
|
+
if (openNext && this.matches(this.active, editor)) {
|
|
255
|
+
if (this.mru.length > 1) {
|
|
256
|
+
let newActive;
|
|
257
|
+
if (this.focusRecentEditorAfterClose) {
|
|
258
|
+
newActive = this.mru[1];
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
if (index === this.editors.length - 1) {
|
|
262
|
+
newActive = this.editors[index - 1];
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
newActive = this.editors[index + 1];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
this.doSetActive(newActive, this.editors.indexOf(newActive));
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
this.active = null;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (this.matches(this.preview, editor)) {
|
|
275
|
+
this.preview = null;
|
|
276
|
+
}
|
|
277
|
+
this.splice(index, true);
|
|
278
|
+
return { editor, sticky, editorIndex: index, context };
|
|
279
|
+
}
|
|
280
|
+
moveEditor(candidate, toIndex) {
|
|
281
|
+
if (toIndex >= this.editors.length) {
|
|
282
|
+
toIndex = this.editors.length - 1;
|
|
283
|
+
}
|
|
284
|
+
else if (toIndex < 0) {
|
|
285
|
+
toIndex = 0;
|
|
286
|
+
}
|
|
287
|
+
const index = this.indexOf(candidate);
|
|
288
|
+
if (index < 0 || toIndex === index) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const editor = this.editors[index];
|
|
292
|
+
const sticky = this.sticky;
|
|
293
|
+
if (this.isSticky(index) && toIndex > this.sticky) {
|
|
294
|
+
this.sticky--;
|
|
295
|
+
}
|
|
296
|
+
else if (!this.isSticky(index) && toIndex <= this.sticky) {
|
|
297
|
+
this.sticky++;
|
|
298
|
+
}
|
|
299
|
+
this.editors.splice(index, 1);
|
|
300
|
+
this.editors.splice(toIndex, 0, editor);
|
|
301
|
+
const event = {
|
|
302
|
+
kind: 5 ,
|
|
303
|
+
editor,
|
|
304
|
+
oldEditorIndex: index,
|
|
305
|
+
editorIndex: toIndex
|
|
306
|
+
};
|
|
307
|
+
this._onDidModelChange.fire(event);
|
|
308
|
+
if (sticky !== this.sticky) {
|
|
309
|
+
const event = {
|
|
310
|
+
kind: 10 ,
|
|
311
|
+
editor,
|
|
312
|
+
editorIndex: toIndex
|
|
313
|
+
};
|
|
314
|
+
this._onDidModelChange.fire(event);
|
|
315
|
+
}
|
|
316
|
+
return editor;
|
|
317
|
+
}
|
|
318
|
+
setActive(candidate) {
|
|
319
|
+
let result = undefined;
|
|
320
|
+
if (!candidate) {
|
|
321
|
+
this.setGroupActive();
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
result = this.setEditorActive(candidate);
|
|
325
|
+
}
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
328
|
+
setGroupActive() {
|
|
329
|
+
this._onDidModelChange.fire({ kind: 0 });
|
|
330
|
+
}
|
|
331
|
+
setEditorActive(candidate) {
|
|
332
|
+
const res = this.findEditor(candidate);
|
|
333
|
+
if (!res) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const [editor, editorIndex] = res;
|
|
337
|
+
this.doSetActive(editor, editorIndex);
|
|
338
|
+
return editor;
|
|
339
|
+
}
|
|
340
|
+
doSetActive(editor, editorIndex) {
|
|
341
|
+
if (this.matches(this.active, editor)) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
this.active = editor;
|
|
345
|
+
const mruIndex = this.indexOf(editor, this.mru);
|
|
346
|
+
this.mru.splice(mruIndex, 1);
|
|
347
|
+
this.mru.unshift(editor);
|
|
348
|
+
const event = {
|
|
349
|
+
kind: 6 ,
|
|
350
|
+
editor,
|
|
351
|
+
editorIndex
|
|
352
|
+
};
|
|
353
|
+
this._onDidModelChange.fire(event);
|
|
354
|
+
}
|
|
355
|
+
setIndex(index) {
|
|
356
|
+
this._onDidModelChange.fire({ kind: 1 });
|
|
357
|
+
}
|
|
358
|
+
pin(candidate) {
|
|
359
|
+
const res = this.findEditor(candidate);
|
|
360
|
+
if (!res) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const [editor, editorIndex] = res;
|
|
364
|
+
this.doPin(editor, editorIndex);
|
|
365
|
+
return editor;
|
|
366
|
+
}
|
|
367
|
+
doPin(editor, editorIndex) {
|
|
368
|
+
if (this.isPinned(editor)) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
this.preview = null;
|
|
372
|
+
const event = {
|
|
373
|
+
kind: 9 ,
|
|
374
|
+
editor,
|
|
375
|
+
editorIndex
|
|
376
|
+
};
|
|
377
|
+
this._onDidModelChange.fire(event);
|
|
378
|
+
}
|
|
379
|
+
unpin(candidate) {
|
|
380
|
+
const res = this.findEditor(candidate);
|
|
381
|
+
if (!res) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const [editor, editorIndex] = res;
|
|
385
|
+
this.doUnpin(editor, editorIndex);
|
|
386
|
+
return editor;
|
|
387
|
+
}
|
|
388
|
+
doUnpin(editor, editorIndex) {
|
|
389
|
+
if (!this.isPinned(editor)) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const oldPreview = this.preview;
|
|
393
|
+
this.preview = editor;
|
|
394
|
+
const event = {
|
|
395
|
+
kind: 9 ,
|
|
396
|
+
editor,
|
|
397
|
+
editorIndex
|
|
398
|
+
};
|
|
399
|
+
this._onDidModelChange.fire(event);
|
|
400
|
+
if (oldPreview) {
|
|
401
|
+
this.closeEditor(oldPreview, EditorCloseContext.UNPIN);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
isPinned(editorOrIndex) {
|
|
405
|
+
let editor;
|
|
406
|
+
if (typeof editorOrIndex === 'number') {
|
|
407
|
+
editor = this.editors[editorOrIndex];
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
editor = editorOrIndex;
|
|
411
|
+
}
|
|
412
|
+
return !this.matches(this.preview, editor);
|
|
413
|
+
}
|
|
414
|
+
stick(candidate) {
|
|
415
|
+
const res = this.findEditor(candidate);
|
|
416
|
+
if (!res) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const [editor, editorIndex] = res;
|
|
420
|
+
this.doStick(editor, editorIndex);
|
|
421
|
+
return editor;
|
|
422
|
+
}
|
|
423
|
+
doStick(editor, editorIndex) {
|
|
424
|
+
if (this.isSticky(editorIndex)) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
this.pin(editor);
|
|
428
|
+
const newEditorIndex = this.sticky + 1;
|
|
429
|
+
this.moveEditor(editor, newEditorIndex);
|
|
430
|
+
this.sticky++;
|
|
431
|
+
const event = {
|
|
432
|
+
kind: 10 ,
|
|
433
|
+
editor,
|
|
434
|
+
editorIndex: newEditorIndex
|
|
435
|
+
};
|
|
436
|
+
this._onDidModelChange.fire(event);
|
|
437
|
+
}
|
|
438
|
+
unstick(candidate) {
|
|
439
|
+
const res = this.findEditor(candidate);
|
|
440
|
+
if (!res) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const [editor, editorIndex] = res;
|
|
444
|
+
this.doUnstick(editor, editorIndex);
|
|
445
|
+
return editor;
|
|
446
|
+
}
|
|
447
|
+
doUnstick(editor, editorIndex) {
|
|
448
|
+
if (!this.isSticky(editorIndex)) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const newEditorIndex = this.sticky;
|
|
452
|
+
this.moveEditor(editor, newEditorIndex);
|
|
453
|
+
this.sticky--;
|
|
454
|
+
const event = {
|
|
455
|
+
kind: 10 ,
|
|
456
|
+
editor,
|
|
457
|
+
editorIndex: newEditorIndex
|
|
458
|
+
};
|
|
459
|
+
this._onDidModelChange.fire(event);
|
|
460
|
+
}
|
|
461
|
+
isSticky(candidateOrIndex) {
|
|
462
|
+
if (this.sticky < 0) {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
let index;
|
|
466
|
+
if (typeof candidateOrIndex === 'number') {
|
|
467
|
+
index = candidateOrIndex;
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
index = this.indexOf(candidateOrIndex);
|
|
471
|
+
}
|
|
472
|
+
if (index < 0) {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
return index <= this.sticky;
|
|
476
|
+
}
|
|
477
|
+
splice(index, del, editor) {
|
|
478
|
+
const editorToDeleteOrReplace = this.editors[index];
|
|
479
|
+
if (del && this.isSticky(index)) {
|
|
480
|
+
this.sticky--;
|
|
481
|
+
}
|
|
482
|
+
if (editor) {
|
|
483
|
+
this.editors.splice(index, del ? 1 : 0, editor);
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
this.editors.splice(index, del ? 1 : 0);
|
|
487
|
+
}
|
|
488
|
+
{
|
|
489
|
+
if (!del && editor) {
|
|
490
|
+
if (this.mru.length === 0) {
|
|
491
|
+
this.mru.push(editor);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
this.mru.splice(1, 0, editor);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
const indexInMRU = this.indexOf(editorToDeleteOrReplace, this.mru);
|
|
499
|
+
if (del && !editor) {
|
|
500
|
+
this.mru.splice(indexInMRU, 1);
|
|
501
|
+
}
|
|
502
|
+
else if (del && editor) {
|
|
503
|
+
this.mru.splice(indexInMRU, 1, editor);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
indexOf(candidate, editors = this.editors, options) {
|
|
509
|
+
let index = -1;
|
|
510
|
+
if (!candidate) {
|
|
511
|
+
return index;
|
|
512
|
+
}
|
|
513
|
+
for (let i = 0; i < editors.length; i++) {
|
|
514
|
+
const editor = editors[i];
|
|
515
|
+
if (this.matches(editor, candidate, options)) {
|
|
516
|
+
if (options?.supportSideBySide && editor instanceof SideBySideEditorInput && !(candidate instanceof SideBySideEditorInput)) {
|
|
517
|
+
index = i;
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
index = i;
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return index;
|
|
526
|
+
}
|
|
527
|
+
findEditor(candidate, options) {
|
|
528
|
+
const index = this.indexOf(candidate, this.editors, options);
|
|
529
|
+
if (index === -1) {
|
|
530
|
+
return undefined;
|
|
531
|
+
}
|
|
532
|
+
return [this.editors[index], index];
|
|
533
|
+
}
|
|
534
|
+
isFirst(candidate) {
|
|
535
|
+
return this.matches(this.editors[0], candidate);
|
|
536
|
+
}
|
|
537
|
+
isLast(candidate) {
|
|
538
|
+
return this.matches(this.editors[this.editors.length - 1], candidate);
|
|
539
|
+
}
|
|
540
|
+
contains(candidate, options) {
|
|
541
|
+
for (const editor of this.editors) {
|
|
542
|
+
if (this.matches(editor, candidate, options)) {
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
matches(editor, candidate, options) {
|
|
549
|
+
if (!editor || !candidate) {
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
if (options?.supportSideBySide && editor instanceof SideBySideEditorInput && !(candidate instanceof SideBySideEditorInput)) {
|
|
553
|
+
switch (options.supportSideBySide) {
|
|
554
|
+
case SideBySideEditor.ANY:
|
|
555
|
+
if (this.matches(editor.primary, candidate, options) || this.matches(editor.secondary, candidate, options)) {
|
|
556
|
+
return true;
|
|
557
|
+
}
|
|
558
|
+
break;
|
|
559
|
+
case SideBySideEditor.BOTH:
|
|
560
|
+
if (this.matches(editor.primary, candidate, options) && this.matches(editor.secondary, candidate, options)) {
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
const strictEquals = editor === candidate;
|
|
567
|
+
if (options?.strictEquals) {
|
|
568
|
+
return strictEquals;
|
|
569
|
+
}
|
|
570
|
+
return strictEquals || editor.matches(candidate);
|
|
571
|
+
}
|
|
572
|
+
get isLocked() {
|
|
573
|
+
return this.locked;
|
|
574
|
+
}
|
|
575
|
+
lock(locked) {
|
|
576
|
+
if (this.isLocked !== locked) {
|
|
577
|
+
this.locked = locked;
|
|
578
|
+
this._onDidModelChange.fire({ kind: 2 });
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
clone() {
|
|
582
|
+
const clone = this.instantiationService.createInstance(EditorGroupModel, undefined);
|
|
583
|
+
clone.editors = this.editors.slice(0);
|
|
584
|
+
clone.mru = this.mru.slice(0);
|
|
585
|
+
clone.preview = this.preview;
|
|
586
|
+
clone.active = this.active;
|
|
587
|
+
clone.sticky = this.sticky;
|
|
588
|
+
for (const editor of clone.editors) {
|
|
589
|
+
clone.registerEditorListeners(editor);
|
|
590
|
+
}
|
|
591
|
+
return clone;
|
|
592
|
+
}
|
|
593
|
+
serialize() {
|
|
594
|
+
const registry = ( Registry.as(EditorExtensions.EditorFactory));
|
|
595
|
+
const serializableEditors = [];
|
|
596
|
+
const serializedEditors = [];
|
|
597
|
+
let serializablePreviewIndex;
|
|
598
|
+
let serializableSticky = this.sticky;
|
|
599
|
+
for (let i = 0; i < this.editors.length; i++) {
|
|
600
|
+
const editor = this.editors[i];
|
|
601
|
+
let canSerializeEditor = false;
|
|
602
|
+
const editorSerializer = registry.getEditorSerializer(editor);
|
|
603
|
+
if (editorSerializer) {
|
|
604
|
+
const value = editorSerializer.serialize(editor);
|
|
605
|
+
if (typeof value === 'string') {
|
|
606
|
+
canSerializeEditor = true;
|
|
607
|
+
serializedEditors.push({ id: editor.typeId, value });
|
|
608
|
+
serializableEditors.push(editor);
|
|
609
|
+
if (this.preview === editor) {
|
|
610
|
+
serializablePreviewIndex = serializableEditors.length - 1;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
canSerializeEditor = false;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
if (!canSerializeEditor && this.isSticky(i)) {
|
|
618
|
+
serializableSticky--;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const serializableMru = ( this.mru.map(editor => this.indexOf(editor, serializableEditors))).filter(i => i >= 0);
|
|
622
|
+
return {
|
|
623
|
+
id: this.id,
|
|
624
|
+
locked: this.locked ? true : undefined,
|
|
625
|
+
editors: serializedEditors,
|
|
626
|
+
mru: serializableMru,
|
|
627
|
+
preview: serializablePreviewIndex,
|
|
628
|
+
sticky: serializableSticky >= 0 ? serializableSticky : undefined
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
deserialize(data) {
|
|
632
|
+
const registry = ( Registry.as(EditorExtensions.EditorFactory));
|
|
633
|
+
if (typeof data.id === 'number') {
|
|
634
|
+
this._id = data.id;
|
|
635
|
+
EditorGroupModel.IDS = Math.max(data.id + 1, EditorGroupModel.IDS);
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
this._id = EditorGroupModel.IDS++;
|
|
639
|
+
}
|
|
640
|
+
if (data.locked) {
|
|
641
|
+
this.locked = true;
|
|
642
|
+
}
|
|
643
|
+
this.editors = coalesce(( data.editors.map((e, index) => {
|
|
644
|
+
let editor = undefined;
|
|
645
|
+
const editorSerializer = registry.getEditorSerializer(e.id);
|
|
646
|
+
if (editorSerializer) {
|
|
647
|
+
const deserializedEditor = editorSerializer.deserialize(this.instantiationService, e.value);
|
|
648
|
+
if (deserializedEditor instanceof EditorInput) {
|
|
649
|
+
editor = deserializedEditor;
|
|
650
|
+
this.registerEditorListeners(editor);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (!editor && typeof data.sticky === 'number' && index <= data.sticky) {
|
|
654
|
+
data.sticky--;
|
|
655
|
+
}
|
|
656
|
+
return editor;
|
|
657
|
+
})));
|
|
658
|
+
this.mru = coalesce(( data.mru.map(i => this.editors[i])));
|
|
659
|
+
this.active = this.mru[0];
|
|
660
|
+
if (typeof data.preview === 'number') {
|
|
661
|
+
this.preview = this.editors[data.preview];
|
|
662
|
+
}
|
|
663
|
+
if (typeof data.sticky === 'number') {
|
|
664
|
+
this.sticky = data.sticky;
|
|
665
|
+
}
|
|
666
|
+
return this._id;
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
EditorGroupModel.IDS = 0;
|
|
670
|
+
EditorGroupModel = ( __decorate([
|
|
671
|
+
( __param(1, IInstantiationService)),
|
|
672
|
+
( __param(2, IConfigurationService))
|
|
673
|
+
], EditorGroupModel));
|
|
674
|
+
export { EditorGroupModel, isGroupEditorCloseEvent, isGroupEditorOpenEvent, isSerializedEditorGroupModel };
|