@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,1288 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
3
|
-
import { scheduleAtNextAnimationFrame, getWindow, isAncestorOfActiveElement, getActiveElement, findParentWithClass } from '../../../../../base/browser/dom.js';
|
|
4
|
-
import { createStyleSheet } from '../../../../../base/browser/domStylesheets.js';
|
|
5
|
-
import { ListError } from '../../../../../base/browser/ui/list/list.js';
|
|
6
|
-
import { Emitter, Event } from '../../../../../base/common/event.js';
|
|
7
|
-
import { DisposableStore, MutableDisposable, Disposable } from '../../../../../base/common/lifecycle.js';
|
|
8
|
-
import { isMacintosh } from '../../../../../base/common/platform.js';
|
|
9
|
-
import { TrackedRangeStickiness } from '../../../../../editor/common/model.js';
|
|
10
|
-
import { PrefixSumComputer } from '../../../../../editor/common/model/prefixSumComputer.js';
|
|
11
|
-
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.service.js';
|
|
12
|
-
import { WorkbenchList } from '../../../../../platform/list/browser/listService.js';
|
|
13
|
-
import { IListService } from '../../../../../platform/list/browser/listService.service.js';
|
|
14
|
-
import { CursorAtBoundary, CursorAtLineBoundary, CellRevealType, CellEditState, CellRevealRangeType } from '../notebookBrowser.js';
|
|
15
|
-
import { NOTEBOOK_EDITOR_CURSOR_BOUNDARY, NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY, diff, CellKind, SelectionStateType } from '../../common/notebookCommon.js';
|
|
16
|
-
import { cellRangesEqual, cellRangesToIndexes, reduceCellRanges } from '../../common/notebookRange.js';
|
|
17
|
-
import { NOTEBOOK_CELL_LIST_FOCUSED } from '../../common/notebookContextKeys.js';
|
|
18
|
-
import { clamp } from '../../../../../base/common/numbers.js';
|
|
19
|
-
import { FastDomNode } from '../../../../../base/browser/fastDomNode.js';
|
|
20
|
-
import { MarkupCellViewModel } from '../viewModel/markupCellViewModel.js';
|
|
21
|
-
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
|
|
22
|
-
import { NotebookCellListView } from './notebookCellListView.js';
|
|
23
|
-
import { INotebookExecutionStateService } from '../../common/notebookExecutionStateService.service.js';
|
|
24
|
-
import { NotebookCellAnchor } from './notebookCellAnchor.js';
|
|
25
|
-
import { NotebookViewZones } from '../viewParts/notebookViewZones.js';
|
|
26
|
-
import { NotebookCellOverlays } from '../viewParts/notebookCellOverlays.js';
|
|
27
|
-
|
|
28
|
-
var CellRevealPosition;
|
|
29
|
-
(function(CellRevealPosition) {
|
|
30
|
-
CellRevealPosition[CellRevealPosition["Top"] = 0] = "Top";
|
|
31
|
-
CellRevealPosition[CellRevealPosition["Center"] = 1] = "Center";
|
|
32
|
-
CellRevealPosition[CellRevealPosition["Bottom"] = 2] = "Bottom";
|
|
33
|
-
CellRevealPosition[CellRevealPosition["NearTop"] = 3] = "NearTop";
|
|
34
|
-
})(CellRevealPosition || (CellRevealPosition = {}));
|
|
35
|
-
function getVisibleCells(cells, hiddenRanges) {
|
|
36
|
-
if (!hiddenRanges.length) {
|
|
37
|
-
return cells;
|
|
38
|
-
}
|
|
39
|
-
let start = 0;
|
|
40
|
-
let hiddenRangeIndex = 0;
|
|
41
|
-
const result = [];
|
|
42
|
-
while (start < cells.length && hiddenRangeIndex < hiddenRanges.length) {
|
|
43
|
-
if (start < hiddenRanges[hiddenRangeIndex].start) {
|
|
44
|
-
result.push(...cells.slice(start, hiddenRanges[hiddenRangeIndex].start));
|
|
45
|
-
}
|
|
46
|
-
start = hiddenRanges[hiddenRangeIndex].end + 1;
|
|
47
|
-
hiddenRangeIndex++;
|
|
48
|
-
}
|
|
49
|
-
if (start < cells.length) {
|
|
50
|
-
result.push(...cells.slice(start));
|
|
51
|
-
}
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
|
-
const NOTEBOOK_WEBVIEW_BOUNDARY = 5000;
|
|
55
|
-
function validateWebviewBoundary(element) {
|
|
56
|
-
const webviewTop = 0 - (parseInt(element.style.top, 10) || 0);
|
|
57
|
-
return webviewTop >= 0 && webviewTop <= NOTEBOOK_WEBVIEW_BOUNDARY * 2;
|
|
58
|
-
}
|
|
59
|
-
let NotebookCellList = class NotebookCellList extends WorkbenchList {
|
|
60
|
-
get onWillScroll() {
|
|
61
|
-
return this.view.onWillScroll;
|
|
62
|
-
}
|
|
63
|
-
get rowsContainer() {
|
|
64
|
-
return this.view.containerDomNode;
|
|
65
|
-
}
|
|
66
|
-
get scrollableElement() {
|
|
67
|
-
return this.view.scrollableElementDomNode;
|
|
68
|
-
}
|
|
69
|
-
get viewModel() {
|
|
70
|
-
return this._viewModel;
|
|
71
|
-
}
|
|
72
|
-
get visibleRanges() {
|
|
73
|
-
return this._visibleRanges;
|
|
74
|
-
}
|
|
75
|
-
set visibleRanges(ranges) {
|
|
76
|
-
if (cellRangesEqual(this._visibleRanges, ranges)) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
this._visibleRanges = ranges;
|
|
80
|
-
this._onDidChangeVisibleRanges.fire();
|
|
81
|
-
}
|
|
82
|
-
get isDisposed() {
|
|
83
|
-
return this._isDisposed;
|
|
84
|
-
}
|
|
85
|
-
get webviewElement() {
|
|
86
|
-
return this._webviewElement;
|
|
87
|
-
}
|
|
88
|
-
get inRenderingTransaction() {
|
|
89
|
-
return this.view.inRenderingTransaction;
|
|
90
|
-
}
|
|
91
|
-
constructor(
|
|
92
|
-
listUser,
|
|
93
|
-
container,
|
|
94
|
-
notebookOptions,
|
|
95
|
-
delegate,
|
|
96
|
-
renderers,
|
|
97
|
-
contextKeyService,
|
|
98
|
-
options,
|
|
99
|
-
listService,
|
|
100
|
-
configurationService,
|
|
101
|
-
instantiationService,
|
|
102
|
-
notebookExecutionStateService
|
|
103
|
-
) {
|
|
104
|
-
super(
|
|
105
|
-
listUser,
|
|
106
|
-
container,
|
|
107
|
-
delegate,
|
|
108
|
-
renderers,
|
|
109
|
-
options,
|
|
110
|
-
contextKeyService,
|
|
111
|
-
listService,
|
|
112
|
-
configurationService,
|
|
113
|
-
instantiationService
|
|
114
|
-
);
|
|
115
|
-
this.listUser = listUser;
|
|
116
|
-
this.notebookOptions = notebookOptions;
|
|
117
|
-
this._previousFocusedElements = [];
|
|
118
|
-
this._localDisposableStore = ( new DisposableStore());
|
|
119
|
-
this._viewModelStore = ( new DisposableStore());
|
|
120
|
-
this._onDidRemoveOutputs = this._localDisposableStore.add(( new Emitter()));
|
|
121
|
-
this.onDidRemoveOutputs = this._onDidRemoveOutputs.event;
|
|
122
|
-
this._onDidHideOutputs = this._localDisposableStore.add(( new Emitter()));
|
|
123
|
-
this.onDidHideOutputs = this._onDidHideOutputs.event;
|
|
124
|
-
this._onDidRemoveCellsFromView = this._localDisposableStore.add(( new Emitter()));
|
|
125
|
-
this.onDidRemoveCellsFromView = this._onDidRemoveCellsFromView.event;
|
|
126
|
-
this._viewModel = null;
|
|
127
|
-
this._hiddenRangeIds = [];
|
|
128
|
-
this.hiddenRangesPrefixSum = null;
|
|
129
|
-
this._onDidChangeVisibleRanges = this._localDisposableStore.add(( new Emitter()));
|
|
130
|
-
this.onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;
|
|
131
|
-
this._visibleRanges = [];
|
|
132
|
-
this._isDisposed = false;
|
|
133
|
-
this._isInLayout = false;
|
|
134
|
-
this._webviewElement = null;
|
|
135
|
-
NOTEBOOK_CELL_LIST_FOCUSED.bindTo(this.contextKeyService).set(true);
|
|
136
|
-
this._previousFocusedElements = this.getFocusedElements();
|
|
137
|
-
this._localDisposableStore.add(this.onDidChangeFocus(e => {
|
|
138
|
-
this._previousFocusedElements.forEach(element => {
|
|
139
|
-
if (e.elements.indexOf(element) < 0) {
|
|
140
|
-
element.onDeselect();
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
this._previousFocusedElements = e.elements;
|
|
144
|
-
}));
|
|
145
|
-
const notebookEditorCursorAtBoundaryContext = NOTEBOOK_EDITOR_CURSOR_BOUNDARY.bindTo(contextKeyService);
|
|
146
|
-
notebookEditorCursorAtBoundaryContext.set("none");
|
|
147
|
-
const notebookEditorCursorAtLineBoundaryContext = NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY.bindTo(contextKeyService);
|
|
148
|
-
notebookEditorCursorAtLineBoundaryContext.set("none");
|
|
149
|
-
const cursorSelectionListener = this._localDisposableStore.add(( new MutableDisposable()));
|
|
150
|
-
const textEditorAttachListener = this._localDisposableStore.add(( new MutableDisposable()));
|
|
151
|
-
this._notebookCellAnchor = ( new NotebookCellAnchor(notebookExecutionStateService, configurationService, this.onDidScroll));
|
|
152
|
-
const recomputeContext = element => {
|
|
153
|
-
switch (element.cursorAtBoundary()) {
|
|
154
|
-
case CursorAtBoundary.Both:
|
|
155
|
-
notebookEditorCursorAtBoundaryContext.set("both");
|
|
156
|
-
break;
|
|
157
|
-
case CursorAtBoundary.Top:
|
|
158
|
-
notebookEditorCursorAtBoundaryContext.set("top");
|
|
159
|
-
break;
|
|
160
|
-
case CursorAtBoundary.Bottom:
|
|
161
|
-
notebookEditorCursorAtBoundaryContext.set("bottom");
|
|
162
|
-
break;
|
|
163
|
-
default:
|
|
164
|
-
notebookEditorCursorAtBoundaryContext.set("none");
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
switch (element.cursorAtLineBoundary()) {
|
|
168
|
-
case CursorAtLineBoundary.Both:
|
|
169
|
-
notebookEditorCursorAtLineBoundaryContext.set("both");
|
|
170
|
-
break;
|
|
171
|
-
case CursorAtLineBoundary.Start:
|
|
172
|
-
notebookEditorCursorAtLineBoundaryContext.set("start");
|
|
173
|
-
break;
|
|
174
|
-
case CursorAtLineBoundary.End:
|
|
175
|
-
notebookEditorCursorAtLineBoundaryContext.set("end");
|
|
176
|
-
break;
|
|
177
|
-
default:
|
|
178
|
-
notebookEditorCursorAtLineBoundaryContext.set("none");
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
return;
|
|
182
|
-
};
|
|
183
|
-
this._localDisposableStore.add(this.onDidChangeFocus(e => {
|
|
184
|
-
if (e.elements.length) {
|
|
185
|
-
const focusedElement = e.elements[0];
|
|
186
|
-
cursorSelectionListener.value = focusedElement.onDidChangeState(e => {
|
|
187
|
-
if (e.selectionChanged) {
|
|
188
|
-
recomputeContext(focusedElement);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
textEditorAttachListener.value = focusedElement.onDidChangeEditorAttachState(() => {
|
|
192
|
-
if (focusedElement.editorAttached) {
|
|
193
|
-
recomputeContext(focusedElement);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
recomputeContext(focusedElement);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
notebookEditorCursorAtBoundaryContext.set("none");
|
|
200
|
-
}));
|
|
201
|
-
const updateVisibleRanges = () => {
|
|
202
|
-
if (!this.view.length) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
const top = this.getViewScrollTop();
|
|
206
|
-
const bottom = this.getViewScrollBottom();
|
|
207
|
-
if (top >= bottom) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const topViewIndex = clamp(this.view.indexAt(top), 0, this.view.length - 1);
|
|
211
|
-
const topElement = this.view.element(topViewIndex);
|
|
212
|
-
const topModelIndex = this._viewModel.getCellIndex(topElement);
|
|
213
|
-
const bottomViewIndex = clamp(this.view.indexAt(bottom), 0, this.view.length - 1);
|
|
214
|
-
const bottomElement = this.view.element(bottomViewIndex);
|
|
215
|
-
const bottomModelIndex = this._viewModel.getCellIndex(bottomElement);
|
|
216
|
-
if (bottomModelIndex - topModelIndex === bottomViewIndex - topViewIndex) {
|
|
217
|
-
this.visibleRanges = [{
|
|
218
|
-
start: topModelIndex,
|
|
219
|
-
end: bottomModelIndex + 1
|
|
220
|
-
}];
|
|
221
|
-
} else {
|
|
222
|
-
this.visibleRanges = this._getVisibleRangesFromIndex(topViewIndex, topModelIndex, bottomViewIndex, bottomModelIndex);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
this._localDisposableStore.add(this.view.onDidChangeContentHeight(() => {
|
|
226
|
-
if (this._isInLayout) {
|
|
227
|
-
scheduleAtNextAnimationFrame(getWindow(container), () => {
|
|
228
|
-
updateVisibleRanges();
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
updateVisibleRanges();
|
|
232
|
-
}));
|
|
233
|
-
this._localDisposableStore.add(this.view.onDidScroll(() => {
|
|
234
|
-
if (this._isInLayout) {
|
|
235
|
-
scheduleAtNextAnimationFrame(getWindow(container), () => {
|
|
236
|
-
updateVisibleRanges();
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
updateVisibleRanges();
|
|
240
|
-
}));
|
|
241
|
-
}
|
|
242
|
-
createListView(container, virtualDelegate, renderers, viewOptions) {
|
|
243
|
-
const listView = ( new NotebookCellListView(container, virtualDelegate, renderers, viewOptions));
|
|
244
|
-
this.viewZones = ( new NotebookViewZones(listView, this));
|
|
245
|
-
this.cellOverlays = ( new NotebookCellOverlays(listView));
|
|
246
|
-
return listView;
|
|
247
|
-
}
|
|
248
|
-
_getView() {
|
|
249
|
-
return this.view;
|
|
250
|
-
}
|
|
251
|
-
attachWebview(element) {
|
|
252
|
-
element.style.top = `-${NOTEBOOK_WEBVIEW_BOUNDARY}px`;
|
|
253
|
-
this.rowsContainer.insertAdjacentElement("afterbegin", element);
|
|
254
|
-
this._webviewElement = ( new FastDomNode(element));
|
|
255
|
-
}
|
|
256
|
-
elementAt(position) {
|
|
257
|
-
if (!this.view.length) {
|
|
258
|
-
return undefined;
|
|
259
|
-
}
|
|
260
|
-
const idx = this.view.indexAt(position);
|
|
261
|
-
const clamped = clamp(idx, 0, this.view.length - 1);
|
|
262
|
-
return this.element(clamped);
|
|
263
|
-
}
|
|
264
|
-
elementHeight(element) {
|
|
265
|
-
const index = this._getViewIndexUpperBound(element);
|
|
266
|
-
if (index === undefined || index < 0 || index >= this.length) {
|
|
267
|
-
this._getViewIndexUpperBound(element);
|
|
268
|
-
throw ( new ListError(this.listUser, `Invalid index ${index}`));
|
|
269
|
-
}
|
|
270
|
-
return this.view.elementHeight(index);
|
|
271
|
-
}
|
|
272
|
-
detachViewModel() {
|
|
273
|
-
this._viewModelStore.clear();
|
|
274
|
-
this._viewModel = null;
|
|
275
|
-
this.hiddenRangesPrefixSum = null;
|
|
276
|
-
}
|
|
277
|
-
attachViewModel(model) {
|
|
278
|
-
this._viewModel = model;
|
|
279
|
-
this._viewModelStore.add(model.onDidChangeViewCells(e => {
|
|
280
|
-
if (this._isDisposed) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
this.viewZones.onCellsChanged(e);
|
|
284
|
-
this.cellOverlays.onCellsChanged(e);
|
|
285
|
-
const currentRanges = ( this._hiddenRangeIds.map(id => this._viewModel.getTrackedRange(id))).filter(range => range !== null);
|
|
286
|
-
const newVisibleViewCells = getVisibleCells(this._viewModel.viewCells, currentRanges);
|
|
287
|
-
const oldVisibleViewCells = [];
|
|
288
|
-
const oldViewCellMapping = ( new Set());
|
|
289
|
-
for (let i = 0; i < this.length; i++) {
|
|
290
|
-
oldVisibleViewCells.push(this.element(i));
|
|
291
|
-
oldViewCellMapping.add(( this.element(i).uri.toString()));
|
|
292
|
-
}
|
|
293
|
-
const viewDiffs = diff(oldVisibleViewCells, newVisibleViewCells, a => {
|
|
294
|
-
return ( oldViewCellMapping.has(( a.uri.toString())));
|
|
295
|
-
});
|
|
296
|
-
if (e.synchronous) {
|
|
297
|
-
this._updateElementsInWebview(viewDiffs);
|
|
298
|
-
} else {
|
|
299
|
-
this._viewModelStore.add(
|
|
300
|
-
scheduleAtNextAnimationFrame(getWindow(this.rowsContainer), () => {
|
|
301
|
-
if (this._isDisposed) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
this._updateElementsInWebview(viewDiffs);
|
|
305
|
-
})
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
}));
|
|
309
|
-
this._viewModelStore.add(model.onDidChangeSelection(e => {
|
|
310
|
-
if (e === "view") {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
const viewSelections = ( ( cellRangesToIndexes(model.getSelections()).map(index => model.cellAt(index))).filter(cell => !!cell).map(cell => this._getViewIndexUpperBound(cell)));
|
|
314
|
-
this.setSelection(viewSelections, undefined, true);
|
|
315
|
-
const primary = ( ( cellRangesToIndexes([model.getFocus()]).map(index => model.cellAt(index))).filter(cell => !!cell).map(cell => this._getViewIndexUpperBound(cell)));
|
|
316
|
-
if (primary.length) {
|
|
317
|
-
this.setFocus(primary, undefined, true);
|
|
318
|
-
}
|
|
319
|
-
}));
|
|
320
|
-
const hiddenRanges = model.getHiddenRanges();
|
|
321
|
-
this.setHiddenAreas(hiddenRanges, false);
|
|
322
|
-
const newRanges = reduceCellRanges(hiddenRanges);
|
|
323
|
-
const viewCells = model.viewCells.slice(0);
|
|
324
|
-
newRanges.reverse().forEach(range => {
|
|
325
|
-
const removedCells = viewCells.splice(range.start, range.end - range.start + 1);
|
|
326
|
-
this._onDidRemoveCellsFromView.fire(removedCells);
|
|
327
|
-
});
|
|
328
|
-
this.splice2(0, 0, viewCells);
|
|
329
|
-
}
|
|
330
|
-
_updateElementsInWebview(viewDiffs) {
|
|
331
|
-
viewDiffs.reverse().forEach(diff => {
|
|
332
|
-
const hiddenOutputs = [];
|
|
333
|
-
const deletedOutputs = [];
|
|
334
|
-
const removedMarkdownCells = [];
|
|
335
|
-
for (let i = diff.start; i < diff.start + diff.deleteCount; i++) {
|
|
336
|
-
const cell = this.element(i);
|
|
337
|
-
if (cell.cellKind === CellKind.Code) {
|
|
338
|
-
if (this._viewModel.hasCell(cell)) {
|
|
339
|
-
hiddenOutputs.push(...cell?.outputsViewModels);
|
|
340
|
-
} else {
|
|
341
|
-
deletedOutputs.push(...cell?.outputsViewModels);
|
|
342
|
-
}
|
|
343
|
-
} else {
|
|
344
|
-
removedMarkdownCells.push(cell);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
this.splice2(diff.start, diff.deleteCount, diff.toInsert);
|
|
348
|
-
this._onDidHideOutputs.fire(hiddenOutputs);
|
|
349
|
-
this._onDidRemoveOutputs.fire(deletedOutputs);
|
|
350
|
-
this._onDidRemoveCellsFromView.fire(removedMarkdownCells);
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
clear() {
|
|
354
|
-
super.splice(0, this.length);
|
|
355
|
-
}
|
|
356
|
-
setHiddenAreas(_ranges, triggerViewUpdate) {
|
|
357
|
-
if (!this._viewModel) {
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
const newRanges = reduceCellRanges(_ranges);
|
|
361
|
-
const oldRanges = ( this._hiddenRangeIds.map(id => this._viewModel.getTrackedRange(id))).filter(range => range !== null);
|
|
362
|
-
if (newRanges.length === oldRanges.length) {
|
|
363
|
-
let hasDifference = false;
|
|
364
|
-
for (let i = 0; i < newRanges.length; i++) {
|
|
365
|
-
if (!(newRanges[i].start === oldRanges[i].start && newRanges[i].end === oldRanges[i].end)) {
|
|
366
|
-
hasDifference = true;
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
if (!hasDifference) {
|
|
371
|
-
this._updateHiddenRangePrefixSum(newRanges);
|
|
372
|
-
this.viewZones.onHiddenRangesChange();
|
|
373
|
-
this.viewZones.layout();
|
|
374
|
-
this.cellOverlays.onHiddenRangesChange();
|
|
375
|
-
this.cellOverlays.layout();
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
this._hiddenRangeIds.forEach(
|
|
380
|
-
id => this._viewModel.setTrackedRange(id, null, TrackedRangeStickiness.GrowsOnlyWhenTypingAfter)
|
|
381
|
-
);
|
|
382
|
-
const hiddenAreaIds = ( newRanges.map(
|
|
383
|
-
range => this._viewModel.setTrackedRange(null, range, TrackedRangeStickiness.GrowsOnlyWhenTypingAfter)
|
|
384
|
-
)).filter(id => id !== null);
|
|
385
|
-
this._hiddenRangeIds = hiddenAreaIds;
|
|
386
|
-
this._updateHiddenRangePrefixSum(newRanges);
|
|
387
|
-
this.viewZones.onHiddenRangesChange();
|
|
388
|
-
this.cellOverlays.onHiddenRangesChange();
|
|
389
|
-
if (triggerViewUpdate) {
|
|
390
|
-
this.updateHiddenAreasInView(oldRanges, newRanges);
|
|
391
|
-
}
|
|
392
|
-
this.viewZones.layout();
|
|
393
|
-
this.cellOverlays.layout();
|
|
394
|
-
return true;
|
|
395
|
-
}
|
|
396
|
-
_updateHiddenRangePrefixSum(newRanges) {
|
|
397
|
-
let start = 0;
|
|
398
|
-
let index = 0;
|
|
399
|
-
const ret = [];
|
|
400
|
-
while (index < newRanges.length) {
|
|
401
|
-
for (let j = start; j < newRanges[index].start - 1; j++) {
|
|
402
|
-
ret.push(1);
|
|
403
|
-
}
|
|
404
|
-
ret.push(newRanges[index].end - newRanges[index].start + 1 + 1);
|
|
405
|
-
start = newRanges[index].end + 1;
|
|
406
|
-
index++;
|
|
407
|
-
}
|
|
408
|
-
for (let i = start; i < this._viewModel.length; i++) {
|
|
409
|
-
ret.push(1);
|
|
410
|
-
}
|
|
411
|
-
const values = ( new Uint32Array(ret.length));
|
|
412
|
-
for (let i = 0; i < ret.length; i++) {
|
|
413
|
-
values[i] = ret[i];
|
|
414
|
-
}
|
|
415
|
-
this.hiddenRangesPrefixSum = ( new PrefixSumComputer(values));
|
|
416
|
-
}
|
|
417
|
-
updateHiddenAreasInView(oldRanges, newRanges) {
|
|
418
|
-
const oldViewCellEntries = getVisibleCells(this._viewModel.viewCells, oldRanges);
|
|
419
|
-
const oldViewCellMapping = ( new Set());
|
|
420
|
-
oldViewCellEntries.forEach(cell => {
|
|
421
|
-
oldViewCellMapping.add(( cell.uri.toString()));
|
|
422
|
-
});
|
|
423
|
-
const newViewCellEntries = getVisibleCells(this._viewModel.viewCells, newRanges);
|
|
424
|
-
const viewDiffs = diff(oldViewCellEntries, newViewCellEntries, a => {
|
|
425
|
-
return ( oldViewCellMapping.has(( a.uri.toString())));
|
|
426
|
-
});
|
|
427
|
-
this._updateElementsInWebview(viewDiffs);
|
|
428
|
-
}
|
|
429
|
-
splice2(start, deleteCount, elements = []) {
|
|
430
|
-
if (start < 0 || start > this.view.length) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
const focusInside = isAncestorOfActiveElement(this.rowsContainer);
|
|
434
|
-
super.splice(start, deleteCount, elements);
|
|
435
|
-
if (focusInside) {
|
|
436
|
-
this.domFocus();
|
|
437
|
-
}
|
|
438
|
-
const selectionsLeft = [];
|
|
439
|
-
this.getSelectedElements().forEach(el => {
|
|
440
|
-
if (this._viewModel.hasCell(el)) {
|
|
441
|
-
selectionsLeft.push(el.handle);
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
if (!selectionsLeft.length && this._viewModel.viewCells.length) {
|
|
445
|
-
this._viewModel.updateSelectionsState({
|
|
446
|
-
kind: SelectionStateType.Index,
|
|
447
|
-
focus: {
|
|
448
|
-
start: 0,
|
|
449
|
-
end: 1
|
|
450
|
-
},
|
|
451
|
-
selections: [{
|
|
452
|
-
start: 0,
|
|
453
|
-
end: 1
|
|
454
|
-
}]
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
this.viewZones.layout();
|
|
458
|
-
this.cellOverlays.layout();
|
|
459
|
-
}
|
|
460
|
-
getModelIndex(cell) {
|
|
461
|
-
const viewIndex = this.indexOf(cell);
|
|
462
|
-
return this.getModelIndex2(viewIndex);
|
|
463
|
-
}
|
|
464
|
-
getModelIndex2(viewIndex) {
|
|
465
|
-
if (!this.hiddenRangesPrefixSum) {
|
|
466
|
-
return viewIndex;
|
|
467
|
-
}
|
|
468
|
-
const modelIndex = this.hiddenRangesPrefixSum.getPrefixSum(viewIndex - 1);
|
|
469
|
-
return modelIndex;
|
|
470
|
-
}
|
|
471
|
-
getViewIndex(cell) {
|
|
472
|
-
const modelIndex = this._viewModel.getCellIndex(cell);
|
|
473
|
-
return this.getViewIndex2(modelIndex);
|
|
474
|
-
}
|
|
475
|
-
getViewIndex2(modelIndex) {
|
|
476
|
-
if (!this.hiddenRangesPrefixSum) {
|
|
477
|
-
return modelIndex;
|
|
478
|
-
}
|
|
479
|
-
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
|
480
|
-
if (viewIndexInfo.remainder !== 0) {
|
|
481
|
-
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
|
482
|
-
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
|
483
|
-
}
|
|
484
|
-
return undefined;
|
|
485
|
-
} else {
|
|
486
|
-
return viewIndexInfo.index;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
convertModelIndexToViewIndex(modelIndex) {
|
|
490
|
-
if (!this.hiddenRangesPrefixSum) {
|
|
491
|
-
return modelIndex;
|
|
492
|
-
}
|
|
493
|
-
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
|
494
|
-
return Math.min(this.length, this.hiddenRangesPrefixSum.getTotalSum());
|
|
495
|
-
}
|
|
496
|
-
return this.hiddenRangesPrefixSum.getIndexOf(modelIndex).index;
|
|
497
|
-
}
|
|
498
|
-
modelIndexIsVisible(modelIndex) {
|
|
499
|
-
if (!this.hiddenRangesPrefixSum) {
|
|
500
|
-
return true;
|
|
501
|
-
}
|
|
502
|
-
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
|
503
|
-
if (viewIndexInfo.remainder !== 0) {
|
|
504
|
-
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
|
505
|
-
return true;
|
|
506
|
-
}
|
|
507
|
-
return false;
|
|
508
|
-
} else {
|
|
509
|
-
return true;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
_getVisibleRangesFromIndex(topViewIndex, topModelIndex, bottomViewIndex, bottomModelIndex) {
|
|
513
|
-
const stack = [];
|
|
514
|
-
const ranges = [];
|
|
515
|
-
let index = topViewIndex;
|
|
516
|
-
let modelIndex = topModelIndex;
|
|
517
|
-
while (index <= bottomViewIndex) {
|
|
518
|
-
const accu = this.hiddenRangesPrefixSum.getPrefixSum(index);
|
|
519
|
-
if (accu === modelIndex + 1) {
|
|
520
|
-
if (stack.length) {
|
|
521
|
-
if (stack[stack.length - 1] === modelIndex - 1) {
|
|
522
|
-
ranges.push({
|
|
523
|
-
start: stack[stack.length - 1],
|
|
524
|
-
end: modelIndex + 1
|
|
525
|
-
});
|
|
526
|
-
} else {
|
|
527
|
-
ranges.push({
|
|
528
|
-
start: stack[stack.length - 1],
|
|
529
|
-
end: stack[stack.length - 1] + 1
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
stack.push(modelIndex);
|
|
534
|
-
index++;
|
|
535
|
-
modelIndex++;
|
|
536
|
-
} else {
|
|
537
|
-
if (stack.length) {
|
|
538
|
-
if (stack[stack.length - 1] === modelIndex - 1) {
|
|
539
|
-
ranges.push({
|
|
540
|
-
start: stack[stack.length - 1],
|
|
541
|
-
end: modelIndex + 1
|
|
542
|
-
});
|
|
543
|
-
} else {
|
|
544
|
-
ranges.push({
|
|
545
|
-
start: stack[stack.length - 1],
|
|
546
|
-
end: stack[stack.length - 1] + 1
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
stack.push(modelIndex);
|
|
551
|
-
index++;
|
|
552
|
-
modelIndex = accu;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
if (stack.length) {
|
|
556
|
-
ranges.push({
|
|
557
|
-
start: stack[stack.length - 1],
|
|
558
|
-
end: stack[stack.length - 1] + 1
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
return reduceCellRanges(ranges);
|
|
562
|
-
}
|
|
563
|
-
getVisibleRangesPlusViewportAboveAndBelow() {
|
|
564
|
-
if (this.view.length <= 0) {
|
|
565
|
-
return [];
|
|
566
|
-
}
|
|
567
|
-
const top = Math.max(this.getViewScrollTop() - this.renderHeight, 0);
|
|
568
|
-
const topViewIndex = this.view.indexAt(top);
|
|
569
|
-
const topElement = this.view.element(topViewIndex);
|
|
570
|
-
const topModelIndex = this._viewModel.getCellIndex(topElement);
|
|
571
|
-
const bottom = clamp(this.getViewScrollBottom() + this.renderHeight, 0, this.scrollHeight);
|
|
572
|
-
const bottomViewIndex = clamp(this.view.indexAt(bottom), 0, this.view.length - 1);
|
|
573
|
-
const bottomElement = this.view.element(bottomViewIndex);
|
|
574
|
-
const bottomModelIndex = this._viewModel.getCellIndex(bottomElement);
|
|
575
|
-
if (bottomModelIndex - topModelIndex === bottomViewIndex - topViewIndex) {
|
|
576
|
-
return [{
|
|
577
|
-
start: topModelIndex,
|
|
578
|
-
end: bottomModelIndex
|
|
579
|
-
}];
|
|
580
|
-
} else {
|
|
581
|
-
return this._getVisibleRangesFromIndex(topViewIndex, topModelIndex, bottomViewIndex, bottomModelIndex);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
_getViewIndexUpperBound(cell) {
|
|
585
|
-
if (!this._viewModel) {
|
|
586
|
-
return -1;
|
|
587
|
-
}
|
|
588
|
-
const modelIndex = this._viewModel.getCellIndex(cell);
|
|
589
|
-
if (modelIndex === -1) {
|
|
590
|
-
return -1;
|
|
591
|
-
}
|
|
592
|
-
if (!this.hiddenRangesPrefixSum) {
|
|
593
|
-
return modelIndex;
|
|
594
|
-
}
|
|
595
|
-
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
|
596
|
-
if (viewIndexInfo.remainder !== 0) {
|
|
597
|
-
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
|
598
|
-
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
return viewIndexInfo.index;
|
|
602
|
-
}
|
|
603
|
-
_getViewIndexUpperBound2(modelIndex) {
|
|
604
|
-
if (!this.hiddenRangesPrefixSum) {
|
|
605
|
-
return modelIndex;
|
|
606
|
-
}
|
|
607
|
-
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
|
608
|
-
if (viewIndexInfo.remainder !== 0) {
|
|
609
|
-
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
|
610
|
-
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
return viewIndexInfo.index;
|
|
614
|
-
}
|
|
615
|
-
focusElement(cell) {
|
|
616
|
-
const index = this._getViewIndexUpperBound(cell);
|
|
617
|
-
if (index >= 0 && this._viewModel) {
|
|
618
|
-
const focusedElementHandle = this.element(index).handle;
|
|
619
|
-
this._viewModel.updateSelectionsState({
|
|
620
|
-
kind: SelectionStateType.Handle,
|
|
621
|
-
primary: focusedElementHandle,
|
|
622
|
-
selections: [focusedElementHandle]
|
|
623
|
-
}, "view");
|
|
624
|
-
this.setFocus([index], undefined, false);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
selectElements(elements) {
|
|
628
|
-
const indices = ( elements.map(cell => this._getViewIndexUpperBound(cell))).filter(index => index >= 0);
|
|
629
|
-
this.setSelection(indices);
|
|
630
|
-
}
|
|
631
|
-
getCellViewScrollTop(cell) {
|
|
632
|
-
const index = this._getViewIndexUpperBound(cell);
|
|
633
|
-
if (index === undefined || index < 0 || index >= this.length) {
|
|
634
|
-
throw ( new ListError(this.listUser, `Invalid index ${index}`));
|
|
635
|
-
}
|
|
636
|
-
return this.view.elementTop(index);
|
|
637
|
-
}
|
|
638
|
-
getCellViewScrollBottom(cell) {
|
|
639
|
-
const index = this._getViewIndexUpperBound(cell);
|
|
640
|
-
if (index === undefined || index < 0 || index >= this.length) {
|
|
641
|
-
throw ( new ListError(this.listUser, `Invalid index ${index}`));
|
|
642
|
-
}
|
|
643
|
-
const top = this.view.elementTop(index);
|
|
644
|
-
const height = this.view.elementHeight(index);
|
|
645
|
-
return top + height;
|
|
646
|
-
}
|
|
647
|
-
setFocus(indexes, browserEvent, ignoreTextModelUpdate) {
|
|
648
|
-
if (ignoreTextModelUpdate) {
|
|
649
|
-
super.setFocus(indexes, browserEvent);
|
|
650
|
-
return;
|
|
651
|
-
}
|
|
652
|
-
if (!indexes.length) {
|
|
653
|
-
if (this._viewModel) {
|
|
654
|
-
if (this.length) {
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
this._viewModel.updateSelectionsState({
|
|
658
|
-
kind: SelectionStateType.Handle,
|
|
659
|
-
primary: null,
|
|
660
|
-
selections: []
|
|
661
|
-
}, "view");
|
|
662
|
-
}
|
|
663
|
-
} else {
|
|
664
|
-
if (this._viewModel) {
|
|
665
|
-
const focusedElementHandle = this.element(indexes[0]).handle;
|
|
666
|
-
this._viewModel.updateSelectionsState({
|
|
667
|
-
kind: SelectionStateType.Handle,
|
|
668
|
-
primary: focusedElementHandle,
|
|
669
|
-
selections: ( this.getSelection().map(selection => this.element(selection).handle))
|
|
670
|
-
}, "view");
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
super.setFocus(indexes, browserEvent);
|
|
674
|
-
}
|
|
675
|
-
setSelection(indexes, browserEvent, ignoreTextModelUpdate) {
|
|
676
|
-
if (ignoreTextModelUpdate) {
|
|
677
|
-
super.setSelection(indexes, browserEvent);
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
if (!indexes.length) {
|
|
681
|
-
if (this._viewModel) {
|
|
682
|
-
this._viewModel.updateSelectionsState({
|
|
683
|
-
kind: SelectionStateType.Handle,
|
|
684
|
-
primary: this.getFocusedElements()[0]?.handle ?? null,
|
|
685
|
-
selections: []
|
|
686
|
-
}, "view");
|
|
687
|
-
}
|
|
688
|
-
} else {
|
|
689
|
-
if (this._viewModel) {
|
|
690
|
-
this._viewModel.updateSelectionsState({
|
|
691
|
-
kind: SelectionStateType.Handle,
|
|
692
|
-
primary: this.getFocusedElements()[0]?.handle ?? null,
|
|
693
|
-
selections: ( ( indexes.map(index => this.element(index))).map(cell => cell.handle))
|
|
694
|
-
}, "view");
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
super.setSelection(indexes, browserEvent);
|
|
698
|
-
}
|
|
699
|
-
revealCells(range) {
|
|
700
|
-
const startIndex = this._getViewIndexUpperBound2(range.start);
|
|
701
|
-
if (startIndex < 0) {
|
|
702
|
-
return;
|
|
703
|
-
}
|
|
704
|
-
const endIndex = this._getViewIndexUpperBound2(range.end - 1);
|
|
705
|
-
const scrollTop = this.getViewScrollTop();
|
|
706
|
-
const wrapperBottom = this.getViewScrollBottom();
|
|
707
|
-
const elementTop = this.view.elementTop(startIndex);
|
|
708
|
-
if (elementTop >= scrollTop && elementTop < wrapperBottom) {
|
|
709
|
-
const endElementTop = this.view.elementTop(endIndex);
|
|
710
|
-
const endElementHeight = this.view.elementHeight(endIndex);
|
|
711
|
-
if (endElementTop + endElementHeight <= wrapperBottom) {
|
|
712
|
-
return;
|
|
713
|
-
}
|
|
714
|
-
if (endElementTop >= wrapperBottom) {
|
|
715
|
-
return this._revealInternal(endIndex, false, CellRevealPosition.Bottom);
|
|
716
|
-
}
|
|
717
|
-
if (endElementTop < wrapperBottom) {
|
|
718
|
-
if (endElementTop + endElementHeight - wrapperBottom < elementTop - scrollTop) {
|
|
719
|
-
return this.view.setScrollTop(scrollTop + endElementTop + endElementHeight - wrapperBottom);
|
|
720
|
-
} else {
|
|
721
|
-
return this._revealInternal(startIndex, false, CellRevealPosition.Top);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
this._revealInViewWithMinimalScrolling(startIndex);
|
|
726
|
-
}
|
|
727
|
-
_revealInViewWithMinimalScrolling(viewIndex, firstLine) {
|
|
728
|
-
const firstIndex = this.view.firstMostlyVisibleIndex;
|
|
729
|
-
const elementHeight = this.view.elementHeight(viewIndex);
|
|
730
|
-
if (viewIndex <= firstIndex || (!firstLine && elementHeight >= this.view.renderHeight)) {
|
|
731
|
-
this._revealInternal(viewIndex, true, CellRevealPosition.Top);
|
|
732
|
-
} else {
|
|
733
|
-
this._revealInternal(viewIndex, true, CellRevealPosition.Bottom, firstLine);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
scrollToBottom() {
|
|
737
|
-
const scrollHeight = this.view.scrollHeight;
|
|
738
|
-
const scrollTop = this.getViewScrollTop();
|
|
739
|
-
const wrapperBottom = this.getViewScrollBottom();
|
|
740
|
-
this.view.setScrollTop(scrollHeight - (wrapperBottom - scrollTop));
|
|
741
|
-
}
|
|
742
|
-
async revealCell(cell, revealType) {
|
|
743
|
-
const index = this._getViewIndexUpperBound(cell);
|
|
744
|
-
if (index < 0) {
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
switch (revealType) {
|
|
748
|
-
case CellRevealType.Top:
|
|
749
|
-
this._revealInternal(index, false, CellRevealPosition.Top);
|
|
750
|
-
break;
|
|
751
|
-
case CellRevealType.Center:
|
|
752
|
-
this._revealInternal(index, false, CellRevealPosition.Center);
|
|
753
|
-
break;
|
|
754
|
-
case CellRevealType.CenterIfOutsideViewport:
|
|
755
|
-
this._revealInternal(index, true, CellRevealPosition.Center);
|
|
756
|
-
break;
|
|
757
|
-
case CellRevealType.NearTopIfOutsideViewport:
|
|
758
|
-
this._revealInternal(index, true, CellRevealPosition.NearTop);
|
|
759
|
-
break;
|
|
760
|
-
case CellRevealType.FirstLineIfOutsideViewport:
|
|
761
|
-
this._revealInViewWithMinimalScrolling(index, true);
|
|
762
|
-
break;
|
|
763
|
-
case CellRevealType.Default:
|
|
764
|
-
this._revealInViewWithMinimalScrolling(index);
|
|
765
|
-
break;
|
|
766
|
-
}
|
|
767
|
-
if (
|
|
768
|
-
(
|
|
769
|
-
cell.getEditState() === CellEditState.Editing || (revealType === CellRevealType.FirstLineIfOutsideViewport && cell.cellKind === CellKind.Code)) && !cell.editorAttached) {
|
|
770
|
-
return getEditorAttachedPromise(cell);
|
|
771
|
-
}
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
_revealInternal(viewIndex, ignoreIfInsideViewport, revealPosition, firstLine) {
|
|
775
|
-
if (viewIndex >= this.view.length) {
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
const scrollTop = this.getViewScrollTop();
|
|
779
|
-
const wrapperBottom = this.getViewScrollBottom();
|
|
780
|
-
const elementTop = this.view.elementTop(viewIndex);
|
|
781
|
-
const elementBottom = this.view.elementHeight(viewIndex) + elementTop;
|
|
782
|
-
if (ignoreIfInsideViewport) {
|
|
783
|
-
if (elementTop >= scrollTop && elementBottom < wrapperBottom) {
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
switch (revealPosition) {
|
|
788
|
-
case CellRevealPosition.Top:
|
|
789
|
-
this.view.setScrollTop(elementTop);
|
|
790
|
-
this.view.setScrollTop(this.view.elementTop(viewIndex));
|
|
791
|
-
break;
|
|
792
|
-
case CellRevealPosition.Center:
|
|
793
|
-
case CellRevealPosition.NearTop:
|
|
794
|
-
{
|
|
795
|
-
this.view.setScrollTop(elementTop - this.view.renderHeight / 2);
|
|
796
|
-
const newElementTop = this.view.elementTop(viewIndex);
|
|
797
|
-
const newElementHeight = this.view.elementHeight(viewIndex);
|
|
798
|
-
const renderHeight = this.getViewScrollBottom() - this.getViewScrollTop();
|
|
799
|
-
if (newElementHeight >= renderHeight) {
|
|
800
|
-
this.view.setScrollTop(newElementTop);
|
|
801
|
-
} else if (revealPosition === CellRevealPosition.Center) {
|
|
802
|
-
this.view.setScrollTop(newElementTop + (newElementHeight / 2) - (renderHeight / 2));
|
|
803
|
-
} else if (revealPosition === CellRevealPosition.NearTop) {
|
|
804
|
-
this.view.setScrollTop(newElementTop - (renderHeight / 5));
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
break;
|
|
808
|
-
case CellRevealPosition.Bottom:
|
|
809
|
-
if (firstLine) {
|
|
810
|
-
const lineHeight = this.viewModel?.layoutInfo?.fontInfo.lineHeight ?? 15;
|
|
811
|
-
const padding = this.notebookOptions.getLayoutConfiguration().cellTopMargin + this.notebookOptions.getLayoutConfiguration().editorTopPadding;
|
|
812
|
-
const firstLineLocation = elementTop + lineHeight + padding;
|
|
813
|
-
if (firstLineLocation < wrapperBottom) {
|
|
814
|
-
return;
|
|
815
|
-
}
|
|
816
|
-
this.view.setScrollTop(this.scrollTop + (firstLineLocation - wrapperBottom));
|
|
817
|
-
break;
|
|
818
|
-
}
|
|
819
|
-
this.view.setScrollTop(this.scrollTop + (elementBottom - wrapperBottom));
|
|
820
|
-
this.view.setScrollTop(
|
|
821
|
-
this.scrollTop + (this.view.elementTop(viewIndex) + this.view.elementHeight(viewIndex) - this.getViewScrollBottom())
|
|
822
|
-
);
|
|
823
|
-
break;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
async revealRangeInCell(cell, range, revealType) {
|
|
827
|
-
const index = this._getViewIndexUpperBound(cell);
|
|
828
|
-
if (index < 0) {
|
|
829
|
-
return;
|
|
830
|
-
}
|
|
831
|
-
switch (revealType) {
|
|
832
|
-
case CellRevealRangeType.Default:
|
|
833
|
-
return this._revealRangeInternalAsync(index, range);
|
|
834
|
-
case CellRevealRangeType.Center:
|
|
835
|
-
return this._revealRangeInCenterInternalAsync(index, range);
|
|
836
|
-
case CellRevealRangeType.CenterIfOutsideViewport:
|
|
837
|
-
return this._revealRangeInCenterIfOutsideViewportInternalAsync(index, range);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
async _revealRangeInternalAsync(viewIndex, range) {
|
|
841
|
-
const scrollTop = this.getViewScrollTop();
|
|
842
|
-
const wrapperBottom = this.getViewScrollBottom();
|
|
843
|
-
const elementTop = this.view.elementTop(viewIndex);
|
|
844
|
-
const element = this.view.element(viewIndex);
|
|
845
|
-
if (element.editorAttached) {
|
|
846
|
-
this._revealRangeCommon(viewIndex, range);
|
|
847
|
-
} else {
|
|
848
|
-
const elementHeight = this.view.elementHeight(viewIndex);
|
|
849
|
-
let alignHint = undefined;
|
|
850
|
-
if (elementTop + elementHeight <= scrollTop) {
|
|
851
|
-
this.view.setScrollTop(elementTop);
|
|
852
|
-
alignHint = "top";
|
|
853
|
-
} else if (elementTop >= wrapperBottom) {
|
|
854
|
-
this.view.setScrollTop(elementTop - this.view.renderHeight / 2);
|
|
855
|
-
alignHint = "bottom";
|
|
856
|
-
}
|
|
857
|
-
const editorAttachedPromise = ( new Promise((resolve, reject) => {
|
|
858
|
-
Event.once(element.onDidChangeEditorAttachState)(() => {
|
|
859
|
-
element.editorAttached ? resolve() : reject();
|
|
860
|
-
});
|
|
861
|
-
}));
|
|
862
|
-
return editorAttachedPromise.then(() => {
|
|
863
|
-
this._revealRangeCommon(viewIndex, range, alignHint);
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
async _revealRangeInCenterInternalAsync(viewIndex, range) {
|
|
868
|
-
const reveal = (viewIndex, range) => {
|
|
869
|
-
const element = this.view.element(viewIndex);
|
|
870
|
-
const positionOffset = element.getPositionScrollTopOffset(range);
|
|
871
|
-
const positionOffsetInView = this.view.elementTop(viewIndex) + positionOffset;
|
|
872
|
-
this.view.setScrollTop(positionOffsetInView - this.view.renderHeight / 2);
|
|
873
|
-
element.revealRangeInCenter(range);
|
|
874
|
-
};
|
|
875
|
-
const elementTop = this.view.elementTop(viewIndex);
|
|
876
|
-
const viewItemOffset = elementTop;
|
|
877
|
-
this.view.setScrollTop(viewItemOffset - this.view.renderHeight / 2);
|
|
878
|
-
const element = this.view.element(viewIndex);
|
|
879
|
-
if (!element.editorAttached) {
|
|
880
|
-
return getEditorAttachedPromise(element).then(() => reveal(viewIndex, range));
|
|
881
|
-
} else {
|
|
882
|
-
reveal(viewIndex, range);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
async _revealRangeInCenterIfOutsideViewportInternalAsync(viewIndex, range) {
|
|
886
|
-
const reveal = (viewIndex, range) => {
|
|
887
|
-
const element = this.view.element(viewIndex);
|
|
888
|
-
const positionOffset = element.getPositionScrollTopOffset(range);
|
|
889
|
-
const positionOffsetInView = this.view.elementTop(viewIndex) + positionOffset;
|
|
890
|
-
this.view.setScrollTop(positionOffsetInView - this.view.renderHeight / 2);
|
|
891
|
-
element.revealRangeInCenter(range);
|
|
892
|
-
};
|
|
893
|
-
const scrollTop = this.getViewScrollTop();
|
|
894
|
-
const wrapperBottom = this.getViewScrollBottom();
|
|
895
|
-
const elementTop = this.view.elementTop(viewIndex);
|
|
896
|
-
const viewItemOffset = elementTop;
|
|
897
|
-
const element = this.view.element(viewIndex);
|
|
898
|
-
const positionOffset = viewItemOffset + element.getPositionScrollTopOffset(range);
|
|
899
|
-
if (positionOffset < scrollTop || positionOffset > wrapperBottom) {
|
|
900
|
-
this.view.setScrollTop(positionOffset - this.view.renderHeight / 2);
|
|
901
|
-
const newPositionOffset = this.view.elementTop(viewIndex) + element.getPositionScrollTopOffset(range);
|
|
902
|
-
this.view.setScrollTop(newPositionOffset - this.view.renderHeight / 2);
|
|
903
|
-
if (!element.editorAttached) {
|
|
904
|
-
return getEditorAttachedPromise(element).then(() => reveal(viewIndex, range));
|
|
905
|
-
}
|
|
906
|
-
} else {
|
|
907
|
-
if (element.editorAttached) {
|
|
908
|
-
element.revealRangeInCenter(range);
|
|
909
|
-
} else {
|
|
910
|
-
return getEditorAttachedPromise(element).then(() => reveal(viewIndex, range));
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
_revealRangeCommon(viewIndex, range, alignHint) {
|
|
915
|
-
const element = this.view.element(viewIndex);
|
|
916
|
-
const scrollTop = this.getViewScrollTop();
|
|
917
|
-
const wrapperBottom = this.getViewScrollBottom();
|
|
918
|
-
const positionOffset = element.getPositionScrollTopOffset(range);
|
|
919
|
-
const elementOriginalHeight = this.view.elementHeight(viewIndex);
|
|
920
|
-
if (positionOffset >= elementOriginalHeight) {
|
|
921
|
-
const newTotalHeight = element.layoutInfo.totalHeight;
|
|
922
|
-
this.updateElementHeight(viewIndex, newTotalHeight);
|
|
923
|
-
}
|
|
924
|
-
const elementTop = this.view.elementTop(viewIndex);
|
|
925
|
-
const positionTop = elementTop + positionOffset;
|
|
926
|
-
if (positionTop < scrollTop) {
|
|
927
|
-
this.view.setScrollTop(positionTop - 30);
|
|
928
|
-
} else if (positionTop > wrapperBottom) {
|
|
929
|
-
this.view.setScrollTop(scrollTop + positionTop - wrapperBottom + 30);
|
|
930
|
-
} else if (alignHint === "bottom") {
|
|
931
|
-
this.view.setScrollTop(scrollTop + positionTop - wrapperBottom + 30);
|
|
932
|
-
} else if (alignHint === "top") {
|
|
933
|
-
this.view.setScrollTop(positionTop - 30);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
revealCellOffsetInCenter(cell, offset) {
|
|
937
|
-
const viewIndex = this._getViewIndexUpperBound(cell);
|
|
938
|
-
if (viewIndex >= 0) {
|
|
939
|
-
const element = this.view.element(viewIndex);
|
|
940
|
-
const elementTop = this.view.elementTop(viewIndex);
|
|
941
|
-
if (element instanceof MarkupCellViewModel) {
|
|
942
|
-
return this._revealInCenterIfOutsideViewport(viewIndex);
|
|
943
|
-
} else {
|
|
944
|
-
const rangeOffset = element.layoutInfo.outputContainerOffset + Math.min(offset, element.layoutInfo.outputTotalHeight);
|
|
945
|
-
this.view.setScrollTop(elementTop - this.view.renderHeight / 2);
|
|
946
|
-
this.view.setScrollTop(elementTop + rangeOffset - this.view.renderHeight / 2);
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
revealOffsetInCenterIfOutsideViewport(offset) {
|
|
951
|
-
const scrollTop = this.getViewScrollTop();
|
|
952
|
-
const wrapperBottom = this.getViewScrollBottom();
|
|
953
|
-
if (offset < scrollTop || offset > wrapperBottom) {
|
|
954
|
-
const newTop = Math.max(0, offset - this.view.renderHeight / 2);
|
|
955
|
-
this.view.setScrollTop(newTop);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
_revealInCenterIfOutsideViewport(viewIndex) {
|
|
959
|
-
this._revealInternal(viewIndex, true, CellRevealPosition.Center);
|
|
960
|
-
}
|
|
961
|
-
domElementOfElement(element) {
|
|
962
|
-
const index = this._getViewIndexUpperBound(element);
|
|
963
|
-
if (index >= 0 && index < this.length) {
|
|
964
|
-
return this.view.domElement(index);
|
|
965
|
-
}
|
|
966
|
-
return null;
|
|
967
|
-
}
|
|
968
|
-
focusView() {
|
|
969
|
-
this.view.domNode.focus();
|
|
970
|
-
}
|
|
971
|
-
triggerScrollFromMouseWheelEvent(browserEvent) {
|
|
972
|
-
this.view.delegateScrollFromMouseWheelEvent(browserEvent);
|
|
973
|
-
}
|
|
974
|
-
delegateVerticalScrollbarPointerDown(browserEvent) {
|
|
975
|
-
this.view.delegateVerticalScrollbarPointerDown(browserEvent);
|
|
976
|
-
}
|
|
977
|
-
isElementAboveViewport(index) {
|
|
978
|
-
const elementTop = this.view.elementTop(index);
|
|
979
|
-
const elementBottom = elementTop + this.view.elementHeight(index);
|
|
980
|
-
return elementBottom < this.scrollTop;
|
|
981
|
-
}
|
|
982
|
-
updateElementHeight2(element, size, anchorElementIndex = null) {
|
|
983
|
-
const index = this._getViewIndexUpperBound(element);
|
|
984
|
-
if (index === undefined || index < 0 || index >= this.length) {
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
if (this.isElementAboveViewport(index)) {
|
|
988
|
-
const oldHeight = this.elementHeight(element);
|
|
989
|
-
const delta = oldHeight - size;
|
|
990
|
-
if (this._webviewElement) {
|
|
991
|
-
Event.once(this.view.onWillScroll)(() => {
|
|
992
|
-
const webviewTop = parseInt(this._webviewElement.domNode.style.top, 10);
|
|
993
|
-
if (validateWebviewBoundary(this._webviewElement.domNode)) {
|
|
994
|
-
this._webviewElement.setTop(webviewTop - delta);
|
|
995
|
-
} else {
|
|
996
|
-
this._webviewElement.setTop(-NOTEBOOK_WEBVIEW_BOUNDARY);
|
|
997
|
-
}
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
this.view.updateElementHeight(index, size, anchorElementIndex);
|
|
1001
|
-
this.viewZones.layout();
|
|
1002
|
-
this.cellOverlays.layout();
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
if (anchorElementIndex !== null) {
|
|
1006
|
-
this.view.updateElementHeight(index, size, anchorElementIndex);
|
|
1007
|
-
this.viewZones.layout();
|
|
1008
|
-
this.cellOverlays.layout();
|
|
1009
|
-
return;
|
|
1010
|
-
}
|
|
1011
|
-
const focused = this.getFocus();
|
|
1012
|
-
const focus = focused.length ? focused[0] : null;
|
|
1013
|
-
if (focus) {
|
|
1014
|
-
const heightDelta = size - this.view.elementHeight(index);
|
|
1015
|
-
if (this._notebookCellAnchor.shouldAnchor(this.view, focus, heightDelta, this.element(index))) {
|
|
1016
|
-
this.view.updateElementHeight(index, size, focus);
|
|
1017
|
-
this.viewZones.layout();
|
|
1018
|
-
this.cellOverlays.layout();
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
this.view.updateElementHeight(index, size, null);
|
|
1023
|
-
this.viewZones.layout();
|
|
1024
|
-
this.cellOverlays.layout();
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
changeViewZones(callback) {
|
|
1028
|
-
if (this.viewZones.changeViewZones(callback)) {
|
|
1029
|
-
this.viewZones.layout();
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
changeCellOverlays(callback) {
|
|
1033
|
-
if (this.cellOverlays.changeCellOverlays(callback)) {
|
|
1034
|
-
this.cellOverlays.layout();
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
getViewZoneLayoutInfo(viewZoneId) {
|
|
1038
|
-
return this.viewZones.getViewZoneLayoutInfo(viewZoneId);
|
|
1039
|
-
}
|
|
1040
|
-
domFocus() {
|
|
1041
|
-
const focused = this.getFocusedElements()[0];
|
|
1042
|
-
const focusedDomElement = focused && this.domElementOfElement(focused);
|
|
1043
|
-
const activeElement = getActiveElement(this.view.domNode.ownerDocument);
|
|
1044
|
-
if (activeElement && focusedDomElement && focusedDomElement.contains(activeElement)) {
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
if (!isMacintosh && activeElement && !!findParentWithClass(activeElement, "context-view")) {
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
super.domFocus();
|
|
1051
|
-
}
|
|
1052
|
-
focusContainer(clearSelection) {
|
|
1053
|
-
if (clearSelection) {
|
|
1054
|
-
this._viewModel?.updateSelectionsState({
|
|
1055
|
-
kind: SelectionStateType.Handle,
|
|
1056
|
-
primary: null,
|
|
1057
|
-
selections: []
|
|
1058
|
-
}, "view");
|
|
1059
|
-
this.setFocus([], undefined, true);
|
|
1060
|
-
this.setSelection([], undefined, true);
|
|
1061
|
-
}
|
|
1062
|
-
super.domFocus();
|
|
1063
|
-
}
|
|
1064
|
-
getViewScrollTop() {
|
|
1065
|
-
return this.view.getScrollTop();
|
|
1066
|
-
}
|
|
1067
|
-
getViewScrollBottom() {
|
|
1068
|
-
return this.getViewScrollTop() + this.view.renderHeight;
|
|
1069
|
-
}
|
|
1070
|
-
setCellEditorSelection(cell, range) {
|
|
1071
|
-
const element = cell;
|
|
1072
|
-
if (element.editorAttached) {
|
|
1073
|
-
element.setSelection(range);
|
|
1074
|
-
} else {
|
|
1075
|
-
getEditorAttachedPromise(element).then(() => {
|
|
1076
|
-
element.setSelection(range);
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
style(styles) {
|
|
1081
|
-
const selectorSuffix = this.view.domId;
|
|
1082
|
-
if (!this.styleElement) {
|
|
1083
|
-
this.styleElement = createStyleSheet(this.view.domNode);
|
|
1084
|
-
}
|
|
1085
|
-
const suffix = selectorSuffix && `.${selectorSuffix}`;
|
|
1086
|
-
const content = [];
|
|
1087
|
-
if (styles.listBackground) {
|
|
1088
|
-
content.push(
|
|
1089
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows { background: ${styles.listBackground}; }`
|
|
1090
|
-
);
|
|
1091
|
-
}
|
|
1092
|
-
if (styles.listFocusBackground) {
|
|
1093
|
-
content.push(
|
|
1094
|
-
`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`
|
|
1095
|
-
);
|
|
1096
|
-
content.push(
|
|
1097
|
-
`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${styles.listFocusBackground}; }`
|
|
1098
|
-
);
|
|
1099
|
-
}
|
|
1100
|
-
if (styles.listFocusForeground) {
|
|
1101
|
-
content.push(
|
|
1102
|
-
`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${styles.listFocusForeground}; }`
|
|
1103
|
-
);
|
|
1104
|
-
}
|
|
1105
|
-
if (styles.listActiveSelectionBackground) {
|
|
1106
|
-
content.push(
|
|
1107
|
-
`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${styles.listActiveSelectionBackground}; }`
|
|
1108
|
-
);
|
|
1109
|
-
content.push(
|
|
1110
|
-
`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${styles.listActiveSelectionBackground}; }`
|
|
1111
|
-
);
|
|
1112
|
-
}
|
|
1113
|
-
if (styles.listActiveSelectionForeground) {
|
|
1114
|
-
content.push(
|
|
1115
|
-
`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${styles.listActiveSelectionForeground}; }`
|
|
1116
|
-
);
|
|
1117
|
-
}
|
|
1118
|
-
if (styles.listFocusAndSelectionBackground) {
|
|
1119
|
-
content.push(`
|
|
1120
|
-
.monaco-drag-image${suffix},
|
|
1121
|
-
.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${styles.listFocusAndSelectionBackground}; }
|
|
1122
|
-
`);
|
|
1123
|
-
}
|
|
1124
|
-
if (styles.listFocusAndSelectionForeground) {
|
|
1125
|
-
content.push(`
|
|
1126
|
-
.monaco-drag-image${suffix},
|
|
1127
|
-
.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${styles.listFocusAndSelectionForeground}; }
|
|
1128
|
-
`);
|
|
1129
|
-
}
|
|
1130
|
-
if (styles.listInactiveFocusBackground) {
|
|
1131
|
-
content.push(
|
|
1132
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${styles.listInactiveFocusBackground}; }`
|
|
1133
|
-
);
|
|
1134
|
-
content.push(
|
|
1135
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${styles.listInactiveFocusBackground}; }`
|
|
1136
|
-
);
|
|
1137
|
-
}
|
|
1138
|
-
if (styles.listInactiveSelectionBackground) {
|
|
1139
|
-
content.push(
|
|
1140
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${styles.listInactiveSelectionBackground}; }`
|
|
1141
|
-
);
|
|
1142
|
-
content.push(
|
|
1143
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${styles.listInactiveSelectionBackground}; }`
|
|
1144
|
-
);
|
|
1145
|
-
}
|
|
1146
|
-
if (styles.listInactiveSelectionForeground) {
|
|
1147
|
-
content.push(
|
|
1148
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${styles.listInactiveSelectionForeground}; }`
|
|
1149
|
-
);
|
|
1150
|
-
}
|
|
1151
|
-
if (styles.listHoverBackground) {
|
|
1152
|
-
content.push(
|
|
1153
|
-
`.monaco-list${suffix}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`
|
|
1154
|
-
);
|
|
1155
|
-
}
|
|
1156
|
-
if (styles.listHoverForeground) {
|
|
1157
|
-
content.push(
|
|
1158
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`
|
|
1159
|
-
);
|
|
1160
|
-
}
|
|
1161
|
-
if (styles.listSelectionOutline) {
|
|
1162
|
-
content.push(
|
|
1163
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${styles.listSelectionOutline}; outline-offset: -1px; }`
|
|
1164
|
-
);
|
|
1165
|
-
}
|
|
1166
|
-
if (styles.listFocusOutline) {
|
|
1167
|
-
content.push(`
|
|
1168
|
-
.monaco-drag-image${suffix},
|
|
1169
|
-
.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }
|
|
1170
|
-
`);
|
|
1171
|
-
}
|
|
1172
|
-
if (styles.listInactiveFocusOutline) {
|
|
1173
|
-
content.push(
|
|
1174
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${styles.listInactiveFocusOutline}; outline-offset: -1px; }`
|
|
1175
|
-
);
|
|
1176
|
-
}
|
|
1177
|
-
if (styles.listHoverOutline) {
|
|
1178
|
-
content.push(
|
|
1179
|
-
`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${styles.listHoverOutline}; outline-offset: -1px; }`
|
|
1180
|
-
);
|
|
1181
|
-
}
|
|
1182
|
-
if (styles.listDropOverBackground) {
|
|
1183
|
-
content.push(`
|
|
1184
|
-
.monaco-list${suffix}.drop-target,
|
|
1185
|
-
.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
|
|
1186
|
-
.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${styles.listDropOverBackground} !important; color: inherit !important; }
|
|
1187
|
-
`);
|
|
1188
|
-
}
|
|
1189
|
-
const newStyles = content.join("\n");
|
|
1190
|
-
if (newStyles !== this.styleElement.textContent) {
|
|
1191
|
-
this.styleElement.textContent = newStyles;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
getRenderHeight() {
|
|
1195
|
-
return this.view.renderHeight;
|
|
1196
|
-
}
|
|
1197
|
-
getScrollHeight() {
|
|
1198
|
-
return this.view.scrollHeight;
|
|
1199
|
-
}
|
|
1200
|
-
layout(height, width) {
|
|
1201
|
-
this._isInLayout = true;
|
|
1202
|
-
super.layout(height, width);
|
|
1203
|
-
if (this.renderHeight === 0) {
|
|
1204
|
-
this.view.domNode.style.visibility = "hidden";
|
|
1205
|
-
} else {
|
|
1206
|
-
this.view.domNode.style.visibility = "initial";
|
|
1207
|
-
}
|
|
1208
|
-
this._isInLayout = false;
|
|
1209
|
-
}
|
|
1210
|
-
dispose() {
|
|
1211
|
-
this._isDisposed = true;
|
|
1212
|
-
this._viewModelStore.dispose();
|
|
1213
|
-
this._localDisposableStore.dispose();
|
|
1214
|
-
this._notebookCellAnchor.dispose();
|
|
1215
|
-
this.viewZones.dispose();
|
|
1216
|
-
this.cellOverlays.dispose();
|
|
1217
|
-
super.dispose();
|
|
1218
|
-
this._previousFocusedElements = [];
|
|
1219
|
-
this._viewModel = null;
|
|
1220
|
-
this._hiddenRangeIds = [];
|
|
1221
|
-
this.hiddenRangesPrefixSum = null;
|
|
1222
|
-
this._visibleRanges = [];
|
|
1223
|
-
}
|
|
1224
|
-
};
|
|
1225
|
-
NotebookCellList = ( __decorate([( __param(7, IListService)), ( __param(8, IConfigurationService)), ( __param(9, IInstantiationService)), ( __param(10, INotebookExecutionStateService))], NotebookCellList));
|
|
1226
|
-
class ListViewInfoAccessor extends Disposable {
|
|
1227
|
-
constructor(list) {
|
|
1228
|
-
super();
|
|
1229
|
-
this.list = list;
|
|
1230
|
-
}
|
|
1231
|
-
getViewIndex(cell) {
|
|
1232
|
-
return this.list.getViewIndex(cell) ?? -1;
|
|
1233
|
-
}
|
|
1234
|
-
getViewHeight(cell) {
|
|
1235
|
-
if (!this.list.viewModel) {
|
|
1236
|
-
return -1;
|
|
1237
|
-
}
|
|
1238
|
-
return this.list.elementHeight(cell);
|
|
1239
|
-
}
|
|
1240
|
-
getCellRangeFromViewRange(startIndex, endIndex) {
|
|
1241
|
-
if (!this.list.viewModel) {
|
|
1242
|
-
return undefined;
|
|
1243
|
-
}
|
|
1244
|
-
const modelIndex = this.list.getModelIndex2(startIndex);
|
|
1245
|
-
if (modelIndex === undefined) {
|
|
1246
|
-
throw ( new Error(`startIndex ${startIndex} out of boundary`));
|
|
1247
|
-
}
|
|
1248
|
-
if (endIndex >= this.list.length) {
|
|
1249
|
-
const endModelIndex = this.list.viewModel.length;
|
|
1250
|
-
return {
|
|
1251
|
-
start: modelIndex,
|
|
1252
|
-
end: endModelIndex
|
|
1253
|
-
};
|
|
1254
|
-
} else {
|
|
1255
|
-
const endModelIndex = this.list.getModelIndex2(endIndex);
|
|
1256
|
-
if (endModelIndex === undefined) {
|
|
1257
|
-
throw ( new Error(`endIndex ${endIndex} out of boundary`));
|
|
1258
|
-
}
|
|
1259
|
-
return {
|
|
1260
|
-
start: modelIndex,
|
|
1261
|
-
end: endModelIndex
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
getCellsFromViewRange(startIndex, endIndex) {
|
|
1266
|
-
if (!this.list.viewModel) {
|
|
1267
|
-
return [];
|
|
1268
|
-
}
|
|
1269
|
-
const range = this.getCellRangeFromViewRange(startIndex, endIndex);
|
|
1270
|
-
if (!range) {
|
|
1271
|
-
return [];
|
|
1272
|
-
}
|
|
1273
|
-
return this.list.viewModel.getCellsInRange(range);
|
|
1274
|
-
}
|
|
1275
|
-
getCellsInRange(range) {
|
|
1276
|
-
return this.list.viewModel?.getCellsInRange(range) ?? [];
|
|
1277
|
-
}
|
|
1278
|
-
getVisibleRangesPlusViewportAboveAndBelow() {
|
|
1279
|
-
return this.list?.getVisibleRangesPlusViewportAboveAndBelow() ?? [];
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
function getEditorAttachedPromise(element) {
|
|
1283
|
-
return ( new Promise((resolve, reject) => {
|
|
1284
|
-
Event.once(element.onDidChangeEditorAttachState)(() => element.editorAttached ? resolve() : reject());
|
|
1285
|
-
}));
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
export { ListViewInfoAccessor, NOTEBOOK_WEBVIEW_BOUNDARY, NotebookCellList };
|