@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,435 @@
|
|
|
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 { raceCancellation } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
4
|
+
import { CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
5
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
6
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
7
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
8
|
+
import { Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
9
|
+
import * as strings from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
10
|
+
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
11
|
+
import { tokenizeToStringSync } from 'monaco-editor/esm/vs/editor/common/languages/textToHtmlTokenizer.js';
|
|
12
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
13
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
14
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
15
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
16
|
+
import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
17
|
+
import { CellFocusMode, EXPAND_CELL_INPUT_COMMAND_ID } from '../../notebookBrowser.js';
|
|
18
|
+
import { CellEditorOptions } from './cellEditorOptions.js';
|
|
19
|
+
import { CellOutputContainer } from './cellOutput.js';
|
|
20
|
+
import { CollapsedCodeCellExecutionIcon } from './codeCellExecutionIcon.js';
|
|
21
|
+
import { outputDisplayLimit } from '../../viewModel/codeCellViewModel.js';
|
|
22
|
+
import { INotebookExecutionStateService } from '../../../common/notebookExecutionStateService.js';
|
|
23
|
+
import { WordHighlighterContribution } from 'monaco-editor/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js';
|
|
24
|
+
import { CodeActionController } from 'monaco-editor/esm/vs/editor/contrib/codeAction/browser/codeActionController.js';
|
|
25
|
+
let CodeCell = class CodeCell extends Disposable {
|
|
26
|
+
constructor(notebookEditor, viewCell, templateData, instantiationService, keybindingService, openerService, languageService, configurationService, notebookExecutionStateService) {
|
|
27
|
+
super();
|
|
28
|
+
this.notebookEditor = notebookEditor;
|
|
29
|
+
this.viewCell = viewCell;
|
|
30
|
+
this.templateData = templateData;
|
|
31
|
+
this.instantiationService = instantiationService;
|
|
32
|
+
this.keybindingService = keybindingService;
|
|
33
|
+
this.languageService = languageService;
|
|
34
|
+
this.configurationService = configurationService;
|
|
35
|
+
this._isDisposed = false;
|
|
36
|
+
const cellEditorOptions = this._register(( new CellEditorOptions(
|
|
37
|
+
this.notebookEditor.getBaseCellEditorOptions(viewCell.language),
|
|
38
|
+
this.notebookEditor.notebookOptions,
|
|
39
|
+
this.configurationService
|
|
40
|
+
)));
|
|
41
|
+
this._outputContainerRenderer = this.instantiationService.createInstance(CellOutputContainer, notebookEditor, viewCell, templateData, { limit: outputDisplayLimit });
|
|
42
|
+
this.cellParts = this._register(templateData.cellParts.concatContentPart([cellEditorOptions, this._outputContainerRenderer], dom.getWindow(notebookEditor.getDomNode())));
|
|
43
|
+
const editorHeight = this.calculateInitEditorHeight();
|
|
44
|
+
this.initializeEditor(editorHeight);
|
|
45
|
+
this._renderedInputCollapseState = false;
|
|
46
|
+
this.registerViewCellLayoutChange();
|
|
47
|
+
this.registerCellEditorEventListeners();
|
|
48
|
+
this.registerDecorations();
|
|
49
|
+
this.registerMouseListener();
|
|
50
|
+
this._register(Event.any(this.viewCell.onDidStartExecution, this.viewCell.onDidStopExecution)((e) => {
|
|
51
|
+
this.cellParts.updateForExecutionState(this.viewCell, e);
|
|
52
|
+
}));
|
|
53
|
+
this._register(this.viewCell.onDidChangeState(e => {
|
|
54
|
+
this.cellParts.updateState(this.viewCell, e);
|
|
55
|
+
if (e.outputIsHoveredChanged) {
|
|
56
|
+
this.updateForOutputHover();
|
|
57
|
+
}
|
|
58
|
+
if (e.outputIsFocusedChanged) {
|
|
59
|
+
this.updateForOutputFocus();
|
|
60
|
+
}
|
|
61
|
+
if (e.metadataChanged || e.internalMetadataChanged) {
|
|
62
|
+
this.updateEditorOptions();
|
|
63
|
+
}
|
|
64
|
+
if (e.inputCollapsedChanged || e.outputCollapsedChanged) {
|
|
65
|
+
this.viewCell.pauseLayout();
|
|
66
|
+
const updated = this.updateForCollapseState();
|
|
67
|
+
this.viewCell.resumeLayout();
|
|
68
|
+
if (updated) {
|
|
69
|
+
this.relayoutCell();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (e.focusModeChanged) {
|
|
73
|
+
this.updateEditorForFocusModeChange();
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
this.cellParts.scheduleRenderCell(this.viewCell);
|
|
77
|
+
this._register(toDisposable(() => {
|
|
78
|
+
this.cellParts.unrenderCell(this.viewCell);
|
|
79
|
+
}));
|
|
80
|
+
this.updateEditorOptions();
|
|
81
|
+
this.updateEditorForFocusModeChange();
|
|
82
|
+
this.updateForOutputHover();
|
|
83
|
+
this.updateForOutputFocus();
|
|
84
|
+
this.viewCell.editorHeight = editorHeight;
|
|
85
|
+
this._outputContainerRenderer.render();
|
|
86
|
+
this._renderedOutputCollapseState = false;
|
|
87
|
+
this.initialViewUpdateExpanded();
|
|
88
|
+
this._register(this.viewCell.onLayoutInfoRead(() => {
|
|
89
|
+
this.cellParts.prepareLayout();
|
|
90
|
+
}));
|
|
91
|
+
const executionItemElement = dom.append(this.templateData.cellInputCollapsedContainer, dom.$('.collapsed-execution-icon'));
|
|
92
|
+
this._register(toDisposable(() => {
|
|
93
|
+
executionItemElement.parentElement?.removeChild(executionItemElement);
|
|
94
|
+
}));
|
|
95
|
+
this._collapsedExecutionIcon = this._register(this.instantiationService.createInstance(CollapsedCodeCellExecutionIcon, this.notebookEditor, this.viewCell, executionItemElement));
|
|
96
|
+
this.updateForCollapseState();
|
|
97
|
+
this._register(Event.runAndSubscribe(viewCell.onDidChangeOutputs, this.updateForOutputs.bind(this)));
|
|
98
|
+
this._register(Event.runAndSubscribe(viewCell.onDidChangeLayout, this.updateForLayout.bind(this)));
|
|
99
|
+
cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers);
|
|
100
|
+
this._register(cellEditorOptions.onDidChange(() => templateData.editor.updateOptions(cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata, this.viewCell.uri))));
|
|
101
|
+
templateData.editor.updateOptions(cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata, this.viewCell.uri));
|
|
102
|
+
}
|
|
103
|
+
updateForLayout() {
|
|
104
|
+
this._pendingLayout?.dispose();
|
|
105
|
+
this._pendingLayout = dom.modify(dom.getWindow(this.notebookEditor.getDomNode()), () => {
|
|
106
|
+
this.cellParts.updateInternalLayoutNow(this.viewCell);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
updateForOutputHover() {
|
|
110
|
+
this.templateData.container.classList.toggle('cell-output-hover', this.viewCell.outputIsHovered);
|
|
111
|
+
}
|
|
112
|
+
updateForOutputFocus() {
|
|
113
|
+
this.templateData.container.classList.toggle('cell-output-focus', this.viewCell.outputIsFocused);
|
|
114
|
+
}
|
|
115
|
+
calculateInitEditorHeight() {
|
|
116
|
+
const lineNum = this.viewCell.lineCount;
|
|
117
|
+
const lineHeight = this.viewCell.layoutInfo.fontInfo?.lineHeight || 17;
|
|
118
|
+
const editorPadding = this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata, this.viewCell.uri);
|
|
119
|
+
const editorHeight = this.viewCell.layoutInfo.editorHeight === 0
|
|
120
|
+
? lineNum * lineHeight + editorPadding.top + editorPadding.bottom
|
|
121
|
+
: this.viewCell.layoutInfo.editorHeight;
|
|
122
|
+
return editorHeight;
|
|
123
|
+
}
|
|
124
|
+
initializeEditor(initEditorHeight) {
|
|
125
|
+
const width = this.viewCell.layoutInfo.editorWidth;
|
|
126
|
+
this.layoutEditor({
|
|
127
|
+
width: width,
|
|
128
|
+
height: initEditorHeight
|
|
129
|
+
});
|
|
130
|
+
const cts = ( new CancellationTokenSource());
|
|
131
|
+
this._register({ dispose() { cts.dispose(true); } });
|
|
132
|
+
raceCancellation(this.viewCell.resolveTextModel(), cts.token).then(model => {
|
|
133
|
+
if (this._isDisposed) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (model && this.templateData.editor) {
|
|
137
|
+
this._reigsterModelListeners(model);
|
|
138
|
+
this.templateData.editor.setModel(model);
|
|
139
|
+
this.viewCell.attachTextEditor(this.templateData.editor, this.viewCell.layoutInfo.estimatedHasHorizontalScrolling);
|
|
140
|
+
const focusEditorIfNeeded = () => {
|
|
141
|
+
if (this.notebookEditor.getActiveCell() === this.viewCell &&
|
|
142
|
+
this.viewCell.focusMode === CellFocusMode.Editor &&
|
|
143
|
+
(this.notebookEditor.hasEditorFocus() || this.notebookEditor.getDomNode().ownerDocument.activeElement === this.notebookEditor.getDomNode().ownerDocument.body))
|
|
144
|
+
{
|
|
145
|
+
this.templateData.editor?.focus();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
focusEditorIfNeeded();
|
|
149
|
+
const realContentHeight = this.templateData.editor?.getContentHeight();
|
|
150
|
+
if (realContentHeight !== undefined && realContentHeight !== initEditorHeight) {
|
|
151
|
+
this.onCellEditorHeightChange(realContentHeight);
|
|
152
|
+
}
|
|
153
|
+
focusEditorIfNeeded();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
updateForOutputs() {
|
|
158
|
+
dom.setVisibility(this.viewCell.outputsViewModels.length > 0, this.templateData.focusSinkElement);
|
|
159
|
+
}
|
|
160
|
+
updateEditorOptions() {
|
|
161
|
+
const editor = this.templateData.editor;
|
|
162
|
+
if (!editor) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const isReadonly = this.notebookEditor.isReadOnly;
|
|
166
|
+
const padding = this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata, this.viewCell.uri);
|
|
167
|
+
const options = editor.getOptions();
|
|
168
|
+
if (options.get(90 ) !== isReadonly || options.get(83 ) !== padding) {
|
|
169
|
+
editor.updateOptions({ readOnly: this.notebookEditor.isReadOnly, padding: this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata, this.viewCell.uri) });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
registerViewCellLayoutChange() {
|
|
173
|
+
this._register(this.viewCell.onDidChangeLayout((e) => {
|
|
174
|
+
if (e.outerWidth !== undefined) {
|
|
175
|
+
const layoutInfo = this.templateData.editor.getLayoutInfo();
|
|
176
|
+
if (layoutInfo.width !== this.viewCell.layoutInfo.editorWidth) {
|
|
177
|
+
this.onCellWidthChange();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
registerCellEditorEventListeners() {
|
|
183
|
+
this._register(this.templateData.editor.onDidContentSizeChange((e) => {
|
|
184
|
+
if (e.contentHeightChanged) {
|
|
185
|
+
if (this.viewCell.layoutInfo.editorHeight !== e.contentHeight) {
|
|
186
|
+
this.onCellEditorHeightChange(e.contentHeight);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
190
|
+
this._register(this.templateData.editor.onDidChangeCursorSelection((e) => {
|
|
191
|
+
if (e.source === 'restoreState' || e.oldModelVersionId === 0) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const selections = this.templateData.editor.getSelections();
|
|
195
|
+
if (selections?.length) {
|
|
196
|
+
const contentHeight = this.templateData.editor.getContentHeight();
|
|
197
|
+
const layoutContentHeight = this.viewCell.layoutInfo.editorHeight;
|
|
198
|
+
if (contentHeight !== layoutContentHeight) {
|
|
199
|
+
this.onCellEditorHeightChange(contentHeight);
|
|
200
|
+
}
|
|
201
|
+
const lastSelection = selections[selections.length - 1];
|
|
202
|
+
this.notebookEditor.revealRangeInViewAsync(this.viewCell, lastSelection);
|
|
203
|
+
}
|
|
204
|
+
}));
|
|
205
|
+
this._register(this.templateData.editor.onDidBlurEditorWidget(() => {
|
|
206
|
+
WordHighlighterContribution.get(this.templateData.editor)?.stopHighlighting();
|
|
207
|
+
CodeActionController.get(this.templateData.editor)?.hideCodeActions();
|
|
208
|
+
CodeActionController.get(this.templateData.editor)?.hideLightBulbWidget();
|
|
209
|
+
}));
|
|
210
|
+
this._register(this.templateData.editor.onDidFocusEditorWidget(() => {
|
|
211
|
+
WordHighlighterContribution.get(this.templateData.editor)?.restoreViewState(true);
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
_reigsterModelListeners(model) {
|
|
215
|
+
this._register(model.onDidChangeTokens(() => {
|
|
216
|
+
if (this.viewCell.isInputCollapsed && this._inputCollapseElement) {
|
|
217
|
+
const content = this._getRichTextFromLineTokens(model);
|
|
218
|
+
dom.safeInnerHtml(this._inputCollapseElement, content);
|
|
219
|
+
this._attachInputExpandButton(this._inputCollapseElement);
|
|
220
|
+
}
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
registerDecorations() {
|
|
224
|
+
this._register(this.viewCell.onCellDecorationsChanged((e) => {
|
|
225
|
+
e.added.forEach(options => {
|
|
226
|
+
if (options.className) {
|
|
227
|
+
this.templateData.rootContainer.classList.add(options.className);
|
|
228
|
+
}
|
|
229
|
+
if (options.outputClassName) {
|
|
230
|
+
this.notebookEditor.deltaCellContainerClassNames(this.viewCell.id, [options.outputClassName], []);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
e.removed.forEach(options => {
|
|
234
|
+
if (options.className) {
|
|
235
|
+
this.templateData.rootContainer.classList.remove(options.className);
|
|
236
|
+
}
|
|
237
|
+
if (options.outputClassName) {
|
|
238
|
+
this.notebookEditor.deltaCellContainerClassNames(this.viewCell.id, [], [options.outputClassName]);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}));
|
|
242
|
+
this.viewCell.getCellDecorations().forEach(options => {
|
|
243
|
+
if (options.className) {
|
|
244
|
+
this.templateData.rootContainer.classList.add(options.className);
|
|
245
|
+
}
|
|
246
|
+
if (options.outputClassName) {
|
|
247
|
+
this.notebookEditor.deltaCellContainerClassNames(this.viewCell.id, [options.outputClassName], []);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
registerMouseListener() {
|
|
252
|
+
this._register(this.templateData.editor.onMouseDown(e => {
|
|
253
|
+
if (e.event.rightButton) {
|
|
254
|
+
e.event.preventDefault();
|
|
255
|
+
}
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
258
|
+
shouldUpdateDOMFocus() {
|
|
259
|
+
return this.notebookEditor.getActiveCell() === this.viewCell
|
|
260
|
+
&& this.viewCell.focusMode === CellFocusMode.Editor
|
|
261
|
+
&& (this.notebookEditor.hasEditorFocus() || this.notebookEditor.getDomNode().ownerDocument.activeElement === this.notebookEditor.getDomNode().ownerDocument.body);
|
|
262
|
+
}
|
|
263
|
+
updateEditorForFocusModeChange() {
|
|
264
|
+
if (this.shouldUpdateDOMFocus()) {
|
|
265
|
+
this.templateData.editor?.focus();
|
|
266
|
+
}
|
|
267
|
+
this.templateData.container.classList.toggle('cell-editor-focus', this.viewCell.focusMode === CellFocusMode.Editor);
|
|
268
|
+
this.templateData.container.classList.toggle('cell-output-focus', this.viewCell.focusMode === CellFocusMode.Output);
|
|
269
|
+
}
|
|
270
|
+
updateForCollapseState() {
|
|
271
|
+
if (this.viewCell.isOutputCollapsed === this._renderedOutputCollapseState &&
|
|
272
|
+
this.viewCell.isInputCollapsed === this._renderedInputCollapseState) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
this.viewCell.layoutChange({ editorHeight: true });
|
|
276
|
+
if (this.viewCell.isInputCollapsed) {
|
|
277
|
+
this._collapseInput();
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
this._showInput();
|
|
281
|
+
}
|
|
282
|
+
if (this.viewCell.isOutputCollapsed) {
|
|
283
|
+
this._collapseOutput();
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
this._showOutput(false);
|
|
287
|
+
}
|
|
288
|
+
this.relayoutCell();
|
|
289
|
+
this._renderedOutputCollapseState = this.viewCell.isOutputCollapsed;
|
|
290
|
+
this._renderedInputCollapseState = this.viewCell.isInputCollapsed;
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
_collapseInput() {
|
|
294
|
+
dom.hide(this.templateData.editorPart);
|
|
295
|
+
this.templateData.container.classList.toggle('input-collapsed', true);
|
|
296
|
+
this._removeInputCollapsePreview();
|
|
297
|
+
this._collapsedExecutionIcon.setVisibility(true);
|
|
298
|
+
const richEditorText = this.templateData.editor.hasModel() ? this._getRichTextFromLineTokens(this.templateData.editor.getModel()) : this._getRichText(this.viewCell.textBuffer, this.viewCell.language);
|
|
299
|
+
const element = dom.$('div.cell-collapse-preview');
|
|
300
|
+
dom.safeInnerHtml(element, richEditorText);
|
|
301
|
+
this._inputCollapseElement = element;
|
|
302
|
+
this.templateData.cellInputCollapsedContainer.appendChild(element);
|
|
303
|
+
this._attachInputExpandButton(element);
|
|
304
|
+
dom.show(this.templateData.cellInputCollapsedContainer);
|
|
305
|
+
}
|
|
306
|
+
_attachInputExpandButton(element) {
|
|
307
|
+
const expandIcon = dom.$('span.expandInputIcon');
|
|
308
|
+
const keybinding = this.keybindingService.lookupKeybinding(EXPAND_CELL_INPUT_COMMAND_ID);
|
|
309
|
+
if (keybinding) {
|
|
310
|
+
element.title = ( localizeWithPath(
|
|
311
|
+
'vs/workbench/contrib/notebook/browser/view/cellParts/codeCell',
|
|
312
|
+
'cellExpandInputButtonLabelWithDoubleClick',
|
|
313
|
+
"Double-click to expand cell input ({0})",
|
|
314
|
+
keybinding.getLabel()
|
|
315
|
+
));
|
|
316
|
+
expandIcon.title = ( localizeWithPath(
|
|
317
|
+
'vs/workbench/contrib/notebook/browser/view/cellParts/codeCell',
|
|
318
|
+
'cellExpandInputButtonLabel',
|
|
319
|
+
"Expand Cell Input ({0})",
|
|
320
|
+
keybinding.getLabel()
|
|
321
|
+
));
|
|
322
|
+
}
|
|
323
|
+
expandIcon.classList.add(...ThemeIcon.asClassNameArray(Codicon.more));
|
|
324
|
+
element.appendChild(expandIcon);
|
|
325
|
+
}
|
|
326
|
+
_showInput() {
|
|
327
|
+
this._collapsedExecutionIcon.setVisibility(false);
|
|
328
|
+
dom.show(this.templateData.editorPart);
|
|
329
|
+
dom.hide(this.templateData.cellInputCollapsedContainer);
|
|
330
|
+
}
|
|
331
|
+
_getRichText(buffer, language) {
|
|
332
|
+
return tokenizeToStringSync(this.languageService, buffer.getLineContent(1), language);
|
|
333
|
+
}
|
|
334
|
+
_getRichTextFromLineTokens(model) {
|
|
335
|
+
let result = `<div class="monaco-tokenized-source">`;
|
|
336
|
+
const firstLineTokens = model.tokenization.getLineTokens(1);
|
|
337
|
+
const viewLineTokens = firstLineTokens.inflate();
|
|
338
|
+
const line = model.getLineContent(1);
|
|
339
|
+
let startOffset = 0;
|
|
340
|
+
for (let j = 0, lenJ = viewLineTokens.getCount(); j < lenJ; j++) {
|
|
341
|
+
const type = viewLineTokens.getClassName(j);
|
|
342
|
+
const endIndex = viewLineTokens.getEndOffset(j);
|
|
343
|
+
result += `<span class="${type}">${strings.escape(line.substring(startOffset, endIndex))}</span>`;
|
|
344
|
+
startOffset = endIndex;
|
|
345
|
+
}
|
|
346
|
+
result += `</div>`;
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
_removeInputCollapsePreview() {
|
|
350
|
+
const children = this.templateData.cellInputCollapsedContainer.children;
|
|
351
|
+
const elements = [];
|
|
352
|
+
for (let i = 0; i < children.length; i++) {
|
|
353
|
+
if (children[i].classList.contains('cell-collapse-preview')) {
|
|
354
|
+
elements.push(children[i]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
elements.forEach(element => {
|
|
358
|
+
element.parentElement?.removeChild(element);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
_updateOutputInnerContainer(hide) {
|
|
362
|
+
const children = this.templateData.outputContainer.domNode.children;
|
|
363
|
+
for (let i = 0; i < children.length; i++) {
|
|
364
|
+
if (children[i].classList.contains('output-inner-container')) {
|
|
365
|
+
dom.setVisibility(!hide, children[i]);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
_collapseOutput() {
|
|
370
|
+
this.templateData.container.classList.toggle('output-collapsed', true);
|
|
371
|
+
dom.show(this.templateData.cellOutputCollapsedContainer);
|
|
372
|
+
this._updateOutputInnerContainer(true);
|
|
373
|
+
this._outputContainerRenderer.viewUpdateHideOuputs();
|
|
374
|
+
}
|
|
375
|
+
_showOutput(initRendering) {
|
|
376
|
+
this.templateData.container.classList.toggle('output-collapsed', false);
|
|
377
|
+
dom.hide(this.templateData.cellOutputCollapsedContainer);
|
|
378
|
+
this._updateOutputInnerContainer(false);
|
|
379
|
+
this._outputContainerRenderer.viewUpdateShowOutputs(initRendering);
|
|
380
|
+
}
|
|
381
|
+
initialViewUpdateExpanded() {
|
|
382
|
+
this.templateData.container.classList.toggle('input-collapsed', false);
|
|
383
|
+
dom.show(this.templateData.editorPart);
|
|
384
|
+
dom.hide(this.templateData.cellInputCollapsedContainer);
|
|
385
|
+
this.templateData.container.classList.toggle('output-collapsed', false);
|
|
386
|
+
this._showOutput(true);
|
|
387
|
+
}
|
|
388
|
+
layoutEditor(dimension) {
|
|
389
|
+
this.templateData.editor?.layout(dimension, true);
|
|
390
|
+
}
|
|
391
|
+
onCellWidthChange() {
|
|
392
|
+
if (!this.templateData.editor.hasModel()) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const realContentHeight = this.templateData.editor.getContentHeight();
|
|
396
|
+
this.viewCell.editorHeight = realContentHeight;
|
|
397
|
+
this.relayoutCell();
|
|
398
|
+
this.layoutEditor({
|
|
399
|
+
width: this.viewCell.layoutInfo.editorWidth,
|
|
400
|
+
height: realContentHeight
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
onCellEditorHeightChange(newHeight) {
|
|
404
|
+
const viewLayout = this.templateData.editor.getLayoutInfo();
|
|
405
|
+
this.viewCell.editorHeight = newHeight;
|
|
406
|
+
this.relayoutCell();
|
|
407
|
+
this.layoutEditor({
|
|
408
|
+
width: viewLayout.width,
|
|
409
|
+
height: newHeight
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
relayoutCell() {
|
|
413
|
+
this.notebookEditor.layoutNotebookCell(this.viewCell, this.viewCell.layoutInfo.totalHeight);
|
|
414
|
+
}
|
|
415
|
+
dispose() {
|
|
416
|
+
this._isDisposed = true;
|
|
417
|
+
if (this.shouldUpdateDOMFocus()) {
|
|
418
|
+
this.notebookEditor.focusContainer();
|
|
419
|
+
}
|
|
420
|
+
this.viewCell.detachTextEditor();
|
|
421
|
+
this._removeInputCollapsePreview();
|
|
422
|
+
this._outputContainerRenderer.dispose();
|
|
423
|
+
this._pendingLayout?.dispose();
|
|
424
|
+
super.dispose();
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
CodeCell = ( __decorate([
|
|
428
|
+
( __param(3, IInstantiationService)),
|
|
429
|
+
( __param(4, IKeybindingService)),
|
|
430
|
+
( __param(5, IOpenerService)),
|
|
431
|
+
( __param(6, ILanguageService)),
|
|
432
|
+
( __param(7, IConfigurationService)),
|
|
433
|
+
( __param(8, INotebookExecutionStateService))
|
|
434
|
+
], CodeCell));
|
|
435
|
+
export { CodeCell };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
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 { renderLabelWithIcons } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js';
|
|
4
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
6
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
7
|
+
import { successStateIcon, errorStateIcon, pendingStateIcon, executingStateIcon } from '../../notebookIcons.js';
|
|
8
|
+
import { NotebookCellExecutionState } from '../../../common/notebookCommon.js';
|
|
9
|
+
import { NotebookExecutionType, INotebookExecutionStateService } from '../../../common/notebookExecutionStateService.js';
|
|
10
|
+
let CollapsedCodeCellExecutionIcon = class CollapsedCodeCellExecutionIcon extends Disposable {
|
|
11
|
+
constructor(_notebookEditor, _cell, _element, _executionStateService) {
|
|
12
|
+
super();
|
|
13
|
+
this._cell = _cell;
|
|
14
|
+
this._element = _element;
|
|
15
|
+
this._executionStateService = _executionStateService;
|
|
16
|
+
this._visible = false;
|
|
17
|
+
this._update();
|
|
18
|
+
this._register(this._executionStateService.onDidChangeExecution(e => {
|
|
19
|
+
if (e.type === NotebookExecutionType.cell && e.affectsCell(this._cell.uri)) {
|
|
20
|
+
this._update();
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
this._register(this._cell.model.onDidChangeInternalMetadata(() => this._update()));
|
|
24
|
+
}
|
|
25
|
+
setVisibility(visible) {
|
|
26
|
+
this._visible = visible;
|
|
27
|
+
this._update();
|
|
28
|
+
}
|
|
29
|
+
_update() {
|
|
30
|
+
if (!this._visible) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const runState = this._executionStateService.getCellExecution(this._cell.uri);
|
|
34
|
+
const item = this._getItemForState(runState, this._cell.model.internalMetadata);
|
|
35
|
+
if (item) {
|
|
36
|
+
this._element.style.display = '';
|
|
37
|
+
dom.reset(this._element, ...renderLabelWithIcons(item.text));
|
|
38
|
+
this._element.title = item.tooltip ?? '';
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this._element.style.display = 'none';
|
|
42
|
+
dom.reset(this._element);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
_getItemForState(runState, internalMetadata) {
|
|
46
|
+
const state = runState?.state;
|
|
47
|
+
const { lastRunSuccess } = internalMetadata;
|
|
48
|
+
if (!state && lastRunSuccess) {
|
|
49
|
+
return {
|
|
50
|
+
text: `$(${successStateIcon.id})`,
|
|
51
|
+
tooltip: ( localizeWithPath(
|
|
52
|
+
'vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon',
|
|
53
|
+
'notebook.cell.status.success',
|
|
54
|
+
"Success"
|
|
55
|
+
)),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else if (!state && lastRunSuccess === false) {
|
|
59
|
+
return {
|
|
60
|
+
text: `$(${errorStateIcon.id})`,
|
|
61
|
+
tooltip: ( localizeWithPath(
|
|
62
|
+
'vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon',
|
|
63
|
+
'notebook.cell.status.failed',
|
|
64
|
+
"Failed"
|
|
65
|
+
)),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
else if (state === NotebookCellExecutionState.Pending || state === NotebookCellExecutionState.Unconfirmed) {
|
|
69
|
+
return {
|
|
70
|
+
text: `$(${pendingStateIcon.id})`,
|
|
71
|
+
tooltip: ( localizeWithPath(
|
|
72
|
+
'vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon',
|
|
73
|
+
'notebook.cell.status.pending',
|
|
74
|
+
"Pending"
|
|
75
|
+
)),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
else if (state === NotebookCellExecutionState.Executing) {
|
|
79
|
+
const icon = ThemeIcon.modify(executingStateIcon, 'spin');
|
|
80
|
+
return {
|
|
81
|
+
text: `$(${icon.id})`,
|
|
82
|
+
tooltip: ( localizeWithPath(
|
|
83
|
+
'vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon',
|
|
84
|
+
'notebook.cell.status.executing',
|
|
85
|
+
"Executing"
|
|
86
|
+
)),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
CollapsedCodeCellExecutionIcon = ( __decorate([
|
|
93
|
+
( __param(3, INotebookExecutionStateService))
|
|
94
|
+
], CollapsedCodeCellExecutionIcon));
|
|
95
|
+
export { CollapsedCodeCellExecutionIcon };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { ToolBar } from 'monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js';
|
|
3
|
+
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
4
|
+
import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { EditorContextKeys } from 'monaco-editor/esm/vs/editor/common/editorContextKeys.js';
|
|
6
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
7
|
+
import { DropdownWithPrimaryActionViewItem } from '../../../../../../platform/actions/browser/dropdownWithPrimaryActionViewItem.js';
|
|
8
|
+
import { createAndFillInActionBarActions } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
|
|
9
|
+
import { MenuItemAction, IMenuService } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
10
|
+
import { InputFocusedContext } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js';
|
|
11
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
12
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
13
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
14
|
+
import { CellContentPart } from '../cellPart.js';
|
|
15
|
+
import { registerCellToolbarStickyScroll } from './cellToolbarStickyScroll.js';
|
|
16
|
+
import { NOTEBOOK_CELL_EXECUTION_STATE, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_CELL_TYPE } from '../../../common/notebookContextKeys.js';
|
|
17
|
+
let RunToolbar = class RunToolbar extends CellContentPart {
|
|
18
|
+
constructor(notebookEditor, contextKeyService, cellContainer, runButtonContainer, menuService, keybindingService, contextMenuService, instantiationService) {
|
|
19
|
+
super();
|
|
20
|
+
this.notebookEditor = notebookEditor;
|
|
21
|
+
this.contextKeyService = contextKeyService;
|
|
22
|
+
this.cellContainer = cellContainer;
|
|
23
|
+
this.runButtonContainer = runButtonContainer;
|
|
24
|
+
this.keybindingService = keybindingService;
|
|
25
|
+
this.contextMenuService = contextMenuService;
|
|
26
|
+
this.instantiationService = instantiationService;
|
|
27
|
+
this.primaryMenu = this._register(menuService.createMenu(this.notebookEditor.creationOptions.menuIds.cellExecutePrimary, contextKeyService));
|
|
28
|
+
this.secondaryMenu = this._register(menuService.createMenu(this.notebookEditor.creationOptions.menuIds.cellExecuteToolbar, contextKeyService));
|
|
29
|
+
this.createRunCellToolbar(runButtonContainer, cellContainer, contextKeyService);
|
|
30
|
+
const updateActions = () => {
|
|
31
|
+
const actions = this.getCellToolbarActions(this.primaryMenu);
|
|
32
|
+
const primary = actions.primary[0];
|
|
33
|
+
this.toolbar.setActions(primary ? [primary] : []);
|
|
34
|
+
};
|
|
35
|
+
updateActions();
|
|
36
|
+
this._register(this.primaryMenu.onDidChange(updateActions));
|
|
37
|
+
this._register(this.secondaryMenu.onDidChange(updateActions));
|
|
38
|
+
this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(updateActions));
|
|
39
|
+
}
|
|
40
|
+
didRenderCell(element) {
|
|
41
|
+
this.cellDisposables.add(registerCellToolbarStickyScroll(this.notebookEditor, element, this.runButtonContainer));
|
|
42
|
+
this.toolbar.context = {
|
|
43
|
+
ui: true,
|
|
44
|
+
cell: element,
|
|
45
|
+
notebookEditor: this.notebookEditor,
|
|
46
|
+
$mid: 13
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
getCellToolbarActions(menu) {
|
|
50
|
+
const primary = [];
|
|
51
|
+
const secondary = [];
|
|
52
|
+
const result = { primary, secondary };
|
|
53
|
+
createAndFillInActionBarActions(menu, { shouldForwardArgs: true }, result, g => /^inline/.test(g));
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
createRunCellToolbar(container, cellContainer, contextKeyService) {
|
|
57
|
+
const actionViewItemDisposables = this._register(( new DisposableStore()));
|
|
58
|
+
const dropdownAction = this._register(( new Action('notebook.moreRunActions', ( localizeWithPath(
|
|
59
|
+
'vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar',
|
|
60
|
+
'notebook.moreRunActionsLabel',
|
|
61
|
+
"More..."
|
|
62
|
+
)), 'codicon-chevron-down', true)));
|
|
63
|
+
const keybindingProvider = (action) => this.keybindingService.lookupKeybinding(action.id, executionContextKeyService);
|
|
64
|
+
const executionContextKeyService = this._register(getCodeCellExecutionContextKeyService(contextKeyService));
|
|
65
|
+
this.toolbar = this._register(( new ToolBar(container, this.contextMenuService, {
|
|
66
|
+
getKeyBinding: keybindingProvider,
|
|
67
|
+
actionViewItemProvider: _action => {
|
|
68
|
+
actionViewItemDisposables.clear();
|
|
69
|
+
const primary = this.getCellToolbarActions(this.primaryMenu).primary[0];
|
|
70
|
+
if (!(primary instanceof MenuItemAction)) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const secondary = this.getCellToolbarActions(this.secondaryMenu).secondary;
|
|
74
|
+
if (!secondary.length) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const item = this.instantiationService.createInstance(DropdownWithPrimaryActionViewItem, primary, dropdownAction, secondary, 'notebook-cell-run-toolbar', this.contextMenuService, {
|
|
78
|
+
getKeyBinding: keybindingProvider
|
|
79
|
+
});
|
|
80
|
+
actionViewItemDisposables.add(item.onDidChangeDropdownVisibility(visible => {
|
|
81
|
+
cellContainer.classList.toggle('cell-run-toolbar-dropdown-active', visible);
|
|
82
|
+
}));
|
|
83
|
+
return item;
|
|
84
|
+
},
|
|
85
|
+
renderDropdownAsChildElement: true
|
|
86
|
+
})));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
RunToolbar = ( __decorate([
|
|
90
|
+
( __param(4, IMenuService)),
|
|
91
|
+
( __param(5, IKeybindingService)),
|
|
92
|
+
( __param(6, IContextMenuService)),
|
|
93
|
+
( __param(7, IInstantiationService))
|
|
94
|
+
], RunToolbar));
|
|
95
|
+
function getCodeCellExecutionContextKeyService(contextKeyService) {
|
|
96
|
+
const executionContextKeyService = contextKeyService.createScoped(document.createElement('div'));
|
|
97
|
+
InputFocusedContext.bindTo(executionContextKeyService).set(true);
|
|
98
|
+
EditorContextKeys.editorTextFocus.bindTo(executionContextKeyService).set(true);
|
|
99
|
+
EditorContextKeys.focus.bindTo(executionContextKeyService).set(true);
|
|
100
|
+
EditorContextKeys.textInputFocus.bindTo(executionContextKeyService).set(true);
|
|
101
|
+
NOTEBOOK_CELL_EXECUTION_STATE.bindTo(executionContextKeyService).set('idle');
|
|
102
|
+
NOTEBOOK_CELL_LIST_FOCUSED.bindTo(executionContextKeyService).set(true);
|
|
103
|
+
NOTEBOOK_EDITOR_FOCUSED.bindTo(executionContextKeyService).set(true);
|
|
104
|
+
NOTEBOOK_CELL_TYPE.bindTo(executionContextKeyService).set('code');
|
|
105
|
+
return executionContextKeyService;
|
|
106
|
+
}
|
|
107
|
+
export { RunToolbar, getCodeCellExecutionContextKeyService };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
+
import { CellContentPart } from '../cellPart.js';
|
|
3
|
+
class CollapsedCellInput extends CellContentPart {
|
|
4
|
+
constructor(notebookEditor, cellInputCollapsedContainer) {
|
|
5
|
+
super();
|
|
6
|
+
this.notebookEditor = notebookEditor;
|
|
7
|
+
this._register(dom.addDisposableListener(cellInputCollapsedContainer, dom.EventType.DBLCLICK, e => {
|
|
8
|
+
if (!this.currentCell || !this.notebookEditor.hasModel()) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (this.currentCell.isInputCollapsed) {
|
|
12
|
+
this.currentCell.isInputCollapsed = false;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this.currentCell.isOutputCollapsed = false;
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
this._register(dom.addDisposableListener(cellInputCollapsedContainer, dom.EventType.CLICK, e => {
|
|
19
|
+
if (!this.currentCell || !this.notebookEditor.hasModel()) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const element = e.target;
|
|
23
|
+
if (element && element.classList && element.classList.contains('expandInputIcon')) {
|
|
24
|
+
this.currentCell.isInputCollapsed = false;
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export { CollapsedCellInput };
|