@codingame/monaco-vscode-katex-common 24.1.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 (262) hide show
  1. package/empty.js +1 -0
  2. package/package.json +45 -0
  3. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +37 -0
  4. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +127 -0
  5. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +27 -0
  6. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +81 -0
  7. package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +44 -0
  8. package/vscode/src/vs/platform/actions/browser/buttonbar.js +172 -0
  9. package/vscode/src/vs/platform/editor/browser/editor.d.ts +12 -0
  10. package/vscode/src/vs/platform/editor/browser/editor.js +51 -0
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +41 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +295 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.d.ts +2 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +60 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +65 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +650 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +2 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +364 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +38 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +207 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.d.ts +17 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.js +216 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.d.ts +24 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.js +114 -0
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.d.ts +34 -0
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.js +141 -0
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.d.ts +169 -0
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.js +951 -0
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.d.ts +19 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.js +109 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.d.ts +12 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.js +47 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.d.ts +13 -0
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.js +49 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.d.ts +27 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.js +160 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.d.ts +40 -0
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.js +286 -0
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.d.ts +13 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.js +49 -0
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.d.ts +34 -0
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.js +101 -0
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.d.ts +14 -0
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.js +30 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.d.ts +11 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.js +37 -0
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.d.ts +17 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.js +69 -0
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.d.ts +116 -0
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.js +417 -0
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.d.ts +20 -0
  52. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.js +66 -0
  53. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.d.ts +25 -0
  54. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.js +123 -0
  55. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.d.ts +18 -0
  56. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.js +60 -0
  57. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.d.ts +16 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.js +46 -0
  59. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.d.ts +19 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.js +57 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.d.ts +94 -0
  62. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.js +567 -0
  63. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.d.ts +34 -0
  64. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.js +224 -0
  65. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.d.ts +34 -0
  66. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.js +259 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.d.ts +38 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.js +160 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.d.ts +16 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.js +55 -0
  71. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.d.ts +17 -0
  72. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.js +117 -0
  73. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.d.ts +66 -0
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.js +528 -0
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.d.ts +31 -0
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.js +160 -0
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.d.ts +17 -0
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.js +49 -0
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.d.ts +18 -0
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.js +91 -0
  81. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.d.ts +13 -0
  82. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.js +6 -0
  83. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.d.ts +54 -0
  84. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.js +429 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.d.ts +40 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.js +347 -0
  87. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.d.ts +56 -0
  88. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.js +164 -0
  89. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.d.ts +32 -0
  90. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.js +224 -0
  91. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.d.ts +35 -0
  92. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.js +173 -0
  93. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatConfirmationWidget.css +341 -0
  94. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatExtensionsContent.css +27 -0
  95. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMarkdownPart.css +23 -0
  96. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMcpServersInteractionContent.css +14 -0
  97. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatPullRequestContent.css +75 -0
  98. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css +221 -0
  99. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatThinkingContent.css +162 -0
  100. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +41 -0
  101. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +94 -0
  102. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +15 -0
  103. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +96 -0
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +18 -0
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +147 -0
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +14 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.js +23 -0
  108. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +68 -0
  109. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +353 -0
  110. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +100 -0
  111. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +1085 -0
  112. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +39 -0
  113. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +275 -0
  114. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +32 -0
  115. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +119 -0
  116. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +19 -0
  117. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +36 -0
  118. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +21 -0
  119. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.js +130 -0
  120. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +25 -0
  121. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +225 -0
  122. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +24 -0
  123. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.js +101 -0
  124. package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.d.ts +42 -0
  125. package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.js +127 -0
  126. package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.d.ts +43 -0
  127. package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.js +388 -0
  128. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +49 -0
  129. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +721 -0
  130. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.d.ts +13 -0
  131. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +52 -0
  132. package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.d.ts +39 -0
  133. package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.js +409 -0
  134. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.d.ts +334 -0
  135. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +2008 -0
  136. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.d.ts +52 -0
  137. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.js +93 -0
  138. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.d.ts +217 -0
  139. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1573 -0
  140. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.d.ts +43 -0
  141. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +249 -0
  142. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.d.ts +50 -0
  143. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +84 -0
  144. package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.d.ts +32 -0
  145. package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.js +174 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +31 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +101 -0
  148. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +19 -0
  149. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +76 -0
  150. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionAction.css +39 -0
  151. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.d.ts +292 -0
  152. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +2014 -0
  153. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css +171 -0
  154. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.d.ts +173 -0
  155. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +797 -0
  156. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.d.ts +54 -0
  157. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.js +345 -0
  158. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.d.ts +10 -0
  159. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +1069 -0
  160. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +34 -0
  161. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +139 -0
  162. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css +2880 -0
  163. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatAgentHover.css +87 -0
  164. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatCodeBlockPill.css +139 -0
  165. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatInlineAnchorWidget.css +61 -0
  166. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewWelcome.css +209 -0
  167. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.d.ts +28 -0
  168. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.js +135 -0
  169. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.d.ts +28 -0
  170. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.js +147 -0
  171. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +71 -0
  172. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +279 -0
  173. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.d.ts +28 -0
  174. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +28 -0
  175. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.d.ts +13 -0
  176. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +38 -0
  177. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +55 -0
  178. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +176 -0
  179. package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.d.ts +45 -0
  180. package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.js +207 -0
  181. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +48 -0
  182. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +373 -0
  183. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +171 -0
  184. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +1442 -0
  185. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +199 -0
  186. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +482 -0
  187. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +28 -0
  188. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +37 -0
  189. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +95 -0
  190. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +497 -0
  191. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +76 -0
  192. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +464 -0
  193. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +124 -0
  194. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +562 -0
  195. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +42 -0
  196. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +279 -0
  197. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +411 -0
  198. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +13 -0
  199. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +66 -0
  200. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +61 -0
  201. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +154 -0
  202. package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.d.ts +19 -0
  203. package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +201 -0
  204. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +41 -0
  205. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +372 -0
  206. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +4 -0
  207. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +58 -0
  208. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
  209. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +594 -0
  210. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
  211. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
  212. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
  213. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1746 -0
  214. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
  215. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +269 -0
  216. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
  217. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +806 -0
  218. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
  219. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +116 -0
  220. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
  221. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +62 -0
  222. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
  223. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
  224. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
  225. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +295 -0
  226. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
  227. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +241 -0
  228. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
  229. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +146 -0
  230. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
  231. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +90 -0
  232. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
  233. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +41 -0
  234. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
  235. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +42 -0
  236. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
  237. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +77 -0
  238. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
  239. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
  240. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +823 -0
  241. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
  242. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +29 -0
  243. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
  244. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +567 -0
  245. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
  246. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +189 -0
  247. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
  248. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +439 -0
  249. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
  250. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +263 -0
  251. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
  252. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +48 -0
  253. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
  254. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
  255. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
  256. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +89 -0
  257. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
  258. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
  259. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
  260. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +108 -0
  261. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +34 -0
  262. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +145 -0
@@ -0,0 +1,594 @@
1
+
2
+ import { ResourceTextEdit } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService';
3
+ import { Position } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/position';
4
+ import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
5
+ import { EndOfLinePreference } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
6
+ import { PLAINTEXT_LANGUAGE_ID } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/modesRegistry';
7
+ import { ResourceNotebookCellEdit } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
8
+ import { CellEditState, expandCellRangesWithHiddenCells, CellFocusMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
9
+ import { cloneNotebookCellTextModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
10
+ import { CellEditType, SelectionStateType, CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
11
+ import { cellRangeContains, cellRangesToIndexes } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookRange';
12
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
13
+
14
+ async function changeCellToKind(kind, context, language, mime) {
15
+ const { notebookEditor } = context;
16
+ if (!notebookEditor.hasModel()) {
17
+ return;
18
+ }
19
+ if (notebookEditor.isReadOnly) {
20
+ return;
21
+ }
22
+ if (context.ui && context.cell) {
23
+ const { cell } = context;
24
+ if (cell.cellKind === kind) {
25
+ return;
26
+ }
27
+ const text = cell.getText();
28
+ const idx = notebookEditor.getCellIndex(cell);
29
+ if (language === undefined) {
30
+ const availableLanguages = notebookEditor.activeKernel?.supportedLanguages ?? [];
31
+ language = availableLanguages[0] ?? PLAINTEXT_LANGUAGE_ID;
32
+ }
33
+ notebookEditor.textModel.applyEdits([
34
+ {
35
+ editType: CellEditType.Replace,
36
+ index: idx,
37
+ count: 1,
38
+ cells: [{
39
+ cellKind: kind,
40
+ source: text,
41
+ language: language,
42
+ mime: mime ?? cell.mime,
43
+ outputs: cell.model.outputs,
44
+ metadata: cell.metadata,
45
+ }]
46
+ }
47
+ ], true, {
48
+ kind: SelectionStateType.Index,
49
+ focus: notebookEditor.getFocus(),
50
+ selections: notebookEditor.getSelections()
51
+ }, () => {
52
+ return {
53
+ kind: SelectionStateType.Index,
54
+ focus: notebookEditor.getFocus(),
55
+ selections: notebookEditor.getSelections()
56
+ };
57
+ }, undefined, true);
58
+ const newCell = notebookEditor.cellAt(idx);
59
+ await notebookEditor.focusNotebookCell(newCell, cell.getEditState() === CellEditState.Editing ? 'editor' : 'container');
60
+ }
61
+ else if (context.selectedCells) {
62
+ const selectedCells = context.selectedCells;
63
+ const rawEdits = [];
64
+ selectedCells.forEach(cell => {
65
+ if (cell.cellKind === kind) {
66
+ return;
67
+ }
68
+ const text = cell.getText();
69
+ const idx = notebookEditor.getCellIndex(cell);
70
+ if (language === undefined) {
71
+ const availableLanguages = notebookEditor.activeKernel?.supportedLanguages ?? [];
72
+ language = availableLanguages[0] ?? PLAINTEXT_LANGUAGE_ID;
73
+ }
74
+ rawEdits.push({
75
+ editType: CellEditType.Replace,
76
+ index: idx,
77
+ count: 1,
78
+ cells: [{
79
+ cellKind: kind,
80
+ source: text,
81
+ language: language,
82
+ mime: mime ?? cell.mime,
83
+ outputs: cell.model.outputs,
84
+ metadata: cell.metadata,
85
+ }]
86
+ });
87
+ });
88
+ notebookEditor.textModel.applyEdits(rawEdits, true, {
89
+ kind: SelectionStateType.Index,
90
+ focus: notebookEditor.getFocus(),
91
+ selections: notebookEditor.getSelections()
92
+ }, () => {
93
+ return {
94
+ kind: SelectionStateType.Index,
95
+ focus: notebookEditor.getFocus(),
96
+ selections: notebookEditor.getSelections()
97
+ };
98
+ }, undefined, true);
99
+ }
100
+ }
101
+ function runDeleteAction(editor, cell) {
102
+ const textModel = editor.textModel;
103
+ const selections = editor.getSelections();
104
+ const targetCellIndex = editor.getCellIndex(cell);
105
+ const containingSelection = selections.find(selection => selection.start <= targetCellIndex && targetCellIndex < selection.end);
106
+ const computeUndoRedo = !editor.isReadOnly || textModel.viewType === 'interactive';
107
+ if (containingSelection) {
108
+ const edits = ( selections.reverse().map(selection => ({
109
+ editType: CellEditType.Replace, index: selection.start, count: selection.end - selection.start, cells: []
110
+ })));
111
+ const nextCellAfterContainingSelection = containingSelection.end >= editor.getLength() ? undefined : editor.cellAt(containingSelection.end);
112
+ textModel.applyEdits(edits, true, { kind: SelectionStateType.Index, focus: editor.getFocus(), selections: editor.getSelections() }, () => {
113
+ if (nextCellAfterContainingSelection) {
114
+ const cellIndex = textModel.cells.findIndex(cell => cell.handle === nextCellAfterContainingSelection.handle);
115
+ return { kind: SelectionStateType.Index, focus: { start: cellIndex, end: cellIndex + 1 }, selections: [{ start: cellIndex, end: cellIndex + 1 }] };
116
+ }
117
+ else {
118
+ if (textModel.length) {
119
+ const lastCellIndex = textModel.length - 1;
120
+ return { kind: SelectionStateType.Index, focus: { start: lastCellIndex, end: lastCellIndex + 1 }, selections: [{ start: lastCellIndex, end: lastCellIndex + 1 }] };
121
+ }
122
+ else {
123
+ return { kind: SelectionStateType.Index, focus: { start: 0, end: 0 }, selections: [{ start: 0, end: 0 }] };
124
+ }
125
+ }
126
+ }, undefined, computeUndoRedo);
127
+ }
128
+ else {
129
+ const focus = editor.getFocus();
130
+ const edits = [{
131
+ editType: CellEditType.Replace, index: targetCellIndex, count: 1, cells: []
132
+ }];
133
+ const finalSelections = [];
134
+ for (let i = 0; i < selections.length; i++) {
135
+ const selection = selections[i];
136
+ if (selection.end <= targetCellIndex) {
137
+ finalSelections.push(selection);
138
+ }
139
+ else if (selection.start > targetCellIndex) {
140
+ finalSelections.push({ start: selection.start - 1, end: selection.end - 1 });
141
+ }
142
+ else {
143
+ finalSelections.push({ start: targetCellIndex, end: targetCellIndex + 1 });
144
+ }
145
+ }
146
+ if (editor.cellAt(focus.start) === cell) {
147
+ const newFocus = focus.end === textModel.length ? { start: focus.start - 1, end: focus.end - 1 } : focus;
148
+ textModel.applyEdits(edits, true, { kind: SelectionStateType.Index, focus: editor.getFocus(), selections: editor.getSelections() }, () => ({
149
+ kind: SelectionStateType.Index, focus: newFocus, selections: finalSelections
150
+ }), undefined, computeUndoRedo);
151
+ }
152
+ else {
153
+ const newFocus = focus.start > targetCellIndex ? { start: focus.start - 1, end: focus.end - 1 } : focus;
154
+ textModel.applyEdits(edits, true, { kind: SelectionStateType.Index, focus: editor.getFocus(), selections: editor.getSelections() }, () => ({
155
+ kind: SelectionStateType.Index, focus: newFocus, selections: finalSelections
156
+ }), undefined, computeUndoRedo);
157
+ }
158
+ }
159
+ }
160
+ async function moveCellRange(context, direction) {
161
+ if (!context.notebookEditor.hasModel()) {
162
+ return;
163
+ }
164
+ const editor = context.notebookEditor;
165
+ const textModel = editor.textModel;
166
+ if (editor.isReadOnly) {
167
+ return;
168
+ }
169
+ let range = undefined;
170
+ if (context.cell) {
171
+ const idx = editor.getCellIndex(context.cell);
172
+ range = { start: idx, end: idx + 1 };
173
+ }
174
+ else {
175
+ const selections = editor.getSelections();
176
+ const modelRanges = expandCellRangesWithHiddenCells(editor, selections);
177
+ range = modelRanges[0];
178
+ }
179
+ if (!range || range.start === range.end) {
180
+ return;
181
+ }
182
+ if (direction === 'up') {
183
+ if (range.start === 0) {
184
+ return;
185
+ }
186
+ const indexAbove = range.start - 1;
187
+ const finalSelection = { start: range.start - 1, end: range.end - 1 };
188
+ const focus = context.notebookEditor.getFocus();
189
+ const newFocus = cellRangeContains(range, focus) ? { start: focus.start - 1, end: focus.end - 1 } : { start: range.start - 1, end: range.start };
190
+ textModel.applyEdits([
191
+ {
192
+ editType: CellEditType.Move,
193
+ index: indexAbove,
194
+ length: 1,
195
+ newIdx: range.end - 1
196
+ }
197
+ ], true, {
198
+ kind: SelectionStateType.Index,
199
+ focus: editor.getFocus(),
200
+ selections: editor.getSelections()
201
+ }, () => ({ kind: SelectionStateType.Index, focus: newFocus, selections: [finalSelection] }), undefined, true);
202
+ const focusRange = editor.getSelections()[0] ?? editor.getFocus();
203
+ editor.revealCellRangeInView(focusRange);
204
+ }
205
+ else {
206
+ if (range.end >= textModel.length) {
207
+ return;
208
+ }
209
+ const indexBelow = range.end;
210
+ const finalSelection = { start: range.start + 1, end: range.end + 1 };
211
+ const focus = editor.getFocus();
212
+ const newFocus = cellRangeContains(range, focus) ? { start: focus.start + 1, end: focus.end + 1 } : { start: range.start + 1, end: range.start + 2 };
213
+ textModel.applyEdits([
214
+ {
215
+ editType: CellEditType.Move,
216
+ index: indexBelow,
217
+ length: 1,
218
+ newIdx: range.start
219
+ }
220
+ ], true, {
221
+ kind: SelectionStateType.Index,
222
+ focus: editor.getFocus(),
223
+ selections: editor.getSelections()
224
+ }, () => ({ kind: SelectionStateType.Index, focus: newFocus, selections: [finalSelection] }), undefined, true);
225
+ const focusRange = editor.getSelections()[0] ?? editor.getFocus();
226
+ editor.revealCellRangeInView(focusRange);
227
+ }
228
+ }
229
+ async function copyCellRange(context, direction) {
230
+ const editor = context.notebookEditor;
231
+ if (!editor.hasModel()) {
232
+ return;
233
+ }
234
+ const textModel = editor.textModel;
235
+ if (editor.isReadOnly) {
236
+ return;
237
+ }
238
+ let range = undefined;
239
+ if (context.ui) {
240
+ const targetCell = context.cell;
241
+ const targetCellIndex = editor.getCellIndex(targetCell);
242
+ range = { start: targetCellIndex, end: targetCellIndex + 1 };
243
+ }
244
+ else {
245
+ const selections = editor.getSelections();
246
+ const modelRanges = expandCellRangesWithHiddenCells(editor, selections);
247
+ range = modelRanges[0];
248
+ }
249
+ if (!range || range.start === range.end) {
250
+ return;
251
+ }
252
+ if (direction === 'up') {
253
+ const focus = editor.getFocus();
254
+ const selections = editor.getSelections();
255
+ textModel.applyEdits([
256
+ {
257
+ editType: CellEditType.Replace,
258
+ index: range.end,
259
+ count: 0,
260
+ cells: ( cellRangesToIndexes([range]).map(index => cloneNotebookCellTextModel(editor.cellAt(index).model)))
261
+ }
262
+ ], true, {
263
+ kind: SelectionStateType.Index,
264
+ focus: focus,
265
+ selections: selections
266
+ }, () => ({ kind: SelectionStateType.Index, focus: focus, selections: selections }), undefined, true);
267
+ }
268
+ else {
269
+ const focus = editor.getFocus();
270
+ const selections = editor.getSelections();
271
+ const newCells = ( cellRangesToIndexes([range]).map(index => cloneNotebookCellTextModel(editor.cellAt(index).model)));
272
+ const countDelta = newCells.length;
273
+ const newFocus = context.ui ? focus : { start: focus.start + countDelta, end: focus.end + countDelta };
274
+ const newSelections = context.ui ? selections : [{ start: range.start + countDelta, end: range.end + countDelta }];
275
+ textModel.applyEdits([
276
+ {
277
+ editType: CellEditType.Replace,
278
+ index: range.end,
279
+ count: 0,
280
+ cells: ( cellRangesToIndexes([range]).map(index => cloneNotebookCellTextModel(editor.cellAt(index).model)))
281
+ }
282
+ ], true, {
283
+ kind: SelectionStateType.Index,
284
+ focus: focus,
285
+ selections: selections
286
+ }, () => ({ kind: SelectionStateType.Index, focus: newFocus, selections: newSelections }), undefined, true);
287
+ const focusRange = editor.getSelections()[0] ?? editor.getFocus();
288
+ editor.revealCellRangeInView(focusRange);
289
+ }
290
+ }
291
+ async function joinSelectedCells(bulkEditService, notificationService, context) {
292
+ const editor = context.notebookEditor;
293
+ if (editor.isReadOnly) {
294
+ return;
295
+ }
296
+ const edits = [];
297
+ const cells = [];
298
+ for (const selection of editor.getSelections()) {
299
+ cells.push(...editor.getCellsInRange(selection));
300
+ }
301
+ if (cells.length <= 1) {
302
+ return;
303
+ }
304
+ const cellKind = cells[0].cellKind;
305
+ const isSameKind = cells.every(cell => cell.cellKind === cellKind);
306
+ if (!isSameKind) {
307
+ const message = ( localize(9323, "Cannot join cells of different kinds"));
308
+ return notificationService.warn(message);
309
+ }
310
+ const firstCell = cells[0];
311
+ const insertContent = ( cells.map(cell => cell.getText())).join(firstCell.textBuffer.getEOL());
312
+ const firstSelection = editor.getSelections()[0];
313
+ edits.push(( new ResourceNotebookCellEdit(editor.textModel.uri, {
314
+ editType: CellEditType.Replace,
315
+ index: firstSelection.start,
316
+ count: firstSelection.end - firstSelection.start,
317
+ cells: [{
318
+ cellKind: firstCell.cellKind,
319
+ source: insertContent,
320
+ language: firstCell.language,
321
+ mime: firstCell.mime,
322
+ outputs: firstCell.model.outputs,
323
+ metadata: firstCell.metadata,
324
+ }]
325
+ })));
326
+ for (const selection of editor.getSelections().slice(1)) {
327
+ edits.push(( new ResourceNotebookCellEdit(editor.textModel.uri, {
328
+ editType: CellEditType.Replace,
329
+ index: selection.start,
330
+ count: selection.end - selection.start,
331
+ cells: []
332
+ })));
333
+ }
334
+ if (edits.length) {
335
+ await bulkEditService.apply(edits, { quotableLabel: ( localize(9324, "Join Notebook Cells")) });
336
+ }
337
+ }
338
+ async function joinNotebookCells(editor, range, direction, constraint) {
339
+ if (editor.isReadOnly) {
340
+ return null;
341
+ }
342
+ const textModel = editor.textModel;
343
+ const cells = editor.getCellsInRange(range);
344
+ if (!cells.length) {
345
+ return null;
346
+ }
347
+ if (range.start === 0 && direction === 'above') {
348
+ return null;
349
+ }
350
+ if (range.end === textModel.length && direction === 'below') {
351
+ return null;
352
+ }
353
+ if (direction === 'above') {
354
+ const above = editor.cellAt(range.start - 1);
355
+ const insertContent = ( cells.map(cell => (cell.textBuffer.getEOL() ?? '') + cell.getText())).join('');
356
+ const aboveCellLineCount = above.textBuffer.getLineCount();
357
+ const aboveCellLastLineEndColumn = above.textBuffer.getLineLength(aboveCellLineCount);
358
+ return {
359
+ edits: [
360
+ ( new ResourceTextEdit(above.uri, { range: ( new Range(
361
+ aboveCellLineCount,
362
+ aboveCellLastLineEndColumn + 1,
363
+ aboveCellLineCount,
364
+ aboveCellLastLineEndColumn + 1
365
+ )), text: insertContent })),
366
+ ( new ResourceNotebookCellEdit(textModel.uri, {
367
+ editType: CellEditType.Replace,
368
+ index: range.start,
369
+ count: range.end - range.start,
370
+ cells: []
371
+ }))
372
+ ],
373
+ cell: above,
374
+ endFocus: { start: range.start - 1, end: range.start },
375
+ endSelections: [{ start: range.start - 1, end: range.start }]
376
+ };
377
+ }
378
+ else {
379
+ const below = editor.cellAt(range.end);
380
+ const cell = cells[0];
381
+ const restCells = [...cells.slice(1), below];
382
+ const insertContent = ( restCells.map(cl => (cl.textBuffer.getEOL() ?? '') + cl.getText())).join('');
383
+ const cellLineCount = cell.textBuffer.getLineCount();
384
+ const cellLastLineEndColumn = cell.textBuffer.getLineLength(cellLineCount);
385
+ return {
386
+ edits: [
387
+ ( new ResourceTextEdit(cell.uri, { range: ( new Range(
388
+ cellLineCount,
389
+ cellLastLineEndColumn + 1,
390
+ cellLineCount,
391
+ cellLastLineEndColumn + 1
392
+ )), text: insertContent })),
393
+ ( new ResourceNotebookCellEdit(textModel.uri, {
394
+ editType: CellEditType.Replace,
395
+ index: range.start + 1,
396
+ count: range.end - range.start,
397
+ cells: []
398
+ }))
399
+ ],
400
+ cell,
401
+ endFocus: { start: range.start, end: range.start + 1 },
402
+ endSelections: [{ start: range.start, end: range.start + 1 }]
403
+ };
404
+ }
405
+ }
406
+ async function joinCellsWithSurrounds(bulkEditService, context, direction) {
407
+ const editor = context.notebookEditor;
408
+ const textModel = editor.textModel;
409
+ const viewModel = editor.getViewModel();
410
+ let ret = null;
411
+ if (context.ui) {
412
+ const focusMode = context.cell.focusMode;
413
+ const cellIndex = editor.getCellIndex(context.cell);
414
+ ret = await joinNotebookCells(editor, { start: cellIndex, end: cellIndex + 1 }, direction);
415
+ if (!ret) {
416
+ return;
417
+ }
418
+ await bulkEditService.apply(ret?.edits, { quotableLabel: 'Join Notebook Cells' });
419
+ viewModel.updateSelectionsState({ kind: SelectionStateType.Index, focus: ret.endFocus, selections: ret.endSelections });
420
+ ret.cell.updateEditState(CellEditState.Editing, 'joinCellsWithSurrounds');
421
+ editor.revealCellRangeInView(editor.getFocus());
422
+ if (focusMode === CellFocusMode.Editor) {
423
+ ret.cell.focusMode = CellFocusMode.Editor;
424
+ }
425
+ }
426
+ else {
427
+ const selections = editor.getSelections();
428
+ if (!selections.length) {
429
+ return;
430
+ }
431
+ const focus = editor.getFocus();
432
+ const focusMode = editor.cellAt(focus.start)?.focusMode;
433
+ const edits = [];
434
+ let cell = null;
435
+ const cells = [];
436
+ for (let i = selections.length - 1; i >= 0; i--) {
437
+ const selection = selections[i];
438
+ const containFocus = cellRangeContains(selection, focus);
439
+ if (selection.end >= textModel.length && direction === 'below'
440
+ || selection.start === 0 && direction === 'above') {
441
+ if (containFocus) {
442
+ cell = editor.cellAt(focus.start);
443
+ }
444
+ cells.push(...editor.getCellsInRange(selection));
445
+ continue;
446
+ }
447
+ const singleRet = await joinNotebookCells(editor, selection, direction);
448
+ if (!singleRet) {
449
+ return;
450
+ }
451
+ edits.push(...singleRet.edits);
452
+ cells.push(singleRet.cell);
453
+ if (containFocus) {
454
+ cell = singleRet.cell;
455
+ }
456
+ }
457
+ if (!edits.length) {
458
+ return;
459
+ }
460
+ if (!cell || !cells.length) {
461
+ return;
462
+ }
463
+ await bulkEditService.apply(edits, { quotableLabel: 'Join Notebook Cells' });
464
+ cells.forEach(cell => {
465
+ cell.updateEditState(CellEditState.Editing, 'joinCellsWithSurrounds');
466
+ });
467
+ viewModel.updateSelectionsState({ kind: SelectionStateType.Handle, primary: cell.handle, selections: ( cells.map(cell => cell.handle)) });
468
+ editor.revealCellRangeInView(editor.getFocus());
469
+ const newFocusedCell = editor.cellAt(editor.getFocus().start);
470
+ if (focusMode === CellFocusMode.Editor && newFocusedCell) {
471
+ newFocusedCell.focusMode = CellFocusMode.Editor;
472
+ }
473
+ }
474
+ }
475
+ function _splitPointsToBoundaries(splitPoints, textBuffer) {
476
+ const boundaries = [];
477
+ const lineCnt = textBuffer.getLineCount();
478
+ const getLineLen = (lineNumber) => {
479
+ return textBuffer.getLineLength(lineNumber);
480
+ };
481
+ splitPoints = splitPoints.sort((l, r) => {
482
+ const lineDiff = l.lineNumber - r.lineNumber;
483
+ const columnDiff = l.column - r.column;
484
+ return lineDiff !== 0 ? lineDiff : columnDiff;
485
+ });
486
+ for (let sp of splitPoints) {
487
+ if (getLineLen(sp.lineNumber) + 1 === sp.column && sp.column !== 1 && sp.lineNumber < lineCnt) {
488
+ sp = ( new Position(sp.lineNumber + 1, 1));
489
+ }
490
+ _pushIfAbsent(boundaries, sp);
491
+ }
492
+ if (boundaries.length === 0) {
493
+ return null;
494
+ }
495
+ const modelStart = ( new Position(1, 1));
496
+ const modelEnd = ( new Position(lineCnt, getLineLen(lineCnt) + 1));
497
+ return [modelStart, ...boundaries, modelEnd];
498
+ }
499
+ function _pushIfAbsent(positions, p) {
500
+ const last = positions.length > 0 ? positions[positions.length - 1] : undefined;
501
+ if (!last || last.lineNumber !== p.lineNumber || last.column !== p.column) {
502
+ positions.push(p);
503
+ }
504
+ }
505
+ function computeCellLinesContents(cell, splitPoints) {
506
+ const rangeBoundaries = _splitPointsToBoundaries(splitPoints, cell.textBuffer);
507
+ if (!rangeBoundaries) {
508
+ return null;
509
+ }
510
+ const newLineModels = [];
511
+ for (let i = 1; i < rangeBoundaries.length; i++) {
512
+ const start = rangeBoundaries[i - 1];
513
+ const end = rangeBoundaries[i];
514
+ newLineModels.push(cell.textBuffer.getValueInRange(( new Range(start.lineNumber, start.column, end.lineNumber, end.column)), EndOfLinePreference.TextDefined));
515
+ }
516
+ return newLineModels;
517
+ }
518
+ function insertCell(languageService, editor, index, type, direction = 'above', initialText = '', ui = false, kernelHistoryService) {
519
+ const viewModel = editor.getViewModel();
520
+ const activeKernel = editor.activeKernel;
521
+ if (viewModel.options.isReadOnly) {
522
+ return null;
523
+ }
524
+ const cell = editor.cellAt(index);
525
+ const nextIndex = ui ? viewModel.getNextVisibleCellIndex(index) : index + 1;
526
+ let language;
527
+ if (type === CellKind.Code) {
528
+ const supportedLanguages = activeKernel?.supportedLanguages ?? languageService.getRegisteredLanguageIds();
529
+ const defaultLanguage = supportedLanguages[0] || PLAINTEXT_LANGUAGE_ID;
530
+ if (cell?.cellKind === CellKind.Code) {
531
+ language = cell.language;
532
+ }
533
+ else if (cell?.cellKind === CellKind.Markup) {
534
+ const nearestCodeCellIndex = viewModel.nearestCodeCellIndex(index);
535
+ if (nearestCodeCellIndex > -1) {
536
+ language = viewModel.cellAt(nearestCodeCellIndex).language;
537
+ }
538
+ else {
539
+ language = defaultLanguage;
540
+ }
541
+ }
542
+ else if (!cell && viewModel.length === 0) {
543
+ const lastKernels = kernelHistoryService?.getKernels(viewModel.notebookDocument);
544
+ if (lastKernels?.all.length) {
545
+ const lastKernel = lastKernels.all[0];
546
+ language = lastKernel.supportedLanguages[0] || defaultLanguage;
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);
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: CellEditType.Replace,
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, !viewModel.options.isReadOnly);
591
+ return viewModel.cellAt(index);
592
+ }
593
+
594
+ export { changeCellToKind, computeCellLinesContents, copyCellRange, insertCell, insertCellAtIndex, joinCellsWithSurrounds, joinNotebookCells, joinSelectedCells, moveCellRange, runDeleteAction };
@@ -0,0 +1,8 @@
1
+ import { IDiffEditorConstructionOptions } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
2
+ import { IEditorOptions } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/config/editorOptions";
3
+ export declare function getEditorPadding(lineCount: number): {
4
+ top: number;
5
+ bottom: number;
6
+ };
7
+ export declare const fixedEditorOptions: IEditorOptions;
8
+ export declare const fixedDiffEditorOptions: IDiffEditorConstructionOptions;
@@ -0,0 +1,55 @@
1
+
2
+
3
+ const fixedEditorPaddingSingleLineCells = {
4
+ top: 24,
5
+ bottom: 24
6
+ };
7
+ const fixedEditorPadding = {
8
+ top: 12,
9
+ bottom: 12
10
+ };
11
+ function getEditorPadding(lineCount) {
12
+ return lineCount === 1 ? fixedEditorPaddingSingleLineCells : fixedEditorPadding;
13
+ }
14
+ const fixedEditorOptions = {
15
+ padding: fixedEditorPadding,
16
+ scrollBeyondLastLine: false,
17
+ scrollbar: {
18
+ verticalScrollbarSize: 14,
19
+ horizontal: 'auto',
20
+ vertical: 'auto',
21
+ useShadows: true,
22
+ verticalHasArrows: false,
23
+ horizontalHasArrows: false,
24
+ alwaysConsumeMouseWheel: false,
25
+ },
26
+ renderLineHighlightOnlyWhenFocus: true,
27
+ overviewRulerLanes: 0,
28
+ overviewRulerBorder: false,
29
+ selectOnLineNumbers: false,
30
+ wordWrap: 'off',
31
+ lineNumbers: 'off',
32
+ glyphMargin: true,
33
+ fixedOverflowWidgets: true,
34
+ minimap: { enabled: false },
35
+ renderValidationDecorations: 'on',
36
+ renderLineHighlight: 'none',
37
+ readOnly: true
38
+ };
39
+ const fixedDiffEditorOptions = {
40
+ ...fixedEditorOptions,
41
+ glyphMargin: true,
42
+ enableSplitViewResizing: false,
43
+ renderIndicators: true,
44
+ renderMarginRevertIcon: false,
45
+ readOnly: false,
46
+ isInEmbeddedEditor: true,
47
+ renderOverviewRuler: false,
48
+ wordWrap: 'off',
49
+ diffWordWrap: 'off',
50
+ diffAlgorithm: 'advanced',
51
+ renderSideBySide: true,
52
+ useInlineViewWhenSpaceIsLimited: false
53
+ };
54
+
55
+ export { fixedDiffEditorOptions, fixedEditorOptions, getEditorPadding };