@codingame/monaco-vscode-api 1.85.0-next.2 → 1.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/README.md +19 -10
  2. package/contributions.js +1 -0
  3. package/missing-services.js +91 -5
  4. package/monaco-editor-treemending.patch +2540 -2533
  5. package/package.json +6 -6
  6. package/vscode/src/vs/base/common/jsonFormatter.js +8 -1
  7. package/vscode/src/vs/platform/actions/browser/buttonbar.js +128 -0
  8. package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
  9. package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +58 -0
  10. package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +56 -1
  11. package/vscode/src/vs/workbench/browser/actions/layoutActions.js +186 -4
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +191 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +238 -2
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +75 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +205 -1
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +168 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +35 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +340 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1195 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +115 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +81 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.css.js +4 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.js +62 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +583 -0
  25. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +4 -0
  26. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +290 -0
  27. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +167 -0
  28. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +4 -0
  29. package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +6 -1
  30. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +562 -0
  31. package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +31 -1
  32. package/vscode/src/vs/workbench/contrib/chat/common/chatProvider.js +24 -1
  33. package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +193 -0
  34. package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +22 -1
  35. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +52 -1
  36. package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +258 -0
  37. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +37 -0
  38. package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +25 -0
  39. package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css.js +4 -0
  40. package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +388 -0
  41. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +61 -0
  42. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +49 -0
  43. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +647 -0
  44. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +300 -0
  45. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +60 -0
  46. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
  47. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +107 -0
  48. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +333 -0
  49. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +4 -0
  50. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +99 -0
  51. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +55 -0
  52. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +2 -0
  53. package/vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js +20 -0
  54. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +855 -0
  55. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +410 -0
  56. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1591 -0
  57. package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
  58. package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
  59. package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
  60. package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1485 -0
  61. package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +125 -0
  62. package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +29 -0
  63. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +41 -0
  64. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +102 -0
  65. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.css.js +4 -0
  66. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +988 -0
  67. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.js +431 -0
  68. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +417 -0
  69. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +806 -0
  70. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +915 -0
  71. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +19 -0
  72. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +129 -10
  73. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +205 -0
  74. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +150 -0
  75. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +480 -0
  76. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
  77. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +90 -0
  78. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
  79. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
  80. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +258 -0
  81. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +614 -0
  82. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
  83. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +44 -0
  84. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
  85. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
  86. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +169 -0
  87. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +64 -0
  88. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.js +49 -0
  89. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
  90. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +120 -0
  91. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +416 -0
  92. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
  93. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +663 -0
  94. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +593 -0
  95. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +72 -0
  96. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +326 -0
  97. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +539 -0
  98. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +265 -0
  99. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +348 -0
  100. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css.js +4 -0
  101. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +4 -0
  102. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css.js +4 -0
  103. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css.js +4 -0
  104. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css.js +4 -0
  105. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css.js +4 -0
  106. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css.js +4 -0
  107. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css.js +4 -0
  108. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css.js +4 -0
  109. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css.js +4 -0
  110. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css.js +4 -0
  111. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css.js +4 -0
  112. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css.js +4 -0
  113. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css.js +4 -0
  114. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.js +95 -3
  115. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +437 -0
  116. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +29 -0
  117. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2730 -0
  118. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +139 -0
  119. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +17 -0
  120. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +564 -0
  121. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +27 -0
  122. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +119 -0
  123. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +27 -0
  124. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +135 -0
  125. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +178 -0
  126. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +35 -0
  127. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +377 -0
  128. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +97 -0
  129. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +194 -0
  130. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +71 -0
  131. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +20 -0
  132. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +85 -0
  133. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +652 -0
  134. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +59 -0
  135. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +303 -0
  136. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +24 -0
  137. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +228 -0
  138. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatActions.js +302 -0
  139. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.js +438 -0
  140. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +45 -0
  141. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +435 -0
  142. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +95 -0
  143. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +107 -0
  144. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +29 -0
  145. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +59 -0
  146. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +67 -0
  147. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +430 -0
  148. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +54 -0
  149. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +1131 -0
  150. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +21 -0
  151. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +1591 -0
  152. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +341 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +2155 -0
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +65 -0
  155. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +95 -0
  156. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +507 -0
  157. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +85 -0
  158. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +47 -0
  159. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +40 -0
  160. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +435 -0
  161. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +31 -0
  162. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +257 -0
  163. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +239 -0
  164. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +103 -0
  165. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.js +211 -0
  166. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +808 -0
  167. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +8 -0
  168. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +381 -0
  169. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +527 -0
  170. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +163 -0
  171. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +651 -0
  172. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +173 -0
  173. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +98 -0
  174. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +62 -0
  175. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +101 -0
  176. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +346 -0
  177. package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +152 -1
  178. package/vscode/src/vs/workbench/contrib/notebook/common/notebookContextKeys.js +39 -0
  179. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +296 -0
  180. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +261 -0
  181. package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.js +3 -1
  182. package/vscode/src/vs/workbench/contrib/notebook/common/notebookKernelService.js +2 -1
  183. package/vscode/src/vs/workbench/contrib/notebook/common/notebookKeymapService.js +3 -0
  184. package/vscode/src/vs/workbench/contrib/notebook/common/notebookLoggingService.js +3 -0
  185. package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +16 -0
  186. package/vscode/src/vs/workbench/contrib/notebook/common/notebookRange.js +66 -0
  187. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWorkerService.js +4 -0
  188. package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +130 -0
  189. package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
  190. package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +847 -0
  191. package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +89 -0
  192. package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +1942 -0
  193. package/vscode/src/vs/workbench/contrib/remote/browser/urlFinder.js +107 -0
  194. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +49 -0
  195. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +387 -0
  196. package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +2 -2
  197. package/vscode/src/vs/workbench/contrib/search/common/constants.js +66 -0
  198. package/vscode/src/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
  199. package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js +24 -0
  200. package/vscode/src/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets.js +95 -0
  201. package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
  202. package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -1
  203. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/featuredExtensionService.js +159 -0
  204. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint.js +375 -0
  205. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +563 -0
  206. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.js +932 -0
  207. package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +15 -1
  208. package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +2 -2
  209. package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +190 -2
  210. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +77 -0
  211. package/assets/break.mp3 +0 -0
  212. package/assets/chatRequestSent.mp3 +0 -0
  213. package/assets/chatResponsePending.mp3 +0 -0
  214. package/assets/chatResponseReceived1.mp3 +0 -0
  215. package/assets/chatResponseReceived2.mp3 +0 -0
  216. package/assets/chatResponseReceived3.mp3 +0 -0
  217. package/assets/chatResponseReceived4.mp3 +0 -0
  218. package/assets/clear.mp3 +0 -0
  219. package/assets/defaultIcon.png +0 -0
  220. package/assets/diffLineDeleted.mp3 +0 -0
  221. package/assets/diffLineInserted.mp3 +0 -0
  222. package/assets/diffLineModified.mp3 +0 -0
  223. package/assets/error.mp3 +0 -0
  224. package/assets/fake.html +0 -10
  225. package/assets/foldedAreas.mp3 +0 -0
  226. package/assets/format.mp3 +0 -0
  227. package/assets/index-no-csp.html +0 -1226
  228. package/assets/index.html +0 -1227
  229. package/assets/quickFixes.mp3 +0 -0
  230. package/assets/save.mp3 +0 -0
  231. package/assets/service-worker.js +0 -457
  232. package/assets/taskCompleted.mp3 +0 -0
  233. package/assets/taskFailed.mp3 +0 -0
  234. package/assets/terminalBell.mp3 +0 -0
  235. package/assets/warning.mp3 +0 -0
  236. package/assets/webWorkerExtensionHostIframe.html +0 -123
  237. package/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +0 -2
  238. package/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2
  239. package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -5
@@ -0,0 +1,593 @@
1
+ import { ResourceTextEdit } from 'monaco-editor/esm/vs/editor/browser/services/bulkEditService.js';
2
+ import { Position } from 'monaco-editor/esm/vs/editor/common/core/position.js';
3
+ import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
4
+ import { PLAINTEXT_LANGUAGE_ID } from 'monaco-editor/esm/vs/editor/common/languages/modesRegistry.js';
5
+ import { ResourceNotebookCellEdit } from '../../../bulkEdit/browser/bulkCellEdits.js';
6
+ import { CellEditState, expandCellRangesWithHiddenCells, CellFocusMode } from '../notebookBrowser.js';
7
+ import { cloneNotebookCellTextModel } from '../../common/model/notebookCellTextModel.js';
8
+ import { SelectionStateType, CellKind } from '../../common/notebookCommon.js';
9
+ import { cellRangesToIndexes, cellRangeContains } from '../../common/notebookRange.js';
10
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
11
+ async function changeCellToKind(kind, context, language, mime) {
12
+ const { notebookEditor } = context;
13
+ if (!notebookEditor.hasModel()) {
14
+ return;
15
+ }
16
+ if (notebookEditor.isReadOnly) {
17
+ return;
18
+ }
19
+ if (context.ui && context.cell) {
20
+ const { cell } = context;
21
+ if (cell.cellKind === kind) {
22
+ return;
23
+ }
24
+ const text = cell.getText();
25
+ const idx = notebookEditor.getCellIndex(cell);
26
+ if (language === undefined) {
27
+ const availableLanguages = notebookEditor.activeKernel?.supportedLanguages ?? [];
28
+ language = availableLanguages[0] ?? PLAINTEXT_LANGUAGE_ID;
29
+ }
30
+ notebookEditor.textModel.applyEdits([
31
+ {
32
+ editType: 1 ,
33
+ index: idx,
34
+ count: 1,
35
+ cells: [{
36
+ cellKind: kind,
37
+ source: text,
38
+ language: language,
39
+ mime: mime ?? cell.mime,
40
+ outputs: cell.model.outputs,
41
+ metadata: cell.metadata,
42
+ }]
43
+ }
44
+ ], true, {
45
+ kind: SelectionStateType.Index,
46
+ focus: notebookEditor.getFocus(),
47
+ selections: notebookEditor.getSelections()
48
+ }, () => {
49
+ return {
50
+ kind: SelectionStateType.Index,
51
+ focus: notebookEditor.getFocus(),
52
+ selections: notebookEditor.getSelections()
53
+ };
54
+ }, undefined, true);
55
+ const newCell = notebookEditor.cellAt(idx);
56
+ await notebookEditor.focusNotebookCell(newCell, cell.getEditState() === CellEditState.Editing ? 'editor' : 'container');
57
+ }
58
+ else if (context.selectedCells) {
59
+ const selectedCells = context.selectedCells;
60
+ const rawEdits = [];
61
+ selectedCells.forEach(cell => {
62
+ if (cell.cellKind === kind) {
63
+ return;
64
+ }
65
+ const text = cell.getText();
66
+ const idx = notebookEditor.getCellIndex(cell);
67
+ if (language === undefined) {
68
+ const availableLanguages = notebookEditor.activeKernel?.supportedLanguages ?? [];
69
+ language = availableLanguages[0] ?? PLAINTEXT_LANGUAGE_ID;
70
+ }
71
+ rawEdits.push({
72
+ editType: 1 ,
73
+ index: idx,
74
+ count: 1,
75
+ cells: [{
76
+ cellKind: kind,
77
+ source: text,
78
+ language: language,
79
+ mime: mime ?? cell.mime,
80
+ outputs: cell.model.outputs,
81
+ metadata: cell.metadata,
82
+ }]
83
+ });
84
+ });
85
+ notebookEditor.textModel.applyEdits(rawEdits, true, {
86
+ kind: SelectionStateType.Index,
87
+ focus: notebookEditor.getFocus(),
88
+ selections: notebookEditor.getSelections()
89
+ }, () => {
90
+ return {
91
+ kind: SelectionStateType.Index,
92
+ focus: notebookEditor.getFocus(),
93
+ selections: notebookEditor.getSelections()
94
+ };
95
+ }, undefined, true);
96
+ }
97
+ }
98
+ function runDeleteAction(editor, cell) {
99
+ const textModel = editor.textModel;
100
+ const selections = editor.getSelections();
101
+ const targetCellIndex = editor.getCellIndex(cell);
102
+ const containingSelection = selections.find(selection => selection.start <= targetCellIndex && targetCellIndex < selection.end);
103
+ const computeUndoRedo = !editor.isReadOnly || textModel.viewType === 'interactive';
104
+ if (containingSelection) {
105
+ const edits = ( selections.reverse().map(selection => ({
106
+ editType: 1 , index: selection.start, count: selection.end - selection.start, cells: []
107
+ })));
108
+ const nextCellAfterContainingSelection = containingSelection.end >= editor.getLength() ? undefined : editor.cellAt(containingSelection.end);
109
+ textModel.applyEdits(edits, true, { kind: SelectionStateType.Index, focus: editor.getFocus(), selections: editor.getSelections() }, () => {
110
+ if (nextCellAfterContainingSelection) {
111
+ const cellIndex = textModel.cells.findIndex(cell => cell.handle === nextCellAfterContainingSelection.handle);
112
+ return { kind: SelectionStateType.Index, focus: { start: cellIndex, end: cellIndex + 1 }, selections: [{ start: cellIndex, end: cellIndex + 1 }] };
113
+ }
114
+ else {
115
+ if (textModel.length) {
116
+ const lastCellIndex = textModel.length - 1;
117
+ return { kind: SelectionStateType.Index, focus: { start: lastCellIndex, end: lastCellIndex + 1 }, selections: [{ start: lastCellIndex, end: lastCellIndex + 1 }] };
118
+ }
119
+ else {
120
+ return { kind: SelectionStateType.Index, focus: { start: 0, end: 0 }, selections: [{ start: 0, end: 0 }] };
121
+ }
122
+ }
123
+ }, undefined, computeUndoRedo);
124
+ }
125
+ else {
126
+ const focus = editor.getFocus();
127
+ const edits = [{
128
+ editType: 1 , index: targetCellIndex, count: 1, cells: []
129
+ }];
130
+ const finalSelections = [];
131
+ for (let i = 0; i < selections.length; i++) {
132
+ const selection = selections[i];
133
+ if (selection.end <= targetCellIndex) {
134
+ finalSelections.push(selection);
135
+ }
136
+ else if (selection.start > targetCellIndex) {
137
+ finalSelections.push({ start: selection.start - 1, end: selection.end - 1 });
138
+ }
139
+ else {
140
+ finalSelections.push({ start: targetCellIndex, end: targetCellIndex + 1 });
141
+ }
142
+ }
143
+ if (editor.cellAt(focus.start) === cell) {
144
+ const newFocus = focus.end === textModel.length ? { start: focus.start - 1, end: focus.end - 1 } : focus;
145
+ textModel.applyEdits(edits, true, { kind: SelectionStateType.Index, focus: editor.getFocus(), selections: editor.getSelections() }, () => ({
146
+ kind: SelectionStateType.Index, focus: newFocus, selections: finalSelections
147
+ }), undefined, computeUndoRedo);
148
+ }
149
+ else {
150
+ const newFocus = focus.start > targetCellIndex ? { start: focus.start - 1, end: focus.end - 1 } : focus;
151
+ textModel.applyEdits(edits, true, { kind: SelectionStateType.Index, focus: editor.getFocus(), selections: editor.getSelections() }, () => ({
152
+ kind: SelectionStateType.Index, focus: newFocus, selections: finalSelections
153
+ }), undefined, computeUndoRedo);
154
+ }
155
+ }
156
+ }
157
+ async function moveCellRange(context, direction) {
158
+ if (!context.notebookEditor.hasModel()) {
159
+ return;
160
+ }
161
+ const editor = context.notebookEditor;
162
+ const textModel = editor.textModel;
163
+ if (editor.isReadOnly) {
164
+ return;
165
+ }
166
+ const selections = editor.getSelections();
167
+ const modelRanges = expandCellRangesWithHiddenCells(editor, selections);
168
+ const range = modelRanges[0];
169
+ if (!range || range.start === range.end) {
170
+ return;
171
+ }
172
+ if (direction === 'up') {
173
+ if (range.start === 0) {
174
+ return;
175
+ }
176
+ const indexAbove = range.start - 1;
177
+ const finalSelection = { start: range.start - 1, end: range.end - 1 };
178
+ const focus = context.notebookEditor.getFocus();
179
+ const newFocus = cellRangeContains(range, focus) ? { start: focus.start - 1, end: focus.end - 1 } : { start: range.start - 1, end: range.start };
180
+ textModel.applyEdits([
181
+ {
182
+ editType: 6 ,
183
+ index: indexAbove,
184
+ length: 1,
185
+ newIdx: range.end - 1
186
+ }
187
+ ], true, {
188
+ kind: SelectionStateType.Index,
189
+ focus: editor.getFocus(),
190
+ selections: editor.getSelections()
191
+ }, () => ({ kind: SelectionStateType.Index, focus: newFocus, selections: [finalSelection] }), undefined, true);
192
+ const focusRange = editor.getSelections()[0] ?? editor.getFocus();
193
+ editor.revealCellRangeInView(focusRange);
194
+ }
195
+ else {
196
+ if (range.end >= textModel.length) {
197
+ return;
198
+ }
199
+ const indexBelow = range.end;
200
+ const finalSelection = { start: range.start + 1, end: range.end + 1 };
201
+ const focus = editor.getFocus();
202
+ const newFocus = cellRangeContains(range, focus) ? { start: focus.start + 1, end: focus.end + 1 } : { start: range.start + 1, end: range.start + 2 };
203
+ textModel.applyEdits([
204
+ {
205
+ editType: 6 ,
206
+ index: indexBelow,
207
+ length: 1,
208
+ newIdx: range.start
209
+ }
210
+ ], true, {
211
+ kind: SelectionStateType.Index,
212
+ focus: editor.getFocus(),
213
+ selections: editor.getSelections()
214
+ }, () => ({ kind: SelectionStateType.Index, focus: newFocus, selections: [finalSelection] }), undefined, true);
215
+ const focusRange = editor.getSelections()[0] ?? editor.getFocus();
216
+ editor.revealCellRangeInView(focusRange);
217
+ }
218
+ }
219
+ async function copyCellRange(context, direction) {
220
+ const editor = context.notebookEditor;
221
+ if (!editor.hasModel()) {
222
+ return;
223
+ }
224
+ const textModel = editor.textModel;
225
+ if (editor.isReadOnly) {
226
+ return;
227
+ }
228
+ let range = undefined;
229
+ if (context.ui) {
230
+ const targetCell = context.cell;
231
+ const targetCellIndex = editor.getCellIndex(targetCell);
232
+ range = { start: targetCellIndex, end: targetCellIndex + 1 };
233
+ }
234
+ else {
235
+ const selections = editor.getSelections();
236
+ const modelRanges = expandCellRangesWithHiddenCells(editor, selections);
237
+ range = modelRanges[0];
238
+ }
239
+ if (!range || range.start === range.end) {
240
+ return;
241
+ }
242
+ if (direction === 'up') {
243
+ const focus = editor.getFocus();
244
+ const selections = editor.getSelections();
245
+ textModel.applyEdits([
246
+ {
247
+ editType: 1 ,
248
+ index: range.end,
249
+ count: 0,
250
+ cells: ( cellRangesToIndexes([range]).map(index => cloneNotebookCellTextModel(editor.cellAt(index).model)))
251
+ }
252
+ ], true, {
253
+ kind: SelectionStateType.Index,
254
+ focus: focus,
255
+ selections: selections
256
+ }, () => ({ kind: SelectionStateType.Index, focus: focus, selections: selections }), undefined, true);
257
+ }
258
+ else {
259
+ const focus = editor.getFocus();
260
+ const selections = editor.getSelections();
261
+ const newCells = ( cellRangesToIndexes([range]).map(index => cloneNotebookCellTextModel(editor.cellAt(index).model)));
262
+ const countDelta = newCells.length;
263
+ const newFocus = context.ui ? focus : { start: focus.start + countDelta, end: focus.end + countDelta };
264
+ const newSelections = context.ui ? selections : [{ start: range.start + countDelta, end: range.end + countDelta }];
265
+ textModel.applyEdits([
266
+ {
267
+ editType: 1 ,
268
+ index: range.end,
269
+ count: 0,
270
+ cells: ( cellRangesToIndexes([range]).map(index => cloneNotebookCellTextModel(editor.cellAt(index).model)))
271
+ }
272
+ ], true, {
273
+ kind: SelectionStateType.Index,
274
+ focus: focus,
275
+ selections: selections
276
+ }, () => ({ kind: SelectionStateType.Index, focus: newFocus, selections: newSelections }), undefined, true);
277
+ const focusRange = editor.getSelections()[0] ?? editor.getFocus();
278
+ editor.revealCellRangeInView(focusRange);
279
+ }
280
+ }
281
+ async function joinSelectedCells(bulkEditService, notificationService, context) {
282
+ const editor = context.notebookEditor;
283
+ if (editor.isReadOnly) {
284
+ return;
285
+ }
286
+ const edits = [];
287
+ const cells = [];
288
+ for (const selection of editor.getSelections()) {
289
+ cells.push(...editor.getCellsInRange(selection));
290
+ }
291
+ if (cells.length <= 1) {
292
+ return;
293
+ }
294
+ const cellKind = cells[0].cellKind;
295
+ const isSameKind = cells.every(cell => cell.cellKind === cellKind);
296
+ if (!isSameKind) {
297
+ const message = ( localizeWithPath(
298
+ 'vs/workbench/contrib/notebook/browser/controller/cellOperations',
299
+ 'notebookActions.joinSelectedCells',
300
+ "Cannot join cells of different kinds"
301
+ ));
302
+ return notificationService.warn(message);
303
+ }
304
+ const firstCell = cells[0];
305
+ const insertContent = ( cells.map(cell => cell.getText())).join(firstCell.textBuffer.getEOL());
306
+ const firstSelection = editor.getSelections()[0];
307
+ edits.push(( new ResourceNotebookCellEdit(editor.textModel.uri, {
308
+ editType: 1 ,
309
+ index: firstSelection.start,
310
+ count: firstSelection.end - firstSelection.start,
311
+ cells: [{
312
+ cellKind: firstCell.cellKind,
313
+ source: insertContent,
314
+ language: firstCell.language,
315
+ mime: firstCell.mime,
316
+ outputs: firstCell.model.outputs,
317
+ metadata: firstCell.metadata,
318
+ }]
319
+ })));
320
+ for (const selection of editor.getSelections().slice(1)) {
321
+ edits.push(( new ResourceNotebookCellEdit(editor.textModel.uri, {
322
+ editType: 1 ,
323
+ index: selection.start,
324
+ count: selection.end - selection.start,
325
+ cells: []
326
+ })));
327
+ }
328
+ if (edits.length) {
329
+ await bulkEditService.apply(edits, { quotableLabel: ( localizeWithPath(
330
+ 'vs/workbench/contrib/notebook/browser/controller/cellOperations',
331
+ 'notebookActions.joinSelectedCells.label',
332
+ "Join Notebook Cells"
333
+ )) });
334
+ }
335
+ }
336
+ async function joinNotebookCells(editor, range, direction, constraint) {
337
+ if (editor.isReadOnly) {
338
+ return null;
339
+ }
340
+ const textModel = editor.textModel;
341
+ const cells = editor.getCellsInRange(range);
342
+ if (!cells.length) {
343
+ return null;
344
+ }
345
+ if (range.start === 0 && direction === 'above') {
346
+ return null;
347
+ }
348
+ if (range.end === textModel.length && direction === 'below') {
349
+ return null;
350
+ }
351
+ for (let i = 0; i < cells.length; i++) {
352
+ const cell = cells[i];
353
+ if (constraint && cell.cellKind !== constraint) {
354
+ return null;
355
+ }
356
+ }
357
+ if (direction === 'above') {
358
+ const above = editor.cellAt(range.start - 1);
359
+ if (constraint && above.cellKind !== constraint) {
360
+ return null;
361
+ }
362
+ const insertContent = ( cells.map(cell => (cell.textBuffer.getEOL() ?? '') + cell.getText())).join('');
363
+ const aboveCellLineCount = above.textBuffer.getLineCount();
364
+ const aboveCellLastLineEndColumn = above.textBuffer.getLineLength(aboveCellLineCount);
365
+ return {
366
+ edits: [
367
+ ( new ResourceTextEdit(above.uri, { range: ( new Range(
368
+ aboveCellLineCount,
369
+ aboveCellLastLineEndColumn + 1,
370
+ aboveCellLineCount,
371
+ aboveCellLastLineEndColumn + 1
372
+ )), text: insertContent })),
373
+ ( new ResourceNotebookCellEdit(textModel.uri, {
374
+ editType: 1 ,
375
+ index: range.start,
376
+ count: range.end - range.start,
377
+ cells: []
378
+ }))
379
+ ],
380
+ cell: above,
381
+ endFocus: { start: range.start - 1, end: range.start },
382
+ endSelections: [{ start: range.start - 1, end: range.start }]
383
+ };
384
+ }
385
+ else {
386
+ const below = editor.cellAt(range.end);
387
+ if (constraint && below.cellKind !== constraint) {
388
+ return null;
389
+ }
390
+ const cell = cells[0];
391
+ const restCells = [...cells.slice(1), below];
392
+ const insertContent = ( restCells.map(cl => (cl.textBuffer.getEOL() ?? '') + cl.getText())).join('');
393
+ const cellLineCount = cell.textBuffer.getLineCount();
394
+ const cellLastLineEndColumn = cell.textBuffer.getLineLength(cellLineCount);
395
+ return {
396
+ edits: [
397
+ ( new ResourceTextEdit(cell.uri, { range: ( new Range(
398
+ cellLineCount,
399
+ cellLastLineEndColumn + 1,
400
+ cellLineCount,
401
+ cellLastLineEndColumn + 1
402
+ )), text: insertContent })),
403
+ ( new ResourceNotebookCellEdit(textModel.uri, {
404
+ editType: 1 ,
405
+ index: range.start + 1,
406
+ count: range.end - range.start,
407
+ cells: []
408
+ }))
409
+ ],
410
+ cell,
411
+ endFocus: { start: range.start, end: range.start + 1 },
412
+ endSelections: [{ start: range.start, end: range.start + 1 }]
413
+ };
414
+ }
415
+ }
416
+ async function joinCellsWithSurrounds(bulkEditService, context, direction) {
417
+ const editor = context.notebookEditor;
418
+ const textModel = editor.textModel;
419
+ const viewModel = editor.getViewModel();
420
+ let ret = null;
421
+ if (context.ui) {
422
+ const focusMode = context.cell.focusMode;
423
+ const cellIndex = editor.getCellIndex(context.cell);
424
+ ret = await joinNotebookCells(editor, { start: cellIndex, end: cellIndex + 1 }, direction);
425
+ if (!ret) {
426
+ return;
427
+ }
428
+ await bulkEditService.apply(ret?.edits, { quotableLabel: 'Join Notebook Cells' });
429
+ viewModel.updateSelectionsState({ kind: SelectionStateType.Index, focus: ret.endFocus, selections: ret.endSelections });
430
+ ret.cell.updateEditState(CellEditState.Editing, 'joinCellsWithSurrounds');
431
+ editor.revealCellRangeInView(editor.getFocus());
432
+ if (focusMode === CellFocusMode.Editor) {
433
+ ret.cell.focusMode = CellFocusMode.Editor;
434
+ }
435
+ }
436
+ else {
437
+ const selections = editor.getSelections();
438
+ if (!selections.length) {
439
+ return;
440
+ }
441
+ const focus = editor.getFocus();
442
+ const focusMode = editor.cellAt(focus.start)?.focusMode;
443
+ const edits = [];
444
+ let cell = null;
445
+ const cells = [];
446
+ for (let i = selections.length - 1; i >= 0; i--) {
447
+ const selection = selections[i];
448
+ const containFocus = cellRangeContains(selection, focus);
449
+ if (selection.end >= textModel.length && direction === 'below'
450
+ || selection.start === 0 && direction === 'above') {
451
+ if (containFocus) {
452
+ cell = editor.cellAt(focus.start);
453
+ }
454
+ cells.push(...editor.getCellsInRange(selection));
455
+ continue;
456
+ }
457
+ const singleRet = await joinNotebookCells(editor, selection, direction);
458
+ if (!singleRet) {
459
+ return;
460
+ }
461
+ edits.push(...singleRet.edits);
462
+ cells.push(singleRet.cell);
463
+ if (containFocus) {
464
+ cell = singleRet.cell;
465
+ }
466
+ }
467
+ if (!edits.length) {
468
+ return;
469
+ }
470
+ if (!cell || !cells.length) {
471
+ return;
472
+ }
473
+ await bulkEditService.apply(edits, { quotableLabel: 'Join Notebook Cells' });
474
+ cells.forEach(cell => {
475
+ cell.updateEditState(CellEditState.Editing, 'joinCellsWithSurrounds');
476
+ });
477
+ viewModel.updateSelectionsState({ kind: SelectionStateType.Handle, primary: cell.handle, selections: ( cells.map(cell => cell.handle)) });
478
+ editor.revealCellRangeInView(editor.getFocus());
479
+ const newFocusedCell = editor.cellAt(editor.getFocus().start);
480
+ if (focusMode === CellFocusMode.Editor && newFocusedCell) {
481
+ newFocusedCell.focusMode = CellFocusMode.Editor;
482
+ }
483
+ }
484
+ }
485
+ function _splitPointsToBoundaries(splitPoints, textBuffer) {
486
+ const boundaries = [];
487
+ const lineCnt = textBuffer.getLineCount();
488
+ const getLineLen = (lineNumber) => {
489
+ return textBuffer.getLineLength(lineNumber);
490
+ };
491
+ splitPoints = splitPoints.sort((l, r) => {
492
+ const lineDiff = l.lineNumber - r.lineNumber;
493
+ const columnDiff = l.column - r.column;
494
+ return lineDiff !== 0 ? lineDiff : columnDiff;
495
+ });
496
+ for (let sp of splitPoints) {
497
+ if (getLineLen(sp.lineNumber) + 1 === sp.column && sp.column !== 1 && sp.lineNumber < lineCnt) {
498
+ sp = ( new Position(sp.lineNumber + 1, 1));
499
+ }
500
+ _pushIfAbsent(boundaries, sp);
501
+ }
502
+ if (boundaries.length === 0) {
503
+ return null;
504
+ }
505
+ const modelStart = ( new Position(1, 1));
506
+ const modelEnd = ( new Position(lineCnt, getLineLen(lineCnt) + 1));
507
+ return [modelStart, ...boundaries, modelEnd];
508
+ }
509
+ function _pushIfAbsent(positions, p) {
510
+ const last = positions.length > 0 ? positions[positions.length - 1] : undefined;
511
+ if (!last || last.lineNumber !== p.lineNumber || last.column !== p.column) {
512
+ positions.push(p);
513
+ }
514
+ }
515
+ function computeCellLinesContents(cell, splitPoints) {
516
+ const rangeBoundaries = _splitPointsToBoundaries(splitPoints, cell.textBuffer);
517
+ if (!rangeBoundaries) {
518
+ return null;
519
+ }
520
+ const newLineModels = [];
521
+ for (let i = 1; i < rangeBoundaries.length; i++) {
522
+ const start = rangeBoundaries[i - 1];
523
+ const end = rangeBoundaries[i];
524
+ newLineModels.push(cell.textBuffer.getValueInRange(( new Range(start.lineNumber, start.column, end.lineNumber, end.column)), 0 ));
525
+ }
526
+ return newLineModels;
527
+ }
528
+ function insertCell(languageService, editor, index, type, direction = 'above', initialText = '', ui = false) {
529
+ const viewModel = editor.getViewModel();
530
+ const activeKernel = editor.activeKernel;
531
+ if (viewModel.options.isReadOnly) {
532
+ return null;
533
+ }
534
+ const cell = editor.cellAt(index);
535
+ const nextIndex = ui ? viewModel.getNextVisibleCellIndex(index) : index + 1;
536
+ let language;
537
+ if (type === CellKind.Code) {
538
+ const supportedLanguages = activeKernel?.supportedLanguages ?? languageService.getRegisteredLanguageIds();
539
+ const defaultLanguage = supportedLanguages[0] || PLAINTEXT_LANGUAGE_ID;
540
+ if (cell?.cellKind === CellKind.Code) {
541
+ language = cell.language;
542
+ }
543
+ else if (cell?.cellKind === CellKind.Markup) {
544
+ const nearestCodeCellIndex = viewModel.nearestCodeCellIndex(index);
545
+ if (nearestCodeCellIndex > -1) {
546
+ language = viewModel.cellAt(nearestCodeCellIndex).language;
547
+ }
548
+ else {
549
+ language = defaultLanguage;
550
+ }
551
+ }
552
+ else {
553
+ if (cell === undefined && direction === 'above') {
554
+ language = viewModel.viewCells.find(cell => cell.cellKind === CellKind.Code)?.language || defaultLanguage;
555
+ }
556
+ else {
557
+ language = defaultLanguage;
558
+ }
559
+ }
560
+ if (!supportedLanguages.includes(language)) {
561
+ language = defaultLanguage;
562
+ }
563
+ }
564
+ else {
565
+ language = 'markdown';
566
+ }
567
+ const insertIndex = cell ?
568
+ (direction === 'above' ? index : nextIndex) :
569
+ index;
570
+ return insertCellAtIndex(viewModel, insertIndex, initialText, language, type, undefined, [], true, true);
571
+ }
572
+ function insertCellAtIndex(viewModel, index, source, language, type, metadata, outputs, synchronous, pushUndoStop) {
573
+ const endSelections = { kind: SelectionStateType.Index, focus: { start: index, end: index + 1 }, selections: [{ start: index, end: index + 1 }] };
574
+ viewModel.notebookDocument.applyEdits([
575
+ {
576
+ editType: 1 ,
577
+ index,
578
+ count: 0,
579
+ cells: [
580
+ {
581
+ cellKind: type,
582
+ language: language,
583
+ mime: undefined,
584
+ outputs: outputs,
585
+ metadata: metadata,
586
+ source: source
587
+ }
588
+ ]
589
+ }
590
+ ], synchronous, { kind: SelectionStateType.Index, focus: viewModel.getFocus(), selections: viewModel.getSelections() }, () => endSelections, undefined, pushUndoStop && !viewModel.options.isReadOnly);
591
+ return viewModel.cellAt(index);
592
+ }
593
+ export { changeCellToKind, computeCellLinesContents, copyCellRange, insertCell, insertCellAtIndex, joinCellsWithSurrounds, joinNotebookCells, joinSelectedCells, moveCellRange, runDeleteAction };
@@ -0,0 +1,72 @@
1
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
2
+ import { registerAction2, Action2, MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
3
+ import { IClipboardService } from 'monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js';
4
+ import { NOTEBOOK_ACTIONS_CATEGORY } from './coreActions.js';
5
+ import { NOTEBOOK_CELL_HAS_OUTPUTS } from '../../common/notebookContextKeys.js';
6
+ import { copyIcon } from '../notebookIcons.js';
7
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
8
+ import { copyCellOutput } from '../contrib/clipboard/cellOutputClipboard.js';
9
+ import { IEditorService } from '../../../../services/editor/common/editorService.js';
10
+ import { getNotebookEditorFromEditorPane } from '../notebookBrowser.js';
11
+ import { CellKind } from '../../common/notebookCommon.js';
12
+ const COPY_OUTPUT_COMMAND_ID = 'notebook.cellOutput.copy';
13
+ registerAction2(class CopyCellOutputAction extends Action2 {
14
+ constructor() {
15
+ super({
16
+ id: COPY_OUTPUT_COMMAND_ID,
17
+ title: ( localizeWithPath(
18
+ 'vs/workbench/contrib/notebook/browser/controller/cellOutputActions',
19
+ 'notebookActions.copyOutput',
20
+ "Copy Output"
21
+ )),
22
+ menu: {
23
+ id: MenuId.NotebookOutputToolbar,
24
+ when: NOTEBOOK_CELL_HAS_OUTPUTS
25
+ },
26
+ category: NOTEBOOK_ACTIONS_CATEGORY,
27
+ icon: copyIcon,
28
+ });
29
+ }
30
+ async run(accessor, outputContext) {
31
+ const editorService = accessor.get(IEditorService);
32
+ const notebookEditor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
33
+ if (!notebookEditor) {
34
+ return;
35
+ }
36
+ let outputViewModel;
37
+ if ('outputId' in outputContext && typeof outputContext.outputId === 'string') {
38
+ outputViewModel = getOutputViewModelFromId(outputContext.outputId, notebookEditor);
39
+ }
40
+ else {
41
+ outputViewModel = outputContext.outputViewModel;
42
+ }
43
+ if (!outputViewModel) {
44
+ return;
45
+ }
46
+ const mimeType = outputViewModel.pickedMimeType?.mimeType;
47
+ if (mimeType?.startsWith('image/')) {
48
+ const focusOptions = { skipReveal: true, outputId: outputViewModel.model.outputId, altOutputId: outputViewModel.model.alternativeOutputId };
49
+ await notebookEditor.focusNotebookCell(outputViewModel.cellViewModel, 'output', focusOptions);
50
+ notebookEditor.copyOutputImage(outputViewModel);
51
+ }
52
+ else {
53
+ const clipboardService = accessor.get(IClipboardService);
54
+ const logService = accessor.get(ILogService);
55
+ copyCellOutput(mimeType, outputViewModel, clipboardService, logService);
56
+ }
57
+ }
58
+ });
59
+ function getOutputViewModelFromId(outputId, notebookEditor) {
60
+ const notebookViewModel = notebookEditor.getViewModel();
61
+ if (notebookViewModel) {
62
+ const codeCells = notebookViewModel.viewCells.filter(cell => cell.cellKind === CellKind.Code);
63
+ for (const cell of codeCells) {
64
+ const output = cell.outputsViewModels.find(output => output.model.outputId === outputId);
65
+ if (output) {
66
+ return output;
67
+ }
68
+ }
69
+ }
70
+ return undefined;
71
+ }
72
+ export { COPY_OUTPUT_COMMAND_ID };