@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,137 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { isMacintosh, isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
4
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
5
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
6
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
7
|
+
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
8
|
+
import { ILifecycleService } from '../../../services/lifecycle/common/lifecycle.js';
|
|
9
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
10
|
+
import { h, append, $, clearNode } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
11
|
+
import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
12
|
+
import { IContextKeyService, ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
13
|
+
const showCommands = { text: ( nls.localize('watermark.showCommands', "Show All Commands")), id: 'workbench.action.showCommands' };
|
|
14
|
+
const quickAccess = { text: ( nls.localize('watermark.quickAccess', "Go to File")), id: 'workbench.action.quickOpen' };
|
|
15
|
+
const openFileNonMacOnly = { text: ( nls.localize('watermark.openFile', "Open File")), id: 'workbench.action.files.openFile', mac: false };
|
|
16
|
+
const openFolderNonMacOnly = { text: ( nls.localize('watermark.openFolder', "Open Folder")), id: 'workbench.action.files.openFolder', mac: false };
|
|
17
|
+
const openFileOrFolderMacOnly = { text: ( nls.localize('watermark.openFileFolder', "Open File or Folder")), id: 'workbench.action.files.openFileFolder', mac: true };
|
|
18
|
+
const openRecent = { text: ( nls.localize('watermark.openRecent', "Open Recent")), id: 'workbench.action.openRecent' };
|
|
19
|
+
const newUntitledFile = { text: ( nls.localize('watermark.newUntitledFile', "New Untitled Text File")), id: 'workbench.action.files.newUntitledFile' };
|
|
20
|
+
const newUntitledFileMacOnly = Object.assign({ mac: true }, newUntitledFile);
|
|
21
|
+
const findInFiles = { text: ( nls.localize('watermark.findInFiles', "Find in Files")), id: 'workbench.action.findInFiles' };
|
|
22
|
+
const toggleTerminal = { text: ( nls.localize(
|
|
23
|
+
{ key: 'watermark.toggleTerminal', comment: ['toggle is a verb here'] },
|
|
24
|
+
"Toggle Terminal"
|
|
25
|
+
)), id: 'workbench.action.terminal.toggleTerminal', when: ( ContextKeyExpr.equals('terminalProcessSupported', true)) };
|
|
26
|
+
const startDebugging = { text: ( nls.localize('watermark.startDebugging', "Start Debugging")), id: 'workbench.action.debug.start', when: ( ContextKeyExpr.equals('terminalProcessSupported', true)) };
|
|
27
|
+
const toggleFullscreen = { text: ( nls.localize(
|
|
28
|
+
{ key: 'watermark.toggleFullscreen', comment: ['toggle is a verb here'] },
|
|
29
|
+
"Toggle Full Screen"
|
|
30
|
+
)), id: 'workbench.action.toggleFullScreen', when: ( ( ContextKeyExpr.equals('terminalProcessSupported', true)).negate()) };
|
|
31
|
+
const showSettings = { text: ( nls.localize('watermark.showSettings', "Show Settings")), id: 'workbench.action.openSettings', when: ( ( ContextKeyExpr.equals('terminalProcessSupported', true)).negate()) };
|
|
32
|
+
const noFolderEntries = [
|
|
33
|
+
showCommands,
|
|
34
|
+
openFileNonMacOnly,
|
|
35
|
+
openFolderNonMacOnly,
|
|
36
|
+
openFileOrFolderMacOnly,
|
|
37
|
+
openRecent,
|
|
38
|
+
newUntitledFileMacOnly
|
|
39
|
+
];
|
|
40
|
+
const folderEntries = [
|
|
41
|
+
showCommands,
|
|
42
|
+
quickAccess,
|
|
43
|
+
findInFiles,
|
|
44
|
+
startDebugging,
|
|
45
|
+
toggleTerminal,
|
|
46
|
+
toggleFullscreen,
|
|
47
|
+
showSettings
|
|
48
|
+
];
|
|
49
|
+
let EditorGroupWatermark = class EditorGroupWatermark extends Disposable {
|
|
50
|
+
constructor(container, lifecycleService, keybindingService, contextService, contextKeyService, configurationService, telemetryService) {
|
|
51
|
+
super();
|
|
52
|
+
this.lifecycleService = lifecycleService;
|
|
53
|
+
this.keybindingService = keybindingService;
|
|
54
|
+
this.contextService = contextService;
|
|
55
|
+
this.contextKeyService = contextKeyService;
|
|
56
|
+
this.configurationService = configurationService;
|
|
57
|
+
this.telemetryService = telemetryService;
|
|
58
|
+
this.transientDisposables = this._register(( new DisposableStore()));
|
|
59
|
+
const elements = h('.editor-group-watermark', [
|
|
60
|
+
h('.letterpress'),
|
|
61
|
+
h('.shortcuts@shortcuts'),
|
|
62
|
+
]);
|
|
63
|
+
append(container, elements.root);
|
|
64
|
+
this.shortcuts = elements.shortcuts;
|
|
65
|
+
this.workbenchState = contextService.getWorkbenchState();
|
|
66
|
+
this.enabled = this.configurationService.getValue('workbench.tips.enabled');
|
|
67
|
+
this.registerListeners();
|
|
68
|
+
if (this.enabled) {
|
|
69
|
+
this.render();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
registerListeners() {
|
|
73
|
+
this.lifecycleService.onDidShutdown(() => this.dispose());
|
|
74
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
75
|
+
if (e.affectsConfiguration('workbench.tips.enabled')) {
|
|
76
|
+
const enabled = this.configurationService.getValue('workbench.tips.enabled');
|
|
77
|
+
if (enabled === this.enabled) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.enabled = enabled;
|
|
81
|
+
if (this.enabled) {
|
|
82
|
+
this.render();
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.clear();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
this._register(this.contextService.onDidChangeWorkbenchState(workbenchState => {
|
|
90
|
+
if (!this.enabled || this.workbenchState === workbenchState) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.workbenchState = workbenchState;
|
|
94
|
+
this.render();
|
|
95
|
+
}));
|
|
96
|
+
const allEntriesWhenClauses = ( [...noFolderEntries, ...folderEntries].filter(entry => entry.when !== undefined).map(entry => entry.when));
|
|
97
|
+
const allKeys = ( new Set());
|
|
98
|
+
allEntriesWhenClauses.forEach(when => ( when.keys()).forEach(key => allKeys.add(key)));
|
|
99
|
+
this._register(this.contextKeyService.onDidChangeContext(e => {
|
|
100
|
+
if (e.affectsSome(allKeys)) {
|
|
101
|
+
this.render();
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
render() {
|
|
106
|
+
this.clear();
|
|
107
|
+
const box = append(this.shortcuts, $('.watermark-box'));
|
|
108
|
+
const folder = this.workbenchState !== 1 ;
|
|
109
|
+
(folder ? folderEntries : noFolderEntries)
|
|
110
|
+
.filter(entry => !('when' in entry) || this.contextKeyService.contextMatchesRules(entry.when))
|
|
111
|
+
.filter(entry => !('mac' in entry) || entry.mac === (isMacintosh && !isWeb))
|
|
112
|
+
.filter(entry => !!CommandsRegistry.getCommand(entry.id));
|
|
113
|
+
const update = () => {
|
|
114
|
+
clearNode(box);
|
|
115
|
+
};
|
|
116
|
+
update();
|
|
117
|
+
this.transientDisposables.add(this.keybindingService.onDidUpdateKeybindings(update));
|
|
118
|
+
this.telemetryService.publicLog('watermark:open');
|
|
119
|
+
}
|
|
120
|
+
clear() {
|
|
121
|
+
clearNode(this.shortcuts);
|
|
122
|
+
this.transientDisposables.clear();
|
|
123
|
+
}
|
|
124
|
+
dispose() {
|
|
125
|
+
super.dispose();
|
|
126
|
+
this.clear();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
EditorGroupWatermark = ( __decorate([
|
|
130
|
+
( __param(1, ILifecycleService)),
|
|
131
|
+
( __param(2, IKeybindingService)),
|
|
132
|
+
( __param(3, IWorkspaceContextService)),
|
|
133
|
+
( __param(4, IContextKeyService)),
|
|
134
|
+
( __param(5, IConfigurationService)),
|
|
135
|
+
( __param(6, ITelemetryService))
|
|
136
|
+
], EditorGroupWatermark));
|
|
137
|
+
export { EditorGroupWatermark };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { Composite } from '../../composite.js';
|
|
2
|
+
import { isEditorInput } from '../../../common/editor.js';
|
|
3
|
+
import { LRUCache } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
4
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
5
|
+
import { Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
6
|
+
import { isEmptyObject } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
7
|
+
import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from './editor.js';
|
|
8
|
+
import { isEqual, joinPath } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
9
|
+
import { indexOfPath } from 'monaco-editor/esm/vs/base/common/extpath.js';
|
|
10
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
11
|
+
class EditorPane extends Composite {
|
|
12
|
+
get minimumWidth() { return DEFAULT_EDITOR_MIN_DIMENSIONS.width; }
|
|
13
|
+
get maximumWidth() { return DEFAULT_EDITOR_MAX_DIMENSIONS.width; }
|
|
14
|
+
get minimumHeight() { return DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
|
|
15
|
+
get maximumHeight() { return DEFAULT_EDITOR_MAX_DIMENSIONS.height; }
|
|
16
|
+
get input() { return this._input; }
|
|
17
|
+
get options() { return this._options; }
|
|
18
|
+
get group() { return this._group; }
|
|
19
|
+
get scopedContextKeyService() { return undefined; }
|
|
20
|
+
constructor(id, telemetryService, themeService, storageService) {
|
|
21
|
+
super(id, telemetryService, themeService, storageService);
|
|
22
|
+
this.onDidChangeSizeConstraints = Event.None;
|
|
23
|
+
this._onDidChangeControl = this._register(( new Emitter()));
|
|
24
|
+
this.onDidChangeControl = this._onDidChangeControl.event;
|
|
25
|
+
}
|
|
26
|
+
create(parent) {
|
|
27
|
+
super.create(parent);
|
|
28
|
+
this.createEditor(parent);
|
|
29
|
+
}
|
|
30
|
+
async setInput(input, options, context, token) {
|
|
31
|
+
this._input = input;
|
|
32
|
+
this._options = options;
|
|
33
|
+
}
|
|
34
|
+
clearInput() {
|
|
35
|
+
this._input = undefined;
|
|
36
|
+
this._options = undefined;
|
|
37
|
+
}
|
|
38
|
+
setOptions(options) {
|
|
39
|
+
this._options = options;
|
|
40
|
+
}
|
|
41
|
+
setVisible(visible, group) {
|
|
42
|
+
super.setVisible(visible);
|
|
43
|
+
this.setEditorVisible(visible, group);
|
|
44
|
+
}
|
|
45
|
+
setEditorVisible(visible, group) {
|
|
46
|
+
this._group = group;
|
|
47
|
+
}
|
|
48
|
+
setBoundarySashes(_sashes) {
|
|
49
|
+
}
|
|
50
|
+
getEditorMemento(editorGroupService, configurationService, key, limit = 10) {
|
|
51
|
+
const mementoKey = `${this.getId()}${key}`;
|
|
52
|
+
let editorMemento = EditorPane.EDITOR_MEMENTOS.get(mementoKey);
|
|
53
|
+
if (!editorMemento) {
|
|
54
|
+
editorMemento = this._register(( new EditorMemento(
|
|
55
|
+
this.getId(),
|
|
56
|
+
key,
|
|
57
|
+
this.getMemento(1 , 1 ),
|
|
58
|
+
limit,
|
|
59
|
+
editorGroupService,
|
|
60
|
+
configurationService
|
|
61
|
+
)));
|
|
62
|
+
EditorPane.EDITOR_MEMENTOS.set(mementoKey, editorMemento);
|
|
63
|
+
}
|
|
64
|
+
return editorMemento;
|
|
65
|
+
}
|
|
66
|
+
getViewState() {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
saveState() {
|
|
70
|
+
for (const [, editorMemento] of EditorPane.EDITOR_MEMENTOS) {
|
|
71
|
+
if (editorMemento.id === this.getId()) {
|
|
72
|
+
editorMemento.saveState();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
super.saveState();
|
|
76
|
+
}
|
|
77
|
+
dispose() {
|
|
78
|
+
this._input = undefined;
|
|
79
|
+
this._options = undefined;
|
|
80
|
+
super.dispose();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
EditorPane.EDITOR_MEMENTOS = ( new Map());
|
|
84
|
+
class EditorMemento extends Disposable {
|
|
85
|
+
constructor(id, key, memento, limit, editorGroupService, configurationService) {
|
|
86
|
+
super();
|
|
87
|
+
this.id = id;
|
|
88
|
+
this.key = key;
|
|
89
|
+
this.memento = memento;
|
|
90
|
+
this.limit = limit;
|
|
91
|
+
this.editorGroupService = editorGroupService;
|
|
92
|
+
this.configurationService = configurationService;
|
|
93
|
+
this.cleanedUp = false;
|
|
94
|
+
this.shareEditorState = false;
|
|
95
|
+
this.updateConfiguration(undefined);
|
|
96
|
+
this.registerListeners();
|
|
97
|
+
}
|
|
98
|
+
registerListeners() {
|
|
99
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration(e)));
|
|
100
|
+
}
|
|
101
|
+
updateConfiguration(e) {
|
|
102
|
+
if (!e || e.affectsConfiguration(undefined, 'workbench.editor.sharedViewState')) {
|
|
103
|
+
this.shareEditorState = this.configurationService.getValue(undefined, 'workbench.editor.sharedViewState') === true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
saveEditorState(group, resourceOrEditor, state) {
|
|
107
|
+
const resource = this.doGetResource(resourceOrEditor);
|
|
108
|
+
if (!resource || !group) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const cache = this.doLoad();
|
|
112
|
+
let mementosForResource = cache.get(( resource.toString()));
|
|
113
|
+
if (!mementosForResource) {
|
|
114
|
+
mementosForResource = Object.create(null);
|
|
115
|
+
cache.set(( resource.toString()), mementosForResource);
|
|
116
|
+
}
|
|
117
|
+
mementosForResource[group.id] = state;
|
|
118
|
+
if (this.shareEditorState) {
|
|
119
|
+
mementosForResource[EditorMemento.SHARED_EDITOR_STATE] = state;
|
|
120
|
+
}
|
|
121
|
+
if (isEditorInput(resourceOrEditor)) {
|
|
122
|
+
this.clearEditorStateOnDispose(resource, resourceOrEditor);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
loadEditorState(group, resourceOrEditor) {
|
|
126
|
+
const resource = this.doGetResource(resourceOrEditor);
|
|
127
|
+
if (!resource || !group) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const cache = this.doLoad();
|
|
131
|
+
const mementosForResource = cache.get(( resource.toString()));
|
|
132
|
+
if (mementosForResource) {
|
|
133
|
+
const mementoForResourceAndGroup = mementosForResource[group.id];
|
|
134
|
+
if (mementoForResourceAndGroup) {
|
|
135
|
+
return mementoForResourceAndGroup;
|
|
136
|
+
}
|
|
137
|
+
if (this.shareEditorState) {
|
|
138
|
+
return mementosForResource[EditorMemento.SHARED_EDITOR_STATE];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
clearEditorState(resourceOrEditor, group) {
|
|
144
|
+
if (isEditorInput(resourceOrEditor)) {
|
|
145
|
+
this.editorDisposables?.delete(resourceOrEditor);
|
|
146
|
+
}
|
|
147
|
+
const resource = this.doGetResource(resourceOrEditor);
|
|
148
|
+
if (resource) {
|
|
149
|
+
const cache = this.doLoad();
|
|
150
|
+
if (group) {
|
|
151
|
+
const mementosForResource = cache.get(( resource.toString()));
|
|
152
|
+
if (mementosForResource) {
|
|
153
|
+
delete mementosForResource[group.id];
|
|
154
|
+
if (isEmptyObject(mementosForResource)) {
|
|
155
|
+
cache.delete(( resource.toString()));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
cache.delete(( resource.toString()));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
clearEditorStateOnDispose(resource, editor) {
|
|
165
|
+
if (!this.editorDisposables) {
|
|
166
|
+
this.editorDisposables = ( new Map());
|
|
167
|
+
}
|
|
168
|
+
if (!( this.editorDisposables.has(editor))) {
|
|
169
|
+
this.editorDisposables.set(editor, Event.once(editor.onWillDispose)(() => {
|
|
170
|
+
this.clearEditorState(resource);
|
|
171
|
+
this.editorDisposables?.delete(editor);
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
moveEditorState(source, target, comparer) {
|
|
176
|
+
const cache = this.doLoad();
|
|
177
|
+
const cacheKeys = [...( cache.keys())];
|
|
178
|
+
for (const cacheKey of cacheKeys) {
|
|
179
|
+
const resource = ( URI.parse(cacheKey));
|
|
180
|
+
if (!comparer.isEqualOrParent(resource, source)) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
let targetResource;
|
|
184
|
+
if (isEqual(source, resource)) {
|
|
185
|
+
targetResource = target;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
const index = indexOfPath(resource.path, source.path);
|
|
189
|
+
targetResource = joinPath(target, resource.path.substr(index + source.path.length + 1));
|
|
190
|
+
}
|
|
191
|
+
const value = cache.get(cacheKey, 0 );
|
|
192
|
+
if (value) {
|
|
193
|
+
cache.delete(cacheKey);
|
|
194
|
+
cache.set(( targetResource.toString()), value);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
doGetResource(resourceOrEditor) {
|
|
199
|
+
if (isEditorInput(resourceOrEditor)) {
|
|
200
|
+
return resourceOrEditor.resource;
|
|
201
|
+
}
|
|
202
|
+
return resourceOrEditor;
|
|
203
|
+
}
|
|
204
|
+
doLoad() {
|
|
205
|
+
if (!this.cache) {
|
|
206
|
+
this.cache = ( new LRUCache(this.limit));
|
|
207
|
+
const rawEditorMemento = this.memento[this.key];
|
|
208
|
+
if (Array.isArray(rawEditorMemento)) {
|
|
209
|
+
this.cache.fromJSON(rawEditorMemento);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return this.cache;
|
|
213
|
+
}
|
|
214
|
+
saveState() {
|
|
215
|
+
const cache = this.doLoad();
|
|
216
|
+
if (!this.cleanedUp) {
|
|
217
|
+
this.cleanUp();
|
|
218
|
+
this.cleanedUp = true;
|
|
219
|
+
}
|
|
220
|
+
this.memento[this.key] = cache.toJSON();
|
|
221
|
+
}
|
|
222
|
+
cleanUp() {
|
|
223
|
+
const cache = this.doLoad();
|
|
224
|
+
const entries = [...cache.entries()];
|
|
225
|
+
for (const [resource, mapGroupToMementos] of entries) {
|
|
226
|
+
for (const group of ( Object.keys(mapGroupToMementos))) {
|
|
227
|
+
const groupId = Number(group);
|
|
228
|
+
if (groupId === EditorMemento.SHARED_EDITOR_STATE && this.shareEditorState) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (!this.editorGroupService.getGroup(groupId)) {
|
|
232
|
+
delete mapGroupToMementos[groupId];
|
|
233
|
+
if (isEmptyObject(mapGroupToMementos)) {
|
|
234
|
+
cache.delete(resource);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
EditorMemento.SHARED_EDITOR_STATE = -1;
|
|
242
|
+
export { EditorMemento, EditorPane };
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
+
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
5
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
+
import { EditorExtensions, isEditorOpenError } from '../../../common/editor.js';
|
|
7
|
+
import { isAncestor, show, Dimension, hide } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
8
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
9
|
+
import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.js';
|
|
10
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
|
+
import { LongRunningOperation, IEditorProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
12
|
+
import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from './editor.js';
|
|
13
|
+
import { assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
14
|
+
import { IWorkspaceTrustManagementService } from 'monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js';
|
|
15
|
+
import { ErrorPlaceholderEditor, WorkspaceTrustRequiredPlaceholderEditor } from './editorPlaceholder.js';
|
|
16
|
+
import { EditorOpenSource } from 'monaco-editor/esm/vs/platform/editor/common/editor.js';
|
|
17
|
+
import { isCancellationError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
18
|
+
import { toErrorMessage } from 'monaco-editor/esm/vs/base/common/errorMessage.js';
|
|
19
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
20
|
+
import { IDialogService } from 'monaco-editor/esm/vs/platform/dialogs/common/dialogs.js';
|
|
21
|
+
let EditorPanes = class EditorPanes extends Disposable {
|
|
22
|
+
get minimumWidth() { return this._activeEditorPane?.minimumWidth ?? DEFAULT_EDITOR_MIN_DIMENSIONS.width; }
|
|
23
|
+
get minimumHeight() { return this._activeEditorPane?.minimumHeight ?? DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
|
|
24
|
+
get maximumWidth() { return this._activeEditorPane?.maximumWidth ?? DEFAULT_EDITOR_MAX_DIMENSIONS.width; }
|
|
25
|
+
get maximumHeight() { return this._activeEditorPane?.maximumHeight ?? DEFAULT_EDITOR_MAX_DIMENSIONS.height; }
|
|
26
|
+
get activeEditorPane() { return this._activeEditorPane; }
|
|
27
|
+
constructor(editorGroupParent, editorPanesParent, groupView, layoutService, instantiationService, editorProgressService, workspaceTrustService, logService, dialogService) {
|
|
28
|
+
super();
|
|
29
|
+
this.editorGroupParent = editorGroupParent;
|
|
30
|
+
this.editorPanesParent = editorPanesParent;
|
|
31
|
+
this.groupView = groupView;
|
|
32
|
+
this.layoutService = layoutService;
|
|
33
|
+
this.instantiationService = instantiationService;
|
|
34
|
+
this.editorProgressService = editorProgressService;
|
|
35
|
+
this.workspaceTrustService = workspaceTrustService;
|
|
36
|
+
this.logService = logService;
|
|
37
|
+
this.dialogService = dialogService;
|
|
38
|
+
this._onDidFocus = this._register(( new Emitter()));
|
|
39
|
+
this.onDidFocus = this._onDidFocus.event;
|
|
40
|
+
this._onDidChangeSizeConstraints = this._register(( new Emitter()));
|
|
41
|
+
this.onDidChangeSizeConstraints = this._onDidChangeSizeConstraints.event;
|
|
42
|
+
this._activeEditorPane = null;
|
|
43
|
+
this.editorPanes = [];
|
|
44
|
+
this.activeEditorPaneDisposables = this._register(( new DisposableStore()));
|
|
45
|
+
this.editorOperation = this._register(( new LongRunningOperation(this.editorProgressService)));
|
|
46
|
+
this.editorPanesRegistry = ( Registry.as(EditorExtensions.EditorPane));
|
|
47
|
+
this.registerListeners();
|
|
48
|
+
}
|
|
49
|
+
registerListeners() {
|
|
50
|
+
this._register(this.workspaceTrustService.onDidChangeTrust(() => this.onDidChangeWorkspaceTrust()));
|
|
51
|
+
}
|
|
52
|
+
onDidChangeWorkspaceTrust() {
|
|
53
|
+
const editor = this._activeEditorPane?.input;
|
|
54
|
+
const options = this._activeEditorPane?.options;
|
|
55
|
+
if (editor?.hasCapability(16 )) {
|
|
56
|
+
this.groupView.openEditor(editor, options);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async openEditor(editor, options, context = Object.create(null)) {
|
|
60
|
+
try {
|
|
61
|
+
return await this.doOpenEditor(this.getEditorPaneDescriptor(editor), editor, options, context);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (options?.ignoreError) {
|
|
65
|
+
return { error };
|
|
66
|
+
}
|
|
67
|
+
return this.doShowError(error, editor, options, context);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async doShowError(error, editor, options, context) {
|
|
71
|
+
this.logService.error(error);
|
|
72
|
+
let errorHandled = false;
|
|
73
|
+
if (options?.source === EditorOpenSource.USER && (!isEditorOpenError(error) || error.allowDialog)) {
|
|
74
|
+
errorHandled = await this.doShowErrorDialog(error, editor);
|
|
75
|
+
}
|
|
76
|
+
if (errorHandled) {
|
|
77
|
+
return { error };
|
|
78
|
+
}
|
|
79
|
+
const editorPlaceholderOptions = { ...options };
|
|
80
|
+
if (!isCancellationError(error)) {
|
|
81
|
+
editorPlaceholderOptions.error = error;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
...(await this.doOpenEditor(ErrorPlaceholderEditor.DESCRIPTOR, editor, editorPlaceholderOptions, context)),
|
|
85
|
+
error
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
async doShowErrorDialog(error, editor) {
|
|
89
|
+
let severity = Severity.Error;
|
|
90
|
+
let message = undefined;
|
|
91
|
+
let detail = toErrorMessage(error);
|
|
92
|
+
let errorActions = undefined;
|
|
93
|
+
if (isEditorOpenError(error)) {
|
|
94
|
+
errorActions = error.actions;
|
|
95
|
+
severity = error.forceSeverity ?? Severity.Error;
|
|
96
|
+
if (error.forceMessage) {
|
|
97
|
+
message = error.message;
|
|
98
|
+
detail = undefined;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!message) {
|
|
102
|
+
message = ( localize('editorOpenErrorDialog', "Unable to open '{0}'", editor.getName()));
|
|
103
|
+
}
|
|
104
|
+
const buttons = [];
|
|
105
|
+
if (errorActions && errorActions.length > 0) {
|
|
106
|
+
for (const errorAction of errorActions) {
|
|
107
|
+
buttons.push({
|
|
108
|
+
label: errorAction.label,
|
|
109
|
+
run: () => errorAction
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
buttons.push({
|
|
115
|
+
label: ( localize({ key: 'ok', comment: ['&& denotes a mnemonic'] }, "&&OK")),
|
|
116
|
+
run: () => undefined
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
let cancelButton = undefined;
|
|
120
|
+
if (buttons.length === 1) {
|
|
121
|
+
cancelButton = {
|
|
122
|
+
run: () => {
|
|
123
|
+
errorHandled = true;
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
let errorHandled = false;
|
|
129
|
+
const { result } = await this.dialogService.prompt({
|
|
130
|
+
type: severity,
|
|
131
|
+
message,
|
|
132
|
+
detail,
|
|
133
|
+
buttons,
|
|
134
|
+
cancelButton
|
|
135
|
+
});
|
|
136
|
+
if (result) {
|
|
137
|
+
const errorActionResult = result.run();
|
|
138
|
+
if (errorActionResult instanceof Promise) {
|
|
139
|
+
errorActionResult.catch(error => this.dialogService.error(toErrorMessage(error)));
|
|
140
|
+
}
|
|
141
|
+
errorHandled = true;
|
|
142
|
+
}
|
|
143
|
+
return errorHandled;
|
|
144
|
+
}
|
|
145
|
+
async doOpenEditor(descriptor, editor, options, context = Object.create(null)) {
|
|
146
|
+
const pane = this.doShowEditorPane(descriptor);
|
|
147
|
+
const activeElement = document.activeElement;
|
|
148
|
+
const { changed, cancelled } = await this.doSetInput(pane, editor, options, context);
|
|
149
|
+
const focus = !options || !options.preserveFocus;
|
|
150
|
+
if (!cancelled && focus && this.shouldRestoreFocus(activeElement)) {
|
|
151
|
+
pane.focus();
|
|
152
|
+
}
|
|
153
|
+
return { pane, changed, cancelled };
|
|
154
|
+
}
|
|
155
|
+
shouldRestoreFocus(expectedActiveElement) {
|
|
156
|
+
if (!this.layoutService.isRestored()) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
if (!expectedActiveElement) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
const activeElement = document.activeElement;
|
|
163
|
+
if (!activeElement || activeElement === document.body) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
const same = expectedActiveElement === activeElement;
|
|
167
|
+
if (same) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
if (activeElement.tagName !== 'INPUT' && activeElement.tagName !== 'TEXTAREA') {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
if (isAncestor(activeElement, this.editorGroupParent)) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
getEditorPaneDescriptor(editor) {
|
|
179
|
+
if (editor.hasCapability(16 ) && !this.workspaceTrustService.isWorkspaceTrusted()) {
|
|
180
|
+
return WorkspaceTrustRequiredPlaceholderEditor.DESCRIPTOR;
|
|
181
|
+
}
|
|
182
|
+
return assertIsDefined(this.editorPanesRegistry.getEditorPane(editor));
|
|
183
|
+
}
|
|
184
|
+
doShowEditorPane(descriptor) {
|
|
185
|
+
if (this._activeEditorPane && descriptor.describes(this._activeEditorPane)) {
|
|
186
|
+
return this._activeEditorPane;
|
|
187
|
+
}
|
|
188
|
+
this.doHideActiveEditorPane();
|
|
189
|
+
const editorPane = this.doCreateEditorPane(descriptor);
|
|
190
|
+
this.doSetActiveEditorPane(editorPane);
|
|
191
|
+
const container = assertIsDefined(editorPane.getContainer());
|
|
192
|
+
this.editorPanesParent.appendChild(container);
|
|
193
|
+
show(container);
|
|
194
|
+
editorPane.setVisible(true, this.groupView);
|
|
195
|
+
if (this.pagePosition) {
|
|
196
|
+
editorPane.layout(( new Dimension(this.pagePosition.width, this.pagePosition.height)), { top: this.pagePosition.top, left: this.pagePosition.left });
|
|
197
|
+
}
|
|
198
|
+
if (this.boundarySashes) {
|
|
199
|
+
editorPane.setBoundarySashes(this.boundarySashes);
|
|
200
|
+
}
|
|
201
|
+
return editorPane;
|
|
202
|
+
}
|
|
203
|
+
doCreateEditorPane(descriptor) {
|
|
204
|
+
const editorPane = this.doInstantiateEditorPane(descriptor);
|
|
205
|
+
if (!editorPane.getContainer()) {
|
|
206
|
+
const editorPaneContainer = document.createElement('div');
|
|
207
|
+
editorPaneContainer.classList.add('editor-instance');
|
|
208
|
+
editorPane.create(editorPaneContainer);
|
|
209
|
+
}
|
|
210
|
+
return editorPane;
|
|
211
|
+
}
|
|
212
|
+
doInstantiateEditorPane(descriptor) {
|
|
213
|
+
const existingEditorPane = this.editorPanes.find(editorPane => descriptor.describes(editorPane));
|
|
214
|
+
if (existingEditorPane) {
|
|
215
|
+
return existingEditorPane;
|
|
216
|
+
}
|
|
217
|
+
const editorPane = this._register(descriptor.instantiate(this.instantiationService));
|
|
218
|
+
this.editorPanes.push(editorPane);
|
|
219
|
+
return editorPane;
|
|
220
|
+
}
|
|
221
|
+
doSetActiveEditorPane(editorPane) {
|
|
222
|
+
this._activeEditorPane = editorPane;
|
|
223
|
+
this.activeEditorPaneDisposables.clear();
|
|
224
|
+
if (editorPane) {
|
|
225
|
+
this.activeEditorPaneDisposables.add(editorPane.onDidChangeSizeConstraints(e => this._onDidChangeSizeConstraints.fire(e)));
|
|
226
|
+
this.activeEditorPaneDisposables.add(editorPane.onDidFocus(() => this._onDidFocus.fire()));
|
|
227
|
+
}
|
|
228
|
+
this._onDidChangeSizeConstraints.fire(undefined);
|
|
229
|
+
}
|
|
230
|
+
async doSetInput(editorPane, editor, options, context) {
|
|
231
|
+
const inputMatches = editorPane.input?.matches(editor);
|
|
232
|
+
if (inputMatches && !options?.forceReload) {
|
|
233
|
+
editorPane.setOptions(options);
|
|
234
|
+
return { changed: false, cancelled: false };
|
|
235
|
+
}
|
|
236
|
+
const operation = this.editorOperation.start(this.layoutService.isRestored() ? 800 : 3200);
|
|
237
|
+
let cancelled = false;
|
|
238
|
+
try {
|
|
239
|
+
editorPane.clearInput();
|
|
240
|
+
await editorPane.setInput(editor, options, context, operation.token);
|
|
241
|
+
if (!operation.isCurrent()) {
|
|
242
|
+
cancelled = true;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
if (!operation.isCurrent()) {
|
|
247
|
+
cancelled = true;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
throw error;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
operation.stop();
|
|
255
|
+
}
|
|
256
|
+
return { changed: !inputMatches, cancelled };
|
|
257
|
+
}
|
|
258
|
+
doHideActiveEditorPane() {
|
|
259
|
+
if (!this._activeEditorPane) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.editorOperation.stop();
|
|
263
|
+
this._activeEditorPane.clearInput();
|
|
264
|
+
this._activeEditorPane.setVisible(false, this.groupView);
|
|
265
|
+
const editorPaneContainer = this._activeEditorPane.getContainer();
|
|
266
|
+
if (editorPaneContainer) {
|
|
267
|
+
this.editorPanesParent.removeChild(editorPaneContainer);
|
|
268
|
+
hide(editorPaneContainer);
|
|
269
|
+
}
|
|
270
|
+
this.doSetActiveEditorPane(null);
|
|
271
|
+
}
|
|
272
|
+
closeEditor(editor) {
|
|
273
|
+
if (this._activeEditorPane?.input && editor.matches(this._activeEditorPane.input)) {
|
|
274
|
+
this.doHideActiveEditorPane();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
setVisible(visible) {
|
|
278
|
+
this._activeEditorPane?.setVisible(visible, this.groupView);
|
|
279
|
+
}
|
|
280
|
+
layout(pagePosition) {
|
|
281
|
+
this.pagePosition = pagePosition;
|
|
282
|
+
this._activeEditorPane?.layout(( new Dimension(pagePosition.width, pagePosition.height)), pagePosition);
|
|
283
|
+
}
|
|
284
|
+
setBoundarySashes(sashes) {
|
|
285
|
+
this.boundarySashes = sashes;
|
|
286
|
+
this._activeEditorPane?.setBoundarySashes(sashes);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
EditorPanes = ( __decorate([
|
|
290
|
+
( __param(3, IWorkbenchLayoutService)),
|
|
291
|
+
( __param(4, IInstantiationService)),
|
|
292
|
+
( __param(5, IEditorProgressService)),
|
|
293
|
+
( __param(6, IWorkspaceTrustManagementService)),
|
|
294
|
+
( __param(7, ILogService)),
|
|
295
|
+
( __param(8, IDialogService))
|
|
296
|
+
], EditorPanes));
|
|
297
|
+
export { EditorPanes };
|