@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,720 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
3
|
+
import { EditorResourceAccessor, SideBySideEditor, isEditorInput, isEditorInputWithOptions, isResourceMergeEditorInput, isResourceDiffEditorInput, isResourceEditorInput, isEditorInputWithOptionsAndGroup } from '../../../common/editor.js';
|
|
4
|
+
import { EditorInput } from '../../../common/editor/editorInput.js';
|
|
5
|
+
import { SideBySideEditorInput } from '../../../common/editor/sideBySideEditorInput.js';
|
|
6
|
+
import { ResourceMap, ResourceSet } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
7
|
+
import { FileChangesEvent, IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
8
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
9
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
10
|
+
import { joinPath } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
11
|
+
import { DiffEditorInput } from '../../../common/editor/diffEditorInput.js';
|
|
12
|
+
import { isEditorReplacement, IEditorGroupsService } from '../common/editorGroupsService.js';
|
|
13
|
+
import { isPreferredGroup } from '../common/editorService.js';
|
|
14
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
15
|
+
import { Disposable, dispose, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
16
|
+
import { distinct, coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
17
|
+
import { isCodeEditor, isDiffEditor, isCompositeEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
|
|
18
|
+
import { withNullAsUndefined, isUndefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
19
|
+
import { EditorsObserver } from '../../../browser/parts/editor/editorsObserver.js';
|
|
20
|
+
import { timeout, Promises } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
21
|
+
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
22
|
+
import { indexOfPath } from 'monaco-editor/esm/vs/base/common/extpath.js';
|
|
23
|
+
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
24
|
+
import { IEditorResolverService } from '../common/editorResolverService.js';
|
|
25
|
+
import { IWorkspaceTrustRequestService } from 'monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js';
|
|
26
|
+
import { IHostService } from '../../host/browser/host.js';
|
|
27
|
+
import { findGroup } from '../common/editorGroupFinder.js';
|
|
28
|
+
import { ITextEditorService } from '../../textfile/common/textEditorService.js';
|
|
29
|
+
let EditorService = class EditorService extends Disposable {
|
|
30
|
+
constructor(editorGroupService, instantiationService, fileService, configurationService, contextService, uriIdentityService, editorResolverService, workspaceTrustRequestService, hostService, textEditorService) {
|
|
31
|
+
super();
|
|
32
|
+
this.editorGroupService = editorGroupService;
|
|
33
|
+
this.instantiationService = instantiationService;
|
|
34
|
+
this.fileService = fileService;
|
|
35
|
+
this.configurationService = configurationService;
|
|
36
|
+
this.contextService = contextService;
|
|
37
|
+
this.uriIdentityService = uriIdentityService;
|
|
38
|
+
this.editorResolverService = editorResolverService;
|
|
39
|
+
this.workspaceTrustRequestService = workspaceTrustRequestService;
|
|
40
|
+
this.hostService = hostService;
|
|
41
|
+
this.textEditorService = textEditorService;
|
|
42
|
+
this._onDidActiveEditorChange = this._register(( new Emitter()));
|
|
43
|
+
this.onDidActiveEditorChange = this._onDidActiveEditorChange.event;
|
|
44
|
+
this._onDidVisibleEditorsChange = this._register(( new Emitter()));
|
|
45
|
+
this.onDidVisibleEditorsChange = this._onDidVisibleEditorsChange.event;
|
|
46
|
+
this._onDidEditorsChange = this._register(( new Emitter()));
|
|
47
|
+
this.onDidEditorsChange = this._onDidEditorsChange.event;
|
|
48
|
+
this._onDidCloseEditor = this._register(( new Emitter()));
|
|
49
|
+
this.onDidCloseEditor = this._onDidCloseEditor.event;
|
|
50
|
+
this._onDidOpenEditorFail = this._register(( new Emitter()));
|
|
51
|
+
this.onDidOpenEditorFail = this._onDidOpenEditorFail.event;
|
|
52
|
+
this._onDidMostRecentlyActiveEditorsChange = this._register(( new Emitter()));
|
|
53
|
+
this.onDidMostRecentlyActiveEditorsChange = this._onDidMostRecentlyActiveEditorsChange.event;
|
|
54
|
+
this.lastActiveEditor = undefined;
|
|
55
|
+
this.activeOutOfWorkspaceWatchers = ( new ResourceMap());
|
|
56
|
+
this.closeOnFileDelete = false;
|
|
57
|
+
this.editorsObserver = this._register(this.instantiationService.createInstance(EditorsObserver));
|
|
58
|
+
this.onConfigurationUpdated();
|
|
59
|
+
this.registerListeners();
|
|
60
|
+
}
|
|
61
|
+
registerListeners() {
|
|
62
|
+
this.editorGroupService.whenReady.then(() => this.onEditorGroupsReady());
|
|
63
|
+
this.editorGroupService.onDidChangeActiveGroup(group => this.handleActiveEditorChange(group));
|
|
64
|
+
this.editorGroupService.onDidAddGroup(group => this.registerGroupListeners(group));
|
|
65
|
+
this.editorsObserver.onDidMostRecentlyActiveEditorsChange(() => this._onDidMostRecentlyActiveEditorsChange.fire());
|
|
66
|
+
this._register(this.onDidVisibleEditorsChange(() => this.handleVisibleEditorsChange()));
|
|
67
|
+
this._register(this.fileService.onDidRunOperation(e => this.onDidRunFileOperation(e)));
|
|
68
|
+
this._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));
|
|
69
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
|
|
70
|
+
}
|
|
71
|
+
onEditorGroupsReady() {
|
|
72
|
+
for (const group of this.editorGroupService.groups) {
|
|
73
|
+
this.registerGroupListeners(group);
|
|
74
|
+
}
|
|
75
|
+
if (this.activeEditor) {
|
|
76
|
+
this.doHandleActiveEditorChangeEvent();
|
|
77
|
+
this._onDidVisibleEditorsChange.fire();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
handleActiveEditorChange(group) {
|
|
81
|
+
if (group !== this.editorGroupService.activeGroup) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!this.lastActiveEditor && !group.activeEditor) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.doHandleActiveEditorChangeEvent();
|
|
88
|
+
}
|
|
89
|
+
doHandleActiveEditorChangeEvent() {
|
|
90
|
+
const activeGroup = this.editorGroupService.activeGroup;
|
|
91
|
+
this.lastActiveEditor = withNullAsUndefined(activeGroup.activeEditor);
|
|
92
|
+
this._onDidActiveEditorChange.fire();
|
|
93
|
+
}
|
|
94
|
+
registerGroupListeners(group) {
|
|
95
|
+
const groupDisposables = ( new DisposableStore());
|
|
96
|
+
groupDisposables.add(group.onDidModelChange(e => {
|
|
97
|
+
this._onDidEditorsChange.fire({ groupId: group.id, event: e });
|
|
98
|
+
}));
|
|
99
|
+
groupDisposables.add(group.onDidActiveEditorChange(() => {
|
|
100
|
+
this.handleActiveEditorChange(group);
|
|
101
|
+
this._onDidVisibleEditorsChange.fire();
|
|
102
|
+
}));
|
|
103
|
+
groupDisposables.add(group.onDidCloseEditor(e => {
|
|
104
|
+
this._onDidCloseEditor.fire(e);
|
|
105
|
+
}));
|
|
106
|
+
groupDisposables.add(group.onDidOpenEditorFail(editor => {
|
|
107
|
+
this._onDidOpenEditorFail.fire({ editor, groupId: group.id });
|
|
108
|
+
}));
|
|
109
|
+
Event.once(group.onWillDispose)(() => {
|
|
110
|
+
dispose(groupDisposables);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
handleVisibleEditorsChange() {
|
|
114
|
+
const visibleOutOfWorkspaceResources = ( new ResourceSet());
|
|
115
|
+
for (const editor of this.visibleEditors) {
|
|
116
|
+
const resources = distinct(coalesce([
|
|
117
|
+
EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY }),
|
|
118
|
+
EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.SECONDARY })
|
|
119
|
+
]), resource => ( resource.toString()));
|
|
120
|
+
for (const resource of resources) {
|
|
121
|
+
if (this.fileService.hasProvider(resource) && !this.contextService.isInsideWorkspace(resource)) {
|
|
122
|
+
visibleOutOfWorkspaceResources.add(resource);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (const resource of ( this.activeOutOfWorkspaceWatchers.keys())) {
|
|
127
|
+
if (!( visibleOutOfWorkspaceResources.has(resource))) {
|
|
128
|
+
dispose(this.activeOutOfWorkspaceWatchers.get(resource));
|
|
129
|
+
this.activeOutOfWorkspaceWatchers.delete(resource);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const resource of ( visibleOutOfWorkspaceResources.keys())) {
|
|
133
|
+
if (!this.activeOutOfWorkspaceWatchers.get(resource)) {
|
|
134
|
+
const disposable = this.fileService.watch(resource);
|
|
135
|
+
this.activeOutOfWorkspaceWatchers.set(resource, disposable);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async onDidRunFileOperation(e) {
|
|
140
|
+
if (e.isOperation(2 )) {
|
|
141
|
+
this.handleMovedFile(e.resource, e.target.resource);
|
|
142
|
+
}
|
|
143
|
+
if (e.isOperation(1 ) || e.isOperation(2 )) {
|
|
144
|
+
this.handleDeletedFile(e.resource, false, e.target ? e.target.resource : undefined);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
onDidFilesChange(e) {
|
|
148
|
+
if (e.gotDeleted()) {
|
|
149
|
+
this.handleDeletedFile(e, true);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async handleMovedFile(source, target) {
|
|
153
|
+
for (const group of this.editorGroupService.groups) {
|
|
154
|
+
const replacements = [];
|
|
155
|
+
for (const editor of group.editors) {
|
|
156
|
+
const resource = editor.resource;
|
|
157
|
+
if (!resource || !this.uriIdentityService.extUri.isEqualOrParent(resource, source)) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
let targetResource;
|
|
161
|
+
if (this.uriIdentityService.extUri.isEqual(source, resource)) {
|
|
162
|
+
targetResource = target;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
const index = indexOfPath(resource.path, source.path, this.uriIdentityService.extUri.ignorePathCasing(resource));
|
|
166
|
+
targetResource = joinPath(target, resource.path.substr(index + source.path.length + 1));
|
|
167
|
+
}
|
|
168
|
+
const moveResult = await editor.rename(group.id, targetResource);
|
|
169
|
+
if (!moveResult) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const optionOverrides = {
|
|
173
|
+
preserveFocus: true,
|
|
174
|
+
pinned: group.isPinned(editor),
|
|
175
|
+
sticky: group.isSticky(editor),
|
|
176
|
+
index: group.getIndexOfEditor(editor),
|
|
177
|
+
inactive: !group.isActive(editor)
|
|
178
|
+
};
|
|
179
|
+
if (isEditorInput(moveResult.editor)) {
|
|
180
|
+
replacements.push({
|
|
181
|
+
editor,
|
|
182
|
+
replacement: moveResult.editor,
|
|
183
|
+
options: {
|
|
184
|
+
...moveResult.options,
|
|
185
|
+
...optionOverrides
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
replacements.push({
|
|
191
|
+
editor,
|
|
192
|
+
replacement: {
|
|
193
|
+
...moveResult.editor,
|
|
194
|
+
options: {
|
|
195
|
+
...moveResult.editor.options,
|
|
196
|
+
...optionOverrides
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (replacements.length) {
|
|
203
|
+
this.replaceEditors(replacements, group);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
onConfigurationUpdated(e) {
|
|
208
|
+
if (e && !e.affectsConfiguration('workbench.editor.closeOnFileDelete')) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const configuration = this.configurationService.getValue();
|
|
212
|
+
if (typeof configuration.workbench?.editor?.closeOnFileDelete === 'boolean') {
|
|
213
|
+
this.closeOnFileDelete = configuration.workbench.editor.closeOnFileDelete;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.closeOnFileDelete = false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
handleDeletedFile(arg1, isExternal, movedTo) {
|
|
220
|
+
for (const editor of this.getAllNonDirtyEditors({ includeUntitled: false, supportSideBySide: true })) {
|
|
221
|
+
(async () => {
|
|
222
|
+
const resource = editor.resource;
|
|
223
|
+
if (!resource) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (this.closeOnFileDelete || !isExternal) {
|
|
227
|
+
if (movedTo && this.uriIdentityService.extUri.isEqualOrParent(resource, movedTo)) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
let matches = false;
|
|
231
|
+
if (arg1 instanceof FileChangesEvent) {
|
|
232
|
+
matches = arg1.contains(resource, 2 );
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
matches = this.uriIdentityService.extUri.isEqualOrParent(resource, arg1);
|
|
236
|
+
}
|
|
237
|
+
if (!matches) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
let exists = false;
|
|
241
|
+
if (isExternal && this.fileService.hasProvider(resource)) {
|
|
242
|
+
await timeout(100);
|
|
243
|
+
exists = await this.fileService.exists(resource);
|
|
244
|
+
}
|
|
245
|
+
if (!exists && !editor.isDisposed()) {
|
|
246
|
+
editor.dispose();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
})();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
getAllNonDirtyEditors(options) {
|
|
253
|
+
const editors = [];
|
|
254
|
+
function conditionallyAddEditor(editor) {
|
|
255
|
+
if (editor.hasCapability(4 ) && !options.includeUntitled) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (editor.isDirty()) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
editors.push(editor);
|
|
262
|
+
}
|
|
263
|
+
for (const editor of this.editors) {
|
|
264
|
+
if (options.supportSideBySide && editor instanceof SideBySideEditorInput) {
|
|
265
|
+
conditionallyAddEditor(editor.primary);
|
|
266
|
+
conditionallyAddEditor(editor.secondary);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
conditionallyAddEditor(editor);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return editors;
|
|
273
|
+
}
|
|
274
|
+
get activeEditorPane() {
|
|
275
|
+
return this.editorGroupService.activeGroup?.activeEditorPane;
|
|
276
|
+
}
|
|
277
|
+
get activeTextEditorControl() {
|
|
278
|
+
const activeEditorPane = this.activeEditorPane;
|
|
279
|
+
if (activeEditorPane) {
|
|
280
|
+
const activeControl = activeEditorPane.getControl();
|
|
281
|
+
if (isCodeEditor(activeControl) || isDiffEditor(activeControl)) {
|
|
282
|
+
return activeControl;
|
|
283
|
+
}
|
|
284
|
+
if (isCompositeEditor(activeControl) && isCodeEditor(activeControl.activeCodeEditor)) {
|
|
285
|
+
return activeControl.activeCodeEditor;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
get activeTextEditorLanguageId() {
|
|
291
|
+
let activeCodeEditor = undefined;
|
|
292
|
+
const activeTextEditorControl = this.activeTextEditorControl;
|
|
293
|
+
if (isDiffEditor(activeTextEditorControl)) {
|
|
294
|
+
activeCodeEditor = activeTextEditorControl.getModifiedEditor();
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
activeCodeEditor = activeTextEditorControl;
|
|
298
|
+
}
|
|
299
|
+
return activeCodeEditor?.getModel()?.getLanguageId();
|
|
300
|
+
}
|
|
301
|
+
get count() {
|
|
302
|
+
return this.editorsObserver.count;
|
|
303
|
+
}
|
|
304
|
+
get editors() {
|
|
305
|
+
return ( this.getEditors(1 ).map(({ editor }) => editor));
|
|
306
|
+
}
|
|
307
|
+
getEditors(order, options) {
|
|
308
|
+
switch (order) {
|
|
309
|
+
case 0 :
|
|
310
|
+
if (options?.excludeSticky) {
|
|
311
|
+
return this.editorsObserver.editors.filter(({ groupId, editor }) => !this.editorGroupService.getGroup(groupId)?.isSticky(editor));
|
|
312
|
+
}
|
|
313
|
+
return this.editorsObserver.editors;
|
|
314
|
+
case 1 : {
|
|
315
|
+
const editors = [];
|
|
316
|
+
for (const group of this.editorGroupService.getGroups(2 )) {
|
|
317
|
+
editors.push(...( group.getEditors(1 , options).map(editor => ({ editor, groupId: group.id }))));
|
|
318
|
+
}
|
|
319
|
+
return editors;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
get activeEditor() {
|
|
324
|
+
const activeGroup = this.editorGroupService.activeGroup;
|
|
325
|
+
return activeGroup ? withNullAsUndefined(activeGroup.activeEditor) : undefined;
|
|
326
|
+
}
|
|
327
|
+
get visibleEditorPanes() {
|
|
328
|
+
return coalesce(( this.editorGroupService.groups.map(group => group.activeEditorPane)));
|
|
329
|
+
}
|
|
330
|
+
get visibleTextEditorControls() {
|
|
331
|
+
const visibleTextEditorControls = [];
|
|
332
|
+
for (const visibleEditorPane of this.visibleEditorPanes) {
|
|
333
|
+
const control = visibleEditorPane.getControl();
|
|
334
|
+
if (isCodeEditor(control) || isDiffEditor(control)) {
|
|
335
|
+
visibleTextEditorControls.push(control);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return visibleTextEditorControls;
|
|
339
|
+
}
|
|
340
|
+
get visibleEditors() {
|
|
341
|
+
return coalesce(( this.editorGroupService.groups.map(group => group.activeEditor)));
|
|
342
|
+
}
|
|
343
|
+
async openEditor(editor, optionsOrPreferredGroup, preferredGroup) {
|
|
344
|
+
let typedEditor = undefined;
|
|
345
|
+
let options = isEditorInput(editor) ? optionsOrPreferredGroup : editor.options;
|
|
346
|
+
let group = undefined;
|
|
347
|
+
if (isPreferredGroup(optionsOrPreferredGroup)) {
|
|
348
|
+
preferredGroup = optionsOrPreferredGroup;
|
|
349
|
+
}
|
|
350
|
+
if (!isEditorInput(editor)) {
|
|
351
|
+
const resolvedEditor = await this.editorResolverService.resolveEditor(editor, preferredGroup);
|
|
352
|
+
if (resolvedEditor === 1 ) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (isEditorInputWithOptionsAndGroup(resolvedEditor)) {
|
|
356
|
+
typedEditor = resolvedEditor.editor;
|
|
357
|
+
options = resolvedEditor.options;
|
|
358
|
+
group = resolvedEditor.group;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (!typedEditor) {
|
|
362
|
+
typedEditor = isEditorInput(editor) ? editor : await this.textEditorService.resolveTextEditor(editor);
|
|
363
|
+
}
|
|
364
|
+
if (!group) {
|
|
365
|
+
let activation = undefined;
|
|
366
|
+
([group, activation] = this.instantiationService.invokeFunction(findGroup, { editor: typedEditor, options }, preferredGroup));
|
|
367
|
+
if (activation) {
|
|
368
|
+
options = { ...options, activation };
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return group.openEditor(typedEditor, options);
|
|
372
|
+
}
|
|
373
|
+
async openEditors(editors, preferredGroup, options) {
|
|
374
|
+
if (options?.validateTrust) {
|
|
375
|
+
const editorsTrusted = await this.handleWorkspaceTrust(editors);
|
|
376
|
+
if (!editorsTrusted) {
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
const mapGroupToTypedEditors = ( new Map());
|
|
381
|
+
for (const editor of editors) {
|
|
382
|
+
let typedEditor = undefined;
|
|
383
|
+
let group = undefined;
|
|
384
|
+
if (!isEditorInputWithOptions(editor)) {
|
|
385
|
+
const resolvedEditor = await this.editorResolverService.resolveEditor(editor, preferredGroup);
|
|
386
|
+
if (resolvedEditor === 1 ) {
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
if (isEditorInputWithOptionsAndGroup(resolvedEditor)) {
|
|
390
|
+
typedEditor = resolvedEditor;
|
|
391
|
+
group = resolvedEditor.group;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (!typedEditor) {
|
|
395
|
+
typedEditor = isEditorInputWithOptions(editor) ? editor : { editor: await this.textEditorService.resolveTextEditor(editor), options: editor.options };
|
|
396
|
+
}
|
|
397
|
+
if (!group) {
|
|
398
|
+
[group] = this.instantiationService.invokeFunction(findGroup, typedEditor, preferredGroup);
|
|
399
|
+
}
|
|
400
|
+
let targetGroupEditors = mapGroupToTypedEditors.get(group);
|
|
401
|
+
if (!targetGroupEditors) {
|
|
402
|
+
targetGroupEditors = [];
|
|
403
|
+
mapGroupToTypedEditors.set(group, targetGroupEditors);
|
|
404
|
+
}
|
|
405
|
+
targetGroupEditors.push(typedEditor);
|
|
406
|
+
}
|
|
407
|
+
const result = [];
|
|
408
|
+
for (const [group, editors] of mapGroupToTypedEditors) {
|
|
409
|
+
result.push(group.openEditors(editors));
|
|
410
|
+
}
|
|
411
|
+
return coalesce(await Promises.settled(result));
|
|
412
|
+
}
|
|
413
|
+
async handleWorkspaceTrust(editors) {
|
|
414
|
+
const { resources, diffMode, mergeMode } = this.extractEditorResources(editors);
|
|
415
|
+
const trustResult = await this.workspaceTrustRequestService.requestOpenFilesTrust(resources);
|
|
416
|
+
switch (trustResult) {
|
|
417
|
+
case 1 :
|
|
418
|
+
return true;
|
|
419
|
+
case 2 :
|
|
420
|
+
await this.hostService.openWindow(( resources.map(resource => ({ fileUri: resource }))), { forceNewWindow: true, diffMode, mergeMode });
|
|
421
|
+
return false;
|
|
422
|
+
case 3 :
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
extractEditorResources(editors) {
|
|
427
|
+
const resources = ( new ResourceSet());
|
|
428
|
+
let diffMode = false;
|
|
429
|
+
let mergeMode = false;
|
|
430
|
+
for (const editor of editors) {
|
|
431
|
+
if (isEditorInputWithOptions(editor)) {
|
|
432
|
+
const resource = EditorResourceAccessor.getOriginalUri(editor.editor, { supportSideBySide: SideBySideEditor.BOTH });
|
|
433
|
+
if (URI.isUri(resource)) {
|
|
434
|
+
resources.add(resource);
|
|
435
|
+
}
|
|
436
|
+
else if (resource) {
|
|
437
|
+
if (resource.primary) {
|
|
438
|
+
resources.add(resource.primary);
|
|
439
|
+
}
|
|
440
|
+
if (resource.secondary) {
|
|
441
|
+
resources.add(resource.secondary);
|
|
442
|
+
}
|
|
443
|
+
diffMode = editor.editor instanceof DiffEditorInput;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
if (isResourceMergeEditorInput(editor)) {
|
|
448
|
+
if (URI.isUri(editor.input1)) {
|
|
449
|
+
resources.add(editor.input1.resource);
|
|
450
|
+
}
|
|
451
|
+
if (URI.isUri(editor.input2)) {
|
|
452
|
+
resources.add(editor.input2.resource);
|
|
453
|
+
}
|
|
454
|
+
if (URI.isUri(editor.base)) {
|
|
455
|
+
resources.add(editor.base.resource);
|
|
456
|
+
}
|
|
457
|
+
if (URI.isUri(editor.result)) {
|
|
458
|
+
resources.add(editor.result.resource);
|
|
459
|
+
}
|
|
460
|
+
mergeMode = true;
|
|
461
|
+
}
|
|
462
|
+
if (isResourceDiffEditorInput(editor)) {
|
|
463
|
+
if (URI.isUri(editor.original.resource)) {
|
|
464
|
+
resources.add(editor.original.resource);
|
|
465
|
+
}
|
|
466
|
+
if (URI.isUri(editor.modified.resource)) {
|
|
467
|
+
resources.add(editor.modified.resource);
|
|
468
|
+
}
|
|
469
|
+
diffMode = true;
|
|
470
|
+
}
|
|
471
|
+
else if (isResourceEditorInput(editor)) {
|
|
472
|
+
resources.add(editor.resource);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
resources: Array.from(( resources.keys())),
|
|
478
|
+
diffMode,
|
|
479
|
+
mergeMode
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
isOpened(editor) {
|
|
483
|
+
return this.editorsObserver.hasEditor({
|
|
484
|
+
resource: this.uriIdentityService.asCanonicalUri(editor.resource),
|
|
485
|
+
typeId: editor.typeId,
|
|
486
|
+
editorId: editor.editorId
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
isVisible(editor) {
|
|
490
|
+
for (const group of this.editorGroupService.groups) {
|
|
491
|
+
if (group.activeEditor?.matches(editor)) {
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
async closeEditor({ editor, groupId }, options) {
|
|
498
|
+
const group = this.editorGroupService.getGroup(groupId);
|
|
499
|
+
await group?.closeEditor(editor, options);
|
|
500
|
+
}
|
|
501
|
+
async closeEditors(editors, options) {
|
|
502
|
+
const mapGroupToEditors = ( new Map());
|
|
503
|
+
for (const { editor, groupId } of editors) {
|
|
504
|
+
const group = this.editorGroupService.getGroup(groupId);
|
|
505
|
+
if (!group) {
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
let editors = mapGroupToEditors.get(group);
|
|
509
|
+
if (!editors) {
|
|
510
|
+
editors = [];
|
|
511
|
+
mapGroupToEditors.set(group, editors);
|
|
512
|
+
}
|
|
513
|
+
editors.push(editor);
|
|
514
|
+
}
|
|
515
|
+
for (const [group, editors] of mapGroupToEditors) {
|
|
516
|
+
await group.closeEditors(editors, options);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
findEditors(arg1, options, arg2) {
|
|
520
|
+
const resource = URI.isUri(arg1) ? arg1 : arg1.resource;
|
|
521
|
+
const typeId = URI.isUri(arg1) ? undefined : arg1.typeId;
|
|
522
|
+
if (options?.supportSideBySide !== SideBySideEditor.ANY && options?.supportSideBySide !== SideBySideEditor.SECONDARY) {
|
|
523
|
+
if (!this.editorsObserver.hasEditors(resource)) {
|
|
524
|
+
if (URI.isUri(arg1) || isUndefined(arg2)) {
|
|
525
|
+
return [];
|
|
526
|
+
}
|
|
527
|
+
return undefined;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
if (!isUndefined(arg2)) {
|
|
531
|
+
const targetGroup = typeof arg2 === 'number' ? this.editorGroupService.getGroup(arg2) : arg2;
|
|
532
|
+
if (URI.isUri(arg1)) {
|
|
533
|
+
if (!targetGroup) {
|
|
534
|
+
return [];
|
|
535
|
+
}
|
|
536
|
+
return targetGroup.findEditors(resource, options);
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
if (!targetGroup) {
|
|
540
|
+
return undefined;
|
|
541
|
+
}
|
|
542
|
+
const editors = targetGroup.findEditors(resource, options);
|
|
543
|
+
for (const editor of editors) {
|
|
544
|
+
if (editor.typeId === typeId) {
|
|
545
|
+
return editor;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return undefined;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
const result = [];
|
|
553
|
+
for (const group of this.editorGroupService.getGroups(1 )) {
|
|
554
|
+
const editors = [];
|
|
555
|
+
if (URI.isUri(arg1)) {
|
|
556
|
+
editors.push(...this.findEditors(arg1, options, group));
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
const editor = this.findEditors(arg1, options, group);
|
|
560
|
+
if (editor) {
|
|
561
|
+
editors.push(editor);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
result.push(...( editors.map(editor => ({ editor, groupId: group.id }))));
|
|
565
|
+
}
|
|
566
|
+
return result;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
async replaceEditors(replacements, group) {
|
|
570
|
+
const targetGroup = typeof group === 'number' ? this.editorGroupService.getGroup(group) : group;
|
|
571
|
+
const typedReplacements = [];
|
|
572
|
+
for (const replacement of replacements) {
|
|
573
|
+
let typedReplacement = undefined;
|
|
574
|
+
if (!isEditorInput(replacement.replacement)) {
|
|
575
|
+
const resolvedEditor = await this.editorResolverService.resolveEditor(replacement.replacement, targetGroup);
|
|
576
|
+
if (resolvedEditor === 1 ) {
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
if (isEditorInputWithOptionsAndGroup(resolvedEditor)) {
|
|
580
|
+
typedReplacement = {
|
|
581
|
+
editor: replacement.editor,
|
|
582
|
+
replacement: resolvedEditor.editor,
|
|
583
|
+
options: resolvedEditor.options,
|
|
584
|
+
forceReplaceDirty: replacement.forceReplaceDirty
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
if (!typedReplacement) {
|
|
589
|
+
typedReplacement = {
|
|
590
|
+
editor: replacement.editor,
|
|
591
|
+
replacement: isEditorReplacement(replacement) ? replacement.replacement : await this.textEditorService.resolveTextEditor(replacement.replacement),
|
|
592
|
+
options: isEditorReplacement(replacement) ? replacement.options : replacement.replacement.options,
|
|
593
|
+
forceReplaceDirty: replacement.forceReplaceDirty
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
typedReplacements.push(typedReplacement);
|
|
597
|
+
}
|
|
598
|
+
return targetGroup?.replaceEditors(typedReplacements);
|
|
599
|
+
}
|
|
600
|
+
async save(editors, options) {
|
|
601
|
+
if (!Array.isArray(editors)) {
|
|
602
|
+
editors = [editors];
|
|
603
|
+
}
|
|
604
|
+
const uniqueEditors = this.getUniqueEditors(editors);
|
|
605
|
+
const editorsToSaveParallel = [];
|
|
606
|
+
const editorsToSaveSequentially = [];
|
|
607
|
+
if (options?.saveAs) {
|
|
608
|
+
editorsToSaveSequentially.push(...uniqueEditors);
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
for (const { groupId, editor } of uniqueEditors) {
|
|
612
|
+
if (editor.hasCapability(4 )) {
|
|
613
|
+
editorsToSaveSequentially.push({ groupId, editor });
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
editorsToSaveParallel.push({ groupId, editor });
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
const saveResults = await Promises.settled(( editorsToSaveParallel.map(({ groupId, editor }) => {
|
|
621
|
+
if (options?.reason === 1 ) {
|
|
622
|
+
this.editorGroupService.getGroup(groupId)?.pinEditor(editor);
|
|
623
|
+
}
|
|
624
|
+
return editor.save(groupId, options);
|
|
625
|
+
})));
|
|
626
|
+
for (const { groupId, editor } of editorsToSaveSequentially) {
|
|
627
|
+
if (editor.isDisposed()) {
|
|
628
|
+
continue;
|
|
629
|
+
}
|
|
630
|
+
const editorPane = await this.openEditor(editor, groupId);
|
|
631
|
+
const editorOptions = {
|
|
632
|
+
pinned: true,
|
|
633
|
+
viewState: editorPane?.getViewState()
|
|
634
|
+
};
|
|
635
|
+
const result = options?.saveAs ? await editor.saveAs(groupId, options) : await editor.save(groupId, options);
|
|
636
|
+
saveResults.push(result);
|
|
637
|
+
if (!result) {
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
if (!editor.matches(result)) {
|
|
641
|
+
const targetGroups = editor.hasCapability(4 ) ? ( this.editorGroupService.groups.map(group => group.id) ) : [groupId];
|
|
642
|
+
for (const targetGroup of targetGroups) {
|
|
643
|
+
if (result instanceof EditorInput) {
|
|
644
|
+
await this.replaceEditors([{ editor, replacement: result, options: editorOptions }], targetGroup);
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
await this.replaceEditors([{ editor, replacement: { ...result, options: editorOptions } }], targetGroup);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return {
|
|
653
|
+
success: saveResults.every(result => !!result),
|
|
654
|
+
editors: coalesce(saveResults)
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
saveAll(options) {
|
|
658
|
+
return this.save(this.getAllDirtyEditors(options), options);
|
|
659
|
+
}
|
|
660
|
+
async revert(editors, options) {
|
|
661
|
+
if (!Array.isArray(editors)) {
|
|
662
|
+
editors = [editors];
|
|
663
|
+
}
|
|
664
|
+
const uniqueEditors = this.getUniqueEditors(editors);
|
|
665
|
+
await Promises.settled(( uniqueEditors.map(async ({ groupId, editor }) => {
|
|
666
|
+
this.editorGroupService.getGroup(groupId)?.pinEditor(editor);
|
|
667
|
+
return editor.revert(groupId, options);
|
|
668
|
+
})));
|
|
669
|
+
return !( uniqueEditors.some(({ editor }) => editor.isDirty()));
|
|
670
|
+
}
|
|
671
|
+
async revertAll(options) {
|
|
672
|
+
return this.revert(this.getAllDirtyEditors(options), options);
|
|
673
|
+
}
|
|
674
|
+
getAllDirtyEditors(options) {
|
|
675
|
+
const editors = [];
|
|
676
|
+
for (const group of this.editorGroupService.getGroups(1 )) {
|
|
677
|
+
for (const editor of group.getEditors(0 )) {
|
|
678
|
+
if (!editor.isDirty()) {
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
if (!options?.includeUntitled && editor.hasCapability(4 )) {
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
if (options?.excludeSticky && group.isSticky(editor)) {
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
687
|
+
editors.push({ groupId: group.id, editor });
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
return editors;
|
|
691
|
+
}
|
|
692
|
+
getUniqueEditors(editors) {
|
|
693
|
+
const uniqueEditors = [];
|
|
694
|
+
for (const { editor, groupId } of editors) {
|
|
695
|
+
if (( uniqueEditors.some(uniqueEditor => uniqueEditor.editor.matches(editor)))) {
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
uniqueEditors.push({ editor, groupId });
|
|
699
|
+
}
|
|
700
|
+
return uniqueEditors;
|
|
701
|
+
}
|
|
702
|
+
dispose() {
|
|
703
|
+
super.dispose();
|
|
704
|
+
this.activeOutOfWorkspaceWatchers.forEach(disposable => dispose(disposable));
|
|
705
|
+
this.activeOutOfWorkspaceWatchers.clear();
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
EditorService = ( __decorate([
|
|
709
|
+
( __param(0, IEditorGroupsService)),
|
|
710
|
+
( __param(1, IInstantiationService)),
|
|
711
|
+
( __param(2, IFileService)),
|
|
712
|
+
( __param(3, IConfigurationService)),
|
|
713
|
+
( __param(4, IWorkspaceContextService)),
|
|
714
|
+
( __param(5, IUriIdentityService)),
|
|
715
|
+
( __param(6, IEditorResolverService)),
|
|
716
|
+
( __param(7, IWorkspaceTrustRequestService)),
|
|
717
|
+
( __param(8, IHostService)),
|
|
718
|
+
( __param(9, ITextEditorService))
|
|
719
|
+
], EditorService));
|
|
720
|
+
export { EditorService };
|