@codingame/monaco-vscode-katex-common 24.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/empty.js +1 -0
  2. package/package.json +45 -0
  3. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +37 -0
  4. package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +127 -0
  5. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +27 -0
  6. package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +81 -0
  7. package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +44 -0
  8. package/vscode/src/vs/platform/actions/browser/buttonbar.js +172 -0
  9. package/vscode/src/vs/platform/editor/browser/editor.d.ts +12 -0
  10. package/vscode/src/vs/platform/editor/browser/editor.js +51 -0
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +41 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +295 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.d.ts +2 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +60 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +65 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +650 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +2 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +364 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +38 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +207 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.d.ts +17 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.js +216 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.d.ts +24 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.js +114 -0
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.d.ts +34 -0
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.js +141 -0
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.d.ts +169 -0
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.js +951 -0
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.d.ts +19 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.js +109 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.d.ts +12 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.js +47 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.d.ts +13 -0
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.js +49 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.d.ts +27 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.js +160 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.d.ts +40 -0
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.js +286 -0
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.d.ts +13 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.js +49 -0
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.d.ts +34 -0
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.js +101 -0
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.d.ts +14 -0
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.js +30 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.d.ts +11 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.js +37 -0
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.d.ts +17 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.js +69 -0
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.d.ts +116 -0
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.js +417 -0
  51. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.d.ts +20 -0
  52. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.js +66 -0
  53. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.d.ts +25 -0
  54. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.js +123 -0
  55. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.d.ts +18 -0
  56. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.js +60 -0
  57. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.d.ts +16 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.js +46 -0
  59. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.d.ts +19 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.js +57 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.d.ts +94 -0
  62. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.js +567 -0
  63. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.d.ts +34 -0
  64. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.js +224 -0
  65. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.d.ts +34 -0
  66. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.js +259 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.d.ts +38 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.js +160 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.d.ts +16 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.js +55 -0
  71. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.d.ts +17 -0
  72. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.js +117 -0
  73. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.d.ts +66 -0
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.js +528 -0
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.d.ts +31 -0
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.js +160 -0
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.d.ts +17 -0
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.js +49 -0
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.d.ts +18 -0
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.js +91 -0
  81. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.d.ts +13 -0
  82. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.js +6 -0
  83. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.d.ts +54 -0
  84. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.js +429 -0
  85. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.d.ts +40 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.js +347 -0
  87. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.d.ts +56 -0
  88. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.js +164 -0
  89. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.d.ts +32 -0
  90. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.js +224 -0
  91. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.d.ts +35 -0
  92. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.js +173 -0
  93. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatConfirmationWidget.css +341 -0
  94. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatExtensionsContent.css +27 -0
  95. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMarkdownPart.css +23 -0
  96. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMcpServersInteractionContent.css +14 -0
  97. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatPullRequestContent.css +75 -0
  98. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css +221 -0
  99. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatThinkingContent.css +162 -0
  100. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +41 -0
  101. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +94 -0
  102. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +15 -0
  103. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +96 -0
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +18 -0
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +147 -0
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +14 -0
  107. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.js +23 -0
  108. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +68 -0
  109. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +353 -0
  110. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +100 -0
  111. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +1085 -0
  112. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +39 -0
  113. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +275 -0
  114. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +32 -0
  115. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +119 -0
  116. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +19 -0
  117. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +36 -0
  118. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +21 -0
  119. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.js +130 -0
  120. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +25 -0
  121. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +225 -0
  122. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +24 -0
  123. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.js +101 -0
  124. package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.d.ts +42 -0
  125. package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.js +127 -0
  126. package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.d.ts +43 -0
  127. package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.js +388 -0
  128. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +49 -0
  129. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +721 -0
  130. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.d.ts +13 -0
  131. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +52 -0
  132. package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.d.ts +39 -0
  133. package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.js +409 -0
  134. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.d.ts +334 -0
  135. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +2008 -0
  136. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.d.ts +52 -0
  137. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.js +93 -0
  138. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.d.ts +217 -0
  139. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1573 -0
  140. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.d.ts +43 -0
  141. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +249 -0
  142. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.d.ts +50 -0
  143. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +84 -0
  144. package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.d.ts +32 -0
  145. package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.js +174 -0
  146. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +31 -0
  147. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +101 -0
  148. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +19 -0
  149. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +76 -0
  150. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionAction.css +39 -0
  151. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.d.ts +292 -0
  152. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +2014 -0
  153. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css +171 -0
  154. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.d.ts +173 -0
  155. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +797 -0
  156. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.d.ts +54 -0
  157. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.js +345 -0
  158. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.d.ts +10 -0
  159. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +1069 -0
  160. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +34 -0
  161. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +139 -0
  162. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css +2880 -0
  163. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatAgentHover.css +87 -0
  164. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatCodeBlockPill.css +139 -0
  165. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatInlineAnchorWidget.css +61 -0
  166. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewWelcome.css +209 -0
  167. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.d.ts +28 -0
  168. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.js +135 -0
  169. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.d.ts +28 -0
  170. package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.js +147 -0
  171. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +71 -0
  172. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +279 -0
  173. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.d.ts +28 -0
  174. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +28 -0
  175. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.d.ts +13 -0
  176. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +38 -0
  177. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +55 -0
  178. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +176 -0
  179. package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.d.ts +45 -0
  180. package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.js +207 -0
  181. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +48 -0
  182. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +373 -0
  183. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +171 -0
  184. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +1442 -0
  185. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +199 -0
  186. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +482 -0
  187. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +28 -0
  188. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +37 -0
  189. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +95 -0
  190. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +497 -0
  191. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +76 -0
  192. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +464 -0
  193. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +124 -0
  194. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +562 -0
  195. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +42 -0
  196. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +279 -0
  197. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +411 -0
  198. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +13 -0
  199. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +66 -0
  200. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +61 -0
  201. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +154 -0
  202. package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.d.ts +19 -0
  203. package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +201 -0
  204. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +41 -0
  205. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +372 -0
  206. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +4 -0
  207. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +58 -0
  208. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
  209. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +594 -0
  210. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
  211. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
  212. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
  213. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1746 -0
  214. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
  215. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +269 -0
  216. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
  217. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +806 -0
  218. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
  219. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +116 -0
  220. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
  221. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +62 -0
  222. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
  223. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
  224. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
  225. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +295 -0
  226. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
  227. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +241 -0
  228. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
  229. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +146 -0
  230. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
  231. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +90 -0
  232. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
  233. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +41 -0
  234. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
  235. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +42 -0
  236. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
  237. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +77 -0
  238. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
  239. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
  240. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +823 -0
  241. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
  242. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +29 -0
  243. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
  244. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +567 -0
  245. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
  246. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +189 -0
  247. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
  248. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +439 -0
  249. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
  250. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +263 -0
  251. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
  252. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +48 -0
  253. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
  254. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
  255. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
  256. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +89 -0
  257. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
  258. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
  259. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
  260. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +108 -0
  261. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +34 -0
  262. package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +145 -0
@@ -0,0 +1,951 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { append, $, addDisposableListener, EventType, addStandardDisposableListener, EventHelper, getWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
+ import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
5
+ import { StandardMouseEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/mouseEvent';
6
+ import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
7
+ import { HoverStyle } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hover';
8
+ import { createInstantHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
9
+ import { HoverPosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverWidget';
10
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
11
+ import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
12
+ import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
13
+ import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
14
+ import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
15
+ import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
16
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
17
+ import { basename, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
18
+ import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
19
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
20
+ import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorContextKeys';
21
+ import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
22
+ import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
23
+ import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
24
+ import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
25
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
26
+ import { getFlatContextMenuActions } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
27
+ import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
28
+ import { IMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service';
29
+ import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
30
+ import { RawContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
31
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
32
+ import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
33
+ import { fillInSymbolsDragData } from '@codingame/monaco-vscode-api/vscode/vs/platform/dnd/browser/dnd';
34
+ import { registerOpenEditorListeners } from '../../../../platform/editor/browser/editor.js';
35
+ import { FileKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
36
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
37
+ import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
38
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
39
+ import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
40
+ import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
41
+ import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
42
+ import { FolderThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService';
43
+ import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
44
+ import { fillEditorsDragData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/dnd';
45
+ import { ResourceContextKey } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
46
+ import { SIDE_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
47
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
48
+ import { IPreferencesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/preferences/common/preferences.service';
49
+ import { revealInSideBarCommand } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/files/browser/fileActions.contribution';
50
+ import { CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
51
+ import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
52
+ import { toHistoryItemHoverContent } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/browser/scmHistory';
53
+ import { getHistoryItemEditorTitle } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/browser/util';
54
+ import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
55
+ import { OmittedState, PromptFileVariableKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariableEntries';
56
+ import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
57
+ import { ToolSet } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService';
58
+ import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
59
+ import { getCleanPromptName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
60
+
61
+ const commonHoverOptions = {
62
+ style: HoverStyle.Pointer,
63
+ position: {
64
+ hoverPosition: HoverPosition.BELOW
65
+ },
66
+ trapFocus: true,
67
+ };
68
+ const commonHoverLifecycleOptions = {
69
+ groupId: 'chat-attachments',
70
+ };
71
+ let AbstractChatAttachmentWidget = class AbstractChatAttachmentWidget extends Disposable {
72
+ get onDidDelete() {
73
+ return this._onDidDelete.event;
74
+ }
75
+ get onDidOpen() {
76
+ return this._onDidOpen.event;
77
+ }
78
+ constructor(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService, terminalService) {
79
+ super();
80
+ this.attachment = attachment;
81
+ this.options = options;
82
+ this.currentLanguageModel = currentLanguageModel;
83
+ this.commandService = commandService;
84
+ this.openerService = openerService;
85
+ this.terminalService = terminalService;
86
+ this._onDidDelete = this._register(new Emitter());
87
+ this._onDidOpen = this._register(new Emitter());
88
+ this.element = append(container, $('.chat-attached-context-attachment.show-file-icons'));
89
+ this.label = contextResourceLabels.create(this.element, { supportIcons: true, hoverTargetOverride: this.element });
90
+ this._register(this.label);
91
+ this.element.tabIndex = 0;
92
+ this.element.role = 'button';
93
+ this._register(addDisposableListener(this.element, EventType.AUXCLICK, (e) => {
94
+ if (e.button === 1 && this.options.supportsDeletion && !this.attachment.range) {
95
+ e.preventDefault();
96
+ e.stopPropagation();
97
+ this._onDidDelete.fire(e);
98
+ }
99
+ }));
100
+ }
101
+ modelSupportsVision() {
102
+ return modelSupportsVision(this.currentLanguageModel);
103
+ }
104
+ attachClearButton() {
105
+ if (this.attachment.range || !this.options.supportsDeletion) {
106
+ return;
107
+ }
108
+ const clearButton = ( new Button(this.element, {
109
+ supportIcons: true,
110
+ hoverDelegate: createInstantHoverDelegate(),
111
+ title: ( localize(5013, "Remove from context"))
112
+ }));
113
+ clearButton.element.tabIndex = -1;
114
+ clearButton.icon = Codicon.close;
115
+ this._register(clearButton);
116
+ this._register(Event.once(clearButton.onDidClick)((e) => {
117
+ this._onDidDelete.fire(e);
118
+ }));
119
+ this._register(addStandardDisposableListener(this.element, EventType.KEY_DOWN, e => {
120
+ if (e.keyCode === KeyCode.Backspace || e.keyCode === KeyCode.Delete) {
121
+ this._onDidDelete.fire(e.browserEvent);
122
+ }
123
+ }));
124
+ }
125
+ addResourceOpenHandlers(resource, range) {
126
+ this.element.style.cursor = 'pointer';
127
+ this._register(registerOpenEditorListeners(this.element, async (options) => {
128
+ if (this.attachment.kind === 'directory') {
129
+ await this.openResource(resource, options, true);
130
+ }
131
+ else {
132
+ await this.openResource(resource, options, false, range);
133
+ }
134
+ }));
135
+ }
136
+ async openResource(resource, openOptions, isDirectory, range) {
137
+ if (isDirectory) {
138
+ this.commandService.executeCommand(revealInSideBarCommand.id, resource);
139
+ return;
140
+ }
141
+ if (resource.scheme === Schemas.vscodeTerminal) {
142
+ this.terminalService?.openResource(resource);
143
+ return;
144
+ }
145
+ const openTextEditorOptions = range ? { selection: range } : undefined;
146
+ const options = {
147
+ fromUserGesture: true,
148
+ openToSide: openOptions.openToSide,
149
+ editorOptions: {
150
+ ...openTextEditorOptions,
151
+ ...openOptions.editorOptions
152
+ },
153
+ };
154
+ await this.openerService.open(resource, options);
155
+ this._onDidOpen.fire();
156
+ this.element.focus();
157
+ }
158
+ };
159
+ AbstractChatAttachmentWidget = ( __decorate([
160
+ ( __param(5, ICommandService)),
161
+ ( __param(6, IOpenerService)),
162
+ ( __param(7, ITerminalService))
163
+ ], AbstractChatAttachmentWidget));
164
+ function modelSupportsVision(currentLanguageModel) {
165
+ return currentLanguageModel?.metadata.capabilities?.vision ?? false;
166
+ }
167
+ let FileAttachmentWidget = class FileAttachmentWidget extends AbstractChatAttachmentWidget {
168
+ constructor(resource, range, attachment, correspondingContentReference, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, themeService, hoverService, languageModelsService, instantiationService) {
169
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
170
+ this.themeService = themeService;
171
+ this.hoverService = hoverService;
172
+ this.languageModelsService = languageModelsService;
173
+ this.instantiationService = instantiationService;
174
+ const fileBasename = basename(resource.path);
175
+ const fileDirname = dirname(resource.path);
176
+ const friendlyName = `${fileBasename} ${fileDirname}`;
177
+ let ariaLabel = range ? ( localize(
178
+ 5014,
179
+ "Attached file, {0}, line {1} to line {2}",
180
+ friendlyName,
181
+ range.startLineNumber,
182
+ range.endLineNumber
183
+ )) : ( localize(5015, "Attached file, {0}", friendlyName));
184
+ if (attachment.omittedState === OmittedState.Full) {
185
+ ariaLabel = ( localize(5016, "Omitted this file: {0}", attachment.name));
186
+ this.renderOmittedWarning(friendlyName, ariaLabel);
187
+ }
188
+ else {
189
+ const fileOptions = { hidePath: true, title: correspondingContentReference?.options?.status?.description };
190
+ this.label.setFile(resource, attachment.kind === 'file' ? {
191
+ ...fileOptions,
192
+ fileKind: FileKind.FILE,
193
+ range,
194
+ } : {
195
+ ...fileOptions,
196
+ fileKind: FileKind.FOLDER,
197
+ icon: !this.themeService.getFileIconTheme().hasFolderIcons ? FolderThemeIcon : undefined
198
+ });
199
+ }
200
+ this.element.ariaLabel = ariaLabel;
201
+ this.instantiationService.invokeFunction(accessor => {
202
+ this._register(hookUpResourceAttachmentDragAndContextMenu(accessor, this.element, resource));
203
+ });
204
+ this.addResourceOpenHandlers(resource, range);
205
+ this.attachClearButton();
206
+ }
207
+ renderOmittedWarning(friendlyName, ariaLabel) {
208
+ const pillIcon = $('div.chat-attached-context-pill', {}, $('span.codicon.codicon-warning'));
209
+ const textLabel = $('span.chat-attached-context-custom-text', {}, friendlyName);
210
+ this.element.appendChild(pillIcon);
211
+ this.element.appendChild(textLabel);
212
+ const hoverElement = $('div.chat-attached-context-hover');
213
+ hoverElement.setAttribute('aria-label', ariaLabel);
214
+ this.element.classList.add('warning');
215
+ hoverElement.textContent = ( localize(
216
+ 5017,
217
+ "{0} does not support this file type.",
218
+ this.currentLanguageModel ? this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name : this.currentLanguageModel ?? 'This model'
219
+ ));
220
+ this._register(this.hoverService.setupDelayedHover(this.element, {
221
+ ...commonHoverOptions,
222
+ content: hoverElement,
223
+ }, commonHoverLifecycleOptions));
224
+ }
225
+ };
226
+ FileAttachmentWidget = ( __decorate([
227
+ ( __param(8, ICommandService)),
228
+ ( __param(9, IOpenerService)),
229
+ ( __param(10, IThemeService)),
230
+ ( __param(11, IHoverService)),
231
+ ( __param(12, ILanguageModelsService)),
232
+ ( __param(13, IInstantiationService))
233
+ ], FileAttachmentWidget));
234
+ let TerminalCommandAttachmentWidget = class TerminalCommandAttachmentWidget extends AbstractChatAttachmentWidget {
235
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, hoverService, terminalService) {
236
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService, terminalService);
237
+ this.hoverService = hoverService;
238
+ this.terminalService = terminalService;
239
+ const ariaLabel = ( localize(5018, "Terminal command, {0}", attachment.command));
240
+ const clickHandler = () => this.openResource(attachment.resource, { editorOptions: { preserveFocus: true } }, false, undefined);
241
+ this._register(createTerminalCommandElements(this.element, attachment, ariaLabel, this.hoverService, clickHandler));
242
+ this._register(addDisposableListener(this.element, EventType.KEY_DOWN, async (e) => {
243
+ const event = ( new StandardKeyboardEvent(e));
244
+ if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
245
+ EventHelper.stop(e, true);
246
+ await clickHandler();
247
+ }
248
+ }));
249
+ this.attachClearButton();
250
+ }
251
+ };
252
+ TerminalCommandAttachmentWidget = ( __decorate([
253
+ ( __param(5, ICommandService)),
254
+ ( __param(6, IOpenerService)),
255
+ ( __param(7, IHoverService)),
256
+ ( __param(8, ITerminalService))
257
+ ], TerminalCommandAttachmentWidget));
258
+ var TerminalConstants;
259
+ (function (TerminalConstants) {
260
+ TerminalConstants[TerminalConstants["MaxAttachmentOutputLineCount"] = 5] = "MaxAttachmentOutputLineCount";
261
+ TerminalConstants[TerminalConstants["MaxAttachmentOutputLineLength"] = 80] = "MaxAttachmentOutputLineLength";
262
+ })(TerminalConstants || (TerminalConstants = {}));
263
+ function createTerminalCommandElements(element, attachment, ariaLabel, hoverService, clickHandler) {
264
+ const disposable = ( new DisposableStore());
265
+ element.ariaLabel = ariaLabel;
266
+ element.style.cursor = 'pointer';
267
+ const terminalIconSpan = $('span');
268
+ terminalIconSpan.classList.add(...ThemeIcon.asClassNameArray(Codicon.terminal));
269
+ const pillIcon = $('div.chat-attached-context-pill', {}, terminalIconSpan);
270
+ const textLabel = $('span.chat-attached-context-custom-text', {}, attachment.command);
271
+ element.appendChild(pillIcon);
272
+ element.appendChild(textLabel);
273
+ disposable.add(addDisposableListener(element, EventType.CLICK, e => {
274
+ e.preventDefault();
275
+ e.stopPropagation();
276
+ clickHandler();
277
+ }));
278
+ const hoverElement = $('div.chat-attached-context-hover');
279
+ hoverElement.setAttribute('aria-label', ariaLabel);
280
+ const commandTitle = $('div', {}, typeof attachment.exitCode === 'number'
281
+ ? ( localize(
282
+ 5019,
283
+ "Command: {0}, exit code: {1}",
284
+ attachment.command,
285
+ attachment.exitCode
286
+ ))
287
+ : ( localize(5020, "Command")));
288
+ commandTitle.classList.add('attachment-additional-info');
289
+ const commandBlock = $('pre.chat-terminal-command-block');
290
+ hoverElement.append(commandTitle, commandBlock);
291
+ if (attachment.output && attachment.output.trim().length > 0) {
292
+ const outputTitle = $('div', {}, ( localize(5021, "Output:")));
293
+ outputTitle.classList.add('attachment-additional-info');
294
+ const outputBlock = $('pre.chat-terminal-command-output');
295
+ const fullOutputLines = attachment.output.split('\n');
296
+ const hoverOutputLines = [];
297
+ for (const line of fullOutputLines) {
298
+ if (hoverOutputLines.length >= TerminalConstants.MaxAttachmentOutputLineCount) {
299
+ hoverOutputLines.push('...');
300
+ break;
301
+ }
302
+ const trimmed = line.trim();
303
+ if (trimmed.length === 0) {
304
+ continue;
305
+ }
306
+ if (trimmed.length > TerminalConstants.MaxAttachmentOutputLineLength) {
307
+ hoverOutputLines.push(`${trimmed.slice(0, TerminalConstants.MaxAttachmentOutputLineLength)}...`);
308
+ }
309
+ else {
310
+ hoverOutputLines.push(trimmed);
311
+ }
312
+ }
313
+ outputBlock.textContent = hoverOutputLines.join('\n');
314
+ hoverElement.append(outputTitle, outputBlock);
315
+ }
316
+ const hint = $('div', {}, ( localize(5022, "Click to focus this command in the terminal.")));
317
+ hint.classList.add('attachment-additional-info');
318
+ hoverElement.appendChild(hint);
319
+ disposable.add(hoverService.setupDelayedHover(element, {
320
+ ...commonHoverOptions,
321
+ content: hoverElement,
322
+ }, commonHoverLifecycleOptions));
323
+ return disposable;
324
+ }
325
+ let ImageAttachmentWidget = class ImageAttachmentWidget extends AbstractChatAttachmentWidget {
326
+ constructor(resource, attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, hoverService, languageModelsService, instantiationService, labelService) {
327
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
328
+ this.hoverService = hoverService;
329
+ this.languageModelsService = languageModelsService;
330
+ this.labelService = labelService;
331
+ let ariaLabel;
332
+ if (attachment.omittedState === OmittedState.Full) {
333
+ ariaLabel = ( localize(5023, "Omitted this image: {0}", attachment.name));
334
+ }
335
+ else if (attachment.omittedState === OmittedState.Partial) {
336
+ ariaLabel = ( localize(5024, "Partially omitted this image: {0}", attachment.name));
337
+ }
338
+ else {
339
+ ariaLabel = ( localize(5025, "Attached image, {0}", attachment.name));
340
+ }
341
+ const ref = attachment.references?.[0]?.reference;
342
+ resource = ref && URI.isUri(ref) ? ref : undefined;
343
+ const clickHandler = async () => {
344
+ if (resource) {
345
+ await this.openResource(resource, { editorOptions: { preserveFocus: true } }, false, undefined);
346
+ }
347
+ };
348
+ const currentLanguageModelName = this.currentLanguageModel ? this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name ?? this.currentLanguageModel.identifier : 'Current model';
349
+ const fullName = resource ? this.labelService.getUriLabel(resource) : (attachment.fullName || attachment.name);
350
+ this._register(createImageElements(resource, attachment.name, fullName, this.element, attachment.value, this.hoverService, ariaLabel, currentLanguageModelName, clickHandler, this.currentLanguageModel, attachment.omittedState));
351
+ if (resource) {
352
+ this.addResourceOpenHandlers(resource, undefined);
353
+ instantiationService.invokeFunction(accessor => {
354
+ this._register(hookUpResourceAttachmentDragAndContextMenu(accessor, this.element, resource));
355
+ });
356
+ }
357
+ this.attachClearButton();
358
+ }
359
+ };
360
+ ImageAttachmentWidget = ( __decorate([
361
+ ( __param(6, ICommandService)),
362
+ ( __param(7, IOpenerService)),
363
+ ( __param(8, IHoverService)),
364
+ ( __param(9, ILanguageModelsService)),
365
+ ( __param(10, IInstantiationService)),
366
+ ( __param(11, ILabelService))
367
+ ], ImageAttachmentWidget));
368
+ function createImageElements(resource, name, fullName, element, buffer, hoverService, ariaLabel, currentLanguageModelName, clickHandler, currentLanguageModel, omittedState) {
369
+ const disposable = ( new DisposableStore());
370
+ if (omittedState === OmittedState.Partial) {
371
+ element.classList.add('partial-warning');
372
+ }
373
+ element.ariaLabel = ariaLabel;
374
+ element.style.position = 'relative';
375
+ if (resource) {
376
+ element.style.cursor = 'pointer';
377
+ disposable.add(addDisposableListener(element, 'click', clickHandler));
378
+ }
379
+ const supportsVision = modelSupportsVision(currentLanguageModel);
380
+ const pillIcon = $('div.chat-attached-context-pill', {}, $(supportsVision ? 'span.codicon.codicon-file-media' : 'span.codicon.codicon-warning'));
381
+ const textLabel = $('span.chat-attached-context-custom-text', {}, name);
382
+ element.appendChild(pillIcon);
383
+ element.appendChild(textLabel);
384
+ const hoverElement = $('div.chat-attached-context-hover');
385
+ hoverElement.setAttribute('aria-label', ariaLabel);
386
+ if ((!supportsVision && currentLanguageModel) || omittedState === OmittedState.Full) {
387
+ element.classList.add('warning');
388
+ hoverElement.textContent = ( localize(
389
+ 5026,
390
+ "{0} does not support images.",
391
+ currentLanguageModelName ?? 'This model'
392
+ ));
393
+ disposable.add(hoverService.setupDelayedHover(element, {
394
+ content: hoverElement,
395
+ style: HoverStyle.Pointer,
396
+ }));
397
+ }
398
+ else {
399
+ disposable.add(hoverService.setupDelayedHover(element, {
400
+ content: hoverElement,
401
+ style: HoverStyle.Pointer,
402
+ }));
403
+ const blob = ( new Blob([buffer], { type: 'image/png' }));
404
+ const url = URL.createObjectURL(blob);
405
+ const pillImg = $('img.chat-attached-context-pill-image', { src: url, alt: '' });
406
+ const pill = $('div.chat-attached-context-pill', {}, pillImg);
407
+ const existingPill = element.querySelector('.chat-attached-context-pill');
408
+ if (existingPill) {
409
+ existingPill.replaceWith(pill);
410
+ }
411
+ const hoverImage = $('img.chat-attached-context-image', { src: url, alt: '' });
412
+ const imageContainer = $('div.chat-attached-context-image-container', {}, hoverImage);
413
+ hoverElement.appendChild(imageContainer);
414
+ if (resource) {
415
+ const urlContainer = $('a.chat-attached-context-url', {}, omittedState === OmittedState.Partial ? ( localize(5027, "This GIF was partially omitted - current frame will be sent.")) : fullName);
416
+ const separator = $('div.chat-attached-context-url-separator');
417
+ disposable.add(addDisposableListener(urlContainer, 'click', () => clickHandler()));
418
+ hoverElement.append(separator, urlContainer);
419
+ }
420
+ hoverImage.onload = () => { URL.revokeObjectURL(url); };
421
+ hoverImage.onerror = () => {
422
+ const pillIcon = $('div.chat-attached-context-pill', {}, $('span.codicon.codicon-file-media'));
423
+ const pill = $('div.chat-attached-context-pill', {}, pillIcon);
424
+ const existingPill = element.querySelector('.chat-attached-context-pill');
425
+ if (existingPill) {
426
+ existingPill.replaceWith(pill);
427
+ }
428
+ };
429
+ }
430
+ return disposable;
431
+ }
432
+ let PasteAttachmentWidget = class PasteAttachmentWidget extends AbstractChatAttachmentWidget {
433
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, hoverService, instantiationService) {
434
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
435
+ this.hoverService = hoverService;
436
+ this.instantiationService = instantiationService;
437
+ const ariaLabel = ( localize(5028, "Attached context, {0}", attachment.name));
438
+ this.element.ariaLabel = ariaLabel;
439
+ const classNames = ['file-icon', `${attachment.language}-lang-file-icon`];
440
+ let resource;
441
+ let range;
442
+ if (attachment.copiedFrom) {
443
+ resource = attachment.copiedFrom.uri;
444
+ range = attachment.copiedFrom.range;
445
+ const filename = basename(resource.path);
446
+ this.label.setLabel(filename, undefined, { extraClasses: classNames });
447
+ }
448
+ else {
449
+ this.label.setLabel(attachment.fileName, undefined, { extraClasses: classNames });
450
+ }
451
+ this.element.appendChild($('span.attachment-additional-info', {}, `Pasted ${attachment.pastedLines}`));
452
+ this.element.style.position = 'relative';
453
+ const sourceUri = attachment.copiedFrom?.uri;
454
+ const hoverContent = ( new MarkdownString(
455
+ `${sourceUri ? this.instantiationService.invokeFunction(accessor => accessor.get(ILabelService).getUriLabel(sourceUri, { relative: true })) : attachment.fileName}\n\n---\n\n\`\`\`${attachment.language}\n\n${attachment.code}\n\`\`\``
456
+ ));
457
+ this._register(this.hoverService.setupDelayedHover(this.element, {
458
+ ...commonHoverOptions,
459
+ content: hoverContent,
460
+ }, commonHoverLifecycleOptions));
461
+ const copiedFromResource = attachment.copiedFrom?.uri;
462
+ if (copiedFromResource) {
463
+ this._register(this.instantiationService.invokeFunction(hookUpResourceAttachmentDragAndContextMenu, this.element, copiedFromResource));
464
+ this.addResourceOpenHandlers(copiedFromResource, range);
465
+ }
466
+ this.attachClearButton();
467
+ }
468
+ };
469
+ PasteAttachmentWidget = ( __decorate([
470
+ ( __param(5, ICommandService)),
471
+ ( __param(6, IOpenerService)),
472
+ ( __param(7, IHoverService)),
473
+ ( __param(8, IInstantiationService))
474
+ ], PasteAttachmentWidget));
475
+ let DefaultChatAttachmentWidget = class DefaultChatAttachmentWidget extends AbstractChatAttachmentWidget {
476
+ constructor(resource, range, attachment, correspondingContentReference, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, contextKeyService, instantiationService) {
477
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
478
+ this.contextKeyService = contextKeyService;
479
+ this.instantiationService = instantiationService;
480
+ const attachmentLabel = attachment.fullName ?? attachment.name;
481
+ const withIcon = attachment.icon?.id ? `$(${attachment.icon.id})\u00A0${attachmentLabel}` : attachmentLabel;
482
+ this.label.setLabel(withIcon, correspondingContentReference?.options?.status?.description);
483
+ this.element.ariaLabel = ( localize(5028, "Attached context, {0}", attachment.name));
484
+ if (attachment.kind === 'diagnostic') {
485
+ if (attachment.filterUri) {
486
+ resource = attachment.filterUri ? URI.revive(attachment.filterUri) : undefined;
487
+ range = attachment.filterRange;
488
+ }
489
+ else {
490
+ this.element.style.cursor = 'pointer';
491
+ this._register(addDisposableListener(this.element, EventType.CLICK, () => {
492
+ this.commandService.executeCommand('workbench.panel.markers.view.focus');
493
+ }));
494
+ }
495
+ }
496
+ if (attachment.kind === 'symbol') {
497
+ const scopedContextKeyService = this._register(this.contextKeyService.createScoped(this.element));
498
+ this._register(this.instantiationService.invokeFunction(hookUpSymbolAttachmentDragAndContextMenu, this.element, scopedContextKeyService, { ...attachment, kind: attachment.symbolKind }, MenuId.ChatInputSymbolAttachmentContext));
499
+ }
500
+ if (resource) {
501
+ this.addResourceOpenHandlers(resource, range);
502
+ }
503
+ this.attachClearButton();
504
+ }
505
+ };
506
+ DefaultChatAttachmentWidget = ( __decorate([
507
+ ( __param(8, ICommandService)),
508
+ ( __param(9, IOpenerService)),
509
+ ( __param(10, IContextKeyService)),
510
+ ( __param(11, IInstantiationService))
511
+ ], DefaultChatAttachmentWidget));
512
+ let PromptFileAttachmentWidget = class PromptFileAttachmentWidget extends AbstractChatAttachmentWidget {
513
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, labelService, instantiationService) {
514
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
515
+ this.labelService = labelService;
516
+ this.instantiationService = instantiationService;
517
+ this.hintElement = append(this.element, $('span.prompt-type'));
518
+ this.updateLabel(attachment);
519
+ this.instantiationService.invokeFunction(accessor => {
520
+ this._register(hookUpResourceAttachmentDragAndContextMenu(accessor, this.element, attachment.value));
521
+ });
522
+ this.addResourceOpenHandlers(attachment.value, undefined);
523
+ this.attachClearButton();
524
+ }
525
+ updateLabel(attachment) {
526
+ const resource = attachment.value;
527
+ const fileBasename = basename(resource.path);
528
+ const fileDirname = dirname(resource.path);
529
+ const friendlyName = `${fileBasename} ${fileDirname}`;
530
+ const isPrompt = attachment.id.startsWith(PromptFileVariableKind.PromptFile);
531
+ const ariaLabel = isPrompt
532
+ ? ( localize(5029, "Prompt file, {0}", friendlyName))
533
+ : ( localize(5030, "Instructions attachment, {0}", friendlyName));
534
+ const typeLabel = isPrompt
535
+ ? ( localize(5031, "Prompt"))
536
+ : ( localize(5032, "Instructions"));
537
+ const title = this.labelService.getUriLabel(resource) + (attachment.originLabel ? `\n${attachment.originLabel}` : '');
538
+ this.element.classList.remove('warning', 'error');
539
+ const fileWithoutExtension = getCleanPromptName(resource);
540
+ this.label.setFile(URI.file(fileWithoutExtension), {
541
+ fileKind: FileKind.FILE,
542
+ hidePath: true,
543
+ range: undefined,
544
+ title,
545
+ icon: ThemeIcon.fromId(Codicon.bookmark.id),
546
+ extraClasses: [],
547
+ });
548
+ this.hintElement.innerText = typeLabel;
549
+ this.element.ariaLabel = ariaLabel;
550
+ }
551
+ };
552
+ PromptFileAttachmentWidget = ( __decorate([
553
+ ( __param(5, ICommandService)),
554
+ ( __param(6, IOpenerService)),
555
+ ( __param(7, ILabelService)),
556
+ ( __param(8, IInstantiationService))
557
+ ], PromptFileAttachmentWidget));
558
+ let PromptTextAttachmentWidget = class PromptTextAttachmentWidget extends AbstractChatAttachmentWidget {
559
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, preferencesService, hoverService) {
560
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
561
+ if (attachment.settingId) {
562
+ const openSettings = () => preferencesService.openSettings({ jsonEditor: false, query: `@id:${attachment.settingId}` });
563
+ this.element.style.cursor = 'pointer';
564
+ this._register(addDisposableListener(this.element, EventType.CLICK, async (e) => {
565
+ EventHelper.stop(e, true);
566
+ openSettings();
567
+ }));
568
+ this._register(addDisposableListener(this.element, EventType.KEY_DOWN, async (e) => {
569
+ const event = ( new StandardKeyboardEvent(e));
570
+ if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
571
+ EventHelper.stop(e, true);
572
+ openSettings();
573
+ }
574
+ }));
575
+ }
576
+ this.label.setLabel(( localize(5033, 'Additional Instructions')), undefined, undefined);
577
+ this._register(hoverService.setupDelayedHover(this.element, {
578
+ ...commonHoverOptions,
579
+ content: attachment.value,
580
+ }, commonHoverLifecycleOptions));
581
+ }
582
+ };
583
+ PromptTextAttachmentWidget = ( __decorate([
584
+ ( __param(5, ICommandService)),
585
+ ( __param(6, IOpenerService)),
586
+ ( __param(7, IPreferencesService)),
587
+ ( __param(8, IHoverService))
588
+ ], PromptTextAttachmentWidget));
589
+ let ToolSetOrToolItemAttachmentWidget = class ToolSetOrToolItemAttachmentWidget extends AbstractChatAttachmentWidget {
590
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, toolsService, commandService, openerService, hoverService) {
591
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
592
+ const toolOrToolSet = Iterable.find(toolsService.getTools(), tool => tool.id === attachment.id) ?? Iterable.find(toolsService.toolSets.get(), toolSet => toolSet.id === attachment.id);
593
+ let name = attachment.name;
594
+ const icon = attachment.icon ?? Codicon.tools;
595
+ if (toolOrToolSet instanceof ToolSet) {
596
+ name = toolOrToolSet.referenceName;
597
+ }
598
+ else if (toolOrToolSet) {
599
+ name = toolOrToolSet.toolReferenceName ?? name;
600
+ }
601
+ this.label.setLabel(`$(${icon.id})\u00A0${name}`, undefined);
602
+ this.element.style.cursor = 'pointer';
603
+ this.element.ariaLabel = ( localize(5028, "Attached context, {0}", name));
604
+ let hoverContent;
605
+ if (toolOrToolSet instanceof ToolSet) {
606
+ hoverContent = ( localize(
607
+ 5034,
608
+ "{0} - {1}",
609
+ toolOrToolSet.description ?? toolOrToolSet.referenceName,
610
+ toolOrToolSet.source.label
611
+ ));
612
+ }
613
+ else if (toolOrToolSet) {
614
+ hoverContent = ( localize(
615
+ 5035,
616
+ "{0} - {1}",
617
+ toolOrToolSet.userDescription ?? toolOrToolSet.modelDescription,
618
+ toolOrToolSet.source.label
619
+ ));
620
+ }
621
+ if (hoverContent) {
622
+ this._register(hoverService.setupDelayedHover(this.element, {
623
+ ...commonHoverOptions,
624
+ content: hoverContent,
625
+ }, commonHoverLifecycleOptions));
626
+ }
627
+ this.attachClearButton();
628
+ }
629
+ };
630
+ ToolSetOrToolItemAttachmentWidget = ( __decorate([
631
+ ( __param(5, ILanguageModelToolsService)),
632
+ ( __param(6, ICommandService)),
633
+ ( __param(7, IOpenerService)),
634
+ ( __param(8, IHoverService))
635
+ ], ToolSetOrToolItemAttachmentWidget));
636
+ let NotebookCellOutputChatAttachmentWidget = class NotebookCellOutputChatAttachmentWidget extends AbstractChatAttachmentWidget {
637
+ constructor(resource, attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, hoverService, languageModelsService, notebookService, instantiationService) {
638
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
639
+ this.hoverService = hoverService;
640
+ this.languageModelsService = languageModelsService;
641
+ this.notebookService = notebookService;
642
+ this.instantiationService = instantiationService;
643
+ switch (attachment.mimeType) {
644
+ case 'application/vnd.code.notebook.error': {
645
+ this.renderErrorOutput(resource, attachment);
646
+ break;
647
+ }
648
+ case 'image/png':
649
+ case 'image/jpeg':
650
+ case 'image/svg': {
651
+ this.renderImageOutput(resource, attachment);
652
+ break;
653
+ }
654
+ default: {
655
+ this.renderGenericOutput(resource, attachment);
656
+ }
657
+ }
658
+ this.instantiationService.invokeFunction(accessor => {
659
+ this._register(hookUpResourceAttachmentDragAndContextMenu(accessor, this.element, resource));
660
+ });
661
+ this.addResourceOpenHandlers(resource, undefined);
662
+ this.attachClearButton();
663
+ }
664
+ getAriaLabel(attachment) {
665
+ return localize(5036, "Attached Notebook output, {0}", attachment.name);
666
+ }
667
+ renderErrorOutput(resource, attachment) {
668
+ const attachmentLabel = attachment.name;
669
+ const withIcon = attachment.icon?.id ? `$(${attachment.icon.id})\u00A0${attachmentLabel}` : attachmentLabel;
670
+ const buffer = this.getOutputItem(resource, attachment)?.data.buffer ?? ( new Uint8Array());
671
+ let title = undefined;
672
+ try {
673
+ const error = JSON.parse(( new TextDecoder()).decode(buffer));
674
+ if (error.name && error.message) {
675
+ title = `${error.name}: ${error.message}`;
676
+ }
677
+ }
678
+ catch {
679
+ }
680
+ this.label.setLabel(withIcon, undefined, { title });
681
+ this.element.ariaLabel = this.getAriaLabel(attachment);
682
+ }
683
+ renderGenericOutput(resource, attachment) {
684
+ this.element.ariaLabel = this.getAriaLabel(attachment);
685
+ this.label.setFile(resource, { hidePath: true, icon: ThemeIcon.fromId('output') });
686
+ }
687
+ renderImageOutput(resource, attachment) {
688
+ let ariaLabel;
689
+ if (attachment.omittedState === OmittedState.Full) {
690
+ ariaLabel = ( localize(5037, "Omitted this Notebook ouput: {0}", attachment.name));
691
+ }
692
+ else if (attachment.omittedState === OmittedState.Partial) {
693
+ ariaLabel = ( localize(5038, "Partially omitted this Notebook output: {0}", attachment.name));
694
+ }
695
+ else {
696
+ ariaLabel = this.getAriaLabel(attachment);
697
+ }
698
+ const clickHandler = async () => await this.openResource(resource, { editorOptions: { preserveFocus: true } }, false, undefined);
699
+ const currentLanguageModelName = this.currentLanguageModel ? this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name ?? this.currentLanguageModel.identifier : undefined;
700
+ const buffer = this.getOutputItem(resource, attachment)?.data.buffer ?? ( new Uint8Array());
701
+ this._register(createImageElements(resource, attachment.name, attachment.name, this.element, buffer, this.hoverService, ariaLabel, currentLanguageModelName, clickHandler, this.currentLanguageModel, attachment.omittedState));
702
+ }
703
+ getOutputItem(resource, attachment) {
704
+ const parsedInfo = CellUri.parseCellOutputUri(resource);
705
+ if (!parsedInfo || typeof parsedInfo.cellHandle !== 'number' || typeof parsedInfo.outputIndex !== 'number') {
706
+ return undefined;
707
+ }
708
+ const notebook = this.notebookService.getNotebookTextModel(parsedInfo.notebook);
709
+ if (!notebook) {
710
+ return undefined;
711
+ }
712
+ const cell = notebook.cells.find(c => c.handle === parsedInfo.cellHandle);
713
+ if (!cell) {
714
+ return undefined;
715
+ }
716
+ const output = cell.outputs.length > parsedInfo.outputIndex ? cell.outputs[parsedInfo.outputIndex] : undefined;
717
+ return output?.outputs.find(o => o.mime === attachment.mimeType);
718
+ }
719
+ };
720
+ NotebookCellOutputChatAttachmentWidget = ( __decorate([
721
+ ( __param(6, ICommandService)),
722
+ ( __param(7, IOpenerService)),
723
+ ( __param(8, IHoverService)),
724
+ ( __param(9, ILanguageModelsService)),
725
+ ( __param(10, INotebookService)),
726
+ ( __param(11, IInstantiationService))
727
+ ], NotebookCellOutputChatAttachmentWidget));
728
+ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends AbstractChatAttachmentWidget {
729
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, editorService) {
730
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
731
+ const ariaLabel = ( localize(5039, "Attached element, {0}", attachment.name));
732
+ this.element.ariaLabel = ariaLabel;
733
+ this.element.style.position = 'relative';
734
+ this.element.style.cursor = 'pointer';
735
+ const attachmentLabel = attachment.name;
736
+ const withIcon = attachment.icon?.id ? `$(${attachment.icon.id})\u00A0${attachmentLabel}` : attachmentLabel;
737
+ this.label.setLabel(withIcon, undefined, { title: ( localize(5040, "Click to view the contents of: {0}", attachmentLabel)) });
738
+ this._register(addDisposableListener(this.element, EventType.CLICK, async () => {
739
+ const content = attachment.value?.toString() || '';
740
+ await editorService.openEditor({
741
+ resource: undefined,
742
+ contents: content,
743
+ options: {
744
+ pinned: true
745
+ }
746
+ });
747
+ }));
748
+ this.attachClearButton();
749
+ }
750
+ };
751
+ ElementChatAttachmentWidget = ( __decorate([
752
+ ( __param(5, ICommandService)),
753
+ ( __param(6, IOpenerService)),
754
+ ( __param(7, IEditorService))
755
+ ], ElementChatAttachmentWidget));
756
+ let SCMHistoryItemAttachmentWidget = class SCMHistoryItemAttachmentWidget extends AbstractChatAttachmentWidget {
757
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, markdownRendererService, hoverService, openerService, themeService) {
758
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
759
+ this.label.setLabel(attachment.name, undefined);
760
+ this.element.style.cursor = 'pointer';
761
+ this.element.ariaLabel = ( localize(5028, "Attached context, {0}", attachment.name));
762
+ const { content, disposables } = toHistoryItemHoverContent(markdownRendererService, attachment.historyItem, false);
763
+ this._store.add(hoverService.setupDelayedHover(this.element, {
764
+ ...commonHoverOptions,
765
+ content,
766
+ }, commonHoverLifecycleOptions));
767
+ this._store.add(disposables);
768
+ this._store.add(addDisposableListener(this.element, EventType.CLICK, (e) => {
769
+ EventHelper.stop(e, true);
770
+ this._openAttachment(attachment);
771
+ }));
772
+ this._store.add(addDisposableListener(this.element, EventType.KEY_DOWN, (e) => {
773
+ const event = ( new StandardKeyboardEvent(e));
774
+ if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
775
+ EventHelper.stop(e, true);
776
+ this._openAttachment(attachment);
777
+ }
778
+ }));
779
+ this.attachClearButton();
780
+ }
781
+ async _openAttachment(attachment) {
782
+ await this.commandService.executeCommand('_workbench.openMultiDiffEditor', {
783
+ title: getHistoryItemEditorTitle(attachment.historyItem), multiDiffSourceUri: attachment.value
784
+ });
785
+ }
786
+ };
787
+ SCMHistoryItemAttachmentWidget = ( __decorate([
788
+ ( __param(5, ICommandService)),
789
+ ( __param(6, IMarkdownRendererService)),
790
+ ( __param(7, IHoverService)),
791
+ ( __param(8, IOpenerService)),
792
+ ( __param(9, IThemeService))
793
+ ], SCMHistoryItemAttachmentWidget));
794
+ let SCMHistoryItemChangeAttachmentWidget = class SCMHistoryItemChangeAttachmentWidget extends AbstractChatAttachmentWidget {
795
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, hoverService, markdownRendererService, openerService, themeService, editorService) {
796
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
797
+ this.editorService = editorService;
798
+ const nameSuffix = `\u00A0$(${Codicon.gitCommit.id})${attachment.historyItem.displayId ?? attachment.historyItem.id}`;
799
+ this.label.setFile(attachment.value, { fileKind: FileKind.FILE, hidePath: true, nameSuffix });
800
+ this.element.ariaLabel = ( localize(5028, "Attached context, {0}", attachment.name));
801
+ const { content, disposables } = toHistoryItemHoverContent(markdownRendererService, attachment.historyItem, false);
802
+ this._store.add(hoverService.setupDelayedHover(this.element, {
803
+ ...commonHoverOptions, content,
804
+ }, commonHoverLifecycleOptions));
805
+ this._store.add(disposables);
806
+ this.addResourceOpenHandlers(attachment.value, undefined);
807
+ this.attachClearButton();
808
+ }
809
+ async openResource(resource, options, isDirectory, range) {
810
+ const attachment = this.attachment;
811
+ const historyItem = attachment.historyItem;
812
+ await this.editorService.openEditor({
813
+ resource,
814
+ label: `${basename(resource.path)} (${historyItem.displayId ?? historyItem.id})`,
815
+ options: { ...options.editorOptions }
816
+ }, options.openToSide ? SIDE_GROUP : undefined);
817
+ }
818
+ };
819
+ SCMHistoryItemChangeAttachmentWidget = ( __decorate([
820
+ ( __param(5, ICommandService)),
821
+ ( __param(6, IHoverService)),
822
+ ( __param(7, IMarkdownRendererService)),
823
+ ( __param(8, IOpenerService)),
824
+ ( __param(9, IThemeService)),
825
+ ( __param(10, IEditorService))
826
+ ], SCMHistoryItemChangeAttachmentWidget));
827
+ let SCMHistoryItemChangeRangeAttachmentWidget = class SCMHistoryItemChangeRangeAttachmentWidget extends AbstractChatAttachmentWidget {
828
+ constructor(attachment, currentLanguageModel, options, container, contextResourceLabels, commandService, openerService, editorService) {
829
+ super(attachment, options, container, contextResourceLabels, currentLanguageModel, commandService, openerService);
830
+ this.editorService = editorService;
831
+ const historyItemStartId = attachment.historyItemChangeStart.historyItem.displayId ?? attachment.historyItemChangeStart.historyItem.id;
832
+ const historyItemEndId = attachment.historyItemChangeEnd.historyItem.displayId ?? attachment.historyItemChangeEnd.historyItem.id;
833
+ const nameSuffix = `\u00A0$(${Codicon.gitCommit.id})${historyItemStartId}..${historyItemEndId}`;
834
+ this.label.setFile(attachment.value, { fileKind: FileKind.FILE, hidePath: true, nameSuffix });
835
+ this.element.ariaLabel = ( localize(5028, "Attached context, {0}", attachment.name));
836
+ this.addResourceOpenHandlers(attachment.value, undefined);
837
+ this.attachClearButton();
838
+ }
839
+ async openResource(resource, options, isDirectory, range) {
840
+ const attachment = this.attachment;
841
+ const historyItemChangeStart = attachment.historyItemChangeStart;
842
+ const historyItemChangeEnd = attachment.historyItemChangeEnd;
843
+ const originalUriTitle = `${basename(historyItemChangeStart.uri.fsPath)} (${historyItemChangeStart.historyItem.displayId ?? historyItemChangeStart.historyItem.id})`;
844
+ const modifiedUriTitle = `${basename(historyItemChangeEnd.uri.fsPath)} (${historyItemChangeEnd.historyItem.displayId ?? historyItemChangeEnd.historyItem.id})`;
845
+ await this.editorService.openEditor({
846
+ original: { resource: historyItemChangeStart.uri },
847
+ modified: { resource: historyItemChangeEnd.uri },
848
+ label: `${originalUriTitle} ↔ ${modifiedUriTitle}`,
849
+ options: { ...options.editorOptions }
850
+ }, options.openToSide ? SIDE_GROUP : undefined);
851
+ }
852
+ };
853
+ SCMHistoryItemChangeRangeAttachmentWidget = ( __decorate([
854
+ ( __param(5, ICommandService)),
855
+ ( __param(6, IOpenerService)),
856
+ ( __param(7, IEditorService))
857
+ ], SCMHistoryItemChangeRangeAttachmentWidget));
858
+ function hookUpResourceAttachmentDragAndContextMenu(accessor, widget, resource) {
859
+ const contextKeyService = accessor.get(IContextKeyService);
860
+ const instantiationService = accessor.get(IInstantiationService);
861
+ const store = ( new DisposableStore());
862
+ const scopedContextKeyService = store.add(contextKeyService.createScoped(widget));
863
+ store.add(setResourceContext(accessor, scopedContextKeyService, resource));
864
+ widget.draggable = true;
865
+ store.add(addDisposableListener(widget, 'dragstart', e => {
866
+ instantiationService.invokeFunction(accessor => fillEditorsDragData(accessor, [resource], e));
867
+ e.dataTransfer?.setDragImage(widget, 0, 0);
868
+ }));
869
+ store.add(addBasicContextMenu(accessor, widget, scopedContextKeyService, MenuId.ChatInputResourceAttachmentContext, resource));
870
+ return store;
871
+ }
872
+ function hookUpSymbolAttachmentDragAndContextMenu(accessor, widget, scopedContextKeyService, attachment, contextMenuId) {
873
+ const instantiationService = accessor.get(IInstantiationService);
874
+ const languageFeaturesService = accessor.get(ILanguageFeaturesService);
875
+ const textModelService = accessor.get(ITextModelService);
876
+ const store = ( new DisposableStore());
877
+ store.add(setResourceContext(accessor, scopedContextKeyService, attachment.value.uri));
878
+ const chatResourceContext = chatAttachmentResourceContextKey.bindTo(scopedContextKeyService);
879
+ chatResourceContext.set(( attachment.value.uri.toString()));
880
+ widget.draggable = true;
881
+ store.add(addDisposableListener(widget, 'dragstart', e => {
882
+ instantiationService.invokeFunction(accessor => fillEditorsDragData(accessor, [{ resource: attachment.value.uri, selection: attachment.value.range }], e));
883
+ fillInSymbolsDragData([{
884
+ fsPath: attachment.value.uri.fsPath,
885
+ range: attachment.value.range,
886
+ name: attachment.name,
887
+ kind: attachment.kind,
888
+ }], e);
889
+ e.dataTransfer?.setDragImage(widget, 0, 0);
890
+ }));
891
+ const providerContexts = [
892
+ [EditorContextKeys.hasDefinitionProvider.bindTo(scopedContextKeyService), languageFeaturesService.definitionProvider],
893
+ [EditorContextKeys.hasReferenceProvider.bindTo(scopedContextKeyService), languageFeaturesService.referenceProvider],
894
+ [EditorContextKeys.hasImplementationProvider.bindTo(scopedContextKeyService), languageFeaturesService.implementationProvider],
895
+ [EditorContextKeys.hasTypeDefinitionProvider.bindTo(scopedContextKeyService), languageFeaturesService.typeDefinitionProvider],
896
+ ];
897
+ const updateContextKeys = async () => {
898
+ const modelRef = await textModelService.createModelReference(attachment.value.uri);
899
+ try {
900
+ const model = modelRef.object.textEditorModel;
901
+ for (const [contextKey, registry] of providerContexts) {
902
+ contextKey.set(( registry.has(model)));
903
+ }
904
+ }
905
+ finally {
906
+ modelRef.dispose();
907
+ }
908
+ };
909
+ store.add(addBasicContextMenu(accessor, widget, scopedContextKeyService, contextMenuId, attachment.value, updateContextKeys));
910
+ return store;
911
+ }
912
+ function setResourceContext(accessor, scopedContextKeyService, resource) {
913
+ const fileService = accessor.get(IFileService);
914
+ const languageService = accessor.get(ILanguageService);
915
+ const modelService = accessor.get(IModelService);
916
+ const resourceContextKey = ( new ResourceContextKey(scopedContextKeyService, fileService, languageService, modelService));
917
+ resourceContextKey.set(resource);
918
+ return resourceContextKey;
919
+ }
920
+ function addBasicContextMenu(accessor, widget, scopedContextKeyService, menuId, arg, updateContextKeys) {
921
+ const contextMenuService = accessor.get(IContextMenuService);
922
+ const menuService = accessor.get(IMenuService);
923
+ return addDisposableListener(widget, EventType.CONTEXT_MENU, async (domEvent) => {
924
+ const event = ( new StandardMouseEvent(getWindow(domEvent), domEvent));
925
+ EventHelper.stop(domEvent, true);
926
+ try {
927
+ await updateContextKeys?.();
928
+ }
929
+ catch (e) {
930
+ console.error(e);
931
+ }
932
+ contextMenuService.showContextMenu({
933
+ contextKeyService: scopedContextKeyService,
934
+ getAnchor: () => event,
935
+ getActions: () => {
936
+ const menu = menuService.getMenuActions(menuId, scopedContextKeyService, { arg });
937
+ return getFlatContextMenuActions(menu);
938
+ },
939
+ });
940
+ });
941
+ }
942
+ const chatAttachmentResourceContextKey = ( new RawContextKey(
943
+ 'chatAttachmentResource',
944
+ undefined,
945
+ { type: 'URI', description: ( localize(
946
+ 5041,
947
+ "The full value of the chat attachment resource, including scheme and path"
948
+ )) }
949
+ ));
950
+
951
+ export { DefaultChatAttachmentWidget, ElementChatAttachmentWidget, FileAttachmentWidget, ImageAttachmentWidget, NotebookCellOutputChatAttachmentWidget, PasteAttachmentWidget, PromptFileAttachmentWidget, PromptTextAttachmentWidget, SCMHistoryItemAttachmentWidget, SCMHistoryItemChangeAttachmentWidget, SCMHistoryItemChangeRangeAttachmentWidget, TerminalCommandAttachmentWidget, ToolSetOrToolItemAttachmentWidget, chatAttachmentResourceContextKey, hookUpResourceAttachmentDragAndContextMenu, hookUpSymbolAttachmentDragAndContextMenu };