@codingame/monaco-vscode-katex-common 26.2.2 → 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 (230) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +10 -4
  3. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +37 -11
  4. package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +3 -0
  5. package/vscode/src/vs/platform/actions/browser/buttonbar.js +15 -4
  6. package/vscode/src/vs/platform/mcp/common/modelContextProtocolApps.d.ts +576 -0
  7. package/vscode/src/vs/{workbench/contrib → platform}/mcp/common/modelContextProtocolApps.js +1 -0
  8. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +15 -15
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +5 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +176 -17
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +5 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +127 -64
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +1 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +12 -11
  16. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +26 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +106 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +9 -9
  19. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +14 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +105 -29
  21. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +13 -1
  22. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +69 -43
  23. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +2 -2
  24. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +35 -7
  25. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +187 -78
  26. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +138 -32
  27. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +23 -6
  28. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +394 -87
  29. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +1 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +28 -13
  31. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +38 -19
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +113 -116
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +16 -15
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +2 -2
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +8 -8
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +14 -14
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +5 -5
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +1 -1
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +2 -1
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +30 -11
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +250 -132
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +4 -4
  43. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +1 -16
  44. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +4 -110
  45. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
  46. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.d.ts +1 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
  48. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
  50. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +3 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +9 -4
  52. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +2 -4
  53. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +7 -10
  54. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
  56. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +4 -2
  57. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +22 -4
  58. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +3 -2
  59. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +11 -3
  60. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -1
  61. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
  62. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +1 -1
  63. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
  64. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -1
  65. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
  66. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.d.ts +59 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.js +29 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.d.ts +0 -2
  69. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +0 -6
  70. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.d.ts +1 -1
  71. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +2 -2
  72. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +4 -2
  74. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +6 -3
  75. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.d.ts +1 -1
  76. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +1 -1
  77. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
  78. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.d.ts +3 -2
  79. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +7 -6
  80. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +0 -1
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +26 -27
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +4 -1
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +53 -20
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.d.ts +15 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownTableScrolling.js +55 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +1 -1
  87. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -7
  88. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +1 -1
  89. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
  90. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +3 -2
  91. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +24 -10
  92. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +4 -4
  93. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -6
  94. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +62 -7
  95. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +414 -129
  96. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +1 -1
  97. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
  98. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +4 -3
  99. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +19 -12
  100. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.d.ts +22 -0
  101. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +263 -0
  102. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +14 -5
  103. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +98 -26
  104. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +5 -5
  105. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +1 -1
  106. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +1 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +1 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
  109. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +11 -2
  110. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +252 -80
  111. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +29 -1
  112. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +246 -8
  113. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +4 -0
  114. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +39 -18
  115. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +6 -4
  116. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +36 -23
  117. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +3 -13
  118. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +6 -260
  119. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +1 -1
  120. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
  121. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +1 -1
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +5 -7
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +42 -37
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatCodeBlockPill.css +12 -3
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +65 -18
  127. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatHookContentPart.css +9 -6
  128. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +2 -2
  129. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +356 -415
  130. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +14 -7
  131. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +102 -7
  132. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +68 -19
  133. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/codeBlockPart.css +48 -15
  134. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +5 -2
  135. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +47 -23
  136. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +1 -1
  137. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
  138. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +1 -2
  139. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +0 -5
  140. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +8 -1
  141. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +57 -4
  142. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +5 -1
  143. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +24 -8
  144. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +1 -1
  145. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.d.ts +18 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.js +103 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +1 -1
  148. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +15 -18
  149. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +44 -1
  150. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +85 -89
  151. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +3 -5
  152. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +15 -17
  153. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +4 -2
  154. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +41 -2
  155. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +1 -1
  156. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
  157. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +3 -3
  158. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +2 -2
  159. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +6 -5
  160. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +1 -1
  161. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +13 -1
  162. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +1 -1
  163. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +2 -1
  164. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
  165. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +21 -5
  166. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +341 -88
  167. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +6 -0
  168. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +13 -4
  169. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.d.ts +35 -0
  170. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.js +440 -0
  171. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +24 -10
  172. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +437 -241
  173. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
  174. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +77 -17
  175. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +521 -284
  176. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +1 -1
  177. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +7 -1
  178. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +71 -0
  179. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +664 -0
  180. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.d.ts +104 -0
  181. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelSelectionLogic.js +127 -0
  182. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +12 -1
  183. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +57 -16
  184. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +4 -7
  185. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +89 -49
  186. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +1 -0
  187. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +28 -0
  188. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +87 -0
  189. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +22 -0
  190. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +213 -0
  191. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +1 -0
  192. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +15 -17
  193. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +7 -4
  194. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +563 -140
  195. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +35 -26
  196. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +2 -2
  197. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +26 -23
  198. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +26 -6
  199. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +145 -79
  200. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +36 -50
  201. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +35 -15
  202. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +7 -0
  203. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +127 -30
  204. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +1 -0
  205. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +20 -14
  206. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +6 -6
  207. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +96 -34
  208. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +11 -2
  209. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +68 -27
  210. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +5 -0
  211. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +125 -13
  212. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +8 -11
  213. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +54 -45
  214. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +11 -10
  215. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +172 -112
  216. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
  217. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
  218. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +2 -44
  219. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +28 -4
  220. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +84 -3
  221. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +9 -2
  222. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +58 -41
  223. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
  224. package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +1 -548
  225. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
  226. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
  227. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
  228. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
  229. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +6 -10
  230. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +0 -187
@@ -1,43 +1,94 @@
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 { $, addDisposableListener, EventType, clearNode, 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
+ import { renderAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
5
6
  import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
6
7
  import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
8
+ import { isMarkdownString, MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
7
9
  import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
8
- 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';
9
12
  import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
10
13
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
14
+ import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
15
+ import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
11
16
  import { defaultButtonStyles, defaultInputBoxStyles, defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
12
17
  import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
13
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';
14
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';
15
22
  import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
16
23
  import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
17
24
  import { HoverPosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverWidget';
18
25
  import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
26
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
27
+ import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
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';
19
30
  import * as chatQuestionCarousel from './media/chatQuestionCarousel.css';
20
31
 
21
32
  registerCss(chatQuestionCarousel);
33
+ const PREVIOUS_QUESTION_ACTION_ID = "workbench.action.chat.previousQuestion";
34
+ const NEXT_QUESTION_ACTION_ID = "workbench.action.chat.nextQuestion";
22
35
  let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable {
23
- constructor(carousel, context, _options, _hoverService) {
36
+ constructor(
37
+ carousel,
38
+ context,
39
+ _options,
40
+ _markdownRendererService,
41
+ _hoverService,
42
+ _accessibilityService,
43
+ _contextKeyService,
44
+ _keybindingService
45
+ ) {
24
46
  super();
25
47
  this.carousel = carousel;
26
48
  this._options = _options;
49
+ this._markdownRendererService = _markdownRendererService;
27
50
  this._hoverService = _hoverService;
51
+ this._accessibilityService = _accessibilityService;
52
+ this._contextKeyService = _contextKeyService;
53
+ this._keybindingService = _keybindingService;
28
54
  this._onDidChangeHeight = this._register(( new Emitter()));
29
55
  this.onDidChangeHeight = this._onDidChangeHeight.event;
30
56
  this._currentIndex = 0;
31
57
  this._answers = ( new Map());
32
- this._nextButtonHover = this._register(( new MutableDisposable()));
33
58
  this._isSkipped = false;
34
59
  this._textInputBoxes = ( new Map());
35
60
  this._singleSelectItems = ( new Map());
36
61
  this._multiSelectCheckboxes = ( new Map());
37
62
  this._freeformTextareas = ( new Map());
38
63
  this._inputBoxes = this._register(( new DisposableStore()));
64
+ this._questionRenderStore = this._register(( new MutableDisposable()));
39
65
  this._interactiveUIStore = this._register(( new MutableDisposable()));
40
66
  this.domNode = $(".chat-question-carousel-container");
67
+ this._inChatQuestionCarouselContextKey = ChatContextKeys.inChatQuestionCarousel.bindTo(this._contextKeyService);
68
+ const focusTracker = this._register(trackFocus(this.domNode));
69
+ this._register(
70
+ focusTracker.onDidFocus(() => this._inChatQuestionCarouselContextKey.set(true))
71
+ );
72
+ this._register(
73
+ focusTracker.onDidBlur(() => this._inChatQuestionCarouselContextKey.set(false))
74
+ );
75
+ this._register({
76
+ dispose: () => this._inChatQuestionCarouselContextKey.reset()
77
+ });
78
+ this.domNode.tabIndex = 0;
79
+ this.domNode.setAttribute("role", "region");
80
+ this.domNode.setAttribute("aria-roledescription", ( localize(6542, "chat question")));
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
+ }
41
92
  if (carousel.data) {
42
93
  for (const [key, value] of Object.entries(carousel.data)) {
43
94
  this._answers.set(key, value);
@@ -56,53 +107,20 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
56
107
  this.domNode.append(this._questionContainer);
57
108
  if (carousel.allowSkip) {
58
109
  this._closeButtonContainer = $(".chat-question-close-container");
59
- const skipAllTitle = ( localize(5948, "Skip all questions"));
110
+ const skipAllTitle = ( localize(6543, "Skip all questions"));
60
111
  const skipAllButton = interactiveStore.add(( new Button(this._closeButtonContainer, {
61
112
  ...defaultButtonStyles,
62
113
  secondary: true,
63
114
  supportIcons: true
64
115
  })));
65
116
  skipAllButton.label = `$(${Codicon.close.id})`;
66
- skipAllButton.element.classList.add("chat-question-nav-arrow", "chat-question-close");
117
+ skipAllButton.element.classList.add("chat-question-close");
67
118
  skipAllButton.element.setAttribute("aria-label", skipAllTitle);
68
119
  interactiveStore.add(this._hoverService.setupDelayedHover(skipAllButton.element, {
69
120
  content: skipAllTitle
70
121
  }));
71
122
  this._skipAllButton = skipAllButton;
72
123
  }
73
- this._footerRow = $(".chat-question-footer-row");
74
- this._stepIndicator = $(".chat-question-step-indicator");
75
- this._footerRow.appendChild(this._stepIndicator);
76
- this._navigationButtons = $(".chat-question-carousel-nav");
77
- this._navigationButtons.setAttribute("role", "navigation");
78
- this._navigationButtons.setAttribute("aria-label", ( localize(5949, "Question navigation")));
79
- const arrowsContainer = $(".chat-question-nav-arrows");
80
- const previousLabel = ( localize(5950, "Previous"));
81
- const prevButton = interactiveStore.add(( new Button(arrowsContainer, {
82
- ...defaultButtonStyles,
83
- secondary: true,
84
- supportIcons: true
85
- })));
86
- prevButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-prev");
87
- prevButton.label = `$(${Codicon.chevronLeft.id})`;
88
- prevButton.element.setAttribute("aria-label", previousLabel);
89
- interactiveStore.add(this._hoverService.setupDelayedHover(prevButton.element, {
90
- content: previousLabel
91
- }));
92
- this._prevButton = prevButton;
93
- const nextButton = interactiveStore.add(( new Button(arrowsContainer, {
94
- ...defaultButtonStyles,
95
- secondary: true,
96
- supportIcons: true
97
- })));
98
- nextButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-next");
99
- nextButton.label = `$(${Codicon.chevronRight.id})`;
100
- this._nextButton = nextButton;
101
- this._navigationButtons.appendChild(arrowsContainer);
102
- this._footerRow.appendChild(this._navigationButtons);
103
- this.domNode.append(this._footerRow);
104
- interactiveStore.add(prevButton.onDidClick(() => this.navigate(-1)));
105
- interactiveStore.add(nextButton.onDidClick(() => this.handleNext()));
106
124
  if (this._skipAllButton) {
107
125
  interactiveStore.add(this._skipAllButton.onDidClick(() => this.ignore()));
108
126
  }
@@ -112,6 +130,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
112
130
  e.preventDefault();
113
131
  e.stopPropagation();
114
132
  this.ignore();
133
+ } else if (event.keyCode === KeyCode.Enter && (event.metaKey || event.ctrlKey)) {
134
+ e.preventDefault();
135
+ e.stopPropagation();
136
+ this.submit();
115
137
  } else if (event.keyCode === KeyCode.Enter && !event.shiftKey) {
116
138
  const target = e.target;
117
139
  const isTextInput = target.tagName === "INPUT" && target.type === "text";
@@ -119,7 +141,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
119
141
  if (isTextInput || isFreeformTextarea) {
120
142
  e.preventDefault();
121
143
  e.stopPropagation();
122
- this.handleNext();
144
+ this.handleNextOrSubmit();
123
145
  }
124
146
  } else if ((event.ctrlKey || event.metaKey) && (event.keyCode === KeyCode.Backspace || event.keyCode === KeyCode.Delete)) {
125
147
  e.stopPropagation();
@@ -132,26 +154,61 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
132
154
  const answer = this.getCurrentAnswer();
133
155
  if (answer !== undefined) {
134
156
  this._answers.set(currentQuestion.id, answer);
157
+ } else {
158
+ this._answers.delete(currentQuestion.id);
159
+ }
160
+ this.persistDraftState();
161
+ }
162
+ persistDraftState() {
163
+ if (this.carousel.isUsed || !(this.carousel instanceof ChatQuestionCarouselData)) {
164
+ return;
135
165
  }
166
+ this.carousel.draftAnswers = Object.fromEntries(this._answers.entries());
167
+ this.carousel.draftCurrentIndex = this._currentIndex;
136
168
  }
137
169
  navigate(delta) {
138
170
  const newIndex = this._currentIndex + delta;
139
171
  if (newIndex >= 0 && newIndex < this.carousel.questions.length) {
140
172
  this.saveCurrentAnswer();
141
173
  this._currentIndex = newIndex;
142
- this.renderCurrentQuestion();
174
+ this.persistDraftState();
175
+ this.renderCurrentQuestion(true);
176
+ this.domNode.focus();
143
177
  }
144
178
  }
145
- handleNext() {
179
+ handleNextOrSubmit() {
146
180
  this.saveCurrentAnswer();
147
181
  if (this._currentIndex < this.carousel.questions.length - 1) {
148
182
  this._currentIndex++;
149
- this.renderCurrentQuestion();
183
+ this.persistDraftState();
184
+ this.renderCurrentQuestion(true);
150
185
  } else {
151
186
  this._options.onSubmit(this._answers);
152
187
  this.hideAndShowSummary();
153
188
  }
154
189
  }
190
+ submit() {
191
+ this.saveCurrentAnswer();
192
+ this._options.onSubmit(this._answers);
193
+ this.hideAndShowSummary();
194
+ }
195
+ _focusContainerAndAnnounce() {
196
+ this.domNode.focus();
197
+ const question = this.carousel.questions[this._currentIndex];
198
+ if (question) {
199
+ const questionText = question.message ?? question.title;
200
+ const messageContent = this.getQuestionText(questionText);
201
+ const questionCount = this.carousel.questions.length;
202
+ const alertMessage = questionCount === 1 ? messageContent : ( localize(
203
+ 6544,
204
+ "Question {0} of {1}: {2}",
205
+ this._currentIndex + 1,
206
+ questionCount,
207
+ messageContent
208
+ ));
209
+ this._accessibilityService.alert(alertMessage);
210
+ }
211
+ }
155
212
  hideAndShowSummary() {
156
213
  this._isSkipped = true;
157
214
  this.domNode.classList.add("chat-question-carousel-used");
@@ -162,6 +219,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
162
219
  }
163
220
  clearInteractiveResources() {
164
221
  this._interactiveUIStore.clear();
222
+ this._questionRenderStore.clear();
165
223
  this._inputBoxes.clear();
166
224
  this._textInputBoxes.clear();
167
225
  this._singleSelectItems.clear();
@@ -169,12 +227,49 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
169
227
  this._freeformTextareas.clear();
170
228
  this._prevButton = undefined;
171
229
  this._nextButton = undefined;
230
+ this._submitButton = undefined;
172
231
  this._skipAllButton = undefined;
173
232
  this._questionContainer = undefined;
174
- this._navigationButtons = undefined;
175
233
  this._closeButtonContainer = undefined;
176
234
  this._footerRow = undefined;
177
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();
178
273
  }
179
274
  skip() {
180
275
  if (this._isSkipped || !this.carousel.allowSkip) {
@@ -239,10 +334,60 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
239
334
  return question.defaultValue;
240
335
  }
241
336
  }
242
- renderCurrentQuestion() {
243
- if (!this._questionContainer || !this._prevButton || !this._nextButton) {
337
+ _shouldAutoFocus() {
338
+ if (this._options.shouldAutoFocus === false) {
339
+ return false;
340
+ }
341
+ return !this._accessibilityService.isScreenReaderOptimized();
342
+ }
343
+ _updateAriaLabel() {
344
+ const question = this.carousel.questions[this._currentIndex];
345
+ if (!question) {
346
+ this.domNode.setAttribute("aria-label", ( localize(6545, "Chat question")));
244
347
  return;
245
348
  }
349
+ const questionText = question.message ?? question.title;
350
+ const messageContent = this.getQuestionText(questionText);
351
+ const questionCount = this.carousel.questions.length;
352
+ if (questionCount === 1) {
353
+ this.domNode.setAttribute("aria-label", ( localize(6546, "Chat question: {0}", messageContent)));
354
+ } else {
355
+ this.domNode.setAttribute("aria-label", ( localize(
356
+ 6547,
357
+ "Chat question {0} of {1}: {2}",
358
+ this._currentIndex + 1,
359
+ questionCount,
360
+ messageContent
361
+ )));
362
+ }
363
+ }
364
+ focus() {
365
+ this.domNode.focus();
366
+ }
367
+ hasFocus() {
368
+ return isAncestorOfActiveElement(this.domNode);
369
+ }
370
+ navigateToPreviousQuestion() {
371
+ if (this._currentIndex <= 0) {
372
+ return false;
373
+ }
374
+ this.navigate(-1);
375
+ return true;
376
+ }
377
+ navigateToNextQuestion() {
378
+ if (this._currentIndex >= this.carousel.questions.length - 1) {
379
+ return false;
380
+ }
381
+ this.navigate(1);
382
+ return true;
383
+ }
384
+ renderCurrentQuestion(focusContainerForScreenReader = false) {
385
+ if (!this._questionContainer) {
386
+ return;
387
+ }
388
+ const questionRenderStore = ( new DisposableStore());
389
+ this._questionRenderStore.value = questionRenderStore;
390
+ this._inputScrollable = undefined;
246
391
  this._inputBoxes.clear();
247
392
  this._textInputBoxes.clear();
248
393
  this._singleSelectItems.clear();
@@ -254,58 +399,181 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
254
399
  return;
255
400
  }
256
401
  const headerRow = $(".chat-question-header-row");
402
+ const titleRow = $(".chat-question-title-row");
257
403
  const questionText = question.message ?? question.title;
258
404
  if (questionText) {
259
405
  const title = $(".chat-question-title");
260
- const messageContent = typeof questionText === "string" ? questionText : questionText.value;
406
+ const messageContent = this.getQuestionText(questionText);
261
407
  title.setAttribute("aria-label", messageContent);
262
- const parenMatch = messageContent.match(/^(.+?)\s*(\([^)]+\))\s*$/);
263
- if (parenMatch) {
264
- const mainTitle = $("span.chat-question-title-main");
265
- mainTitle.textContent = parenMatch[1];
266
- title.appendChild(mainTitle);
267
- const subtitle = $("span.chat-question-title-subtitle");
268
- subtitle.textContent = " " + parenMatch[2];
269
- title.appendChild(subtitle);
270
- } else {
271
- title.textContent = messageContent;
272
- }
273
- 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);
274
412
  }
413
+ headerRow.appendChild(titleRow);
275
414
  if (this._closeButtonContainer) {
276
- headerRow.appendChild(this._closeButtonContainer);
415
+ titleRow.appendChild(this._closeButtonContainer);
277
416
  }
278
417
  this._questionContainer.appendChild(headerRow);
279
- const isSingleQuestion = this.carousel.questions.length === 1;
280
- if (this._stepIndicator) {
281
- this._stepIndicator.textContent = `${this._currentIndex + 1}/${this.carousel.questions.length}`;
282
- this._stepIndicator.style.display = isSingleQuestion ? "none" : "";
283
- }
284
418
  const inputContainer = $(".chat-question-input-container");
285
419
  this.renderInput(inputContainer, question);
286
- this._questionContainer.appendChild(inputContainer);
287
- this._prevButton.enabled = this._currentIndex > 0;
288
- this._prevButton.element.style.display = isSingleQuestion ? "none" : "";
289
- const isLastQuestion = this._currentIndex === this.carousel.questions.length - 1;
290
- const submitLabel = ( localize(5951, "Submit"));
291
- const nextLabel = ( localize(5952, "Next"));
292
- if (isLastQuestion) {
293
- this._nextButton.label = submitLabel;
294
- this._nextButton.element.setAttribute("aria-label", submitLabel);
295
- this._nextButton.element.classList.add("chat-question-nav-submit");
296
- this._nextButtonHover.value = this._hoverService.setupDelayedHover(this._nextButton.element, {
297
- content: submitLabel
298
- });
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();
299
432
  } else {
300
- this._nextButton.label = `$(${Codicon.chevronRight.id})`;
301
- this._nextButton.element.setAttribute("aria-label", nextLabel);
302
- this._nextButton.element.classList.remove("chat-question-nav-submit");
303
- this._nextButtonHover.value = this._hoverService.setupDelayedHover(this._nextButton.element, {
304
- content: nextLabel
433
+ this.renderSingleQuestionFooter();
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);
305
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
+ );
462
+ this._updateAriaLabel();
463
+ if (focusContainerForScreenReader && this._accessibilityService.isScreenReaderOptimized()) {
464
+ this._focusContainerAndAnnounce();
306
465
  }
307
466
  this._onDidChangeHeight.fire();
308
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
+ }
573
+ getLabelWithKeybinding(label, actionId) {
574
+ const keybindingLabel = this._keybindingService.lookupKeybinding(actionId, this._contextKeyService)?.getLabel();
575
+ return keybindingLabel ? ( localize(6555, "{0} ({1})", label, keybindingLabel)) : label;
576
+ }
309
577
  renderInput(container, question) {
310
578
  switch (question.type) {
311
579
  case "text":
@@ -323,6 +591,9 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
323
591
  const autoResize = () => {
324
592
  textarea.style.height = "auto";
325
593
  textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
594
+ if (this._inputScrollable) {
595
+ this.layoutInputScrollable(this._inputScrollable);
596
+ }
326
597
  this._onDidChangeHeight.fire();
327
598
  };
328
599
  this._inputBoxes.add(addDisposableListener(textarea, EventType.INPUT, autoResize));
@@ -330,9 +601,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
330
601
  }
331
602
  renderTextInput(container, question) {
332
603
  const inputBox = this._inputBoxes.add(( new InputBox(container, undefined, {
333
- placeholder: ( localize(5953, "Enter your answer")),
604
+ placeholder: ( localize(6556, "Enter your answer")),
334
605
  inputBoxStyles: defaultInputBoxStyles
335
606
  })));
607
+ this._inputBoxes.add(inputBox.onDidChange(() => this.saveCurrentAnswer()));
336
608
  const previousAnswer = this._answers.get(question.id);
337
609
  if (previousAnswer !== undefined) {
338
610
  inputBox.value = String(previousAnswer);
@@ -340,7 +612,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
340
612
  inputBox.value = String(question.defaultValue);
341
613
  }
342
614
  this._textInputBoxes.set(question.id, inputBox);
343
- if (this._options.shouldAutoFocus !== false) {
615
+ if (this._shouldAutoFocus()) {
344
616
  this._inputBoxes.add(
345
617
  runAtThisOrScheduleAtNextAnimationFrame(getWindow(inputBox.element), () => inputBox.focus())
346
618
  );
@@ -387,13 +659,14 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
387
659
  if (data) {
388
660
  data.selectedIndex = newIndex;
389
661
  }
662
+ this.saveCurrentAnswer();
390
663
  };
391
664
  options.forEach((option, index) => {
392
665
  const isSelected = index === selectedIndex;
393
666
  const listItem = $(".chat-question-list-item");
394
667
  listItem.setAttribute("role", "option");
395
668
  listItem.setAttribute("aria-selected", String(isSelected));
396
- listItem.setAttribute("aria-label", ( localize(5954, "Option {0}: {1}", index + 1, option.label)));
669
+ listItem.setAttribute("aria-label", ( localize(6557, "Option {0}: {1}", index + 1, option.label)));
397
670
  listItem.id = `option-${question.id}-${index}`;
398
671
  listItem.tabIndex = -1;
399
672
  const number = $(".chat-question-list-number");
@@ -407,11 +680,12 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
407
680
  const label = $(".chat-question-list-label");
408
681
  const separatorIndex = option.label.indexOf(" - ");
409
682
  if (separatorIndex !== -1) {
683
+ listItem.classList.add("has-description");
410
684
  const titleSpan = $("span.chat-question-list-label-title");
411
685
  titleSpan.textContent = option.label.substring(0, separatorIndex);
412
686
  label.appendChild(titleSpan);
413
687
  const descSpan = $("span.chat-question-list-label-desc");
414
- descSpan.textContent = ": " + option.label.substring(separatorIndex + 3);
688
+ descSpan.textContent = option.label.substring(separatorIndex + 3);
415
689
  label.appendChild(descSpan);
416
690
  } else {
417
691
  label.textContent = option.label;
@@ -429,7 +703,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
429
703
  if (freeform) {
430
704
  freeform.value = "";
431
705
  }
432
- this.handleNext();
706
+ this.handleNextOrSubmit();
433
707
  }));
434
708
  this._inputBoxes.add(this._hoverService.setupDelayedHover(listItem, {
435
709
  content: option.label,
@@ -455,7 +729,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
455
729
  freeformNumber.textContent = `${options.length + 1}`;
456
730
  freeformContainer.appendChild(freeformNumber);
457
731
  const freeformTextarea = $("textarea.chat-question-freeform-textarea");
458
- freeformTextarea.placeholder = ( localize(5955, "Enter custom answer"));
732
+ freeformTextarea.placeholder = ( localize(6558, "Enter custom answer"));
459
733
  freeformTextarea.rows = 1;
460
734
  if (previousFreeform !== undefined) {
461
735
  freeformTextarea.value = previousFreeform;
@@ -464,6 +738,8 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
464
738
  this._inputBoxes.add(addDisposableListener(freeformTextarea, EventType.INPUT, () => {
465
739
  if (freeformTextarea.value.length > 0) {
466
740
  updateSelection(-1);
741
+ } else {
742
+ this.saveCurrentAnswer();
467
743
  }
468
744
  }));
469
745
  freeformContainer.appendChild(freeformTextarea);
@@ -482,10 +758,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
482
758
  } else if (event.keyCode === KeyCode.UpArrow) {
483
759
  e.preventDefault();
484
760
  newIndex = Math.max(data.selectedIndex - 1, 0);
485
- } 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) {
486
762
  e.preventDefault();
487
763
  e.stopPropagation();
488
- this.handleNext();
764
+ this.handleNextOrSubmit();
489
765
  return;
490
766
  } else if (event.keyCode >= KeyCode.Digit1 && event.keyCode <= KeyCode.Digit9) {
491
767
  const numberIndex = event.keyCode - KeyCode.Digit1;
@@ -508,7 +784,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
508
784
  runAtThisOrScheduleAtNextAnimationFrame(getWindow(freeformTextarea), () => autoResize())
509
785
  );
510
786
  }
511
- if (this._options.shouldAutoFocus !== false) {
787
+ if (this._shouldAutoFocus()) {
512
788
  if (previousFreeform) {
513
789
  this._inputBoxes.add(
514
790
  runAtThisOrScheduleAtNextAnimationFrame(getWindow(freeformTextarea), () => {
@@ -558,7 +834,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
558
834
  const listItem = $(".chat-question-list-item.multi-select");
559
835
  listItem.setAttribute("role", "option");
560
836
  listItem.setAttribute("aria-selected", String(isChecked));
561
- listItem.setAttribute("aria-label", ( localize(5954, "Option {0}: {1}", index + 1, option.label)));
837
+ listItem.setAttribute("aria-label", ( localize(6557, "Option {0}: {1}", index + 1, option.label)));
562
838
  listItem.id = `option-${question.id}-${index}`;
563
839
  listItem.tabIndex = -1;
564
840
  const number = $(".chat-question-list-number");
@@ -571,11 +847,12 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
571
847
  const label = $(".chat-question-list-label");
572
848
  const separatorIndex = option.label.indexOf(" - ");
573
849
  if (separatorIndex !== -1) {
850
+ listItem.classList.add("has-description");
574
851
  const titleSpan = $("span.chat-question-list-label-title");
575
852
  titleSpan.textContent = option.label.substring(0, separatorIndex);
576
853
  label.appendChild(titleSpan);
577
854
  const descSpan = $("span.chat-question-list-label-desc");
578
- descSpan.textContent = ": " + option.label.substring(separatorIndex + 3);
855
+ descSpan.textContent = option.label.substring(separatorIndex + 3);
579
856
  label.appendChild(descSpan);
580
857
  } else {
581
858
  label.textContent = option.label;
@@ -590,6 +867,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
590
867
  this._inputBoxes.add(checkbox.onChange(() => {
591
868
  listItem.classList.toggle("checked", checkbox.checked);
592
869
  listItem.setAttribute("aria-selected", String(checkbox.checked));
870
+ this.saveCurrentAnswer();
593
871
  }));
594
872
  this._inputBoxes.add(addDisposableListener(listItem, EventType.CLICK, e => {
595
873
  focusedIndex = index;
@@ -616,12 +894,15 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
616
894
  freeformNumber.textContent = `${options.length + 1}`;
617
895
  freeformContainer.appendChild(freeformNumber);
618
896
  const freeformTextarea = $("textarea.chat-question-freeform-textarea");
619
- freeformTextarea.placeholder = ( localize(5955, "Enter custom answer"));
897
+ freeformTextarea.placeholder = ( localize(6558, "Enter custom answer"));
620
898
  freeformTextarea.rows = 1;
621
899
  if (previousFreeform !== undefined) {
622
900
  freeformTextarea.value = previousFreeform;
623
901
  }
624
902
  const autoResize = this.setupTextareaAutoResize(freeformTextarea);
903
+ this._inputBoxes.add(
904
+ addDisposableListener(freeformTextarea, EventType.INPUT, () => this.saveCurrentAnswer())
905
+ );
625
906
  freeformContainer.appendChild(freeformTextarea);
626
907
  container.appendChild(freeformContainer);
627
908
  this._freeformTextareas.set(question.id, freeformTextarea);
@@ -638,10 +919,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
638
919
  e.preventDefault();
639
920
  focusedIndex = Math.max(focusedIndex - 1, 0);
640
921
  listItems[focusedIndex].focus();
641
- } else if (event.keyCode === KeyCode.Enter) {
922
+ } else if (event.keyCode === KeyCode.Enter && !event.metaKey && !event.ctrlKey) {
642
923
  e.preventDefault();
643
924
  e.stopPropagation();
644
- this.handleNext();
925
+ this.handleNextOrSubmit();
645
926
  } else if (event.keyCode === KeyCode.Space) {
646
927
  e.preventDefault();
647
928
  if (focusedIndex >= 0 && focusedIndex < checkboxes.length) {
@@ -663,7 +944,7 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
663
944
  runAtThisOrScheduleAtNextAnimationFrame(getWindow(freeformTextarea), () => autoResize())
664
945
  );
665
946
  }
666
- if (this._options.shouldAutoFocus !== false) {
947
+ if (this._shouldAutoFocus()) {
667
948
  if (previousFreeform) {
668
949
  this._inputBoxes.add(
669
950
  runAtThisOrScheduleAtNextAnimationFrame(getWindow(freeformTextarea), () => {
@@ -735,15 +1016,9 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
735
1016
  }
736
1017
  const freeformTextarea = this._freeformTextareas.get(question.id);
737
1018
  const freeformValue = freeformTextarea?.value !== "" ? freeformTextarea?.value : undefined;
738
- let finalSelectedValues = selectedValues;
739
- if (selectedValues.length === 0 && !freeformValue && question.defaultValue !== undefined) {
740
- const defaultIds = Array.isArray(question.defaultValue) ? question.defaultValue : [question.defaultValue];
741
- const defaultValues = question.options?.filter(opt => defaultIds.includes(opt.id)).map(opt => opt.value);
742
- finalSelectedValues = defaultValues?.filter(v => v !== undefined) || [];
743
- }
744
- if (freeformValue || finalSelectedValues.length > 0) {
1019
+ if (freeformValue || selectedValues.length > 0) {
745
1020
  return {
746
- selectedValues: finalSelectedValues,
1021
+ selectedValues,
747
1022
  freeformValue
748
1023
  };
749
1024
  }
@@ -756,41 +1031,36 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
756
1031
  renderSkippedMessage() {
757
1032
  const skippedContainer = $(".chat-question-carousel-summary");
758
1033
  const skippedMessage = $(".chat-question-summary-skipped");
759
- skippedMessage.textContent = ( localize(5956, "Skipped"));
1034
+ skippedMessage.textContent = ( localize(6559, "Skipped"));
760
1035
  skippedContainer.appendChild(skippedMessage);
761
1036
  this.domNode.appendChild(skippedContainer);
762
1037
  }
763
1038
  renderSummary() {
764
1039
  if (this._answers.size === 0) {
765
- this.renderSkippedMessage();
1040
+ if (this.carousel.isUsed) {
1041
+ this.renderSkippedMessage();
1042
+ }
766
1043
  return;
767
1044
  }
768
1045
  const summaryContainer = $(".chat-question-carousel-summary");
769
1046
  for (const question of this.carousel.questions) {
770
1047
  const answer = this._answers.get(question.id);
771
- if (answer === undefined) {
772
- continue;
773
- }
774
1048
  const summaryItem = $(".chat-question-summary-item");
775
- const questionLabel = $("span.chat-question-summary-label");
1049
+ const questionRow = $("div.chat-question-summary-label");
776
1050
  const questionText = question.message ?? question.title;
777
1051
  let labelText = typeof questionText === "string" ? questionText : questionText.value;
778
1052
  labelText = labelText.replace(/[:\s]+$/, "");
779
- questionLabel.textContent = labelText;
780
- summaryItem.appendChild(questionLabel);
781
- const formattedAnswer = this.formatAnswerForSummary(question, answer);
782
- const separatorIndex = formattedAnswer.indexOf(" - ");
783
- if (separatorIndex !== -1) {
784
- const answerTitle = $("span.chat-question-summary-answer-title");
785
- answerTitle.textContent = formattedAnswer.substring(0, separatorIndex);
786
- summaryItem.appendChild(answerTitle);
787
- const answerDesc = $("span.chat-question-summary-answer-desc");
788
- answerDesc.textContent = " - " + formattedAnswer.substring(separatorIndex + 3);
789
- 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);
790
1060
  } else {
791
- const answerValue = $("span.chat-question-summary-answer-title");
792
- answerValue.textContent = formattedAnswer;
793
- summaryItem.appendChild(answerValue);
1061
+ const unanswered = $("div.chat-question-summary-unanswered");
1062
+ unanswered.textContent = ( localize(6562, "Not answered yet"));
1063
+ summaryItem.appendChild(unanswered);
794
1064
  }
795
1065
  summaryContainer.appendChild(summaryItem);
796
1066
  }
@@ -815,6 +1085,11 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
815
1085
  }
816
1086
  return selectedLabel ?? String(selectedValue ?? "");
817
1087
  }
1088
+ if (typeof answer === "object" && answer !== null && hasKey(answer, {
1089
+ freeformValue: true
1090
+ })) {
1091
+ return answer.freeformValue ?? "";
1092
+ }
818
1093
  const label = question.options?.find(opt => opt.value === answer)?.label;
819
1094
  return label ?? String(answer);
820
1095
  }
@@ -831,10 +1106,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
831
1106
  if (freeformValue) {
832
1107
  labels.push(freeformValue);
833
1108
  }
834
- return labels.join(( localize(5957, ", ")));
1109
+ return labels.join(( localize(6563, ", ")));
835
1110
  }
836
1111
  if (Array.isArray(answer)) {
837
- return ( answer.map(v => question.options?.find(opt => opt.value === v)?.label ?? String(v))).join(( localize(5957, ", ")));
1112
+ return ( answer.map(v => question.options?.find(opt => opt.value === v)?.label ?? String(v))).join(( localize(6563, ", ")));
838
1113
  }
839
1114
  return String(answer);
840
1115
  }
@@ -842,6 +1117,10 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
842
1117
  return String(answer);
843
1118
  }
844
1119
  }
1120
+ getQuestionText(questionText) {
1121
+ const md = typeof questionText === "string" ? ( new MarkdownString(questionText)) : questionText;
1122
+ return renderAsPlaintext(md);
1123
+ }
845
1124
  hasSameContent(other, _followingContent, element) {
846
1125
  if (!this._isSkipped && !this.carousel.isUsed && isResponseVM(element) && element.isComplete) {
847
1126
  return false;
@@ -851,7 +1130,13 @@ let ChatQuestionCarouselPart = class ChatQuestionCarouselPart extends Disposable
851
1130
  addDisposable(disposable) {
852
1131
  this._register(disposable);
853
1132
  }
1133
+ dispose() {
1134
+ if (!this._isSkipped && !this.carousel.isUsed) {
1135
+ this.saveCurrentAnswer();
1136
+ }
1137
+ super.dispose();
1138
+ }
854
1139
  };
855
- ChatQuestionCarouselPart = ( __decorate([( __param(3, IHoverService))], ChatQuestionCarouselPart));
1140
+ ChatQuestionCarouselPart = ( __decorate([( __param(3, IMarkdownRendererService)), ( __param(4, IHoverService)), ( __param(5, IAccessibilityService)), ( __param(6, IContextKeyService)), ( __param(7, IKeybindingService))], ChatQuestionCarouselPart));
856
1141
 
857
1142
  export { ChatQuestionCarouselPart };