@codingame/monaco-vscode-katex-common 27.0.0 → 28.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 (181) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +2 -0
  3. package/vscode/src/vs/platform/actions/browser/buttonbar.js +2 -2
  4. package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.d.ts +30 -2
  5. package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.js +1 -0
  6. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +15 -15
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +17 -11
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +5 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +90 -43
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +10 -10
  12. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +26 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +106 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
  15. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +6 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +63 -10
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +1 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +13 -10
  19. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +2 -2
  20. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +28 -2
  21. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +133 -28
  22. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +69 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +55 -46
  24. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +10 -10
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +38 -37
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +5 -5
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +1 -1
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +2 -2
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +72 -57
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +4 -4
  35. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +1 -16
  36. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +4 -110
  37. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
  38. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.d.ts +1 -1
  39. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.d.ts +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
  42. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.d.ts +1 -1
  45. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +1 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +1 -1
  48. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
  50. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
  52. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -1
  53. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
  54. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.d.ts +59 -0
  55. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.js +29 -0
  56. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.d.ts +1 -1
  57. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +2 -2
  58. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +1 -1
  59. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +1 -1
  60. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.d.ts +1 -1
  61. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +1 -1
  62. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
  63. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.d.ts +1 -1
  64. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +3 -3
  65. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +13 -13
  66. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +1 -1
  67. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +8 -6
  68. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.d.ts +15 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.js +55 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +1 -1
  71. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +6 -6
  72. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
  74. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +1 -1
  75. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +6 -4
  76. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +1 -1
  77. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +26 -6
  78. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +290 -126
  79. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +1 -1
  80. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +1 -1
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +9 -7
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.d.ts +22 -0
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +263 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +1 -1
  86. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +6 -6
  87. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +5 -5
  88. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +1 -1
  89. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +1 -1
  90. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
  91. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +1 -1
  92. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +22 -13
  93. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +12 -18
  94. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +17 -17
  95. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +1 -1
  96. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +2 -2
  97. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +3 -13
  98. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +6 -260
  99. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +1 -1
  100. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
  101. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +1 -1
  102. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
  103. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
  104. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +17 -0
  105. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +129 -117
  106. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +0 -1
  107. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +1 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +1 -1
  109. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +1 -1
  110. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
  111. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +1 -1
  112. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +8 -1
  113. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +56 -3
  114. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +5 -1
  115. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +20 -4
  116. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +1 -1
  117. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.d.ts +1 -1
  118. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +1 -1
  119. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +15 -15
  120. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +43 -1
  121. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +42 -41
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +2 -4
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +14 -14
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +1 -1
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +1 -1
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
  127. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +3 -3
  128. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +1 -1
  129. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
  130. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +1 -1
  131. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +1 -1
  132. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
  133. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +4 -2
  134. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +61 -39
  135. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.js +7 -8
  136. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +1 -10
  137. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +81 -191
  138. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
  139. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +31 -17
  140. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +334 -181
  141. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +1 -1
  142. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +7 -1
  143. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +3 -0
  144. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +51 -55
  145. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +104 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.js +127 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +5 -5
  148. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +2 -1
  149. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +16 -9
  150. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +2 -1
  151. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +22 -0
  152. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +213 -0
  153. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +1 -0
  154. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +10 -16
  155. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +6 -4
  156. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +174 -10
  157. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +2 -12
  158. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +12 -16
  159. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +1 -0
  160. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +5 -1
  161. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +36 -50
  162. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +19 -4
  163. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +22 -6
  164. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +15 -15
  165. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +3 -1
  166. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +24 -4
  167. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +3 -3
  168. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +5 -5
  169. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
  170. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
  171. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +2 -2
  172. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +1 -1
  173. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +3 -3
  174. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +1 -1
  175. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +38 -46
  176. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
  177. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
  178. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
  179. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
  180. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
  181. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +6 -10
@@ -1,13 +1,14 @@
1
1
 
2
2
  import { registerCss } from '@codingame/monaco-vscode-api/css';
3
3
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
- import { $, trackFocus, addDisposableListener, EventType, clearNode, isAncestorOfActiveElement, runAtThisOrScheduleAtNextAnimationFrame, getWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
+ import { $, trackFocus, addDisposableListener, EventType, clearNode, isHTMLElement, getWindow, isAncestorOfActiveElement, runAtThisOrScheduleAtNextAnimationFrame, DisposableResizeObserver } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
5
5
  import { renderAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
6
6
  import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
7
7
  import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
8
8
  import { isMarkdownString, MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
9
9
  import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
10
- import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
10
+ import { Disposable, DisposableStore, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
11
+ import { isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
11
12
  import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
12
13
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
13
14
  import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
@@ -15,7 +16,9 @@ import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs
15
16
  import { defaultButtonStyles, defaultInputBoxStyles, defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
16
17
  import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
17
18
  import { InputBox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/inputbox/inputBox';
19
+ import { DomScrollableElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
18
20
  import { Checkbox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
21
+ import { ChatQuestionCarouselData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatQuestionCarouselData';
19
22
  import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
20
23
  import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
21
24
  import { HoverPosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverWidget';
@@ -23,6 +26,7 @@ import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/h
23
26
  import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
24
27
  import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
25
28
  import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
29
+ import { ScrollbarVisibility } from '@codingame/monaco-vscode-api/vscode/vs/base/common/scrollable';
26
30
  import * as chatQuestionCarousel from './media/chatQuestionCarousel.css';
27
31
 
28
32
  registerCss(chatQuestionCarousel);
@@ -51,7 +55,6 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
51
55
  this.onDidChangeHeight = this._onDidChangeHeight.event;
52
56
  this._currentIndex = 0;
53
57
  this._answers = ( new Map());
54
- this._nextButtonHover = this._register(( new MutableDisposable()));
55
58
  this._isSkipped = false;
56
59
  this._textInputBoxes = ( new Map());
57
60
  this._singleSelectItems = ( new Map());
@@ -74,8 +77,18 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
74
77
  });
75
78
  this.domNode.tabIndex = 0;
76
79
  this.domNode.setAttribute("role", "region");
77
- this.domNode.setAttribute("aria-roledescription", ( localize(6452, "chat question")));
80
+ this.domNode.setAttribute("aria-roledescription", ( localize(6542, "chat question")));
78
81
  this._updateAriaLabel();
82
+ if (carousel instanceof ChatQuestionCarouselData) {
83
+ if (typeof carousel.draftCurrentIndex === "number") {
84
+ this._currentIndex = Math.max(0, Math.min(carousel.draftCurrentIndex, carousel.questions.length - 1));
85
+ }
86
+ if (carousel.draftAnswers) {
87
+ for (const [key, value] of Object.entries(carousel.draftAnswers)) {
88
+ this._answers.set(key, value);
89
+ }
90
+ }
91
+ }
79
92
  if (carousel.data) {
80
93
  for (const [key, value] of Object.entries(carousel.data)) {
81
94
  this._answers.set(key, value);
@@ -94,54 +107,20 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
94
107
  this.domNode.append(this._questionContainer);
95
108
  if (carousel.allowSkip) {
96
109
  this._closeButtonContainer = $(".chat-question-close-container");
97
- const skipAllTitle = ( localize(6453, "Skip all questions"));
110
+ const skipAllTitle = ( localize(6543, "Skip all questions"));
98
111
  const skipAllButton = interactiveStore.add(( new Button(this._closeButtonContainer, {
99
112
  ...defaultButtonStyles,
100
113
  secondary: true,
101
114
  supportIcons: true
102
115
  })));
103
116
  skipAllButton.label = `$(${Codicon.close.id})`;
104
- skipAllButton.element.classList.add("chat-question-nav-arrow", "chat-question-close");
117
+ skipAllButton.element.classList.add("chat-question-close");
105
118
  skipAllButton.element.setAttribute("aria-label", skipAllTitle);
106
119
  interactiveStore.add(this._hoverService.setupDelayedHover(skipAllButton.element, {
107
120
  content: skipAllTitle
108
121
  }));
109
122
  this._skipAllButton = skipAllButton;
110
123
  }
111
- this._footerRow = $(".chat-question-footer-row");
112
- this._stepIndicator = $(".chat-question-step-indicator");
113
- this._footerRow.appendChild(this._stepIndicator);
114
- this._navigationButtons = $(".chat-question-carousel-nav");
115
- this._navigationButtons.setAttribute("role", "navigation");
116
- this._navigationButtons.setAttribute("aria-label", ( localize(6454, "Question navigation")));
117
- const arrowsContainer = $(".chat-question-nav-arrows");
118
- const previousLabel = ( localize(6455, "Previous"));
119
- const previousLabelWithKeybinding = this.getLabelWithKeybinding(previousLabel, PREVIOUS_QUESTION_ACTION_ID);
120
- const prevButton = interactiveStore.add(( new Button(arrowsContainer, {
121
- ...defaultButtonStyles,
122
- secondary: true,
123
- supportIcons: true
124
- })));
125
- prevButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-prev");
126
- prevButton.label = `$(${Codicon.chevronLeft.id})`;
127
- prevButton.element.setAttribute("aria-label", previousLabelWithKeybinding);
128
- interactiveStore.add(this._hoverService.setupDelayedHover(prevButton.element, {
129
- content: previousLabelWithKeybinding
130
- }));
131
- this._prevButton = prevButton;
132
- const nextButton = interactiveStore.add(( new Button(arrowsContainer, {
133
- ...defaultButtonStyles,
134
- secondary: true,
135
- supportIcons: true
136
- })));
137
- nextButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-next");
138
- nextButton.label = `$(${Codicon.chevronRight.id})`;
139
- this._nextButton = nextButton;
140
- this._navigationButtons.appendChild(arrowsContainer);
141
- this._footerRow.appendChild(this._navigationButtons);
142
- this.domNode.append(this._footerRow);
143
- interactiveStore.add(prevButton.onDidClick(() => this.navigate(-1)));
144
- interactiveStore.add(nextButton.onDidClick(() => this.handleNext()));
145
124
  if (this._skipAllButton) {
146
125
  interactiveStore.add(this._skipAllButton.onDidClick(() => this.ignore()));
147
126
  }
@@ -151,6 +130,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
151
130
  e.preventDefault();
152
131
  e.stopPropagation();
153
132
  this.ignore();
133
+ } else if (event.keyCode === KeyCode.Enter && (event.metaKey || event.ctrlKey)) {
134
+ e.preventDefault();
135
+ e.stopPropagation();
136
+ this.submit();
154
137
  } else if (event.keyCode === KeyCode.Enter && !event.shiftKey) {
155
138
  const target = e.target;
156
139
  const isTextInput = target.tagName === "INPUT" && target.type === "text";
@@ -158,7 +141,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
158
141
  if (isTextInput || isFreeformTextarea) {
159
142
  e.preventDefault();
160
143
  e.stopPropagation();
161
- this.handleNext();
144
+ this.handleNextOrSubmit();
162
145
  }
163
146
  } else if ((event.ctrlKey || event.metaKey) && (event.keyCode === KeyCode.Backspace || event.keyCode === KeyCode.Delete)) {
164
147
  e.stopPropagation();
@@ -171,26 +154,44 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
171
154
  const answer = this.getCurrentAnswer();
172
155
  if (answer !== undefined) {
173
156
  this._answers.set(currentQuestion.id, answer);
157
+ } else {
158
+ this._answers.delete(currentQuestion.id);
174
159
  }
160
+ this.persistDraftState();
161
+ }
162
+ persistDraftState() {
163
+ if (this.carousel.isUsed || !(this.carousel instanceof ChatQuestionCarouselData)) {
164
+ return;
165
+ }
166
+ this.carousel.draftAnswers = Object.fromEntries(this._answers.entries());
167
+ this.carousel.draftCurrentIndex = this._currentIndex;
175
168
  }
176
169
  navigate(delta) {
177
170
  const newIndex = this._currentIndex + delta;
178
171
  if (newIndex >= 0 && newIndex < this.carousel.questions.length) {
179
172
  this.saveCurrentAnswer();
180
173
  this._currentIndex = newIndex;
174
+ this.persistDraftState();
181
175
  this.renderCurrentQuestion(true);
176
+ this.domNode.focus();
182
177
  }
183
178
  }
184
- handleNext() {
179
+ handleNextOrSubmit() {
185
180
  this.saveCurrentAnswer();
186
181
  if (this._currentIndex < this.carousel.questions.length - 1) {
187
182
  this._currentIndex++;
183
+ this.persistDraftState();
188
184
  this.renderCurrentQuestion(true);
189
185
  } else {
190
186
  this._options.onSubmit(this._answers);
191
187
  this.hideAndShowSummary();
192
188
  }
193
189
  }
190
+ submit() {
191
+ this.saveCurrentAnswer();
192
+ this._options.onSubmit(this._answers);
193
+ this.hideAndShowSummary();
194
+ }
194
195
  _focusContainerAndAnnounce() {
195
196
  this.domNode.focus();
196
197
  const question = this.carousel.questions[this._currentIndex];
@@ -199,7 +200,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
199
200
  const messageContent = this.getQuestionText(questionText);
200
201
  const questionCount = this.carousel.questions.length;
201
202
  const alertMessage = questionCount === 1 ? messageContent : ( localize(
202
- 6456,
203
+ 6544,
203
204
  "Question {0} of {1}: {2}",
204
205
  this._currentIndex + 1,
205
206
  questionCount,
@@ -226,12 +227,49 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
226
227
  this._freeformTextareas.clear();
227
228
  this._prevButton = undefined;
228
229
  this._nextButton = undefined;
230
+ this._submitButton = undefined;
229
231
  this._skipAllButton = undefined;
230
232
  this._questionContainer = undefined;
231
- this._navigationButtons = undefined;
232
233
  this._closeButtonContainer = undefined;
233
234
  this._footerRow = undefined;
234
235
  this._stepIndicator = undefined;
236
+ this._submitHint = undefined;
237
+ this._inputScrollable = undefined;
238
+ }
239
+ layoutInputScrollable(inputScrollable) {
240
+ if (!this._questionContainer) {
241
+ return;
242
+ }
243
+ const scrollableNode = inputScrollable.getDomNode();
244
+ const scrollableContent = scrollableNode.firstElementChild;
245
+ if (!isHTMLElement(scrollableContent)) {
246
+ return;
247
+ }
248
+ if (scrollableNode.style.height !== "" || scrollableNode.style.maxHeight !== "") {
249
+ scrollableNode.style.height = "";
250
+ scrollableNode.style.maxHeight = "";
251
+ }
252
+ if (scrollableContent.style.height !== "" || scrollableContent.style.maxHeight !== "") {
253
+ scrollableContent.style.height = "";
254
+ scrollableContent.style.maxHeight = "";
255
+ }
256
+ const maxContainerHeight = this._questionContainer.clientHeight;
257
+ const computedStyle = getWindow(this._questionContainer).getComputedStyle(this._questionContainer);
258
+ const contentVerticalPadding = Number.parseFloat(computedStyle.paddingTop || "0") + Number.parseFloat(computedStyle.paddingBottom || "0");
259
+ const nonScrollableContentHeight = Array.from(this._questionContainer.children).filter(child => child !== scrollableNode).reduce((sum, child) => sum + child.offsetHeight, 0);
260
+ const availableScrollableHeight = Math.floor(maxContainerHeight - contentVerticalPadding - nonScrollableContentHeight);
261
+ const contentScrollableHeight = scrollableContent.scrollHeight;
262
+ const constrainedScrollableHeight = Math.max(0, Math.min(availableScrollableHeight, contentScrollableHeight));
263
+ const constrainedScrollableHeightPx = `${constrainedScrollableHeight}px`;
264
+ if (scrollableNode.style.height !== constrainedScrollableHeightPx || scrollableNode.style.maxHeight !== constrainedScrollableHeightPx) {
265
+ scrollableNode.style.height = constrainedScrollableHeightPx;
266
+ scrollableNode.style.maxHeight = constrainedScrollableHeightPx;
267
+ }
268
+ if (scrollableContent.style.height !== constrainedScrollableHeightPx || scrollableContent.style.maxHeight !== constrainedScrollableHeightPx) {
269
+ scrollableContent.style.height = constrainedScrollableHeightPx;
270
+ scrollableContent.style.maxHeight = constrainedScrollableHeightPx;
271
+ }
272
+ inputScrollable.scanDomNode();
235
273
  }
236
274
  skip() {
237
275
  if (this._isSkipped || !this.carousel.allowSkip) {
@@ -305,17 +343,17 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
305
343
  _updateAriaLabel() {
306
344
  const question = this.carousel.questions[this._currentIndex];
307
345
  if (!question) {
308
- this.domNode.setAttribute("aria-label", ( localize(6457, "Chat question")));
346
+ this.domNode.setAttribute("aria-label", ( localize(6545, "Chat question")));
309
347
  return;
310
348
  }
311
349
  const questionText = question.message ?? question.title;
312
350
  const messageContent = this.getQuestionText(questionText);
313
351
  const questionCount = this.carousel.questions.length;
314
352
  if (questionCount === 1) {
315
- this.domNode.setAttribute("aria-label", ( localize(6458, "Chat question: {0}", messageContent)));
353
+ this.domNode.setAttribute("aria-label", ( localize(6546, "Chat question: {0}", messageContent)));
316
354
  } else {
317
355
  this.domNode.setAttribute("aria-label", ( localize(
318
- 6459,
356
+ 6547,
319
357
  "Chat question {0} of {1}: {2}",
320
358
  this._currentIndex + 1,
321
359
  questionCount,
@@ -344,11 +382,12 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
344
382
  return true;
345
383
  }
346
384
  renderCurrentQuestion(focusContainerForScreenReader = false) {
347
- if (!this._questionContainer || !this._prevButton || !this._nextButton) {
385
+ if (!this._questionContainer) {
348
386
  return;
349
387
  }
350
388
  const questionRenderStore = ( new DisposableStore());
351
389
  this._questionRenderStore.value = questionRenderStore;
390
+ this._inputScrollable = undefined;
352
391
  this._inputBoxes.clear();
353
392
  this._textInputBoxes.clear();
354
393
  this._singleSelectItems.clear();
@@ -360,72 +399,180 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
360
399
  return;
361
400
  }
362
401
  const headerRow = $(".chat-question-header-row");
402
+ const titleRow = $(".chat-question-title-row");
363
403
  const questionText = question.message ?? question.title;
364
404
  if (questionText) {
365
405
  const title = $(".chat-question-title");
366
406
  const messageContent = this.getQuestionText(questionText);
367
407
  title.setAttribute("aria-label", messageContent);
368
- if (question.message !== undefined) {
369
- const messageMd = isMarkdownString(questionText) ? MarkdownString.lift(questionText) : ( new MarkdownString(questionText));
370
- const renderedTitle = questionRenderStore.add(this._markdownRendererService.render(messageMd));
371
- title.appendChild(renderedTitle.element);
372
- } else {
373
- const parenMatch = messageContent.match(/^(.+?)\s*(\([^)]+\))\s*$/);
374
- if (parenMatch) {
375
- const mainTitle = $("span.chat-question-title-main");
376
- mainTitle.textContent = parenMatch[1];
377
- title.appendChild(mainTitle);
378
- const subtitle = $("span.chat-question-title-subtitle");
379
- subtitle.textContent = " " + parenMatch[2];
380
- title.appendChild(subtitle);
381
- } else {
382
- title.textContent = messageContent;
383
- }
384
- }
385
- headerRow.appendChild(title);
408
+ const messageMd = isMarkdownString(questionText) ? MarkdownString.lift(questionText) : ( new MarkdownString(questionText));
409
+ const renderedTitle = questionRenderStore.add(this._markdownRendererService.render(messageMd));
410
+ title.appendChild(renderedTitle.element);
411
+ titleRow.appendChild(title);
386
412
  }
413
+ headerRow.appendChild(titleRow);
387
414
  if (this._closeButtonContainer) {
388
- headerRow.appendChild(this._closeButtonContainer);
415
+ titleRow.appendChild(this._closeButtonContainer);
389
416
  }
390
417
  this._questionContainer.appendChild(headerRow);
391
- const isSingleQuestion = this.carousel.questions.length === 1;
392
- if (this._stepIndicator) {
393
- this._stepIndicator.textContent = `${this._currentIndex + 1}/${this.carousel.questions.length}`;
394
- this._stepIndicator.style.display = isSingleQuestion ? "none" : "";
395
- }
396
418
  const inputContainer = $(".chat-question-input-container");
397
419
  this.renderInput(inputContainer, question);
398
- this._questionContainer.appendChild(inputContainer);
399
- this._prevButton.enabled = this._currentIndex > 0;
400
- this._prevButton.element.style.display = isSingleQuestion ? "none" : "";
401
- const isLastQuestion = this._currentIndex === this.carousel.questions.length - 1;
402
- const submitLabel = ( localize(6460, "Submit"));
403
- const nextLabel = ( localize(6461, "Next"));
404
- const nextLabelWithKeybinding = this.getLabelWithKeybinding(nextLabel, NEXT_QUESTION_ACTION_ID);
405
- if (isLastQuestion) {
406
- this._nextButton.label = submitLabel;
407
- this._nextButton.element.setAttribute("aria-label", submitLabel);
408
- this._nextButton.element.classList.add("chat-question-nav-submit");
409
- this._nextButtonHover.value = this._hoverService.setupDelayedHover(this._nextButton.element, {
410
- content: submitLabel
411
- });
420
+ const inputScrollable = questionRenderStore.add(( new DomScrollableElement(inputContainer, {
421
+ vertical: ScrollbarVisibility.Visible,
422
+ horizontal: ScrollbarVisibility.Hidden,
423
+ consumeMouseWheelIfScrollbarIsNeeded: true
424
+ })));
425
+ this._inputScrollable = inputScrollable;
426
+ const inputScrollableNode = inputScrollable.getDomNode();
427
+ inputScrollableNode.classList.add("chat-question-input-scrollable");
428
+ this._questionContainer.appendChild(inputScrollableNode);
429
+ const isSingleQuestion = this.carousel.questions.length === 1;
430
+ if (!isSingleQuestion) {
431
+ this.renderFooter();
412
432
  } else {
413
- this._nextButton.label = `$(${Codicon.chevronRight.id})`;
414
- this._nextButton.element.setAttribute("aria-label", nextLabelWithKeybinding);
415
- this._nextButton.element.classList.remove("chat-question-nav-submit");
416
- this._nextButtonHover.value = this._hoverService.setupDelayedHover(this._nextButton.element, {
417
- content: nextLabelWithKeybinding
418
- });
433
+ this.renderSingleQuestionFooter();
419
434
  }
435
+ let relayoutScheduled = false;
436
+ const relayoutScheduler = questionRenderStore.add(( new MutableDisposable()));
437
+ const scheduleLayoutInputScrollable = () => {
438
+ if (relayoutScheduled) {
439
+ return;
440
+ }
441
+ relayoutScheduled = true;
442
+ relayoutScheduler.value = runAtThisOrScheduleAtNextAnimationFrame(getWindow(this.domNode), () => {
443
+ relayoutScheduled = false;
444
+ this.layoutInputScrollable(inputScrollable);
445
+ });
446
+ };
447
+ const inputResizeObserver = questionRenderStore.add(new DisposableResizeObserver(() => scheduleLayoutInputScrollable()));
448
+ questionRenderStore.add(inputResizeObserver.observe(inputScrollableNode));
449
+ questionRenderStore.add(inputResizeObserver.observe(inputContainer));
450
+ scheduleLayoutInputScrollable();
451
+ questionRenderStore.add(
452
+ runAtThisOrScheduleAtNextAnimationFrame(getWindow(this.domNode), () => {
453
+ inputContainer.scrollTop = 0;
454
+ inputContainer.scrollLeft = 0;
455
+ inputScrollable.setScrollPosition({
456
+ scrollTop: 0,
457
+ scrollLeft: 0
458
+ });
459
+ inputScrollable.scanDomNode();
460
+ })
461
+ );
420
462
  this._updateAriaLabel();
421
463
  if (focusContainerForScreenReader && this._accessibilityService.isScreenReaderOptimized()) {
422
464
  this._focusContainerAndAnnounce();
423
465
  }
424
466
  this._onDidChangeHeight.fire();
425
467
  }
468
+ renderFooter() {
469
+ if (!this._footerRow) {
470
+ const interactiveStore = this._interactiveUIStore.value;
471
+ if (!interactiveStore) {
472
+ return;
473
+ }
474
+ this._footerRow = $(".chat-question-footer-row");
475
+ const leftControls = $(".chat-question-footer-left.chat-question-carousel-nav");
476
+ leftControls.setAttribute("role", "navigation");
477
+ leftControls.setAttribute("aria-label", ( localize(6548, "Question navigation")));
478
+ const arrowsContainer = $(".chat-question-nav-arrows");
479
+ const previousLabel = this.getLabelWithKeybinding(( localize(6549, "Previous")), PREVIOUS_QUESTION_ACTION_ID);
480
+ const prevButton = interactiveStore.add(( new Button(arrowsContainer, {
481
+ ...defaultButtonStyles,
482
+ secondary: true,
483
+ supportIcons: true
484
+ })));
485
+ prevButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-prev");
486
+ prevButton.label = `$(${Codicon.chevronLeft.id})`;
487
+ prevButton.element.setAttribute("aria-label", previousLabel);
488
+ interactiveStore.add(this._hoverService.setupDelayedHover(prevButton.element, {
489
+ content: previousLabel
490
+ }));
491
+ interactiveStore.add(prevButton.onDidClick(() => this.navigate(-1)));
492
+ this._prevButton = prevButton;
493
+ const nextLabel = this.getLabelWithKeybinding(( localize(6550, "Next")), NEXT_QUESTION_ACTION_ID);
494
+ const nextButton = interactiveStore.add(( new Button(arrowsContainer, {
495
+ ...defaultButtonStyles,
496
+ secondary: true,
497
+ supportIcons: true
498
+ })));
499
+ nextButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-next");
500
+ nextButton.label = `$(${Codicon.chevronRight.id})`;
501
+ nextButton.element.setAttribute("aria-label", nextLabel);
502
+ interactiveStore.add(this._hoverService.setupDelayedHover(nextButton.element, {
503
+ content: nextLabel
504
+ }));
505
+ interactiveStore.add(nextButton.onDidClick(() => this.navigate(1)));
506
+ this._nextButton = nextButton;
507
+ leftControls.appendChild(arrowsContainer);
508
+ this._stepIndicator = $(".chat-question-step-indicator");
509
+ leftControls.appendChild(this._stepIndicator);
510
+ this._footerRow.appendChild(leftControls);
511
+ const rightControls = $(".chat-question-footer-right");
512
+ const hint = $("span.chat-question-submit-hint");
513
+ hint.textContent = isMacintosh ? ( localize(6551, "⌘⏎ to submit")) : ( localize(6552, "Ctrl+Enter to submit"));
514
+ rightControls.appendChild(hint);
515
+ this._submitHint = hint;
516
+ const submitButton = interactiveStore.add(( new Button(rightControls, {
517
+ ...defaultButtonStyles
518
+ })));
519
+ submitButton.element.classList.add("chat-question-submit-button");
520
+ submitButton.label = ( localize(6553, "Submit"));
521
+ interactiveStore.add(submitButton.onDidClick(() => this.submit()));
522
+ this._submitButton = submitButton;
523
+ this._footerRow.appendChild(rightControls);
524
+ this.domNode.append(this._footerRow);
525
+ }
526
+ this.updateFooterState();
527
+ }
528
+ updateFooterState() {
529
+ if (this._prevButton) {
530
+ this._prevButton.enabled = this._currentIndex > 0;
531
+ }
532
+ if (this._nextButton) {
533
+ this._nextButton.enabled = this._currentIndex < this.carousel.questions.length - 1;
534
+ }
535
+ if (this._stepIndicator) {
536
+ this._stepIndicator.textContent = ( localize(6554, "{0}/{1}", this._currentIndex + 1, this.carousel.questions.length));
537
+ }
538
+ if (this._submitButton) {
539
+ const isLastQuestion = this._currentIndex === this.carousel.questions.length - 1;
540
+ this._submitButton.element.style.display = isLastQuestion ? "" : "none";
541
+ if (this._submitHint) {
542
+ this._submitHint.style.display = isLastQuestion ? "" : "none";
543
+ }
544
+ }
545
+ }
546
+ renderSingleQuestionFooter() {
547
+ if (!this._footerRow) {
548
+ const interactiveStore = this._interactiveUIStore.value;
549
+ if (!interactiveStore) {
550
+ return;
551
+ }
552
+ this._footerRow = $(".chat-question-footer-row");
553
+ const leftControls = $(".chat-question-footer-left.chat-question-carousel-nav");
554
+ leftControls.setAttribute("role", "navigation");
555
+ leftControls.setAttribute("aria-label", ( localize(6548, "Question navigation")));
556
+ this._footerRow.appendChild(leftControls);
557
+ const rightControls = $(".chat-question-footer-right");
558
+ const hint = $("span.chat-question-submit-hint");
559
+ hint.textContent = isMacintosh ? ( localize(6551, "⌘⏎ to submit")) : ( localize(6552, "Ctrl+Enter to submit"));
560
+ rightControls.appendChild(hint);
561
+ this._submitHint = hint;
562
+ const submitButton = interactiveStore.add(( new Button(rightControls, {
563
+ ...defaultButtonStyles
564
+ })));
565
+ submitButton.element.classList.add("chat-question-submit-button");
566
+ submitButton.label = ( localize(6553, "Submit"));
567
+ interactiveStore.add(submitButton.onDidClick(() => this.submit()));
568
+ this._submitButton = submitButton;
569
+ this._footerRow.appendChild(rightControls);
570
+ this.domNode.append(this._footerRow);
571
+ }
572
+ }
426
573
  getLabelWithKeybinding(label, actionId) {
427
574
  const keybindingLabel = this._keybindingService.lookupKeybinding(actionId, this._contextKeyService)?.getLabel();
428
- return keybindingLabel ? ( localize(6462, "{0} ({1})", label, keybindingLabel)) : label;
575
+ return keybindingLabel ? ( localize(6555, "{0} ({1})", label, keybindingLabel)) : label;
429
576
  }
430
577
  renderInput(container, question) {
431
578
  switch (question.type) {
@@ -444,6 +591,9 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
444
591
  const autoResize = () => {
445
592
  textarea.style.height = "auto";
446
593
  textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
594
+ if (this._inputScrollable) {
595
+ this.layoutInputScrollable(this._inputScrollable);
596
+ }
447
597
  this._onDidChangeHeight.fire();
448
598
  };
449
599
  this._inputBoxes.add(addDisposableListener(textarea, EventType.INPUT, autoResize));
@@ -451,9 +601,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
451
601
  }
452
602
  renderTextInput(container, question) {
453
603
  const inputBox = this._inputBoxes.add(( new InputBox(container, undefined, {
454
- placeholder: ( localize(6463, "Enter your answer")),
604
+ placeholder: ( localize(6556, "Enter your answer")),
455
605
  inputBoxStyles: defaultInputBoxStyles
456
606
  })));
607
+ this._inputBoxes.add(inputBox.onDidChange(() => this.saveCurrentAnswer()));
457
608
  const previousAnswer = this._answers.get(question.id);
458
609
  if (previousAnswer !== undefined) {
459
610
  inputBox.value = String(previousAnswer);
@@ -508,13 +659,14 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
508
659
  if (data) {
509
660
  data.selectedIndex = newIndex;
510
661
  }
662
+ this.saveCurrentAnswer();
511
663
  };
512
664
  options.forEach((option, index) => {
513
665
  const isSelected = index === selectedIndex;
514
666
  const listItem = $(".chat-question-list-item");
515
667
  listItem.setAttribute("role", "option");
516
668
  listItem.setAttribute("aria-selected", String(isSelected));
517
- listItem.setAttribute("aria-label", ( localize(6464, "Option {0}: {1}", index + 1, option.label)));
669
+ listItem.setAttribute("aria-label", ( localize(6557, "Option {0}: {1}", index + 1, option.label)));
518
670
  listItem.id = `option-${question.id}-${index}`;
519
671
  listItem.tabIndex = -1;
520
672
  const number = $(".chat-question-list-number");
@@ -528,11 +680,12 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
528
680
  const label = $(".chat-question-list-label");
529
681
  const separatorIndex = option.label.indexOf(" - ");
530
682
  if (separatorIndex !== -1) {
683
+ listItem.classList.add("has-description");
531
684
  const titleSpan = $("span.chat-question-list-label-title");
532
685
  titleSpan.textContent = option.label.substring(0, separatorIndex);
533
686
  label.appendChild(titleSpan);
534
687
  const descSpan = $("span.chat-question-list-label-desc");
535
- descSpan.textContent = ": " + option.label.substring(separatorIndex + 3);
688
+ descSpan.textContent = option.label.substring(separatorIndex + 3);
536
689
  label.appendChild(descSpan);
537
690
  } else {
538
691
  label.textContent = option.label;
@@ -550,7 +703,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
550
703
  if (freeform) {
551
704
  freeform.value = "";
552
705
  }
553
- this.handleNext();
706
+ this.handleNextOrSubmit();
554
707
  }));
555
708
  this._inputBoxes.add(this._hoverService.setupDelayedHover(listItem, {
556
709
  content: option.label,
@@ -576,7 +729,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
576
729
  freeformNumber.textContent = `${options.length + 1}`;
577
730
  freeformContainer.appendChild(freeformNumber);
578
731
  const freeformTextarea = $("textarea.chat-question-freeform-textarea");
579
- freeformTextarea.placeholder = ( localize(6465, "Enter custom answer"));
732
+ freeformTextarea.placeholder = ( localize(6558, "Enter custom answer"));
580
733
  freeformTextarea.rows = 1;
581
734
  if (previousFreeform !== undefined) {
582
735
  freeformTextarea.value = previousFreeform;
@@ -585,6 +738,8 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
585
738
  this._inputBoxes.add(addDisposableListener(freeformTextarea, EventType.INPUT, () => {
586
739
  if (freeformTextarea.value.length > 0) {
587
740
  updateSelection(-1);
741
+ } else {
742
+ this.saveCurrentAnswer();
588
743
  }
589
744
  }));
590
745
  freeformContainer.appendChild(freeformTextarea);
@@ -603,10 +758,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
603
758
  } else if (event.keyCode === KeyCode.UpArrow) {
604
759
  e.preventDefault();
605
760
  newIndex = Math.max(data.selectedIndex - 1, 0);
606
- } else if (event.keyCode === KeyCode.Enter || event.keyCode === KeyCode.Space) {
761
+ } else if ((event.keyCode === KeyCode.Enter || event.keyCode === KeyCode.Space) && !event.metaKey && !event.ctrlKey) {
607
762
  e.preventDefault();
608
763
  e.stopPropagation();
609
- this.handleNext();
764
+ this.handleNextOrSubmit();
610
765
  return;
611
766
  } else if (event.keyCode >= KeyCode.Digit1 && event.keyCode <= KeyCode.Digit9) {
612
767
  const numberIndex = event.keyCode - KeyCode.Digit1;
@@ -679,7 +834,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
679
834
  const listItem = $(".chat-question-list-item.multi-select");
680
835
  listItem.setAttribute("role", "option");
681
836
  listItem.setAttribute("aria-selected", String(isChecked));
682
- listItem.setAttribute("aria-label", ( localize(6464, "Option {0}: {1}", index + 1, option.label)));
837
+ listItem.setAttribute("aria-label", ( localize(6557, "Option {0}: {1}", index + 1, option.label)));
683
838
  listItem.id = `option-${question.id}-${index}`;
684
839
  listItem.tabIndex = -1;
685
840
  const number = $(".chat-question-list-number");
@@ -692,11 +847,12 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
692
847
  const label = $(".chat-question-list-label");
693
848
  const separatorIndex = option.label.indexOf(" - ");
694
849
  if (separatorIndex !== -1) {
850
+ listItem.classList.add("has-description");
695
851
  const titleSpan = $("span.chat-question-list-label-title");
696
852
  titleSpan.textContent = option.label.substring(0, separatorIndex);
697
853
  label.appendChild(titleSpan);
698
854
  const descSpan = $("span.chat-question-list-label-desc");
699
- descSpan.textContent = ": " + option.label.substring(separatorIndex + 3);
855
+ descSpan.textContent = option.label.substring(separatorIndex + 3);
700
856
  label.appendChild(descSpan);
701
857
  } else {
702
858
  label.textContent = option.label;
@@ -711,6 +867,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
711
867
  this._inputBoxes.add(checkbox.onChange(() => {
712
868
  listItem.classList.toggle("checked", checkbox.checked);
713
869
  listItem.setAttribute("aria-selected", String(checkbox.checked));
870
+ this.saveCurrentAnswer();
714
871
  }));
715
872
  this._inputBoxes.add(addDisposableListener(listItem, EventType.CLICK, e => {
716
873
  focusedIndex = index;
@@ -737,12 +894,15 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
737
894
  freeformNumber.textContent = `${options.length + 1}`;
738
895
  freeformContainer.appendChild(freeformNumber);
739
896
  const freeformTextarea = $("textarea.chat-question-freeform-textarea");
740
- freeformTextarea.placeholder = ( localize(6465, "Enter custom answer"));
897
+ freeformTextarea.placeholder = ( localize(6558, "Enter custom answer"));
741
898
  freeformTextarea.rows = 1;
742
899
  if (previousFreeform !== undefined) {
743
900
  freeformTextarea.value = previousFreeform;
744
901
  }
745
902
  const autoResize = this.setupTextareaAutoResize(freeformTextarea);
903
+ this._inputBoxes.add(
904
+ addDisposableListener(freeformTextarea, EventType.INPUT, () => this.saveCurrentAnswer())
905
+ );
746
906
  freeformContainer.appendChild(freeformTextarea);
747
907
  container.appendChild(freeformContainer);
748
908
  this._freeformTextareas.set(question.id, freeformTextarea);
@@ -759,10 +919,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
759
919
  e.preventDefault();
760
920
  focusedIndex = Math.max(focusedIndex - 1, 0);
761
921
  listItems[focusedIndex].focus();
762
- } else if (event.keyCode === KeyCode.Enter) {
922
+ } else if (event.keyCode === KeyCode.Enter && !event.metaKey && !event.ctrlKey) {
763
923
  e.preventDefault();
764
924
  e.stopPropagation();
765
- this.handleNext();
925
+ this.handleNextOrSubmit();
766
926
  } else if (event.keyCode === KeyCode.Space) {
767
927
  e.preventDefault();
768
928
  if (focusedIndex >= 0 && focusedIndex < checkboxes.length) {
@@ -871,7 +1031,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
871
1031
  renderSkippedMessage() {
872
1032
  const skippedContainer = $(".chat-question-carousel-summary");
873
1033
  const skippedMessage = $(".chat-question-summary-skipped");
874
- skippedMessage.textContent = ( localize(6466, "Skipped"));
1034
+ skippedMessage.textContent = ( localize(6559, "Skipped"));
875
1035
  skippedContainer.appendChild(skippedMessage);
876
1036
  this.domNode.appendChild(skippedContainer);
877
1037
  }
@@ -885,29 +1045,22 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
885
1045
  const summaryContainer = $(".chat-question-carousel-summary");
886
1046
  for (const question of this.carousel.questions) {
887
1047
  const answer = this._answers.get(question.id);
888
- if (answer === undefined) {
889
- continue;
890
- }
891
1048
  const summaryItem = $(".chat-question-summary-item");
892
- const questionLabel = $("span.chat-question-summary-label");
1049
+ const questionRow = $("div.chat-question-summary-label");
893
1050
  const questionText = question.message ?? question.title;
894
1051
  let labelText = typeof questionText === "string" ? questionText : questionText.value;
895
1052
  labelText = labelText.replace(/[:\s]+$/, "");
896
- questionLabel.textContent = labelText;
897
- summaryItem.appendChild(questionLabel);
898
- const formattedAnswer = this.formatAnswerForSummary(question, answer);
899
- const separatorIndex = formattedAnswer.indexOf(" - ");
900
- if (separatorIndex !== -1) {
901
- const answerTitle = $("span.chat-question-summary-answer-title");
902
- answerTitle.textContent = formattedAnswer.substring(0, separatorIndex);
903
- summaryItem.appendChild(answerTitle);
904
- const answerDesc = $("span.chat-question-summary-answer-desc");
905
- answerDesc.textContent = " - " + formattedAnswer.substring(separatorIndex + 3);
906
- summaryItem.appendChild(answerDesc);
1053
+ questionRow.textContent = ( localize(6560, "Q: {0}", labelText));
1054
+ summaryItem.appendChild(questionRow);
1055
+ if (answer !== undefined) {
1056
+ const formattedAnswer = this.formatAnswerForSummary(question, answer);
1057
+ const answerRow = $("div.chat-question-summary-answer-title");
1058
+ answerRow.textContent = ( localize(6561, "A: {0}", formattedAnswer));
1059
+ summaryItem.appendChild(answerRow);
907
1060
  } else {
908
- const answerValue = $("span.chat-question-summary-answer-title");
909
- answerValue.textContent = formattedAnswer;
910
- summaryItem.appendChild(answerValue);
1061
+ const unanswered = $("div.chat-question-summary-unanswered");
1062
+ unanswered.textContent = ( localize(6562, "Not answered yet"));
1063
+ summaryItem.appendChild(unanswered);
911
1064
  }
912
1065
  summaryContainer.appendChild(summaryItem);
913
1066
  }
@@ -932,6 +1085,11 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
932
1085
  }
933
1086
  return selectedLabel ?? String(selectedValue ?? "");
934
1087
  }
1088
+ if (typeof answer === "object" && answer !== null && hasKey(answer, {
1089
+ freeformValue: true
1090
+ })) {
1091
+ return answer.freeformValue ?? "";
1092
+ }
935
1093
  const label = question.options?.find(opt => opt.value === answer)?.label;
936
1094
  return label ?? String(answer);
937
1095
  }
@@ -948,10 +1106,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
948
1106
  if (freeformValue) {
949
1107
  labels.push(freeformValue);
950
1108
  }
951
- return labels.join(( localize(6467, ", ")));
1109
+ return labels.join(( localize(6563, ", ")));
952
1110
  }
953
1111
  if (Array.isArray(answer)) {
954
- return ( answer.map(v => question.options?.find(opt => opt.value === v)?.label ?? String(v))).join(( localize(6467, ", ")));
1112
+ return ( answer.map(v => question.options?.find(opt => opt.value === v)?.label ?? String(v))).join(( localize(6563, ", ")));
955
1113
  }
956
1114
  return String(answer);
957
1115
  }
@@ -972,6 +1130,12 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
972
1130
  addDisposable(disposable) {
973
1131
  this._register(disposable);
974
1132
  }
1133
+ dispose() {
1134
+ if (!this._isSkipped && !this.carousel.isUsed) {
1135
+ this.saveCurrentAnswer();
1136
+ }
1137
+ super.dispose();
1138
+ }
975
1139
  };
976
1140
  ChatQuestionCarouselPart = ( __decorate([( __param(3, IMarkdownRendererService)), ( __param(4, IHoverService)), ( __param(5, IAccessibilityService)), ( __param(6, IContextKeyService)), ( __param(7, IKeybindingService))], ChatQuestionCarouselPart));
977
1141