@codingame/monaco-vscode-api 1.85.0 → 1.85.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 +19 -10
- package/contributions.js +1 -0
- package/missing-services.js +91 -5
- package/monaco-editor-treemending.patch +957 -950
- package/package.json +6 -6
- package/vscode/src/vs/base/common/jsonFormatter.js +8 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +128 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +58 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +56 -1
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +186 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +191 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +238 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +75 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +205 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +168 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +340 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1195 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +81 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +583 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +290 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +167 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +562 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +31 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProvider.js +24 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +22 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +52 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +258 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +25 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +388 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +61 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +49 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +647 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +300 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +60 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +333 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +99 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +55 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +2 -0
- package/vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js +20 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +855 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +410 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1485 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +125 -0
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +41 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +102 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +988 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.js +431 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +417 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +806 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +915 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +19 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +129 -10
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +205 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +150 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +480 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +90 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +258 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +614 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +44 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +169 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +64 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.js +49 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +120 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +416 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +663 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +593 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +326 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +539 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +265 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +348 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.js +95 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +437 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2730 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +139 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +564 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +119 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +178 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +35 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +377 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +97 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +194 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +71 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +652 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +303 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +228 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatActions.js +302 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.js +438 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +107 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +430 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +54 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +1131 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +341 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +2155 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +507 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +47 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +31 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +257 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +239 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.js +211 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +808 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +381 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +527 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +163 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +651 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +62 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +101 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +346 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +152 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookContextKeys.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +296 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +261 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.js +3 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKernelService.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKeymapService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookLoggingService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +16 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookRange.js +66 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWorkerService.js +4 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +130 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +847 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +89 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +1942 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/urlFinder.js +107 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +49 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +387 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/common/constants.js +66 -0
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js +24 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets.js +95 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -1
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/featuredExtensionService.js +159 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint.js +375 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +563 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.js +932 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +15 -1
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +2 -2
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +190 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +77 -0
- package/assets/break.mp3 +0 -0
- package/assets/chatRequestSent.mp3 +0 -0
- package/assets/chatResponsePending.mp3 +0 -0
- package/assets/chatResponseReceived1.mp3 +0 -0
- package/assets/chatResponseReceived2.mp3 +0 -0
- package/assets/chatResponseReceived3.mp3 +0 -0
- package/assets/chatResponseReceived4.mp3 +0 -0
- package/assets/clear.mp3 +0 -0
- package/assets/defaultIcon.png +0 -0
- package/assets/diffLineDeleted.mp3 +0 -0
- package/assets/diffLineInserted.mp3 +0 -0
- package/assets/diffLineModified.mp3 +0 -0
- package/assets/error.mp3 +0 -0
- package/assets/fake.html +0 -10
- package/assets/foldedAreas.mp3 +0 -0
- package/assets/format.mp3 +0 -0
- package/assets/index-no-csp.html +0 -1226
- package/assets/index.html +0 -1227
- package/assets/quickFixes.mp3 +0 -0
- package/assets/save.mp3 +0 -0
- package/assets/service-worker.js +0 -457
- package/assets/taskCompleted.mp3 +0 -0
- package/assets/taskFailed.mp3 +0 -0
- package/assets/terminalBell.mp3 +0 -0
- package/assets/warning.mp3 +0 -0
- package/assets/webWorkerExtensionHostIframe.html +0 -123
- package/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +0 -2
- package/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -5
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { ProgressBar } from 'monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js';
|
|
3
|
+
import { defaultProgressBarStyles } from 'monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js';
|
|
4
|
+
import { CellContentPart } from '../cellPart.js';
|
|
5
|
+
import { NotebookCellExecutionState } from '../../../common/notebookCommon.js';
|
|
6
|
+
import { INotebookExecutionStateService } from '../../../common/notebookExecutionStateService.js';
|
|
7
|
+
let CellProgressBar = class CellProgressBar extends CellContentPart {
|
|
8
|
+
constructor(editorContainer, collapsedInputContainer, _notebookExecutionStateService) {
|
|
9
|
+
super();
|
|
10
|
+
this._notebookExecutionStateService = _notebookExecutionStateService;
|
|
11
|
+
this._progressBar = this._register(( new ProgressBar(editorContainer, defaultProgressBarStyles)));
|
|
12
|
+
this._progressBar.hide();
|
|
13
|
+
this._collapsedProgressBar = this._register(( new ProgressBar(collapsedInputContainer, defaultProgressBarStyles)));
|
|
14
|
+
this._collapsedProgressBar.hide();
|
|
15
|
+
}
|
|
16
|
+
didRenderCell(element) {
|
|
17
|
+
this._updateForExecutionState(element);
|
|
18
|
+
}
|
|
19
|
+
updateForExecutionState(element, e) {
|
|
20
|
+
this._updateForExecutionState(element, e);
|
|
21
|
+
}
|
|
22
|
+
updateState(element, e) {
|
|
23
|
+
if (e.metadataChanged || e.internalMetadataChanged) {
|
|
24
|
+
this._updateForExecutionState(element);
|
|
25
|
+
}
|
|
26
|
+
if (e.inputCollapsedChanged) {
|
|
27
|
+
const exeState = this._notebookExecutionStateService.getCellExecution(element.uri);
|
|
28
|
+
if (element.isInputCollapsed) {
|
|
29
|
+
this._progressBar.hide();
|
|
30
|
+
if (exeState?.state === NotebookCellExecutionState.Executing) {
|
|
31
|
+
this._updateForExecutionState(element);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this._collapsedProgressBar.hide();
|
|
36
|
+
if (exeState?.state === NotebookCellExecutionState.Executing) {
|
|
37
|
+
this._updateForExecutionState(element);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_updateForExecutionState(element, e) {
|
|
43
|
+
const exeState = e?.changed ?? this._notebookExecutionStateService.getCellExecution(element.uri);
|
|
44
|
+
const progressBar = element.isInputCollapsed ? this._collapsedProgressBar : this._progressBar;
|
|
45
|
+
if (exeState?.state === NotebookCellExecutionState.Executing && (!exeState.didPause || element.isInputCollapsed)) {
|
|
46
|
+
showProgressBar(progressBar);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
progressBar.hide();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
CellProgressBar = ( __decorate([
|
|
54
|
+
( __param(2, INotebookExecutionStateService))
|
|
55
|
+
], CellProgressBar));
|
|
56
|
+
function showProgressBar(progressBar) {
|
|
57
|
+
progressBar.infinite().show(500);
|
|
58
|
+
}
|
|
59
|
+
export { CellProgressBar };
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
+
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
4
|
+
import { SimpleIconLabel } from '../../../../../../base/browser/ui/iconLabel/simpleIconLabel.js';
|
|
5
|
+
import { toErrorMessage } from 'monaco-editor/esm/vs/base/common/errorMessage.js';
|
|
6
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
7
|
+
import { stripIcons } from 'monaco-editor/esm/vs/base/common/iconLabels.js';
|
|
8
|
+
import { DisposableStore, dispose, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
9
|
+
import { isThemeColor } from 'monaco-editor/esm/vs/editor/common/editorCommon.js';
|
|
10
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
11
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
12
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
13
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
14
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
15
|
+
import { CellFocusMode } from '../../notebookBrowser.js';
|
|
16
|
+
import { CellContentPart } from '../cellPart.js';
|
|
17
|
+
import { CodeCellViewModel } from '../../viewModel/codeCellViewModel.js';
|
|
18
|
+
import { setupCustomHover } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabelHover.js';
|
|
19
|
+
import { IHoverService } from '../../../../../services/hover/browser/hover.js';
|
|
20
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
21
|
+
const $ = dom.$;
|
|
22
|
+
let CellEditorStatusBar = class CellEditorStatusBar extends CellContentPart {
|
|
23
|
+
constructor(_notebookEditor, _cellContainer, editorPart, _editor, _instantiationService, hoverService, configurationService, _themeService) {
|
|
24
|
+
super();
|
|
25
|
+
this._notebookEditor = _notebookEditor;
|
|
26
|
+
this._cellContainer = _cellContainer;
|
|
27
|
+
this._editor = _editor;
|
|
28
|
+
this._instantiationService = _instantiationService;
|
|
29
|
+
this._themeService = _themeService;
|
|
30
|
+
this.leftItems = [];
|
|
31
|
+
this.rightItems = [];
|
|
32
|
+
this.width = 0;
|
|
33
|
+
this._onDidClick = this._register(( new Emitter()));
|
|
34
|
+
this.onDidClick = this._onDidClick.event;
|
|
35
|
+
this.statusBarContainer = dom.append(editorPart, $('.cell-statusbar-container'));
|
|
36
|
+
this.statusBarContainer.tabIndex = -1;
|
|
37
|
+
const leftItemsContainer = dom.append(this.statusBarContainer, $('.cell-status-left'));
|
|
38
|
+
const rightItemsContainer = dom.append(this.statusBarContainer, $('.cell-status-right'));
|
|
39
|
+
this.leftItemsContainer = dom.append(leftItemsContainer, $('.cell-contributed-items.cell-contributed-items-left'));
|
|
40
|
+
this.rightItemsContainer = dom.append(rightItemsContainer, $('.cell-contributed-items.cell-contributed-items-right'));
|
|
41
|
+
this.itemsDisposable = this._register(( new DisposableStore()));
|
|
42
|
+
this.hoverDelegate = new (class {
|
|
43
|
+
constructor() {
|
|
44
|
+
this._lastHoverHideTime = 0;
|
|
45
|
+
this.showHover = (options) => {
|
|
46
|
+
options.position = options.position ?? {};
|
|
47
|
+
options.position.hoverPosition = 3 ;
|
|
48
|
+
return hoverService.showHover(options);
|
|
49
|
+
};
|
|
50
|
+
this.placement = 'element';
|
|
51
|
+
}
|
|
52
|
+
get delay() {
|
|
53
|
+
return Date.now() - this._lastHoverHideTime < 200
|
|
54
|
+
? 0
|
|
55
|
+
: configurationService.getValue('workbench.hover.delay');
|
|
56
|
+
}
|
|
57
|
+
onDidHideHover() {
|
|
58
|
+
this._lastHoverHideTime = Date.now();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
this._register(this._themeService.onDidColorThemeChange(() => this.currentContext && this.updateContext(this.currentContext)));
|
|
62
|
+
this._register(dom.addDisposableListener(this.statusBarContainer, dom.EventType.CLICK, e => {
|
|
63
|
+
if (e.target === leftItemsContainer || e.target === rightItemsContainer || e.target === this.statusBarContainer) {
|
|
64
|
+
this._onDidClick.fire({
|
|
65
|
+
type: 0 ,
|
|
66
|
+
event: e
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (e.target.classList.contains('cell-status-item-has-command')) {
|
|
71
|
+
this._onDidClick.fire({
|
|
72
|
+
type: 2 ,
|
|
73
|
+
event: e
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this._onDidClick.fire({
|
|
78
|
+
type: 1 ,
|
|
79
|
+
event: e
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
didRenderCell(element) {
|
|
86
|
+
this.updateContext({
|
|
87
|
+
ui: true,
|
|
88
|
+
cell: element,
|
|
89
|
+
notebookEditor: this._notebookEditor,
|
|
90
|
+
$mid: 13
|
|
91
|
+
});
|
|
92
|
+
if (this._editor) {
|
|
93
|
+
const updateFocusModeForEditorEvent = () => {
|
|
94
|
+
if (this._editor && (this._editor.hasWidgetFocus() || (this.statusBarContainer.ownerDocument.activeElement && this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement)))) {
|
|
95
|
+
element.focusMode = CellFocusMode.Editor;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const currentMode = element.focusMode;
|
|
99
|
+
if (currentMode === CellFocusMode.ChatInput) {
|
|
100
|
+
element.focusMode = CellFocusMode.ChatInput;
|
|
101
|
+
}
|
|
102
|
+
else if (currentMode === CellFocusMode.Output && this._notebookEditor.hasWebviewFocus()) {
|
|
103
|
+
element.focusMode = CellFocusMode.Output;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
element.focusMode = CellFocusMode.Container;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
this.cellDisposables.add(this._editor.onDidFocusEditorWidget(() => {
|
|
111
|
+
updateFocusModeForEditorEvent();
|
|
112
|
+
}));
|
|
113
|
+
this.cellDisposables.add(this._editor.onDidBlurEditorWidget(() => {
|
|
114
|
+
if (this._notebookEditor.hasEditorFocus() &&
|
|
115
|
+
!(this.statusBarContainer.ownerDocument.activeElement && this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement))) {
|
|
116
|
+
updateFocusModeForEditorEvent();
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
this.cellDisposables.add(this.onDidClick(e => {
|
|
120
|
+
if (this.currentCell instanceof CodeCellViewModel && e.type !== 2 && this._editor) {
|
|
121
|
+
const target = this._editor.getTargetAtClientPoint(e.event.clientX, e.event.clientY - this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(this.currentCell.internalMetadata, this.currentCell.uri));
|
|
122
|
+
if (target?.position) {
|
|
123
|
+
this._editor.setPosition(target.position);
|
|
124
|
+
this._editor.focus();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
updateInternalLayoutNow(element) {
|
|
131
|
+
this._cellContainer.classList.toggle('cell-statusbar-hidden', this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(element.internalMetadata, element.uri) === 0);
|
|
132
|
+
const layoutInfo = element.layoutInfo;
|
|
133
|
+
const width = layoutInfo.editorWidth;
|
|
134
|
+
if (!width) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.width = width;
|
|
138
|
+
this.statusBarContainer.style.width = `${width}px`;
|
|
139
|
+
const maxItemWidth = this.getMaxItemWidth();
|
|
140
|
+
this.leftItems.forEach(item => item.maxWidth = maxItemWidth);
|
|
141
|
+
this.rightItems.forEach(item => item.maxWidth = maxItemWidth);
|
|
142
|
+
}
|
|
143
|
+
getMaxItemWidth() {
|
|
144
|
+
return this.width / 2;
|
|
145
|
+
}
|
|
146
|
+
updateContext(context) {
|
|
147
|
+
this.currentContext = context;
|
|
148
|
+
this.itemsDisposable.clear();
|
|
149
|
+
if (!this.currentContext) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this.itemsDisposable.add(this.currentContext.cell.onDidChangeLayout(() => {
|
|
153
|
+
if (this.currentContext) {
|
|
154
|
+
this.updateInternalLayoutNow(this.currentContext.cell);
|
|
155
|
+
}
|
|
156
|
+
}));
|
|
157
|
+
this.itemsDisposable.add(this.currentContext.cell.onDidChangeCellStatusBarItems(() => this.updateRenderedItems()));
|
|
158
|
+
this.itemsDisposable.add(this.currentContext.notebookEditor.onDidChangeActiveCell(() => this.updateActiveCell()));
|
|
159
|
+
this.updateInternalLayoutNow(this.currentContext.cell);
|
|
160
|
+
this.updateActiveCell();
|
|
161
|
+
this.updateRenderedItems();
|
|
162
|
+
}
|
|
163
|
+
updateActiveCell() {
|
|
164
|
+
const isActiveCell = this.currentContext.notebookEditor.getActiveCell() === this.currentContext?.cell;
|
|
165
|
+
this.statusBarContainer.classList.toggle('is-active-cell', isActiveCell);
|
|
166
|
+
}
|
|
167
|
+
updateRenderedItems() {
|
|
168
|
+
const items = this.currentContext.cell.getCellStatusBarItems();
|
|
169
|
+
items.sort((itemA, itemB) => {
|
|
170
|
+
return (itemB.priority ?? 0) - (itemA.priority ?? 0);
|
|
171
|
+
});
|
|
172
|
+
const maxItemWidth = this.getMaxItemWidth();
|
|
173
|
+
const newLeftItems = items.filter(item => item.alignment === 1 );
|
|
174
|
+
const newRightItems = items.filter(item => item.alignment === 2 ).reverse();
|
|
175
|
+
const updateItems = (renderedItems, newItems, container) => {
|
|
176
|
+
if (renderedItems.length > newItems.length) {
|
|
177
|
+
const deleted = renderedItems.splice(newItems.length, renderedItems.length - newItems.length);
|
|
178
|
+
for (const deletedItem of deleted) {
|
|
179
|
+
container.removeChild(deletedItem.container);
|
|
180
|
+
deletedItem.dispose();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
newItems.forEach((newLeftItem, i) => {
|
|
184
|
+
const existingItem = renderedItems[i];
|
|
185
|
+
if (existingItem) {
|
|
186
|
+
existingItem.updateItem(newLeftItem, maxItemWidth);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
const item = this._instantiationService.createInstance(CellStatusBarItem, this.currentContext, this.hoverDelegate, this._editor, newLeftItem, maxItemWidth);
|
|
190
|
+
renderedItems.push(item);
|
|
191
|
+
container.appendChild(item.container);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
updateItems(this.leftItems, newLeftItems, this.leftItemsContainer);
|
|
196
|
+
updateItems(this.rightItems, newRightItems, this.rightItemsContainer);
|
|
197
|
+
}
|
|
198
|
+
dispose() {
|
|
199
|
+
super.dispose();
|
|
200
|
+
dispose(this.leftItems);
|
|
201
|
+
dispose(this.rightItems);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
CellEditorStatusBar = ( __decorate([
|
|
205
|
+
( __param(4, IInstantiationService)),
|
|
206
|
+
( __param(5, IHoverService)),
|
|
207
|
+
( __param(6, IConfigurationService)),
|
|
208
|
+
( __param(7, IThemeService))
|
|
209
|
+
], CellEditorStatusBar));
|
|
210
|
+
let CellStatusBarItem = class CellStatusBarItem extends Disposable {
|
|
211
|
+
set maxWidth(v) {
|
|
212
|
+
this.container.style.maxWidth = v + 'px';
|
|
213
|
+
}
|
|
214
|
+
constructor(_context, _hoverDelegate, _editor, itemModel, maxWidth, _telemetryService, _commandService, _notificationService, _themeService) {
|
|
215
|
+
super();
|
|
216
|
+
this._context = _context;
|
|
217
|
+
this._hoverDelegate = _hoverDelegate;
|
|
218
|
+
this._editor = _editor;
|
|
219
|
+
this._telemetryService = _telemetryService;
|
|
220
|
+
this._commandService = _commandService;
|
|
221
|
+
this._notificationService = _notificationService;
|
|
222
|
+
this._themeService = _themeService;
|
|
223
|
+
this.container = $('.cell-status-item');
|
|
224
|
+
this._itemDisposables = this._register(( new DisposableStore()));
|
|
225
|
+
this.updateItem(itemModel, maxWidth);
|
|
226
|
+
}
|
|
227
|
+
updateItem(item, maxWidth) {
|
|
228
|
+
this._itemDisposables.clear();
|
|
229
|
+
if (!this._currentItem || this._currentItem.text !== item.text) {
|
|
230
|
+
( new SimpleIconLabel(this.container)).text = item.text.replace(/\n/g, ' ');
|
|
231
|
+
}
|
|
232
|
+
const resolveColor = (color) => {
|
|
233
|
+
return isThemeColor(color) ?
|
|
234
|
+
(this._themeService.getColorTheme().getColor(color.id)?.toString() || '') :
|
|
235
|
+
color;
|
|
236
|
+
};
|
|
237
|
+
this.container.style.color = item.color ? resolveColor(item.color) : '';
|
|
238
|
+
this.container.style.backgroundColor = item.backgroundColor ? resolveColor(item.backgroundColor) : '';
|
|
239
|
+
this.container.style.opacity = item.opacity ? item.opacity : '';
|
|
240
|
+
this.container.classList.toggle('cell-status-item-show-when-active', !!item.onlyShowWhenActive);
|
|
241
|
+
if (typeof maxWidth === 'number') {
|
|
242
|
+
this.maxWidth = maxWidth;
|
|
243
|
+
}
|
|
244
|
+
let ariaLabel;
|
|
245
|
+
let role;
|
|
246
|
+
if (item.accessibilityInformation) {
|
|
247
|
+
ariaLabel = item.accessibilityInformation.label;
|
|
248
|
+
role = item.accessibilityInformation.role;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
ariaLabel = item.text ? stripIcons(item.text).trim() : '';
|
|
252
|
+
}
|
|
253
|
+
this.container.setAttribute('aria-label', ariaLabel);
|
|
254
|
+
this.container.setAttribute('role', role || '');
|
|
255
|
+
if (item.tooltip) {
|
|
256
|
+
const hoverContent = typeof item.tooltip === 'string' ? item.tooltip : { markdown: item.tooltip };
|
|
257
|
+
this._itemDisposables.add(setupCustomHover(this._hoverDelegate, this.container, hoverContent));
|
|
258
|
+
}
|
|
259
|
+
this.container.classList.toggle('cell-status-item-has-command', !!item.command);
|
|
260
|
+
if (item.command) {
|
|
261
|
+
this.container.tabIndex = 0;
|
|
262
|
+
this._itemDisposables.add(dom.addDisposableListener(this.container, dom.EventType.CLICK, _e => {
|
|
263
|
+
this.executeCommand();
|
|
264
|
+
}));
|
|
265
|
+
this._itemDisposables.add(dom.addDisposableListener(this.container, dom.EventType.KEY_DOWN, e => {
|
|
266
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
267
|
+
if (event.equals(10 ) || event.equals(3 )) {
|
|
268
|
+
this.executeCommand();
|
|
269
|
+
}
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
this.container.removeAttribute('tabIndex');
|
|
274
|
+
}
|
|
275
|
+
this._currentItem = item;
|
|
276
|
+
}
|
|
277
|
+
async executeCommand() {
|
|
278
|
+
const command = this._currentItem.command;
|
|
279
|
+
if (!command) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const id = typeof command === 'string' ? command : command.id;
|
|
283
|
+
const args = typeof command === 'string' ? [] : command.arguments ?? [];
|
|
284
|
+
if (typeof command === 'string' || !command.arguments || !Array.isArray(command.arguments) || command.arguments.length === 0) {
|
|
285
|
+
args.unshift(this._context);
|
|
286
|
+
}
|
|
287
|
+
this._telemetryService.publicLog2('workbenchActionExecuted', { id, from: 'cell status bar' });
|
|
288
|
+
try {
|
|
289
|
+
this._editor?.focus();
|
|
290
|
+
await this._commandService.executeCommand(id, ...args);
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
this._notificationService.error(toErrorMessage(error));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
CellStatusBarItem = ( __decorate([
|
|
298
|
+
( __param(5, ITelemetryService)),
|
|
299
|
+
( __param(6, ICommandService)),
|
|
300
|
+
( __param(7, INotificationService)),
|
|
301
|
+
( __param(8, IThemeService))
|
|
302
|
+
], CellStatusBarItem));
|
|
303
|
+
export { CellEditorStatusBar };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { clamp } from 'monaco-editor/esm/vs/base/common/numbers.js';
|
|
2
|
+
function registerCellToolbarStickyScroll(notebookEditor, cell, element, opts) {
|
|
3
|
+
const extraOffset = opts?.extraOffset ?? 0;
|
|
4
|
+
const min = opts?.min ?? 0;
|
|
5
|
+
const updateForScroll = () => {
|
|
6
|
+
if (cell.isInputCollapsed) {
|
|
7
|
+
element.style.top = '';
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
const stickyHeight = notebookEditor.getLayoutInfo().stickyHeight;
|
|
11
|
+
const scrollTop = notebookEditor.scrollTop;
|
|
12
|
+
const elementTop = notebookEditor.getAbsoluteTopOfElement(cell);
|
|
13
|
+
const diff = scrollTop - elementTop + extraOffset + stickyHeight;
|
|
14
|
+
const maxTop = cell.layoutInfo.editorHeight + cell.layoutInfo.statusBarHeight - 45;
|
|
15
|
+
const top = maxTop > 20 ?
|
|
16
|
+
clamp(min, diff, maxTop) :
|
|
17
|
+
min;
|
|
18
|
+
element.style.top = `${top}px`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
updateForScroll();
|
|
22
|
+
return notebookEditor.onDidScroll(() => updateForScroll());
|
|
23
|
+
}
|
|
24
|
+
export { registerCellToolbarStickyScroll };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
+
import { ToolBar } from 'monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js';
|
|
4
|
+
import { disposableTimeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
5
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
6
|
+
import { MenuEntryActionViewItem, createActionViewItem, createAndFillInActionBarActions } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
|
|
7
|
+
import { MenuItemAction, IMenuService } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
8
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
9
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
10
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
12
|
+
import { CodiconActionViewItem } from './cellActionView.js';
|
|
13
|
+
import { CellOverlayPart } from '../cellPart.js';
|
|
14
|
+
import { registerCellToolbarStickyScroll } from './cellToolbarStickyScroll.js';
|
|
15
|
+
import { WorkbenchToolBar } from 'monaco-editor/esm/vs/platform/actions/browser/toolbar.js';
|
|
16
|
+
let BetweenCellToolbar = class BetweenCellToolbar extends CellOverlayPart {
|
|
17
|
+
constructor(_notebookEditor, _titleToolbarContainer, _bottomCellToolbarContainer, instantiationService, contextMenuService, contextKeyService, menuService) {
|
|
18
|
+
super();
|
|
19
|
+
this._notebookEditor = _notebookEditor;
|
|
20
|
+
this._bottomCellToolbarContainer = _bottomCellToolbarContainer;
|
|
21
|
+
this.instantiationService = instantiationService;
|
|
22
|
+
this.contextMenuService = contextMenuService;
|
|
23
|
+
this.contextKeyService = contextKeyService;
|
|
24
|
+
this.menuService = menuService;
|
|
25
|
+
}
|
|
26
|
+
_initialize() {
|
|
27
|
+
if (this._betweenCellToolbar) {
|
|
28
|
+
return this._betweenCellToolbar;
|
|
29
|
+
}
|
|
30
|
+
const betweenCellToolbar = this._register(( new ToolBar(this._bottomCellToolbarContainer, this.contextMenuService, {
|
|
31
|
+
actionViewItemProvider: action => {
|
|
32
|
+
if (action instanceof MenuItemAction) {
|
|
33
|
+
if (this._notebookEditor.notebookOptions.getDisplayOptions().insertToolbarAlignment === 'center') {
|
|
34
|
+
return this.instantiationService.createInstance(CodiconActionViewItem, action, undefined);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
})));
|
|
43
|
+
this._betweenCellToolbar = betweenCellToolbar;
|
|
44
|
+
const menu = this._register(this.menuService.createMenu(this._notebookEditor.creationOptions.menuIds.cellInsertToolbar, this.contextKeyService));
|
|
45
|
+
const updateActions = () => {
|
|
46
|
+
const actions = getCellToolbarActions(menu);
|
|
47
|
+
betweenCellToolbar.setActions(actions.primary, actions.secondary);
|
|
48
|
+
};
|
|
49
|
+
this._register(menu.onDidChange(() => updateActions()));
|
|
50
|
+
this._register(this._notebookEditor.notebookOptions.onDidChangeOptions((e) => {
|
|
51
|
+
if (e.insertToolbarAlignment) {
|
|
52
|
+
updateActions();
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
updateActions();
|
|
56
|
+
return betweenCellToolbar;
|
|
57
|
+
}
|
|
58
|
+
didRenderCell(element) {
|
|
59
|
+
const betweenCellToolbar = this._initialize();
|
|
60
|
+
betweenCellToolbar.context = {
|
|
61
|
+
ui: true,
|
|
62
|
+
cell: element,
|
|
63
|
+
notebookEditor: this._notebookEditor,
|
|
64
|
+
$mid: 13
|
|
65
|
+
};
|
|
66
|
+
this.updateInternalLayoutNow(element);
|
|
67
|
+
}
|
|
68
|
+
updateInternalLayoutNow(element) {
|
|
69
|
+
const bottomToolbarOffset = element.layoutInfo.bottomToolbarOffset;
|
|
70
|
+
this._bottomCellToolbarContainer.style.transform = `translateY(${bottomToolbarOffset}px)`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
BetweenCellToolbar = ( __decorate([
|
|
74
|
+
( __param(3, IInstantiationService)),
|
|
75
|
+
( __param(4, IContextMenuService)),
|
|
76
|
+
( __param(5, IContextKeyService)),
|
|
77
|
+
( __param(6, IMenuService))
|
|
78
|
+
], BetweenCellToolbar));
|
|
79
|
+
let CellTitleToolbarPart = class CellTitleToolbarPart extends CellOverlayPart {
|
|
80
|
+
get hasActions() {
|
|
81
|
+
if (!this._model) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return this._model.actions.primary.length
|
|
85
|
+
+ this._model.actions.secondary.length
|
|
86
|
+
+ this._model.deleteActions.primary.length
|
|
87
|
+
+ this._model.deleteActions.secondary.length
|
|
88
|
+
> 0;
|
|
89
|
+
}
|
|
90
|
+
constructor(toolbarContainer, _rootClassDelegate, toolbarId, deleteToolbarId, _notebookEditor, contextKeyService, menuService, instantiationService) {
|
|
91
|
+
super();
|
|
92
|
+
this.toolbarContainer = toolbarContainer;
|
|
93
|
+
this._rootClassDelegate = _rootClassDelegate;
|
|
94
|
+
this.toolbarId = toolbarId;
|
|
95
|
+
this.deleteToolbarId = deleteToolbarId;
|
|
96
|
+
this._notebookEditor = _notebookEditor;
|
|
97
|
+
this.contextKeyService = contextKeyService;
|
|
98
|
+
this.menuService = menuService;
|
|
99
|
+
this.instantiationService = instantiationService;
|
|
100
|
+
this._onDidUpdateActions = this._register(( new Emitter()));
|
|
101
|
+
this.onDidUpdateActions = this._onDidUpdateActions.event;
|
|
102
|
+
}
|
|
103
|
+
_initializeModel() {
|
|
104
|
+
if (this._model) {
|
|
105
|
+
return this._model;
|
|
106
|
+
}
|
|
107
|
+
const titleMenu = this._register(this.menuService.createMenu(this.toolbarId, this.contextKeyService));
|
|
108
|
+
const deleteMenu = this._register(this.menuService.createMenu(this.deleteToolbarId, this.contextKeyService));
|
|
109
|
+
const actions = getCellToolbarActions(titleMenu);
|
|
110
|
+
const deleteActions = getCellToolbarActions(deleteMenu);
|
|
111
|
+
this._model = {
|
|
112
|
+
titleMenu,
|
|
113
|
+
actions,
|
|
114
|
+
deleteMenu,
|
|
115
|
+
deleteActions
|
|
116
|
+
};
|
|
117
|
+
return this._model;
|
|
118
|
+
}
|
|
119
|
+
_initialize(model, element) {
|
|
120
|
+
if (this._view) {
|
|
121
|
+
return this._view;
|
|
122
|
+
}
|
|
123
|
+
const toolbar = this._register(this.instantiationService.createInstance(WorkbenchToolBar, this.toolbarContainer, {
|
|
124
|
+
actionViewItemProvider: action => {
|
|
125
|
+
return createActionViewItem(this.instantiationService, action);
|
|
126
|
+
},
|
|
127
|
+
renderDropdownAsChildElement: true
|
|
128
|
+
}));
|
|
129
|
+
const deleteToolbar = this._register(this.instantiationService.invokeFunction(accessor => createDeleteToolbar(accessor, this.toolbarContainer, 'cell-delete-toolbar')));
|
|
130
|
+
if (model.deleteActions.primary.length !== 0 || model.deleteActions.secondary.length !== 0) {
|
|
131
|
+
deleteToolbar.setActions(model.deleteActions.primary, model.deleteActions.secondary);
|
|
132
|
+
}
|
|
133
|
+
this.setupChangeListeners(toolbar, model.titleMenu, model.actions);
|
|
134
|
+
this.setupChangeListeners(deleteToolbar, model.deleteMenu, model.deleteActions);
|
|
135
|
+
this._view = {
|
|
136
|
+
toolbar,
|
|
137
|
+
deleteToolbar
|
|
138
|
+
};
|
|
139
|
+
return this._view;
|
|
140
|
+
}
|
|
141
|
+
prepareRenderCell(element) {
|
|
142
|
+
this._initializeModel();
|
|
143
|
+
}
|
|
144
|
+
didRenderCell(element) {
|
|
145
|
+
const model = this._initializeModel();
|
|
146
|
+
const view = this._initialize(model, element);
|
|
147
|
+
this.cellDisposables.add(registerCellToolbarStickyScroll(this._notebookEditor, element, this.toolbarContainer, { extraOffset: 4, min: -14 }));
|
|
148
|
+
this.updateContext(view, {
|
|
149
|
+
ui: true,
|
|
150
|
+
cell: element,
|
|
151
|
+
notebookEditor: this._notebookEditor,
|
|
152
|
+
$mid: 13
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
updateContext(view, toolbarContext) {
|
|
156
|
+
view.toolbar.context = toolbarContext;
|
|
157
|
+
view.deleteToolbar.context = toolbarContext;
|
|
158
|
+
}
|
|
159
|
+
setupChangeListeners(toolbar, menu, initActions) {
|
|
160
|
+
let dropdownIsVisible = false;
|
|
161
|
+
let deferredUpdate;
|
|
162
|
+
this.updateActions(toolbar, initActions);
|
|
163
|
+
this._register(menu.onDidChange(() => {
|
|
164
|
+
if (dropdownIsVisible) {
|
|
165
|
+
const actions = getCellToolbarActions(menu);
|
|
166
|
+
deferredUpdate = () => this.updateActions(toolbar, actions);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const actions = getCellToolbarActions(menu);
|
|
170
|
+
this.updateActions(toolbar, actions);
|
|
171
|
+
}));
|
|
172
|
+
this._rootClassDelegate.toggle('cell-toolbar-dropdown-active', false);
|
|
173
|
+
this._register(toolbar.onDidChangeDropdownVisibility(visible => {
|
|
174
|
+
dropdownIsVisible = visible;
|
|
175
|
+
this._rootClassDelegate.toggle('cell-toolbar-dropdown-active', visible);
|
|
176
|
+
if (deferredUpdate && !visible) {
|
|
177
|
+
disposableTimeout(() => {
|
|
178
|
+
deferredUpdate?.();
|
|
179
|
+
}, 0, this._store);
|
|
180
|
+
deferredUpdate = undefined;
|
|
181
|
+
}
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
updateActions(toolbar, actions) {
|
|
185
|
+
const hadFocus = dom.isAncestorOfActiveElement(toolbar.getElement());
|
|
186
|
+
toolbar.setActions(actions.primary, actions.secondary);
|
|
187
|
+
if (hadFocus) {
|
|
188
|
+
this._notebookEditor.focus();
|
|
189
|
+
}
|
|
190
|
+
if (actions.primary.length || actions.secondary.length) {
|
|
191
|
+
this._rootClassDelegate.toggle('cell-has-toolbar-actions', true);
|
|
192
|
+
this._onDidUpdateActions.fire();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this._rootClassDelegate.toggle('cell-has-toolbar-actions', false);
|
|
196
|
+
this._onDidUpdateActions.fire();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
CellTitleToolbarPart = ( __decorate([
|
|
201
|
+
( __param(5, IContextKeyService)),
|
|
202
|
+
( __param(6, IMenuService)),
|
|
203
|
+
( __param(7, IInstantiationService))
|
|
204
|
+
], CellTitleToolbarPart));
|
|
205
|
+
function getCellToolbarActions(menu) {
|
|
206
|
+
const primary = [];
|
|
207
|
+
const secondary = [];
|
|
208
|
+
const result = { primary, secondary };
|
|
209
|
+
createAndFillInActionBarActions(menu, { shouldForwardArgs: true }, result, g => /^inline/.test(g));
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
function createDeleteToolbar(accessor, container, elementClass) {
|
|
213
|
+
const contextMenuService = accessor.get(IContextMenuService);
|
|
214
|
+
const keybindingService = accessor.get(IKeybindingService);
|
|
215
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
216
|
+
const toolbar = ( new ToolBar(container, contextMenuService, {
|
|
217
|
+
getKeyBinding: action => keybindingService.lookupKeybinding(action.id),
|
|
218
|
+
actionViewItemProvider: action => {
|
|
219
|
+
return createActionViewItem(instantiationService, action);
|
|
220
|
+
},
|
|
221
|
+
renderDropdownAsChildElement: true
|
|
222
|
+
}));
|
|
223
|
+
if (elementClass) {
|
|
224
|
+
toolbar.getElement().classList.add(elementClass);
|
|
225
|
+
}
|
|
226
|
+
return toolbar;
|
|
227
|
+
}
|
|
228
|
+
export { BetweenCellToolbar, CellTitleToolbarPart };
|