@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,1152 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import './media/editorstatus.css.js';
|
|
3
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import { runAtThisOrScheduleAtNextAnimationFrame } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
5
|
+
import { format, splitLines, compare } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
6
|
+
import { isEqual, extname, basename } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
7
|
+
import { withNullAsUndefined, withUndefinedAsNull, areFunctions, assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
8
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
9
|
+
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
10
|
+
import { Language } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
11
|
+
import { UntitledTextEditorInput } from '../../../services/untitled/common/untitledTextEditorInput.js';
|
|
12
|
+
import { EditorResourceAccessor, SideBySideEditor } from '../../../common/editor.js';
|
|
13
|
+
import { Disposable, MutableDisposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
14
|
+
import { TrimTrailingWhitespaceAction } from 'monaco-editor/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js';
|
|
15
|
+
import { IndentUsingSpaces, IndentUsingTabs, ChangeTabDisplaySize, DetectIndentation, IndentationToSpacesAction, IndentationToTabsAction } from 'monaco-editor/esm/vs/editor/contrib/indentation/browser/indentation.js';
|
|
16
|
+
import { BaseBinaryResourceEditor } from './binaryEditor.js';
|
|
17
|
+
import { BinaryResourceDiffEditor } from './binaryDiffEditor.js';
|
|
18
|
+
import { IEditorService } from '../../../services/editor/common/editorService.js';
|
|
19
|
+
import { FILES_ASSOCIATIONS_CONFIG, IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
20
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
21
|
+
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
22
|
+
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
23
|
+
import { Selection } from 'monaco-editor/esm/vs/editor/common/core/selection.js';
|
|
24
|
+
import { TabFocus } from 'monaco-editor/esm/vs/editor/browser/config/tabFocus.js';
|
|
25
|
+
import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
26
|
+
import { IExtensionGalleryService } from '../../../../platform/extensionManagement/common/extensionManagement.js';
|
|
27
|
+
import { ITextFileService } from '../../../services/textfile/common/textfiles.js';
|
|
28
|
+
import { SUPPORTED_ENCODINGS } from '../../../services/textfile/common/encoding.js';
|
|
29
|
+
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
30
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
31
|
+
import { deepClone } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
32
|
+
import { getCodeEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
|
|
33
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
34
|
+
import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
|
|
35
|
+
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
36
|
+
import { getIconClassesForLanguageId } from 'monaco-editor/esm/vs/editor/common/services/getIconClasses.js';
|
|
37
|
+
import { timeout, Promises } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
38
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
39
|
+
import { IStatusbarService } from '../../../services/statusbar/browser/statusbar.js';
|
|
40
|
+
import { IMarkerData, MarkerSeverity, IMarkerService } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
41
|
+
import { STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGROUND } from '../../../common/theme.js';
|
|
42
|
+
import { themeColorFromId } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
43
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
44
|
+
import { SideBySideEditorInput } from '../../../common/editor/sideBySideEditorInput.js';
|
|
45
|
+
import { ILanguageDetectionService, AutomaticLanguageDetectionLikelyWrongId } from '../../../services/languageDetection/common/languageDetectionWorkerService.js';
|
|
46
|
+
import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
47
|
+
import { Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
48
|
+
import { KeyChord } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
|
|
49
|
+
import { TabFocusMode } from './tabFocus.js';
|
|
50
|
+
class SideBySideEditorEncodingSupport {
|
|
51
|
+
constructor(primary, secondary) {
|
|
52
|
+
this.primary = primary;
|
|
53
|
+
this.secondary = secondary;
|
|
54
|
+
}
|
|
55
|
+
getEncoding() {
|
|
56
|
+
return this.primary.getEncoding();
|
|
57
|
+
}
|
|
58
|
+
async setEncoding(encoding, mode) {
|
|
59
|
+
await Promises.settled(( [this.primary, this.secondary].map(editor => editor.setEncoding(encoding, mode))));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
class SideBySideEditorLanguageSupport {
|
|
63
|
+
constructor(primary, secondary) {
|
|
64
|
+
this.primary = primary;
|
|
65
|
+
this.secondary = secondary;
|
|
66
|
+
}
|
|
67
|
+
setLanguageId(languageId, source) {
|
|
68
|
+
[this.primary, this.secondary].forEach(editor => editor.setLanguageId(languageId, source));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function toEditorWithEncodingSupport(input) {
|
|
72
|
+
if (input instanceof UntitledTextEditorInput) {
|
|
73
|
+
return input;
|
|
74
|
+
}
|
|
75
|
+
if (input instanceof SideBySideEditorInput) {
|
|
76
|
+
const primaryEncodingSupport = toEditorWithEncodingSupport(input.primary);
|
|
77
|
+
const secondaryEncodingSupport = toEditorWithEncodingSupport(input.secondary);
|
|
78
|
+
if (primaryEncodingSupport && secondaryEncodingSupport) {
|
|
79
|
+
return ( new SideBySideEditorEncodingSupport(primaryEncodingSupport, secondaryEncodingSupport));
|
|
80
|
+
}
|
|
81
|
+
return primaryEncodingSupport;
|
|
82
|
+
}
|
|
83
|
+
const encodingSupport = input;
|
|
84
|
+
if (areFunctions(encodingSupport.setEncoding, encodingSupport.getEncoding)) {
|
|
85
|
+
return encodingSupport;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
function toEditorWithLanguageSupport(input) {
|
|
90
|
+
if (input instanceof UntitledTextEditorInput) {
|
|
91
|
+
return input;
|
|
92
|
+
}
|
|
93
|
+
if (input instanceof SideBySideEditorInput) {
|
|
94
|
+
const primaryLanguageSupport = toEditorWithLanguageSupport(input.primary);
|
|
95
|
+
const secondaryLanguageSupport = toEditorWithLanguageSupport(input.secondary);
|
|
96
|
+
if (primaryLanguageSupport && secondaryLanguageSupport) {
|
|
97
|
+
return ( new SideBySideEditorLanguageSupport(primaryLanguageSupport, secondaryLanguageSupport));
|
|
98
|
+
}
|
|
99
|
+
return primaryLanguageSupport;
|
|
100
|
+
}
|
|
101
|
+
const languageSupport = input;
|
|
102
|
+
if (typeof languageSupport.setLanguageId === 'function') {
|
|
103
|
+
return languageSupport;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
class StateChange {
|
|
108
|
+
constructor() {
|
|
109
|
+
this.indentation = false;
|
|
110
|
+
this.selectionStatus = false;
|
|
111
|
+
this.languageId = false;
|
|
112
|
+
this.languageStatus = false;
|
|
113
|
+
this.encoding = false;
|
|
114
|
+
this.EOL = false;
|
|
115
|
+
this.tabFocusMode = false;
|
|
116
|
+
this.columnSelectionMode = false;
|
|
117
|
+
this.metadata = false;
|
|
118
|
+
}
|
|
119
|
+
combine(other) {
|
|
120
|
+
this.indentation = this.indentation || other.indentation;
|
|
121
|
+
this.selectionStatus = this.selectionStatus || other.selectionStatus;
|
|
122
|
+
this.languageId = this.languageId || other.languageId;
|
|
123
|
+
this.languageStatus = this.languageStatus || other.languageStatus;
|
|
124
|
+
this.encoding = this.encoding || other.encoding;
|
|
125
|
+
this.EOL = this.EOL || other.EOL;
|
|
126
|
+
this.tabFocusMode = this.tabFocusMode || other.tabFocusMode;
|
|
127
|
+
this.columnSelectionMode = this.columnSelectionMode || other.columnSelectionMode;
|
|
128
|
+
this.metadata = this.metadata || other.metadata;
|
|
129
|
+
}
|
|
130
|
+
hasChanges() {
|
|
131
|
+
return this.indentation
|
|
132
|
+
|| this.selectionStatus
|
|
133
|
+
|| this.languageId
|
|
134
|
+
|| this.languageStatus
|
|
135
|
+
|| this.encoding
|
|
136
|
+
|| this.EOL
|
|
137
|
+
|| this.tabFocusMode
|
|
138
|
+
|| this.columnSelectionMode
|
|
139
|
+
|| this.metadata;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
class State {
|
|
143
|
+
get selectionStatus() { return this._selectionStatus; }
|
|
144
|
+
get languageId() { return this._languageId; }
|
|
145
|
+
get encoding() { return this._encoding; }
|
|
146
|
+
get EOL() { return this._EOL; }
|
|
147
|
+
get indentation() { return this._indentation; }
|
|
148
|
+
get tabFocusMode() { return this._tabFocusMode; }
|
|
149
|
+
get columnSelectionMode() { return this._columnSelectionMode; }
|
|
150
|
+
get metadata() { return this._metadata; }
|
|
151
|
+
update(update) {
|
|
152
|
+
const change = ( new StateChange());
|
|
153
|
+
switch (update.type) {
|
|
154
|
+
case 'selectionStatus':
|
|
155
|
+
if (this._selectionStatus !== update.selectionStatus) {
|
|
156
|
+
this._selectionStatus = update.selectionStatus;
|
|
157
|
+
change.selectionStatus = true;
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case 'indentation':
|
|
161
|
+
if (this._indentation !== update.indentation) {
|
|
162
|
+
this._indentation = update.indentation;
|
|
163
|
+
change.indentation = true;
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
case 'languageId':
|
|
167
|
+
if (this._languageId !== update.languageId) {
|
|
168
|
+
this._languageId = update.languageId;
|
|
169
|
+
change.languageId = true;
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case 'encoding':
|
|
173
|
+
if (this._encoding !== update.encoding) {
|
|
174
|
+
this._encoding = update.encoding;
|
|
175
|
+
change.encoding = true;
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
case 'EOL':
|
|
179
|
+
if (this._EOL !== update.EOL) {
|
|
180
|
+
this._EOL = update.EOL;
|
|
181
|
+
change.EOL = true;
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case 'tabFocusMode':
|
|
185
|
+
if (this._tabFocusMode !== update.tabFocusMode) {
|
|
186
|
+
this._tabFocusMode = update.tabFocusMode;
|
|
187
|
+
change.tabFocusMode = true;
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
case 'columnSelectionMode':
|
|
191
|
+
if (this._columnSelectionMode !== update.columnSelectionMode) {
|
|
192
|
+
this._columnSelectionMode = update.columnSelectionMode;
|
|
193
|
+
change.columnSelectionMode = true;
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
case 'metadata':
|
|
197
|
+
if (this._metadata !== update.metadata) {
|
|
198
|
+
this._metadata = update.metadata;
|
|
199
|
+
change.metadata = true;
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
return change;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const nlsSingleSelectionRange = ( localize('singleSelectionRange', "Ln {0}, Col {1} ({2} selected)"));
|
|
207
|
+
const nlsSingleSelection = ( localize('singleSelection', "Ln {0}, Col {1}"));
|
|
208
|
+
const nlsMultiSelectionRange = ( localize('multiSelectionRange', "{0} selections ({1} characters selected)"));
|
|
209
|
+
const nlsMultiSelection = ( localize('multiSelection', "{0} selections"));
|
|
210
|
+
const nlsEOLLF = ( localize('endOfLineLineFeed', "LF"));
|
|
211
|
+
const nlsEOLCRLF = ( localize('endOfLineCarriageReturnLineFeed', "CRLF"));
|
|
212
|
+
let EditorStatus = class EditorStatus extends Disposable {
|
|
213
|
+
constructor(editorService, quickInputService, languageService, textFileService, statusbarService, instantiationService, contextKeyService) {
|
|
214
|
+
super();
|
|
215
|
+
this.editorService = editorService;
|
|
216
|
+
this.quickInputService = quickInputService;
|
|
217
|
+
this.languageService = languageService;
|
|
218
|
+
this.textFileService = textFileService;
|
|
219
|
+
this.statusbarService = statusbarService;
|
|
220
|
+
this.instantiationService = instantiationService;
|
|
221
|
+
this.contextKeyService = contextKeyService;
|
|
222
|
+
this.tabFocusModeElement = this._register(( new MutableDisposable()));
|
|
223
|
+
this.columnSelectionModeElement = this._register(( new MutableDisposable()));
|
|
224
|
+
this.indentationElement = this._register(( new MutableDisposable()));
|
|
225
|
+
this.selectionElement = this._register(( new MutableDisposable()));
|
|
226
|
+
this.encodingElement = this._register(( new MutableDisposable()));
|
|
227
|
+
this.eolElement = this._register(( new MutableDisposable()));
|
|
228
|
+
this.languageElement = this._register(( new MutableDisposable()));
|
|
229
|
+
this.metadataElement = this._register(( new MutableDisposable()));
|
|
230
|
+
this.currentProblemStatus = this._register(this.instantiationService.createInstance(ShowCurrentMarkerInStatusbarContribution));
|
|
231
|
+
this.state = ( new State());
|
|
232
|
+
this.activeEditorListeners = this._register(( new DisposableStore()));
|
|
233
|
+
this.delayedRender = this._register(( new MutableDisposable()));
|
|
234
|
+
this.toRender = null;
|
|
235
|
+
this.tabFocusMode = instantiationService.createInstance(TabFocusMode);
|
|
236
|
+
this.registerCommands();
|
|
237
|
+
this.registerListeners();
|
|
238
|
+
}
|
|
239
|
+
registerListeners() {
|
|
240
|
+
this._register(this.editorService.onDidActiveEditorChange(() => this.updateStatusBar()));
|
|
241
|
+
this._register(this.textFileService.untitled.onDidChangeEncoding(model => this.onResourceEncodingChange(model.resource)));
|
|
242
|
+
this._register(this.textFileService.files.onDidChangeEncoding(model => this.onResourceEncodingChange((model.resource))));
|
|
243
|
+
this._register(Event.runAndSubscribe(TabFocus.onDidChangeTabFocus, () => this.onTabFocusModeChange()));
|
|
244
|
+
this._register(this.tabFocusMode.onDidChange(() => this.onTabFocusModeChange()));
|
|
245
|
+
}
|
|
246
|
+
registerCommands() {
|
|
247
|
+
CommandsRegistry.registerCommand({ id: 'changeEditorIndentation', handler: () => this.showIndentationPicker() });
|
|
248
|
+
}
|
|
249
|
+
async showIndentationPicker() {
|
|
250
|
+
const activeTextEditorControl = getCodeEditor(this.editorService.activeTextEditorControl);
|
|
251
|
+
if (!activeTextEditorControl) {
|
|
252
|
+
return this.quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
253
|
+
}
|
|
254
|
+
if (this.editorService.activeEditor?.hasCapability(2 )) {
|
|
255
|
+
return this.quickInputService.pick([{ label: ( localize('noWritableCodeEditor', "The active code editor is read-only.")) }]);
|
|
256
|
+
}
|
|
257
|
+
const picks = ( [
|
|
258
|
+
assertIsDefined(activeTextEditorControl.getAction(IndentUsingSpaces.ID)),
|
|
259
|
+
assertIsDefined(activeTextEditorControl.getAction(IndentUsingTabs.ID)),
|
|
260
|
+
assertIsDefined(activeTextEditorControl.getAction(ChangeTabDisplaySize.ID)),
|
|
261
|
+
assertIsDefined(activeTextEditorControl.getAction(DetectIndentation.ID)),
|
|
262
|
+
assertIsDefined(activeTextEditorControl.getAction(IndentationToSpacesAction.ID)),
|
|
263
|
+
assertIsDefined(activeTextEditorControl.getAction(IndentationToTabsAction.ID)),
|
|
264
|
+
assertIsDefined(activeTextEditorControl.getAction(TrimTrailingWhitespaceAction.ID))
|
|
265
|
+
].map((a) => {
|
|
266
|
+
return {
|
|
267
|
+
id: a.id,
|
|
268
|
+
label: a.label,
|
|
269
|
+
detail: (Language.isDefaultVariant() || a.label === a.alias) ? undefined : a.alias,
|
|
270
|
+
run: () => {
|
|
271
|
+
activeTextEditorControl.focus();
|
|
272
|
+
a.run();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}));
|
|
276
|
+
picks.splice(3, 0, { type: 'separator', label: ( localize('indentConvert', "convert file")) });
|
|
277
|
+
picks.unshift({ type: 'separator', label: ( localize('indentView', "change view")) });
|
|
278
|
+
const action = await this.quickInputService.pick(picks, { placeHolder: ( localize('pickAction', "Select Action")), matchOnDetail: true });
|
|
279
|
+
return action?.run();
|
|
280
|
+
}
|
|
281
|
+
updateTabFocusModeElement(visible) {
|
|
282
|
+
if (visible) {
|
|
283
|
+
if (!this.tabFocusModeElement.value) {
|
|
284
|
+
const text = ( localize('tabFocusModeEnabled', "Tab Moves Focus"));
|
|
285
|
+
this.tabFocusModeElement.value = this.statusbarService.addEntry({
|
|
286
|
+
name: ( localize('status.editor.tabFocusMode', "Accessibility Mode")),
|
|
287
|
+
text,
|
|
288
|
+
ariaLabel: text,
|
|
289
|
+
tooltip: ( localize('disableTabMode', "Disable Accessibility Mode")),
|
|
290
|
+
command: 'editor.action.toggleTabFocusMode',
|
|
291
|
+
backgroundColor: themeColorFromId(STATUS_BAR_PROMINENT_ITEM_BACKGROUND),
|
|
292
|
+
color: themeColorFromId(STATUS_BAR_PROMINENT_ITEM_FOREGROUND)
|
|
293
|
+
}, 'status.editor.tabFocusMode', 1 , 100.7);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.tabFocusModeElement.clear();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
updateColumnSelectionModeElement(visible) {
|
|
301
|
+
if (visible) {
|
|
302
|
+
if (!this.columnSelectionModeElement.value) {
|
|
303
|
+
const text = ( localize('columnSelectionModeEnabled', "Column Selection"));
|
|
304
|
+
this.columnSelectionModeElement.value = this.statusbarService.addEntry({
|
|
305
|
+
name: ( localize('status.editor.columnSelectionMode', "Column Selection Mode")),
|
|
306
|
+
text,
|
|
307
|
+
ariaLabel: text,
|
|
308
|
+
tooltip: ( localize('disableColumnSelectionMode', "Disable Column Selection Mode")),
|
|
309
|
+
command: 'editor.action.toggleColumnSelection',
|
|
310
|
+
backgroundColor: themeColorFromId(STATUS_BAR_PROMINENT_ITEM_BACKGROUND),
|
|
311
|
+
color: themeColorFromId(STATUS_BAR_PROMINENT_ITEM_FOREGROUND)
|
|
312
|
+
}, 'status.editor.columnSelectionMode', 1 , 100.8);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
this.columnSelectionModeElement.clear();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
updateSelectionElement(text) {
|
|
320
|
+
if (!text) {
|
|
321
|
+
this.selectionElement.clear();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const props = {
|
|
325
|
+
name: ( localize('status.editor.selection', "Editor Selection")),
|
|
326
|
+
text,
|
|
327
|
+
ariaLabel: text,
|
|
328
|
+
tooltip: ( localize('gotoLine', "Go to Line/Column")),
|
|
329
|
+
command: 'workbench.action.gotoLine'
|
|
330
|
+
};
|
|
331
|
+
this.updateElement(this.selectionElement, props, 'status.editor.selection', 1 , 100.5);
|
|
332
|
+
}
|
|
333
|
+
updateIndentationElement(text) {
|
|
334
|
+
if (!text) {
|
|
335
|
+
this.indentationElement.clear();
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const props = {
|
|
339
|
+
name: ( localize('status.editor.indentation', "Editor Indentation")),
|
|
340
|
+
text,
|
|
341
|
+
ariaLabel: text,
|
|
342
|
+
tooltip: ( localize('selectIndentation', "Select Indentation")),
|
|
343
|
+
command: 'changeEditorIndentation'
|
|
344
|
+
};
|
|
345
|
+
this.updateElement(this.indentationElement, props, 'status.editor.indentation', 1 , 100.4);
|
|
346
|
+
}
|
|
347
|
+
updateEncodingElement(text) {
|
|
348
|
+
if (!text) {
|
|
349
|
+
this.encodingElement.clear();
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const props = {
|
|
353
|
+
name: ( localize('status.editor.encoding', "Editor Encoding")),
|
|
354
|
+
text,
|
|
355
|
+
ariaLabel: text,
|
|
356
|
+
tooltip: ( localize('selectEncoding', "Select Encoding")),
|
|
357
|
+
command: 'workbench.action.editor.changeEncoding'
|
|
358
|
+
};
|
|
359
|
+
this.updateElement(this.encodingElement, props, 'status.editor.encoding', 1 , 100.3);
|
|
360
|
+
}
|
|
361
|
+
updateEOLElement(text) {
|
|
362
|
+
if (!text) {
|
|
363
|
+
this.eolElement.clear();
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const props = {
|
|
367
|
+
name: ( localize('status.editor.eol', "Editor End of Line")),
|
|
368
|
+
text,
|
|
369
|
+
ariaLabel: text,
|
|
370
|
+
tooltip: ( localize('selectEOL', "Select End of Line Sequence")),
|
|
371
|
+
command: 'workbench.action.editor.changeEOL'
|
|
372
|
+
};
|
|
373
|
+
this.updateElement(this.eolElement, props, 'status.editor.eol', 1 , 100.2);
|
|
374
|
+
}
|
|
375
|
+
updateLanguageIdElement(text) {
|
|
376
|
+
if (!text) {
|
|
377
|
+
this.languageElement.clear();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const props = {
|
|
381
|
+
name: ( localize('status.editor.mode', "Editor Language")),
|
|
382
|
+
text,
|
|
383
|
+
ariaLabel: text,
|
|
384
|
+
tooltip: ( localize('selectLanguageMode', "Select Language Mode")),
|
|
385
|
+
command: 'workbench.action.editor.changeLanguageMode'
|
|
386
|
+
};
|
|
387
|
+
this.updateElement(this.languageElement, props, 'status.editor.mode', 1 , 100.1);
|
|
388
|
+
}
|
|
389
|
+
updateMetadataElement(text) {
|
|
390
|
+
if (!text) {
|
|
391
|
+
this.metadataElement.clear();
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const props = {
|
|
395
|
+
name: ( localize('status.editor.info', "File Information")),
|
|
396
|
+
text,
|
|
397
|
+
ariaLabel: text,
|
|
398
|
+
tooltip: ( localize('fileInfo', "File Information"))
|
|
399
|
+
};
|
|
400
|
+
this.updateElement(this.metadataElement, props, 'status.editor.info', 1 , 100);
|
|
401
|
+
}
|
|
402
|
+
updateElement(element, props, id, alignment, priority) {
|
|
403
|
+
if (!element.value) {
|
|
404
|
+
element.value = this.statusbarService.addEntry(props, id, alignment, priority);
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
element.value.update(props);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
updateState(update) {
|
|
411
|
+
const changed = this.state.update(update);
|
|
412
|
+
if (!changed.hasChanges()) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (!this.toRender) {
|
|
416
|
+
this.toRender = changed;
|
|
417
|
+
this.delayedRender.value = runAtThisOrScheduleAtNextAnimationFrame(() => {
|
|
418
|
+
this.delayedRender.clear();
|
|
419
|
+
const toRender = this.toRender;
|
|
420
|
+
this.toRender = null;
|
|
421
|
+
if (toRender) {
|
|
422
|
+
this.doRenderNow(toRender);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
this.toRender.combine(changed);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
doRenderNow(changed) {
|
|
431
|
+
this.updateTabFocusModeElement(!!this.state.tabFocusMode);
|
|
432
|
+
this.updateColumnSelectionModeElement(!!this.state.columnSelectionMode);
|
|
433
|
+
this.updateIndentationElement(this.state.indentation);
|
|
434
|
+
this.updateSelectionElement(this.state.selectionStatus);
|
|
435
|
+
this.updateEncodingElement(this.state.encoding);
|
|
436
|
+
this.updateEOLElement(this.state.EOL ? this.state.EOL === '\r\n' ? nlsEOLCRLF : nlsEOLLF : undefined);
|
|
437
|
+
this.updateLanguageIdElement(this.state.languageId);
|
|
438
|
+
this.updateMetadataElement(this.state.metadata);
|
|
439
|
+
}
|
|
440
|
+
getSelectionLabel(info) {
|
|
441
|
+
if (!info || !info.selections) {
|
|
442
|
+
return undefined;
|
|
443
|
+
}
|
|
444
|
+
if (info.selections.length === 1) {
|
|
445
|
+
if (info.charactersSelected) {
|
|
446
|
+
return format(nlsSingleSelectionRange, info.selections[0].positionLineNumber, info.selections[0].positionColumn, info.charactersSelected);
|
|
447
|
+
}
|
|
448
|
+
return format(nlsSingleSelection, info.selections[0].positionLineNumber, info.selections[0].positionColumn);
|
|
449
|
+
}
|
|
450
|
+
if (info.charactersSelected) {
|
|
451
|
+
return format(nlsMultiSelectionRange, info.selections.length, info.charactersSelected);
|
|
452
|
+
}
|
|
453
|
+
if (info.selections.length > 0) {
|
|
454
|
+
return format(nlsMultiSelection, info.selections.length);
|
|
455
|
+
}
|
|
456
|
+
return undefined;
|
|
457
|
+
}
|
|
458
|
+
updateStatusBar() {
|
|
459
|
+
const activeInput = this.editorService.activeEditor;
|
|
460
|
+
const activeEditorPane = this.editorService.activeEditorPane;
|
|
461
|
+
const activeCodeEditor = activeEditorPane ? withNullAsUndefined(getCodeEditor(activeEditorPane.getControl())) : undefined;
|
|
462
|
+
this.onColumnSelectionModeChange(activeCodeEditor);
|
|
463
|
+
this.onSelectionChange(activeCodeEditor);
|
|
464
|
+
this.onLanguageChange(activeCodeEditor, activeInput);
|
|
465
|
+
this.onEOLChange(activeCodeEditor);
|
|
466
|
+
this.onEncodingChange(activeEditorPane, activeCodeEditor);
|
|
467
|
+
this.onIndentationChange(activeCodeEditor);
|
|
468
|
+
this.onMetadataChange(activeEditorPane);
|
|
469
|
+
this.currentProblemStatus.update(activeCodeEditor);
|
|
470
|
+
this.activeEditorListeners.clear();
|
|
471
|
+
if (activeEditorPane) {
|
|
472
|
+
this.activeEditorListeners.add(activeEditorPane.onDidChangeControl(() => {
|
|
473
|
+
this.updateStatusBar();
|
|
474
|
+
}));
|
|
475
|
+
}
|
|
476
|
+
if (activeCodeEditor) {
|
|
477
|
+
this.activeEditorListeners.add(activeCodeEditor.onDidChangeConfiguration((event) => {
|
|
478
|
+
if (event.hasChanged(20 )) {
|
|
479
|
+
this.onColumnSelectionModeChange(activeCodeEditor);
|
|
480
|
+
}
|
|
481
|
+
}));
|
|
482
|
+
this.activeEditorListeners.add(Event.defer(activeCodeEditor.onDidChangeCursorPosition)(() => {
|
|
483
|
+
this.onSelectionChange(activeCodeEditor);
|
|
484
|
+
this.currentProblemStatus.update(activeCodeEditor);
|
|
485
|
+
}));
|
|
486
|
+
this.activeEditorListeners.add(activeCodeEditor.onDidChangeModelLanguage(() => {
|
|
487
|
+
this.onLanguageChange(activeCodeEditor, activeInput);
|
|
488
|
+
}));
|
|
489
|
+
this.activeEditorListeners.add(Event.accumulate(activeCodeEditor.onDidChangeModelContent)(e => {
|
|
490
|
+
this.onEOLChange(activeCodeEditor);
|
|
491
|
+
this.currentProblemStatus.update(activeCodeEditor);
|
|
492
|
+
const selections = activeCodeEditor.getSelections();
|
|
493
|
+
if (selections) {
|
|
494
|
+
for (const inner of e) {
|
|
495
|
+
for (const change of inner.changes) {
|
|
496
|
+
if (( selections.some(selection => Range.areIntersecting(selection, change.range)))) {
|
|
497
|
+
this.onSelectionChange(activeCodeEditor);
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}));
|
|
504
|
+
this.activeEditorListeners.add(activeCodeEditor.onDidChangeModelOptions(() => {
|
|
505
|
+
this.onIndentationChange(activeCodeEditor);
|
|
506
|
+
}));
|
|
507
|
+
}
|
|
508
|
+
else if (activeEditorPane instanceof BaseBinaryResourceEditor || activeEditorPane instanceof BinaryResourceDiffEditor) {
|
|
509
|
+
const binaryEditors = [];
|
|
510
|
+
if (activeEditorPane instanceof BinaryResourceDiffEditor) {
|
|
511
|
+
const primary = activeEditorPane.getPrimaryEditorPane();
|
|
512
|
+
if (primary instanceof BaseBinaryResourceEditor) {
|
|
513
|
+
binaryEditors.push(primary);
|
|
514
|
+
}
|
|
515
|
+
const secondary = activeEditorPane.getSecondaryEditorPane();
|
|
516
|
+
if (secondary instanceof BaseBinaryResourceEditor) {
|
|
517
|
+
binaryEditors.push(secondary);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
binaryEditors.push(activeEditorPane);
|
|
522
|
+
}
|
|
523
|
+
for (const editor of binaryEditors) {
|
|
524
|
+
this.activeEditorListeners.add(editor.onDidChangeMetadata(() => {
|
|
525
|
+
this.onMetadataChange(activeEditorPane);
|
|
526
|
+
}));
|
|
527
|
+
this.activeEditorListeners.add(editor.onDidOpenInPlace(() => {
|
|
528
|
+
this.updateStatusBar();
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
onLanguageChange(editorWidget, editorInput) {
|
|
534
|
+
const info = { type: 'languageId', languageId: undefined };
|
|
535
|
+
if (editorWidget && editorInput && toEditorWithLanguageSupport(editorInput)) {
|
|
536
|
+
const textModel = editorWidget.getModel();
|
|
537
|
+
if (textModel) {
|
|
538
|
+
const languageId = textModel.getLanguageId();
|
|
539
|
+
info.languageId = withNullAsUndefined(this.languageService.getLanguageName(languageId));
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
this.updateState(info);
|
|
543
|
+
}
|
|
544
|
+
onIndentationChange(editorWidget) {
|
|
545
|
+
const update = { type: 'indentation', indentation: undefined };
|
|
546
|
+
if (editorWidget) {
|
|
547
|
+
const model = editorWidget.getModel();
|
|
548
|
+
if (model) {
|
|
549
|
+
const modelOpts = model.getOptions();
|
|
550
|
+
update.indentation = (modelOpts.insertSpaces
|
|
551
|
+
? modelOpts.tabSize === modelOpts.indentSize
|
|
552
|
+
? ( localize('spacesSize', "Spaces: {0}", modelOpts.indentSize))
|
|
553
|
+
: ( localize(
|
|
554
|
+
'spacesAndTabsSize',
|
|
555
|
+
"Spaces: {0} (Tab Size: {1})",
|
|
556
|
+
modelOpts.indentSize,
|
|
557
|
+
modelOpts.tabSize
|
|
558
|
+
))
|
|
559
|
+
: ( localize(
|
|
560
|
+
{ key: 'tabSize', comment: ['Tab corresponds to the tab key'] },
|
|
561
|
+
"Tab Size: {0}",
|
|
562
|
+
modelOpts.tabSize
|
|
563
|
+
)));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
this.updateState(update);
|
|
567
|
+
}
|
|
568
|
+
onMetadataChange(editor) {
|
|
569
|
+
const update = { type: 'metadata', metadata: undefined };
|
|
570
|
+
if (editor instanceof BaseBinaryResourceEditor || editor instanceof BinaryResourceDiffEditor) {
|
|
571
|
+
update.metadata = editor.getMetadata();
|
|
572
|
+
}
|
|
573
|
+
this.updateState(update);
|
|
574
|
+
}
|
|
575
|
+
onColumnSelectionModeChange(editorWidget) {
|
|
576
|
+
const info = { type: 'columnSelectionMode', columnSelectionMode: false };
|
|
577
|
+
if (editorWidget?.getOption(20 )) {
|
|
578
|
+
info.columnSelectionMode = true;
|
|
579
|
+
}
|
|
580
|
+
this.updateState(info);
|
|
581
|
+
}
|
|
582
|
+
onSelectionChange(editorWidget) {
|
|
583
|
+
const info = Object.create(null);
|
|
584
|
+
if (editorWidget) {
|
|
585
|
+
info.selections = editorWidget.getSelections() || [];
|
|
586
|
+
info.charactersSelected = 0;
|
|
587
|
+
const textModel = editorWidget.getModel();
|
|
588
|
+
if (textModel) {
|
|
589
|
+
for (const selection of info.selections) {
|
|
590
|
+
if (typeof info.charactersSelected !== 'number') {
|
|
591
|
+
info.charactersSelected = 0;
|
|
592
|
+
}
|
|
593
|
+
info.charactersSelected += textModel.getCharacterCountInRange(selection);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (info.selections.length === 1) {
|
|
597
|
+
const editorPosition = editorWidget.getPosition();
|
|
598
|
+
const selectionClone = ( new Selection(
|
|
599
|
+
info.selections[0].selectionStartLineNumber,
|
|
600
|
+
info.selections[0].selectionStartColumn,
|
|
601
|
+
info.selections[0].positionLineNumber,
|
|
602
|
+
editorPosition ? editorWidget.getStatusbarColumn(editorPosition) : info.selections[0].positionColumn
|
|
603
|
+
));
|
|
604
|
+
info.selections[0] = selectionClone;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
this.updateState({ type: 'selectionStatus', selectionStatus: this.getSelectionLabel(info) });
|
|
608
|
+
}
|
|
609
|
+
onEOLChange(editorWidget) {
|
|
610
|
+
const info = { type: 'EOL', EOL: undefined };
|
|
611
|
+
if (editorWidget && !editorWidget.getOption(87 )) {
|
|
612
|
+
const codeEditorModel = editorWidget.getModel();
|
|
613
|
+
if (codeEditorModel) {
|
|
614
|
+
info.EOL = codeEditorModel.getEOL();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
this.updateState(info);
|
|
618
|
+
}
|
|
619
|
+
onEncodingChange(editor, editorWidget) {
|
|
620
|
+
if (editor && !this.isActiveEditor(editor)) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
const info = { type: 'encoding', encoding: undefined };
|
|
624
|
+
if (editor && editorWidget?.hasModel()) {
|
|
625
|
+
const encodingSupport = editor.input ? toEditorWithEncodingSupport(editor.input) : null;
|
|
626
|
+
if (encodingSupport) {
|
|
627
|
+
const rawEncoding = encodingSupport.getEncoding();
|
|
628
|
+
const encodingInfo = typeof rawEncoding === 'string' ? SUPPORTED_ENCODINGS[rawEncoding] : undefined;
|
|
629
|
+
if (encodingInfo) {
|
|
630
|
+
info.encoding = encodingInfo.labelShort;
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
info.encoding = rawEncoding;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
this.updateState(info);
|
|
638
|
+
}
|
|
639
|
+
onResourceEncodingChange(resource) {
|
|
640
|
+
const activeEditorPane = this.editorService.activeEditorPane;
|
|
641
|
+
if (activeEditorPane) {
|
|
642
|
+
const activeResource = EditorResourceAccessor.getCanonicalUri(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
643
|
+
if (activeResource && isEqual(activeResource, resource)) {
|
|
644
|
+
const activeCodeEditor = withNullAsUndefined(getCodeEditor(activeEditorPane.getControl()));
|
|
645
|
+
return this.onEncodingChange(activeEditorPane, activeCodeEditor);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
onTabFocusModeChange() {
|
|
650
|
+
const info = { type: 'tabFocusMode', tabFocusMode: TabFocus.getTabFocusMode(this.contextKeyService.getContextKeyValue('focusedView') === 'terminal' ? "terminalFocus" : "editorFocus" ) };
|
|
651
|
+
this.updateState(info);
|
|
652
|
+
}
|
|
653
|
+
isActiveEditor(control) {
|
|
654
|
+
const activeEditorPane = this.editorService.activeEditorPane;
|
|
655
|
+
return !!activeEditorPane && activeEditorPane === control;
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
EditorStatus = ( __decorate([
|
|
659
|
+
( __param(0, IEditorService)),
|
|
660
|
+
( __param(1, IQuickInputService)),
|
|
661
|
+
( __param(2, ILanguageService)),
|
|
662
|
+
( __param(3, ITextFileService)),
|
|
663
|
+
( __param(4, IStatusbarService)),
|
|
664
|
+
( __param(5, IInstantiationService)),
|
|
665
|
+
( __param(6, IContextKeyService))
|
|
666
|
+
], EditorStatus));
|
|
667
|
+
let ShowCurrentMarkerInStatusbarContribution = class ShowCurrentMarkerInStatusbarContribution extends Disposable {
|
|
668
|
+
constructor(statusbarService, markerService, configurationService) {
|
|
669
|
+
super();
|
|
670
|
+
this.statusbarService = statusbarService;
|
|
671
|
+
this.markerService = markerService;
|
|
672
|
+
this.configurationService = configurationService;
|
|
673
|
+
this.editor = undefined;
|
|
674
|
+
this.markers = [];
|
|
675
|
+
this.currentMarker = null;
|
|
676
|
+
this.statusBarEntryAccessor = this._register(( new MutableDisposable()));
|
|
677
|
+
this._register(markerService.onMarkerChanged(changedResources => this.onMarkerChanged(changedResources)));
|
|
678
|
+
this._register(Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('problems.showCurrentInStatus'))(() => this.updateStatus()));
|
|
679
|
+
}
|
|
680
|
+
update(editor) {
|
|
681
|
+
this.editor = editor;
|
|
682
|
+
this.updateMarkers();
|
|
683
|
+
this.updateStatus();
|
|
684
|
+
}
|
|
685
|
+
updateStatus() {
|
|
686
|
+
const previousMarker = this.currentMarker;
|
|
687
|
+
this.currentMarker = this.getMarker();
|
|
688
|
+
if (this.hasToUpdateStatus(previousMarker, this.currentMarker)) {
|
|
689
|
+
if (this.currentMarker) {
|
|
690
|
+
const line = splitLines(this.currentMarker.message)[0];
|
|
691
|
+
const text = `${this.getType(this.currentMarker)} ${line}`;
|
|
692
|
+
if (!this.statusBarEntryAccessor.value) {
|
|
693
|
+
this.statusBarEntryAccessor.value = this.statusbarService.addEntry({ name: ( localize('currentProblem', "Current Problem")), text: '', ariaLabel: '' }, 'statusbar.currentProblem', 0 );
|
|
694
|
+
}
|
|
695
|
+
this.statusBarEntryAccessor.value.update({ name: ( localize('currentProblem', "Current Problem")), text, ariaLabel: text });
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
this.statusBarEntryAccessor.clear();
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
hasToUpdateStatus(previousMarker, currentMarker) {
|
|
703
|
+
if (!currentMarker) {
|
|
704
|
+
return true;
|
|
705
|
+
}
|
|
706
|
+
if (!previousMarker) {
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
709
|
+
return IMarkerData.makeKey(previousMarker) !== IMarkerData.makeKey(currentMarker);
|
|
710
|
+
}
|
|
711
|
+
getType(marker) {
|
|
712
|
+
switch (marker.severity) {
|
|
713
|
+
case MarkerSeverity.Error: return '$(error)';
|
|
714
|
+
case MarkerSeverity.Warning: return '$(warning)';
|
|
715
|
+
case MarkerSeverity.Info: return '$(info)';
|
|
716
|
+
}
|
|
717
|
+
return '';
|
|
718
|
+
}
|
|
719
|
+
getMarker() {
|
|
720
|
+
if (!this.configurationService.getValue('problems.showCurrentInStatus')) {
|
|
721
|
+
return null;
|
|
722
|
+
}
|
|
723
|
+
if (!this.editor) {
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
const model = this.editor.getModel();
|
|
727
|
+
if (!model) {
|
|
728
|
+
return null;
|
|
729
|
+
}
|
|
730
|
+
const position = this.editor.getPosition();
|
|
731
|
+
if (!position) {
|
|
732
|
+
return null;
|
|
733
|
+
}
|
|
734
|
+
return this.markers.find(marker => Range.containsPosition(marker, position)) || null;
|
|
735
|
+
}
|
|
736
|
+
onMarkerChanged(changedResources) {
|
|
737
|
+
if (!this.editor) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const model = this.editor.getModel();
|
|
741
|
+
if (!model) {
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
if (model && !( changedResources.some(r => isEqual(model.uri, r)))) {
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
this.updateMarkers();
|
|
748
|
+
}
|
|
749
|
+
updateMarkers() {
|
|
750
|
+
if (!this.editor) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
const model = this.editor.getModel();
|
|
754
|
+
if (!model) {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
if (model) {
|
|
758
|
+
this.markers = this.markerService.read({
|
|
759
|
+
resource: model.uri,
|
|
760
|
+
severities: MarkerSeverity.Error | MarkerSeverity.Warning | MarkerSeverity.Info
|
|
761
|
+
});
|
|
762
|
+
this.markers.sort(compareMarker);
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
this.markers = [];
|
|
766
|
+
}
|
|
767
|
+
this.updateStatus();
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
ShowCurrentMarkerInStatusbarContribution = ( __decorate([
|
|
771
|
+
( __param(0, IStatusbarService)),
|
|
772
|
+
( __param(1, IMarkerService)),
|
|
773
|
+
( __param(2, IConfigurationService))
|
|
774
|
+
], ShowCurrentMarkerInStatusbarContribution));
|
|
775
|
+
function compareMarker(a, b) {
|
|
776
|
+
let res = compare(( a.resource.toString()), ( b.resource.toString()));
|
|
777
|
+
if (res === 0) {
|
|
778
|
+
res = MarkerSeverity.compare(a.severity, b.severity);
|
|
779
|
+
}
|
|
780
|
+
if (res === 0) {
|
|
781
|
+
res = Range.compareRangesUsingStarts(a, b);
|
|
782
|
+
}
|
|
783
|
+
return res;
|
|
784
|
+
}
|
|
785
|
+
let ShowLanguageExtensionsAction = class ShowLanguageExtensionsAction extends Action {
|
|
786
|
+
constructor(fileExtension, commandService, galleryService) {
|
|
787
|
+
super(ShowLanguageExtensionsAction.ID, ( localize(
|
|
788
|
+
'showLanguageExtensions',
|
|
789
|
+
"Search Marketplace Extensions for '{0}'...",
|
|
790
|
+
fileExtension
|
|
791
|
+
)));
|
|
792
|
+
this.fileExtension = fileExtension;
|
|
793
|
+
this.commandService = commandService;
|
|
794
|
+
this.enabled = galleryService.isEnabled();
|
|
795
|
+
}
|
|
796
|
+
async run() {
|
|
797
|
+
await this.commandService.executeCommand('workbench.extensions.action.showExtensionsForLanguage', this.fileExtension);
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
ShowLanguageExtensionsAction.ID = 'workbench.action.showLanguageExtensions';
|
|
801
|
+
ShowLanguageExtensionsAction = ( __decorate([
|
|
802
|
+
( __param(1, ICommandService)),
|
|
803
|
+
( __param(2, IExtensionGalleryService))
|
|
804
|
+
], ShowLanguageExtensionsAction));
|
|
805
|
+
class ChangeLanguageAction extends Action2 {
|
|
806
|
+
constructor() {
|
|
807
|
+
super({
|
|
808
|
+
id: ChangeLanguageAction.ID,
|
|
809
|
+
title: { value: ( localize('changeMode', "Change Language Mode")), original: 'Change Language Mode' },
|
|
810
|
+
f1: true,
|
|
811
|
+
keybinding: {
|
|
812
|
+
weight: 200 ,
|
|
813
|
+
primary: KeyChord(2048 | 41 , 43 )
|
|
814
|
+
},
|
|
815
|
+
precondition: ContextKeyExpr.not('notebookEditorFocused')
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
async run(accessor) {
|
|
819
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
820
|
+
const editorService = accessor.get(IEditorService);
|
|
821
|
+
const languageService = accessor.get(ILanguageService);
|
|
822
|
+
const languageDetectionService = accessor.get(ILanguageDetectionService);
|
|
823
|
+
const textFileService = accessor.get(ITextFileService);
|
|
824
|
+
const preferencesService = accessor.get(IPreferencesService);
|
|
825
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
826
|
+
const configurationService = accessor.get(IConfigurationService);
|
|
827
|
+
const telemetryService = accessor.get(ITelemetryService);
|
|
828
|
+
const activeTextEditorControl = getCodeEditor(editorService.activeTextEditorControl);
|
|
829
|
+
if (!activeTextEditorControl) {
|
|
830
|
+
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
const textModel = activeTextEditorControl.getModel();
|
|
834
|
+
const resource = EditorResourceAccessor.getOriginalUri(editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
835
|
+
let currentLanguageName;
|
|
836
|
+
let currentLanguageId;
|
|
837
|
+
if (textModel) {
|
|
838
|
+
currentLanguageId = textModel.getLanguageId();
|
|
839
|
+
currentLanguageName = withNullAsUndefined(languageService.getLanguageName(currentLanguageId));
|
|
840
|
+
}
|
|
841
|
+
let hasLanguageSupport = !!resource;
|
|
842
|
+
if (resource?.scheme === Schemas.untitled && !textFileService.untitled.get(resource)?.hasAssociatedFilePath) {
|
|
843
|
+
hasLanguageSupport = false;
|
|
844
|
+
}
|
|
845
|
+
const languages = languageService.getSortedRegisteredLanguageNames();
|
|
846
|
+
const picks = ( languages
|
|
847
|
+
.map(({ languageName, languageId }) => {
|
|
848
|
+
const extensions = languageService.getExtensions(languageId).join(' ');
|
|
849
|
+
let description;
|
|
850
|
+
if (currentLanguageName === languageName) {
|
|
851
|
+
description = ( localize('languageDescription', "({0}) - Configured Language", languageId));
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
description = ( localize('languageDescriptionConfigured', "({0})", languageId));
|
|
855
|
+
}
|
|
856
|
+
return {
|
|
857
|
+
label: languageName,
|
|
858
|
+
meta: extensions,
|
|
859
|
+
iconClasses: getIconClassesForLanguageId(languageId),
|
|
860
|
+
description
|
|
861
|
+
};
|
|
862
|
+
}));
|
|
863
|
+
picks.unshift({ type: 'separator', label: ( localize('languagesPicks', "languages (identifier)")) });
|
|
864
|
+
let configureLanguageAssociations;
|
|
865
|
+
let configureLanguageSettings;
|
|
866
|
+
let galleryAction;
|
|
867
|
+
if (hasLanguageSupport && resource) {
|
|
868
|
+
const ext = extname(resource) || basename(resource);
|
|
869
|
+
galleryAction = instantiationService.createInstance(ShowLanguageExtensionsAction, ext);
|
|
870
|
+
if (galleryAction.enabled) {
|
|
871
|
+
picks.unshift(galleryAction);
|
|
872
|
+
}
|
|
873
|
+
configureLanguageSettings = { label: ( localize(
|
|
874
|
+
'configureModeSettings',
|
|
875
|
+
"Configure '{0}' language based settings...",
|
|
876
|
+
currentLanguageName
|
|
877
|
+
)) };
|
|
878
|
+
picks.unshift(configureLanguageSettings);
|
|
879
|
+
configureLanguageAssociations = { label: ( localize('configureAssociationsExt', "Configure File Association for '{0}'...", ext)) };
|
|
880
|
+
picks.unshift(configureLanguageAssociations);
|
|
881
|
+
}
|
|
882
|
+
const autoDetectLanguage = {
|
|
883
|
+
label: ( localize('autoDetect', "Auto Detect"))
|
|
884
|
+
};
|
|
885
|
+
picks.unshift(autoDetectLanguage);
|
|
886
|
+
const pick = await quickInputService.pick(picks, { placeHolder: ( localize('pickLanguage', "Select Language Mode")), matchOnDescription: true });
|
|
887
|
+
if (!pick) {
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
if (pick === galleryAction) {
|
|
891
|
+
galleryAction.run();
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
if (pick === configureLanguageAssociations) {
|
|
895
|
+
if (resource) {
|
|
896
|
+
this.configureFileAssociation(resource, languageService, quickInputService, configurationService);
|
|
897
|
+
}
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
if (pick === configureLanguageSettings) {
|
|
901
|
+
preferencesService.openUserSettings({ jsonEditor: true, revealSetting: { key: `[${withUndefinedAsNull(currentLanguageId)}]`, edit: true } });
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
const activeEditor = editorService.activeEditor;
|
|
905
|
+
if (activeEditor) {
|
|
906
|
+
const languageSupport = toEditorWithLanguageSupport(activeEditor);
|
|
907
|
+
if (languageSupport) {
|
|
908
|
+
let languageSelection;
|
|
909
|
+
let detectedLanguage;
|
|
910
|
+
if (pick === autoDetectLanguage) {
|
|
911
|
+
if (textModel) {
|
|
912
|
+
const resource = EditorResourceAccessor.getOriginalUri(activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
913
|
+
if (resource) {
|
|
914
|
+
let languageId = withNullAsUndefined(languageService.guessLanguageIdByFilepathOrFirstLine(resource, textModel.getLineContent(1)));
|
|
915
|
+
if (!languageId || languageId === 'unknown') {
|
|
916
|
+
detectedLanguage = await languageDetectionService.detectLanguage(resource);
|
|
917
|
+
languageId = detectedLanguage;
|
|
918
|
+
}
|
|
919
|
+
if (languageId) {
|
|
920
|
+
languageSelection = languageService.createById(languageId);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
else {
|
|
926
|
+
const languageId = languageService.getLanguageIdByLanguageName(pick.label);
|
|
927
|
+
languageSelection = languageService.createById(languageId);
|
|
928
|
+
if (resource) {
|
|
929
|
+
languageDetectionService.detectLanguage(resource).then(detectedLanguageId => {
|
|
930
|
+
const chosenLanguageId = languageService.getLanguageIdByLanguageName(pick.label) || 'unknown';
|
|
931
|
+
if (detectedLanguageId === currentLanguageId && currentLanguageId !== chosenLanguageId) {
|
|
932
|
+
const modelPreference = configurationService.getValue('workbench.editor.preferHistoryBasedLanguageDetection') ? 'history' : 'classic';
|
|
933
|
+
telemetryService.publicLog2(AutomaticLanguageDetectionLikelyWrongId, {
|
|
934
|
+
currentLanguageId: currentLanguageName ?? 'unknown',
|
|
935
|
+
nextLanguageId: pick.label,
|
|
936
|
+
lineCount: textModel?.getLineCount() ?? -1,
|
|
937
|
+
modelPreference,
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (typeof languageSelection !== 'undefined') {
|
|
944
|
+
languageSupport.setLanguageId(languageSelection.languageId, ChangeLanguageAction.ID);
|
|
945
|
+
if (resource?.scheme === Schemas.untitled) {
|
|
946
|
+
const modelPreference = configurationService.getValue('workbench.editor.preferHistoryBasedLanguageDetection') ? 'history' : 'classic';
|
|
947
|
+
telemetryService.publicLog2('setUntitledDocumentLanguage', {
|
|
948
|
+
to: languageSelection.languageId,
|
|
949
|
+
from: currentLanguageId ?? 'none',
|
|
950
|
+
modelPreference,
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
activeTextEditorControl.focus();
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
configureFileAssociation(resource, languageService, quickInputService, configurationService) {
|
|
959
|
+
const extension = extname(resource);
|
|
960
|
+
const base = basename(resource);
|
|
961
|
+
const currentAssociation = languageService.guessLanguageIdByFilepathOrFirstLine(URI.file(base));
|
|
962
|
+
const languages = languageService.getSortedRegisteredLanguageNames();
|
|
963
|
+
const picks = ( languages.map(({ languageName, languageId }) => {
|
|
964
|
+
return {
|
|
965
|
+
id: languageId,
|
|
966
|
+
label: languageName,
|
|
967
|
+
iconClasses: getIconClassesForLanguageId(languageId),
|
|
968
|
+
description: (languageId === currentAssociation) ? ( localize('currentAssociation', "Current Association")) : undefined
|
|
969
|
+
};
|
|
970
|
+
}));
|
|
971
|
+
setTimeout(async () => {
|
|
972
|
+
const language = await quickInputService.pick(picks, { placeHolder: ( localize(
|
|
973
|
+
'pickLanguageToConfigure',
|
|
974
|
+
"Select Language Mode to Associate with '{0}'",
|
|
975
|
+
extension || base
|
|
976
|
+
)) });
|
|
977
|
+
if (language) {
|
|
978
|
+
const fileAssociationsConfig = configurationService.inspect(FILES_ASSOCIATIONS_CONFIG);
|
|
979
|
+
let associationKey;
|
|
980
|
+
if (extension && base[0] !== '.') {
|
|
981
|
+
associationKey = `*${extension}`;
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
associationKey = base;
|
|
985
|
+
}
|
|
986
|
+
let target = 2 ;
|
|
987
|
+
if (fileAssociationsConfig.workspaceValue && !!fileAssociationsConfig.workspaceValue[associationKey]) {
|
|
988
|
+
target = 5 ;
|
|
989
|
+
}
|
|
990
|
+
const currentAssociations = deepClone(((target === 5) ) ? fileAssociationsConfig.workspaceValue : fileAssociationsConfig.userValue) || Object.create(null);
|
|
991
|
+
currentAssociations[associationKey] = language.id;
|
|
992
|
+
configurationService.updateValue(FILES_ASSOCIATIONS_CONFIG, currentAssociations, target);
|
|
993
|
+
}
|
|
994
|
+
}, 50 );
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
ChangeLanguageAction.ID = 'workbench.action.editor.changeLanguageMode';
|
|
998
|
+
class ChangeEOLAction extends Action2 {
|
|
999
|
+
constructor() {
|
|
1000
|
+
super({
|
|
1001
|
+
id: 'workbench.action.editor.changeEOL',
|
|
1002
|
+
title: { value: ( localize('changeEndOfLine', "Change End of Line Sequence")), original: 'Change End of Line Sequence' },
|
|
1003
|
+
f1: true
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
async run(accessor) {
|
|
1007
|
+
const editorService = accessor.get(IEditorService);
|
|
1008
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
1009
|
+
const activeTextEditorControl = getCodeEditor(editorService.activeTextEditorControl);
|
|
1010
|
+
if (!activeTextEditorControl) {
|
|
1011
|
+
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
if (editorService.activeEditor?.hasCapability(2 )) {
|
|
1015
|
+
await quickInputService.pick([{ label: ( localize('noWritableCodeEditor', "The active code editor is read-only.")) }]);
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
let textModel = activeTextEditorControl.getModel();
|
|
1019
|
+
const EOLOptions = [
|
|
1020
|
+
{ label: nlsEOLLF, eol: 0 },
|
|
1021
|
+
{ label: nlsEOLCRLF, eol: 1 },
|
|
1022
|
+
];
|
|
1023
|
+
const selectedIndex = (textModel?.getEOL() === '\n') ? 0 : 1;
|
|
1024
|
+
const eol = await quickInputService.pick(EOLOptions, { placeHolder: ( localize('pickEndOfLine', "Select End of Line Sequence")), activeItem: EOLOptions[selectedIndex] });
|
|
1025
|
+
if (eol) {
|
|
1026
|
+
const activeCodeEditor = getCodeEditor(editorService.activeTextEditorControl);
|
|
1027
|
+
if (activeCodeEditor?.hasModel() && !editorService.activeEditor?.hasCapability(2 )) {
|
|
1028
|
+
textModel = activeCodeEditor.getModel();
|
|
1029
|
+
textModel.pushStackElement();
|
|
1030
|
+
textModel.pushEOL(eol.eol);
|
|
1031
|
+
textModel.pushStackElement();
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
activeTextEditorControl.focus();
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
class ChangeEncodingAction extends Action2 {
|
|
1038
|
+
constructor() {
|
|
1039
|
+
super({
|
|
1040
|
+
id: 'workbench.action.editor.changeEncoding',
|
|
1041
|
+
title: { value: ( localize('changeEncoding', "Change File Encoding")), original: 'Change File Encoding' },
|
|
1042
|
+
f1: true
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
async run(accessor) {
|
|
1046
|
+
const editorService = accessor.get(IEditorService);
|
|
1047
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
1048
|
+
const fileService = accessor.get(IFileService);
|
|
1049
|
+
const textFileService = accessor.get(ITextFileService);
|
|
1050
|
+
const textResourceConfigurationService = accessor.get(ITextResourceConfigurationService);
|
|
1051
|
+
const activeTextEditorControl = getCodeEditor(editorService.activeTextEditorControl);
|
|
1052
|
+
if (!activeTextEditorControl) {
|
|
1053
|
+
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
const activeEditorPane = editorService.activeEditorPane;
|
|
1057
|
+
if (!activeEditorPane) {
|
|
1058
|
+
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
const encodingSupport = toEditorWithEncodingSupport(activeEditorPane.input);
|
|
1062
|
+
if (!encodingSupport) {
|
|
1063
|
+
await quickInputService.pick([{ label: ( localize('noFileEditor', "No file active at this time")) }]);
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
const saveWithEncodingPick = { label: ( localize('saveWithEncoding', "Save with Encoding")) };
|
|
1067
|
+
const reopenWithEncodingPick = { label: ( localize('reopenWithEncoding', "Reopen with Encoding")) };
|
|
1068
|
+
if (!Language.isDefaultVariant()) {
|
|
1069
|
+
const saveWithEncodingAlias = 'Save with Encoding';
|
|
1070
|
+
if (saveWithEncodingAlias !== saveWithEncodingPick.label) {
|
|
1071
|
+
saveWithEncodingPick.detail = saveWithEncodingAlias;
|
|
1072
|
+
}
|
|
1073
|
+
const reopenWithEncodingAlias = 'Reopen with Encoding';
|
|
1074
|
+
if (reopenWithEncodingAlias !== reopenWithEncodingPick.label) {
|
|
1075
|
+
reopenWithEncodingPick.detail = reopenWithEncodingAlias;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
let action;
|
|
1079
|
+
if (encodingSupport instanceof UntitledTextEditorInput) {
|
|
1080
|
+
action = saveWithEncodingPick;
|
|
1081
|
+
}
|
|
1082
|
+
else if (activeEditorPane.input.hasCapability(2 )) {
|
|
1083
|
+
action = reopenWithEncodingPick;
|
|
1084
|
+
}
|
|
1085
|
+
else {
|
|
1086
|
+
action = await quickInputService.pick([reopenWithEncodingPick, saveWithEncodingPick], { placeHolder: ( localize('pickAction', "Select Action")), matchOnDetail: true });
|
|
1087
|
+
}
|
|
1088
|
+
if (!action) {
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
await timeout(50);
|
|
1092
|
+
const resource = EditorResourceAccessor.getOriginalUri(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
1093
|
+
if (!resource || (!fileService.hasProvider(resource) && resource.scheme !== Schemas.untitled)) {
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
let guessedEncoding = undefined;
|
|
1097
|
+
if (fileService.hasProvider(resource)) {
|
|
1098
|
+
const content = await textFileService.readStream(resource, { autoGuessEncoding: true });
|
|
1099
|
+
guessedEncoding = content.encoding;
|
|
1100
|
+
}
|
|
1101
|
+
const isReopenWithEncoding = (action === reopenWithEncodingPick);
|
|
1102
|
+
const configuredEncoding = textResourceConfigurationService.getValue(withNullAsUndefined(resource), 'files.encoding');
|
|
1103
|
+
let directMatchIndex;
|
|
1104
|
+
let aliasMatchIndex;
|
|
1105
|
+
const picks = ( ( Object.keys(SUPPORTED_ENCODINGS))
|
|
1106
|
+
.sort((k1, k2) => {
|
|
1107
|
+
if (k1 === configuredEncoding) {
|
|
1108
|
+
return -1;
|
|
1109
|
+
}
|
|
1110
|
+
else if (k2 === configuredEncoding) {
|
|
1111
|
+
return 1;
|
|
1112
|
+
}
|
|
1113
|
+
return SUPPORTED_ENCODINGS[k1].order - SUPPORTED_ENCODINGS[k2].order;
|
|
1114
|
+
})
|
|
1115
|
+
.filter(k => {
|
|
1116
|
+
if (k === guessedEncoding && guessedEncoding !== configuredEncoding) {
|
|
1117
|
+
return false;
|
|
1118
|
+
}
|
|
1119
|
+
return !isReopenWithEncoding || !SUPPORTED_ENCODINGS[k].encodeOnly;
|
|
1120
|
+
})
|
|
1121
|
+
.map((key, index) => {
|
|
1122
|
+
if (key === encodingSupport.getEncoding()) {
|
|
1123
|
+
directMatchIndex = index;
|
|
1124
|
+
}
|
|
1125
|
+
else if (SUPPORTED_ENCODINGS[key].alias === encodingSupport.getEncoding()) {
|
|
1126
|
+
aliasMatchIndex = index;
|
|
1127
|
+
}
|
|
1128
|
+
return { id: key, label: SUPPORTED_ENCODINGS[key].labelLong, description: key };
|
|
1129
|
+
}));
|
|
1130
|
+
const items = picks.slice();
|
|
1131
|
+
if (guessedEncoding && configuredEncoding !== guessedEncoding && SUPPORTED_ENCODINGS[guessedEncoding]) {
|
|
1132
|
+
picks.unshift({ type: 'separator' });
|
|
1133
|
+
picks.unshift({ id: guessedEncoding, label: SUPPORTED_ENCODINGS[guessedEncoding].labelLong, description: ( localize('guessedEncoding', "Guessed from content")) });
|
|
1134
|
+
}
|
|
1135
|
+
const encoding = await quickInputService.pick(picks, {
|
|
1136
|
+
placeHolder: isReopenWithEncoding ? ( localize('pickEncodingForReopen', "Select File Encoding to Reopen File")) : ( localize('pickEncodingForSave', "Select File Encoding to Save with")),
|
|
1137
|
+
activeItem: items[typeof directMatchIndex === 'number' ? directMatchIndex : typeof aliasMatchIndex === 'number' ? aliasMatchIndex : -1]
|
|
1138
|
+
});
|
|
1139
|
+
if (!encoding) {
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
if (!editorService.activeEditorPane) {
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
const activeEncodingSupport = toEditorWithEncodingSupport(editorService.activeEditorPane.input);
|
|
1146
|
+
if (typeof encoding.id !== 'undefined' && activeEncodingSupport) {
|
|
1147
|
+
await activeEncodingSupport.setEncoding(encoding.id, isReopenWithEncoding ? 1 : 0 );
|
|
1148
|
+
}
|
|
1149
|
+
activeTextEditorControl.focus();
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
export { ChangeEOLAction, ChangeEncodingAction, ChangeLanguageAction, EditorStatus, ShowLanguageExtensionsAction };
|