@codingame/monaco-vscode-api 37.1.0 → 37.2.0
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/missing-services.js +6 -26
- package/package.json +8 -8
- package/services.d.ts +1 -1
- package/services.js +3 -3
- package/tools.d.ts +4 -0
- package/tools.js +24 -1
- package/vscode/src/vs/platform/product/common/product.js +1 -1
- package/vscode/src/vs/platform/webWorker/browser/webWorkerServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.d.ts +63 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +305 -0
- package/vscode/src/vs/workbench/api/common/extHost.protocol.d.ts +2 -2
- package/vscode/src/vs/workbench/api/common/extHostLanguageModelTools.js +1 -2
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +1 -1
- package/vscode/src/vs/workbench/browser/media/code-icon.svg +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatConstants.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatConstants.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.js +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageBuffer.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageBuffer.js +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatService.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.service.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginSource.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatParserTypes.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolIds.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolIds.js +7 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookService.service.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/AISearch/aiSearchModel.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchModel.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchModelBase.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchTreeModel/folderMatch.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchTreeModel/searchTreeCommon.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +4 -3
- package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.js +72 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.js +96 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css +1148 -0
- package/vscode/src/vs/workbench/contrib/welcomeOnboarding/common/onboardingTypes.d.ts +81 -0
- package/vscode/src/vs/workbench/contrib/welcomeOnboarding/common/onboardingTypes.js +97 -0
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.d.ts +32 -0
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +45 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostEnablementService.d.ts +0 -7
- package/vscode/src/vs/platform/agentHost/common/agentHostEnablementService.js +0 -92
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.d.ts +0 -12
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +0 -64
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.d.ts +0 -262
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.js +0 -865
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.js +0 -311
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.js +0 -80
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +0 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +0 -231
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +0 -1850
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +0 -109
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +0 -85
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.d.ts +0 -140
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.js +0 -186
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatDynamicVariablesConstant.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatDynamicVariablesConstant.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.js +0 -17
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +0 -253
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +0 -20
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.d.ts +0 -34
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +0 -194
- package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.d.ts +0 -87
- package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.js +0 -69
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +0 -300
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +0 -272
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +0 -178
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +0 -78
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +0 -51
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +0 -67
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +0 -195
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +0 -67
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +0 -294
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +0 -212
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +0 -955
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +0 -122
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +0 -697
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/config.d.ts +0 -150
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/config.js +0 -142
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +0 -77
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +0 -77
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +0 -120
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.d.ts +0 -92
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.js +0 -335
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +0 -235
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +0 -1673
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +0 -202
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +0 -872
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.d.ts +0 -35
- package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.js +0 -289
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.d.ts +0 -72
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.js +0 -600
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +0 -239
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.js +0 -143
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +0 -298
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +0 -177
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.d.ts +0 -73
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +0 -577
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +0 -90
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.d.ts +0 -16
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +0 -130
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.js +0 -53
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.js +0 -12
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +0 -92
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +0 -518
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +0 -231
- package/vscode/src/vs/workbench/contrib/chat/common/tools/terminalToolIds.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/chat/common/tools/terminalToolIds.js +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +0 -283
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.d.ts +0 -91
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +0 -340
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +0 -272
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css +0 -686
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css +0 -348
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css +0 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css +0 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookChatEditController.css +0 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookChatEditorOverlay.css +0 -63
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css +0 -63
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css +0 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css +0 -102
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.js +0 -131
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookCellLayoutManager.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookCellLayoutManager.js +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.d.ts +0 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +0 -673
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +0 -37
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.d.ts +0 -354
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2926
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +0 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +0 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.d.ts +0 -200
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +0 -591
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.d.ts +0 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.d.ts +0 -99
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +0 -131
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +0 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +0 -158
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +0 -183
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +0 -66
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +0 -429
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +0 -108
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +0 -221
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +0 -142
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +0 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.d.ts +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +0 -762
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +0 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +0 -357
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +0 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.d.ts +0 -47
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +0 -260
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellWidgets.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellWidgets.js +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.d.ts +0 -182
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +0 -796
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +0 -79
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +0 -126
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +0 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +0 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +0 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +0 -443
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +0 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellEditorPool.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellEditorPool.js +0 -121
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.d.ts +0 -152
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +0 -1288
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.d.ts +0 -59
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +0 -287
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon.d.ts +0 -117
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.d.ts +0 -222
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +0 -1840
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.d.ts +0 -63
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +0 -449
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.d.ts +0 -432
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +0 -2546
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +0 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.d.ts +0 -137
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +0 -646
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +0 -101
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputTextHelper.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputTextHelper.js +0 -111
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +0 -65
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +0 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.d.ts +0 -89
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +0 -472
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +0 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.d.ts +0 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +0 -275
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.d.ts +0 -69
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +0 -269
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.d.ts +0 -125
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +0 -958
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +0 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookCellOverlays.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookCellOverlays.js +0 -101
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +0 -458
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.d.ts +0 -80
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +0 -708
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +0 -193
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookHorizontalTracker.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookHorizontalTracker.js +0 -62
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.d.ts +0 -108
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +0 -717
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +0 -183
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +0 -134
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +0 -135
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.js +0 -213
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +0 -104
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.d.ts +0 -115
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +0 -480
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +0 -87
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -352
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.d.ts +0 -81
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.js +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +0 -19
|
@@ -1,1840 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
3
|
-
import { createElement } from '../../../../../../base/browser/dom.js';
|
|
4
|
-
import { coalesce } from '../../../../../../base/common/arrays.js';
|
|
5
|
-
import { DeferredPromise, runWhenGlobalIdle } from '../../../../../../base/common/async.js';
|
|
6
|
-
import { decodeBase64 } from '../../../../../../base/common/buffer.js';
|
|
7
|
-
import { Emitter } from '../../../../../../base/common/event.js';
|
|
8
|
-
import { getExtensionForMimeType, isTextStreamMime } from '../../../../../../base/common/mime.js';
|
|
9
|
-
import { Schemas, FileAccess, matchesScheme, matchesSomeScheme } from '../../../../../../base/common/network.js';
|
|
10
|
-
import { equals } from '../../../../../../base/common/objects.js';
|
|
11
|
-
import { isAbsolute } from '../../../../../../base/common/path.js';
|
|
12
|
-
import { isWeb, isMacintosh } from '../../../../../../base/common/platform.js';
|
|
13
|
-
import { dirname, isEqual, extname, joinPath } from '../../../../../../base/common/resources.js';
|
|
14
|
-
import { URI } from '../../../../../../base/common/uri.js';
|
|
15
|
-
import { generateUuid } from '../../../../../../base/common/uuid.js';
|
|
16
|
-
import { TokenizationRegistry } from '../../../../../../editor/common/languages.js';
|
|
17
|
-
import { ILanguageService } from '../../../../../../editor/common/languages/language.service.js';
|
|
18
|
-
import { generateTokensCSSForColorMap } from '../../../../../../editor/common/languages/supports/tokenization.js';
|
|
19
|
-
import { tokenizeToString } from '../../../../../../editor/common/languages/textToHtmlTokenizer.js';
|
|
20
|
-
import { localize } from '../../../../../../nls.js';
|
|
21
|
-
import { MenuId } from '../../../../../../platform/actions/common/actions.js';
|
|
22
|
-
import { IConfigurationService } from '../../../../../../platform/configuration/common/configuration.service.js';
|
|
23
|
-
import { IContextKeyService } from '../../../../../../platform/contextkey/common/contextkey.service.js';
|
|
24
|
-
import { IContextMenuService } from '../../../../../../platform/contextview/browser/contextView.service.js';
|
|
25
|
-
import { IFileDialogService } from '../../../../../../platform/dialogs/common/dialogs.service.js';
|
|
26
|
-
import { EditorOpenSource } from '../../../../../../platform/editor/common/editor.js';
|
|
27
|
-
import { IFileService } from '../../../../../../platform/files/common/files.service.js';
|
|
28
|
-
import { extractSelection } from '../../../../../../platform/opener/common/opener.js';
|
|
29
|
-
import { IOpenerService } from '../../../../../../platform/opener/common/opener.service.js';
|
|
30
|
-
import { IStorageService } from '../../../../../../platform/storage/common/storage.service.js';
|
|
31
|
-
import { ITelemetryService } from '../../../../../../platform/telemetry/common/telemetry.service.js';
|
|
32
|
-
import '../../../../../../platform/theme/common/colorUtils.js';
|
|
33
|
-
import '../../../../../../platform/theme/common/colors/baseColors.js';
|
|
34
|
-
import '../../../../../../platform/theme/common/colors/chartsColors.js';
|
|
35
|
-
import { editorFindMatch, editorFindMatchHighlight } from '../../../../../../platform/theme/common/colors/editorColors.js';
|
|
36
|
-
import '../../../../../../platform/theme/common/colors/inputColors.js';
|
|
37
|
-
import '../../../../../../platform/theme/common/colors/listColors.js';
|
|
38
|
-
import '../../../../../../platform/theme/common/colors/menuColors.js';
|
|
39
|
-
import '../../../../../../platform/theme/common/colors/minimapColors.js';
|
|
40
|
-
import '../../../../../../platform/theme/common/colors/miscColors.js';
|
|
41
|
-
import '../../../../../../platform/theme/common/colors/quickpickColors.js';
|
|
42
|
-
import '../../../../../../platform/theme/common/colors/searchColors.js';
|
|
43
|
-
import { Themable } from '../../../../../../platform/theme/common/themeService.js';
|
|
44
|
-
import { IThemeService } from '../../../../../../platform/theme/common/themeService.service.js';
|
|
45
|
-
import { IWorkspaceContextService } from '../../../../../../platform/workspace/common/workspace.service.js';
|
|
46
|
-
import { IWorkspaceTrustManagementService } from '../../../../../../platform/workspace/common/workspaceTrust.service.js';
|
|
47
|
-
import { CellEditState, RenderOutputType } from '../../notebookBrowser.js';
|
|
48
|
-
import { NOTEBOOK_WEBVIEW_BOUNDARY } from '../notebookCellList.js';
|
|
49
|
-
import { preloadsScriptStr } from './webviewPreloads.js';
|
|
50
|
-
import { transformWebviewThemeVars } from './webviewThemeMapping.js';
|
|
51
|
-
import { MarkupCellViewModel } from '../../viewModel/markupCellViewModel.js';
|
|
52
|
-
import { RendererMessagingSpec, CellUri } from '../../../common/notebookCommon.js';
|
|
53
|
-
import { INotebookLoggingService } from '../../../common/notebookLoggingService.service.js';
|
|
54
|
-
import { INotebookService } from '../../../common/notebookService.service.js';
|
|
55
|
-
import { WebviewOriginStore, WebviewContentPurpose } from '../../../../webview/browser/webview.js';
|
|
56
|
-
import { IWebviewService } from '../../../../webview/browser/webview.service.js';
|
|
57
|
-
import { WebviewWindowDragMonitor } from '../../../../webview/browser/webviewWindowDragMonitor.js';
|
|
58
|
-
import { webviewGenericCspSource, asWebviewUri } from '../../../../webview/common/webview.js';
|
|
59
|
-
import { IEditorGroupsService } from '../../../../../services/editor/common/editorGroupsService.service.js';
|
|
60
|
-
import { IEditorService } from '../../../../../services/editor/common/editorService.service.js';
|
|
61
|
-
import { IWorkbenchEnvironmentService } from '../../../../../services/environment/common/environmentService.service.js';
|
|
62
|
-
import { IPathService } from '../../../../../services/path/common/pathService.service.js';
|
|
63
|
-
import { TEXT_BASED_MIMETYPES, getOutputStreamText, getOutputText } from '../../viewModel/cellOutputTextHelper.js';
|
|
64
|
-
|
|
65
|
-
var BackLayerWebView_1;
|
|
66
|
-
const LINE_COLUMN_REGEX = /:([\d]+)(?::([\d]+))?$/;
|
|
67
|
-
const LineQueryRegex = /line=(\d+)$/;
|
|
68
|
-
const FRAGMENT_REGEX = /^(.*)#([^#]*)$/;
|
|
69
|
-
let BackLayerWebView = class BackLayerWebView extends Themable {
|
|
70
|
-
static {
|
|
71
|
-
BackLayerWebView_1 = this;
|
|
72
|
-
}
|
|
73
|
-
static getOriginStore(storageService) {
|
|
74
|
-
this._originStore ??= ( new WebviewOriginStore("notebook.backlayerWebview.origins", storageService));
|
|
75
|
-
return this._originStore;
|
|
76
|
-
}
|
|
77
|
-
constructor(
|
|
78
|
-
notebookEditor,
|
|
79
|
-
id,
|
|
80
|
-
notebookViewType,
|
|
81
|
-
documentUri,
|
|
82
|
-
options,
|
|
83
|
-
rendererMessaging,
|
|
84
|
-
webviewService,
|
|
85
|
-
openerService,
|
|
86
|
-
notebookService,
|
|
87
|
-
contextService,
|
|
88
|
-
environmentService,
|
|
89
|
-
fileDialogService,
|
|
90
|
-
fileService,
|
|
91
|
-
contextMenuService,
|
|
92
|
-
contextKeyService,
|
|
93
|
-
workspaceTrustManagementService,
|
|
94
|
-
configurationService,
|
|
95
|
-
languageService,
|
|
96
|
-
workspaceContextService,
|
|
97
|
-
editorGroupService,
|
|
98
|
-
editorService,
|
|
99
|
-
storageService,
|
|
100
|
-
pathService,
|
|
101
|
-
notebookLogService,
|
|
102
|
-
themeService,
|
|
103
|
-
telemetryService
|
|
104
|
-
) {
|
|
105
|
-
super(themeService);
|
|
106
|
-
this.notebookEditor = notebookEditor;
|
|
107
|
-
this.id = id;
|
|
108
|
-
this.notebookViewType = notebookViewType;
|
|
109
|
-
this.documentUri = documentUri;
|
|
110
|
-
this.options = options;
|
|
111
|
-
this.rendererMessaging = rendererMessaging;
|
|
112
|
-
this.webviewService = webviewService;
|
|
113
|
-
this.openerService = openerService;
|
|
114
|
-
this.notebookService = notebookService;
|
|
115
|
-
this.contextService = contextService;
|
|
116
|
-
this.environmentService = environmentService;
|
|
117
|
-
this.fileDialogService = fileDialogService;
|
|
118
|
-
this.fileService = fileService;
|
|
119
|
-
this.contextMenuService = contextMenuService;
|
|
120
|
-
this.contextKeyService = contextKeyService;
|
|
121
|
-
this.workspaceTrustManagementService = workspaceTrustManagementService;
|
|
122
|
-
this.configurationService = configurationService;
|
|
123
|
-
this.languageService = languageService;
|
|
124
|
-
this.workspaceContextService = workspaceContextService;
|
|
125
|
-
this.editorGroupService = editorGroupService;
|
|
126
|
-
this.editorService = editorService;
|
|
127
|
-
this.storageService = storageService;
|
|
128
|
-
this.pathService = pathService;
|
|
129
|
-
this.notebookLogService = notebookLogService;
|
|
130
|
-
this.telemetryService = telemetryService;
|
|
131
|
-
this.webview = undefined;
|
|
132
|
-
this.insetMapping = ( new Map());
|
|
133
|
-
this.pendingWebviewIdleCreationRequest = ( new Map());
|
|
134
|
-
this.pendingWebviewIdleInsetMapping = ( new Map());
|
|
135
|
-
this.reversedPendingWebviewIdleInsetMapping = ( new Map());
|
|
136
|
-
this.markupPreviewMapping = ( new Map());
|
|
137
|
-
this.hiddenInsetMapping = ( new Set());
|
|
138
|
-
this.reversedInsetMapping = ( new Map());
|
|
139
|
-
this.localResourceRootsCache = undefined;
|
|
140
|
-
this._onMessage = this._register(( new Emitter()));
|
|
141
|
-
this._preloadsCache = ( new Set());
|
|
142
|
-
this.onMessage = this._onMessage.event;
|
|
143
|
-
this._disposed = false;
|
|
144
|
-
this.firstInit = true;
|
|
145
|
-
this.nonce = generateUuid();
|
|
146
|
-
this._logRendererDebugMessage("Creating backlayer webview for notebook");
|
|
147
|
-
this.element = createElement("div");
|
|
148
|
-
this.element.style.height = "1400px";
|
|
149
|
-
this.element.style.position = "absolute";
|
|
150
|
-
if (rendererMessaging) {
|
|
151
|
-
this._register(rendererMessaging);
|
|
152
|
-
rendererMessaging.receiveMessageHandler = (rendererId, message) => {
|
|
153
|
-
if (!this.webview || this._disposed) {
|
|
154
|
-
return Promise.resolve(false);
|
|
155
|
-
}
|
|
156
|
-
this._sendMessageToWebview({
|
|
157
|
-
__vscode_notebook_message: true,
|
|
158
|
-
type: "customRendererMessage",
|
|
159
|
-
rendererId: rendererId,
|
|
160
|
-
message: message
|
|
161
|
-
});
|
|
162
|
-
return Promise.resolve(true);
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
this._register(workspaceTrustManagementService.onDidChangeTrust(e => {
|
|
166
|
-
const baseUrl = this.asWebviewUri(this.getNotebookBaseUri(), undefined);
|
|
167
|
-
const htmlContent = this.generateContent(( baseUrl.toString()));
|
|
168
|
-
this.webview?.setHtml(htmlContent);
|
|
169
|
-
}));
|
|
170
|
-
this._register(TokenizationRegistry.onDidChange(() => {
|
|
171
|
-
this._sendMessageToWebview({
|
|
172
|
-
type: "tokenizedStylesChanged",
|
|
173
|
-
css: getTokenizationCss()
|
|
174
|
-
});
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
updateOptions(options) {
|
|
178
|
-
this.options = options;
|
|
179
|
-
this._updateStyles();
|
|
180
|
-
this._updateOptions();
|
|
181
|
-
}
|
|
182
|
-
_logRendererDebugMessage(msg) {
|
|
183
|
-
this.notebookLogService.debug("BacklayerWebview", `${this.documentUri} (${this.id}) - ${msg}`);
|
|
184
|
-
}
|
|
185
|
-
_updateStyles() {
|
|
186
|
-
this._sendMessageToWebview({
|
|
187
|
-
type: "notebookStyles",
|
|
188
|
-
styles: this._generateStyles()
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
_updateOptions() {
|
|
192
|
-
this._sendMessageToWebview({
|
|
193
|
-
type: "notebookOptions",
|
|
194
|
-
options: {
|
|
195
|
-
dragAndDropEnabled: this.options.dragAndDropEnabled
|
|
196
|
-
},
|
|
197
|
-
renderOptions: {
|
|
198
|
-
lineLimit: this.options.outputLineLimit,
|
|
199
|
-
outputScrolling: this.options.outputScrolling,
|
|
200
|
-
outputWordWrap: this.options.outputWordWrap,
|
|
201
|
-
linkifyFilePaths: this.options.outputLinkifyFilePaths,
|
|
202
|
-
minimalError: this.options.minimalError
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
_generateStyles() {
|
|
207
|
-
return {
|
|
208
|
-
"notebook-output-left-margin": `${this.options.leftMargin + this.options.runGutter}px`,
|
|
209
|
-
"notebook-output-width": `calc(100% - ${this.options.leftMargin + this.options.rightMargin + this.options.runGutter}px)`,
|
|
210
|
-
"notebook-output-node-padding": `${this.options.outputNodePadding}px`,
|
|
211
|
-
"notebook-run-gutter": `${this.options.runGutter}px`,
|
|
212
|
-
"notebook-preview-node-padding": `${this.options.previewNodePadding}px`,
|
|
213
|
-
"notebook-markdown-left-margin": `${this.options.markdownLeftMargin}px`,
|
|
214
|
-
"notebook-output-node-left-padding": `${this.options.outputNodeLeftPadding}px`,
|
|
215
|
-
"notebook-markdown-min-height": `${this.options.previewNodePadding * 2}px`,
|
|
216
|
-
"notebook-markup-font-size": typeof this.options.markupFontSize === "number" && this.options.markupFontSize > 0 ? `${this.options.markupFontSize}px` : `calc(${this.options.fontSize}px * 1.2)`,
|
|
217
|
-
"notebook-markdown-line-height": typeof this.options.markdownLineHeight === "number" && this.options.markdownLineHeight > 0 ? `${this.options.markdownLineHeight}px` : `normal`,
|
|
218
|
-
"notebook-cell-output-font-size": `${this.options.outputFontSize || this.options.fontSize}px`,
|
|
219
|
-
"notebook-cell-output-line-height": `${this.options.outputLineHeight}px`,
|
|
220
|
-
"notebook-cell-output-max-height": `${this.options.outputLineHeight * this.options.outputLineLimit + 2}px`,
|
|
221
|
-
"notebook-cell-output-font-family": this.options.outputFontFamily || this.options.fontFamily,
|
|
222
|
-
"notebook-cell-markup-empty-content": ( localize(14843, "Empty markdown cell, double-click or press enter to edit.")),
|
|
223
|
-
"notebook-cell-renderer-not-found-error": ( localize(14844, "No renderer found for '$0'")),
|
|
224
|
-
"notebook-cell-renderer-fallbacks-exhausted": ( localize(14845, "Could not render content for '$0'")),
|
|
225
|
-
"notebook-markup-font-family": this.options.markupFontFamily
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
generateContent(baseUrl) {
|
|
229
|
-
const renderersData = this.getRendererData();
|
|
230
|
-
const preloadsData = this.getStaticPreloadsData();
|
|
231
|
-
const renderOptions = {
|
|
232
|
-
lineLimit: this.options.outputLineLimit,
|
|
233
|
-
outputScrolling: this.options.outputScrolling,
|
|
234
|
-
outputWordWrap: this.options.outputWordWrap,
|
|
235
|
-
linkifyFilePaths: this.options.outputLinkifyFilePaths,
|
|
236
|
-
minimalError: this.options.minimalError
|
|
237
|
-
};
|
|
238
|
-
const preloadScript = preloadsScriptStr({
|
|
239
|
-
...this.options,
|
|
240
|
-
tokenizationCss: getTokenizationCss()
|
|
241
|
-
}, {
|
|
242
|
-
dragAndDropEnabled: this.options.dragAndDropEnabled
|
|
243
|
-
}, renderOptions, renderersData, preloadsData, this.workspaceTrustManagementService.isWorkspaceTrusted(), this.nonce);
|
|
244
|
-
const enableCsp = this.configurationService.getValue("notebook.experimental.enableCsp");
|
|
245
|
-
const currentHighlight = this.getColor(editorFindMatch);
|
|
246
|
-
const findMatchHighlight = this.getColor(editorFindMatchHighlight);
|
|
247
|
-
return (
|
|
248
|
-
`
|
|
249
|
-
<html lang="en">
|
|
250
|
-
<head>
|
|
251
|
-
<meta charset="UTF-8">
|
|
252
|
-
<base href="${baseUrl}/" />
|
|
253
|
-
${enableCsp ? `<meta http-equiv="Content-Security-Policy" content="
|
|
254
|
-
default-src 'none';
|
|
255
|
-
script-src ${webviewGenericCspSource} 'unsafe-inline' 'unsafe-eval';
|
|
256
|
-
style-src ${webviewGenericCspSource} 'unsafe-inline';
|
|
257
|
-
img-src ${webviewGenericCspSource} https: http: data:;
|
|
258
|
-
font-src ${webviewGenericCspSource} https:;
|
|
259
|
-
connect-src https:;
|
|
260
|
-
child-src https: data:;
|
|
261
|
-
">` : ""}
|
|
262
|
-
<style nonce="${this.nonce}">
|
|
263
|
-
::highlight(find-highlight) {
|
|
264
|
-
background-color: var(--vscode-editor-findMatchBackground, ${findMatchHighlight});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
::highlight(current-find-highlight) {
|
|
268
|
-
background-color: var(--vscode-editor-findMatchHighlightBackground, ${currentHighlight});
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
#container .cell_container {
|
|
272
|
-
width: 100%;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
#container .output_container {
|
|
276
|
-
width: 100%;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
#container .cell_container.nb-insertHighlight div.output_container div.output {
|
|
280
|
-
background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
#container > div > div > div.output {
|
|
284
|
-
font-size: var(--notebook-cell-output-font-size);
|
|
285
|
-
width: var(--notebook-output-width);
|
|
286
|
-
margin-left: var(--notebook-output-left-margin);
|
|
287
|
-
background-color: var(--theme-notebook-output-background);
|
|
288
|
-
padding-top: var(--notebook-output-node-padding);
|
|
289
|
-
padding-right: var(--notebook-output-node-padding);
|
|
290
|
-
padding-bottom: var(--notebook-output-node-padding);
|
|
291
|
-
padding-left: var(--notebook-output-node-left-padding);
|
|
292
|
-
box-sizing: border-box;
|
|
293
|
-
border-top: none;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/* markdown */
|
|
297
|
-
#container div.preview {
|
|
298
|
-
width: 100%;
|
|
299
|
-
padding-right: var(--notebook-preview-node-padding);
|
|
300
|
-
padding-left: var(--notebook-markdown-left-margin);
|
|
301
|
-
padding-top: var(--notebook-preview-node-padding);
|
|
302
|
-
padding-bottom: var(--notebook-preview-node-padding);
|
|
303
|
-
|
|
304
|
-
box-sizing: border-box;
|
|
305
|
-
white-space: nowrap;
|
|
306
|
-
overflow: hidden;
|
|
307
|
-
white-space: initial;
|
|
308
|
-
|
|
309
|
-
font-size: var(--notebook-markup-font-size);
|
|
310
|
-
line-height: var(--notebook-markdown-line-height);
|
|
311
|
-
color: var(--theme-ui-foreground);
|
|
312
|
-
font-family: var(--notebook-markup-font-family);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
#container div.preview.draggable {
|
|
316
|
-
user-select: none;
|
|
317
|
-
-webkit-user-select: none;
|
|
318
|
-
-ms-user-select: none;
|
|
319
|
-
cursor: grab;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
#container div.preview.selected {
|
|
323
|
-
background: var(--theme-notebook-cell-selected-background);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
#container div.preview.dragging {
|
|
327
|
-
background-color: var(--theme-background);
|
|
328
|
-
opacity: 0.5 !important;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex img,
|
|
332
|
-
.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex-block img {
|
|
333
|
-
filter: brightness(0) invert(1)
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
#container .markup > div.nb-symbolHighlight {
|
|
337
|
-
background-color: var(--theme-notebook-symbol-highlight-background);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
#container .markup > div.nb-insertHighlight {
|
|
341
|
-
background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
#container .nb-symbolHighlight .output_container .output {
|
|
345
|
-
background-color: var(--theme-notebook-symbol-highlight-background);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
#container .markup > div.nb-multiCellHighlight {
|
|
349
|
-
background-color: var(--theme-notebook-symbol-highlight-background);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
#container .nb-multiCellHighlight .output_container .output {
|
|
353
|
-
background-color: var(--theme-notebook-symbol-highlight-background);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
#container .nb-chatGenerationHighlight .output_container .output {
|
|
357
|
-
background-color: var(--vscode-notebook-selectedCellBackground);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
#container > div.nb-cellDeleted .output_container {
|
|
361
|
-
background-color: var(--theme-notebook-diff-removed-background);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
#container > div.nb-cellAdded .output_container {
|
|
365
|
-
background-color: var(--theme-notebook-diff-inserted-background);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
#container > div > div:not(.preview) > div {
|
|
369
|
-
overflow-x: auto;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
#container .no-renderer-error {
|
|
373
|
-
color: var(--vscode-editorError-foreground);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
body {
|
|
377
|
-
padding: 0px;
|
|
378
|
-
height: 100%;
|
|
379
|
-
width: 100%;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
table, thead, tr, th, td, tbody {
|
|
383
|
-
border: none;
|
|
384
|
-
border-color: transparent;
|
|
385
|
-
border-spacing: 0;
|
|
386
|
-
border-collapse: collapse;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
table, th, tr {
|
|
390
|
-
vertical-align: middle;
|
|
391
|
-
text-align: right;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
thead {
|
|
395
|
-
font-weight: bold;
|
|
396
|
-
background-color: rgba(130, 130, 130, 0.16);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
th, td {
|
|
400
|
-
padding: 4px 8px;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
tr:nth-child(even) {
|
|
404
|
-
background-color: rgba(130, 130, 130, 0.08);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
tbody th {
|
|
408
|
-
font-weight: normal;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
.find-match {
|
|
412
|
-
background-color: var(--vscode-editor-findMatchHighlightBackground);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
.current-find-match {
|
|
416
|
-
background-color: var(--vscode-editor-findMatchBackground);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
#_defaultColorPalatte {
|
|
420
|
-
color: var(--vscode-editor-findMatchHighlightBackground);
|
|
421
|
-
background-color: var(--vscode-editor-findMatchBackground);
|
|
422
|
-
}
|
|
423
|
-
</style>
|
|
424
|
-
</head>
|
|
425
|
-
<body style="overflow: hidden;">
|
|
426
|
-
<div id='findStart' tabIndex=-1></div>
|
|
427
|
-
<div id='container' class="widgetarea" style="position: absolute;width:100%;top: 0px"></div>
|
|
428
|
-
<div id="_defaultColorPalatte"></div>
|
|
429
|
-
<script type="module">${preloadScript}</script>
|
|
430
|
-
</body>
|
|
431
|
-
</html>`
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
getRendererData() {
|
|
435
|
-
return ( this.notebookService.getRenderers().map(renderer => {
|
|
436
|
-
const entrypoint = {
|
|
437
|
-
extends: renderer.entrypoint.extends,
|
|
438
|
-
path: ( this.asWebviewUri(renderer.entrypoint.path, renderer.extensionLocation).toString())
|
|
439
|
-
};
|
|
440
|
-
return {
|
|
441
|
-
id: renderer.id,
|
|
442
|
-
entrypoint,
|
|
443
|
-
mimeTypes: renderer.mimeTypes,
|
|
444
|
-
messaging: renderer.messaging !== RendererMessagingSpec.Never && !!this.rendererMessaging,
|
|
445
|
-
isBuiltin: renderer.isBuiltin
|
|
446
|
-
};
|
|
447
|
-
}));
|
|
448
|
-
}
|
|
449
|
-
getStaticPreloadsData() {
|
|
450
|
-
return Array.from(
|
|
451
|
-
this.notebookService.getStaticPreloads(this.notebookViewType),
|
|
452
|
-
preload => {
|
|
453
|
-
return {
|
|
454
|
-
entrypoint: ( ( this.asWebviewUri(preload.entrypoint, preload.extensionLocation).toString()).toString())
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
asWebviewUri(uri, fromExtension) {
|
|
460
|
-
return asWebviewUri(uri, fromExtension?.scheme === Schemas.vscodeRemote ? {
|
|
461
|
-
isRemote: true,
|
|
462
|
-
authority: fromExtension.authority
|
|
463
|
-
} : undefined);
|
|
464
|
-
}
|
|
465
|
-
postKernelMessage(message) {
|
|
466
|
-
this._sendMessageToWebview({
|
|
467
|
-
__vscode_notebook_message: true,
|
|
468
|
-
type: "customKernelMessage",
|
|
469
|
-
message
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
resolveOutputId(id) {
|
|
473
|
-
const output = this.reversedInsetMapping.get(id);
|
|
474
|
-
if (!output) {
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
const cellInfo = this.insetMapping.get(output).cellInfo;
|
|
478
|
-
return {
|
|
479
|
-
cellInfo,
|
|
480
|
-
output
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
isResolved() {
|
|
484
|
-
return !!this.webview;
|
|
485
|
-
}
|
|
486
|
-
createWebview(targetWindow) {
|
|
487
|
-
const baseUrl = this.asWebviewUri(this.getNotebookBaseUri(), undefined);
|
|
488
|
-
const htmlContent = this.generateContent(( baseUrl.toString()));
|
|
489
|
-
return this._initialize(htmlContent, targetWindow);
|
|
490
|
-
}
|
|
491
|
-
getNotebookBaseUri() {
|
|
492
|
-
if (this.documentUri.scheme === Schemas.untitled) {
|
|
493
|
-
const folder = this.workspaceContextService.getWorkspaceFolder(this.documentUri);
|
|
494
|
-
if (folder) {
|
|
495
|
-
return folder.uri;
|
|
496
|
-
}
|
|
497
|
-
const folders = this.workspaceContextService.getWorkspace().folders;
|
|
498
|
-
if (folders.length) {
|
|
499
|
-
return folders[0].uri;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
return dirname(this.documentUri);
|
|
503
|
-
}
|
|
504
|
-
getBuiltinLocalResourceRoots() {
|
|
505
|
-
if (!this.documentUri.path.toLowerCase().endsWith(".ipynb")) {
|
|
506
|
-
return [];
|
|
507
|
-
}
|
|
508
|
-
if (isWeb) {
|
|
509
|
-
return [];
|
|
510
|
-
}
|
|
511
|
-
return [dirname(( FileAccess.asFileUri("vs/nls.js")))];
|
|
512
|
-
}
|
|
513
|
-
_initialize(content, targetWindow) {
|
|
514
|
-
if (!this.element.isConnected) {
|
|
515
|
-
throw ( new Error("Element is already detached from the DOM tree"));
|
|
516
|
-
}
|
|
517
|
-
this.webview = this._createInset(this.webviewService, content);
|
|
518
|
-
this.webview.mountTo(this.element, targetWindow);
|
|
519
|
-
this._register(this.webview);
|
|
520
|
-
this._register(( new WebviewWindowDragMonitor(targetWindow, () => this.webview)));
|
|
521
|
-
const initializePromise = ( new DeferredPromise());
|
|
522
|
-
this._register(this.webview.onFatalError(e => {
|
|
523
|
-
initializePromise.error(( new Error(`Could not initialize webview: ${e.message}}`)));
|
|
524
|
-
}));
|
|
525
|
-
this._register(this.webview.onMessage(async message => {
|
|
526
|
-
const data = message.message;
|
|
527
|
-
if (this._disposed) {
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
if (!data.__vscode_notebook_message) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
switch (data.type) {
|
|
534
|
-
case "initialized":
|
|
535
|
-
{
|
|
536
|
-
initializePromise.complete();
|
|
537
|
-
this.initializeWebViewState();
|
|
538
|
-
break;
|
|
539
|
-
}
|
|
540
|
-
case "initializedMarkup":
|
|
541
|
-
{
|
|
542
|
-
if (this.initializeMarkupPromise?.requestId === data.requestId) {
|
|
543
|
-
this.initializeMarkupPromise?.p.complete();
|
|
544
|
-
this.initializeMarkupPromise = undefined;
|
|
545
|
-
}
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
548
|
-
case "dimension":
|
|
549
|
-
{
|
|
550
|
-
for (const update of data.updates) {
|
|
551
|
-
const height = update.height;
|
|
552
|
-
if (update.isOutput) {
|
|
553
|
-
const resolvedResult = this.resolveOutputId(update.id);
|
|
554
|
-
if (resolvedResult) {
|
|
555
|
-
const {
|
|
556
|
-
cellInfo,
|
|
557
|
-
output
|
|
558
|
-
} = resolvedResult;
|
|
559
|
-
this.notebookEditor.updateOutputHeight(cellInfo, output, height, !!update.init, "webview#dimension");
|
|
560
|
-
this.notebookEditor.scheduleOutputHeightAck(cellInfo, update.id, height);
|
|
561
|
-
} else if (update.init) {
|
|
562
|
-
const outputRequest = this.reversedPendingWebviewIdleInsetMapping.get(update.id);
|
|
563
|
-
if (outputRequest) {
|
|
564
|
-
const inset = this.pendingWebviewIdleInsetMapping.get(outputRequest);
|
|
565
|
-
this.pendingWebviewIdleCreationRequest.delete(outputRequest);
|
|
566
|
-
this.pendingWebviewIdleCreationRequest.delete(outputRequest);
|
|
567
|
-
const cellInfo = inset.cellInfo;
|
|
568
|
-
this.reversedInsetMapping.set(update.id, outputRequest);
|
|
569
|
-
this.insetMapping.set(outputRequest, inset);
|
|
570
|
-
this.notebookEditor.updateOutputHeight(cellInfo, outputRequest, height, !!update.init, "webview#dimension");
|
|
571
|
-
this.notebookEditor.scheduleOutputHeightAck(cellInfo, update.id, height);
|
|
572
|
-
}
|
|
573
|
-
this.reversedPendingWebviewIdleInsetMapping.delete(update.id);
|
|
574
|
-
}
|
|
575
|
-
{
|
|
576
|
-
if (!update.init) {
|
|
577
|
-
continue;
|
|
578
|
-
}
|
|
579
|
-
const output = this.reversedInsetMapping.get(update.id);
|
|
580
|
-
if (!output) {
|
|
581
|
-
continue;
|
|
582
|
-
}
|
|
583
|
-
const inset = this.insetMapping.get(output);
|
|
584
|
-
inset.initialized = true;
|
|
585
|
-
}
|
|
586
|
-
} else {
|
|
587
|
-
this.notebookEditor.updateMarkupCellHeight(update.id, height, !!update.init);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
break;
|
|
591
|
-
}
|
|
592
|
-
case "mouseenter":
|
|
593
|
-
{
|
|
594
|
-
const resolvedResult = this.resolveOutputId(data.id);
|
|
595
|
-
if (resolvedResult) {
|
|
596
|
-
const latestCell = this.notebookEditor.getCellByInfo(resolvedResult.cellInfo);
|
|
597
|
-
if (latestCell) {
|
|
598
|
-
latestCell.outputIsHovered = true;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
break;
|
|
602
|
-
}
|
|
603
|
-
case "mouseleave":
|
|
604
|
-
{
|
|
605
|
-
const resolvedResult = this.resolveOutputId(data.id);
|
|
606
|
-
if (resolvedResult) {
|
|
607
|
-
const latestCell = this.notebookEditor.getCellByInfo(resolvedResult.cellInfo);
|
|
608
|
-
if (latestCell) {
|
|
609
|
-
latestCell.outputIsHovered = false;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
break;
|
|
613
|
-
}
|
|
614
|
-
case "outputFocus":
|
|
615
|
-
{
|
|
616
|
-
const resolvedResult = this.resolveOutputId(data.id);
|
|
617
|
-
if (resolvedResult) {
|
|
618
|
-
const latestCell = this.notebookEditor.getCellByInfo(resolvedResult.cellInfo);
|
|
619
|
-
if (latestCell) {
|
|
620
|
-
latestCell.outputIsFocused = true;
|
|
621
|
-
this.notebookEditor.focusNotebookCell(latestCell, "output", {
|
|
622
|
-
outputId: resolvedResult.output.model.outputId,
|
|
623
|
-
skipReveal: true,
|
|
624
|
-
outputWebviewFocused: true
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
630
|
-
case "outputBlur":
|
|
631
|
-
{
|
|
632
|
-
const resolvedResult = this.resolveOutputId(data.id);
|
|
633
|
-
if (resolvedResult) {
|
|
634
|
-
const latestCell = this.notebookEditor.getCellByInfo(resolvedResult.cellInfo);
|
|
635
|
-
if (latestCell) {
|
|
636
|
-
latestCell.outputIsFocused = false;
|
|
637
|
-
latestCell.inputInOutputIsFocused = false;
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
break;
|
|
641
|
-
}
|
|
642
|
-
case "scroll-ack":
|
|
643
|
-
{
|
|
644
|
-
break;
|
|
645
|
-
}
|
|
646
|
-
case "scroll-to-reveal":
|
|
647
|
-
{
|
|
648
|
-
this.notebookEditor.setScrollTop(data.scrollTop - NOTEBOOK_WEBVIEW_BOUNDARY);
|
|
649
|
-
break;
|
|
650
|
-
}
|
|
651
|
-
case "did-scroll-wheel":
|
|
652
|
-
{
|
|
653
|
-
this.notebookEditor.triggerScroll({
|
|
654
|
-
...data.payload,
|
|
655
|
-
preventDefault: () => {},
|
|
656
|
-
stopPropagation: () => {}
|
|
657
|
-
});
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
case "focus-editor":
|
|
661
|
-
{
|
|
662
|
-
const cell = this.notebookEditor.getCellById(data.cellId);
|
|
663
|
-
if (cell) {
|
|
664
|
-
if (data.focusNext) {
|
|
665
|
-
this.notebookEditor.focusNextNotebookCell(cell, "editor");
|
|
666
|
-
} else {
|
|
667
|
-
await this.notebookEditor.focusNotebookCell(cell, "editor");
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
break;
|
|
671
|
-
}
|
|
672
|
-
case "clicked-data-url":
|
|
673
|
-
{
|
|
674
|
-
this._onDidClickDataLink(data);
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
case "clicked-link":
|
|
678
|
-
{
|
|
679
|
-
if (matchesScheme(data.href, Schemas.command)) {
|
|
680
|
-
const uri = ( URI.parse(data.href));
|
|
681
|
-
if (uri.path === "workbench.action.openLargeOutput") {
|
|
682
|
-
const outputId = uri.query;
|
|
683
|
-
const group = this.editorGroupService.activeGroup;
|
|
684
|
-
if (group) {
|
|
685
|
-
if (group.activeEditor) {
|
|
686
|
-
group.pinEditor(group.activeEditor);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
this.openerService.open(CellUri.generateCellOutputUriWithId(this.documentUri, outputId));
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
if (uri.path === "cellOutput.enableScrolling") {
|
|
693
|
-
const outputId = uri.query;
|
|
694
|
-
const cell = this.reversedInsetMapping.get(outputId);
|
|
695
|
-
if (cell) {
|
|
696
|
-
this.telemetryService.publicLog2("workbenchActionExecuted", {
|
|
697
|
-
id: "notebook.cell.toggleOutputScrolling",
|
|
698
|
-
from: "inlineLink"
|
|
699
|
-
});
|
|
700
|
-
cell.cellViewModel.outputsViewModels.forEach(vm => {
|
|
701
|
-
if (vm.model.metadata) {
|
|
702
|
-
vm.model.metadata["scrollable"] = true;
|
|
703
|
-
vm.resetRenderer();
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
this.openerService.open(data.href, {
|
|
710
|
-
fromUserGesture: true,
|
|
711
|
-
fromWorkspace: true,
|
|
712
|
-
allowCommands: [
|
|
713
|
-
"github-issues.authNow",
|
|
714
|
-
"workbench.extensions.search",
|
|
715
|
-
"workbench.action.openSettings",
|
|
716
|
-
"_notebook.selectKernel",
|
|
717
|
-
"jupyter.viewOutput",
|
|
718
|
-
"jupyter.createPythonEnvAndSelectController"
|
|
719
|
-
]
|
|
720
|
-
});
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
if (matchesSomeScheme(data.href, Schemas.http, Schemas.https, Schemas.mailto)) {
|
|
724
|
-
this.openerService.open(data.href, {
|
|
725
|
-
fromUserGesture: true,
|
|
726
|
-
fromWorkspace: true
|
|
727
|
-
});
|
|
728
|
-
} else if (matchesScheme(data.href, Schemas.vscodeNotebookCell)) {
|
|
729
|
-
const uri = ( URI.parse(data.href));
|
|
730
|
-
await this._handleNotebookCellResource(uri);
|
|
731
|
-
} else if (!/^[\w\-]+:/.test(data.href)) {
|
|
732
|
-
await this._handleResourceOpening(tryDecodeURIComponent(data.href));
|
|
733
|
-
} else {
|
|
734
|
-
if (isAbsolute(data.href)) {
|
|
735
|
-
await this._openUri(URI.file(data.href));
|
|
736
|
-
} else {
|
|
737
|
-
await this._openUri(( URI.parse(data.href)));
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
break;
|
|
741
|
-
}
|
|
742
|
-
case "customKernelMessage":
|
|
743
|
-
{
|
|
744
|
-
this._onMessage.fire({
|
|
745
|
-
message: data.message
|
|
746
|
-
});
|
|
747
|
-
break;
|
|
748
|
-
}
|
|
749
|
-
case "customRendererMessage":
|
|
750
|
-
{
|
|
751
|
-
this.rendererMessaging?.postMessage(data.rendererId, data.message);
|
|
752
|
-
break;
|
|
753
|
-
}
|
|
754
|
-
case "clickMarkupCell":
|
|
755
|
-
{
|
|
756
|
-
const cell = this.notebookEditor.getCellById(data.cellId);
|
|
757
|
-
if (cell) {
|
|
758
|
-
if (data.shiftKey || (isMacintosh ? data.metaKey : data.ctrlKey)) {
|
|
759
|
-
this.notebookEditor.toggleNotebookCellSelection(cell, data.shiftKey);
|
|
760
|
-
} else {
|
|
761
|
-
await this.notebookEditor.focusNotebookCell(cell, "container", {
|
|
762
|
-
skipReveal: true
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
break;
|
|
767
|
-
}
|
|
768
|
-
case "contextMenuMarkupCell":
|
|
769
|
-
{
|
|
770
|
-
const cell = this.notebookEditor.getCellById(data.cellId);
|
|
771
|
-
if (cell) {
|
|
772
|
-
await this.notebookEditor.focusNotebookCell(cell, "container", {
|
|
773
|
-
skipReveal: true
|
|
774
|
-
});
|
|
775
|
-
const webviewRect = this.element.getBoundingClientRect();
|
|
776
|
-
this.contextMenuService.showContextMenu({
|
|
777
|
-
menuId: MenuId.NotebookCellTitle,
|
|
778
|
-
contextKeyService: this.contextKeyService,
|
|
779
|
-
getAnchor: () => ({
|
|
780
|
-
x: webviewRect.x + data.clientX,
|
|
781
|
-
y: webviewRect.y + data.clientY
|
|
782
|
-
})
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
break;
|
|
786
|
-
}
|
|
787
|
-
case "toggleMarkupPreview":
|
|
788
|
-
{
|
|
789
|
-
const cell = this.notebookEditor.getCellById(data.cellId);
|
|
790
|
-
if (cell && !this.notebookEditor.creationOptions.isReadOnly) {
|
|
791
|
-
this.notebookEditor.setMarkupCellEditState(data.cellId, CellEditState.Editing);
|
|
792
|
-
await this.notebookEditor.focusNotebookCell(cell, "editor", {
|
|
793
|
-
skipReveal: true
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
break;
|
|
797
|
-
}
|
|
798
|
-
case "mouseEnterMarkupCell":
|
|
799
|
-
{
|
|
800
|
-
const cell = this.notebookEditor.getCellById(data.cellId);
|
|
801
|
-
if (cell instanceof MarkupCellViewModel) {
|
|
802
|
-
cell.cellIsHovered = true;
|
|
803
|
-
}
|
|
804
|
-
break;
|
|
805
|
-
}
|
|
806
|
-
case "mouseLeaveMarkupCell":
|
|
807
|
-
{
|
|
808
|
-
const cell = this.notebookEditor.getCellById(data.cellId);
|
|
809
|
-
if (cell instanceof MarkupCellViewModel) {
|
|
810
|
-
cell.cellIsHovered = false;
|
|
811
|
-
}
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
814
|
-
case "cell-drag-start":
|
|
815
|
-
{
|
|
816
|
-
this.notebookEditor.didStartDragMarkupCell(data.cellId, data);
|
|
817
|
-
break;
|
|
818
|
-
}
|
|
819
|
-
case "cell-drag":
|
|
820
|
-
{
|
|
821
|
-
this.notebookEditor.didDragMarkupCell(data.cellId, data);
|
|
822
|
-
break;
|
|
823
|
-
}
|
|
824
|
-
case "cell-drop":
|
|
825
|
-
{
|
|
826
|
-
this.notebookEditor.didDropMarkupCell(data.cellId, {
|
|
827
|
-
dragOffsetY: data.dragOffsetY,
|
|
828
|
-
ctrlKey: data.ctrlKey,
|
|
829
|
-
altKey: data.altKey
|
|
830
|
-
});
|
|
831
|
-
break;
|
|
832
|
-
}
|
|
833
|
-
case "cell-drag-end":
|
|
834
|
-
{
|
|
835
|
-
this.notebookEditor.didEndDragMarkupCell(data.cellId);
|
|
836
|
-
break;
|
|
837
|
-
}
|
|
838
|
-
case "renderedMarkup":
|
|
839
|
-
{
|
|
840
|
-
const cell = this.notebookEditor.getCellById(data.cellId);
|
|
841
|
-
if (cell instanceof MarkupCellViewModel) {
|
|
842
|
-
cell.renderedHtml = data.html;
|
|
843
|
-
}
|
|
844
|
-
this._handleHighlightCodeBlock(data.codeBlocks);
|
|
845
|
-
break;
|
|
846
|
-
}
|
|
847
|
-
case "renderedCellOutput":
|
|
848
|
-
{
|
|
849
|
-
this._handleHighlightCodeBlock(data.codeBlocks);
|
|
850
|
-
break;
|
|
851
|
-
}
|
|
852
|
-
case "outputResized":
|
|
853
|
-
{
|
|
854
|
-
this.notebookEditor.didResizeOutput(data.cellId);
|
|
855
|
-
break;
|
|
856
|
-
}
|
|
857
|
-
case "getOutputItem":
|
|
858
|
-
{
|
|
859
|
-
const resolvedResult = this.resolveOutputId(data.outputId);
|
|
860
|
-
const output = resolvedResult?.output.model.outputs.find(output => output.mime === data.mime);
|
|
861
|
-
this._sendMessageToWebview({
|
|
862
|
-
type: "returnOutputItem",
|
|
863
|
-
requestId: data.requestId,
|
|
864
|
-
output: output ? {
|
|
865
|
-
mime: output.mime,
|
|
866
|
-
valueBytes: output.data.buffer
|
|
867
|
-
} : undefined
|
|
868
|
-
});
|
|
869
|
-
break;
|
|
870
|
-
}
|
|
871
|
-
case "logRendererDebugMessage":
|
|
872
|
-
{
|
|
873
|
-
this._logRendererDebugMessage(
|
|
874
|
-
`${data.message}${data.data ? " " + JSON.stringify(data.data, null, 4) : ""}`
|
|
875
|
-
);
|
|
876
|
-
break;
|
|
877
|
-
}
|
|
878
|
-
case "notebookPerformanceMessage":
|
|
879
|
-
{
|
|
880
|
-
this.notebookEditor.updatePerformanceMetadata(data.cellId, data.executionId, data.duration, data.rendererId);
|
|
881
|
-
if (data.outputSize && data.rendererId === "vscode.builtin-renderer") {
|
|
882
|
-
this._sendPerformanceData(data.outputSize, data.duration);
|
|
883
|
-
}
|
|
884
|
-
break;
|
|
885
|
-
}
|
|
886
|
-
case "outputInputFocus":
|
|
887
|
-
{
|
|
888
|
-
const resolvedResult = this.resolveOutputId(data.id);
|
|
889
|
-
if (resolvedResult) {
|
|
890
|
-
const latestCell = this.notebookEditor.getCellByInfo(resolvedResult.cellInfo);
|
|
891
|
-
if (latestCell) {
|
|
892
|
-
latestCell.inputInOutputIsFocused = data.inputFocused;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
this.notebookEditor.didFocusOutputInputChange(data.inputFocused);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
}));
|
|
899
|
-
return initializePromise.p;
|
|
900
|
-
}
|
|
901
|
-
_sendPerformanceData(outputSize, renderTime) {
|
|
902
|
-
const telemetryData = {
|
|
903
|
-
outputSize,
|
|
904
|
-
renderTime
|
|
905
|
-
};
|
|
906
|
-
this.telemetryService.publicLog2("NotebookCellOutputRender", telemetryData);
|
|
907
|
-
}
|
|
908
|
-
_handleNotebookCellResource(uri) {
|
|
909
|
-
const notebookResource = uri.path.length > 0 ? uri : this.documentUri;
|
|
910
|
-
const lineMatch = /(?:^|&)line=([^&]+)/.exec(uri.query);
|
|
911
|
-
let editorOptions = undefined;
|
|
912
|
-
if (lineMatch) {
|
|
913
|
-
const parsedLineNumber = parseInt(lineMatch[1], 10);
|
|
914
|
-
if (!isNaN(parsedLineNumber)) {
|
|
915
|
-
const lineNumber = parsedLineNumber;
|
|
916
|
-
editorOptions = {
|
|
917
|
-
selection: {
|
|
918
|
-
startLineNumber: lineNumber,
|
|
919
|
-
startColumn: 1
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
const executionMatch = /(?:^|&)execution_count=([^&]+)/.exec(uri.query);
|
|
925
|
-
if (executionMatch) {
|
|
926
|
-
const executionCount = parseInt(executionMatch[1], 10);
|
|
927
|
-
if (!isNaN(executionCount)) {
|
|
928
|
-
const notebookModel = this.notebookService.getNotebookTextModel(notebookResource);
|
|
929
|
-
const cell = notebookModel?.cells.slice().reverse().find(cell => {
|
|
930
|
-
return cell.internalMetadata.executionOrder === executionCount;
|
|
931
|
-
});
|
|
932
|
-
if (cell?.uri) {
|
|
933
|
-
return this.openerService.open(cell.uri, {
|
|
934
|
-
fromUserGesture: true,
|
|
935
|
-
fromWorkspace: true,
|
|
936
|
-
editorOptions: editorOptions
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
const fragmentLineMatch = /\?line=(\d+)$/.exec(uri.fragment);
|
|
942
|
-
if (fragmentLineMatch) {
|
|
943
|
-
const parsedLineNumber = parseInt(fragmentLineMatch[1], 10);
|
|
944
|
-
if (!isNaN(parsedLineNumber)) {
|
|
945
|
-
const lineNumber = parsedLineNumber + 1;
|
|
946
|
-
const fragment = uri.fragment.substring(0, fragmentLineMatch.index);
|
|
947
|
-
const editorOptions = {
|
|
948
|
-
selection: {
|
|
949
|
-
startLineNumber: lineNumber,
|
|
950
|
-
startColumn: 1,
|
|
951
|
-
endLineNumber: lineNumber,
|
|
952
|
-
endColumn: 1
|
|
953
|
-
}
|
|
954
|
-
};
|
|
955
|
-
return this.openerService.open(notebookResource.with({
|
|
956
|
-
fragment
|
|
957
|
-
}), {
|
|
958
|
-
fromUserGesture: true,
|
|
959
|
-
fromWorkspace: true,
|
|
960
|
-
editorOptions: editorOptions
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
return this.openerService.open(notebookResource, {
|
|
965
|
-
fromUserGesture: true,
|
|
966
|
-
fromWorkspace: true
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
async _handleResourceOpening(href) {
|
|
970
|
-
let linkToOpen = undefined;
|
|
971
|
-
let fragment = undefined;
|
|
972
|
-
const hrefWithFragment = FRAGMENT_REGEX.exec(href);
|
|
973
|
-
if (hrefWithFragment) {
|
|
974
|
-
href = hrefWithFragment[1];
|
|
975
|
-
fragment = hrefWithFragment[2];
|
|
976
|
-
}
|
|
977
|
-
if (href.startsWith("/")) {
|
|
978
|
-
linkToOpen = await this.pathService.fileURI(href);
|
|
979
|
-
const folders = this.workspaceContextService.getWorkspace().folders;
|
|
980
|
-
if (folders.length) {
|
|
981
|
-
linkToOpen = linkToOpen.with({
|
|
982
|
-
scheme: folders[0].uri.scheme,
|
|
983
|
-
authority: folders[0].uri.authority
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
} else if (href.startsWith("~")) {
|
|
987
|
-
const userHome = await this.pathService.userHome();
|
|
988
|
-
if (userHome) {
|
|
989
|
-
linkToOpen = URI.joinPath(userHome, href.substring(2));
|
|
990
|
-
}
|
|
991
|
-
} else {
|
|
992
|
-
if (this.documentUri.scheme === Schemas.untitled) {
|
|
993
|
-
const folders = this.workspaceContextService.getWorkspace().folders;
|
|
994
|
-
if (!folders.length) {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
linkToOpen = URI.joinPath(folders[0].uri, href);
|
|
998
|
-
} else {
|
|
999
|
-
linkToOpen = URI.joinPath(dirname(this.documentUri), href);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
if (linkToOpen) {
|
|
1003
|
-
if (fragment) {
|
|
1004
|
-
linkToOpen = linkToOpen.with({
|
|
1005
|
-
fragment
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
await this._openUri(linkToOpen);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
async _openUri(uri) {
|
|
1012
|
-
let lineNumber = undefined;
|
|
1013
|
-
let column = undefined;
|
|
1014
|
-
const lineCol = LINE_COLUMN_REGEX.exec(uri.path);
|
|
1015
|
-
if (lineCol) {
|
|
1016
|
-
uri = uri.with({
|
|
1017
|
-
path: uri.path.slice(0, lineCol.index),
|
|
1018
|
-
fragment: `L${lineCol[0].slice(1)}`
|
|
1019
|
-
});
|
|
1020
|
-
lineNumber = parseInt(lineCol[1], 10);
|
|
1021
|
-
column = lineCol[2] ? parseInt(lineCol[2], 10) : 1;
|
|
1022
|
-
}
|
|
1023
|
-
const lineMatch = LineQueryRegex.exec(uri.query);
|
|
1024
|
-
if (lineMatch) {
|
|
1025
|
-
const parsedLineNumber = parseInt(lineMatch[1], 10);
|
|
1026
|
-
if (!isNaN(parsedLineNumber)) {
|
|
1027
|
-
lineNumber = parsedLineNumber + 1;
|
|
1028
|
-
column = 1;
|
|
1029
|
-
uri = uri.with({
|
|
1030
|
-
fragment: `L${lineNumber}`
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
uri = uri.with({
|
|
1035
|
-
query: null
|
|
1036
|
-
});
|
|
1037
|
-
const extractedSelection = extractSelection(uri);
|
|
1038
|
-
const selection = lineNumber !== undefined && column !== undefined ? {
|
|
1039
|
-
startLineNumber: lineNumber,
|
|
1040
|
-
startColumn: column
|
|
1041
|
-
} : extractedSelection.selection;
|
|
1042
|
-
const resource = extractedSelection.uri;
|
|
1043
|
-
if (!this.fileService.hasProvider(resource) || this.workspaceContextService.isInsideWorkspace(resource)) {
|
|
1044
|
-
await this.openerService.open(uri, {
|
|
1045
|
-
fromUserGesture: true,
|
|
1046
|
-
fromWorkspace: true
|
|
1047
|
-
});
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
let match = undefined;
|
|
1051
|
-
for (const group of this.editorGroupService.groups) {
|
|
1052
|
-
const editorInput = group.editors.find(editor => editor.resource && isEqual(editor.resource, resource, true));
|
|
1053
|
-
if (editorInput) {
|
|
1054
|
-
match = {
|
|
1055
|
-
group,
|
|
1056
|
-
editor: editorInput
|
|
1057
|
-
};
|
|
1058
|
-
break;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
const options = {
|
|
1062
|
-
selection,
|
|
1063
|
-
source: EditorOpenSource.USER
|
|
1064
|
-
};
|
|
1065
|
-
if (match) {
|
|
1066
|
-
await this.editorService.openEditors([{
|
|
1067
|
-
editor: match.editor,
|
|
1068
|
-
options
|
|
1069
|
-
}], match.group, {
|
|
1070
|
-
validateTrust: true
|
|
1071
|
-
});
|
|
1072
|
-
} else {
|
|
1073
|
-
await this.editorService.openEditors([{
|
|
1074
|
-
resource,
|
|
1075
|
-
options
|
|
1076
|
-
}], undefined, {
|
|
1077
|
-
validateTrust: true
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
_handleHighlightCodeBlock(codeBlocks) {
|
|
1082
|
-
for (const {
|
|
1083
|
-
id,
|
|
1084
|
-
value,
|
|
1085
|
-
lang
|
|
1086
|
-
} of codeBlocks) {
|
|
1087
|
-
const languageId = this.languageService.getLanguageIdByLanguageName(lang);
|
|
1088
|
-
if (!languageId) {
|
|
1089
|
-
continue;
|
|
1090
|
-
}
|
|
1091
|
-
tokenizeToString(this.languageService, value, languageId).then(html => {
|
|
1092
|
-
if (this._disposed) {
|
|
1093
|
-
return;
|
|
1094
|
-
}
|
|
1095
|
-
this._sendMessageToWebview({
|
|
1096
|
-
type: "tokenizedCodeBlock",
|
|
1097
|
-
html,
|
|
1098
|
-
codeBlockId: id
|
|
1099
|
-
});
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
async _onDidClickDataLink(event) {
|
|
1104
|
-
if (typeof event.data !== "string") {
|
|
1105
|
-
return;
|
|
1106
|
-
}
|
|
1107
|
-
const [splitStart, splitData] = event.data.split(";base64,");
|
|
1108
|
-
if (!splitData || !splitStart) {
|
|
1109
|
-
return;
|
|
1110
|
-
}
|
|
1111
|
-
const defaultDir = extname(this.documentUri) === ".interactive" ? this.workspaceContextService.getWorkspace().folders[0]?.uri ?? (await this.fileDialogService.defaultFilePath()) : dirname(this.documentUri);
|
|
1112
|
-
let defaultName;
|
|
1113
|
-
if (event.downloadName) {
|
|
1114
|
-
defaultName = event.downloadName;
|
|
1115
|
-
} else {
|
|
1116
|
-
const mimeType = splitStart.replace(/^data:/, "");
|
|
1117
|
-
const candidateExtension = mimeType && getExtensionForMimeType(mimeType);
|
|
1118
|
-
defaultName = candidateExtension ? `download${candidateExtension}` : "download";
|
|
1119
|
-
}
|
|
1120
|
-
const defaultUri = joinPath(defaultDir, defaultName);
|
|
1121
|
-
const newFileUri = await this.fileDialogService.showSaveDialog({
|
|
1122
|
-
defaultUri
|
|
1123
|
-
});
|
|
1124
|
-
if (!newFileUri) {
|
|
1125
|
-
return;
|
|
1126
|
-
}
|
|
1127
|
-
const buff = decodeBase64(splitData);
|
|
1128
|
-
await this.fileService.writeFile(newFileUri, buff);
|
|
1129
|
-
await this.openerService.open(newFileUri);
|
|
1130
|
-
}
|
|
1131
|
-
_createInset(webviewService, content) {
|
|
1132
|
-
this.localResourceRootsCache = this._getResourceRootsCache();
|
|
1133
|
-
const webview = webviewService.createWebviewElement({
|
|
1134
|
-
origin: BackLayerWebView_1.getOriginStore(this.storageService).getOrigin(this.notebookViewType, undefined),
|
|
1135
|
-
title: ( localize(14846, "Notebook webview content")),
|
|
1136
|
-
options: {
|
|
1137
|
-
purpose: WebviewContentPurpose.NotebookRenderer,
|
|
1138
|
-
enableFindWidget: false,
|
|
1139
|
-
transformCssVariables: transformWebviewThemeVars
|
|
1140
|
-
},
|
|
1141
|
-
contentOptions: {
|
|
1142
|
-
allowMultipleAPIAcquire: true,
|
|
1143
|
-
allowScripts: true,
|
|
1144
|
-
forwardUntrustedKeypressEvents: false,
|
|
1145
|
-
localResourceRoots: this.localResourceRootsCache
|
|
1146
|
-
},
|
|
1147
|
-
extension: undefined,
|
|
1148
|
-
providedViewType: "notebook.output"
|
|
1149
|
-
});
|
|
1150
|
-
webview.setHtml(content);
|
|
1151
|
-
webview.setContextKeyService(this.contextKeyService);
|
|
1152
|
-
return webview;
|
|
1153
|
-
}
|
|
1154
|
-
_getResourceRootsCache() {
|
|
1155
|
-
const workspaceFolders = ( this.contextService.getWorkspace().folders.map(x => x.uri));
|
|
1156
|
-
const notebookDir = this.getNotebookBaseUri();
|
|
1157
|
-
return [this.notebookService.getNotebookProviderResourceRoots(), ( this.notebookService.getRenderers().map(x => dirname(x.entrypoint.path))), ...Array.from(
|
|
1158
|
-
this.notebookService.getStaticPreloads(this.notebookViewType),
|
|
1159
|
-
x => [dirname(x.entrypoint), ...x.localResourceRoots]
|
|
1160
|
-
), workspaceFolders, notebookDir, this.getBuiltinLocalResourceRoots()].flat();
|
|
1161
|
-
}
|
|
1162
|
-
initializeWebViewState() {
|
|
1163
|
-
this._preloadsCache.clear();
|
|
1164
|
-
if (this._currentKernel) {
|
|
1165
|
-
this._updatePreloadsFromKernel(this._currentKernel);
|
|
1166
|
-
}
|
|
1167
|
-
for (const [output, inset] of this.insetMapping.entries()) {
|
|
1168
|
-
this._sendMessageToWebview({
|
|
1169
|
-
...inset.cachedCreation,
|
|
1170
|
-
initiallyHidden: ( this.hiddenInsetMapping.has(output))
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
if (this.initializeMarkupPromise?.isFirstInit)
|
|
1174
|
-
; else {
|
|
1175
|
-
const mdCells = [...( this.markupPreviewMapping.values())];
|
|
1176
|
-
this.markupPreviewMapping.clear();
|
|
1177
|
-
this.initializeMarkup(mdCells);
|
|
1178
|
-
}
|
|
1179
|
-
this._updateStyles();
|
|
1180
|
-
this._updateOptions();
|
|
1181
|
-
}
|
|
1182
|
-
shouldUpdateInset(cell, output, cellTop, outputOffset) {
|
|
1183
|
-
if (this._disposed) {
|
|
1184
|
-
return false;
|
|
1185
|
-
}
|
|
1186
|
-
if ("isOutputCollapsed" in cell && cell.isOutputCollapsed) {
|
|
1187
|
-
return false;
|
|
1188
|
-
}
|
|
1189
|
-
if (( this.hiddenInsetMapping.has(output))) {
|
|
1190
|
-
return true;
|
|
1191
|
-
}
|
|
1192
|
-
const outputCache = this.insetMapping.get(output);
|
|
1193
|
-
if (!outputCache) {
|
|
1194
|
-
return false;
|
|
1195
|
-
}
|
|
1196
|
-
if (outputOffset === outputCache.cachedCreation.outputOffset && cellTop === outputCache.cachedCreation.cellTop) {
|
|
1197
|
-
return false;
|
|
1198
|
-
}
|
|
1199
|
-
return true;
|
|
1200
|
-
}
|
|
1201
|
-
ackHeight(updates) {
|
|
1202
|
-
this._sendMessageToWebview({
|
|
1203
|
-
type: "ack-dimension",
|
|
1204
|
-
updates
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
updateScrollTops(outputRequests, markupPreviews) {
|
|
1208
|
-
if (this._disposed) {
|
|
1209
|
-
return;
|
|
1210
|
-
}
|
|
1211
|
-
const widgets = coalesce(( outputRequests.map(request => {
|
|
1212
|
-
const outputCache = this.insetMapping.get(request.output);
|
|
1213
|
-
if (!outputCache) {
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
if (!request.forceDisplay && !this.shouldUpdateInset(request.cell, request.output, request.cellTop, request.outputOffset)) {
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
const id = outputCache.outputId;
|
|
1220
|
-
outputCache.cachedCreation.cellTop = request.cellTop;
|
|
1221
|
-
outputCache.cachedCreation.outputOffset = request.outputOffset;
|
|
1222
|
-
this.hiddenInsetMapping.delete(request.output);
|
|
1223
|
-
return {
|
|
1224
|
-
cellId: request.cell.id,
|
|
1225
|
-
outputId: id,
|
|
1226
|
-
cellTop: request.cellTop,
|
|
1227
|
-
outputOffset: request.outputOffset,
|
|
1228
|
-
forceDisplay: request.forceDisplay
|
|
1229
|
-
};
|
|
1230
|
-
})));
|
|
1231
|
-
if (!widgets.length && !markupPreviews.length) {
|
|
1232
|
-
return;
|
|
1233
|
-
}
|
|
1234
|
-
this._sendMessageToWebview({
|
|
1235
|
-
type: "view-scroll",
|
|
1236
|
-
widgets: widgets,
|
|
1237
|
-
markupCells: markupPreviews
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
|
-
async createMarkupPreview(initialization) {
|
|
1241
|
-
if (this._disposed) {
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
if (( this.markupPreviewMapping.has(initialization.cellId))) {
|
|
1245
|
-
console.error("Trying to create markup preview that already exists");
|
|
1246
|
-
return;
|
|
1247
|
-
}
|
|
1248
|
-
this.markupPreviewMapping.set(initialization.cellId, initialization);
|
|
1249
|
-
this._sendMessageToWebview({
|
|
1250
|
-
type: "createMarkupCell",
|
|
1251
|
-
cell: initialization
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
async showMarkupPreview(newContent) {
|
|
1255
|
-
if (this._disposed) {
|
|
1256
|
-
return;
|
|
1257
|
-
}
|
|
1258
|
-
const entry = this.markupPreviewMapping.get(newContent.cellId);
|
|
1259
|
-
if (!entry) {
|
|
1260
|
-
return this.createMarkupPreview(newContent);
|
|
1261
|
-
}
|
|
1262
|
-
const sameContent = newContent.content === entry.content;
|
|
1263
|
-
const sameMetadata = (equals(newContent.metadata, entry.metadata));
|
|
1264
|
-
if (!sameContent || !sameMetadata || !entry.visible) {
|
|
1265
|
-
this._sendMessageToWebview({
|
|
1266
|
-
type: "showMarkupCell",
|
|
1267
|
-
id: newContent.cellId,
|
|
1268
|
-
handle: newContent.cellHandle,
|
|
1269
|
-
content: sameContent ? undefined : newContent.content,
|
|
1270
|
-
top: newContent.offset,
|
|
1271
|
-
metadata: sameMetadata ? undefined : newContent.metadata
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
entry.metadata = newContent.metadata;
|
|
1275
|
-
entry.content = newContent.content;
|
|
1276
|
-
entry.offset = newContent.offset;
|
|
1277
|
-
entry.visible = true;
|
|
1278
|
-
}
|
|
1279
|
-
async hideMarkupPreviews(cellIds) {
|
|
1280
|
-
if (this._disposed) {
|
|
1281
|
-
return;
|
|
1282
|
-
}
|
|
1283
|
-
const cellsToHide = [];
|
|
1284
|
-
for (const cellId of cellIds) {
|
|
1285
|
-
const entry = this.markupPreviewMapping.get(cellId);
|
|
1286
|
-
if (entry) {
|
|
1287
|
-
if (entry.visible) {
|
|
1288
|
-
cellsToHide.push(cellId);
|
|
1289
|
-
entry.visible = false;
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
if (cellsToHide.length) {
|
|
1294
|
-
this._sendMessageToWebview({
|
|
1295
|
-
type: "hideMarkupCells",
|
|
1296
|
-
ids: cellsToHide
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
async unhideMarkupPreviews(cellIds) {
|
|
1301
|
-
if (this._disposed) {
|
|
1302
|
-
return;
|
|
1303
|
-
}
|
|
1304
|
-
const toUnhide = [];
|
|
1305
|
-
for (const cellId of cellIds) {
|
|
1306
|
-
const entry = this.markupPreviewMapping.get(cellId);
|
|
1307
|
-
if (entry) {
|
|
1308
|
-
if (!entry.visible) {
|
|
1309
|
-
entry.visible = true;
|
|
1310
|
-
toUnhide.push(cellId);
|
|
1311
|
-
}
|
|
1312
|
-
} else {
|
|
1313
|
-
console.error(`Trying to unhide a preview that does not exist: ${cellId}`);
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
this._sendMessageToWebview({
|
|
1317
|
-
type: "unhideMarkupCells",
|
|
1318
|
-
ids: toUnhide
|
|
1319
|
-
});
|
|
1320
|
-
}
|
|
1321
|
-
async deleteMarkupPreviews(cellIds) {
|
|
1322
|
-
if (this._disposed) {
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
for (const id of cellIds) {
|
|
1326
|
-
if (!( this.markupPreviewMapping.has(id))) {
|
|
1327
|
-
console.error(`Trying to delete a preview that does not exist: ${id}`);
|
|
1328
|
-
}
|
|
1329
|
-
this.markupPreviewMapping.delete(id);
|
|
1330
|
-
}
|
|
1331
|
-
if (cellIds.length) {
|
|
1332
|
-
this._sendMessageToWebview({
|
|
1333
|
-
type: "deleteMarkupCell",
|
|
1334
|
-
ids: cellIds
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
async updateMarkupPreviewSelections(selectedCellsIds) {
|
|
1339
|
-
if (this._disposed) {
|
|
1340
|
-
return;
|
|
1341
|
-
}
|
|
1342
|
-
this._sendMessageToWebview({
|
|
1343
|
-
type: "updateSelectedMarkupCells",
|
|
1344
|
-
selectedCellIds: selectedCellsIds.filter(id => ( this.markupPreviewMapping.has(id)))
|
|
1345
|
-
});
|
|
1346
|
-
}
|
|
1347
|
-
async initializeMarkup(cells) {
|
|
1348
|
-
if (this._disposed) {
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
this.initializeMarkupPromise?.p.complete();
|
|
1352
|
-
const requestId = generateUuid();
|
|
1353
|
-
this.initializeMarkupPromise = {
|
|
1354
|
-
p: ( new DeferredPromise()),
|
|
1355
|
-
requestId,
|
|
1356
|
-
isFirstInit: this.firstInit
|
|
1357
|
-
};
|
|
1358
|
-
this.firstInit = false;
|
|
1359
|
-
for (const cell of cells) {
|
|
1360
|
-
this.markupPreviewMapping.set(cell.cellId, cell);
|
|
1361
|
-
}
|
|
1362
|
-
this._sendMessageToWebview({
|
|
1363
|
-
type: "initializeMarkup",
|
|
1364
|
-
cells,
|
|
1365
|
-
requestId
|
|
1366
|
-
});
|
|
1367
|
-
return this.initializeMarkupPromise.p.p;
|
|
1368
|
-
}
|
|
1369
|
-
_cachedInsetEqual(cachedInset, content) {
|
|
1370
|
-
if (content.type === RenderOutputType.Extension) {
|
|
1371
|
-
return cachedInset.renderer?.id === content.renderer.id;
|
|
1372
|
-
} else {
|
|
1373
|
-
return cachedInset.cachedCreation.type === "html";
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
requestCreateOutputWhenWebviewIdle(cellInfo, content, cellTop, offset) {
|
|
1377
|
-
if (this._disposed) {
|
|
1378
|
-
return;
|
|
1379
|
-
}
|
|
1380
|
-
if (( this.insetMapping.has(content.source))) {
|
|
1381
|
-
return;
|
|
1382
|
-
}
|
|
1383
|
-
if (( this.pendingWebviewIdleCreationRequest.has(content.source))) {
|
|
1384
|
-
return;
|
|
1385
|
-
}
|
|
1386
|
-
if (( this.pendingWebviewIdleInsetMapping.has(content.source))) {
|
|
1387
|
-
return;
|
|
1388
|
-
}
|
|
1389
|
-
this.pendingWebviewIdleCreationRequest.set(content.source, runWhenGlobalIdle(() => {
|
|
1390
|
-
const {
|
|
1391
|
-
message,
|
|
1392
|
-
renderer,
|
|
1393
|
-
transfer: transferable
|
|
1394
|
-
} = this._createOutputCreationMessage(cellInfo, content, cellTop, offset, true, true);
|
|
1395
|
-
this._sendMessageToWebview(message, transferable);
|
|
1396
|
-
this.pendingWebviewIdleInsetMapping.set(content.source, {
|
|
1397
|
-
outputId: message.outputId,
|
|
1398
|
-
versionId: content.source.model.versionId,
|
|
1399
|
-
cellInfo: cellInfo,
|
|
1400
|
-
renderer,
|
|
1401
|
-
cachedCreation: message
|
|
1402
|
-
});
|
|
1403
|
-
this.reversedPendingWebviewIdleInsetMapping.set(message.outputId, content.source);
|
|
1404
|
-
this.pendingWebviewIdleCreationRequest.delete(content.source);
|
|
1405
|
-
}));
|
|
1406
|
-
}
|
|
1407
|
-
createOutput(cellInfo, content, cellTop, offset) {
|
|
1408
|
-
if (this._disposed) {
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
const cachedInset = this.insetMapping.get(content.source);
|
|
1412
|
-
this.pendingWebviewIdleCreationRequest.get(content.source)?.dispose();
|
|
1413
|
-
this.pendingWebviewIdleCreationRequest.delete(content.source);
|
|
1414
|
-
this.pendingWebviewIdleInsetMapping.delete(content.source);
|
|
1415
|
-
if (cachedInset) {
|
|
1416
|
-
this.reversedPendingWebviewIdleInsetMapping.delete(cachedInset.outputId);
|
|
1417
|
-
}
|
|
1418
|
-
if (cachedInset && this._cachedInsetEqual(cachedInset, content)) {
|
|
1419
|
-
this.hiddenInsetMapping.delete(content.source);
|
|
1420
|
-
this._sendMessageToWebview({
|
|
1421
|
-
type: "showOutput",
|
|
1422
|
-
cellId: cachedInset.cellInfo.cellId,
|
|
1423
|
-
outputId: cachedInset.outputId,
|
|
1424
|
-
cellTop: cellTop,
|
|
1425
|
-
outputOffset: offset
|
|
1426
|
-
});
|
|
1427
|
-
return;
|
|
1428
|
-
}
|
|
1429
|
-
const {
|
|
1430
|
-
message,
|
|
1431
|
-
renderer,
|
|
1432
|
-
transfer: transferable
|
|
1433
|
-
} = this._createOutputCreationMessage(cellInfo, content, cellTop, offset, false, false);
|
|
1434
|
-
this._sendMessageToWebview(message, transferable);
|
|
1435
|
-
this.insetMapping.set(content.source, {
|
|
1436
|
-
outputId: message.outputId,
|
|
1437
|
-
versionId: content.source.model.versionId,
|
|
1438
|
-
cellInfo: cellInfo,
|
|
1439
|
-
renderer,
|
|
1440
|
-
cachedCreation: message
|
|
1441
|
-
});
|
|
1442
|
-
this.hiddenInsetMapping.delete(content.source);
|
|
1443
|
-
this.reversedInsetMapping.set(message.outputId, content.source);
|
|
1444
|
-
}
|
|
1445
|
-
createMetadata(output, mimeType) {
|
|
1446
|
-
if (mimeType.startsWith("image")) {
|
|
1447
|
-
const buffer = output.outputs.find(out => out.mime === "text/plain")?.data.buffer;
|
|
1448
|
-
if (buffer?.length && buffer?.length > 0) {
|
|
1449
|
-
const altText = ( new TextDecoder()).decode(buffer);
|
|
1450
|
-
return {
|
|
1451
|
-
...output.metadata,
|
|
1452
|
-
vscode_altText: altText
|
|
1453
|
-
};
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
return output.metadata;
|
|
1457
|
-
}
|
|
1458
|
-
_createOutputCreationMessage(cellInfo, content, cellTop, offset, createOnIdle, initiallyHidden) {
|
|
1459
|
-
const messageBase = {
|
|
1460
|
-
type: "html",
|
|
1461
|
-
executionId: cellInfo.executionId,
|
|
1462
|
-
cellId: cellInfo.cellId,
|
|
1463
|
-
cellTop: cellTop,
|
|
1464
|
-
outputOffset: offset,
|
|
1465
|
-
left: 0,
|
|
1466
|
-
requiredPreloads: [],
|
|
1467
|
-
createOnIdle: createOnIdle
|
|
1468
|
-
};
|
|
1469
|
-
const transfer = [];
|
|
1470
|
-
let message;
|
|
1471
|
-
let renderer;
|
|
1472
|
-
if (content.type === RenderOutputType.Extension) {
|
|
1473
|
-
const output = content.source.model;
|
|
1474
|
-
renderer = content.renderer;
|
|
1475
|
-
const first = output.outputs.find(op => op.mime === content.mimeType);
|
|
1476
|
-
const metadata = this.createMetadata(output, content.mimeType);
|
|
1477
|
-
const valueBytes = copyBufferIfNeeded(first.data.buffer, transfer);
|
|
1478
|
-
message = {
|
|
1479
|
-
...messageBase,
|
|
1480
|
-
outputId: output.outputId,
|
|
1481
|
-
rendererId: content.renderer.id,
|
|
1482
|
-
content: {
|
|
1483
|
-
type: RenderOutputType.Extension,
|
|
1484
|
-
outputId: output.outputId,
|
|
1485
|
-
metadata: metadata,
|
|
1486
|
-
output: {
|
|
1487
|
-
mime: first.mime,
|
|
1488
|
-
valueBytes
|
|
1489
|
-
},
|
|
1490
|
-
allOutputs: ( output.outputs.map(output => ({
|
|
1491
|
-
mime: output.mime
|
|
1492
|
-
})))
|
|
1493
|
-
},
|
|
1494
|
-
initiallyHidden: initiallyHidden
|
|
1495
|
-
};
|
|
1496
|
-
} else {
|
|
1497
|
-
message = {
|
|
1498
|
-
...messageBase,
|
|
1499
|
-
outputId: generateUuid(),
|
|
1500
|
-
content: {
|
|
1501
|
-
type: content.type,
|
|
1502
|
-
htmlContent: content.htmlContent
|
|
1503
|
-
},
|
|
1504
|
-
initiallyHidden: initiallyHidden
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1507
|
-
return {
|
|
1508
|
-
message,
|
|
1509
|
-
renderer,
|
|
1510
|
-
transfer
|
|
1511
|
-
};
|
|
1512
|
-
}
|
|
1513
|
-
updateOutput(cellInfo, content, cellTop, offset) {
|
|
1514
|
-
if (this._disposed) {
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
|
-
if (!( this.insetMapping.has(content.source))) {
|
|
1518
|
-
this.createOutput(cellInfo, content, cellTop, offset);
|
|
1519
|
-
return;
|
|
1520
|
-
}
|
|
1521
|
-
const outputCache = this.insetMapping.get(content.source);
|
|
1522
|
-
if (outputCache.versionId === content.source.model.versionId) {
|
|
1523
|
-
return;
|
|
1524
|
-
}
|
|
1525
|
-
this.hiddenInsetMapping.delete(content.source);
|
|
1526
|
-
let updatedContent = undefined;
|
|
1527
|
-
const transfer = [];
|
|
1528
|
-
if (content.type === RenderOutputType.Extension) {
|
|
1529
|
-
const output = content.source.model;
|
|
1530
|
-
const firstBuffer = output.outputs.find(op => op.mime === content.mimeType);
|
|
1531
|
-
const appenededData = output.appendedSinceVersion(outputCache.versionId, content.mimeType);
|
|
1532
|
-
const appended = appenededData ? {
|
|
1533
|
-
valueBytes: appenededData.buffer,
|
|
1534
|
-
previousVersion: outputCache.versionId
|
|
1535
|
-
} : undefined;
|
|
1536
|
-
const valueBytes = copyBufferIfNeeded(firstBuffer.data.buffer, transfer);
|
|
1537
|
-
updatedContent = {
|
|
1538
|
-
type: RenderOutputType.Extension,
|
|
1539
|
-
outputId: outputCache.outputId,
|
|
1540
|
-
metadata: output.metadata,
|
|
1541
|
-
output: {
|
|
1542
|
-
mime: content.mimeType,
|
|
1543
|
-
valueBytes,
|
|
1544
|
-
appended: appended
|
|
1545
|
-
},
|
|
1546
|
-
allOutputs: ( output.outputs.map(output => ({
|
|
1547
|
-
mime: output.mime
|
|
1548
|
-
})))
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
|
-
this._sendMessageToWebview({
|
|
1552
|
-
type: "showOutput",
|
|
1553
|
-
cellId: outputCache.cellInfo.cellId,
|
|
1554
|
-
outputId: outputCache.outputId,
|
|
1555
|
-
cellTop: cellTop,
|
|
1556
|
-
outputOffset: offset,
|
|
1557
|
-
content: updatedContent
|
|
1558
|
-
}, transfer);
|
|
1559
|
-
outputCache.versionId = content.source.model.versionId;
|
|
1560
|
-
return;
|
|
1561
|
-
}
|
|
1562
|
-
async copyImage(output) {
|
|
1563
|
-
const textAlternates = [];
|
|
1564
|
-
const cellOutput = output.model;
|
|
1565
|
-
for (const outputItem of cellOutput.outputs) {
|
|
1566
|
-
if (TEXT_BASED_MIMETYPES.includes(outputItem.mime)) {
|
|
1567
|
-
const text = isTextStreamMime(outputItem.mime) ? getOutputStreamText(output).text : getOutputText(outputItem.mime, outputItem);
|
|
1568
|
-
textAlternates.push({
|
|
1569
|
-
mimeType: outputItem.mime,
|
|
1570
|
-
content: text
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
this._sendMessageToWebview({
|
|
1575
|
-
type: "copyImage",
|
|
1576
|
-
outputId: output.model.outputId,
|
|
1577
|
-
altOutputId: output.model.alternativeOutputId,
|
|
1578
|
-
textAlternates: textAlternates.length > 0 ? textAlternates : undefined
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
removeInsets(outputs) {
|
|
1582
|
-
if (this._disposed) {
|
|
1583
|
-
return;
|
|
1584
|
-
}
|
|
1585
|
-
for (const output of outputs) {
|
|
1586
|
-
const outputCache = this.insetMapping.get(output);
|
|
1587
|
-
if (!outputCache) {
|
|
1588
|
-
continue;
|
|
1589
|
-
}
|
|
1590
|
-
const id = outputCache.outputId;
|
|
1591
|
-
this._sendMessageToWebview({
|
|
1592
|
-
type: "clearOutput",
|
|
1593
|
-
rendererId: outputCache.cachedCreation.rendererId,
|
|
1594
|
-
cellUri: ( outputCache.cellInfo.cellUri.toString()),
|
|
1595
|
-
outputId: id,
|
|
1596
|
-
cellId: outputCache.cellInfo.cellId
|
|
1597
|
-
});
|
|
1598
|
-
this.insetMapping.delete(output);
|
|
1599
|
-
this.pendingWebviewIdleCreationRequest.get(output)?.dispose();
|
|
1600
|
-
this.pendingWebviewIdleCreationRequest.delete(output);
|
|
1601
|
-
this.pendingWebviewIdleInsetMapping.delete(output);
|
|
1602
|
-
this.reversedPendingWebviewIdleInsetMapping.delete(id);
|
|
1603
|
-
this.reversedInsetMapping.delete(id);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
hideInset(output) {
|
|
1607
|
-
if (this._disposed) {
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
const outputCache = this.insetMapping.get(output);
|
|
1611
|
-
if (!outputCache) {
|
|
1612
|
-
return;
|
|
1613
|
-
}
|
|
1614
|
-
this.hiddenInsetMapping.add(output);
|
|
1615
|
-
this._sendMessageToWebview({
|
|
1616
|
-
type: "hideOutput",
|
|
1617
|
-
outputId: outputCache.outputId,
|
|
1618
|
-
cellId: outputCache.cellInfo.cellId
|
|
1619
|
-
});
|
|
1620
|
-
}
|
|
1621
|
-
focusWebview() {
|
|
1622
|
-
if (this._disposed) {
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
this.webview?.focus();
|
|
1626
|
-
}
|
|
1627
|
-
selectOutputContents(cell) {
|
|
1628
|
-
if (this._disposed) {
|
|
1629
|
-
return;
|
|
1630
|
-
}
|
|
1631
|
-
const output = cell.outputsViewModels.find(o => o.model.outputId === cell.focusedOutputId);
|
|
1632
|
-
const outputId = output ? this.insetMapping.get(output)?.outputId : undefined;
|
|
1633
|
-
this._sendMessageToWebview({
|
|
1634
|
-
type: "select-output-contents",
|
|
1635
|
-
cellOrOutputId: outputId || cell.id
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
selectInputContents(cell) {
|
|
1639
|
-
if (this._disposed) {
|
|
1640
|
-
return;
|
|
1641
|
-
}
|
|
1642
|
-
const output = cell.outputsViewModels.find(o => o.model.outputId === cell.focusedOutputId);
|
|
1643
|
-
const outputId = output ? this.insetMapping.get(output)?.outputId : undefined;
|
|
1644
|
-
this._sendMessageToWebview({
|
|
1645
|
-
type: "select-input-contents",
|
|
1646
|
-
cellOrOutputId: outputId || cell.id
|
|
1647
|
-
});
|
|
1648
|
-
}
|
|
1649
|
-
focusOutput(cellOrOutputId, alternateId, viewFocused) {
|
|
1650
|
-
if (this._disposed) {
|
|
1651
|
-
return;
|
|
1652
|
-
}
|
|
1653
|
-
if (!viewFocused) {
|
|
1654
|
-
this.webview?.focus();
|
|
1655
|
-
}
|
|
1656
|
-
this._sendMessageToWebview({
|
|
1657
|
-
type: "focus-output",
|
|
1658
|
-
cellOrOutputId: cellOrOutputId,
|
|
1659
|
-
alternateId: alternateId
|
|
1660
|
-
});
|
|
1661
|
-
}
|
|
1662
|
-
blurOutput() {
|
|
1663
|
-
if (this._disposed) {
|
|
1664
|
-
return;
|
|
1665
|
-
}
|
|
1666
|
-
this._sendMessageToWebview({
|
|
1667
|
-
type: "blur-output"
|
|
1668
|
-
});
|
|
1669
|
-
}
|
|
1670
|
-
async find(query, options) {
|
|
1671
|
-
if (query === "") {
|
|
1672
|
-
this._sendMessageToWebview({
|
|
1673
|
-
type: "findStop",
|
|
1674
|
-
ownerID: options.ownerID
|
|
1675
|
-
});
|
|
1676
|
-
return [];
|
|
1677
|
-
}
|
|
1678
|
-
const p = ( new Promise(resolve => {
|
|
1679
|
-
const sub = this.webview?.onMessage(e => {
|
|
1680
|
-
if (e.message.type === "didFind") {
|
|
1681
|
-
resolve(e.message.matches);
|
|
1682
|
-
sub?.dispose();
|
|
1683
|
-
}
|
|
1684
|
-
});
|
|
1685
|
-
}));
|
|
1686
|
-
this._sendMessageToWebview({
|
|
1687
|
-
type: "find",
|
|
1688
|
-
query: query,
|
|
1689
|
-
options
|
|
1690
|
-
});
|
|
1691
|
-
const ret = await p;
|
|
1692
|
-
return ret;
|
|
1693
|
-
}
|
|
1694
|
-
findStop(ownerID) {
|
|
1695
|
-
this._sendMessageToWebview({
|
|
1696
|
-
type: "findStop",
|
|
1697
|
-
ownerID
|
|
1698
|
-
});
|
|
1699
|
-
}
|
|
1700
|
-
async findHighlightCurrent(index, ownerID) {
|
|
1701
|
-
const p = ( new Promise(resolve => {
|
|
1702
|
-
const sub = this.webview?.onMessage(e => {
|
|
1703
|
-
if (e.message.type === "didFindHighlightCurrent") {
|
|
1704
|
-
resolve(e.message.offset);
|
|
1705
|
-
sub?.dispose();
|
|
1706
|
-
}
|
|
1707
|
-
});
|
|
1708
|
-
}));
|
|
1709
|
-
this._sendMessageToWebview({
|
|
1710
|
-
type: "findHighlightCurrent",
|
|
1711
|
-
index,
|
|
1712
|
-
ownerID
|
|
1713
|
-
});
|
|
1714
|
-
const ret = await p;
|
|
1715
|
-
return ret;
|
|
1716
|
-
}
|
|
1717
|
-
async findUnHighlightCurrent(index, ownerID) {
|
|
1718
|
-
this._sendMessageToWebview({
|
|
1719
|
-
type: "findUnHighlightCurrent",
|
|
1720
|
-
index,
|
|
1721
|
-
ownerID
|
|
1722
|
-
});
|
|
1723
|
-
}
|
|
1724
|
-
deltaCellOutputContainerClassNames(cellId, added, removed) {
|
|
1725
|
-
this._sendMessageToWebview({
|
|
1726
|
-
type: "decorations",
|
|
1727
|
-
cellId,
|
|
1728
|
-
addedClassNames: added,
|
|
1729
|
-
removedClassNames: removed
|
|
1730
|
-
});
|
|
1731
|
-
}
|
|
1732
|
-
deltaMarkupPreviewClassNames(cellId, added, removed) {
|
|
1733
|
-
if (this.markupPreviewMapping.get(cellId)) {
|
|
1734
|
-
this._sendMessageToWebview({
|
|
1735
|
-
type: "markupDecorations",
|
|
1736
|
-
cellId,
|
|
1737
|
-
addedClassNames: added,
|
|
1738
|
-
removedClassNames: removed
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
updateOutputRenderers() {
|
|
1743
|
-
if (!this.webview) {
|
|
1744
|
-
return;
|
|
1745
|
-
}
|
|
1746
|
-
const renderersData = this.getRendererData();
|
|
1747
|
-
this.localResourceRootsCache = this._getResourceRootsCache();
|
|
1748
|
-
const mixedResourceRoots = [
|
|
1749
|
-
...(this.localResourceRootsCache || []),
|
|
1750
|
-
...(this._currentKernel ? [this._currentKernel.localResourceRoot] : [])
|
|
1751
|
-
];
|
|
1752
|
-
this.webview.localResourcesRoot = mixedResourceRoots;
|
|
1753
|
-
this._sendMessageToWebview({
|
|
1754
|
-
type: "updateRenderers",
|
|
1755
|
-
rendererData: renderersData
|
|
1756
|
-
});
|
|
1757
|
-
}
|
|
1758
|
-
async updateKernelPreloads(kernel) {
|
|
1759
|
-
if (this._disposed || kernel === this._currentKernel) {
|
|
1760
|
-
return;
|
|
1761
|
-
}
|
|
1762
|
-
const previousKernel = this._currentKernel;
|
|
1763
|
-
this._currentKernel = kernel;
|
|
1764
|
-
if (previousKernel && previousKernel.preloadUris.length > 0) {
|
|
1765
|
-
this.webview?.reload();
|
|
1766
|
-
} else if (kernel) {
|
|
1767
|
-
this._updatePreloadsFromKernel(kernel);
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
_updatePreloadsFromKernel(kernel) {
|
|
1771
|
-
const resources = [];
|
|
1772
|
-
for (const preload of kernel.preloadUris) {
|
|
1773
|
-
const uri = this.environmentService.isExtensionDevelopment && (preload.scheme === "http" || preload.scheme === "https") ? preload : this.asWebviewUri(preload, undefined);
|
|
1774
|
-
if (!( this._preloadsCache.has(( uri.toString())))) {
|
|
1775
|
-
resources.push({
|
|
1776
|
-
uri: ( uri.toString()),
|
|
1777
|
-
originalUri: ( preload.toString())
|
|
1778
|
-
});
|
|
1779
|
-
this._preloadsCache.add(( uri.toString()));
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
if (!resources.length) {
|
|
1783
|
-
return;
|
|
1784
|
-
}
|
|
1785
|
-
this._updatePreloads(resources);
|
|
1786
|
-
}
|
|
1787
|
-
_updatePreloads(resources) {
|
|
1788
|
-
if (!this.webview) {
|
|
1789
|
-
return;
|
|
1790
|
-
}
|
|
1791
|
-
const mixedResourceRoots = [
|
|
1792
|
-
...(this.localResourceRootsCache || []),
|
|
1793
|
-
...(this._currentKernel ? [this._currentKernel.localResourceRoot] : [])
|
|
1794
|
-
];
|
|
1795
|
-
this.webview.localResourcesRoot = mixedResourceRoots;
|
|
1796
|
-
this._sendMessageToWebview({
|
|
1797
|
-
type: "preload",
|
|
1798
|
-
resources: resources
|
|
1799
|
-
});
|
|
1800
|
-
}
|
|
1801
|
-
_sendMessageToWebview(message, transfer) {
|
|
1802
|
-
if (this._disposed) {
|
|
1803
|
-
return;
|
|
1804
|
-
}
|
|
1805
|
-
this.webview?.postMessage(message, transfer);
|
|
1806
|
-
}
|
|
1807
|
-
dispose() {
|
|
1808
|
-
this._disposed = true;
|
|
1809
|
-
this.webview?.dispose();
|
|
1810
|
-
this.webview = undefined;
|
|
1811
|
-
this.notebookEditor = null;
|
|
1812
|
-
this.insetMapping.clear();
|
|
1813
|
-
this.pendingWebviewIdleCreationRequest.clear();
|
|
1814
|
-
super.dispose();
|
|
1815
|
-
}
|
|
1816
|
-
};
|
|
1817
|
-
BackLayerWebView = BackLayerWebView_1 = ( __decorate([( __param(6, IWebviewService)), ( __param(7, IOpenerService)), ( __param(8, INotebookService)), ( __param(9, IWorkspaceContextService)), ( __param(10, IWorkbenchEnvironmentService)), ( __param(11, IFileDialogService)), ( __param(12, IFileService)), ( __param(13, IContextMenuService)), ( __param(14, IContextKeyService)), ( __param(15, IWorkspaceTrustManagementService)), ( __param(16, IConfigurationService)), ( __param(17, ILanguageService)), ( __param(18, IWorkspaceContextService)), ( __param(19, IEditorGroupsService)), ( __param(20, IEditorService)), ( __param(21, IStorageService)), ( __param(22, IPathService)), ( __param(23, INotebookLoggingService)), ( __param(24, IThemeService)), ( __param(25, ITelemetryService))], BackLayerWebView));
|
|
1818
|
-
function copyBufferIfNeeded(buffer, transfer) {
|
|
1819
|
-
if (buffer.byteLength === buffer.buffer.byteLength) {
|
|
1820
|
-
return buffer;
|
|
1821
|
-
} else {
|
|
1822
|
-
const valueBytes = ( new Uint8Array(buffer));
|
|
1823
|
-
transfer.push(valueBytes.buffer);
|
|
1824
|
-
return valueBytes;
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
function getTokenizationCss() {
|
|
1828
|
-
const colorMap = TokenizationRegistry.getColorMap();
|
|
1829
|
-
const tokenizationCss = colorMap ? generateTokensCSSForColorMap(colorMap) : "";
|
|
1830
|
-
return tokenizationCss;
|
|
1831
|
-
}
|
|
1832
|
-
function tryDecodeURIComponent(uri) {
|
|
1833
|
-
try {
|
|
1834
|
-
return decodeURIComponent(uri);
|
|
1835
|
-
} catch {
|
|
1836
|
-
return uri;
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
export { BackLayerWebView };
|