@codingame/monaco-vscode-katex-common 25.1.1 → 26.0.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 (317) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +23 -2
  3. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +64 -27
  4. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +3 -1
  5. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +31 -28
  6. package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +2 -0
  7. package/vscode/src/vs/platform/actions/browser/buttonbar.js +71 -50
  8. package/vscode/src/vs/platform/editor/browser/editor.js +17 -7
  9. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +112 -129
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +10 -1
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +110 -85
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +5 -5
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +21 -6
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +308 -216
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +153 -148
  16. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.d.ts +27 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +247 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +71 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +347 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +44 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +287 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.d.ts +20 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +89 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +188 -0
  25. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +677 -0
  26. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentSessionHoverWidget.css +98 -0
  27. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +263 -0
  28. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.js +34 -25
  29. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +19 -14
  30. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +762 -359
  31. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +22 -1
  32. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +188 -99
  33. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +9 -3
  34. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +166 -113
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +12 -5
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +279 -213
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +46 -0
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +533 -0
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +28 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +382 -0
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.d.ts +101 -0
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +509 -0
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +130 -0
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +276 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +24 -7
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +128 -52
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +153 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +1218 -0
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionPickerActionItem.css +14 -0
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.d.ts +39 -0
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +193 -0
  52. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +2 -0
  53. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +93 -89
  54. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +5 -2
  55. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +42 -47
  56. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +58 -56
  57. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +18 -14
  58. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +17 -15
  59. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +6 -2
  60. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +132 -68
  61. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +0 -2
  62. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +68 -47
  63. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +14 -13
  64. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +4 -4
  65. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +36 -24
  66. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +18 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +32 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.d.ts +7 -2
  69. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.js +15 -4
  70. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -0
  71. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +22 -14
  72. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +0 -2
  73. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +34 -27
  74. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -5
  75. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +198 -135
  76. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.d.ts +2 -0
  77. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +38 -10
  78. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +29 -27
  79. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +0 -2
  80. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.js +41 -36
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +0 -2
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +23 -18
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.js +13 -13
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +0 -3
  85. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +20 -14
  86. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +11 -1
  87. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +291 -152
  88. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +2 -3
  89. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +227 -162
  90. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.js +68 -72
  91. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +2 -4
  92. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +76 -75
  93. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +2 -5
  94. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +96 -76
  95. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +4 -1
  96. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +74 -38
  97. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +0 -2
  98. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -25
  99. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +107 -0
  100. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +814 -0
  101. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +0 -2
  102. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +34 -29
  103. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +8 -10
  104. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +236 -197
  105. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +123 -0
  106. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +492 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +75 -47
  108. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +2 -4
  109. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +31 -20
  110. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +0 -3
  111. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +42 -36
  112. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +55 -7
  113. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +714 -148
  114. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +7 -0
  115. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +21 -0
  116. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +2 -7
  117. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +143 -153
  118. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +14 -5
  119. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +79 -61
  120. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +10 -4
  121. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +209 -77
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +9 -7
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +71 -54
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +18 -0
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +83 -0
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +4 -4
  127. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +248 -190
  128. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +1 -14
  129. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +23 -0
  130. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatPullRequestContent.css +5 -41
  131. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +493 -0
  132. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatSubagentContent.css +63 -0
  133. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +9 -1
  134. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +121 -5
  135. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +37 -0
  136. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +51 -45
  137. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +46 -42
  138. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +4 -2
  139. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +99 -67
  140. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +112 -0
  141. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +634 -0
  142. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +49 -0
  143. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +132 -0
  144. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.js +15 -9
  145. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +196 -149
  146. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +17 -1
  147. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +577 -193
  148. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +119 -86
  149. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +10 -2
  150. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +165 -36
  151. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +0 -2
  152. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +5 -8
  153. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +5 -3
  154. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +75 -65
  155. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +30 -28
  156. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +1 -5
  157. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +102 -106
  158. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +44 -20
  159. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +19 -0
  160. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +67 -0
  161. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.d.ts +57 -0
  162. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.js +69 -0
  163. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +122 -82
  164. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +39 -12
  165. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +1110 -597
  166. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +291 -0
  167. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +485 -0
  168. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatOptions.js +38 -28
  169. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +9 -20
  170. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +650 -689
  171. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +21 -18
  172. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +102 -36
  173. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +1253 -790
  174. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.d.ts +0 -7
  175. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.js +11 -11
  176. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +34 -0
  177. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +55 -0
  178. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.d.ts +6 -2
  179. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.js +51 -35
  180. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +22 -0
  181. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +102 -0
  182. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +16 -4
  183. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +192 -44
  184. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +11 -12
  185. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +99 -66
  186. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +47 -0
  187. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +188 -0
  188. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.d.ts +20 -0
  189. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +115 -0
  190. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +129 -167
  191. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +16 -3
  192. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +37 -0
  193. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +143 -0
  194. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +56 -0
  195. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +206 -0
  196. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +152 -0
  197. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +67 -0
  198. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +22 -0
  199. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +170 -0
  200. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +1 -0
  201. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +80 -19
  202. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatWidgetHistoryService.js +20 -28
  203. package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.d.ts +2 -1
  204. package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +22 -19
  205. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +15 -0
  206. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +122 -0
  207. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +19 -104
  208. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +316 -1040
  209. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +28 -0
  210. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +162 -0
  211. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +21 -0
  212. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +98 -0
  213. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +68 -0
  214. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +416 -0
  215. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +1 -6
  216. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +194 -215
  217. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +0 -1
  218. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +74 -104
  219. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +45 -91
  220. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +22 -0
  221. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +98 -0
  222. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +5 -2
  223. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +96 -68
  224. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.d.ts +7 -0
  225. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.js +11 -0
  226. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.d.ts +20 -0
  227. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +150 -0
  228. package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +141 -147
  229. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.d.ts +64 -0
  230. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.js +200 -0
  231. package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +548 -0
  232. package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.js +23 -0
  233. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.d.ts +22 -0
  234. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +338 -0
  235. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.d.ts +18 -0
  236. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
  237. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.d.ts +75 -0
  238. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +364 -0
  239. package/vscode/src/vs/workbench/contrib/replNotebook/browser/interactiveEditor.css +21 -0
  240. package/vscode/src/vs/workbench/contrib/replNotebook/browser/media/interactive.css +36 -0
  241. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.d.ts +110 -0
  242. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +692 -0
  243. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.d.ts +40 -0
  244. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +158 -0
  245. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +80 -21
  246. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +440 -82
  247. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.d.ts +0 -34
  248. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.js +0 -139
  249. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.d.ts +0 -10
  250. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +0 -1081
  251. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +0 -199
  252. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +0 -482
  253. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +0 -28
  254. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +0 -37
  255. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +0 -94
  256. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +0 -495
  257. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +0 -72
  258. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +0 -454
  259. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +0 -13
  260. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +0 -66
  261. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +0 -41
  262. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +0 -372
  263. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +0 -4
  264. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +0 -58
  265. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +0 -26
  266. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +0 -594
  267. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +0 -8
  268. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -55
  269. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +0 -273
  270. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1746
  271. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +0 -50
  272. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -269
  273. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +0 -258
  274. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -806
  275. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +0 -41
  276. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -116
  277. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +0 -17
  278. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +0 -62
  279. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +0 -27
  280. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -40
  281. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +0 -23
  282. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +0 -295
  283. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +0 -51
  284. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +0 -241
  285. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +0 -24
  286. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +0 -146
  287. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +0 -28
  288. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +0 -90
  289. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +0 -10
  290. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +0 -41
  291. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +0 -21
  292. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +0 -42
  293. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +0 -25
  294. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +0 -77
  295. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +0 -469
  296. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +0 -149
  297. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -823
  298. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +0 -180
  299. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -29
  300. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +0 -102
  301. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -567
  302. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +0 -30
  303. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -189
  304. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +0 -75
  305. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +0 -439
  306. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +0 -57
  307. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +0 -263
  308. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +0 -22
  309. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +0 -48
  310. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +0 -13
  311. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +0 -39
  312. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +0 -19
  313. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +0 -89
  314. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +0 -26
  315. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +0 -92
  316. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +0 -33
  317. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -108
@@ -1,1746 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { addDisposableListener, append, $, reset, scheduleAtNextAnimationFrame, getWindow, h } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
- import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
- import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
6
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
7
- import { PropertyFoldingState, NotebookDocumentMetadataViewModel, SideBySideDiffElementViewModel, getFormattedOutputJSON, OUTPUT_EDITOR_HEIGHT_MAGIC, OutputComparison, outputEqual } from './diffElementViewModel.js';
8
- import { NOTEBOOK_DIFF_CELL_PROPERTY, NOTEBOOK_DIFF_CELL_PROPERTY_EXPANDED, DIFF_CELL_MARGIN, NOTEBOOK_DIFF_METADATA, DiffSide, NOTEBOOK_DIFF_CELL_INPUT, NOTEBOOK_DIFF_CELL_IGNORE_WHITESPACE } from './notebookDiffEditorBrowser.js';
9
- import { CodeEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
10
- import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
11
- import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
12
- import { CellEditType, CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
13
- import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
14
- import { MenuItemAction, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
15
- import { IMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service';
16
- import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
17
- import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
18
- import { getFlatActionBarActions } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
19
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
20
- import { CodiconActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView';
21
- import { collapsedIcon, expandedIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
22
- import { OutputContainer } from './diffElementOutputs.js';
23
- import { EditorExtensionsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions';
24
- import { ContextMenuController } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/contextmenu/browser/contextmenu';
25
- import { SnippetController2 } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/snippet/browser/snippetController2';
26
- import { SuggestController } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/suggest/browser/suggestController';
27
- import { MenuPreventer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/codeEditor/browser/menuPreventer';
28
- import { SelectionClipboardContributionID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/codeEditor/browser/selectionClipboard';
29
- import { TabCompletionController } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/snippets/browser/tabCompletion';
30
- import { renderIcon, renderLabelWithIcons } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
31
- import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
32
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
33
- import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
34
- import { WorkbenchToolBar } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
35
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
36
- import { getEditorPadding, fixedDiffEditorOptions, fixedEditorOptions } from './diffCellEditorOptions.js';
37
- import { AccessibilityVerbositySettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
38
- import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
39
- import { DiffEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/diffEditorWidget';
40
- import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
41
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
42
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
43
- import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
44
- import { getFormattedMetadataJSON } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
45
- import { getUnchangedRegionSettings } from './unchangedEditorRegions.js';
46
-
47
- function getOptimizedNestedCodeEditorWidgetOptions() {
48
- return {
49
- isSimpleWidget: false,
50
- contributions: EditorExtensionsRegistry.getSomeEditorContributions([
51
- MenuPreventer.ID,
52
- SelectionClipboardContributionID,
53
- ContextMenuController.ID,
54
- SuggestController.ID,
55
- SnippetController2.ID,
56
- TabCompletionController.ID,
57
- ])
58
- };
59
- }
60
- class CellDiffPlaceholderElement extends Disposable {
61
- constructor(placeholder, templateData) {
62
- super();
63
- templateData.body.classList.remove('left', 'right', 'full');
64
- const text = (placeholder.hiddenCells.length === 1) ?
65
- ( localize(9466, '{0} hidden cell', placeholder.hiddenCells.length)) :
66
- ( localize(9467, '{0} hidden cells', placeholder.hiddenCells.length));
67
- templateData.placeholder.innerText = text;
68
- this._register(addDisposableListener(templateData.placeholder, 'dblclick', (e) => {
69
- if (e.button !== 0) {
70
- return;
71
- }
72
- e.preventDefault();
73
- placeholder.showHiddenCells();
74
- }));
75
- this._register(templateData.marginOverlay.onAction(() => placeholder.showHiddenCells()));
76
- templateData.marginOverlay.show();
77
- }
78
- }
79
- let PropertyHeader = class PropertyHeader extends Disposable {
80
- constructor(cell, propertyHeaderContainer, notebookEditor, accessor, contextMenuService, keybindingService, commandService, notificationService, menuService, contextKeyService, themeService, telemetryService, accessibilityService) {
81
- super();
82
- this.cell = cell;
83
- this.propertyHeaderContainer = propertyHeaderContainer;
84
- this.notebookEditor = notebookEditor;
85
- this.accessor = accessor;
86
- this.contextMenuService = contextMenuService;
87
- this.keybindingService = keybindingService;
88
- this.commandService = commandService;
89
- this.notificationService = notificationService;
90
- this.menuService = menuService;
91
- this.contextKeyService = contextKeyService;
92
- this.themeService = themeService;
93
- this.telemetryService = telemetryService;
94
- this.accessibilityService = accessibilityService;
95
- }
96
- buildHeader() {
97
- this._foldingIndicator = append(this.propertyHeaderContainer, $('.property-folding-indicator'));
98
- this._foldingIndicator.classList.add(this.accessor.prefix);
99
- const metadataStatus = append(this.propertyHeaderContainer, $('div.property-status'));
100
- this._statusSpan = append(metadataStatus, $('span'));
101
- this._description = append(metadataStatus, $('span.property-description'));
102
- const cellToolbarContainer = append(this.propertyHeaderContainer, $('div.property-toolbar'));
103
- this._toolbar = this._register(( new WorkbenchToolBar(cellToolbarContainer, {
104
- actionViewItemProvider: (action, options) => {
105
- if (action instanceof MenuItemAction) {
106
- const item = ( new CodiconActionViewItem(
107
- action,
108
- { hoverDelegate: options.hoverDelegate },
109
- this.keybindingService,
110
- this.notificationService,
111
- this.contextKeyService,
112
- this.themeService,
113
- this.contextMenuService,
114
- this.accessibilityService
115
- ));
116
- return item;
117
- }
118
- return undefined;
119
- }
120
- }, this.menuService, this.contextKeyService, this.contextMenuService, this.keybindingService, this.commandService, this.telemetryService)));
121
- this._toolbar.context = this.cell;
122
- const scopedContextKeyService = this.contextKeyService.createScoped(cellToolbarContainer);
123
- this._register(scopedContextKeyService);
124
- this._propertyChanged = NOTEBOOK_DIFF_CELL_PROPERTY.bindTo(scopedContextKeyService);
125
- this._propertyExpanded = NOTEBOOK_DIFF_CELL_PROPERTY_EXPANDED.bindTo(scopedContextKeyService);
126
- this._menu = this._register(this.menuService.createMenu(this.accessor.menuId, scopedContextKeyService));
127
- this._register(this._menu.onDidChange(() => this.updateMenu()));
128
- this._register(this.notebookEditor.onMouseUp(e => {
129
- if (!e.event.target || e.target !== this.cell) {
130
- return;
131
- }
132
- const target = e.event.target;
133
- if (target === this.propertyHeaderContainer ||
134
- target === this._foldingIndicator || this._foldingIndicator.contains(target) ||
135
- target === metadataStatus || metadataStatus.contains(target)) {
136
- const oldFoldingState = this.accessor.getFoldingState();
137
- this.accessor.updateFoldingState(oldFoldingState === PropertyFoldingState.Expanded ? PropertyFoldingState.Collapsed : PropertyFoldingState.Expanded);
138
- this._updateFoldingIcon();
139
- this.accessor.updateInfoRendering(this.cell.renderOutput);
140
- }
141
- }));
142
- this.refresh();
143
- this.accessor.updateInfoRendering(this.cell.renderOutput);
144
- }
145
- refresh() {
146
- this.updateMenu();
147
- this._updateFoldingIcon();
148
- const metadataChanged = this.accessor.checkIfModified();
149
- if (this._propertyChanged) {
150
- this._propertyChanged.set(!!metadataChanged);
151
- }
152
- if (metadataChanged) {
153
- this._statusSpan.textContent = this.accessor.changedLabel;
154
- this._statusSpan.style.fontWeight = 'bold';
155
- if (metadataChanged.reason) {
156
- this._description.textContent = metadataChanged.reason;
157
- }
158
- this.propertyHeaderContainer.classList.add('modified');
159
- }
160
- else {
161
- this._statusSpan.textContent = this.accessor.unChangedLabel;
162
- this._statusSpan.style.fontWeight = 'normal';
163
- this._description.textContent = '';
164
- this.propertyHeaderContainer.classList.remove('modified');
165
- }
166
- }
167
- updateMenu() {
168
- const metadataChanged = this.accessor.checkIfModified();
169
- if (metadataChanged) {
170
- const actions = getFlatActionBarActions(this._menu.getActions({ shouldForwardArgs: true }));
171
- this._toolbar.setActions(actions);
172
- }
173
- else {
174
- this._toolbar.setActions([]);
175
- }
176
- }
177
- _updateFoldingIcon() {
178
- if (this.accessor.getFoldingState() === PropertyFoldingState.Collapsed) {
179
- reset(this._foldingIndicator, renderIcon(collapsedIcon));
180
- this._propertyExpanded?.set(false);
181
- }
182
- else {
183
- reset(this._foldingIndicator, renderIcon(expandedIcon));
184
- this._propertyExpanded?.set(true);
185
- }
186
- }
187
- };
188
- PropertyHeader = ( __decorate([
189
- ( __param(4, IContextMenuService)),
190
- ( __param(5, IKeybindingService)),
191
- ( __param(6, ICommandService)),
192
- ( __param(7, INotificationService)),
193
- ( __param(8, IMenuService)),
194
- ( __param(9, IContextKeyService)),
195
- ( __param(10, IThemeService)),
196
- ( __param(11, ITelemetryService)),
197
- ( __param(12, IAccessibilityService))
198
- ], PropertyHeader));
199
- let NotebookDocumentMetadataElement = class NotebookDocumentMetadataElement extends Disposable {
200
- constructor(notebookEditor, viewModel, templateData, instantiationService, textModelService, menuService, contextKeyService, textConfigurationService, configurationService) {
201
- super();
202
- this.notebookEditor = notebookEditor;
203
- this.viewModel = viewModel;
204
- this.templateData = templateData;
205
- this.instantiationService = instantiationService;
206
- this.textModelService = textModelService;
207
- this.menuService = menuService;
208
- this.contextKeyService = contextKeyService;
209
- this.textConfigurationService = textConfigurationService;
210
- this.configurationService = configurationService;
211
- this._editor = templateData.sourceEditor;
212
- this._cellHeaderContainer = this.templateData.cellHeaderContainer;
213
- this._editorContainer = this.templateData.editorContainer;
214
- this._diffEditorContainer = this.templateData.diffEditorContainer;
215
- this._editorViewStateChanged = false;
216
- this._register(viewModel.onDidLayoutChange(e => {
217
- this.layout(e);
218
- this.updateBorders();
219
- }));
220
- this.buildBody();
221
- this.updateBorders();
222
- }
223
- buildBody() {
224
- const body = this.templateData.body;
225
- body.classList.remove('full');
226
- body.classList.add('full');
227
- this.updateSourceEditor();
228
- if (this.viewModel instanceof NotebookDocumentMetadataViewModel) {
229
- this._register(this.viewModel.modifiedMetadata.onDidChange(e => {
230
- this._cellHeader.refresh();
231
- }));
232
- }
233
- }
234
- layoutNotebookCell() {
235
- this.notebookEditor.layoutNotebookCell(this.viewModel, this.viewModel.layoutInfo.totalHeight);
236
- }
237
- updateBorders() {
238
- this.templateData.leftBorder.style.height = `${this.viewModel.layoutInfo.totalHeight - 32}px`;
239
- this.templateData.rightBorder.style.height = `${this.viewModel.layoutInfo.totalHeight - 32}px`;
240
- this.templateData.bottomBorder.style.top = `${this.viewModel.layoutInfo.totalHeight - 32}px`;
241
- }
242
- updateSourceEditor() {
243
- this._cellHeaderContainer.style.display = 'flex';
244
- this._cellHeaderContainer.innerText = '';
245
- this._editorContainer.classList.add('diff');
246
- const updateSourceEditor = () => {
247
- if (this.viewModel.cellFoldingState === PropertyFoldingState.Collapsed) {
248
- this._editorContainer.style.display = 'none';
249
- this.viewModel.editorHeight = 0;
250
- return;
251
- }
252
- const lineHeight = this.notebookEditor.getLayoutInfo().fontInfo.lineHeight || 17;
253
- const editorHeight = this.viewModel.layoutInfo.editorHeight !== 0 ? this.viewModel.layoutInfo.editorHeight : this.viewModel.computeInputEditorHeight(lineHeight);
254
- this._editorContainer.style.height = `${editorHeight}px`;
255
- this._editorContainer.style.display = 'block';
256
- const contentHeight = this._editor.getContentHeight();
257
- if (contentHeight >= 0) {
258
- this.viewModel.editorHeight = contentHeight;
259
- }
260
- return editorHeight;
261
- };
262
- const renderSourceEditor = () => {
263
- const editorHeight = updateSourceEditor();
264
- if (!editorHeight) {
265
- return;
266
- }
267
- const lineCount = this.viewModel.modifiedMetadata.textBuffer.getLineCount();
268
- const options = {
269
- padding: getEditorPadding(lineCount)
270
- };
271
- const unchangedRegions = this._register(getUnchangedRegionSettings(this.configurationService));
272
- if (unchangedRegions.options.enabled) {
273
- options.hideUnchangedRegions = unchangedRegions.options;
274
- }
275
- this._editor.updateOptions(options);
276
- this._register(unchangedRegions.onDidChangeEnablement(() => {
277
- options.hideUnchangedRegions = unchangedRegions.options;
278
- this._editor.updateOptions(options);
279
- }));
280
- this._editor.layout({
281
- width: this.notebookEditor.getLayoutInfo().width - 2 * DIFF_CELL_MARGIN,
282
- height: editorHeight
283
- });
284
- this._register(this._editor.onDidContentSizeChange((e) => {
285
- if (this.viewModel.cellFoldingState === PropertyFoldingState.Expanded && e.contentHeightChanged && this.viewModel.layoutInfo.editorHeight !== e.contentHeight) {
286
- this.viewModel.editorHeight = e.contentHeight;
287
- }
288
- }));
289
- this._initializeSourceDiffEditor();
290
- };
291
- this._cellHeader = this._register(this.instantiationService.createInstance(PropertyHeader, this.viewModel, this._cellHeaderContainer, this.notebookEditor, {
292
- updateInfoRendering: () => renderSourceEditor(),
293
- checkIfModified: () => {
294
- return this.viewModel.originalMetadata.getHash() !== this.viewModel.modifiedMetadata.getHash() ? { reason: undefined } : false;
295
- },
296
- getFoldingState: () => this.viewModel.cellFoldingState,
297
- updateFoldingState: (state) => this.viewModel.cellFoldingState = state,
298
- unChangedLabel: 'Notebook Metadata',
299
- changedLabel: 'Notebook Metadata changed',
300
- prefix: 'metadata',
301
- menuId: MenuId.NotebookDiffDocumentMetadata
302
- }));
303
- this._cellHeader.buildHeader();
304
- renderSourceEditor();
305
- const scopedContextKeyService = this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);
306
- this._register(scopedContextKeyService);
307
- const inputChanged = NOTEBOOK_DIFF_METADATA.bindTo(scopedContextKeyService);
308
- inputChanged.set(this.viewModel.originalMetadata.getHash() !== this.viewModel.modifiedMetadata.getHash());
309
- this._toolbar = this.templateData.toolbar;
310
- this._toolbar.context = this.viewModel;
311
- const refreshToolbar = () => {
312
- const hasChanges = this.viewModel.originalMetadata.getHash() !== this.viewModel.modifiedMetadata.getHash();
313
- inputChanged.set(hasChanges);
314
- if (hasChanges) {
315
- const menu = this.menuService.getMenuActions(MenuId.NotebookDiffDocumentMetadata, scopedContextKeyService, { shouldForwardArgs: true });
316
- const actions = getFlatActionBarActions(menu);
317
- this._toolbar.setActions(actions);
318
- }
319
- else {
320
- this._toolbar.setActions([]);
321
- }
322
- };
323
- this._register(this.viewModel.modifiedMetadata.onDidChange(() => {
324
- refreshToolbar();
325
- }));
326
- refreshToolbar();
327
- }
328
- async _initializeSourceDiffEditor() {
329
- const [originalRef, modifiedRef] = await Promise.all([
330
- this.textModelService.createModelReference(this.viewModel.originalMetadata.uri),
331
- this.textModelService.createModelReference(this.viewModel.modifiedMetadata.uri)
332
- ]);
333
- if (this._store.isDisposed) {
334
- originalRef.dispose();
335
- modifiedRef.dispose();
336
- return;
337
- }
338
- this._register(originalRef);
339
- this._register(modifiedRef);
340
- const vm = this._register(this._editor.createViewModel({
341
- original: originalRef.object.textEditorModel,
342
- modified: modifiedRef.object.textEditorModel,
343
- }));
344
- await vm.waitForDiff();
345
- this._editor.setModel(vm);
346
- const handleViewStateChange = () => {
347
- this._editorViewStateChanged = true;
348
- };
349
- const handleScrollChange = (e) => {
350
- if (e.scrollTopChanged || e.scrollLeftChanged) {
351
- this._editorViewStateChanged = true;
352
- }
353
- };
354
- this.updateEditorOptionsForWhitespace();
355
- this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(handleViewStateChange));
356
- this._register(this._editor.getOriginalEditor().onDidScrollChange(handleScrollChange));
357
- this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(handleViewStateChange));
358
- this._register(this._editor.getModifiedEditor().onDidScrollChange(handleScrollChange));
359
- const editorViewState = this.viewModel.getSourceEditorViewState();
360
- if (editorViewState) {
361
- this._editor.restoreViewState(editorViewState);
362
- }
363
- const contentHeight = this._editor.getContentHeight();
364
- this.viewModel.editorHeight = contentHeight;
365
- }
366
- updateEditorOptionsForWhitespace() {
367
- const editor = this._editor;
368
- const uri = editor.getModel()?.modified.uri || editor.getModel()?.original.uri;
369
- if (!uri) {
370
- return;
371
- }
372
- const ignoreTrimWhitespace = this.textConfigurationService.getValue(uri, 'diffEditor.ignoreTrimWhitespace');
373
- editor.updateOptions({ ignoreTrimWhitespace });
374
- this._register(this.textConfigurationService.onDidChangeConfiguration(e => {
375
- if (e.affectsConfiguration(uri, 'diffEditor') &&
376
- ( e.affectedKeys.has('diffEditor.ignoreTrimWhitespace'))) {
377
- const ignoreTrimWhitespace = this.textConfigurationService.getValue(uri, 'diffEditor.ignoreTrimWhitespace');
378
- editor.updateOptions({ ignoreTrimWhitespace });
379
- }
380
- }));
381
- }
382
- layout(state) {
383
- scheduleAtNextAnimationFrame(getWindow(this._diffEditorContainer), () => {
384
- if (state.editorHeight) {
385
- this._editorContainer.style.height = `${this.viewModel.layoutInfo.editorHeight}px`;
386
- this._editor.layout({
387
- width: this._editor.getViewWidth(),
388
- height: this.viewModel.layoutInfo.editorHeight
389
- });
390
- }
391
- if (state.outerWidth) {
392
- this._editorContainer.style.height = `${this.viewModel.layoutInfo.editorHeight}px`;
393
- this._editor.layout();
394
- }
395
- this.layoutNotebookCell();
396
- });
397
- }
398
- dispose() {
399
- this._editor.setModel(null);
400
- if (this._editorViewStateChanged) {
401
- this.viewModel.saveSpirceEditorViewState(this._editor.saveViewState());
402
- }
403
- super.dispose();
404
- }
405
- };
406
- NotebookDocumentMetadataElement = ( __decorate([
407
- ( __param(3, IInstantiationService)),
408
- ( __param(4, ITextModelService)),
409
- ( __param(5, IMenuService)),
410
- ( __param(6, IContextKeyService)),
411
- ( __param(7, ITextResourceConfigurationService)),
412
- ( __param(8, IConfigurationService))
413
- ], NotebookDocumentMetadataElement));
414
- class AbstractElementRenderer extends Disposable {
415
- constructor(notebookEditor, cell, templateData, style, instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService) {
416
- super();
417
- this.notebookEditor = notebookEditor;
418
- this.cell = cell;
419
- this.templateData = templateData;
420
- this.style = style;
421
- this.instantiationService = instantiationService;
422
- this.languageService = languageService;
423
- this.modelService = modelService;
424
- this.textModelService = textModelService;
425
- this.contextMenuService = contextMenuService;
426
- this.keybindingService = keybindingService;
427
- this.notificationService = notificationService;
428
- this.menuService = menuService;
429
- this.contextKeyService = contextKeyService;
430
- this.configurationService = configurationService;
431
- this.textConfigurationService = textConfigurationService;
432
- this._metadataLocalDisposable = this._register(( new DisposableStore()));
433
- this._outputLocalDisposable = this._register(( new DisposableStore()));
434
- this._ignoreMetadata = false;
435
- this._ignoreOutputs = false;
436
- this._isDisposed = false;
437
- this._metadataEditorDisposeStore = this._register(( new DisposableStore()));
438
- this._outputEditorDisposeStore = this._register(( new DisposableStore()));
439
- this._register(cell.onDidLayoutChange(e => {
440
- this.layout(e);
441
- }));
442
- this._register(cell.onDidLayoutChange(e => this.updateBorders()));
443
- this.init();
444
- this.buildBody();
445
- this._register(cell.onDidStateChange(() => {
446
- this.updateOutputRendering(this.cell.renderOutput);
447
- }));
448
- }
449
- buildBody() {
450
- const body = this.templateData.body;
451
- this._diffEditorContainer = this.templateData.diffEditorContainer;
452
- body.classList.remove('left', 'right', 'full');
453
- switch (this.style) {
454
- case 'left':
455
- body.classList.add('left');
456
- break;
457
- case 'right':
458
- body.classList.add('right');
459
- break;
460
- default:
461
- body.classList.add('full');
462
- break;
463
- }
464
- this.styleContainer(this._diffEditorContainer);
465
- this.updateSourceEditor();
466
- if (this.cell.modified) {
467
- this._register(this.cell.modified.textModel.onDidChangeContent(() => this._cellHeader.refresh()));
468
- }
469
- this._ignoreMetadata = this.configurationService.getValue('notebook.diff.ignoreMetadata');
470
- if (this._ignoreMetadata) {
471
- this._disposeMetadata();
472
- }
473
- else {
474
- this._buildMetadata();
475
- }
476
- this._ignoreOutputs = this.configurationService.getValue('notebook.diff.ignoreOutputs') || !!(this.notebookEditor.textModel?.transientOptions.transientOutputs);
477
- if (this._ignoreOutputs) {
478
- this._disposeOutput();
479
- }
480
- else {
481
- this._buildOutput();
482
- }
483
- this._register(this.configurationService.onDidChangeConfiguration(e => {
484
- let metadataLayoutChange = false;
485
- let outputLayoutChange = false;
486
- if (e.affectsConfiguration('notebook.diff.ignoreMetadata')) {
487
- const newValue = this.configurationService.getValue('notebook.diff.ignoreMetadata');
488
- if (newValue !== undefined && this._ignoreMetadata !== newValue) {
489
- this._ignoreMetadata = newValue;
490
- this._metadataLocalDisposable.clear();
491
- if (this.configurationService.getValue('notebook.diff.ignoreMetadata')) {
492
- this._disposeMetadata();
493
- }
494
- else {
495
- this.cell.metadataStatusHeight = 25;
496
- this._buildMetadata();
497
- this.updateMetadataRendering();
498
- metadataLayoutChange = true;
499
- }
500
- }
501
- }
502
- if (e.affectsConfiguration('notebook.diff.ignoreOutputs')) {
503
- const newValue = this.configurationService.getValue('notebook.diff.ignoreOutputs');
504
- if (newValue !== undefined && this._ignoreOutputs !== (newValue || this.notebookEditor.textModel?.transientOptions.transientOutputs)) {
505
- this._ignoreOutputs = newValue || !!(this.notebookEditor.textModel?.transientOptions.transientOutputs);
506
- this._outputLocalDisposable.clear();
507
- if (this._ignoreOutputs) {
508
- this._disposeOutput();
509
- this.cell.layoutChange();
510
- }
511
- else {
512
- this.cell.outputStatusHeight = 25;
513
- this._buildOutput();
514
- outputLayoutChange = true;
515
- }
516
- }
517
- }
518
- if (metadataLayoutChange || outputLayoutChange) {
519
- this.layout({ metadataHeight: metadataLayoutChange, outputTotalHeight: outputLayoutChange });
520
- }
521
- }));
522
- }
523
- updateMetadataRendering() {
524
- if (this.cell.metadataFoldingState === PropertyFoldingState.Expanded) {
525
- this._metadataInfoContainer.style.display = 'block';
526
- if (!this._metadataEditorContainer || !this._metadataEditor) {
527
- this._metadataEditorContainer = append(this._metadataInfoContainer, $('.metadata-editor-container'));
528
- this._buildMetadataEditor();
529
- }
530
- else {
531
- this.cell.metadataHeight = this._metadataEditor.getContentHeight();
532
- }
533
- }
534
- else {
535
- this._metadataInfoContainer.style.display = 'none';
536
- this.cell.metadataHeight = 0;
537
- }
538
- }
539
- updateOutputRendering(renderRichOutput) {
540
- if (this.cell.outputFoldingState === PropertyFoldingState.Expanded) {
541
- this._outputInfoContainer.style.display = 'block';
542
- if (renderRichOutput) {
543
- this._hideOutputsRaw();
544
- this._buildOutputRendererContainer();
545
- this._showOutputsRenderer();
546
- this._showOutputsEmptyView();
547
- }
548
- else {
549
- this._hideOutputsRenderer();
550
- this._buildOutputRawContainer();
551
- this._showOutputsRaw();
552
- }
553
- }
554
- else {
555
- this._outputInfoContainer.style.display = 'none';
556
- this._hideOutputsRaw();
557
- this._hideOutputsRenderer();
558
- this._hideOutputsEmptyView();
559
- }
560
- }
561
- _buildOutputRawContainer() {
562
- if (!this._outputEditorContainer) {
563
- this._outputEditorContainer = append(this._outputInfoContainer, $('.output-editor-container'));
564
- this._buildOutputEditor();
565
- }
566
- }
567
- _showOutputsRaw() {
568
- if (this._outputEditorContainer) {
569
- this._outputEditorContainer.style.display = 'block';
570
- this.cell.rawOutputHeight = this._outputEditor.getContentHeight();
571
- }
572
- }
573
- _showOutputsEmptyView() {
574
- this.cell.layoutChange();
575
- }
576
- _hideOutputsRaw() {
577
- if (this._outputEditorContainer) {
578
- this._outputEditorContainer.style.display = 'none';
579
- this.cell.rawOutputHeight = 0;
580
- }
581
- }
582
- _hideOutputsEmptyView() {
583
- this.cell.layoutChange();
584
- }
585
- _applySanitizedMetadataChanges(currentMetadata, newMetadata) {
586
- const result = {};
587
- try {
588
- const newMetadataObj = JSON.parse(newMetadata);
589
- const keys = ( new Set([...( Object.keys(newMetadataObj))]));
590
- for (const key of keys) {
591
- switch (key) {
592
- case 'inputCollapsed':
593
- case 'outputCollapsed':
594
- if (typeof newMetadataObj[key] === 'boolean') {
595
- result[key] = newMetadataObj[key];
596
- }
597
- else {
598
- result[key] = currentMetadata[key];
599
- }
600
- break;
601
- default:
602
- result[key] = newMetadataObj[key];
603
- break;
604
- }
605
- }
606
- const index = this.notebookEditor.textModel.cells.indexOf(this.cell.modified.textModel);
607
- if (index < 0) {
608
- return;
609
- }
610
- this.notebookEditor.textModel.applyEdits([
611
- { editType: CellEditType.Metadata, index, metadata: result }
612
- ], true, undefined, () => undefined, undefined, true);
613
- }
614
- catch {
615
- }
616
- }
617
- async _buildMetadataEditor() {
618
- this._metadataEditorDisposeStore.clear();
619
- if (this.cell instanceof SideBySideDiffElementViewModel) {
620
- this._metadataEditor = this.instantiationService.createInstance(DiffEditorWidget, this._metadataEditorContainer, {
621
- ...fixedDiffEditorOptions,
622
- overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode(),
623
- readOnly: false,
624
- originalEditable: false,
625
- ignoreTrimWhitespace: false,
626
- automaticLayout: false,
627
- dimension: {
628
- height: this.cell.layoutInfo.metadataHeight,
629
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), true, true)
630
- }
631
- }, {
632
- originalEditor: getOptimizedNestedCodeEditorWidgetOptions(),
633
- modifiedEditor: getOptimizedNestedCodeEditorWidgetOptions()
634
- });
635
- const unchangedRegions = this._register(getUnchangedRegionSettings(this.configurationService));
636
- if (unchangedRegions.options.enabled) {
637
- this._metadataEditor.updateOptions({ hideUnchangedRegions: unchangedRegions.options });
638
- }
639
- this._metadataEditorDisposeStore.add(unchangedRegions.onDidChangeEnablement(() => {
640
- if (this._metadataEditor) {
641
- this._metadataEditor.updateOptions({ hideUnchangedRegions: unchangedRegions.options });
642
- }
643
- }));
644
- this.layout({ metadataHeight: true });
645
- this._metadataEditorDisposeStore.add(this._metadataEditor);
646
- this._metadataEditorContainer?.classList.add('diff');
647
- const [originalMetadataModel, modifiedMetadataModel] = await Promise.all([
648
- this.textModelService.createModelReference(CellUri.generateCellPropertyUri(this.cell.originalDocument.uri, this.cell.original.handle, Schemas.vscodeNotebookCellMetadata)),
649
- this.textModelService.createModelReference(CellUri.generateCellPropertyUri(this.cell.modifiedDocument.uri, this.cell.modified.handle, Schemas.vscodeNotebookCellMetadata))
650
- ]);
651
- if (this._isDisposed) {
652
- originalMetadataModel.dispose();
653
- modifiedMetadataModel.dispose();
654
- return;
655
- }
656
- this._metadataEditorDisposeStore.add(originalMetadataModel);
657
- this._metadataEditorDisposeStore.add(modifiedMetadataModel);
658
- const vm = this._metadataEditor.createViewModel({
659
- original: originalMetadataModel.object.textEditorModel,
660
- modified: modifiedMetadataModel.object.textEditorModel
661
- });
662
- this._metadataEditor.setModel(vm);
663
- await vm.waitForDiff();
664
- if (this._isDisposed) {
665
- return;
666
- }
667
- this.cell.metadataHeight = this._metadataEditor.getContentHeight();
668
- this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange((e) => {
669
- if (e.contentHeightChanged && this.cell.metadataFoldingState === PropertyFoldingState.Expanded) {
670
- this.cell.metadataHeight = e.contentHeight;
671
- }
672
- }));
673
- let respondingToContentChange = false;
674
- this._metadataEditorDisposeStore.add(modifiedMetadataModel.object.textEditorModel.onDidChangeContent(() => {
675
- respondingToContentChange = true;
676
- const value = modifiedMetadataModel.object.textEditorModel.getValue();
677
- this._applySanitizedMetadataChanges(this.cell.modified.metadata, value);
678
- this._metadataHeader.refresh();
679
- respondingToContentChange = false;
680
- }));
681
- this._metadataEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeMetadata(() => {
682
- if (respondingToContentChange) {
683
- return;
684
- }
685
- const modifiedMetadataSource = getFormattedMetadataJSON(this.notebookEditor.textModel?.transientOptions.transientCellMetadata, this.cell.modified?.metadata || {}, this.cell.modified?.language, true);
686
- modifiedMetadataModel.object.textEditorModel.setValue(modifiedMetadataSource);
687
- }));
688
- return;
689
- }
690
- else {
691
- this._metadataEditor = this.instantiationService.createInstance(CodeEditorWidget, this._metadataEditorContainer, {
692
- ...fixedEditorOptions,
693
- dimension: {
694
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
695
- height: this.cell.layoutInfo.metadataHeight
696
- },
697
- overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode(),
698
- readOnly: false,
699
- allowVariableLineHeights: false
700
- }, {});
701
- this.layout({ metadataHeight: true });
702
- this._metadataEditorDisposeStore.add(this._metadataEditor);
703
- const mode = this.languageService.createById('jsonc');
704
- const originalMetadataSource = getFormattedMetadataJSON(this.notebookEditor.textModel?.transientOptions.transientCellMetadata, this.cell.type === 'insert'
705
- ? this.cell.modified.metadata || {}
706
- : this.cell.original.metadata || {}, undefined, true);
707
- const uri = this.cell.type === 'insert'
708
- ? this.cell.modified.uri
709
- : this.cell.original.uri;
710
- const handle = this.cell.type === 'insert'
711
- ? this.cell.modified.handle
712
- : this.cell.original.handle;
713
- const modelUri = CellUri.generateCellPropertyUri(uri, handle, Schemas.vscodeNotebookCellMetadata);
714
- const metadataModel = this.modelService.createModel(originalMetadataSource, mode, modelUri, false);
715
- this._metadataEditor.setModel(metadataModel);
716
- this._metadataEditorDisposeStore.add(metadataModel);
717
- this.cell.metadataHeight = this._metadataEditor.getContentHeight();
718
- this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange((e) => {
719
- if (e.contentHeightChanged && this.cell.metadataFoldingState === PropertyFoldingState.Expanded) {
720
- this.cell.metadataHeight = e.contentHeight;
721
- }
722
- }));
723
- }
724
- }
725
- _buildOutputEditor() {
726
- this._outputEditorDisposeStore.clear();
727
- if ((this.cell.type === 'modified' || this.cell.type === 'unchanged') && !this.notebookEditor.textModel.transientOptions.transientOutputs) {
728
- const originalOutputsSource = getFormattedOutputJSON(this.cell.original?.outputs || []);
729
- const modifiedOutputsSource = getFormattedOutputJSON(this.cell.modified?.outputs || []);
730
- if (originalOutputsSource !== modifiedOutputsSource) {
731
- const mode = this.languageService.createById('json');
732
- const originalModel = this.modelService.createModel(originalOutputsSource, mode, undefined, true);
733
- const modifiedModel = this.modelService.createModel(modifiedOutputsSource, mode, undefined, true);
734
- this._outputEditorDisposeStore.add(originalModel);
735
- this._outputEditorDisposeStore.add(modifiedModel);
736
- const lineHeight = this.notebookEditor.getLayoutInfo().fontInfo.lineHeight || 17;
737
- const lineCount = Math.max(originalModel.getLineCount(), modifiedModel.getLineCount());
738
- this._outputEditor = this.instantiationService.createInstance(DiffEditorWidget, this._outputEditorContainer, {
739
- ...fixedDiffEditorOptions,
740
- overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode(),
741
- readOnly: true,
742
- ignoreTrimWhitespace: false,
743
- automaticLayout: false,
744
- dimension: {
745
- height: Math.min(OUTPUT_EDITOR_HEIGHT_MAGIC, this.cell.layoutInfo.rawOutputHeight || lineHeight * lineCount),
746
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true)
747
- },
748
- accessibilityVerbose: this.configurationService.getValue(AccessibilityVerbositySettingId.DiffEditor) ?? false
749
- }, {
750
- originalEditor: getOptimizedNestedCodeEditorWidgetOptions(),
751
- modifiedEditor: getOptimizedNestedCodeEditorWidgetOptions()
752
- });
753
- this._outputEditorDisposeStore.add(this._outputEditor);
754
- this._outputEditorContainer?.classList.add('diff');
755
- this._outputEditor.setModel({
756
- original: originalModel,
757
- modified: modifiedModel
758
- });
759
- this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState());
760
- this.cell.rawOutputHeight = this._outputEditor.getContentHeight();
761
- this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange((e) => {
762
- if (e.contentHeightChanged && this.cell.outputFoldingState === PropertyFoldingState.Expanded) {
763
- this.cell.rawOutputHeight = e.contentHeight;
764
- }
765
- }));
766
- this._outputEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeOutputs(() => {
767
- const modifiedOutputsSource = getFormattedOutputJSON(this.cell.modified?.outputs || []);
768
- modifiedModel.setValue(modifiedOutputsSource);
769
- this._outputHeader.refresh();
770
- }));
771
- return;
772
- }
773
- }
774
- this._outputEditor = this.instantiationService.createInstance(CodeEditorWidget, this._outputEditorContainer, {
775
- ...fixedEditorOptions,
776
- dimension: {
777
- width: Math.min(OUTPUT_EDITOR_HEIGHT_MAGIC, this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, this.cell.type === 'unchanged' || this.cell.type === 'modified') - 32),
778
- height: this.cell.layoutInfo.rawOutputHeight
779
- },
780
- overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode(),
781
- allowVariableLineHeights: false
782
- }, {});
783
- this._outputEditorDisposeStore.add(this._outputEditor);
784
- const mode = this.languageService.createById('json');
785
- const originaloutputSource = getFormattedOutputJSON(this.notebookEditor.textModel.transientOptions.transientOutputs
786
- ? []
787
- : this.cell.type === 'insert'
788
- ? this.cell.modified?.outputs || []
789
- : this.cell.original?.outputs || []);
790
- const outputModel = this.modelService.createModel(originaloutputSource, mode, undefined, true);
791
- this._outputEditorDisposeStore.add(outputModel);
792
- this._outputEditor.setModel(outputModel);
793
- this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState());
794
- this.cell.rawOutputHeight = this._outputEditor.getContentHeight();
795
- this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange((e) => {
796
- if (e.contentHeightChanged && this.cell.outputFoldingState === PropertyFoldingState.Expanded) {
797
- this.cell.rawOutputHeight = e.contentHeight;
798
- }
799
- }));
800
- }
801
- layoutNotebookCell() {
802
- this.notebookEditor.layoutNotebookCell(this.cell, this.cell.layoutInfo.totalHeight);
803
- }
804
- updateBorders() {
805
- this.templateData.leftBorder.style.height = `${this.cell.layoutInfo.totalHeight - 32}px`;
806
- this.templateData.rightBorder.style.height = `${this.cell.layoutInfo.totalHeight - 32}px`;
807
- this.templateData.bottomBorder.style.top = `${this.cell.layoutInfo.totalHeight - 32}px`;
808
- }
809
- dispose() {
810
- if (this._outputEditor) {
811
- this.cell.saveOutputEditorViewState(this._outputEditor.saveViewState());
812
- }
813
- if (this._metadataEditor) {
814
- this.cell.saveMetadataEditorViewState(this._metadataEditor.saveViewState());
815
- }
816
- this._metadataEditorDisposeStore.dispose();
817
- this._outputEditorDisposeStore.dispose();
818
- this._isDisposed = true;
819
- super.dispose();
820
- }
821
- }
822
- class SingleSideDiffElement extends AbstractElementRenderer {
823
- constructor(notebookEditor, cell, templateData, style, instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService) {
824
- super(notebookEditor, cell, templateData, style, instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService);
825
- this.cell = cell;
826
- this.templateData = templateData;
827
- this.updateBorders();
828
- }
829
- init() {
830
- this._diagonalFill = this.templateData.diagonalFill;
831
- }
832
- buildBody() {
833
- const body = this.templateData.body;
834
- this._diffEditorContainer = this.templateData.diffEditorContainer;
835
- body.classList.remove('left', 'right', 'full');
836
- switch (this.style) {
837
- case 'left':
838
- body.classList.add('left');
839
- break;
840
- case 'right':
841
- body.classList.add('right');
842
- break;
843
- default:
844
- body.classList.add('full');
845
- break;
846
- }
847
- this.styleContainer(this._diffEditorContainer);
848
- this.updateSourceEditor();
849
- if (this.configurationService.getValue('notebook.diff.ignoreMetadata')) {
850
- this._disposeMetadata();
851
- }
852
- else {
853
- this._buildMetadata();
854
- }
855
- if (this.configurationService.getValue('notebook.diff.ignoreOutputs') || this.notebookEditor.textModel?.transientOptions.transientOutputs) {
856
- this._disposeOutput();
857
- }
858
- else {
859
- this._buildOutput();
860
- }
861
- this._register(this.configurationService.onDidChangeConfiguration(e => {
862
- let metadataLayoutChange = false;
863
- let outputLayoutChange = false;
864
- if (e.affectsConfiguration('notebook.diff.ignoreMetadata')) {
865
- this._metadataLocalDisposable.clear();
866
- if (this.configurationService.getValue('notebook.diff.ignoreMetadata')) {
867
- this._disposeMetadata();
868
- }
869
- else {
870
- this.cell.metadataStatusHeight = 25;
871
- this._buildMetadata();
872
- this.updateMetadataRendering();
873
- metadataLayoutChange = true;
874
- }
875
- }
876
- if (e.affectsConfiguration('notebook.diff.ignoreOutputs')) {
877
- this._outputLocalDisposable.clear();
878
- if (this.configurationService.getValue('notebook.diff.ignoreOutputs') || this.notebookEditor.textModel?.transientOptions.transientOutputs) {
879
- this._disposeOutput();
880
- }
881
- else {
882
- this.cell.outputStatusHeight = 25;
883
- this._buildOutput();
884
- outputLayoutChange = true;
885
- }
886
- }
887
- if (metadataLayoutChange || outputLayoutChange) {
888
- this.layout({ metadataHeight: metadataLayoutChange, outputTotalHeight: outputLayoutChange });
889
- }
890
- }));
891
- }
892
- updateSourceEditor() {
893
- this._cellHeaderContainer = this.templateData.cellHeaderContainer;
894
- this._cellHeaderContainer.style.display = 'flex';
895
- this._cellHeaderContainer.innerText = '';
896
- this._editorContainer = this.templateData.editorContainer;
897
- this._editorContainer.classList.add('diff');
898
- const renderSourceEditor = () => {
899
- if (this.cell.cellFoldingState === PropertyFoldingState.Collapsed) {
900
- this._editorContainer.style.display = 'none';
901
- this.cell.editorHeight = 0;
902
- return;
903
- }
904
- const lineHeight = this.notebookEditor.getLayoutInfo().fontInfo.lineHeight || 17;
905
- const editorHeight = this.cell.computeInputEditorHeight(lineHeight);
906
- this._editorContainer.style.height = `${editorHeight}px`;
907
- this._editorContainer.style.display = 'block';
908
- if (this._editor) {
909
- const contentHeight = this._editor.getContentHeight();
910
- if (contentHeight >= 0) {
911
- this.cell.editorHeight = contentHeight;
912
- }
913
- return;
914
- }
915
- this._editor = this.templateData.sourceEditor;
916
- this._editor.layout({
917
- width: (this.notebookEditor.getLayoutInfo().width - 2 * DIFF_CELL_MARGIN) / 2 - 18,
918
- height: editorHeight
919
- });
920
- this._editor.updateOptions({ readOnly: this.readonly });
921
- this.cell.editorHeight = editorHeight;
922
- this._register(this._editor.onDidContentSizeChange((e) => {
923
- if (this.cell.cellFoldingState === PropertyFoldingState.Expanded && e.contentHeightChanged && this.cell.layoutInfo.editorHeight !== e.contentHeight) {
924
- this.cell.editorHeight = e.contentHeight;
925
- }
926
- }));
927
- this._initializeSourceDiffEditor(this.nestedCellViewModel);
928
- };
929
- this._cellHeader = this._register(this.instantiationService.createInstance(PropertyHeader, this.cell, this._cellHeaderContainer, this.notebookEditor, {
930
- updateInfoRendering: () => renderSourceEditor(),
931
- checkIfModified: () => ({ reason: undefined }),
932
- getFoldingState: () => this.cell.cellFoldingState,
933
- updateFoldingState: (state) => this.cell.cellFoldingState = state,
934
- unChangedLabel: 'Input',
935
- changedLabel: 'Input',
936
- prefix: 'input',
937
- menuId: MenuId.NotebookDiffCellInputTitle
938
- }));
939
- this._cellHeader.buildHeader();
940
- renderSourceEditor();
941
- this._initializeSourceDiffEditor(this.nestedCellViewModel);
942
- }
943
- calculateDiagonalFillHeight() {
944
- return this.cell.layoutInfo.cellStatusHeight + this.cell.layoutInfo.editorHeight + this.cell.layoutInfo.editorMargin + this.cell.layoutInfo.metadataStatusHeight + this.cell.layoutInfo.metadataHeight + this.cell.layoutInfo.outputTotalHeight + this.cell.layoutInfo.outputStatusHeight;
945
- }
946
- async _initializeSourceDiffEditor(modifiedCell) {
947
- const modifiedRef = await this.textModelService.createModelReference(modifiedCell.uri);
948
- if (this._isDisposed) {
949
- return;
950
- }
951
- const modifiedTextModel = modifiedRef.object.textEditorModel;
952
- this._register(modifiedRef);
953
- this._editor.setModel(modifiedTextModel);
954
- const editorViewState = this.cell.getSourceEditorViewState();
955
- if (editorViewState) {
956
- this._editor.restoreViewState(editorViewState);
957
- }
958
- const contentHeight = this._editor.getContentHeight();
959
- this.cell.editorHeight = contentHeight;
960
- const height = `${this.calculateDiagonalFillHeight()}px`;
961
- if (this._diagonalFill.style.height !== height) {
962
- this._diagonalFill.style.height = height;
963
- }
964
- }
965
- _disposeMetadata() {
966
- this.cell.metadataStatusHeight = 0;
967
- this.cell.metadataHeight = 0;
968
- this.templateData.cellHeaderContainer.style.display = 'none';
969
- this.templateData.metadataHeaderContainer.style.display = 'none';
970
- this.templateData.metadataInfoContainer.style.display = 'none';
971
- this._metadataEditor = undefined;
972
- }
973
- _buildMetadata() {
974
- this._metadataHeaderContainer = this.templateData.metadataHeaderContainer;
975
- this._metadataInfoContainer = this.templateData.metadataInfoContainer;
976
- this._metadataHeaderContainer.style.display = 'flex';
977
- this._metadataInfoContainer.style.display = 'block';
978
- this._metadataHeaderContainer.innerText = '';
979
- this._metadataInfoContainer.innerText = '';
980
- this._metadataHeader = this.instantiationService.createInstance(PropertyHeader, this.cell, this._metadataHeaderContainer, this.notebookEditor, {
981
- updateInfoRendering: this.updateMetadataRendering.bind(this),
982
- checkIfModified: () => {
983
- return this.cell.checkMetadataIfModified();
984
- },
985
- getFoldingState: () => {
986
- return this.cell.metadataFoldingState;
987
- },
988
- updateFoldingState: (state) => {
989
- this.cell.metadataFoldingState = state;
990
- },
991
- unChangedLabel: 'Metadata',
992
- changedLabel: 'Metadata changed',
993
- prefix: 'metadata',
994
- menuId: MenuId.NotebookDiffCellMetadataTitle
995
- });
996
- this._metadataLocalDisposable.add(this._metadataHeader);
997
- this._metadataHeader.buildHeader();
998
- }
999
- _buildOutput() {
1000
- this.templateData.outputHeaderContainer.style.display = 'flex';
1001
- this.templateData.outputInfoContainer.style.display = 'block';
1002
- this._outputHeaderContainer = this.templateData.outputHeaderContainer;
1003
- this._outputInfoContainer = this.templateData.outputInfoContainer;
1004
- this._outputHeaderContainer.innerText = '';
1005
- this._outputInfoContainer.innerText = '';
1006
- this._outputHeader = this.instantiationService.createInstance(PropertyHeader, this.cell, this._outputHeaderContainer, this.notebookEditor, {
1007
- updateInfoRendering: this.updateOutputRendering.bind(this),
1008
- checkIfModified: () => {
1009
- return this.cell.checkIfOutputsModified();
1010
- },
1011
- getFoldingState: () => {
1012
- return this.cell.outputFoldingState;
1013
- },
1014
- updateFoldingState: (state) => {
1015
- this.cell.outputFoldingState = state;
1016
- },
1017
- unChangedLabel: 'Outputs',
1018
- changedLabel: 'Outputs changed',
1019
- prefix: 'output',
1020
- menuId: MenuId.NotebookDiffCellOutputsTitle
1021
- });
1022
- this._outputLocalDisposable.add(this._outputHeader);
1023
- this._outputHeader.buildHeader();
1024
- }
1025
- _disposeOutput() {
1026
- this._hideOutputsRaw();
1027
- this._hideOutputsRenderer();
1028
- this._hideOutputsEmptyView();
1029
- this.cell.rawOutputHeight = 0;
1030
- this.cell.outputMetadataHeight = 0;
1031
- this.cell.outputStatusHeight = 0;
1032
- this.templateData.outputHeaderContainer.style.display = 'none';
1033
- this.templateData.outputInfoContainer.style.display = 'none';
1034
- this._outputViewContainer = undefined;
1035
- }
1036
- }
1037
- let DeletedElement = class DeletedElement extends SingleSideDiffElement {
1038
- constructor(notebookEditor, cell, templateData, languageService, modelService, textModelService, instantiationService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService) {
1039
- super(notebookEditor, cell, templateData, 'left', instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService);
1040
- }
1041
- get nestedCellViewModel() {
1042
- return this.cell.original;
1043
- }
1044
- get readonly() {
1045
- return true;
1046
- }
1047
- styleContainer(container) {
1048
- container.classList.remove('inserted');
1049
- container.classList.add('removed');
1050
- }
1051
- layout(state) {
1052
- scheduleAtNextAnimationFrame(getWindow(this._diffEditorContainer), () => {
1053
- if ((state.editorHeight || state.outerWidth) && this._editor) {
1054
- this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`;
1055
- this._editor.layout({
1056
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
1057
- height: this.cell.layoutInfo.editorHeight
1058
- });
1059
- }
1060
- if (state.outerWidth && this._editor) {
1061
- this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`;
1062
- this._editor.layout();
1063
- }
1064
- if (state.metadataHeight || state.outerWidth) {
1065
- this._metadataEditor?.layout({
1066
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
1067
- height: this.cell.layoutInfo.metadataHeight
1068
- });
1069
- }
1070
- if (state.outputTotalHeight || state.outerWidth) {
1071
- this._outputEditor?.layout({
1072
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
1073
- height: this.cell.layoutInfo.outputTotalHeight
1074
- });
1075
- }
1076
- if (this._diagonalFill) {
1077
- this._diagonalFill.style.height = `${this.calculateDiagonalFillHeight()}px`;
1078
- }
1079
- this.layoutNotebookCell();
1080
- });
1081
- }
1082
- _buildOutputRendererContainer() {
1083
- if (!this._outputViewContainer) {
1084
- this._outputViewContainer = append(this._outputInfoContainer, $('.output-view-container'));
1085
- this._outputEmptyElement = append(this._outputViewContainer, $('.output-empty-view'));
1086
- const span = append(this._outputEmptyElement, $('span'));
1087
- span.innerText = 'No outputs to render';
1088
- if (!this.cell.original?.outputs.length) {
1089
- this._outputEmptyElement.style.display = 'block';
1090
- }
1091
- else {
1092
- this._outputEmptyElement.style.display = 'none';
1093
- }
1094
- this.cell.layoutChange();
1095
- this._outputLeftView = this.instantiationService.createInstance(OutputContainer, this.notebookEditor, this.notebookEditor.textModel, this.cell, this.cell.original, DiffSide.Original, this._outputViewContainer);
1096
- this._register(this._outputLeftView);
1097
- this._outputLeftView.render();
1098
- const removedOutputRenderListener = this.notebookEditor.onDidDynamicOutputRendered(e => {
1099
- if (( e.cell.uri.toString()) === ( this.cell.original.uri.toString())) {
1100
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Original, this.cell.original.id, ['nb-cellDeleted'], []);
1101
- removedOutputRenderListener.dispose();
1102
- }
1103
- });
1104
- this._register(removedOutputRenderListener);
1105
- }
1106
- this._outputViewContainer.style.display = 'block';
1107
- }
1108
- _decorate() {
1109
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Original, this.cell.original.id, ['nb-cellDeleted'], []);
1110
- }
1111
- _showOutputsRenderer() {
1112
- if (this._outputViewContainer) {
1113
- this._outputViewContainer.style.display = 'block';
1114
- this._outputLeftView?.showOutputs();
1115
- this._decorate();
1116
- }
1117
- }
1118
- _hideOutputsRenderer() {
1119
- if (this._outputViewContainer) {
1120
- this._outputViewContainer.style.display = 'none';
1121
- this._outputLeftView?.hideOutputs();
1122
- }
1123
- }
1124
- dispose() {
1125
- if (this._editor) {
1126
- this.cell.saveSpirceEditorViewState(this._editor.saveViewState());
1127
- }
1128
- super.dispose();
1129
- }
1130
- };
1131
- DeletedElement = ( __decorate([
1132
- ( __param(3, ILanguageService)),
1133
- ( __param(4, IModelService)),
1134
- ( __param(5, ITextModelService)),
1135
- ( __param(6, IInstantiationService)),
1136
- ( __param(7, IContextMenuService)),
1137
- ( __param(8, IKeybindingService)),
1138
- ( __param(9, INotificationService)),
1139
- ( __param(10, IMenuService)),
1140
- ( __param(11, IContextKeyService)),
1141
- ( __param(12, IConfigurationService)),
1142
- ( __param(13, ITextResourceConfigurationService))
1143
- ], DeletedElement));
1144
- let InsertElement = class InsertElement extends SingleSideDiffElement {
1145
- constructor(notebookEditor, cell, templateData, instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService) {
1146
- super(notebookEditor, cell, templateData, 'right', instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService);
1147
- }
1148
- get nestedCellViewModel() {
1149
- return this.cell.modified;
1150
- }
1151
- get readonly() {
1152
- return false;
1153
- }
1154
- styleContainer(container) {
1155
- container.classList.remove('removed');
1156
- container.classList.add('inserted');
1157
- }
1158
- _buildOutputRendererContainer() {
1159
- if (!this._outputViewContainer) {
1160
- this._outputViewContainer = append(this._outputInfoContainer, $('.output-view-container'));
1161
- this._outputEmptyElement = append(this._outputViewContainer, $('.output-empty-view'));
1162
- this._outputEmptyElement.innerText = 'No outputs to render';
1163
- if (!this.cell.modified?.outputs.length) {
1164
- this._outputEmptyElement.style.display = 'block';
1165
- }
1166
- else {
1167
- this._outputEmptyElement.style.display = 'none';
1168
- }
1169
- this.cell.layoutChange();
1170
- this._outputRightView = this.instantiationService.createInstance(OutputContainer, this.notebookEditor, this.notebookEditor.textModel, this.cell, this.cell.modified, DiffSide.Modified, this._outputViewContainer);
1171
- this._register(this._outputRightView);
1172
- this._outputRightView.render();
1173
- const insertOutputRenderListener = this.notebookEditor.onDidDynamicOutputRendered(e => {
1174
- if (( e.cell.uri.toString()) === ( this.cell.modified.uri.toString())) {
1175
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Modified, this.cell.modified.id, ['nb-cellAdded'], []);
1176
- insertOutputRenderListener.dispose();
1177
- }
1178
- });
1179
- this._register(insertOutputRenderListener);
1180
- }
1181
- this._outputViewContainer.style.display = 'block';
1182
- }
1183
- _decorate() {
1184
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Modified, this.cell.modified.id, ['nb-cellAdded'], []);
1185
- }
1186
- _showOutputsRenderer() {
1187
- if (this._outputViewContainer) {
1188
- this._outputViewContainer.style.display = 'block';
1189
- this._outputRightView?.showOutputs();
1190
- this._decorate();
1191
- }
1192
- }
1193
- _hideOutputsRenderer() {
1194
- if (this._outputViewContainer) {
1195
- this._outputViewContainer.style.display = 'none';
1196
- this._outputRightView?.hideOutputs();
1197
- }
1198
- }
1199
- layout(state) {
1200
- scheduleAtNextAnimationFrame(getWindow(this._diffEditorContainer), () => {
1201
- if ((state.editorHeight || state.outerWidth) && this._editor) {
1202
- this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`;
1203
- this._editor.layout({
1204
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
1205
- height: this.cell.layoutInfo.editorHeight
1206
- });
1207
- }
1208
- if (state.outerWidth && this._editor) {
1209
- this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`;
1210
- this._editor.layout();
1211
- }
1212
- if (state.metadataHeight || state.outerWidth) {
1213
- this._metadataEditor?.layout({
1214
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
1215
- height: this.cell.layoutInfo.metadataHeight
1216
- });
1217
- }
1218
- if (state.outputTotalHeight || state.outerWidth) {
1219
- this._outputEditor?.layout({
1220
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
1221
- height: this.cell.layoutInfo.outputTotalHeight
1222
- });
1223
- }
1224
- this.layoutNotebookCell();
1225
- if (this._diagonalFill) {
1226
- this._diagonalFill.style.height = `${this.calculateDiagonalFillHeight()}px`;
1227
- }
1228
- });
1229
- }
1230
- dispose() {
1231
- if (this._editor) {
1232
- this.cell.saveSpirceEditorViewState(this._editor.saveViewState());
1233
- }
1234
- super.dispose();
1235
- }
1236
- };
1237
- InsertElement = ( __decorate([
1238
- ( __param(3, IInstantiationService)),
1239
- ( __param(4, ILanguageService)),
1240
- ( __param(5, IModelService)),
1241
- ( __param(6, ITextModelService)),
1242
- ( __param(7, IContextMenuService)),
1243
- ( __param(8, IKeybindingService)),
1244
- ( __param(9, INotificationService)),
1245
- ( __param(10, IMenuService)),
1246
- ( __param(11, IContextKeyService)),
1247
- ( __param(12, IConfigurationService)),
1248
- ( __param(13, ITextResourceConfigurationService))
1249
- ], InsertElement));
1250
- let ModifiedElement = class ModifiedElement extends AbstractElementRenderer {
1251
- constructor(notebookEditor, cell, templateData, instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService) {
1252
- super(notebookEditor, cell, templateData, 'full', instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService, textConfigurationService);
1253
- this.cell = cell;
1254
- this.templateData = templateData;
1255
- this._editorViewStateChanged = false;
1256
- this.updateBorders();
1257
- }
1258
- init() { }
1259
- styleContainer(container) {
1260
- container.classList.remove('inserted', 'removed');
1261
- }
1262
- buildBody() {
1263
- super.buildBody();
1264
- if (this.cell.displayIconToHideUnmodifiedCells) {
1265
- this._register(this.templateData.marginOverlay.onAction(() => this.cell.hideUnchangedCells()));
1266
- this.templateData.marginOverlay.show();
1267
- }
1268
- else {
1269
- this.templateData.marginOverlay.hide();
1270
- }
1271
- }
1272
- _disposeMetadata() {
1273
- this.cell.metadataStatusHeight = 0;
1274
- this.cell.metadataHeight = 0;
1275
- this.templateData.metadataHeaderContainer.style.display = 'none';
1276
- this.templateData.metadataInfoContainer.style.display = 'none';
1277
- this._metadataEditor = undefined;
1278
- }
1279
- _buildMetadata() {
1280
- this._metadataHeaderContainer = this.templateData.metadataHeaderContainer;
1281
- this._metadataInfoContainer = this.templateData.metadataInfoContainer;
1282
- this._metadataHeaderContainer.style.display = 'flex';
1283
- this._metadataInfoContainer.style.display = 'block';
1284
- this._metadataHeaderContainer.innerText = '';
1285
- this._metadataInfoContainer.innerText = '';
1286
- this._metadataHeader = this.instantiationService.createInstance(PropertyHeader, this.cell, this._metadataHeaderContainer, this.notebookEditor, {
1287
- updateInfoRendering: this.updateMetadataRendering.bind(this),
1288
- checkIfModified: () => {
1289
- return this.cell.checkMetadataIfModified();
1290
- },
1291
- getFoldingState: () => {
1292
- return this.cell.metadataFoldingState;
1293
- },
1294
- updateFoldingState: (state) => {
1295
- this.cell.metadataFoldingState = state;
1296
- },
1297
- unChangedLabel: 'Metadata',
1298
- changedLabel: 'Metadata changed',
1299
- prefix: 'metadata',
1300
- menuId: MenuId.NotebookDiffCellMetadataTitle
1301
- });
1302
- this._metadataLocalDisposable.add(this._metadataHeader);
1303
- this._metadataHeader.buildHeader();
1304
- }
1305
- _disposeOutput() {
1306
- this._hideOutputsRaw();
1307
- this._hideOutputsRenderer();
1308
- this._hideOutputsEmptyView();
1309
- this.cell.rawOutputHeight = 0;
1310
- this.cell.outputMetadataHeight = 0;
1311
- this.cell.outputStatusHeight = 0;
1312
- this.templateData.outputHeaderContainer.style.display = 'none';
1313
- this.templateData.outputInfoContainer.style.display = 'none';
1314
- this._outputViewContainer = undefined;
1315
- }
1316
- _buildOutput() {
1317
- this.templateData.outputHeaderContainer.style.display = 'flex';
1318
- this.templateData.outputInfoContainer.style.display = 'block';
1319
- this._outputHeaderContainer = this.templateData.outputHeaderContainer;
1320
- this._outputInfoContainer = this.templateData.outputInfoContainer;
1321
- this._outputHeaderContainer.innerText = '';
1322
- this._outputInfoContainer.innerText = '';
1323
- if (this.cell.checkIfOutputsModified()) {
1324
- this._outputInfoContainer.classList.add('modified');
1325
- }
1326
- else {
1327
- this._outputInfoContainer.classList.remove('modified');
1328
- }
1329
- this._outputHeader = this.instantiationService.createInstance(PropertyHeader, this.cell, this._outputHeaderContainer, this.notebookEditor, {
1330
- updateInfoRendering: this.updateOutputRendering.bind(this),
1331
- checkIfModified: () => {
1332
- return this.cell.checkIfOutputsModified();
1333
- },
1334
- getFoldingState: () => {
1335
- return this.cell.outputFoldingState;
1336
- },
1337
- updateFoldingState: (state) => {
1338
- this.cell.outputFoldingState = state;
1339
- },
1340
- unChangedLabel: 'Outputs',
1341
- changedLabel: 'Outputs changed',
1342
- prefix: 'output',
1343
- menuId: MenuId.NotebookDiffCellOutputsTitle
1344
- });
1345
- this._outputLocalDisposable.add(this._outputHeader);
1346
- this._outputHeader.buildHeader();
1347
- }
1348
- _buildOutputRendererContainer() {
1349
- if (!this._outputViewContainer) {
1350
- this._outputViewContainer = append(this._outputInfoContainer, $('.output-view-container'));
1351
- this._outputEmptyElement = append(this._outputViewContainer, $('.output-empty-view'));
1352
- this._outputEmptyElement.innerText = 'No outputs to render';
1353
- if (!this.cell.checkIfOutputsModified() && this.cell.modified.outputs.length === 0) {
1354
- this._outputEmptyElement.style.display = 'block';
1355
- }
1356
- else {
1357
- this._outputEmptyElement.style.display = 'none';
1358
- }
1359
- this.cell.layoutChange();
1360
- this._register(this.cell.modified.textModel.onDidChangeOutputs(() => {
1361
- if (!this.cell.checkIfOutputsModified() && this.cell.modified.outputs.length === 0) {
1362
- this._outputEmptyElement.style.display = 'block';
1363
- }
1364
- else {
1365
- this._outputEmptyElement.style.display = 'none';
1366
- }
1367
- this._decorate();
1368
- }));
1369
- this._outputLeftContainer = append(this._outputViewContainer, $('.output-view-container-left'));
1370
- this._outputRightContainer = append(this._outputViewContainer, $('.output-view-container-right'));
1371
- this._outputMetadataContainer = append(this._outputViewContainer, $('.output-view-container-metadata'));
1372
- const outputModified = this.cell.checkIfOutputsModified();
1373
- const outputMetadataChangeOnly = outputModified
1374
- && outputModified.kind === OutputComparison.Metadata
1375
- && this.cell.original.outputs.length === 1
1376
- && this.cell.modified.outputs.length === 1
1377
- && outputEqual(this.cell.original.outputs[0], this.cell.modified.outputs[0]) === OutputComparison.Metadata;
1378
- if (outputModified && !outputMetadataChangeOnly) {
1379
- const originalOutputRenderListener = this.notebookEditor.onDidDynamicOutputRendered(e => {
1380
- if (( e.cell.uri.toString()) === ( this.cell.original.uri.toString()) && this.cell.checkIfOutputsModified()) {
1381
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Original, this.cell.original.id, ['nb-cellDeleted'], []);
1382
- originalOutputRenderListener.dispose();
1383
- }
1384
- });
1385
- const modifiedOutputRenderListener = this.notebookEditor.onDidDynamicOutputRendered(e => {
1386
- if (( e.cell.uri.toString()) === ( this.cell.modified.uri.toString()) && this.cell.checkIfOutputsModified()) {
1387
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Modified, this.cell.modified.id, ['nb-cellAdded'], []);
1388
- modifiedOutputRenderListener.dispose();
1389
- }
1390
- });
1391
- this._register(originalOutputRenderListener);
1392
- this._register(modifiedOutputRenderListener);
1393
- }
1394
- this._outputLeftView = this.instantiationService.createInstance(OutputContainer, this.notebookEditor, this.notebookEditor.textModel, this.cell, this.cell.original, DiffSide.Original, this._outputLeftContainer);
1395
- this._outputLeftView.render();
1396
- this._register(this._outputLeftView);
1397
- this._outputRightView = this.instantiationService.createInstance(OutputContainer, this.notebookEditor, this.notebookEditor.textModel, this.cell, this.cell.modified, DiffSide.Modified, this._outputRightContainer);
1398
- this._outputRightView.render();
1399
- this._register(this._outputRightView);
1400
- if (outputModified && !outputMetadataChangeOnly) {
1401
- this._decorate();
1402
- }
1403
- if (outputMetadataChangeOnly) {
1404
- this._outputMetadataContainer.style.top = `${this.cell.layoutInfo.rawOutputHeight}px`;
1405
- this._outputMetadataEditor = this.instantiationService.createInstance(DiffEditorWidget, this._outputMetadataContainer, {
1406
- ...fixedDiffEditorOptions,
1407
- overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode(),
1408
- readOnly: true,
1409
- ignoreTrimWhitespace: false,
1410
- automaticLayout: false,
1411
- dimension: {
1412
- height: OUTPUT_EDITOR_HEIGHT_MAGIC,
1413
- width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true)
1414
- }
1415
- }, {
1416
- originalEditor: getOptimizedNestedCodeEditorWidgetOptions(),
1417
- modifiedEditor: getOptimizedNestedCodeEditorWidgetOptions()
1418
- });
1419
- this._register(this._outputMetadataEditor);
1420
- const originalOutputMetadataSource = JSON.stringify(this.cell.original.outputs[0].metadata ?? {}, undefined, '\t');
1421
- const modifiedOutputMetadataSource = JSON.stringify(this.cell.modified.outputs[0].metadata ?? {}, undefined, '\t');
1422
- const mode = this.languageService.createById('json');
1423
- const originalModel = this.modelService.createModel(originalOutputMetadataSource, mode, undefined, true);
1424
- const modifiedModel = this.modelService.createModel(modifiedOutputMetadataSource, mode, undefined, true);
1425
- this._outputMetadataEditor.setModel({
1426
- original: originalModel,
1427
- modified: modifiedModel
1428
- });
1429
- this.cell.outputMetadataHeight = this._outputMetadataEditor.getContentHeight();
1430
- this._register(this._outputMetadataEditor.onDidContentSizeChange((e) => {
1431
- this.cell.outputMetadataHeight = e.contentHeight;
1432
- }));
1433
- }
1434
- }
1435
- this._outputViewContainer.style.display = 'block';
1436
- }
1437
- _decorate() {
1438
- if (this.cell.checkIfOutputsModified()) {
1439
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Original, this.cell.original.id, ['nb-cellDeleted'], []);
1440
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Modified, this.cell.modified.id, ['nb-cellAdded'], []);
1441
- }
1442
- else {
1443
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Original, this.cell.original.id, [], ['nb-cellDeleted']);
1444
- this.notebookEditor.deltaCellOutputContainerClassNames(DiffSide.Modified, this.cell.modified.id, [], ['nb-cellAdded']);
1445
- }
1446
- }
1447
- _showOutputsRenderer() {
1448
- if (this._outputViewContainer) {
1449
- this._outputViewContainer.style.display = 'block';
1450
- this._outputLeftView?.showOutputs();
1451
- this._outputRightView?.showOutputs();
1452
- this._outputMetadataEditor?.layout({
1453
- width: this._editor?.getViewWidth() || this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
1454
- height: this.cell.layoutInfo.outputMetadataHeight
1455
- });
1456
- this._decorate();
1457
- }
1458
- }
1459
- _hideOutputsRenderer() {
1460
- if (this._outputViewContainer) {
1461
- this._outputViewContainer.style.display = 'none';
1462
- this._outputLeftView?.hideOutputs();
1463
- this._outputRightView?.hideOutputs();
1464
- }
1465
- }
1466
- updateSourceEditor() {
1467
- this._cellHeaderContainer = this.templateData.cellHeaderContainer;
1468
- this._cellHeaderContainer.style.display = 'flex';
1469
- this._cellHeaderContainer.innerText = '';
1470
- const modifiedCell = this.cell.modified;
1471
- this._editorContainer = this.templateData.editorContainer;
1472
- this._editorContainer.classList.add('diff');
1473
- const renderSourceEditor = () => {
1474
- if (this.cell.cellFoldingState === PropertyFoldingState.Collapsed) {
1475
- this._editorContainer.style.display = 'none';
1476
- this.cell.editorHeight = 0;
1477
- return;
1478
- }
1479
- const lineCount = modifiedCell.textModel.textBuffer.getLineCount();
1480
- const lineHeight = this.notebookEditor.getLayoutInfo().fontInfo.lineHeight || 17;
1481
- const editorHeight = this.cell.layoutInfo.editorHeight !== 0 ? this.cell.layoutInfo.editorHeight : this.cell.computeInputEditorHeight(lineHeight);
1482
- this._editorContainer.style.height = `${editorHeight}px`;
1483
- this._editorContainer.style.display = 'block';
1484
- if (this._editor) {
1485
- const contentHeight = this._editor.getContentHeight();
1486
- if (contentHeight >= 0) {
1487
- this.cell.editorHeight = contentHeight;
1488
- }
1489
- return;
1490
- }
1491
- this._editor = this.templateData.sourceEditor;
1492
- const options = {
1493
- padding: getEditorPadding(lineCount)
1494
- };
1495
- const unchangedRegions = this._register(getUnchangedRegionSettings(this.configurationService));
1496
- if (unchangedRegions.options.enabled) {
1497
- options.hideUnchangedRegions = unchangedRegions.options;
1498
- }
1499
- this._editor.updateOptions(options);
1500
- this._register(unchangedRegions.onDidChangeEnablement(() => {
1501
- options.hideUnchangedRegions = unchangedRegions.options;
1502
- this._editor?.updateOptions(options);
1503
- }));
1504
- this._editor.layout({
1505
- width: this.notebookEditor.getLayoutInfo().width - 2 * DIFF_CELL_MARGIN,
1506
- height: editorHeight
1507
- });
1508
- this._register(this._editor.onDidContentSizeChange((e) => {
1509
- if (this.cell.cellFoldingState === PropertyFoldingState.Expanded && e.contentHeightChanged && this.cell.layoutInfo.editorHeight !== e.contentHeight) {
1510
- this.cell.editorHeight = e.contentHeight;
1511
- }
1512
- }));
1513
- this._initializeSourceDiffEditor();
1514
- };
1515
- this._cellHeader = this._register(this.instantiationService.createInstance(PropertyHeader, this.cell, this._cellHeaderContainer, this.notebookEditor, {
1516
- updateInfoRendering: () => renderSourceEditor(),
1517
- checkIfModified: () => {
1518
- return this.cell.modified?.textModel.getTextBufferHash() !== this.cell.original?.textModel.getTextBufferHash() ? { reason: undefined } : false;
1519
- },
1520
- getFoldingState: () => this.cell.cellFoldingState,
1521
- updateFoldingState: (state) => this.cell.cellFoldingState = state,
1522
- unChangedLabel: 'Input',
1523
- changedLabel: 'Input changed',
1524
- prefix: 'input',
1525
- menuId: MenuId.NotebookDiffCellInputTitle
1526
- }));
1527
- this._cellHeader.buildHeader();
1528
- renderSourceEditor();
1529
- const scopedContextKeyService = this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);
1530
- this._register(scopedContextKeyService);
1531
- const inputChanged = NOTEBOOK_DIFF_CELL_INPUT.bindTo(scopedContextKeyService);
1532
- inputChanged.set(this.cell.modified.textModel.getTextBufferHash() !== this.cell.original.textModel.getTextBufferHash());
1533
- const ignoreWhitespace = NOTEBOOK_DIFF_CELL_IGNORE_WHITESPACE.bindTo(scopedContextKeyService);
1534
- const ignore = this.textConfigurationService.getValue(this.cell.modified.uri, 'diffEditor.ignoreTrimWhitespace');
1535
- ignoreWhitespace.set(ignore);
1536
- this._toolbar = this.templateData.toolbar;
1537
- this._toolbar.context = this.cell;
1538
- const refreshToolbar = () => {
1539
- const ignore = this.textConfigurationService.getValue(this.cell.modified.uri, 'diffEditor.ignoreTrimWhitespace');
1540
- ignoreWhitespace.set(ignore);
1541
- const hasChanges = this.cell.modified.textModel.getTextBufferHash() !== this.cell.original.textModel.getTextBufferHash();
1542
- inputChanged.set(hasChanges);
1543
- if (hasChanges) {
1544
- const menu = this.menuService.getMenuActions(MenuId.NotebookDiffCellInputTitle, scopedContextKeyService, { shouldForwardArgs: true });
1545
- const actions = getFlatActionBarActions(menu);
1546
- this._toolbar.setActions(actions);
1547
- }
1548
- else {
1549
- this._toolbar.setActions([]);
1550
- }
1551
- };
1552
- this._register(this.cell.modified.textModel.onDidChangeContent(() => refreshToolbar()));
1553
- this._register(this.textConfigurationService.onDidChangeConfiguration(e => {
1554
- if (e.affectsConfiguration(this.cell.modified.uri, 'diffEditor') &&
1555
- ( e.affectedKeys.has('diffEditor.ignoreTrimWhitespace'))) {
1556
- refreshToolbar();
1557
- }
1558
- }));
1559
- refreshToolbar();
1560
- }
1561
- async _initializeSourceDiffEditor() {
1562
- const [originalRef, modifiedRef] = await Promise.all([
1563
- this.textModelService.createModelReference(this.cell.original.uri),
1564
- this.textModelService.createModelReference(this.cell.modified.uri)
1565
- ]);
1566
- this._register(originalRef);
1567
- this._register(modifiedRef);
1568
- if (this._isDisposed) {
1569
- originalRef.dispose();
1570
- modifiedRef.dispose();
1571
- return;
1572
- }
1573
- const vm = this._register(this._editor.createViewModel({
1574
- original: originalRef.object.textEditorModel,
1575
- modified: modifiedRef.object.textEditorModel,
1576
- }));
1577
- await vm.waitForDiff();
1578
- this._editor.setModel(vm);
1579
- const handleViewStateChange = () => {
1580
- this._editorViewStateChanged = true;
1581
- };
1582
- const handleScrollChange = (e) => {
1583
- if (e.scrollTopChanged || e.scrollLeftChanged) {
1584
- this._editorViewStateChanged = true;
1585
- }
1586
- };
1587
- this.updateEditorOptionsForWhitespace();
1588
- this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(handleViewStateChange));
1589
- this._register(this._editor.getOriginalEditor().onDidScrollChange(handleScrollChange));
1590
- this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(handleViewStateChange));
1591
- this._register(this._editor.getModifiedEditor().onDidScrollChange(handleScrollChange));
1592
- const editorViewState = this.cell.getSourceEditorViewState();
1593
- if (editorViewState) {
1594
- this._editor.restoreViewState(editorViewState);
1595
- }
1596
- const contentHeight = this._editor.getContentHeight();
1597
- this.cell.editorHeight = contentHeight;
1598
- }
1599
- updateEditorOptionsForWhitespace() {
1600
- const editor = this._editor;
1601
- if (!editor) {
1602
- return;
1603
- }
1604
- const uri = editor.getModel()?.modified.uri || editor.getModel()?.original.uri;
1605
- if (!uri) {
1606
- return;
1607
- }
1608
- const ignoreTrimWhitespace = this.textConfigurationService.getValue(uri, 'diffEditor.ignoreTrimWhitespace');
1609
- editor.updateOptions({ ignoreTrimWhitespace });
1610
- this._register(this.textConfigurationService.onDidChangeConfiguration(e => {
1611
- if (e.affectsConfiguration(uri, 'diffEditor') &&
1612
- ( e.affectedKeys.has('diffEditor.ignoreTrimWhitespace'))) {
1613
- const ignoreTrimWhitespace = this.textConfigurationService.getValue(uri, 'diffEditor.ignoreTrimWhitespace');
1614
- editor.updateOptions({ ignoreTrimWhitespace });
1615
- }
1616
- }));
1617
- }
1618
- layout(state) {
1619
- scheduleAtNextAnimationFrame(getWindow(this._diffEditorContainer), () => {
1620
- if (state.editorHeight && this._editor) {
1621
- this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`;
1622
- this._editor.layout({
1623
- width: this._editor.getViewWidth(),
1624
- height: this.cell.layoutInfo.editorHeight
1625
- });
1626
- }
1627
- if (state.outerWidth && this._editor) {
1628
- this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`;
1629
- this._editor.layout();
1630
- }
1631
- if (state.metadataHeight || state.outerWidth) {
1632
- if (this._metadataEditorContainer) {
1633
- this._metadataEditorContainer.style.height = `${this.cell.layoutInfo.metadataHeight}px`;
1634
- this._metadataEditor?.layout({
1635
- width: this._editor?.getViewWidth() || this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
1636
- height: this.cell.layoutInfo.metadataHeight
1637
- });
1638
- }
1639
- }
1640
- if (state.outputTotalHeight || state.outerWidth) {
1641
- if (this._outputEditorContainer) {
1642
- this._outputEditorContainer.style.height = `${this.cell.layoutInfo.outputTotalHeight}px`;
1643
- this._outputEditor?.layout({
1644
- width: this._editor?.getViewWidth() || this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
1645
- height: this.cell.layoutInfo.outputTotalHeight
1646
- });
1647
- }
1648
- if (this._outputMetadataContainer) {
1649
- this._outputMetadataContainer.style.height = `${this.cell.layoutInfo.outputMetadataHeight}px`;
1650
- this._outputMetadataContainer.style.top = `${this.cell.layoutInfo.outputTotalHeight - this.cell.layoutInfo.outputMetadataHeight}px`;
1651
- this._outputMetadataEditor?.layout({
1652
- width: this._editor?.getViewWidth() || this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
1653
- height: this.cell.layoutInfo.outputMetadataHeight
1654
- });
1655
- }
1656
- }
1657
- this.layoutNotebookCell();
1658
- });
1659
- }
1660
- dispose() {
1661
- if (this._editor) {
1662
- this._editor.setModel(null);
1663
- }
1664
- if (this._editor && this._editorViewStateChanged) {
1665
- this.cell.saveSpirceEditorViewState(this._editor.saveViewState());
1666
- }
1667
- super.dispose();
1668
- }
1669
- };
1670
- ModifiedElement = ( __decorate([
1671
- ( __param(3, IInstantiationService)),
1672
- ( __param(4, ILanguageService)),
1673
- ( __param(5, IModelService)),
1674
- ( __param(6, ITextModelService)),
1675
- ( __param(7, IContextMenuService)),
1676
- ( __param(8, IKeybindingService)),
1677
- ( __param(9, INotificationService)),
1678
- ( __param(10, IMenuService)),
1679
- ( __param(11, IContextKeyService)),
1680
- ( __param(12, IConfigurationService)),
1681
- ( __param(13, ITextResourceConfigurationService))
1682
- ], ModifiedElement));
1683
- class CollapsedCellOverlayWidget extends Disposable {
1684
- constructor(container) {
1685
- super();
1686
- this.container = container;
1687
- this._nodes = h('div.diff-hidden-cells', [
1688
- h('div.center@content', { style: { display: 'flex' } }, [
1689
- $('a', {
1690
- title: ( localize(9468, 'Show Unchanged Cells')),
1691
- role: 'button',
1692
- onclick: () => { this._action.fire(); }
1693
- }, ...renderLabelWithIcons('$(unfold)'))
1694
- ]),
1695
- ]);
1696
- this._action = this._register(( new Emitter()));
1697
- this.onAction = this._action.event;
1698
- this._nodes.root.style.display = 'none';
1699
- container.appendChild(this._nodes.root);
1700
- }
1701
- show() {
1702
- this._nodes.root.style.display = 'block';
1703
- }
1704
- hide() {
1705
- this._nodes.root.style.display = 'none';
1706
- }
1707
- dispose() {
1708
- this.hide();
1709
- this.container.removeChild(this._nodes.root);
1710
- reset(this._nodes.root);
1711
- super.dispose();
1712
- }
1713
- }
1714
- class UnchangedCellOverlayWidget extends Disposable {
1715
- constructor(container) {
1716
- super();
1717
- this.container = container;
1718
- this._nodes = h('div.diff-hidden-cells', [
1719
- h('div.center@content', { style: { display: 'flex' } }, [
1720
- $('a', {
1721
- title: ( localize(9469, 'Hide Unchanged Cells')),
1722
- role: 'button',
1723
- onclick: () => { this._action.fire(); }
1724
- }, ...renderLabelWithIcons('$(fold)')),
1725
- ]),
1726
- ]);
1727
- this._action = this._register(( new Emitter()));
1728
- this.onAction = this._action.event;
1729
- this._nodes.root.style.display = 'none';
1730
- container.appendChild(this._nodes.root);
1731
- }
1732
- show() {
1733
- this._nodes.root.style.display = 'block';
1734
- }
1735
- hide() {
1736
- this._nodes.root.style.display = 'none';
1737
- }
1738
- dispose() {
1739
- this.hide();
1740
- this.container.removeChild(this._nodes.root);
1741
- reset(this._nodes.root);
1742
- super.dispose();
1743
- }
1744
- }
1745
-
1746
- export { CellDiffPlaceholderElement, CollapsedCellOverlayWidget, DeletedElement, InsertElement, ModifiedElement, NotebookDocumentMetadataElement, UnchangedCellOverlayWidget, getOptimizedNestedCodeEditorWidgetOptions };