@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.
Files changed (313) hide show
  1. package/missing-services.js +6 -26
  2. package/package.json +8 -8
  3. package/services.d.ts +1 -1
  4. package/services.js +3 -3
  5. package/tools.d.ts +4 -0
  6. package/tools.js +24 -1
  7. package/vscode/src/vs/platform/product/common/product.js +1 -1
  8. package/vscode/src/vs/platform/webWorker/browser/webWorkerServiceImpl.js +2 -2
  9. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.d.ts +63 -0
  10. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +305 -0
  11. package/vscode/src/vs/workbench/api/common/extHost.protocol.d.ts +2 -2
  12. package/vscode/src/vs/workbench/api/common/extHostLanguageModelTools.js +1 -2
  13. package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +1 -1
  14. package/vscode/src/vs/workbench/browser/media/code-icon.svg +1 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatConstants.d.ts +1 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatConstants.js +2 -1
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +2 -2
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.service.d.ts +1 -1
  19. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.d.ts +30 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.js +39 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service.d.ts +1 -1
  22. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.service.d.ts +1 -1
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chat.d.ts +1 -1
  24. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.service.d.ts +1 -1
  25. package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.d.ts +1 -1
  26. package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.service.d.ts +1 -1
  27. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.service.d.ts +1 -1
  28. package/vscode/src/vs/workbench/contrib/chat/common/chatImageBuffer.d.ts +1 -0
  29. package/vscode/src/vs/workbench/contrib/chat/common/chatImageBuffer.js +29 -0
  30. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatService.d.ts +2 -2
  31. package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.service.d.ts +1 -1
  32. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.d.ts +1 -1
  33. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginRepositoryService.service.d.ts +2 -2
  34. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.service.d.ts +1 -1
  35. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.d.ts +1 -1
  36. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.service.d.ts +1 -1
  37. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.service.d.ts +2 -2
  38. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginSource.d.ts +1 -1
  39. package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatParserTypes.d.ts +1 -1
  40. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolIds.d.ts +3 -0
  41. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolIds.js +7 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.d.ts +3 -3
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service.d.ts +1 -1
  44. package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.d.ts +1 -1
  45. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.d.ts +1 -1
  46. package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.d.ts +1 -1
  47. package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.service.d.ts +1 -1
  48. package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/notebook/common/notebookService.service.d.ts +1 -1
  50. package/vscode/src/vs/workbench/contrib/search/browser/AISearch/aiSearchModel.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchModel.d.ts +1 -1
  52. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchModelBase.d.ts +1 -1
  53. package/vscode/src/vs/workbench/contrib/search/browser/searchTreeModel/folderMatch.d.ts +1 -1
  54. package/vscode/src/vs/workbench/contrib/search/browser/searchTreeModel/searchTreeCommon.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +4 -3
  56. package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.d.ts +34 -0
  57. package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.js +72 -0
  58. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.d.ts +44 -0
  59. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.js +96 -0
  60. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css +1148 -0
  61. package/vscode/src/vs/workbench/contrib/welcomeOnboarding/common/onboardingTypes.d.ts +81 -0
  62. package/vscode/src/vs/workbench/contrib/welcomeOnboarding/common/onboardingTypes.js +97 -0
  63. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.d.ts +32 -0
  64. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +45 -0
  65. package/vscode/src/vs/platform/agentHost/common/agentHostEnablementService.d.ts +0 -7
  66. package/vscode/src/vs/platform/agentHost/common/agentHostEnablementService.js +0 -92
  67. package/vscode/src/vs/platform/layout/browser/zIndexRegistry.d.ts +0 -12
  68. package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +0 -64
  69. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.d.ts +0 -262
  70. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel.js +0 -865
  71. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.d.ts +0 -57
  72. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.js +0 -311
  73. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.d.ts +0 -15
  74. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.js +0 -80
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.d.ts +0 -2
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +0 -57
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +0 -231
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +0 -1850
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +0 -109
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +0 -85
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.d.ts +0 -140
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.js +0 -186
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatDynamicVariablesConstant.d.ts +0 -1
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatDynamicVariablesConstant.js +0 -5
  85. package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.d.ts +0 -46
  86. package/vscode/src/vs/workbench/contrib/chat/common/attachments/chatVariables.js +0 -17
  87. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +0 -253
  88. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +0 -20
  89. package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.d.ts +0 -34
  90. package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +0 -194
  91. package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.d.ts +0 -87
  92. package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.js +0 -69
  93. package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +0 -300
  94. package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +0 -272
  95. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +0 -25
  96. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +0 -178
  97. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +0 -78
  98. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +0 -51
  99. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +0 -67
  100. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +0 -195
  101. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +0 -67
  102. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +0 -294
  103. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +0 -212
  104. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +0 -955
  105. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +0 -31
  106. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +0 -122
  107. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +0 -65
  108. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +0 -697
  109. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/config.d.ts +0 -150
  110. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/config/config.js +0 -142
  111. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +0 -50
  112. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +0 -77
  113. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +0 -77
  114. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +0 -120
  115. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +0 -10
  116. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +0 -23
  117. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.d.ts +0 -92
  118. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.js +0 -335
  119. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +0 -235
  120. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +0 -1673
  121. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +0 -202
  122. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +0 -872
  123. package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.d.ts +0 -35
  124. package/vscode/src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.js +0 -289
  125. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.d.ts +0 -72
  126. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/askQuestionsTool.js +0 -600
  127. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.d.ts +0 -36
  128. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +0 -239
  129. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.d.ts +0 -22
  130. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.js +0 -143
  131. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.d.ts +0 -24
  132. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +0 -298
  133. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.d.ts +0 -25
  134. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +0 -177
  135. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.d.ts +0 -73
  136. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +0 -577
  137. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.d.ts +0 -11
  138. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +0 -90
  139. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.d.ts +0 -16
  140. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +0 -130
  141. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.d.ts +0 -12
  142. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.js +0 -53
  143. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.d.ts +0 -5
  144. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.js +0 -12
  145. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.d.ts +0 -10
  146. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +0 -92
  147. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +0 -38
  148. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +0 -518
  149. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +0 -6
  150. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +0 -231
  151. package/vscode/src/vs/workbench/contrib/chat/common/tools/terminalToolIds.d.ts +0 -20
  152. package/vscode/src/vs/workbench/contrib/chat/common/tools/terminalToolIds.js +0 -17
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.d.ts +0 -6
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +0 -283
  155. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.d.ts +0 -91
  156. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +0 -340
  157. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.d.ts +0 -17
  158. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +0 -272
  159. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css +0 -686
  160. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css +0 -348
  161. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css +0 -8
  162. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css +0 -92
  163. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css +0 -119
  164. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css +0 -79
  165. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css +0 -61
  166. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookChatEditController.css +0 -55
  167. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookChatEditorOverlay.css +0 -63
  168. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css +0 -79
  169. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css +0 -63
  170. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css +0 -92
  171. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css +0 -79
  172. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css +0 -24
  173. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css +0 -61
  174. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css +0 -102
  175. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.d.ts +0 -27
  176. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.js +0 -131
  177. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookCellLayoutManager.d.ts +0 -18
  178. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookCellLayoutManager.js +0 -92
  179. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.d.ts +0 -105
  180. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +0 -673
  181. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.d.ts +0 -9
  182. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +0 -37
  183. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.d.ts +0 -354
  184. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2926
  185. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.d.ts +0 -29
  186. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +0 -36
  187. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.d.ts +0 -1
  188. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +0 -19
  189. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.d.ts +0 -200
  190. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +0 -591
  191. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.d.ts +0 -56
  192. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +0 -30
  193. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.d.ts +0 -99
  194. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +0 -131
  195. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.d.ts +0 -30
  196. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +0 -115
  197. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.d.ts +0 -28
  198. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +0 -158
  199. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.d.ts +0 -40
  200. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +0 -183
  201. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.d.ts +0 -10
  202. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +0 -66
  203. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.d.ts +0 -52
  204. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +0 -429
  205. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.d.ts +0 -6
  206. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +0 -108
  207. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.d.ts +0 -36
  208. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +0 -221
  209. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.d.ts +0 -17
  210. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +0 -142
  211. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.d.ts +0 -5
  212. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +0 -23
  213. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.d.ts +0 -18
  214. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +0 -104
  215. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.d.ts +0 -92
  216. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +0 -762
  217. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.d.ts +0 -15
  218. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +0 -58
  219. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.d.ts +0 -36
  220. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +0 -357
  221. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.d.ts +0 -6
  222. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +0 -32
  223. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.d.ts +0 -47
  224. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +0 -260
  225. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellWidgets.d.ts +0 -9
  226. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellWidgets.js +0 -10
  227. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.d.ts +0 -10
  228. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +0 -24
  229. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.d.ts +0 -182
  230. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +0 -796
  231. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.d.ts +0 -13
  232. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +0 -79
  233. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.d.ts +0 -30
  234. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +0 -126
  235. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.d.ts +0 -6
  236. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +0 -32
  237. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.d.ts +0 -8
  238. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +0 -50
  239. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.d.ts +0 -18
  240. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +0 -119
  241. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.d.ts +0 -57
  242. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +0 -443
  243. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.d.ts +0 -20
  244. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +0 -56
  245. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellEditorPool.d.ts +0 -24
  246. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellEditorPool.js +0 -121
  247. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.d.ts +0 -152
  248. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +0 -1288
  249. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.d.ts +0 -59
  250. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +0 -287
  251. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon.d.ts +0 -117
  252. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon.js +0 -6
  253. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.d.ts +0 -222
  254. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +0 -1840
  255. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.d.ts +0 -63
  256. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +0 -449
  257. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.d.ts +0 -432
  258. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.d.ts +0 -18
  259. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +0 -2546
  260. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.d.ts +0 -8
  261. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +0 -105
  262. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.d.ts +0 -137
  263. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +0 -646
  264. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.d.ts +0 -21
  265. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +0 -101
  266. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputTextHelper.d.ts +0 -13
  267. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputTextHelper.js +0 -111
  268. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.d.ts +0 -30
  269. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +0 -65
  270. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.d.ts +0 -13
  271. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +0 -49
  272. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.d.ts +0 -89
  273. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +0 -472
  274. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.d.ts +0 -11
  275. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +0 -34
  276. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.d.ts +0 -33
  277. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +0 -275
  278. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.d.ts +0 -69
  279. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +0 -269
  280. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.d.ts +0 -125
  281. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +0 -958
  282. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.d.ts +0 -9
  283. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +0 -11
  284. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookCellOverlays.d.ts +0 -20
  285. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookCellOverlays.js +0 -101
  286. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.d.ts +0 -65
  287. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +0 -458
  288. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.d.ts +0 -80
  289. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +0 -708
  290. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.d.ts +0 -37
  291. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +0 -193
  292. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookHorizontalTracker.d.ts +0 -7
  293. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookHorizontalTracker.js +0 -62
  294. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.d.ts +0 -108
  295. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +0 -717
  296. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.d.ts +0 -23
  297. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +0 -183
  298. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.d.ts +0 -11
  299. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +0 -134
  300. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.d.ts +0 -20
  301. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +0 -135
  302. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.d.ts +0 -27
  303. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookViewZones.js +0 -213
  304. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.d.ts +0 -27
  305. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +0 -104
  306. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.d.ts +0 -115
  307. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +0 -480
  308. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +0 -87
  309. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -352
  310. package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.d.ts +0 -81
  311. package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.js +0 -9
  312. package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.d.ts +0 -10
  313. package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +0 -19
@@ -1,2926 +0,0 @@
1
-
2
- import { registerCss } from '../../../../../../../css.js';
3
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
4
- import * as notebook from './media/notebook.css';
5
- import * as notebookCellChat from './media/notebookCellChat.css';
6
- import * as notebookCellEditorHint from './media/notebookCellEditorHint.css';
7
- import * as notebookCellInsertToolbar from './media/notebookCellInsertToolbar.css';
8
- import * as notebookCellStatusBar from './media/notebookCellStatusBar.css';
9
- import * as notebookCellTitleToolbar from './media/notebookCellTitleToolbar.css';
10
- import * as notebookFocusIndicator from './media/notebookFocusIndicator.css';
11
- import * as notebookToolbar from './media/notebookToolbar.css';
12
- import * as notebookDnd from './media/notebookDnd.css';
13
- import * as notebookFolding from './media/notebookFolding.css';
14
- import * as notebookCellOutput from './media/notebookCellOutput.css';
15
- import * as notebookEditorStickyScroll from './media/notebookEditorStickyScroll.css';
16
- import * as notebookKernelActionViewItem from './media/notebookKernelActionViewItem.css';
17
- import * as notebookOutline from './media/notebookOutline.css';
18
- import * as notebookChatEditController from './media/notebookChatEditController.css';
19
- import * as notebookChatEditorOverlay from './media/notebookChatEditorOverlay.css';
20
- import { $ as $$1, getWindow, createElement, append, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, trackFocus, runWhenWindowIdle, scheduleAtNextAnimationFrame, getActiveElement, size, isHTMLElement, isAncestorOfActiveElement } from '../../../../base/browser/dom.js';
21
- import { createStyleSheet } from '../../../../base/browser/domStylesheets.js';
22
- import { OverlayLayoutElement } from '../../../../base/browser/overlayLayoutElement.js';
23
- import { mainWindow } from '../../../../base/browser/window.js';
24
- import { SequencerByKey } from '../../../../base/common/async.js';
25
- import { Color, RGBA } from '../../../../base/common/color.js';
26
- import { onUnexpectedError } from '../../../../base/common/errors.js';
27
- import { Emitter, Event } from '../../../../base/common/event.js';
28
- import { Disposable, DisposableStore, combinedDisposable, dispose, MutableDisposable } from '../../../../base/common/lifecycle.js';
29
- import { setTimeout0 } from '../../../../base/common/platform.js';
30
- import { isEqual, extname } from '../../../../base/common/resources.js';
31
- import { generateUuid } from '../../../../base/common/uuid.js';
32
- import { FontMeasurements } from '../../../../editor/browser/config/fontMeasurements.js';
33
- import { createBareFontInfoFromRawSettings } from '../../../../editor/common/config/fontInfoFromSettings.js';
34
- import { Range } from '../../../../editor/common/core/range.js';
35
- import { SuggestController } from '../../../../editor/contrib/suggest/browser/suggestController.js';
36
- import { localize } from '../../../../nls.js';
37
- import { MenuId } from '../../../../platform/actions/common/actions.js';
38
- import { IConfigurationService } from '../../../../platform/configuration/common/configuration.service.js';
39
- import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
40
- import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.service.js';
41
- import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.service.js';
42
- import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
43
- import { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js';
44
- import { Parts } from '../../../services/layout/browser/layoutService.js';
45
- import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.service.js';
46
- import { registerZIndex, ZIndex } from '../../../../platform/layout/browser/zIndexRegistry.js';
47
- import { IEditorProgressService } from '../../../../platform/progress/common/progress.service.js';
48
- import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.service.js';
49
- import { registerColor, transparent } from '../../../../platform/theme/common/colorUtils.js';
50
- import { foreground, focusBorder, errorForeground, contrastBorder } from '../../../../platform/theme/common/colors/baseColors.js';
51
- import '../../../../platform/theme/common/colors/chartsColors.js';
52
- import '../../../../platform/theme/common/colors/editorColors.js';
53
- import '../../../../platform/theme/common/colors/inputColors.js';
54
- import { listInactiveSelectionBackground } from '../../../../platform/theme/common/colors/listColors.js';
55
- import '../../../../platform/theme/common/colors/menuColors.js';
56
- import '../../../../platform/theme/common/colors/minimapColors.js';
57
- import { scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground } from '../../../../platform/theme/common/colors/miscColors.js';
58
- import '../../../../platform/theme/common/colors/quickpickColors.js';
59
- import '../../../../platform/theme/common/colors/searchColors.js';
60
- import { PANEL_BORDER, SIDE_BAR_BACKGROUND, EDITOR_PANE_BACKGROUND } from '../../../common/theme.js';
61
- import { debugIconStartForeground } from '../../debug/browser/debugColors.js';
62
- import { CellEditState, CellFocusMode, CellRevealType, CellRevealRangeType, ScrollToRevealBehavior, RenderOutputType } from './notebookBrowser.js';
63
- import { NotebookEditorExtensionsRegistry } from './notebookEditorExtensions.js';
64
- import { INotebookEditorService } from './services/notebookEditorService.service.js';
65
- import { notebookDebug } from './notebookLogger.js';
66
- import { NotebookLayoutChangedEvent } from './notebookViewEvents.js';
67
- import { CellContextKeyManager } from './view/cellParts/cellContextKeys.js';
68
- import { CellDragAndDropController } from './view/cellParts/cellDnd.js';
69
- import { NotebookCellList, ListViewInfoAccessor, NOTEBOOK_WEBVIEW_BOUNDARY } from './view/notebookCellList.js';
70
- import { BackLayerWebView } from './view/renderers/backLayerWebView.js';
71
- import { CodeCellRenderer, MarkupCellRenderer, NotebookCellListDelegate } from './view/renderers/cellRenderer.js';
72
- import { outputDisplayLimit, CodeCellViewModel } from './viewModel/codeCellViewModel.js';
73
- import { NotebookEventDispatcher } from './viewModel/eventDispatcher.js';
74
- import { MarkupCellViewModel } from './viewModel/markupCellViewModel.js';
75
- import { NotebookViewModel } from './viewModel/notebookViewModelImpl.js';
76
- import { ViewContext } from './viewModel/viewContext.js';
77
- import { NotebookEditorWorkbenchToolbar } from './viewParts/notebookEditorToolbar.js';
78
- import { NotebookEditorContextKeys } from './viewParts/notebookEditorWidgetContextKeys.js';
79
- import { NotebookOverviewRuler } from './viewParts/notebookOverviewRuler.js';
80
- import { ListTopCellToolbar } from './viewParts/notebookTopCellToolbar.js';
81
- import { SelectionStateType, RENDERER_NOT_AVAILABLE, CellKind, NotebookFindScopeType, CellEditType } from '../common/notebookCommon.js';
82
- import { NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_OUTPUT_FOCUSED, NOTEBOOK_OUTPUT_INPUT_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CURSOR_NAVIGATION_MODE } from '../common/notebookContextKeys.js';
83
- import { INotebookExecutionService } from '../common/notebookExecutionService.service.js';
84
- import { INotebookKernelService } from '../common/notebookKernelService.service.js';
85
- import { NotebookOptions, OutputInnerContainerTopPadding } from './notebookOptions.js';
86
- import { cellRangesToIndexes } from '../common/notebookRange.js';
87
- import { INotebookRendererMessagingService } from '../common/notebookRendererMessagingService.service.js';
88
- import { INotebookService } from '../common/notebookService.service.js';
89
- import { EditorExtensionsRegistry } from '../../../../editor/browser/editorExtensions.js';
90
- import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.service.js';
91
- import { BaseCellEditorOptions } from './viewModel/cellEditorOptions.js';
92
- import { FloatingEditorClickMenu } from '../../../browser/codeeditor.js';
93
- import { CellFindMatchModel } from './contrib/find/findModel.js';
94
- import { INotebookLoggingService } from '../common/notebookLoggingService.service.js';
95
- import { Schemas } from '../../../../base/common/network.js';
96
- import { DropIntoEditorController } from '../../../../editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js';
97
- import { CopyPasteController } from '../../../../editor/contrib/dropOrPasteInto/browser/copyPasteController.js';
98
- import { NotebookStickyScroll } from './viewParts/notebookEditorStickyScroll.js';
99
- import { PixelRatio } from '../../../../base/browser/pixelRatio.js';
100
- import { PreventDefaultContextMenuItemsContextKeyName } from '../../webview/browser/webview.contribution.js';
101
- import { NotebookAccessibilityProvider } from './notebookAccessibilityProvider.js';
102
- import { NotebookHorizontalTracker } from './viewParts/notebookHorizontalTracker.js';
103
- import { NotebookCellEditorPool } from './view/notebookCellEditorPool.js';
104
- import { InlineCompletionsController } from '../../../../editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js';
105
- import { NotebookCellLayoutManager } from './notebookCellLayoutManager.js';
106
- import { FloatingEditorToolbar } from '../../../../editor/contrib/floatingMenu/browser/floatingMenu.js';
107
-
108
- registerCss(notebook);
109
- registerCss(notebookCellChat);
110
- registerCss(notebookCellEditorHint);
111
- registerCss(notebookCellInsertToolbar);
112
- registerCss(notebookCellStatusBar);
113
- registerCss(notebookCellTitleToolbar);
114
- registerCss(notebookFocusIndicator);
115
- registerCss(notebookToolbar);
116
- registerCss(notebookDnd);
117
- registerCss(notebookFolding);
118
- registerCss(notebookCellOutput);
119
- registerCss(notebookEditorStickyScroll);
120
- registerCss(notebookKernelActionViewItem);
121
- registerCss(notebookOutline);
122
- registerCss(notebookChatEditController);
123
- registerCss(notebookChatEditorOverlay);
124
- const $ = $$1;
125
- function getDefaultNotebookCreationOptions() {
126
- const skipContributions = [
127
- "editor.contrib.review",
128
- FloatingEditorClickMenu.ID,
129
- FloatingEditorToolbar.ID,
130
- "editor.contrib.dirtydiff",
131
- "editor.contrib.testingOutputPeek",
132
- "editor.contrib.testingDecorations",
133
- "store.contrib.stickyScrollController",
134
- "editor.contrib.findController",
135
- "editor.contrib.emptyTextEditorHint"
136
- ];
137
- const contributions = EditorExtensionsRegistry.getEditorContributions().filter(c => skipContributions.indexOf(c.id) === -1);
138
- return {
139
- menuIds: {
140
- notebookToolbar: MenuId.NotebookToolbar,
141
- cellTitleToolbar: MenuId.NotebookCellTitle,
142
- cellDeleteToolbar: MenuId.NotebookCellDelete,
143
- cellInsertToolbar: MenuId.NotebookCellBetween,
144
- cellTopInsertToolbar: MenuId.NotebookCellListTop,
145
- cellExecuteToolbar: MenuId.NotebookCellExecute,
146
- cellExecutePrimary: MenuId.NotebookCellExecutePrimary
147
- },
148
- cellEditorContributions: contributions
149
- };
150
- }
151
- let NotebookEditorWidget = class NotebookEditorWidget extends Disposable {
152
- get isVisible() {
153
- return this._isVisible;
154
- }
155
- get isDisposed() {
156
- return this._isDisposed;
157
- }
158
- set viewModel(newModel) {
159
- this._onWillChangeModel.fire(this._notebookViewModel?.notebookDocument);
160
- this._notebookViewModel = newModel;
161
- this._onDidChangeModel.fire(newModel?.notebookDocument);
162
- }
163
- get viewModel() {
164
- return this._notebookViewModel;
165
- }
166
- get textModel() {
167
- return this._notebookViewModel?.notebookDocument;
168
- }
169
- get isReadOnly() {
170
- return this._notebookViewModel?.options.isReadOnly ?? false;
171
- }
172
- get activeCodeEditor() {
173
- if (this._isDisposed) {
174
- return;
175
- }
176
- const [focused] = this._list.getFocusedElements();
177
- return this._renderedEditors.get(focused);
178
- }
179
- get activeCellAndCodeEditor() {
180
- if (this._isDisposed) {
181
- return;
182
- }
183
- const [focused] = this._list.getFocusedElements();
184
- const editor = this._renderedEditors.get(focused);
185
- if (!editor) {
186
- return;
187
- }
188
- return [focused, editor];
189
- }
190
- get codeEditors() {
191
- return [...this._renderedEditors];
192
- }
193
- get visibleRanges() {
194
- return this._list ? (this._list.visibleRanges || []) : [];
195
- }
196
- get notebookOptions() {
197
- return this._notebookOptions;
198
- }
199
- constructor(
200
- creationOptions,
201
- dimension,
202
- instantiationService,
203
- editorGroupsService,
204
- notebookRendererMessaging,
205
- notebookEditorService,
206
- notebookKernelService,
207
- _notebookService,
208
- configurationService,
209
- contextKeyService,
210
- layoutService,
211
- contextMenuService,
212
- telemetryService,
213
- notebookExecutionService,
214
- editorProgressService,
215
- logService
216
- ) {
217
- super();
218
- this.creationOptions = creationOptions;
219
- this.editorGroupsService = editorGroupsService;
220
- this.notebookRendererMessaging = notebookRendererMessaging;
221
- this.notebookEditorService = notebookEditorService;
222
- this.notebookKernelService = notebookKernelService;
223
- this._notebookService = _notebookService;
224
- this.configurationService = configurationService;
225
- this.layoutService = layoutService;
226
- this.contextMenuService = contextMenuService;
227
- this.telemetryService = telemetryService;
228
- this.notebookExecutionService = notebookExecutionService;
229
- this.editorProgressService = editorProgressService;
230
- this.logService = logService;
231
- this._onDidChangeCellState = this._register(( new Emitter()));
232
- this.onDidChangeCellState = this._onDidChangeCellState.event;
233
- this._onDidChangeViewCells = this._register(( new Emitter()));
234
- this.onDidChangeViewCells = this._onDidChangeViewCells.event;
235
- this._onWillChangeModel = this._register(( new Emitter()));
236
- this.onWillChangeModel = this._onWillChangeModel.event;
237
- this._onDidChangeModel = this._register(( new Emitter()));
238
- this.onDidChangeModel = this._onDidChangeModel.event;
239
- this._onDidAttachViewModel = this._register(( new Emitter()));
240
- this.onDidAttachViewModel = this._onDidAttachViewModel.event;
241
- this._onDidChangeOptions = this._register(( new Emitter()));
242
- this.onDidChangeOptions = this._onDidChangeOptions.event;
243
- this._onDidChangeDecorations = this._register(( new Emitter()));
244
- this.onDidChangeDecorations = this._onDidChangeDecorations.event;
245
- this._onDidScroll = this._register(( new Emitter()));
246
- this.onDidScroll = this._onDidScroll.event;
247
- this._onDidChangeLayout = this._register(( new Emitter()));
248
- this.onDidChangeLayout = this._onDidChangeLayout.event;
249
- this._onDidChangeActiveCell = this._register(( new Emitter()));
250
- this.onDidChangeActiveCell = this._onDidChangeActiveCell.event;
251
- this._onDidChangeFocus = this._register(( new Emitter()));
252
- this.onDidChangeFocus = this._onDidChangeFocus.event;
253
- this._onDidChangeSelection = this._register(( new Emitter()));
254
- this.onDidChangeSelection = this._onDidChangeSelection.event;
255
- this._onDidChangeVisibleRanges = this._register(( new Emitter()));
256
- this.onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;
257
- this._onDidFocusEmitter = this._register(( new Emitter()));
258
- this.onDidFocusWidget = this._onDidFocusEmitter.event;
259
- this._onDidBlurEmitter = this._register(( new Emitter()));
260
- this.onDidBlurWidget = this._onDidBlurEmitter.event;
261
- this._onDidChangeActiveEditor = this._register(( new Emitter()));
262
- this.onDidChangeActiveEditor = this._onDidChangeActiveEditor.event;
263
- this._onDidChangeActiveKernel = this._register(( new Emitter()));
264
- this.onDidChangeActiveKernel = this._onDidChangeActiveKernel.event;
265
- this._onMouseUp = this._register(( new Emitter()));
266
- this.onMouseUp = this._onMouseUp.event;
267
- this._onMouseDown = this._register(( new Emitter()));
268
- this.onMouseDown = this._onMouseDown.event;
269
- this._onDidReceiveMessage = this._register(( new Emitter()));
270
- this.onDidReceiveMessage = this._onDidReceiveMessage.event;
271
- this._onDidRenderOutput = this._register(( new Emitter()));
272
- this.onDidRenderOutput = this._onDidRenderOutput.event;
273
- this._onDidRemoveOutput = this._register(( new Emitter()));
274
- this.onDidRemoveOutput = this._onDidRemoveOutput.event;
275
- this._onDidResizeOutputEmitter = this._register(( new Emitter()));
276
- this.onDidResizeOutput = this._onDidResizeOutputEmitter.event;
277
- this._webview = null;
278
- this._webviewResolvePromise = null;
279
- this._webviewTransparentCover = null;
280
- this._listDelegate = null;
281
- this._dndController = null;
282
- this._listTopCellToolbar = null;
283
- this._renderedEditors = ( new Map());
284
- this._localStore = this._register(( new DisposableStore()));
285
- this._localCellStateListeners = [];
286
- this._contributions = ( new Map());
287
- this._insetModifyQueueByOutputId = ( new SequencerByKey());
288
- this._cellContextKeyManager = null;
289
- this._uuid = generateUuid();
290
- this._webviewFocused = false;
291
- this._isVisible = false;
292
- this._isDisposed = false;
293
- this._baseCellEditorOptions = ( new Map());
294
- this._debugFlag = false;
295
- this._backgroundMarkdownRenderRunning = false;
296
- this._lastCellWithEditorFocus = null;
297
- this._pendingOutputHeightAcks = ( new Map());
298
- this._dimension = dimension;
299
- this.isReplHistory = creationOptions.isReplHistory ?? false;
300
- this._readOnly = creationOptions.isReadOnly ?? false;
301
- this._overlayLayout = this._register(( new OverlayLayoutElement()));
302
- this._overlayContainer = this._overlayLayout.content;
303
- this.scopedContextKeyService = this._register(contextKeyService.createScoped(this._overlayContainer));
304
- this.instantiationService = this._register(instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
305
- this._notebookOptions = creationOptions.options ?? this.instantiationService.createInstance(
306
- NotebookOptions,
307
- this.creationOptions?.codeWindow ?? mainWindow,
308
- this._readOnly,
309
- undefined
310
- );
311
- this._register(this._notebookOptions);
312
- const eventDispatcher = this._register(( new NotebookEventDispatcher()));
313
- this._viewContext = ( new ViewContext(
314
- this._notebookOptions,
315
- eventDispatcher,
316
- language => this.getBaseCellEditorOptions(language)
317
- ));
318
- this._register(this._viewContext.eventDispatcher.onDidChangeLayout(() => {
319
- this._onDidChangeLayout.fire();
320
- }));
321
- this._register(this._viewContext.eventDispatcher.onDidChangeCellState(e => {
322
- this._onDidChangeCellState.fire(e);
323
- }));
324
- this._register(_notebookService.onDidChangeOutputRenderers(() => {
325
- this._updateOutputRenderers();
326
- }));
327
- this._register(this.instantiationService.createInstance(NotebookEditorContextKeys, this));
328
- this._register(notebookKernelService.onDidChangeSelectedNotebooks(e => {
329
- if (isEqual(e.notebook, this.viewModel?.uri)) {
330
- this._loadKernelPreloads();
331
- this._onDidChangeActiveKernel.fire();
332
- }
333
- }));
334
- this._scrollBeyondLastLine = this.configurationService.getValue("editor.scrollBeyondLastLine");
335
- this._register(this.configurationService.onDidChangeConfiguration(e => {
336
- if (e.affectsConfiguration("editor.scrollBeyondLastLine")) {
337
- this._scrollBeyondLastLine = this.configurationService.getValue("editor.scrollBeyondLastLine");
338
- if (this._dimension && this._isVisible) {
339
- this.layout(this._dimension);
340
- }
341
- }
342
- }));
343
- this._register(this._notebookOptions.onDidChangeOptions(e => {
344
- if (e.cellStatusBarVisibility || e.cellToolbarLocation || e.cellToolbarInteraction) {
345
- this._updateForNotebookConfiguration();
346
- }
347
- if (e.fontFamily) {
348
- this._generateFontInfo();
349
- }
350
- if (e.compactView || e.focusIndicator || e.insertToolbarPosition || e.cellToolbarLocation || e.dragAndDropEnabled || e.fontSize || e.markupFontSize || e.markdownLineHeight || e.fontFamily || e.insertToolbarAlignment || e.outputFontSize || e.outputLineHeight || e.outputFontFamily || e.outputWordWrap || e.outputScrolling || e.outputLinkifyFilePaths || e.minimalError) {
351
- this._styleElement?.remove();
352
- this._createLayoutStyles();
353
- this._webview?.updateOptions({
354
- ...this.notebookOptions.computeWebviewOptions(),
355
- fontFamily: this._generateFontFamily()
356
- });
357
- }
358
- if (this._dimension && this._isVisible) {
359
- this.layout(this._dimension);
360
- }
361
- }));
362
- const container = creationOptions.codeWindow ? this.layoutService.getContainer(creationOptions.codeWindow) : this.layoutService.mainContainer;
363
- this.notebookEditorService.addNotebookEditor(this);
364
- const id = generateUuid();
365
- this._overlayContainer.id = `notebook-${id}`;
366
- this._overlayContainer.className = "notebookOverlay";
367
- this._overlayContainer.classList.add("notebook-editor");
368
- this._overlayContainer.inert = true;
369
- this._overlayContainer.style.visibility = "hidden";
370
- container.appendChild(this._overlayLayout.root);
371
- this._createBody(this._overlayContainer);
372
- this._generateFontInfo();
373
- this._isVisible = true;
374
- this._editorFocus = NOTEBOOK_EDITOR_FOCUSED.bindTo(this.scopedContextKeyService);
375
- this._outputFocus = NOTEBOOK_OUTPUT_FOCUSED.bindTo(this.scopedContextKeyService);
376
- this._outputInputFocus = NOTEBOOK_OUTPUT_INPUT_FOCUSED.bindTo(this.scopedContextKeyService);
377
- this._editorEditable = NOTEBOOK_EDITOR_EDITABLE.bindTo(this.scopedContextKeyService);
378
- this._cursorNavMode = NOTEBOOK_CURSOR_NAVIGATION_MODE.bindTo(this.scopedContextKeyService);
379
- ( new RawContextKey(PreventDefaultContextMenuItemsContextKeyName, false)).bindTo(this.scopedContextKeyService).set(true);
380
- this._editorEditable.set(!creationOptions.isReadOnly);
381
- let contributions;
382
- if (Array.isArray(this.creationOptions.contributions)) {
383
- contributions = this.creationOptions.contributions;
384
- } else {
385
- contributions = NotebookEditorExtensionsRegistry.getEditorContributions();
386
- }
387
- for (const desc of contributions) {
388
- let contribution;
389
- try {
390
- contribution = this.instantiationService.createInstance(desc.ctor, this);
391
- } catch (err) {
392
- onUnexpectedError(err);
393
- }
394
- if (contribution) {
395
- if (!( this._contributions.has(desc.id))) {
396
- this._contributions.set(desc.id, contribution);
397
- } else {
398
- contribution.dispose();
399
- throw ( new Error(`DUPLICATE notebook editor contribution: '${desc.id}'`));
400
- }
401
- }
402
- }
403
- this._updateForNotebookConfiguration();
404
- }
405
- _debug(...args) {
406
- if (!this._debugFlag) {
407
- return;
408
- }
409
- notebookDebug(...args);
410
- }
411
- getId() {
412
- return this._uuid;
413
- }
414
- getViewModel() {
415
- return this.viewModel;
416
- }
417
- getLength() {
418
- return this.viewModel?.length ?? 0;
419
- }
420
- getSelections() {
421
- return this.viewModel?.getSelections() ?? [{
422
- start: 0,
423
- end: 0
424
- }];
425
- }
426
- setSelections(selections) {
427
- if (!this.viewModel) {
428
- return;
429
- }
430
- const focus = this.viewModel.getFocus();
431
- this.viewModel.updateSelectionsState({
432
- kind: SelectionStateType.Index,
433
- focus: focus,
434
- selections: selections
435
- });
436
- }
437
- getFocus() {
438
- return this.viewModel?.getFocus() ?? {
439
- start: 0,
440
- end: 0
441
- };
442
- }
443
- setFocus(focus) {
444
- if (!this.viewModel) {
445
- return;
446
- }
447
- const selections = this.viewModel.getSelections();
448
- this.viewModel.updateSelectionsState({
449
- kind: SelectionStateType.Index,
450
- focus: focus,
451
- selections: selections
452
- });
453
- }
454
- getSelectionViewModels() {
455
- if (!this.viewModel) {
456
- return [];
457
- }
458
- const cellsSet = ( new Set());
459
- return ( this.viewModel.getSelections().map(range => this.viewModel.viewCells.slice(range.start, range.end))).reduce((a, b) => {
460
- b.forEach(cell => {
461
- if (!( cellsSet.has(cell.handle))) {
462
- cellsSet.add(cell.handle);
463
- a.push(cell);
464
- }
465
- });
466
- return a;
467
- }, []);
468
- }
469
- hasModel() {
470
- return !!this._notebookViewModel;
471
- }
472
- showProgress() {
473
- this._currentProgress = this.editorProgressService.show(true);
474
- }
475
- hideProgress() {
476
- if (this._currentProgress) {
477
- this._currentProgress.done();
478
- this._currentProgress = undefined;
479
- }
480
- }
481
- getBaseCellEditorOptions(language) {
482
- const existingOptions = this._baseCellEditorOptions.get(language);
483
- if (existingOptions) {
484
- return existingOptions;
485
- } else {
486
- const options = ( new BaseCellEditorOptions(this, this.notebookOptions, this.configurationService, language));
487
- this._baseCellEditorOptions.set(language, options);
488
- return options;
489
- }
490
- }
491
- _updateForNotebookConfiguration() {
492
- if (!this._overlayContainer) {
493
- return;
494
- }
495
- this._overlayContainer.classList.remove("cell-title-toolbar-left");
496
- this._overlayContainer.classList.remove("cell-title-toolbar-right");
497
- this._overlayContainer.classList.remove("cell-title-toolbar-hidden");
498
- const cellToolbarLocation = this._notebookOptions.computeCellToolbarLocation(this.viewModel?.viewType);
499
- this._overlayContainer.classList.add(`cell-title-toolbar-${cellToolbarLocation}`);
500
- const cellToolbarInteraction = this._notebookOptions.getDisplayOptions().cellToolbarInteraction;
501
- let cellToolbarInteractionState = "hover";
502
- this._overlayContainer.classList.remove("cell-toolbar-hover");
503
- this._overlayContainer.classList.remove("cell-toolbar-click");
504
- if (cellToolbarInteraction === "hover" || cellToolbarInteraction === "click") {
505
- cellToolbarInteractionState = cellToolbarInteraction;
506
- }
507
- this._overlayContainer.classList.add(`cell-toolbar-${cellToolbarInteractionState}`);
508
- }
509
- _generateFontInfo() {
510
- const editorOptions = this.configurationService.getValue("editor");
511
- const targetWindow = getWindow(this.getDomNode());
512
- this._fontInfo = FontMeasurements.readFontInfo(
513
- targetWindow,
514
- createBareFontInfoFromRawSettings(editorOptions, PixelRatio.getInstance(targetWindow).value)
515
- );
516
- }
517
- _createBody(parent) {
518
- this._notebookTopToolbarContainer = createElement("div");
519
- this._notebookTopToolbarContainer.classList.add("notebook-toolbar-container");
520
- this._notebookTopToolbarContainer.style.display = "none";
521
- append(parent, this._notebookTopToolbarContainer);
522
- this._notebookStickyScrollContainer = createElement("div");
523
- this._notebookStickyScrollContainer.classList.add("notebook-sticky-scroll-container");
524
- append(parent, this._notebookStickyScrollContainer);
525
- this._body = createElement("div");
526
- append(parent, this._body);
527
- this._body.classList.add("cell-list-container");
528
- this._createLayoutStyles();
529
- this._createCellList();
530
- this._notebookOverviewRulerContainer = createElement("div");
531
- this._notebookOverviewRulerContainer.classList.add("notebook-overview-ruler-container");
532
- this._list.scrollableElement.appendChild(this._notebookOverviewRulerContainer);
533
- this._registerNotebookOverviewRuler();
534
- this._register(
535
- this.instantiationService.createInstance(NotebookHorizontalTracker, this, this._list.scrollableElement)
536
- );
537
- this._overflowContainer = createElement("div");
538
- this._overflowContainer.classList.add("notebook-overflow-widget-container", "monaco-editor");
539
- append(parent, this._overflowContainer);
540
- }
541
- _generateFontFamily() {
542
- return this._fontInfo?.fontFamily ?? `"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace`;
543
- }
544
- _createLayoutStyles() {
545
- this._styleElement = createStyleSheet(this._body);
546
- const {
547
- cellRightMargin,
548
- cellTopMargin,
549
- cellRunGutter,
550
- cellBottomMargin,
551
- codeCellLeftMargin,
552
- markdownCellGutter,
553
- markdownCellLeftMargin,
554
- markdownCellBottomMargin,
555
- markdownCellTopMargin,
556
- collapsedIndicatorHeight,
557
- focusIndicator,
558
- insertToolbarPosition,
559
- outputFontSize,
560
- focusIndicatorLeftMargin,
561
- focusIndicatorGap
562
- } = this._notebookOptions.getLayoutConfiguration();
563
- const {
564
- insertToolbarAlignment,
565
- compactView,
566
- fontSize
567
- } = this._notebookOptions.getDisplayOptions();
568
- const getCellEditorContainerLeftMargin = this._notebookOptions.getCellEditorContainerLeftMargin();
569
- const {
570
- bottomToolbarGap,
571
- bottomToolbarHeight
572
- } = this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);
573
- const styleSheets = [];
574
- if (!this._fontInfo) {
575
- this._generateFontInfo();
576
- }
577
- const fontFamily = this._generateFontFamily();
578
- styleSheets.push(`
579
- .notebook-editor {
580
- --notebook-cell-output-font-size: ${outputFontSize}px;
581
- --notebook-cell-input-preview-font-size: ${fontSize}px;
582
- --notebook-cell-input-preview-font-family: ${fontFamily};
583
- }
584
- `);
585
- if (compactView) {
586
- styleSheets.push(
587
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${getCellEditorContainerLeftMargin}px; }`
588
- );
589
- } else {
590
- styleSheets.push(
591
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${codeCellLeftMargin}px; }`
592
- );
593
- }
594
- if (focusIndicator === "border") {
595
- styleSheets.push(`
596
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before,
597
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before,
598
- .monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:before,
599
- .monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:after {
600
- content: "";
601
- position: absolute;
602
- width: 100%;
603
- height: 1px;
604
- }
605
-
606
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before,
607
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
608
- content: "";
609
- position: absolute;
610
- width: 1px;
611
- height: 100%;
612
- z-index: 10;
613
- }
614
-
615
- /* top border */
616
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before {
617
- border-top: 1px solid transparent;
618
- }
619
-
620
- /* left border */
621
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before {
622
- border-left: 1px solid transparent;
623
- }
624
-
625
- /* bottom border */
626
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before {
627
- border-bottom: 1px solid transparent;
628
- }
629
-
630
- /* right border */
631
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
632
- border-right: 1px solid transparent;
633
- }
634
- `);
635
- styleSheets.push(`
636
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-left:before,
637
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-right:before,
638
- .monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-left:before,
639
- .monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-right:before {
640
- top: -${cellTopMargin}px; height: calc(100% + ${cellTopMargin + cellBottomMargin}px)
641
- }`);
642
- } else {
643
- styleSheets.push(`
644
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator {
645
- border-left: 3px solid transparent;
646
- border-radius: 4px;
647
- width: 0px;
648
- margin-left: ${focusIndicatorLeftMargin}px;
649
- border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
650
- }
651
-
652
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-focus-indicator-left .codeOutput-focus-indicator-container,
653
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-output-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
654
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .markdown-cell-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
655
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row:hover .cell-focus-indicator-left .codeOutput-focus-indicator-container {
656
- display: block;
657
- }
658
-
659
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator-container:hover .codeOutput-focus-indicator {
660
- border-left: 5px solid transparent;
661
- margin-left: ${focusIndicatorLeftMargin - 1}px;
662
- }
663
- `);
664
- styleSheets.push(`
665
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-inner-container.cell-output-focus .cell-focus-indicator-left .codeOutput-focus-indicator,
666
- .monaco-workbench .notebookOverlay .monaco-list:focus-within .monaco-list-row.focused .cell-inner-container .cell-focus-indicator-left .codeOutput-focus-indicator {
667
- border-color: var(--vscode-notebook-focusedCellBorder) !important;
668
- }
669
-
670
- .monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-inner-container .cell-focus-indicator-left .output-focus-indicator {
671
- margin-top: ${focusIndicatorGap}px;
672
- }
673
- `);
674
- }
675
- if (insertToolbarPosition === "betweenCells" || insertToolbarPosition === "both") {
676
- styleSheets.push(
677
- `.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: flex; }`
678
- );
679
- styleSheets.push(
680
- `.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: flex; }`
681
- );
682
- } else {
683
- styleSheets.push(
684
- `.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: none; }`
685
- );
686
- styleSheets.push(
687
- `.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: none; }`
688
- );
689
- }
690
- if (insertToolbarAlignment === "left") {
691
- styleSheets.push(`
692
- .monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child,
693
- .monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .action-item:first-child {
694
- margin-right: 0px !important;
695
- }`);
696
- styleSheets.push(`
697
- .monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label,
698
- .monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar .action-label {
699
- padding: 0px !important;
700
- justify-content: center;
701
- border-radius: 4px;
702
- }`);
703
- styleSheets.push(`
704
- .monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
705
- .monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container {
706
- align-items: flex-start;
707
- justify-content: left;
708
- margin: 0 16px 0 ${8 + codeCellLeftMargin}px;
709
- }`);
710
- styleSheets.push(`
711
- .monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
712
- .notebookOverlay .cell-bottom-toolbar-container .action-item {
713
- border: 0px;
714
- }`);
715
- }
716
- styleSheets.push(
717
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .code-cell-row div.cell.code { margin-left: ${getCellEditorContainerLeftMargin}px; }`
718
- );
719
- styleSheets.push(
720
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell.code { margin-left: ${getCellEditorContainerLeftMargin}px; }`
721
- );
722
- styleSheets.push(
723
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell { margin-right: ${cellRightMargin}px; }`
724
- );
725
- styleSheets.push(
726
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell { margin-right: ${cellRightMargin}px; }`
727
- );
728
- styleSheets.push(
729
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row > .cell-inner-container { padding-top: ${cellTopMargin}px; }`
730
- );
731
- styleSheets.push(
732
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container { padding-bottom: ${markdownCellBottomMargin}px; padding-top: ${markdownCellTopMargin}px; }`
733
- );
734
- styleSheets.push(
735
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container.webview-backed-markdown-cell { padding: 0; }`
736
- );
737
- styleSheets.push(
738
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .webview-backed-markdown-cell.markdown-cell-edit-mode .cell.code { padding-bottom: ${markdownCellBottomMargin}px; padding-top: ${markdownCellTopMargin}px; }`
739
- );
740
- styleSheets.push(
741
- `.notebookOverlay .output { margin: 0px ${cellRightMargin}px 0px ${getCellEditorContainerLeftMargin}px; }`
742
- );
743
- styleSheets.push(
744
- `.notebookOverlay .output { width: calc(100% - ${getCellEditorContainerLeftMargin + cellRightMargin}px); }`
745
- );
746
- styleSheets.push(
747
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { left: ${getCellEditorContainerLeftMargin}px; }`
748
- );
749
- styleSheets.push(
750
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { width: calc(100% - ${getCellEditorContainerLeftMargin + cellRightMargin}px); }`
751
- );
752
- styleSheets.push(
753
- `.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton { left: -${cellRunGutter}px; }`
754
- );
755
- styleSheets.push(
756
- `.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton {
757
- position: absolute;
758
- width: ${cellRunGutter}px;
759
- padding: 6px 0px;
760
- }`
761
- );
762
- styleSheets.push(
763
- `.notebookOverlay .output-show-more-container { margin: 0px ${cellRightMargin}px 0px ${getCellEditorContainerLeftMargin}px; }`
764
- );
765
- styleSheets.push(
766
- `.notebookOverlay .output-show-more-container { width: calc(100% - ${getCellEditorContainerLeftMargin + cellRightMargin}px); }`
767
- );
768
- styleSheets.push(
769
- `.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell.markdown { padding-left: ${cellRunGutter}px; }`
770
- );
771
- styleSheets.push(
772
- `.monaco-workbench .notebookOverlay > .cell-list-container .notebook-folding-indicator { left: ${(markdownCellGutter - 20) / 2 + markdownCellLeftMargin}px; }`
773
- );
774
- styleSheets.push(
775
- `.notebookOverlay > .cell-list-container .notebook-folded-hint { left: ${markdownCellGutter + markdownCellLeftMargin + 8}px; }`
776
- );
777
- styleSheets.push(
778
- `.notebookOverlay .monaco-list .monaco-list-row :not(.webview-backed-markdown-cell) .cell-focus-indicator-top { height: ${cellTopMargin}px; }`
779
- );
780
- styleSheets.push(
781
- `.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-side { bottom: ${bottomToolbarGap}px; }`
782
- );
783
- styleSheets.push(
784
- `.notebookOverlay .monaco-list .monaco-list-row.code-cell-row .cell-focus-indicator-left { width: ${getCellEditorContainerLeftMargin}px; }`
785
- );
786
- styleSheets.push(
787
- `.notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .cell-focus-indicator-left { width: ${codeCellLeftMargin}px; }`
788
- );
789
- styleSheets.push(
790
- `.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator.cell-focus-indicator-right { width: ${cellRightMargin}px; }`
791
- );
792
- styleSheets.push(
793
- `.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom { height: ${cellBottomMargin}px; }`
794
- );
795
- styleSheets.push(
796
- `.notebookOverlay .monaco-list .monaco-list-row .cell-shadow-container-bottom { top: ${cellBottomMargin}px; }`
797
- );
798
- styleSheets.push(`
799
- .notebookOverlay .monaco-list.selection-multiple .monaco-list-row:has(+ .monaco-list-row.selected) .cell-focus-indicator-bottom {
800
- height: ${bottomToolbarGap + cellBottomMargin}px;
801
- }
802
- `);
803
- styleSheets.push(`
804
- .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
805
- height: ${bottomToolbarGap + cellBottomMargin}px;
806
- background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
807
- }
808
-
809
- .notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
810
- height: ${bottomToolbarGap + cellBottomMargin - 6}px;
811
- background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
812
- }
813
- `);
814
- styleSheets.push(`
815
- .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview {
816
- line-height: ${collapsedIndicatorHeight}px;
817
- }
818
-
819
- .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview .monaco-tokenized-source {
820
- max-height: ${collapsedIndicatorHeight}px;
821
- }
822
- `);
823
- styleSheets.push(
824
- `.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar { height: ${bottomToolbarHeight}px }`
825
- );
826
- styleSheets.push(
827
- `.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container .monaco-toolbar { height: ${bottomToolbarHeight}px }`
828
- );
829
- styleSheets.push(
830
- `.monaco-workbench .notebookOverlay.cell-title-toolbar-right > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
831
- right: ${cellRightMargin + 26}px;
832
- }
833
- .monaco-workbench .notebookOverlay.cell-title-toolbar-left > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
834
- left: ${getCellEditorContainerLeftMargin + 16}px;
835
- }
836
- .monaco-workbench .notebookOverlay.cell-title-toolbar-hidden > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
837
- display: none;
838
- }`
839
- );
840
- styleSheets.push(`
841
- .monaco-workbench .notebookOverlay .output > div.foreground.output-inner-container {
842
- padding: ${OutputInnerContainerTopPadding}px 8px;
843
- }
844
- .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .output-collapse-container {
845
- padding: ${OutputInnerContainerTopPadding}px 8px;
846
- }
847
- `);
848
- styleSheets.push(`
849
- .monaco-workbench .notebookOverlay .cell-chat-part {
850
- margin: 0 ${cellRightMargin}px 6px 4px;
851
- }
852
- `);
853
- this._styleElement.textContent = styleSheets.join("\n");
854
- }
855
- _createCellList() {
856
- this._body.classList.add("cell-list-container");
857
- this._dndController = this._register(( new CellDragAndDropController(this, this._body)));
858
- const getScopedContextKeyService = container => this._list.contextKeyService.createScoped(container);
859
- this._editorPool = this._register(
860
- this.instantiationService.createInstance(NotebookCellEditorPool, this, getScopedContextKeyService)
861
- );
862
- const renderers = [this.instantiationService.createInstance(
863
- CodeCellRenderer,
864
- this,
865
- this._renderedEditors,
866
- this._editorPool,
867
- this._dndController,
868
- getScopedContextKeyService
869
- ), this.instantiationService.createInstance(
870
- MarkupCellRenderer,
871
- this,
872
- this._dndController,
873
- this._renderedEditors,
874
- getScopedContextKeyService
875
- )];
876
- renderers.forEach(renderer => {
877
- this._register(renderer);
878
- });
879
- this._listDelegate = this.instantiationService.createInstance(NotebookCellListDelegate, getWindow(this.getDomNode()));
880
- this._register(this._listDelegate);
881
- const accessibilityProvider = this.instantiationService.createInstance(NotebookAccessibilityProvider, () => this.viewModel, this.isReplHistory);
882
- this._register(accessibilityProvider);
883
- this._list = this.instantiationService.createInstance(
884
- NotebookCellList,
885
- "NotebookCellList",
886
- this._body,
887
- this._viewContext.notebookOptions,
888
- this._listDelegate,
889
- renderers,
890
- this.scopedContextKeyService,
891
- {
892
- setRowLineHeight: false,
893
- setRowHeight: false,
894
- supportDynamicHeights: true,
895
- horizontalScrolling: false,
896
- keyboardSupport: false,
897
- mouseSupport: true,
898
- multipleSelectionSupport: true,
899
- selectionNavigation: true,
900
- typeNavigationEnabled: true,
901
- paddingTop: 0,
902
- paddingBottom: 0,
903
- transformOptimization: false,
904
- initialSize: this._dimension,
905
- styleController: _suffix => {
906
- return this._list;
907
- },
908
- overrideStyles: {
909
- listBackground: notebookEditorBackground,
910
- listActiveSelectionBackground: notebookEditorBackground,
911
- listActiveSelectionForeground: foreground,
912
- listFocusAndSelectionBackground: notebookEditorBackground,
913
- listFocusAndSelectionForeground: foreground,
914
- listFocusBackground: notebookEditorBackground,
915
- listFocusForeground: foreground,
916
- listHoverForeground: foreground,
917
- listHoverBackground: notebookEditorBackground,
918
- listHoverOutline: focusBorder,
919
- listFocusOutline: focusBorder,
920
- listInactiveSelectionBackground: notebookEditorBackground,
921
- listInactiveSelectionForeground: foreground,
922
- listInactiveFocusBackground: notebookEditorBackground,
923
- listInactiveFocusOutline: notebookEditorBackground
924
- },
925
- accessibilityProvider
926
- }
927
- );
928
- this._cellLayoutManager = ( new NotebookCellLayoutManager(this, this._list, this.logService));
929
- this._dndController.setList(this._list);
930
- this._register(this._list);
931
- this._listViewInfoAccessor = ( new ListViewInfoAccessor(this._list));
932
- this._register(this._listViewInfoAccessor);
933
- this._register(combinedDisposable(...renderers));
934
- this._listTopCellToolbar = this._register(
935
- this.instantiationService.createInstance(ListTopCellToolbar, this, this.notebookOptions)
936
- );
937
- this._webviewTransparentCover = append(this._list.rowsContainer, $(".webview-cover"));
938
- this._webviewTransparentCover.style.display = "none";
939
- this._register(
940
- addStandardDisposableGenericMouseDownListener(this._overlayContainer, e => {
941
- if (e.target.classList.contains("slider") && this._webviewTransparentCover) {
942
- this._webviewTransparentCover.style.display = "block";
943
- }
944
- })
945
- );
946
- this._register(
947
- addStandardDisposableGenericMouseUpListener(this._overlayContainer, () => {
948
- if (this._webviewTransparentCover) {
949
- this._webviewTransparentCover.style.display = "none";
950
- }
951
- })
952
- );
953
- this._register(this._list.onMouseDown(e => {
954
- if (e.element) {
955
- this._onMouseDown.fire({
956
- event: e.browserEvent,
957
- target: e.element
958
- });
959
- }
960
- }));
961
- this._register(this._list.onMouseUp(e => {
962
- if (e.element) {
963
- this._onMouseUp.fire({
964
- event: e.browserEvent,
965
- target: e.element
966
- });
967
- }
968
- }));
969
- this._register(this._list.onDidChangeFocus(_e => {
970
- this._onDidChangeActiveEditor.fire(this);
971
- this._onDidChangeActiveCell.fire();
972
- this._onDidChangeFocus.fire();
973
- this._cursorNavMode.set(false);
974
- }));
975
- this._register(this._list.onContextMenu(e => {
976
- this.showListContextMenu(e);
977
- }));
978
- this._register(this._list.onDidChangeVisibleRanges(() => {
979
- this._onDidChangeVisibleRanges.fire();
980
- }));
981
- this._register(this._list.onDidScroll(e => {
982
- if (e.scrollTop !== e.oldScrollTop) {
983
- this._onDidScroll.fire();
984
- this.clearActiveCellWidgets();
985
- }
986
- if (e.scrollTop === e.oldScrollTop && e.scrollHeightChanged) {
987
- this._onDidChangeLayout.fire();
988
- }
989
- }));
990
- this._focusTracker = this._register(trackFocus(this.getDomNode()));
991
- this._register(this._focusTracker.onDidBlur(() => {
992
- this._editorFocus.set(false);
993
- this.viewModel?.setEditorFocus(false);
994
- this._onDidBlurEmitter.fire();
995
- }));
996
- this._register(this._focusTracker.onDidFocus(() => {
997
- this._editorFocus.set(true);
998
- this.viewModel?.setEditorFocus(true);
999
- this._onDidFocusEmitter.fire();
1000
- }));
1001
- this._registerNotebookActionsToolbar();
1002
- this._registerNotebookStickyScroll();
1003
- this._register(this.configurationService.onDidChangeConfiguration(e => {
1004
- if (e.affectsConfiguration(accessibilityProvider.verbositySettingId)) {
1005
- this._list.ariaLabel = accessibilityProvider?.getWidgetAriaLabel();
1006
- }
1007
- }));
1008
- }
1009
- showListContextMenu(e) {
1010
- this.contextMenuService.showContextMenu({
1011
- menuId: MenuId.NotebookCellTitle,
1012
- menuActionOptions: {
1013
- shouldForwardArgs: true
1014
- },
1015
- contextKeyService: this.scopedContextKeyService,
1016
- getAnchor: () => e.anchor,
1017
- getActionsContext: () => {
1018
- return {
1019
- from: "cellContainer"
1020
- };
1021
- }
1022
- });
1023
- }
1024
- _registerNotebookOverviewRuler() {
1025
- this._notebookOverviewRuler = this._register(
1026
- this.instantiationService.createInstance(NotebookOverviewRuler, this, this._notebookOverviewRulerContainer)
1027
- );
1028
- }
1029
- _registerNotebookActionsToolbar() {
1030
- this._notebookTopToolbar = this._register(this.instantiationService.createInstance(
1031
- NotebookEditorWorkbenchToolbar,
1032
- this,
1033
- this.scopedContextKeyService,
1034
- this._notebookOptions,
1035
- this._notebookTopToolbarContainer
1036
- ));
1037
- this._register(this._notebookTopToolbar.onDidChangeVisibility(() => {
1038
- if (this._dimension && this._isVisible) {
1039
- this.layout(this._dimension);
1040
- }
1041
- }));
1042
- }
1043
- _registerNotebookStickyScroll() {
1044
- this._notebookStickyScroll = this._register(this.instantiationService.createInstance(
1045
- NotebookStickyScroll,
1046
- this._notebookStickyScrollContainer,
1047
- this,
1048
- this._list,
1049
- sizeDelta => {
1050
- if (this.isDisposed) {
1051
- return;
1052
- }
1053
- if (this._dimension && this._isVisible) {
1054
- if (sizeDelta > 0) {
1055
- this.layout(this._dimension);
1056
- this.setScrollTop(this.scrollTop + sizeDelta);
1057
- } else if (sizeDelta < 0) {
1058
- this.setScrollTop(this.scrollTop + sizeDelta);
1059
- this.layout(this._dimension);
1060
- }
1061
- }
1062
- this._onDidScroll.fire();
1063
- }
1064
- ));
1065
- }
1066
- _updateOutputRenderers() {
1067
- if (!this.viewModel || !this._webview) {
1068
- return;
1069
- }
1070
- this._webview.updateOutputRenderers();
1071
- this.viewModel.viewCells.forEach(cell => {
1072
- cell.outputsViewModels.forEach(output => {
1073
- if (output.pickedMimeType?.rendererId === RENDERER_NOT_AVAILABLE) {
1074
- output.resetRenderer();
1075
- }
1076
- });
1077
- });
1078
- }
1079
- getDomNode() {
1080
- return this._overlayContainer;
1081
- }
1082
- getOverflowContainerDomNode() {
1083
- return this._overflowContainer;
1084
- }
1085
- getInnerWebview() {
1086
- return this._webview?.webview;
1087
- }
1088
- setEditorProgressService(editorProgressService) {
1089
- this.editorProgressService = editorProgressService;
1090
- }
1091
- setParentContextKeyService(parentContextKeyService) {
1092
- this.scopedContextKeyService.updateParent(parentContextKeyService);
1093
- }
1094
- async setModel(textModel, viewState, perf, viewType) {
1095
- if (this.viewModel === undefined || !this.viewModel.equal(textModel)) {
1096
- const oldBottomToolbarDimensions = this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);
1097
- this._detachModel();
1098
- await this._attachModel(textModel, viewType ?? textModel.viewType, viewState, perf);
1099
- const newBottomToolbarDimensions = this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);
1100
- if (oldBottomToolbarDimensions.bottomToolbarGap !== newBottomToolbarDimensions.bottomToolbarGap || oldBottomToolbarDimensions.bottomToolbarHeight !== newBottomToolbarDimensions.bottomToolbarHeight) {
1101
- this._styleElement?.remove();
1102
- this._createLayoutStyles();
1103
- this._webview?.updateOptions({
1104
- ...this.notebookOptions.computeWebviewOptions(),
1105
- fontFamily: this._generateFontFamily()
1106
- });
1107
- }
1108
- this.telemetryService.publicLog2("notebook/editorOpened", {
1109
- scheme: textModel.uri.scheme,
1110
- ext: extname(textModel.uri),
1111
- viewType: textModel.viewType,
1112
- isRepl: this.isReplHistory
1113
- });
1114
- } else {
1115
- this.restoreListViewState(viewState);
1116
- }
1117
- this._restoreSelectedKernel(viewState);
1118
- this._loadKernelPreloads();
1119
- this._dndController?.clearGlobalDragState();
1120
- this._localStore.add(this._list.onDidChangeFocus(() => {
1121
- this.updateContextKeysOnFocusChange();
1122
- }));
1123
- this.updateContextKeysOnFocusChange();
1124
- this._backgroundMarkdownRendering();
1125
- }
1126
- _backgroundMarkdownRendering() {
1127
- if (this._backgroundMarkdownRenderRunning) {
1128
- return;
1129
- }
1130
- this._backgroundMarkdownRenderRunning = true;
1131
- runWhenWindowIdle(getWindow(this.getDomNode()), deadline => {
1132
- this._backgroundMarkdownRenderingWithDeadline(deadline);
1133
- });
1134
- }
1135
- _backgroundMarkdownRenderingWithDeadline(deadline) {
1136
- const endTime = Date.now() + deadline.timeRemaining();
1137
- const execute = () => {
1138
- try {
1139
- this._backgroundMarkdownRenderRunning = true;
1140
- if (this._isDisposed) {
1141
- return;
1142
- }
1143
- if (!this.viewModel) {
1144
- return;
1145
- }
1146
- const firstMarkupCell = this.viewModel.viewCells.find(
1147
- cell => cell.cellKind === CellKind.Markup && !this._webview?.markupPreviewMapping.has(cell.id) && !this.cellIsHidden(cell)
1148
- );
1149
- if (!firstMarkupCell) {
1150
- return;
1151
- }
1152
- this.createMarkupPreview(firstMarkupCell);
1153
- } finally {
1154
- this._backgroundMarkdownRenderRunning = false;
1155
- }
1156
- if (Date.now() < endTime) {
1157
- setTimeout0(execute);
1158
- } else {
1159
- this._backgroundMarkdownRendering();
1160
- }
1161
- };
1162
- execute();
1163
- }
1164
- updateContextKeysOnFocusChange() {
1165
- if (!this.viewModel) {
1166
- return;
1167
- }
1168
- const focused = this._list.getFocusedElements()[0];
1169
- if (focused) {
1170
- if (!this._cellContextKeyManager) {
1171
- this._cellContextKeyManager = this._localStore.add(
1172
- this.instantiationService.createInstance(CellContextKeyManager, this, focused)
1173
- );
1174
- }
1175
- this._cellContextKeyManager.updateForElement(focused);
1176
- }
1177
- }
1178
- async setOptions(options) {
1179
- if (options?.isReadOnly !== undefined) {
1180
- this._readOnly = options?.isReadOnly;
1181
- }
1182
- if (!this.viewModel) {
1183
- return;
1184
- }
1185
- this.viewModel.updateOptions({
1186
- isReadOnly: this._readOnly
1187
- });
1188
- this.notebookOptions.updateOptions(this._readOnly);
1189
- const cellOptions = options?.cellOptions ?? this._parseIndexedCellOptions(options);
1190
- if (cellOptions) {
1191
- const cell = this.viewModel.viewCells.find(cell => ( cell.uri.toString()) === ( cellOptions.resource.toString()));
1192
- if (cell) {
1193
- this.focusElement(cell);
1194
- const selection = cellOptions.options?.selection;
1195
- if (selection) {
1196
- cell.updateEditState(CellEditState.Editing, "setOptions");
1197
- cell.focusMode = CellFocusMode.Editor;
1198
- await this.revealRangeInCenterIfOutsideViewportAsync(cell, ( new Range(
1199
- selection.startLineNumber,
1200
- selection.startColumn,
1201
- selection.endLineNumber || selection.startLineNumber,
1202
- selection.endColumn || selection.startColumn
1203
- )));
1204
- } else {
1205
- this._list.revealCell(cell, options?.cellRevealType ?? CellRevealType.CenterIfOutsideViewport);
1206
- }
1207
- const editor = this._renderedEditors.get(cell);
1208
- if (editor) {
1209
- if (cellOptions.options?.selection) {
1210
- const {
1211
- selection
1212
- } = cellOptions.options;
1213
- const editorSelection = ( new Range(
1214
- selection.startLineNumber,
1215
- selection.startColumn,
1216
- selection.endLineNumber || selection.startLineNumber,
1217
- selection.endColumn || selection.startColumn
1218
- ));
1219
- editor.setSelection(editorSelection);
1220
- editor.revealPositionInCenterIfOutsideViewport({
1221
- lineNumber: selection.startLineNumber,
1222
- column: selection.startColumn
1223
- });
1224
- await this.revealRangeInCenterIfOutsideViewportAsync(cell, editorSelection);
1225
- }
1226
- if (!cellOptions.options?.preserveFocus) {
1227
- editor.focus();
1228
- }
1229
- }
1230
- }
1231
- }
1232
- if (options?.cellSelections) {
1233
- const focusCellIndex = options.cellSelections[0].start;
1234
- const focusedCell = this.viewModel.cellAt(focusCellIndex);
1235
- if (focusedCell) {
1236
- this.viewModel.updateSelectionsState({
1237
- kind: SelectionStateType.Index,
1238
- focus: {
1239
- start: focusCellIndex,
1240
- end: focusCellIndex + 1
1241
- },
1242
- selections: options.cellSelections
1243
- });
1244
- this.revealInCenterIfOutsideViewport(focusedCell);
1245
- }
1246
- }
1247
- this._updateForOptions();
1248
- this._onDidChangeOptions.fire();
1249
- }
1250
- _parseIndexedCellOptions(options) {
1251
- if (options?.indexedCellOptions) {
1252
- const cell = this.cellAt(options.indexedCellOptions.index);
1253
- if (cell) {
1254
- return {
1255
- resource: cell.uri,
1256
- options: {
1257
- selection: options.indexedCellOptions.selection,
1258
- preserveFocus: false
1259
- }
1260
- };
1261
- }
1262
- }
1263
- return undefined;
1264
- }
1265
- _detachModel() {
1266
- this._localStore.clear();
1267
- dispose(this._localCellStateListeners);
1268
- this._list.detachViewModel();
1269
- this.viewModel?.dispose();
1270
- this.viewModel = undefined;
1271
- this._webview?.dispose();
1272
- this._webview?.element.remove();
1273
- this._webview = null;
1274
- this._list.clear();
1275
- }
1276
- _updateForOptions() {
1277
- if (!this.viewModel) {
1278
- return;
1279
- }
1280
- this._editorEditable.set(!this.viewModel.options.isReadOnly);
1281
- this._overflowContainer.classList.toggle("notebook-editor-editable", !this.viewModel.options.isReadOnly);
1282
- this.getDomNode().classList.toggle("notebook-editor-editable", !this.viewModel.options.isReadOnly);
1283
- }
1284
- async _resolveWebview() {
1285
- if (!this.textModel) {
1286
- return null;
1287
- }
1288
- if (this._webviewResolvePromise) {
1289
- return this._webviewResolvePromise;
1290
- }
1291
- if (!this._webview) {
1292
- this._ensureWebview(this.getId(), this.textModel.viewType, this.textModel.uri);
1293
- }
1294
- this._webviewResolvePromise = (async () => {
1295
- if (!this._webview) {
1296
- throw ( new Error("Notebook output webview object is not created successfully."));
1297
- }
1298
- await this._webview.createWebview(this.creationOptions.codeWindow ?? mainWindow);
1299
- if (!this._webview.webview) {
1300
- throw ( new Error("Notebook output webview element was not created successfully."));
1301
- }
1302
- this._localStore.add(this._webview.webview.onDidBlur(() => {
1303
- this._outputFocus.set(false);
1304
- this._webviewFocused = false;
1305
- this.updateEditorFocus();
1306
- this.updateCellFocusMode();
1307
- }));
1308
- this._localStore.add(this._webview.webview.onDidFocus(() => {
1309
- this._outputFocus.set(true);
1310
- this.updateEditorFocus();
1311
- this._webviewFocused = true;
1312
- }));
1313
- this._localStore.add(this._webview.onMessage(e => {
1314
- this._onDidReceiveMessage.fire(e);
1315
- }));
1316
- return this._webview;
1317
- })();
1318
- return this._webviewResolvePromise;
1319
- }
1320
- _ensureWebview(id, viewType, resource) {
1321
- if (this._webview) {
1322
- return;
1323
- }
1324
- const that = this;
1325
- this._webview = this.instantiationService.createInstance(BackLayerWebView, {
1326
- get creationOptions() {
1327
- return that.creationOptions;
1328
- },
1329
- setScrollTop(scrollTop) {
1330
- that._list.scrollTop = scrollTop;
1331
- },
1332
- triggerScroll(event) {
1333
- that._list.triggerScrollFromMouseWheelEvent(event);
1334
- },
1335
- getCellByInfo: that.getCellByInfo.bind(that),
1336
- getCellById: that._getCellById.bind(that),
1337
- toggleNotebookCellSelection: that._toggleNotebookCellSelection.bind(that),
1338
- focusNotebookCell: that.focusNotebookCell.bind(that),
1339
- focusNextNotebookCell: that.focusNextNotebookCell.bind(that),
1340
- updateOutputHeight: that._updateOutputHeight.bind(that),
1341
- scheduleOutputHeightAck: that._scheduleOutputHeightAck.bind(that),
1342
- updateMarkupCellHeight: that._updateMarkupCellHeight.bind(that),
1343
- setMarkupCellEditState: that._setMarkupCellEditState.bind(that),
1344
- didStartDragMarkupCell: that._didStartDragMarkupCell.bind(that),
1345
- didDragMarkupCell: that._didDragMarkupCell.bind(that),
1346
- didDropMarkupCell: that._didDropMarkupCell.bind(that),
1347
- didEndDragMarkupCell: that._didEndDragMarkupCell.bind(that),
1348
- didResizeOutput: that._didResizeOutput.bind(that),
1349
- updatePerformanceMetadata: that._updatePerformanceMetadata.bind(that),
1350
- didFocusOutputInputChange: that._didFocusOutputInputChange.bind(that)
1351
- }, id, viewType, resource, {
1352
- ...this._notebookOptions.computeWebviewOptions(),
1353
- fontFamily: this._generateFontFamily()
1354
- }, this.notebookRendererMessaging.getScoped(this._uuid));
1355
- this._webview.element.style.width = "100%";
1356
- this._list.attachWebview(this._webview.element);
1357
- }
1358
- async _attachModel(textModel, viewType, viewState, perf) {
1359
- this._ensureWebview(this.getId(), textModel.viewType, textModel.uri);
1360
- this.viewModel = this.instantiationService.createInstance(
1361
- NotebookViewModel,
1362
- viewType,
1363
- textModel,
1364
- this._viewContext,
1365
- this.getLayoutInfo(),
1366
- {
1367
- isReadOnly: this._readOnly
1368
- }
1369
- );
1370
- this._viewContext.eventDispatcher.emit([( new NotebookLayoutChangedEvent({
1371
- width: true,
1372
- fontInfo: true
1373
- }, this.getLayoutInfo()))]);
1374
- this.notebookOptions.updateOptions(this._readOnly);
1375
- this._updateForOptions();
1376
- this._updateForNotebookConfiguration();
1377
- {
1378
- this.viewModel.restoreEditorViewState(viewState);
1379
- const contributionsState = viewState?.contributionsState || {};
1380
- for (const [id, contribution] of this._contributions) {
1381
- if (typeof contribution.restoreViewState === "function") {
1382
- contribution.restoreViewState(contributionsState[id]);
1383
- }
1384
- }
1385
- }
1386
- this._localStore.add(this.viewModel.onDidChangeViewCells(e => {
1387
- this._onDidChangeViewCells.fire(e);
1388
- }));
1389
- this._localStore.add(this.viewModel.onDidChangeSelection(() => {
1390
- this._onDidChangeSelection.fire();
1391
- this.updateSelectedMarkdownPreviews();
1392
- }));
1393
- this._localStore.add(this._list.onWillScroll(e => {
1394
- if (this._webview?.isResolved()) {
1395
- this._webviewTransparentCover.style.transform = `translateY(${e.scrollTop})`;
1396
- }
1397
- }));
1398
- let hasPendingChangeContentHeight = false;
1399
- const renderScrollHeightDisposable = this._localStore.add(( new MutableDisposable()));
1400
- this._localStore.add(this._list.onDidChangeContentHeight(() => {
1401
- if (hasPendingChangeContentHeight) {
1402
- return;
1403
- }
1404
- hasPendingChangeContentHeight = true;
1405
- renderScrollHeightDisposable.value = scheduleAtNextAnimationFrame(getWindow(this.getDomNode()), () => {
1406
- hasPendingChangeContentHeight = false;
1407
- this._updateScrollHeight();
1408
- }, 100);
1409
- }));
1410
- this._localStore.add(this._list.onDidRemoveOutputs(outputs => {
1411
- outputs.forEach(output => this.removeInset(output));
1412
- }));
1413
- this._localStore.add(this._list.onDidHideOutputs(outputs => {
1414
- outputs.forEach(output => this.hideInset(output));
1415
- }));
1416
- this._localStore.add(this._list.onDidRemoveCellsFromView(cells => {
1417
- const hiddenCells = [];
1418
- const deletedCells = [];
1419
- for (const cell of cells) {
1420
- if (cell.cellKind === CellKind.Markup) {
1421
- const mdCell = cell;
1422
- if (this.viewModel?.viewCells.find(cell => cell.handle === mdCell.handle)) {
1423
- hiddenCells.push(mdCell);
1424
- } else {
1425
- deletedCells.push(mdCell);
1426
- }
1427
- }
1428
- }
1429
- this.hideMarkupPreviews(hiddenCells);
1430
- this.deleteMarkupPreviews(deletedCells);
1431
- }));
1432
- await this._warmupWithMarkdownRenderer(this.viewModel, viewState, perf);
1433
- perf?.mark("customMarkdownLoaded");
1434
- this._localCellStateListeners = ( this.viewModel.viewCells.map(cell => this._bindCellListener(cell)));
1435
- this._lastCellWithEditorFocus = this.viewModel.viewCells.find(
1436
- viewCell => this.getActiveCell() === viewCell && viewCell.focusMode === CellFocusMode.Editor
1437
- ) ?? null;
1438
- this._localStore.add(this.viewModel.onDidChangeViewCells(e => {
1439
- if (this._isDisposed) {
1440
- return;
1441
- }
1442
- [...e.splices].reverse().forEach(splice => {
1443
- const [start, deleted, newCells] = splice;
1444
- const deletedCells = this._localCellStateListeners.splice(start, deleted, ...( newCells.map(cell => this._bindCellListener(cell))));
1445
- dispose(deletedCells);
1446
- });
1447
- if (( e.splices.some(s => ( s[2].some(cell => cell.cellKind === CellKind.Markup))))) {
1448
- this._backgroundMarkdownRendering();
1449
- }
1450
- }));
1451
- if (this._dimension) {
1452
- this._list.layout(this.getBodyHeight(this._dimension.height), this._dimension.width);
1453
- } else {
1454
- this._list.layout();
1455
- }
1456
- this._dndController?.clearGlobalDragState();
1457
- this.restoreListViewState(viewState);
1458
- }
1459
- _bindCellListener(cell) {
1460
- const store = ( new DisposableStore());
1461
- store.add(cell.onDidChangeLayout(e => {
1462
- if (e.totalHeight || e.outerWidth) {
1463
- this.layoutNotebookCell(cell, cell.layoutInfo.totalHeight, e.context);
1464
- }
1465
- }));
1466
- if (cell.cellKind === CellKind.Code) {
1467
- store.add(cell.onDidRemoveOutputs(outputs => {
1468
- outputs.forEach(output => this.removeInset(output));
1469
- }));
1470
- }
1471
- store.add(cell.onDidChangeState(e => {
1472
- if (e.inputCollapsedChanged && cell.isInputCollapsed && cell.cellKind === CellKind.Markup) {
1473
- this.hideMarkupPreviews([cell]);
1474
- }
1475
- if (e.outputCollapsedChanged && cell.isOutputCollapsed && cell.cellKind === CellKind.Code) {
1476
- cell.outputsViewModels.forEach(output => this.hideInset(output));
1477
- }
1478
- if (e.focusModeChanged) {
1479
- this._validateCellFocusMode(cell);
1480
- }
1481
- }));
1482
- store.add(cell.onCellDecorationsChanged(e => {
1483
- e.added.forEach(options => {
1484
- if (options.className) {
1485
- this.deltaCellContainerClassNames(cell.id, [options.className], [], cell.cellKind);
1486
- }
1487
- if (options.outputClassName) {
1488
- this.deltaCellContainerClassNames(cell.id, [options.outputClassName], [], cell.cellKind);
1489
- }
1490
- });
1491
- e.removed.forEach(options => {
1492
- if (options.className) {
1493
- this.deltaCellContainerClassNames(cell.id, [], [options.className], cell.cellKind);
1494
- }
1495
- if (options.outputClassName) {
1496
- this.deltaCellContainerClassNames(cell.id, [], [options.outputClassName], cell.cellKind);
1497
- }
1498
- });
1499
- }));
1500
- return store;
1501
- }
1502
- _validateCellFocusMode(cell) {
1503
- if (cell.focusMode !== CellFocusMode.Editor) {
1504
- return;
1505
- }
1506
- if (this._lastCellWithEditorFocus && this._lastCellWithEditorFocus !== cell) {
1507
- this._lastCellWithEditorFocus.focusMode = CellFocusMode.Container;
1508
- }
1509
- this._lastCellWithEditorFocus = cell;
1510
- }
1511
- async _warmupWithMarkdownRenderer(viewModel, viewState, perf) {
1512
- this.logService.debug("NotebookEditorWidget", "warmup " + this.viewModel?.uri.toString());
1513
- await this._resolveWebview();
1514
- perf?.mark("webviewCommLoaded");
1515
- this.logService.debug("NotebookEditorWidget", "warmup - webview resolved");
1516
- this._webview.element.style.visibility = "hidden";
1517
- await this._warmupViewportMarkdownCells(viewModel, viewState);
1518
- this.logService.debug("NotebookEditorWidget", "warmup - viewport warmed up");
1519
- this._list.layout(0, 0);
1520
- this._list.attachViewModel(viewModel);
1521
- this._list.scrollTop = viewState?.scrollPosition?.top ?? 0;
1522
- this._debug("finish initial viewport warmup and view state restore.");
1523
- this._webview.element.style.visibility = "visible";
1524
- this.logService.debug(
1525
- "NotebookEditorWidget",
1526
- "warmup - list view model attached, set to visible"
1527
- );
1528
- this._onDidAttachViewModel.fire();
1529
- }
1530
- async _warmupViewportMarkdownCells(viewModel, viewState) {
1531
- if (viewState && viewState.cellTotalHeights) {
1532
- const totalHeightCache = viewState.cellTotalHeights;
1533
- const scrollTop = viewState.scrollPosition?.top ?? 0;
1534
- const scrollBottom = scrollTop + Math.max(this._dimension?.height ?? 0, 1080);
1535
- let offset = 0;
1536
- const requests = [];
1537
- for (let i = 0; i < viewModel.length; i++) {
1538
- const cell = viewModel.cellAt(i);
1539
- const cellHeight = totalHeightCache[i] ?? 0;
1540
- if (offset + cellHeight < scrollTop) {
1541
- offset += cellHeight;
1542
- continue;
1543
- }
1544
- if (cell.cellKind === CellKind.Markup) {
1545
- requests.push([cell, offset]);
1546
- }
1547
- offset += cellHeight;
1548
- if (offset > scrollBottom) {
1549
- break;
1550
- }
1551
- }
1552
- await this._webview.initializeMarkup(( requests.map(([model, offset]) => this.createMarkupCellInitialization(model, offset))));
1553
- } else {
1554
- const initRequests = ( viewModel.viewCells.filter(cell => cell.cellKind === CellKind.Markup).slice(0, 5).map(cell => this.createMarkupCellInitialization(cell, -1e4)));
1555
- await this._webview.initializeMarkup(initRequests);
1556
- let offset = 0;
1557
- const offsetUpdateRequests = [];
1558
- const scrollBottom = Math.max(this._dimension?.height ?? 0, 1080);
1559
- for (const cell of viewModel.viewCells) {
1560
- if (cell.cellKind === CellKind.Markup) {
1561
- offsetUpdateRequests.push({
1562
- id: cell.id,
1563
- top: offset
1564
- });
1565
- }
1566
- offset += cell.getHeight(this.getLayoutInfo().fontInfo.lineHeight);
1567
- if (offset > scrollBottom) {
1568
- break;
1569
- }
1570
- }
1571
- this._webview?.updateScrollTops([], offsetUpdateRequests);
1572
- }
1573
- }
1574
- createMarkupCellInitialization(model, offset) {
1575
- return ({
1576
- mime: model.mime,
1577
- cellId: model.id,
1578
- cellHandle: model.handle,
1579
- content: model.getText(),
1580
- offset: offset,
1581
- visible: false,
1582
- metadata: model.metadata
1583
- });
1584
- }
1585
- restoreListViewState(viewState) {
1586
- if (!this.viewModel) {
1587
- return;
1588
- }
1589
- if (viewState?.scrollPosition !== undefined) {
1590
- this._list.scrollTop = viewState.scrollPosition.top;
1591
- this._list.scrollLeft = viewState.scrollPosition.left;
1592
- } else {
1593
- this._list.scrollTop = 0;
1594
- this._list.scrollLeft = 0;
1595
- }
1596
- const focusIdx = typeof viewState?.focus === "number" ? viewState.focus : 0;
1597
- if (focusIdx < this.viewModel.length) {
1598
- const element = this.viewModel.cellAt(focusIdx);
1599
- if (element) {
1600
- this.viewModel?.updateSelectionsState({
1601
- kind: SelectionStateType.Handle,
1602
- primary: element.handle,
1603
- selections: [element.handle]
1604
- });
1605
- }
1606
- } else if (this._list.length > 0) {
1607
- this.viewModel.updateSelectionsState({
1608
- kind: SelectionStateType.Index,
1609
- focus: {
1610
- start: 0,
1611
- end: 1
1612
- },
1613
- selections: [{
1614
- start: 0,
1615
- end: 1
1616
- }]
1617
- });
1618
- }
1619
- if (viewState?.editorFocused) {
1620
- const cell = this.viewModel.cellAt(focusIdx);
1621
- if (cell) {
1622
- cell.focusMode = CellFocusMode.Editor;
1623
- }
1624
- }
1625
- }
1626
- _restoreSelectedKernel(viewState) {
1627
- if (viewState?.selectedKernelId && this.textModel) {
1628
- const matching = this.notebookKernelService.getMatchingKernel(this.textModel);
1629
- const kernel = matching.all.find(k => k.id === viewState.selectedKernelId);
1630
- if (kernel && !matching.selected) {
1631
- this.notebookKernelService.selectKernelForNotebook(kernel, this.textModel);
1632
- }
1633
- }
1634
- }
1635
- getEditorViewState() {
1636
- const state = this.viewModel?.getEditorViewState();
1637
- if (!state) {
1638
- return {
1639
- editingCells: {},
1640
- cellLineNumberStates: {},
1641
- editorViewStates: {},
1642
- collapsedInputCells: {},
1643
- collapsedOutputCells: {}
1644
- };
1645
- }
1646
- if (this._list) {
1647
- state.scrollPosition = {
1648
- left: this._list.scrollLeft,
1649
- top: this._list.scrollTop
1650
- };
1651
- const cellHeights = {};
1652
- for (let i = 0; i < this.viewModel.length; i++) {
1653
- const elm = this.viewModel.cellAt(i);
1654
- cellHeights[i] = elm.layoutInfo.totalHeight;
1655
- }
1656
- state.cellTotalHeights = cellHeights;
1657
- if (this.viewModel) {
1658
- const focusRange = this.viewModel.getFocus();
1659
- const element = this.viewModel.cellAt(focusRange.start);
1660
- if (element) {
1661
- const itemDOM = this._list.domElementOfElement(element);
1662
- const editorFocused = element.getEditState() === CellEditState.Editing && !!(itemDOM && getActiveElement(itemDOM.ownerDocument) && itemDOM.contains(getActiveElement(itemDOM.ownerDocument)));
1663
- state.editorFocused = editorFocused;
1664
- state.focus = focusRange.start;
1665
- }
1666
- }
1667
- }
1668
- const contributionsState = {};
1669
- for (const [id, contribution] of this._contributions) {
1670
- if (typeof contribution.saveViewState === "function") {
1671
- contributionsState[id] = contribution.saveViewState();
1672
- }
1673
- }
1674
- state.contributionsState = contributionsState;
1675
- if (this.textModel?.uri.scheme === Schemas.untitled) {
1676
- state.selectedKernelId = this.activeKernel?.id;
1677
- }
1678
- return state;
1679
- }
1680
- _allowScrollBeyondLastLine() {
1681
- return this._scrollBeyondLastLine && !this.isReplHistory;
1682
- }
1683
- getBodyHeight(dimensionHeight) {
1684
- return Math.max(
1685
- dimensionHeight - (this._notebookTopToolbar?.useGlobalToolbar ? 26 : 0),
1686
- 0
1687
- );
1688
- }
1689
- layout(dimension, shadowElement, position) {
1690
- if (!shadowElement && !this._shadowElement) {
1691
- this._dimension = dimension;
1692
- return;
1693
- }
1694
- if (dimension.width <= 0 || dimension.height <= 0) {
1695
- this.onWillHide();
1696
- return;
1697
- }
1698
- const whenContainerStylesLoaded = this.layoutService.whenContainerStylesLoaded(getWindow(this.getDomNode()));
1699
- if (whenContainerStylesLoaded) {
1700
- whenContainerStylesLoaded.then(() => this.layoutNotebook(dimension, shadowElement));
1701
- } else {
1702
- this.layoutNotebook(dimension, shadowElement);
1703
- }
1704
- }
1705
- layoutNotebook(dimension, shadowElement) {
1706
- if (shadowElement) {
1707
- this._shadowElement = shadowElement;
1708
- }
1709
- this._dimension = dimension;
1710
- const newBodyHeight = this.getBodyHeight(dimension.height) - this.getLayoutInfo().stickyHeight;
1711
- size(this._body, dimension.width, newBodyHeight);
1712
- const newCellListHeight = newBodyHeight;
1713
- if (this._list.getRenderHeight() < newCellListHeight) {
1714
- this._list.updateOptions({
1715
- paddingBottom: this._allowScrollBeyondLastLine() ? Math.max(0, (newCellListHeight - 50)) : 0,
1716
- paddingTop: 0
1717
- });
1718
- this._list.layout(newCellListHeight, dimension.width);
1719
- } else {
1720
- this._list.layout(newCellListHeight, dimension.width);
1721
- this._list.updateOptions({
1722
- paddingBottom: this._allowScrollBeyondLastLine() ? Math.max(0, (newCellListHeight - 50)) : 0,
1723
- paddingTop: 0
1724
- });
1725
- }
1726
- this._overlayContainer.inert = false;
1727
- this.layoutContainerOverShadowElement(shadowElement ?? this._shadowElement);
1728
- if (this._webviewTransparentCover) {
1729
- this._webviewTransparentCover.style.height = `${dimension.height}px`;
1730
- this._webviewTransparentCover.style.width = `${dimension.width}px`;
1731
- }
1732
- this._notebookTopToolbar.layout(this._dimension);
1733
- this._notebookOverviewRuler.layout();
1734
- this._viewContext?.eventDispatcher.emit([( new NotebookLayoutChangedEvent({
1735
- width: true,
1736
- fontInfo: true
1737
- }, this.getLayoutInfo()))]);
1738
- }
1739
- layoutContainerOverShadowElement(anchorElement) {
1740
- if (!anchorElement) {
1741
- return;
1742
- }
1743
- const modalEditorContainer = this.editorGroupsService.activeModalEditorPart?.modalElement;
1744
- const isModal = isHTMLElement(modalEditorContainer) && modalEditorContainer.contains(anchorElement);
1745
- const clippingContainer = isModal ? undefined : this.layoutService.getContainer(getWindow(this.getDomNode()), Parts.EDITOR_PART);
1746
- this._overlayContainer.style.visibility = "visible";
1747
- this._overlayLayout.setAnchorElement(anchorElement, {
1748
- clippingContainer
1749
- });
1750
- this._overlayLayout.reapplyLayoutStyles();
1751
- }
1752
- focus() {
1753
- this._isVisible = true;
1754
- this._editorFocus.set(true);
1755
- if (this._webviewFocused) {
1756
- this._webview?.focusWebview();
1757
- } else {
1758
- if (this.viewModel) {
1759
- const focusRange = this.viewModel.getFocus();
1760
- const element = this.viewModel.cellAt(focusRange.start);
1761
- if (!this.hasEditorFocus()) {
1762
- this.focusContainer();
1763
- this.updateEditorFocus();
1764
- }
1765
- if (element && element.focusMode === CellFocusMode.Editor) {
1766
- element.updateEditState(CellEditState.Editing, "editorWidget.focus");
1767
- element.focusMode = CellFocusMode.Editor;
1768
- this.focusEditor(element);
1769
- return;
1770
- }
1771
- }
1772
- this._list.domFocus();
1773
- }
1774
- if (this._currentProgress) {
1775
- this.showProgress();
1776
- }
1777
- }
1778
- onShow() {
1779
- this._isVisible = true;
1780
- }
1781
- focusEditor(activeElement) {
1782
- for (const [element, editor] of this._renderedEditors.entries()) {
1783
- if (element === activeElement) {
1784
- editor.focus();
1785
- return;
1786
- }
1787
- }
1788
- }
1789
- focusContainer(clearSelection = false) {
1790
- if (this._webviewFocused) {
1791
- this._webview?.focusWebview();
1792
- } else {
1793
- this._list.focusContainer(clearSelection);
1794
- }
1795
- }
1796
- selectOutputContent(cell) {
1797
- this._webview?.selectOutputContents(cell);
1798
- }
1799
- selectInputContents(cell) {
1800
- this._webview?.selectInputContents(cell);
1801
- }
1802
- onWillHide() {
1803
- this._isVisible = false;
1804
- this._editorFocus.set(false);
1805
- this._overlayContainer.inert = true;
1806
- this._overlayContainer.style.visibility = "hidden";
1807
- this._overlayContainer.style.left = "-50000px";
1808
- this._notebookTopToolbarContainer.style.display = "none";
1809
- this.clearActiveCellWidgets();
1810
- }
1811
- clearActiveCellWidgets() {
1812
- this._renderedEditors.forEach((editor, cell) => {
1813
- if (this.getActiveCell() === cell && editor) {
1814
- SuggestController.get(editor)?.cancelSuggestWidget();
1815
- DropIntoEditorController.get(editor)?.clearWidgets();
1816
- CopyPasteController.get(editor)?.clearWidgets();
1817
- }
1818
- });
1819
- this._renderedEditors.forEach((editor, cell) => {
1820
- const controller = InlineCompletionsController.get(editor);
1821
- if (controller?.model.get()?.inlineEditState.get()) {
1822
- editor.render(true);
1823
- }
1824
- });
1825
- }
1826
- editorHasDomFocus() {
1827
- return isAncestorOfActiveElement(this.getDomNode());
1828
- }
1829
- updateEditorFocus() {
1830
- this._focusTracker.refreshState();
1831
- const focused = this.editorHasDomFocus();
1832
- this._editorFocus.set(focused);
1833
- this.viewModel?.setEditorFocus(focused);
1834
- }
1835
- updateCellFocusMode() {
1836
- const activeCell = this.getActiveCell();
1837
- if (activeCell?.focusMode === CellFocusMode.Output && !this._webviewFocused) {
1838
- activeCell.focusMode = CellFocusMode.Container;
1839
- }
1840
- }
1841
- hasEditorFocus() {
1842
- this.updateEditorFocus();
1843
- return this.editorHasDomFocus();
1844
- }
1845
- hasWebviewFocus() {
1846
- return this._webviewFocused;
1847
- }
1848
- hasOutputTextSelection() {
1849
- if (!this.hasEditorFocus()) {
1850
- return false;
1851
- }
1852
- const windowSelection = getWindow(this.getDomNode()).getSelection();
1853
- if (windowSelection?.rangeCount !== 1) {
1854
- return false;
1855
- }
1856
- const activeSelection = windowSelection.getRangeAt(0);
1857
- if (activeSelection.startContainer === activeSelection.endContainer && activeSelection.endOffset - activeSelection.startOffset === 0) {
1858
- return false;
1859
- }
1860
- let container = activeSelection.commonAncestorContainer;
1861
- if (!this._body.contains(container)) {
1862
- return false;
1863
- }
1864
- while (container && container !== this._body) {
1865
- if (container.classList && container.classList.contains("output")) {
1866
- return true;
1867
- }
1868
- container = container.parentNode;
1869
- }
1870
- return false;
1871
- }
1872
- _didFocusOutputInputChange(hasFocus) {
1873
- this._outputInputFocus.set(hasFocus);
1874
- }
1875
- focusElement(cell) {
1876
- this.viewModel?.updateSelectionsState({
1877
- kind: SelectionStateType.Handle,
1878
- primary: cell.handle,
1879
- selections: [cell.handle]
1880
- });
1881
- }
1882
- get scrollTop() {
1883
- return this._list.scrollTop;
1884
- }
1885
- get scrollBottom() {
1886
- return this._list.scrollTop + this._list.getRenderHeight();
1887
- }
1888
- getAbsoluteTopOfElement(cell) {
1889
- return this._list.getCellViewScrollTop(cell);
1890
- }
1891
- getAbsoluteBottomOfElement(cell) {
1892
- return this._list.getCellViewScrollBottom(cell);
1893
- }
1894
- getHeightOfElement(cell) {
1895
- return this._list.elementHeight(cell);
1896
- }
1897
- scrollToBottom() {
1898
- this._list.scrollToBottom();
1899
- }
1900
- setScrollTop(scrollTop) {
1901
- this._list.scrollTop = scrollTop;
1902
- }
1903
- revealCellRangeInView(range) {
1904
- return this._list.revealCells(range);
1905
- }
1906
- revealInView(cell) {
1907
- return this._list.revealCell(cell, CellRevealType.Default);
1908
- }
1909
- revealInViewAtTop(cell) {
1910
- this._list.revealCell(cell, CellRevealType.Top);
1911
- }
1912
- revealInCenter(cell) {
1913
- this._list.revealCell(cell, CellRevealType.Center);
1914
- }
1915
- async revealInCenterIfOutsideViewport(cell) {
1916
- await this._list.revealCell(cell, CellRevealType.CenterIfOutsideViewport);
1917
- }
1918
- async revealFirstLineIfOutsideViewport(cell) {
1919
- await this._list.revealCell(cell, CellRevealType.FirstLineIfOutsideViewport);
1920
- }
1921
- async revealLineInViewAsync(cell, line) {
1922
- return this._list.revealRangeInCell(cell, ( new Range(line, 1, line, 1)), CellRevealRangeType.Default);
1923
- }
1924
- async revealLineInCenterAsync(cell, line) {
1925
- return this._list.revealRangeInCell(cell, ( new Range(line, 1, line, 1)), CellRevealRangeType.Center);
1926
- }
1927
- async revealLineInCenterIfOutsideViewportAsync(cell, line) {
1928
- return this._list.revealRangeInCell(cell, ( new Range(line, 1, line, 1)), CellRevealRangeType.CenterIfOutsideViewport);
1929
- }
1930
- async revealRangeInViewAsync(cell, range) {
1931
- return this._list.revealRangeInCell(cell, range, CellRevealRangeType.Default);
1932
- }
1933
- async revealRangeInCenterAsync(cell, range) {
1934
- return this._list.revealRangeInCell(cell, range, CellRevealRangeType.Center);
1935
- }
1936
- async revealRangeInCenterIfOutsideViewportAsync(cell, range) {
1937
- return this._list.revealRangeInCell(cell, range, CellRevealRangeType.CenterIfOutsideViewport);
1938
- }
1939
- revealCellOffsetInCenter(cell, offset) {
1940
- return this._list.revealCellOffsetInCenter(cell, offset);
1941
- }
1942
- revealOffsetInCenterIfOutsideViewport(offset) {
1943
- return this._list.revealOffsetInCenterIfOutsideViewport(offset);
1944
- }
1945
- getViewIndexByModelIndex(index) {
1946
- if (!this._listViewInfoAccessor) {
1947
- return -1;
1948
- }
1949
- const cell = this.viewModel?.viewCells[index];
1950
- if (!cell) {
1951
- return -1;
1952
- }
1953
- return this._listViewInfoAccessor.getViewIndex(cell);
1954
- }
1955
- getViewHeight(cell) {
1956
- if (!this._listViewInfoAccessor) {
1957
- return -1;
1958
- }
1959
- return this._listViewInfoAccessor.getViewHeight(cell);
1960
- }
1961
- getCellRangeFromViewRange(startIndex, endIndex) {
1962
- return this._listViewInfoAccessor.getCellRangeFromViewRange(startIndex, endIndex);
1963
- }
1964
- getCellsInRange(range) {
1965
- return this._listViewInfoAccessor.getCellsInRange(range);
1966
- }
1967
- setCellEditorSelection(cell, range) {
1968
- this._list.setCellEditorSelection(cell, range);
1969
- }
1970
- setHiddenAreas(_ranges) {
1971
- return this._list.setHiddenAreas(_ranges, true);
1972
- }
1973
- getVisibleRangesPlusViewportAboveAndBelow() {
1974
- return this._listViewInfoAccessor.getVisibleRangesPlusViewportAboveAndBelow();
1975
- }
1976
- deltaCellDecorations(oldDecorations, newDecorations) {
1977
- const ret = this.viewModel?.deltaCellDecorations(oldDecorations, newDecorations) || [];
1978
- this._onDidChangeDecorations.fire();
1979
- return ret;
1980
- }
1981
- deltaCellContainerClassNames(cellId, added, removed, cellkind) {
1982
- if (cellkind === CellKind.Markup) {
1983
- this._webview?.deltaMarkupPreviewClassNames(cellId, added, removed);
1984
- } else {
1985
- this._webview?.deltaCellOutputContainerClassNames(cellId, added, removed);
1986
- }
1987
- }
1988
- changeModelDecorations(callback) {
1989
- return this.viewModel?.changeModelDecorations(callback) || null;
1990
- }
1991
- changeViewZones(callback) {
1992
- this._list.changeViewZones(callback);
1993
- this._onDidChangeLayout.fire();
1994
- }
1995
- getViewZoneLayoutInfo(id) {
1996
- return this._list.getViewZoneLayoutInfo(id);
1997
- }
1998
- changeCellOverlays(callback) {
1999
- this._list.changeCellOverlays(callback);
2000
- }
2001
- async _loadKernelPreloads() {
2002
- if (!this.hasModel()) {
2003
- return;
2004
- }
2005
- const {
2006
- selected
2007
- } = this.notebookKernelService.getMatchingKernel(this.textModel);
2008
- if (!this._webview?.isResolved()) {
2009
- await this._resolveWebview();
2010
- }
2011
- this._webview?.updateKernelPreloads(selected);
2012
- }
2013
- get activeKernel() {
2014
- return this.textModel && this.notebookKernelService.getSelectedOrSuggestedKernel(this.textModel);
2015
- }
2016
- async cancelNotebookCells(cells) {
2017
- if (!this.viewModel || !this.hasModel()) {
2018
- return;
2019
- }
2020
- if (!cells) {
2021
- cells = this.viewModel.viewCells;
2022
- }
2023
- return this.notebookExecutionService.cancelNotebookCellHandles(this.textModel, ( Array.from(cells).map(cell => cell.handle)));
2024
- }
2025
- async executeNotebookCells(cells) {
2026
- if (!this.viewModel || !this.hasModel()) {
2027
- this.logService.info("notebookEditorWidget", "No NotebookViewModel, cannot execute cells");
2028
- return;
2029
- }
2030
- if (!cells) {
2031
- cells = this.viewModel.viewCells;
2032
- }
2033
- return this.notebookExecutionService.executeNotebookCells(this.textModel, ( Array.from(cells).map(c => c.model)), this.scopedContextKeyService);
2034
- }
2035
- async layoutNotebookCell(cell, height, context) {
2036
- return this._cellLayoutManager?.layoutNotebookCell(cell, height);
2037
- }
2038
- getActiveCell() {
2039
- const elements = this._list.getFocusedElements();
2040
- if (elements && elements.length) {
2041
- return elements[0];
2042
- }
2043
- return undefined;
2044
- }
2045
- _toggleNotebookCellSelection(selectedCell, selectFromPrevious) {
2046
- const currentSelections = this._list.getSelectedElements();
2047
- const isSelected = currentSelections.includes(selectedCell);
2048
- const previousSelection = selectFromPrevious ? currentSelections[currentSelections.length - 1] ?? selectedCell : selectedCell;
2049
- const selectedIndex = this._list.getViewIndex(selectedCell);
2050
- const previousIndex = this._list.getViewIndex(previousSelection);
2051
- const cellsInSelectionRange = this.getCellsInViewRange(selectedIndex, previousIndex);
2052
- if (isSelected) {
2053
- this._list.selectElements(
2054
- currentSelections.filter(current => !cellsInSelectionRange.includes(current))
2055
- );
2056
- } else {
2057
- this.focusElement(selectedCell);
2058
- this._list.selectElements([
2059
- ...currentSelections.filter(current => !cellsInSelectionRange.includes(current)),
2060
- ...cellsInSelectionRange
2061
- ]);
2062
- }
2063
- }
2064
- getCellsInViewRange(fromInclusive, toInclusive) {
2065
- const selectedCellsInRange = [];
2066
- for (let index = 0; index < this._list.length; ++index) {
2067
- const cell = this._list.element(index);
2068
- if (cell) {
2069
- if ((index >= fromInclusive && index <= toInclusive) || (index >= toInclusive && index <= fromInclusive)) {
2070
- selectedCellsInRange.push(cell);
2071
- }
2072
- }
2073
- }
2074
- return selectedCellsInRange;
2075
- }
2076
- async focusNotebookCell(cell, focusItem, options) {
2077
- if (this._isDisposed) {
2078
- return;
2079
- }
2080
- cell.focusedOutputId = undefined;
2081
- if (focusItem === "editor") {
2082
- cell.isInputCollapsed = false;
2083
- this.focusElement(cell);
2084
- this._list.focusView();
2085
- cell.updateEditState(CellEditState.Editing, "focusNotebookCell");
2086
- cell.focusMode = CellFocusMode.Editor;
2087
- if (!options?.skipReveal) {
2088
- if (typeof options?.focusEditorLine === "number") {
2089
- this._cursorNavMode.set(true);
2090
- await this.revealLineInViewAsync(cell, options.focusEditorLine);
2091
- const editor = this._renderedEditors.get(cell);
2092
- const focusEditorLine = options.focusEditorLine;
2093
- editor?.setSelection({
2094
- startLineNumber: focusEditorLine,
2095
- startColumn: 1,
2096
- endLineNumber: focusEditorLine,
2097
- endColumn: 1
2098
- });
2099
- } else {
2100
- const selectionsStartPosition = cell.getSelectionsStartPosition();
2101
- if (selectionsStartPosition?.length) {
2102
- const firstSelectionPosition = selectionsStartPosition[0];
2103
- await this.revealRangeInViewAsync(cell, Range.fromPositions(firstSelectionPosition, firstSelectionPosition));
2104
- } else {
2105
- await this.revealInView(cell);
2106
- }
2107
- }
2108
- }
2109
- } else if (focusItem === "output") {
2110
- this.focusElement(cell);
2111
- if (!this.hasEditorFocus()) {
2112
- this._list.focusView();
2113
- }
2114
- if (!this._webview) {
2115
- return;
2116
- }
2117
- const firstOutputId = cell.outputsViewModels.find(o => o.model.alternativeOutputId)?.model.alternativeOutputId;
2118
- const focusElementId = options?.outputId ?? firstOutputId ?? cell.id;
2119
- this._webview.focusOutput(
2120
- focusElementId,
2121
- options?.altOutputId,
2122
- options?.outputWebviewFocused || this._webviewFocused
2123
- );
2124
- cell.updateEditState(CellEditState.Preview, "focusNotebookCell");
2125
- cell.focusMode = CellFocusMode.Output;
2126
- cell.focusedOutputId = options?.outputId;
2127
- this._outputFocus.set(true);
2128
- if (!options?.skipReveal) {
2129
- this.revealInCenterIfOutsideViewport(cell);
2130
- }
2131
- } else {
2132
- const itemDOM = this._list.domElementOfElement(cell);
2133
- if (itemDOM && getActiveElement(itemDOM.ownerDocument) && itemDOM.contains(getActiveElement(itemDOM.ownerDocument))) {
2134
- getActiveElement(itemDOM.ownerDocument).blur();
2135
- }
2136
- this._webview?.blurOutput();
2137
- cell.updateEditState(CellEditState.Preview, "focusNotebookCell");
2138
- cell.focusMode = CellFocusMode.Container;
2139
- this.focusElement(cell);
2140
- if (!options?.skipReveal) {
2141
- if (typeof options?.focusEditorLine === "number") {
2142
- this._cursorNavMode.set(true);
2143
- await this.revealInView(cell);
2144
- } else if (options?.revealBehavior === ScrollToRevealBehavior.firstLine) {
2145
- await this.revealFirstLineIfOutsideViewport(cell);
2146
- } else if (options?.revealBehavior === ScrollToRevealBehavior.fullCell) {
2147
- await this.revealInView(cell);
2148
- } else {
2149
- await this.revealInCenterIfOutsideViewport(cell);
2150
- }
2151
- }
2152
- this._list.focusView();
2153
- this.updateEditorFocus();
2154
- }
2155
- }
2156
- async focusNextNotebookCell(cell, focusItem) {
2157
- const idx = this.viewModel?.getCellIndex(cell);
2158
- if (typeof idx !== "number") {
2159
- return;
2160
- }
2161
- const newCell = this.viewModel?.cellAt(idx + 1);
2162
- if (!newCell) {
2163
- return;
2164
- }
2165
- await this.focusNotebookCell(newCell, focusItem);
2166
- }
2167
- async _warmupCell(viewCell) {
2168
- if (viewCell.isOutputCollapsed) {
2169
- return;
2170
- }
2171
- const outputs = viewCell.outputsViewModels;
2172
- for (const output of outputs.slice(0, outputDisplayLimit)) {
2173
- const [mimeTypes, pick] = output.resolveMimeTypes(this.textModel, undefined);
2174
- if (!mimeTypes.find(mimeType => mimeType.isTrusted) || mimeTypes.length === 0) {
2175
- continue;
2176
- }
2177
- const pickedMimeTypeRenderer = mimeTypes[pick];
2178
- if (!pickedMimeTypeRenderer) {
2179
- return;
2180
- }
2181
- const renderer = this._notebookService.getRendererInfo(pickedMimeTypeRenderer.rendererId);
2182
- if (!renderer) {
2183
- return;
2184
- }
2185
- const result = {
2186
- type: RenderOutputType.Extension,
2187
- renderer,
2188
- source: output,
2189
- mimeType: pickedMimeTypeRenderer.mimeType
2190
- };
2191
- const inset = this._webview?.insetMapping.get(result.source);
2192
- if (!inset || !inset.initialized) {
2193
- const p = ( new Promise(resolve => {
2194
- this._register(Event.any(this.onDidRenderOutput, this.onDidRemoveOutput)(e => {
2195
- if (e.model === result.source.model) {
2196
- resolve();
2197
- }
2198
- }));
2199
- }));
2200
- this.createOutput(viewCell, result, 0, false);
2201
- await p;
2202
- } else {
2203
- this.createOutput(viewCell, result, 0, false);
2204
- }
2205
- return;
2206
- }
2207
- }
2208
- async _warmupAll(includeOutput) {
2209
- if (!this.hasModel() || !this.viewModel) {
2210
- return;
2211
- }
2212
- const cells = this.viewModel.viewCells;
2213
- const requests = [];
2214
- for (let i = 0; i < cells.length; i++) {
2215
- if (cells[i].cellKind === CellKind.Markup && !( this._webview.markupPreviewMapping.has(cells[i].id))) {
2216
- requests.push(this.createMarkupPreview(cells[i]));
2217
- }
2218
- }
2219
- if (includeOutput && this._list) {
2220
- for (let i = 0; i < this._list.length; i++) {
2221
- const cell = this._list.element(i);
2222
- if (cell?.cellKind === CellKind.Code) {
2223
- requests.push(this._warmupCell(cell));
2224
- }
2225
- }
2226
- }
2227
- return Promise.all(requests);
2228
- }
2229
- async _warmupSelection(includeOutput, selectedCellRanges) {
2230
- if (!this.hasModel() || !this.viewModel) {
2231
- return;
2232
- }
2233
- const cells = this.viewModel.viewCells;
2234
- const requests = [];
2235
- for (const range of selectedCellRanges) {
2236
- for (let i = range.start; i < range.end; i++) {
2237
- if (cells[i].cellKind === CellKind.Markup && !( this._webview.markupPreviewMapping.has(cells[i].id))) {
2238
- requests.push(this.createMarkupPreview(cells[i]));
2239
- }
2240
- }
2241
- }
2242
- if (includeOutput && this._list) {
2243
- for (const range of selectedCellRanges) {
2244
- for (let i = range.start; i < range.end; i++) {
2245
- const cell = this._list.element(i);
2246
- if (cell?.cellKind === CellKind.Code) {
2247
- requests.push(this._warmupCell(cell));
2248
- }
2249
- }
2250
- }
2251
- }
2252
- return Promise.all(requests);
2253
- }
2254
- async find(
2255
- query,
2256
- options,
2257
- token,
2258
- skipWarmup = false,
2259
- shouldGetSearchPreviewInfo = false,
2260
- ownerID
2261
- ) {
2262
- if (!this._notebookViewModel) {
2263
- return [];
2264
- }
2265
- if (!ownerID) {
2266
- ownerID = this.getId();
2267
- }
2268
- const findMatches = this._notebookViewModel.find(query, options).filter(match => match.length > 0);
2269
- if ((!options.includeMarkupPreview && !options.includeOutput) || options.findScope?.findScopeType === NotebookFindScopeType.Text) {
2270
- this._webview?.findStop(ownerID);
2271
- return findMatches;
2272
- }
2273
- const matchMap = {};
2274
- findMatches.forEach(match => {
2275
- matchMap[match.cell.id] = match;
2276
- });
2277
- if (this._webview) {
2278
- const start = Date.now();
2279
- if (options.findScope && options.findScope.findScopeType === NotebookFindScopeType.Cells && options.findScope.selectedCellRanges) {
2280
- await this._warmupSelection(!!options.includeOutput, options.findScope.selectedCellRanges);
2281
- } else {
2282
- await this._warmupAll(!!options.includeOutput);
2283
- }
2284
- const end = Date.now();
2285
- this.logService.debug("Find", `Warmup time: ${end - start}ms`);
2286
- if (token.isCancellationRequested) {
2287
- return [];
2288
- }
2289
- let findIds = [];
2290
- if (options.findScope && options.findScope.findScopeType === NotebookFindScopeType.Cells && options.findScope.selectedCellRanges) {
2291
- const selectedIndexes = cellRangesToIndexes(options.findScope.selectedCellRanges);
2292
- findIds = ( selectedIndexes.map(index => this._notebookViewModel?.viewCells[index].id ?? ""));
2293
- }
2294
- const webviewMatches = await this._webview.find(query, {
2295
- caseSensitive: options.caseSensitive,
2296
- wholeWord: options.wholeWord,
2297
- includeMarkup: !!options.includeMarkupPreview,
2298
- includeOutput: !!options.includeOutput,
2299
- shouldGetSearchPreviewInfo,
2300
- ownerID,
2301
- findIds: findIds
2302
- });
2303
- if (token.isCancellationRequested) {
2304
- return [];
2305
- }
2306
- webviewMatches.forEach(match => {
2307
- const cell = this._notebookViewModel.viewCells.find(cell => cell.id === match.cellId);
2308
- if (!cell) {
2309
- return;
2310
- }
2311
- if (match.type === "preview") {
2312
- if (cell.getEditState() === CellEditState.Preview && !options.includeMarkupPreview) {
2313
- return;
2314
- }
2315
- if (cell.getEditState() === CellEditState.Editing && options.includeMarkupInput) {
2316
- return;
2317
- }
2318
- } else {
2319
- if (!options.includeOutput) {
2320
- return;
2321
- }
2322
- }
2323
- const exisitingMatch = matchMap[match.cellId];
2324
- if (exisitingMatch) {
2325
- exisitingMatch.webviewMatches.push(match);
2326
- } else {
2327
- matchMap[match.cellId] = ( new CellFindMatchModel(
2328
- this._notebookViewModel.viewCells.find(cell => cell.id === match.cellId),
2329
- this._notebookViewModel.viewCells.findIndex(cell => cell.id === match.cellId),
2330
- [],
2331
- [match]
2332
- ));
2333
- }
2334
- });
2335
- }
2336
- const ret = [];
2337
- this._notebookViewModel.viewCells.forEach((cell, index) => {
2338
- if (matchMap[cell.id]) {
2339
- ret.push(( new CellFindMatchModel(
2340
- cell,
2341
- index,
2342
- matchMap[cell.id].contentMatches,
2343
- matchMap[cell.id].webviewMatches
2344
- )));
2345
- }
2346
- });
2347
- return ret;
2348
- }
2349
- async findHighlightCurrent(matchIndex, ownerID) {
2350
- if (!this._webview) {
2351
- return 0;
2352
- }
2353
- return this._webview?.findHighlightCurrent(matchIndex, ownerID ?? this.getId());
2354
- }
2355
- async findUnHighlightCurrent(matchIndex, ownerID) {
2356
- if (!this._webview) {
2357
- return;
2358
- }
2359
- return this._webview?.findUnHighlightCurrent(matchIndex, ownerID ?? this.getId());
2360
- }
2361
- findStop(ownerID) {
2362
- this._webview?.findStop(ownerID ?? this.getId());
2363
- }
2364
- getLayoutInfo() {
2365
- if (!this._list) {
2366
- throw ( new Error("Editor is not initalized successfully"));
2367
- }
2368
- if (!this._fontInfo) {
2369
- this._generateFontInfo();
2370
- }
2371
- let listViewOffset = 0;
2372
- if (this._dimension) {
2373
- listViewOffset = (this._notebookTopToolbar?.useGlobalToolbar ? 26 : 0) + (this._notebookStickyScroll?.getCurrentStickyHeight() ?? 0);
2374
- }
2375
- return {
2376
- width: this._dimension?.width ?? 0,
2377
- height: this._dimension?.height ?? 0,
2378
- scrollHeight: this._list?.getScrollHeight() ?? 0,
2379
- fontInfo: this._fontInfo,
2380
- stickyHeight: this._notebookStickyScroll?.getCurrentStickyHeight() ?? 0,
2381
- listViewOffsetTop: listViewOffset
2382
- };
2383
- }
2384
- async createMarkupPreview(cell) {
2385
- if (!this._webview) {
2386
- return;
2387
- }
2388
- if (!this._webview.isResolved()) {
2389
- await this._resolveWebview();
2390
- }
2391
- if (!this._webview || !this._list.webviewElement) {
2392
- return;
2393
- }
2394
- if (!this.viewModel || !this._list.viewModel) {
2395
- return;
2396
- }
2397
- if (this.viewModel.getCellIndex(cell) === -1) {
2398
- return;
2399
- }
2400
- if (this.cellIsHidden(cell)) {
2401
- return;
2402
- }
2403
- const webviewTop = parseInt(this._list.webviewElement.domNode.style.top, 10);
2404
- const top = !!webviewTop ? (0 - webviewTop) : 0;
2405
- const cellTop = this._list.getCellViewScrollTop(cell);
2406
- await this._webview.showMarkupPreview({
2407
- mime: cell.mime,
2408
- cellHandle: cell.handle,
2409
- cellId: cell.id,
2410
- content: cell.getText(),
2411
- offset: cellTop + top,
2412
- visible: true,
2413
- metadata: cell.metadata
2414
- });
2415
- }
2416
- cellIsHidden(cell) {
2417
- const modelIndex = this.viewModel.getCellIndex(cell);
2418
- const foldedRanges = this.viewModel.getHiddenRanges();
2419
- return ( foldedRanges.some(range => modelIndex >= range.start && modelIndex <= range.end));
2420
- }
2421
- async unhideMarkupPreviews(cells) {
2422
- if (!this._webview) {
2423
- return;
2424
- }
2425
- if (!this._webview.isResolved()) {
2426
- await this._resolveWebview();
2427
- }
2428
- await this._webview?.unhideMarkupPreviews(( cells.map(cell => cell.id)));
2429
- }
2430
- async hideMarkupPreviews(cells) {
2431
- if (!this._webview || !cells.length) {
2432
- return;
2433
- }
2434
- if (!this._webview.isResolved()) {
2435
- await this._resolveWebview();
2436
- }
2437
- await this._webview?.hideMarkupPreviews(( cells.map(cell => cell.id)));
2438
- }
2439
- async deleteMarkupPreviews(cells) {
2440
- if (!this._webview) {
2441
- return;
2442
- }
2443
- if (!this._webview.isResolved()) {
2444
- await this._resolveWebview();
2445
- }
2446
- await this._webview?.deleteMarkupPreviews(( cells.map(cell => cell.id)));
2447
- }
2448
- async updateSelectedMarkdownPreviews() {
2449
- if (!this._webview) {
2450
- return;
2451
- }
2452
- if (!this._webview.isResolved()) {
2453
- await this._resolveWebview();
2454
- }
2455
- const selectedCells = ( this.getSelectionViewModels().map(cell => cell.id));
2456
- await this._webview?.updateMarkupPreviewSelections(selectedCells.length > 1 ? selectedCells : []);
2457
- }
2458
- async createOutput(cell, output, offset, createWhenIdle) {
2459
- this._insetModifyQueueByOutputId.queue(output.source.model.outputId, async () => {
2460
- if (this._isDisposed || !this._webview) {
2461
- return;
2462
- }
2463
- if (!this._webview.isResolved()) {
2464
- await this._resolveWebview();
2465
- }
2466
- if (!this._webview) {
2467
- return;
2468
- }
2469
- if (!this._list.webviewElement) {
2470
- return;
2471
- }
2472
- if (output.type === RenderOutputType.Extension) {
2473
- this.notebookRendererMessaging.prepare(output.renderer.id);
2474
- }
2475
- const webviewTop = parseInt(this._list.webviewElement.domNode.style.top, 10);
2476
- const top = !!webviewTop ? (0 - webviewTop) : 0;
2477
- const cellTop = this._list.getCellViewScrollTop(cell) + top;
2478
- const existingOutput = this._webview.insetMapping.get(output.source);
2479
- if (!existingOutput || (!existingOutput.renderer && output.type === RenderOutputType.Extension)) {
2480
- if (createWhenIdle) {
2481
- this._webview.requestCreateOutputWhenWebviewIdle({
2482
- cellId: cell.id,
2483
- cellHandle: cell.handle,
2484
- cellUri: cell.uri,
2485
- executionId: cell.internalMetadata.executionId
2486
- }, output, cellTop, offset);
2487
- } else {
2488
- this._webview.createOutput({
2489
- cellId: cell.id,
2490
- cellHandle: cell.handle,
2491
- cellUri: cell.uri,
2492
- executionId: cell.internalMetadata.executionId
2493
- }, output, cellTop, offset);
2494
- }
2495
- } else if (existingOutput.renderer && output.type === RenderOutputType.Extension && existingOutput.renderer.id !== output.renderer.id) {
2496
- this._webview.removeInsets([output.source]);
2497
- this._webview.createOutput({
2498
- cellId: cell.id,
2499
- cellHandle: cell.handle,
2500
- cellUri: cell.uri
2501
- }, output, cellTop, offset);
2502
- } else if (existingOutput.versionId !== output.source.model.versionId) {
2503
- this._webview.updateOutput({
2504
- cellId: cell.id,
2505
- cellHandle: cell.handle,
2506
- cellUri: cell.uri,
2507
- executionId: cell.internalMetadata.executionId
2508
- }, output, cellTop, offset);
2509
- } else {
2510
- const outputIndex = cell.outputsViewModels.indexOf(output.source);
2511
- const outputOffset = cell.getOutputOffset(outputIndex);
2512
- this._webview.updateScrollTops([{
2513
- cell,
2514
- output: output.source,
2515
- cellTop,
2516
- outputOffset,
2517
- forceDisplay: !cell.isOutputCollapsed
2518
- }], []);
2519
- }
2520
- });
2521
- }
2522
- async updateOutput(cell, output, offset) {
2523
- this._insetModifyQueueByOutputId.queue(output.source.model.outputId, async () => {
2524
- if (this._isDisposed || !this._webview || cell.isOutputCollapsed) {
2525
- return;
2526
- }
2527
- if (!this._webview.isResolved()) {
2528
- await this._resolveWebview();
2529
- }
2530
- if (!this._webview || !this._list.webviewElement) {
2531
- return;
2532
- }
2533
- if (!( this._webview.insetMapping.has(output.source))) {
2534
- return this.createOutput(cell, output, offset, false);
2535
- }
2536
- if (output.type === RenderOutputType.Extension) {
2537
- this.notebookRendererMessaging.prepare(output.renderer.id);
2538
- }
2539
- const webviewTop = parseInt(this._list.webviewElement.domNode.style.top, 10);
2540
- const top = !!webviewTop ? (0 - webviewTop) : 0;
2541
- const cellTop = this._list.getCellViewScrollTop(cell) + top;
2542
- this._webview.updateOutput({
2543
- cellId: cell.id,
2544
- cellHandle: cell.handle,
2545
- cellUri: cell.uri
2546
- }, output, cellTop, offset);
2547
- });
2548
- }
2549
- async copyOutputImage(cellOutput) {
2550
- this._webview?.copyImage(cellOutput);
2551
- }
2552
- removeInset(output) {
2553
- this._insetModifyQueueByOutputId.queue(output.model.outputId, async () => {
2554
- if (this._isDisposed || !this._webview) {
2555
- return;
2556
- }
2557
- if (this._webview?.isResolved()) {
2558
- this._webview.removeInsets([output]);
2559
- }
2560
- this._onDidRemoveOutput.fire(output);
2561
- });
2562
- }
2563
- hideInset(output) {
2564
- this._insetModifyQueueByOutputId.queue(output.model.outputId, async () => {
2565
- if (this._isDisposed || !this._webview) {
2566
- return;
2567
- }
2568
- if (this._webview?.isResolved()) {
2569
- this._webview.hideInset(output);
2570
- }
2571
- });
2572
- }
2573
- postMessage(message) {
2574
- if (this._webview?.isResolved()) {
2575
- this._webview.postKernelMessage(message);
2576
- }
2577
- }
2578
- addClassName(className) {
2579
- this._overlayContainer.classList.add(className);
2580
- }
2581
- removeClassName(className) {
2582
- this._overlayContainer.classList.remove(className);
2583
- }
2584
- cellAt(index) {
2585
- return this.viewModel?.cellAt(index);
2586
- }
2587
- getCellByInfo(cellInfo) {
2588
- const {
2589
- cellHandle
2590
- } = cellInfo;
2591
- return this.viewModel?.viewCells.find(vc => vc.handle === cellHandle);
2592
- }
2593
- getCellByHandle(handle) {
2594
- return this.viewModel?.getCellByHandle(handle);
2595
- }
2596
- getCellIndex(cell) {
2597
- return this.viewModel?.getCellIndexByHandle(cell.handle);
2598
- }
2599
- getNextVisibleCellIndex(index) {
2600
- return this.viewModel?.getNextVisibleCellIndex(index);
2601
- }
2602
- getPreviousVisibleCellIndex(index) {
2603
- return this.viewModel?.getPreviousVisibleCellIndex(index);
2604
- }
2605
- _updateScrollHeight() {
2606
- if (this._isDisposed || !this._webview?.isResolved()) {
2607
- return;
2608
- }
2609
- if (!this._list.webviewElement) {
2610
- return;
2611
- }
2612
- const scrollHeight = this._list.scrollHeight;
2613
- this._webview.element.style.height = `${scrollHeight + NOTEBOOK_WEBVIEW_BOUNDARY * 2}px`;
2614
- const webviewTop = parseInt(this._list.webviewElement.domNode.style.top, 10);
2615
- const top = !!webviewTop ? (0 - webviewTop) : 0;
2616
- const updateItems = [];
2617
- const removedItems = [];
2618
- this._webview?.insetMapping.forEach((value, key) => {
2619
- const cell = this.viewModel?.getCellByHandle(value.cellInfo.cellHandle);
2620
- if (!cell || !(cell instanceof CodeCellViewModel)) {
2621
- return;
2622
- }
2623
- const viewIndex = this._list.getViewIndex(cell);
2624
- if (viewIndex === undefined) {
2625
- return;
2626
- }
2627
- const outputIndex = cell.outputsViewModels.indexOf(key);
2628
- if (outputIndex < 0) {
2629
- removedItems.push(key);
2630
- return;
2631
- }
2632
- const cellTop = this._list.getCellViewScrollTop(cell);
2633
- const outputOffset = cell.getOutputOffset(outputIndex);
2634
- updateItems.push({
2635
- cell,
2636
- output: key,
2637
- cellTop: cellTop + top,
2638
- outputOffset,
2639
- forceDisplay: false
2640
- });
2641
- });
2642
- this._webview.removeInsets(removedItems);
2643
- const markdownUpdateItems = [];
2644
- for (const cellId of ( this._webview.markupPreviewMapping.keys())) {
2645
- const cell = this.viewModel?.viewCells.find(cell => cell.id === cellId);
2646
- if (cell) {
2647
- const cellTop = this._list.getCellViewScrollTop(cell);
2648
- markdownUpdateItems.push({
2649
- id: cellId,
2650
- top: cellTop + top
2651
- });
2652
- }
2653
- }
2654
- if (markdownUpdateItems.length || updateItems.length) {
2655
- this._debug("_list.onDidChangeContentHeight/markdown", markdownUpdateItems);
2656
- this._webview?.updateScrollTops(updateItems, markdownUpdateItems);
2657
- }
2658
- }
2659
- _updateOutputHeight(cellInfo, output, outputHeight, isInit, source) {
2660
- const cell = this.viewModel?.viewCells.find(vc => vc.handle === cellInfo.cellHandle);
2661
- if (cell && cell instanceof CodeCellViewModel) {
2662
- const outputIndex = cell.outputsViewModels.indexOf(output);
2663
- if (outputIndex > -1) {
2664
- this._debug("update cell output", cell.handle, outputHeight);
2665
- cell.updateOutputHeight(outputIndex, outputHeight, source);
2666
- this.layoutNotebookCell(cell, cell.layoutInfo.totalHeight);
2667
- if (isInit) {
2668
- this._onDidRenderOutput.fire(output);
2669
- }
2670
- } else {
2671
- this._debug("tried to update cell output that does not exist");
2672
- }
2673
- }
2674
- }
2675
- _scheduleOutputHeightAck(cellInfo, outputId, height) {
2676
- const wasEmpty = this._pendingOutputHeightAcks.size === 0;
2677
- this._pendingOutputHeightAcks.set(outputId, {
2678
- cellId: cellInfo.cellId,
2679
- outputId,
2680
- height
2681
- });
2682
- if (wasEmpty) {
2683
- scheduleAtNextAnimationFrame(getWindow(this.getDomNode()), () => {
2684
- this._debug("ack height");
2685
- this._updateScrollHeight();
2686
- this._webview?.ackHeight([...( this._pendingOutputHeightAcks.values())]);
2687
- this._pendingOutputHeightAcks.clear();
2688
- }, -1);
2689
- }
2690
- }
2691
- _getCellById(cellId) {
2692
- return this.viewModel?.viewCells.find(vc => vc.id === cellId);
2693
- }
2694
- _updateMarkupCellHeight(cellId, height, isInit) {
2695
- const cell = this._getCellById(cellId);
2696
- if (cell && cell instanceof MarkupCellViewModel) {
2697
- const {
2698
- bottomToolbarGap
2699
- } = this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);
2700
- this._debug("updateMarkdownCellHeight", cell.handle, height + bottomToolbarGap, isInit);
2701
- cell.renderedMarkdownHeight = height;
2702
- }
2703
- }
2704
- _setMarkupCellEditState(cellId, editState) {
2705
- const cell = this._getCellById(cellId);
2706
- if (cell instanceof MarkupCellViewModel) {
2707
- this.revealInView(cell);
2708
- cell.updateEditState(editState, "setMarkdownCellEditState");
2709
- }
2710
- }
2711
- _didStartDragMarkupCell(cellId, event) {
2712
- const cell = this._getCellById(cellId);
2713
- if (cell instanceof MarkupCellViewModel) {
2714
- const webviewOffset = this._list.webviewElement ? -parseInt(this._list.webviewElement.domNode.style.top, 10) : 0;
2715
- this._dndController?.startExplicitDrag(cell, event.dragOffsetY - webviewOffset);
2716
- }
2717
- }
2718
- _didDragMarkupCell(cellId, event) {
2719
- const cell = this._getCellById(cellId);
2720
- if (cell instanceof MarkupCellViewModel) {
2721
- const webviewOffset = this._list.webviewElement ? -parseInt(this._list.webviewElement.domNode.style.top, 10) : 0;
2722
- this._dndController?.explicitDrag(cell, event.dragOffsetY - webviewOffset);
2723
- }
2724
- }
2725
- _didDropMarkupCell(cellId, event) {
2726
- const cell = this._getCellById(cellId);
2727
- if (cell instanceof MarkupCellViewModel) {
2728
- const webviewOffset = this._list.webviewElement ? -parseInt(this._list.webviewElement.domNode.style.top, 10) : 0;
2729
- event.dragOffsetY -= webviewOffset;
2730
- this._dndController?.explicitDrop(cell, event);
2731
- }
2732
- }
2733
- _didEndDragMarkupCell(cellId) {
2734
- const cell = this._getCellById(cellId);
2735
- if (cell instanceof MarkupCellViewModel) {
2736
- this._dndController?.endExplicitDrag(cell);
2737
- }
2738
- }
2739
- _didResizeOutput(cellId) {
2740
- const cell = this._getCellById(cellId);
2741
- if (cell) {
2742
- this._onDidResizeOutputEmitter.fire(cell);
2743
- }
2744
- }
2745
- _updatePerformanceMetadata(cellId, executionId, duration, rendererId) {
2746
- if (!this.hasModel()) {
2747
- return;
2748
- }
2749
- const cell = this._getCellById(cellId);
2750
- const cellIndex = !cell ? undefined : this.getCellIndex(cell);
2751
- if (cell?.internalMetadata.executionId === executionId && cellIndex !== undefined) {
2752
- const renderDurationMap = cell.internalMetadata.renderDuration || {};
2753
- renderDurationMap[rendererId] = (renderDurationMap[rendererId] ?? 0) + duration;
2754
- this.textModel.applyEdits([{
2755
- editType: CellEditType.PartialInternalMetadata,
2756
- index: cellIndex,
2757
- internalMetadata: {
2758
- executionId: executionId,
2759
- renderDuration: renderDurationMap
2760
- }
2761
- }], true, undefined, () => undefined, undefined, false);
2762
- }
2763
- }
2764
- getContribution(id) {
2765
- return (this._contributions.get(id) || null);
2766
- }
2767
- dispose() {
2768
- this._isDisposed = true;
2769
- this._webview?.dispose();
2770
- this._webview = null;
2771
- this.notebookEditorService.removeNotebookEditor(this);
2772
- dispose(( this._contributions.values()));
2773
- this._contributions.clear();
2774
- this._localStore.clear();
2775
- dispose(this._localCellStateListeners);
2776
- this._list.dispose();
2777
- this._cellLayoutManager?.dispose();
2778
- this._listTopCellToolbar?.dispose();
2779
- this._overlayContainer.remove();
2780
- this.viewModel?.dispose();
2781
- this._renderedEditors.clear();
2782
- this._baseCellEditorOptions.forEach(v => v.dispose());
2783
- this._baseCellEditorOptions.clear();
2784
- this._notebookOverviewRulerContainer.remove();
2785
- super.dispose();
2786
- this._webview = null;
2787
- this._webviewResolvePromise = null;
2788
- this._webviewTransparentCover = null;
2789
- this._dndController = null;
2790
- this._listTopCellToolbar = null;
2791
- this._notebookViewModel = undefined;
2792
- this._cellContextKeyManager = null;
2793
- this._notebookTopToolbar = null;
2794
- this._list = null;
2795
- this._listViewInfoAccessor = null;
2796
- this._listDelegate = null;
2797
- }
2798
- toJSON() {
2799
- return {
2800
- notebookUri: this.viewModel?.uri
2801
- };
2802
- }
2803
- };
2804
- NotebookEditorWidget = ( __decorate([( __param(2, IInstantiationService)), ( __param(3, IEditorGroupsService)), ( __param(4, INotebookRendererMessagingService)), ( __param(5, INotebookEditorService)), ( __param(6, INotebookKernelService)), ( __param(7, INotebookService)), ( __param(8, IConfigurationService)), ( __param(9, IContextKeyService)), ( __param(10, IWorkbenchLayoutService)), ( __param(11, IContextMenuService)), ( __param(12, ITelemetryService)), ( __param(13, INotebookExecutionService)), ( __param(14, IEditorProgressService)), ( __param(15, INotebookLoggingService))], NotebookEditorWidget));
2805
- registerZIndex(ZIndex.Base, 5, "notebook-progress-bar");
2806
- registerZIndex(ZIndex.Base, 10, "notebook-list-insertion-indicator");
2807
- registerZIndex(ZIndex.Base, 20, "notebook-cell-editor-outline");
2808
- registerZIndex(ZIndex.Base, 25, "notebook-scrollbar");
2809
- registerZIndex(ZIndex.Base, 26, "notebook-cell-status");
2810
- registerZIndex(ZIndex.Base, 26, "notebook-folding-indicator");
2811
- registerZIndex(ZIndex.Base, 27, "notebook-output");
2812
- registerZIndex(ZIndex.Base, 28, "notebook-cell-bottom-toolbar-container");
2813
- registerZIndex(ZIndex.Base, 29, "notebook-run-button-container");
2814
- registerZIndex(ZIndex.Base, 29, "notebook-input-collapse-condicon");
2815
- registerZIndex(ZIndex.Base, 30, "notebook-cell-output-toolbar");
2816
- registerZIndex(ZIndex.Sash, 1, "notebook-cell-expand-part-button");
2817
- registerZIndex(ZIndex.Sash, 2, "notebook-cell-toolbar");
2818
- registerZIndex(ZIndex.Sash, 3, "notebook-cell-toolbar-dropdown-active");
2819
- const notebookCellBorder = registerColor("notebook.cellBorderColor", {
2820
- dark: ( transparent(listInactiveSelectionBackground, 1)),
2821
- light: ( transparent(listInactiveSelectionBackground, 1)),
2822
- hcDark: PANEL_BORDER,
2823
- hcLight: PANEL_BORDER
2824
- }, ( localize(14721, "The border color for notebook cells.")));
2825
- registerColor("notebook.focusedEditorBorder", focusBorder, ( localize(14722, "The color of the notebook cell editor border.")));
2826
- const cellStatusIconSuccess = registerColor(
2827
- "notebookStatusSuccessIcon.foreground",
2828
- debugIconStartForeground,
2829
- ( localize(14723, "The error icon color of notebook cells in the cell status bar."))
2830
- );
2831
- const runningCellRulerDecorationColor = registerColor(
2832
- "notebookEditorOverviewRuler.runningCellForeground",
2833
- debugIconStartForeground,
2834
- ( localize(
2835
- 14724,
2836
- "The color of the running cell decoration in the notebook editor overview ruler."
2837
- ))
2838
- );
2839
- const cellStatusIconError = registerColor("notebookStatusErrorIcon.foreground", errorForeground, ( localize(14725, "The error icon color of notebook cells in the cell status bar.")));
2840
- registerColor("notebookStatusRunningIcon.foreground", foreground, ( localize(14726, "The running icon color of notebook cells in the cell status bar.")));
2841
- registerColor("notebook.outputContainerBorderColor", null, ( localize(14727, "The border color of the notebook output container.")));
2842
- registerColor("notebook.outputContainerBackgroundColor", null, ( localize(14728, "The color of the notebook output container background.")));
2843
- registerColor("notebook.cellToolbarSeparator", {
2844
- dark: ( ( Color.fromHex("#808080")).transparent(0.35)),
2845
- light: ( ( Color.fromHex("#808080")).transparent(0.35)),
2846
- hcDark: contrastBorder,
2847
- hcLight: contrastBorder
2848
- }, ( localize(14729, "The color of the separator in the cell bottom toolbar")));
2849
- const focusedCellBackground = registerColor("notebook.focusedCellBackground", null, ( localize(14730, "The background color of a cell when the cell is focused.")));
2850
- registerColor("notebook.selectedCellBackground", {
2851
- dark: listInactiveSelectionBackground,
2852
- light: listInactiveSelectionBackground,
2853
- hcDark: null,
2854
- hcLight: null
2855
- }, ( localize(14731, "The background color of a cell when the cell is selected.")));
2856
- registerColor("notebook.cellHoverBackground", {
2857
- dark: ( transparent(focusedCellBackground, .5)),
2858
- light: ( transparent(focusedCellBackground, .7)),
2859
- hcDark: null,
2860
- hcLight: null
2861
- }, ( localize(14732, "The background color of a cell when the cell is hovered.")));
2862
- registerColor("notebook.selectedCellBorder", {
2863
- dark: notebookCellBorder,
2864
- light: notebookCellBorder,
2865
- hcDark: contrastBorder,
2866
- hcLight: contrastBorder
2867
- }, ( localize(
2868
- 14733,
2869
- "The color of the cell's top and bottom border when the cell is selected but not focused."
2870
- )));
2871
- registerColor("notebook.inactiveSelectedCellBorder", {
2872
- dark: null,
2873
- light: null,
2874
- hcDark: focusBorder,
2875
- hcLight: focusBorder
2876
- }, ( localize(14734, "The color of the cell's borders when multiple cells are selected.")));
2877
- registerColor("notebook.focusedCellBorder", focusBorder, ( localize(
2878
- 14735,
2879
- "The color of the cell's focus indicator borders when the cell is focused."
2880
- )));
2881
- registerColor("notebook.inactiveFocusedCellBorder", notebookCellBorder, ( localize(
2882
- 14736,
2883
- "The color of the cell's top and bottom border when a cell is focused while the primary focus is outside of the editor."
2884
- )));
2885
- registerColor("notebook.cellStatusBarItemHoverBackground", {
2886
- light: ( new Color(( new RGBA(0, 0, 0, 0.08)))),
2887
- dark: ( new Color(( new RGBA(255, 255, 255, 0.15)))),
2888
- hcDark: ( new Color(( new RGBA(255, 255, 255, 0.15)))),
2889
- hcLight: ( new Color(( new RGBA(0, 0, 0, 0.08))))
2890
- }, ( localize(14737, "The background color of notebook cell status bar items.")));
2891
- registerColor("notebook.cellInsertionIndicator", focusBorder, ( localize(14738, "The color of the notebook cell insertion indicator.")));
2892
- registerColor(
2893
- "notebookScrollbarSlider.background",
2894
- scrollbarSliderBackground,
2895
- ( localize(14739, "Notebook scrollbar slider background color."))
2896
- );
2897
- registerColor(
2898
- "notebookScrollbarSlider.hoverBackground",
2899
- scrollbarSliderHoverBackground,
2900
- ( localize(14740, "Notebook scrollbar slider background color when hovering."))
2901
- );
2902
- registerColor(
2903
- "notebookScrollbarSlider.activeBackground",
2904
- scrollbarSliderActiveBackground,
2905
- ( localize(14741, "Notebook scrollbar slider background color when clicked on."))
2906
- );
2907
- registerColor("notebook.symbolHighlightBackground", {
2908
- dark: ( Color.fromHex("#ffffff0b")),
2909
- light: ( Color.fromHex("#fdff0033")),
2910
- hcDark: null,
2911
- hcLight: null
2912
- }, ( localize(14742, "Background color of highlighted cell")));
2913
- registerColor("notebook.cellEditorBackground", {
2914
- light: SIDE_BAR_BACKGROUND,
2915
- dark: SIDE_BAR_BACKGROUND,
2916
- hcDark: null,
2917
- hcLight: null
2918
- }, ( localize(14743, "Cell editor background color.")));
2919
- const notebookEditorBackground = registerColor("notebook.editorBackground", {
2920
- light: EDITOR_PANE_BACKGROUND,
2921
- dark: EDITOR_PANE_BACKGROUND,
2922
- hcDark: null,
2923
- hcLight: null
2924
- }, ( localize(14744, "Notebook background color.")));
2925
-
2926
- export { NotebookEditorWidget, cellStatusIconError, cellStatusIconSuccess, focusedCellBackground, getDefaultNotebookCreationOptions, notebookCellBorder, runningCellRulerDecorationColor };