@codingame/monaco-vscode-katex-common 28.4.0 → 29.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 (154) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/actions/browser/buttonbar.js +2 -2
  3. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +17 -15
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +2 -2
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +9 -9
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +3 -1
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +158 -47
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +22 -17
  10. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
  11. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +16 -4
  12. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +121 -14
  13. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +8 -1
  14. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +15 -8
  15. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +1 -1
  16. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +29 -13
  17. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +349 -109
  18. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +47 -23
  19. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +6 -1
  20. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +104 -62
  21. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +1 -3
  22. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +13 -11
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +34 -40
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +21 -16
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +14 -14
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +8 -1
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +13 -4
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +29 -50
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +261 -282
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.d.ts +2 -1
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +7 -5
  33. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
  34. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.d.ts +31 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +184 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +4 -2
  37. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
  38. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
  39. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
  42. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
  43. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +4 -3
  45. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +1 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +3 -2
  48. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +42 -34
  49. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +1 -0
  50. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +14 -18
  51. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +11 -9
  52. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
  53. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +6 -2
  54. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +25 -2
  55. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +332 -114
  56. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +4 -4
  57. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +1 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +7 -7
  59. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.d.ts +2 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +10 -5
  61. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +1 -1
  62. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +11 -16
  63. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.d.ts +7 -1
  64. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +66 -7
  65. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
  66. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +28 -3
  67. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +272 -107
  68. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingExternalResourcesWidget.d.ts +18 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingExternalResourcesWidget.js +70 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +9 -9
  71. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +17 -17
  72. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +6 -3
  74. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
  75. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
  76. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
  77. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +151 -0
  78. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +6 -6
  79. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +96 -10
  80. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +6 -1
  81. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +86 -10
  82. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +7 -0
  83. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +5 -2
  84. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
  85. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +1 -1
  86. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +8 -6
  87. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +1 -1
  88. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +3 -3
  89. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.d.ts +28 -0
  90. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.js +273 -0
  91. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSimpleToolProgressPart.js +3 -2
  92. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +28 -16
  93. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +22 -1
  94. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +81 -32
  95. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +1 -0
  96. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +20 -7
  97. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +11 -1
  98. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
  99. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.d.ts +6 -0
  100. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +21 -7
  101. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
  102. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +2 -12
  103. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +12 -12
  104. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +0 -6
  105. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +112 -163
  106. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +11 -1
  107. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +9 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +137 -52
  109. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
  110. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +12 -0
  111. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +108 -38
  112. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +9 -3
  113. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +385 -247
  114. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +5 -1
  115. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +23 -7
  116. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +6 -6
  117. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +4 -1
  118. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +4 -2
  119. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +23 -23
  120. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +3 -3
  121. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +3 -3
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +124 -17
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +4 -0
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +24 -7
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +30 -11
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +84 -0
  127. package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.d.ts +31 -0
  128. package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +170 -0
  129. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.d.ts +47 -0
  130. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.js +95 -0
  131. package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +4 -1
  132. package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +15 -15
  133. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +1 -1
  134. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +4 -3
  135. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +2 -0
  136. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +38 -6
  137. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +1 -0
  138. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +31 -0
  139. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +12 -3
  140. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +130 -23
  141. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +23 -0
  142. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +41 -0
  143. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +5 -5
  144. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
  145. package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +55 -3
  146. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +4 -1
  147. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +50 -39
  148. package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
  149. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
  150. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
  151. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
  152. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
  153. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.d.ts +0 -35
  154. package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatQuestionCarouselAutoReply.js +0 -440
@@ -1,6 +1,6 @@
1
1
 
2
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';
3
+ import { append, $, addDisposableListener, EventType, addStandardDisposableListener, EventHelper, createTextNode, getWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
4
  import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
5
5
  import { StandardMouseEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/mouseEvent';
6
6
  import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
@@ -56,6 +56,8 @@ import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workben
56
56
  import { toHistoryItemHoverContent } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/browser/scmHistory';
57
57
  import { getHistoryItemEditorTitle } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/browser/util';
58
58
  import { ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
59
+ import { coerceImageBuffer } from '../../common/chatImageExtraction.js';
60
+ import { ChatConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
59
61
  import { OmittedState, isStringVariableEntry, PromptFileVariableKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
60
62
  import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
61
63
  import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
@@ -63,6 +65,7 @@ import { isToolSet } from '@codingame/monaco-vscode-api/vscode/vs/workbench/cont
63
65
  import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
64
66
  import { getCleanPromptName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
65
67
  import { IChatContextService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.service';
68
+ import { IChatImageCarouselService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatImageCarouselService.service';
66
69
 
67
70
  const commonHoverOptions = {
68
71
  style: HoverStyle.Pointer,
@@ -112,6 +115,7 @@ let AbstractChatAttachmentWidget = class AbstractChatAttachmentWidget extends Di
112
115
  this.terminalService = terminalService;
113
116
  this._onDidDelete = this._register(new Emitter());
114
117
  this._onDidOpen = this._register(new Emitter());
118
+ this._hasClearButton = false;
115
119
  this.element = append(container, $(".chat-attached-context-attachment.show-file-icons"));
116
120
  this.attachClearButton();
117
121
  this.label = contextResourceLabels.create(this.element, {
@@ -132,14 +136,21 @@ let AbstractChatAttachmentWidget = class AbstractChatAttachmentWidget extends Di
132
136
  modelSupportsVision() {
133
137
  return modelSupportsVision(this.currentLanguageModel);
134
138
  }
139
+ appendDeletionHint(ariaLabel) {
140
+ if (!this._hasClearButton) {
141
+ return ariaLabel;
142
+ }
143
+ return localize(5476, "{0} (Delete)", ariaLabel);
144
+ }
135
145
  attachClearButton() {
136
146
  if (this.attachment.range || !this.options.supportsDeletion) {
137
147
  return;
138
148
  }
149
+ this._hasClearButton = true;
139
150
  const clearButton = ( new Button(this.element, {
140
151
  supportIcons: true,
141
152
  hoverDelegate: createInstantHoverDelegate(),
142
- title: ( localize(5390, "Remove from context"))
153
+ title: ( localize(5477, "Remove from context"))
143
154
  }));
144
155
  clearButton.element.tabIndex = -1;
145
156
  clearButton.icon = Codicon.close;
@@ -150,6 +161,8 @@ let AbstractChatAttachmentWidget = class AbstractChatAttachmentWidget extends Di
150
161
  this._register(
151
162
  addStandardDisposableListener(this.element, EventType.KEY_DOWN, e => {
152
163
  if (e.keyCode === KeyCode.Backspace || e.keyCode === KeyCode.Delete) {
164
+ e.preventDefault();
165
+ e.stopPropagation();
153
166
  this._onDidDelete.fire(e.browserEvent);
154
167
  }
155
168
  })
@@ -230,14 +243,14 @@ let FileAttachmentWidget = class FileAttachmentWidget extends AbstractChatAttach
230
243
  const fileDirname = dirname(resource.path);
231
244
  const friendlyName = `${fileBasename} ${fileDirname}`;
232
245
  let ariaLabel = range ? ( localize(
233
- 5391,
246
+ 5478,
234
247
  "Attached file, {0}, line {1} to line {2}",
235
248
  friendlyName,
236
249
  range.startLineNumber,
237
250
  range.endLineNumber
238
- )) : ( localize(5392, "Attached file, {0}", friendlyName));
251
+ )) : ( localize(5479, "Attached file, {0}", friendlyName));
239
252
  if (attachment.omittedState === OmittedState.Full) {
240
- ariaLabel = ( localize(5393, "Omitted this file: {0}", attachment.name));
253
+ ariaLabel = ( localize(5480, "Omitted this file: {0}", attachment.name));
241
254
  this.renderOmittedWarning(friendlyName, ariaLabel);
242
255
  } else {
243
256
  const fileOptions = {
@@ -254,7 +267,7 @@ let FileAttachmentWidget = class FileAttachmentWidget extends AbstractChatAttach
254
267
  icon: !this.themeService.getFileIconTheme().hasFolderIcons ? FolderThemeIcon : undefined
255
268
  });
256
269
  }
257
- this.element.ariaLabel = ariaLabel;
270
+ this.element.ariaLabel = this.appendDeletionHint(ariaLabel);
258
271
  this.instantiationService.invokeFunction(accessor => {
259
272
  this._register(
260
273
  hookUpResourceAttachmentDragAndContextMenu(accessor, this.element, resource)
@@ -275,7 +288,7 @@ let FileAttachmentWidget = class FileAttachmentWidget extends AbstractChatAttach
275
288
  hoverElement.setAttribute("aria-label", ariaLabel);
276
289
  this.element.classList.add("warning");
277
290
  hoverElement.textContent = ( localize(
278
- 5394,
291
+ 5481,
279
292
  "{0} does not support this file type.",
280
293
  this.currentLanguageModel ? this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name : this.currentLanguageModel ?? "This model"
281
294
  ));
@@ -312,7 +325,7 @@ let TerminalCommandAttachmentWidget = class TerminalCommandAttachmentWidget exte
312
325
  );
313
326
  this.hoverService = hoverService;
314
327
  this.terminalService = terminalService;
315
- const ariaLabel = ( localize(5395, "Terminal command, {0}", attachment.command));
328
+ const ariaLabel = ( localize(5482, "Terminal command, {0}", attachment.command));
316
329
  const clickHandler = () => this.openResource(attachment.resource, {
317
330
  editorOptions: {
318
331
  preserveFocus: true
@@ -330,6 +343,7 @@ let TerminalCommandAttachmentWidget = class TerminalCommandAttachmentWidget exte
330
343
  }
331
344
  })
332
345
  );
346
+ this.element.ariaLabel = this.appendDeletionHint(ariaLabel);
333
347
  }
334
348
  };
335
349
  TerminalCommandAttachmentWidget = ( __decorate([( __param(5, ICommandService)), ( __param(6, IOpenerService)), ( __param(7, IConfigurationService)), ( __param(8, IHoverService)), ( __param(9, ITerminalService))], TerminalCommandAttachmentWidget));
@@ -365,16 +379,16 @@ function getHoverContent(ariaLabel, attachment) {
365
379
  const hoverElement = $("div.chat-attached-context-hover");
366
380
  hoverElement.setAttribute("aria-label", ariaLabel);
367
381
  const commandTitle = $("div", {}, typeof attachment.exitCode === "number" ? ( localize(
368
- 5396,
382
+ 5483,
369
383
  "Command: {0}, exit code: {1}",
370
384
  attachment.command,
371
385
  attachment.exitCode
372
- )) : ( localize(5397, "Command")));
386
+ )) : ( localize(5484, "Command")));
373
387
  commandTitle.classList.add("attachment-additional-info");
374
388
  const commandBlock = $("pre.chat-terminal-command-block");
375
389
  hoverElement.append(commandTitle, commandBlock);
376
390
  if (attachment.output && attachment.output.trim().length > 0) {
377
- const outputTitle = $("div", {}, ( localize(5398, "Output:")));
391
+ const outputTitle = $("div", {}, ( localize(5485, "Output:")));
378
392
  outputTitle.classList.add("attachment-additional-info");
379
393
  const outputBlock = $("pre.chat-terminal-command-output");
380
394
  const fullOutputLines = attachment.output.split("\n");
@@ -418,7 +432,8 @@ let ImageAttachmentWidget = class ImageAttachmentWidget extends AbstractChatAtta
418
432
  languageModelsService,
419
433
  instantiationService,
420
434
  labelService,
421
- chatEntitlementService
435
+ chatEntitlementService,
436
+ chatImageCarouselService
422
437
  ) {
423
438
  super(
424
439
  attachment,
@@ -434,18 +449,22 @@ let ImageAttachmentWidget = class ImageAttachmentWidget extends AbstractChatAtta
434
449
  this.languageModelsService = languageModelsService;
435
450
  this.labelService = labelService;
436
451
  this.chatEntitlementService = chatEntitlementService;
452
+ this.chatImageCarouselService = chatImageCarouselService;
437
453
  let ariaLabel;
438
454
  if (attachment.omittedState === OmittedState.Full) {
439
- ariaLabel = ( localize(5399, "Omitted this image: {0}", attachment.name));
455
+ ariaLabel = ( localize(5486, "Omitted this image: {0}", attachment.name));
440
456
  } else if (attachment.omittedState === OmittedState.Partial) {
441
- ariaLabel = ( localize(5400, "Partially omitted this image: {0}", attachment.name));
457
+ ariaLabel = ( localize(5487, "Partially omitted this image: {0}", attachment.name));
442
458
  } else {
443
- ariaLabel = ( localize(5401, "Attached image, {0}", attachment.name));
459
+ ariaLabel = ( localize(5488, "Attached image, {0}", attachment.name));
444
460
  }
445
461
  const ref = attachment.references?.[0]?.reference;
446
462
  resource = ref && URI.isUri(ref) ? ref : undefined;
463
+ const imageData = coerceImageBuffer(attachment.value);
447
464
  const clickHandler = async () => {
448
- if (resource) {
465
+ if ((resource || imageData) && configurationService.getValue(ChatConfiguration.ImageCarouselEnabled)) {
466
+ await this.openInCarousel(attachment.name, imageData, resource);
467
+ } else if (resource) {
449
468
  await this.openResource(resource, {
450
469
  editorOptions: {
451
470
  preserveFocus: true
@@ -460,7 +479,7 @@ let ImageAttachmentWidget = class ImageAttachmentWidget extends AbstractChatAtta
460
479
  attachment.name,
461
480
  fullName,
462
481
  this.element,
463
- attachment.value,
482
+ imageData ?? attachment.value,
464
483
  this.hoverService,
465
484
  ariaLabel,
466
485
  currentLanguageModelName,
@@ -469,8 +488,15 @@ let ImageAttachmentWidget = class ImageAttachmentWidget extends AbstractChatAtta
469
488
  attachment.omittedState,
470
489
  this.chatEntitlementService.previewFeaturesDisabled
471
490
  ));
491
+ this.element.ariaLabel = this.appendDeletionHint(ariaLabel);
492
+ const canOpenCarousel = !!imageData && configurationService.getValue(ChatConfiguration.ImageCarouselEnabled);
493
+ if (canOpenCarousel || resource) {
494
+ this.element.style.cursor = "pointer";
495
+ this._register(registerOpenEditorListeners(this.element, async () => {
496
+ await clickHandler();
497
+ }));
498
+ }
472
499
  if (resource) {
473
- this.addResourceOpenHandlers(resource, undefined);
474
500
  instantiationService.invokeFunction(accessor => {
475
501
  this._register(
476
502
  hookUpResourceAttachmentDragAndContextMenu(accessor, this.element, resource)
@@ -478,8 +504,15 @@ let ImageAttachmentWidget = class ImageAttachmentWidget extends AbstractChatAtta
478
504
  });
479
505
  }
480
506
  }
507
+ async openInCarousel(name, data, referenceUri) {
508
+ const resource = referenceUri ?? ( URI.from({
509
+ scheme: "data",
510
+ path: name
511
+ }));
512
+ await this.chatImageCarouselService.openCarouselAtResource(resource, data);
513
+ }
481
514
  };
482
- ImageAttachmentWidget = ( __decorate([( __param(6, ICommandService)), ( __param(7, IOpenerService)), ( __param(8, IConfigurationService)), ( __param(9, IHoverService)), ( __param(10, ILanguageModelsService)), ( __param(11, IInstantiationService)), ( __param(12, ILabelService)), ( __param(13, IChatEntitlementService))], ImageAttachmentWidget));
515
+ ImageAttachmentWidget = ( __decorate([( __param(6, ICommandService)), ( __param(7, IOpenerService)), ( __param(8, IConfigurationService)), ( __param(9, IHoverService)), ( __param(10, ILanguageModelsService)), ( __param(11, IInstantiationService)), ( __param(12, ILabelService)), ( __param(13, IChatEntitlementService)), ( __param(14, IChatImageCarouselService))], ImageAttachmentWidget));
483
516
  function createImageElements(
484
517
  resource,
485
518
  name,
@@ -502,7 +535,6 @@ function createImageElements(
502
535
  element.style.position = "relative";
503
536
  if (resource) {
504
537
  element.style.cursor = "pointer";
505
- disposable.add(addDisposableListener(element, "click", clickHandler));
506
538
  }
507
539
  const supportsVision = modelSupportsVision(currentLanguageModel);
508
540
  const pillIcon = $("div.chat-attached-context-pill", {}, $(
@@ -515,7 +547,7 @@ function createImageElements(
515
547
  hoverElement.setAttribute("aria-label", ariaLabel);
516
548
  if (previewFeaturesDisabled) {
517
549
  element.classList.add("warning");
518
- hoverElement.textContent = ( localize(5402, "Vision is disabled by your organization."));
550
+ hoverElement.textContent = ( localize(5489, "Vision is disabled by your organization."));
519
551
  disposable.add(hoverService.setupDelayedHover(element, {
520
552
  content: hoverElement,
521
553
  style: HoverStyle.Pointer
@@ -523,7 +555,7 @@ function createImageElements(
523
555
  } else if ((!supportsVision && currentLanguageModel) || omittedState === OmittedState.Full) {
524
556
  element.classList.add("warning");
525
557
  hoverElement.textContent = ( localize(
526
- 5403,
558
+ 5490,
527
559
  "{0} does not support images.",
528
560
  currentLanguageModelName ?? "This model"
529
561
  ));
@@ -559,7 +591,7 @@ function createImageElements(
559
591
  const urlContainer = $(
560
592
  "a.chat-attached-context-url",
561
593
  {},
562
- omittedState === OmittedState.Partial ? ( localize(5404, "This GIF was partially omitted - current frame will be sent.")) : fullName
594
+ omittedState === OmittedState.Partial ? ( localize(5491, "This GIF was partially omitted - current frame will be sent.")) : fullName
563
595
  );
564
596
  const separator = $("div.chat-attached-context-url-separator");
565
597
  disposable.add(addDisposableListener(urlContainer, "click", () => clickHandler()));
@@ -608,8 +640,8 @@ let PasteAttachmentWidget = class PasteAttachmentWidget extends AbstractChatAtta
608
640
  );
609
641
  this.hoverService = hoverService;
610
642
  this.instantiationService = instantiationService;
611
- const ariaLabel = ( localize(5405, "Attached context, {0}", attachment.name));
612
- this.element.ariaLabel = ariaLabel;
643
+ const ariaLabel = ( localize(5492, "Attached context, {0}", attachment.name));
644
+ this.element.ariaLabel = this.appendDeletionHint(ariaLabel);
613
645
  const classNames = ["file-icon", `${attachment.language}-lang-file-icon`];
614
646
  let resource;
615
647
  let range;
@@ -701,7 +733,7 @@ let DefaultChatAttachmentWidget = class DefaultChatAttachmentWidget extends Abst
701
733
  const withIcon = attachment.icon?.id ? `$(${attachment.icon.id})\u00A0${attachmentLabel}` : attachmentLabel;
702
734
  this.label.setLabel(withIcon, correspondingContentReference?.options?.status?.description);
703
735
  }
704
- this.element.ariaLabel = ( localize(5405, "Attached context, {0}", attachment.name));
736
+ this.element.ariaLabel = this.appendDeletionHint(( localize(5492, "Attached context, {0}", attachment.name)));
705
737
  if (attachment.kind === "diagnostic") {
706
738
  if (attachment.filterUri) {
707
739
  resource = attachment.filterUri ? URI.revive(attachment.filterUri) : undefined;
@@ -802,8 +834,8 @@ let PromptFileAttachmentWidget = class PromptFileAttachmentWidget extends Abstra
802
834
  const fileDirname = dirname(resource.path);
803
835
  const friendlyName = `${fileBasename} ${fileDirname}`;
804
836
  const isPrompt = attachment.id.startsWith(PromptFileVariableKind.PromptFile);
805
- const ariaLabel = isPrompt ? ( localize(5406, "Prompt file, {0}", friendlyName)) : ( localize(5407, "Instructions attachment, {0}", friendlyName));
806
- const typeLabel = isPrompt ? ( localize(5408, "Prompt")) : ( localize(5409, "Instructions"));
837
+ const ariaLabel = isPrompt ? ( localize(5493, "Prompt file, {0}", friendlyName)) : ( localize(5494, "Instructions attachment, {0}", friendlyName));
838
+ const typeLabel = isPrompt ? ( localize(5495, "Prompt")) : ( localize(5496, "Instructions"));
807
839
  const title = this.labelService.getUriLabel(resource) + (attachment.originLabel ? `\n${attachment.originLabel}` : "");
808
840
  this.element.classList.remove("warning", "error");
809
841
  const fileWithoutExtension = getCleanPromptName(resource);
@@ -816,7 +848,7 @@ let PromptFileAttachmentWidget = class PromptFileAttachmentWidget extends Abstra
816
848
  extraClasses: []
817
849
  });
818
850
  this.hintElement.innerText = typeLabel;
819
- this.element.ariaLabel = ariaLabel;
851
+ this.element.ariaLabel = this.appendDeletionHint(ariaLabel);
820
852
  }
821
853
  };
822
854
  PromptFileAttachmentWidget = ( __decorate([( __param(5, ICommandService)), ( __param(6, IOpenerService)), ( __param(7, IConfigurationService)), ( __param(8, ILabelService)), ( __param(9, IInstantiationService))], PromptFileAttachmentWidget));
@@ -863,7 +895,8 @@ let PromptTextAttachmentWidget = class PromptTextAttachmentWidget extends Abstra
863
895
  })
864
896
  );
865
897
  }
866
- this.label.setLabel(( localize(5410, "Additional Instructions")), undefined, undefined);
898
+ this.label.setLabel(( localize(5497, "Additional Instructions")), undefined, undefined);
899
+ this.element.ariaLabel = this.appendDeletionHint(( localize(5492, "Attached context, {0}", attachment.name)));
867
900
  this._register(hoverService.setupDelayedHover(this.element, {
868
901
  ...commonHoverOptions,
869
902
  content: attachment.value
@@ -910,18 +943,18 @@ let ToolSetOrToolItemAttachmentWidget = class ToolSetOrToolItemAttachmentWidget
910
943
  }
911
944
  this.label.setLabel(`$(${icon.id})\u00A0${name}`, undefined);
912
945
  this.element.style.cursor = "pointer";
913
- this.element.ariaLabel = ( localize(5405, "Attached context, {0}", name));
946
+ this.element.ariaLabel = this.appendDeletionHint(( localize(5492, "Attached context, {0}", name)));
914
947
  let hoverContent;
915
948
  if (isToolSet(toolOrToolSet)) {
916
949
  hoverContent = ( localize(
917
- 5411,
950
+ 5498,
918
951
  "{0} - {1}",
919
952
  toolOrToolSet.description ?? toolOrToolSet.referenceName,
920
953
  toolOrToolSet.source.label
921
954
  ));
922
955
  } else if (toolOrToolSet) {
923
956
  hoverContent = ( localize(
924
- 5412,
957
+ 5499,
925
958
  "{0} - {1}",
926
959
  toolOrToolSet.userDescription ?? toolOrToolSet.modelDescription,
927
960
  toolOrToolSet.source.label
@@ -994,7 +1027,7 @@ let NotebookCellOutputChatAttachmentWidget = class NotebookCellOutputChatAttachm
994
1027
  this.addResourceOpenHandlers(resource, undefined);
995
1028
  }
996
1029
  getAriaLabel(attachment) {
997
- return localize(5413, "Attached Notebook output, {0}", attachment.name);
1030
+ return localize(5500, "Attached Notebook output, {0}", attachment.name);
998
1031
  }
999
1032
  renderErrorOutput(resource, attachment) {
1000
1033
  const attachmentLabel = attachment.name;
@@ -1010,10 +1043,10 @@ let NotebookCellOutputChatAttachmentWidget = class NotebookCellOutputChatAttachm
1010
1043
  this.label.setLabel(withIcon, undefined, {
1011
1044
  title
1012
1045
  });
1013
- this.element.ariaLabel = this.getAriaLabel(attachment);
1046
+ this.element.ariaLabel = this.appendDeletionHint(this.getAriaLabel(attachment));
1014
1047
  }
1015
1048
  renderGenericOutput(resource, attachment) {
1016
- this.element.ariaLabel = this.getAriaLabel(attachment);
1049
+ this.element.ariaLabel = this.appendDeletionHint(this.getAriaLabel(attachment));
1017
1050
  this.label.setFile(resource, {
1018
1051
  hidePath: true,
1019
1052
  icon: ThemeIcon.fromId("output")
@@ -1022,9 +1055,9 @@ let NotebookCellOutputChatAttachmentWidget = class NotebookCellOutputChatAttachm
1022
1055
  renderImageOutput(resource, attachment) {
1023
1056
  let ariaLabel;
1024
1057
  if (attachment.omittedState === OmittedState.Full) {
1025
- ariaLabel = ( localize(5414, "Omitted this Notebook ouput: {0}", attachment.name));
1058
+ ariaLabel = ( localize(5501, "Omitted this Notebook ouput: {0}", attachment.name));
1026
1059
  } else if (attachment.omittedState === OmittedState.Partial) {
1027
- ariaLabel = ( localize(5415, "Partially omitted this Notebook output: {0}", attachment.name));
1060
+ ariaLabel = ( localize(5502, "Partially omitted this Notebook output: {0}", attachment.name));
1028
1061
  } else {
1029
1062
  ariaLabel = this.getAriaLabel(attachment);
1030
1063
  }
@@ -1049,6 +1082,7 @@ let NotebookCellOutputChatAttachmentWidget = class NotebookCellOutputChatAttachm
1049
1082
  attachment.omittedState,
1050
1083
  this.chatEntitlementService.previewFeaturesDisabled
1051
1084
  ));
1085
+ this.element.ariaLabel = this.appendDeletionHint(ariaLabel);
1052
1086
  }
1053
1087
  getOutputItem(resource, attachment) {
1054
1088
  const parsedInfo = CellUri.parseCellOutputUri(resource);
@@ -1093,14 +1127,14 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1093
1127
  );
1094
1128
  this.editorService = editorService;
1095
1129
  this.hoverService = hoverService;
1096
- const ariaLabel = ( localize(5416, "Attached element, {0}", attachment.name));
1097
- this.element.ariaLabel = ariaLabel;
1130
+ const ariaLabel = ( localize(5503, "Attached element, {0}", attachment.name));
1131
+ this.element.ariaLabel = this.appendDeletionHint(ariaLabel);
1098
1132
  this.element.style.position = "relative";
1099
1133
  this.element.style.cursor = "pointer";
1100
1134
  const attachmentLabel = attachment.name;
1101
1135
  const withIcon = attachment.icon?.id ? `$(${attachment.icon.id})\u00A0${attachmentLabel}` : attachmentLabel;
1102
1136
  this.label.setLabel(withIcon, undefined, {
1103
- title: ( localize(5417, "Click to view the contents of: {0}", attachmentLabel))
1137
+ title: ( localize(5504, "Click to view the contents of: {0}", attachmentLabel))
1104
1138
  });
1105
1139
  this._register(this.hoverService.setupDelayedHover(
1106
1140
  this.element,
@@ -1120,7 +1154,7 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1120
1154
  const innerScrollables = [];
1121
1155
  {
1122
1156
  const section = $("div.chat-element-hover-section");
1123
- const header = $("div.chat-element-hover-header", {}, ( localize(5418, "ELEMENT")));
1157
+ const header = $("div.chat-element-hover-header", {}, ( localize(5505, "ELEMENT")));
1124
1158
  section.appendChild(header);
1125
1159
  const elementPre = $("pre.chat-element-hover-code");
1126
1160
  const elementCode = $("code");
@@ -1138,7 +1172,7 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1138
1172
  const computedStyleEntries = this.getComputedStyleEntriesForHover(attachment.computedStyles);
1139
1173
  if (computedStyleEntries.length > 0) {
1140
1174
  const section = $("div.chat-element-hover-section");
1141
- const header = $("div.chat-element-hover-header", {}, ( localize(5419, "KEY COMPUTED STYLES")));
1175
+ const header = $("div.chat-element-hover-header", {}, ( localize(5506, "KEY COMPUTED STYLES")));
1142
1176
  section.appendChild(header);
1143
1177
  const table = $("div.chat-element-hover-table");
1144
1178
  for (const [name, value] of computedStyleEntries) {
@@ -1150,14 +1184,14 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1150
1184
  swatch.style.backgroundColor = value;
1151
1185
  valueContainer.appendChild(swatch);
1152
1186
  }
1153
- valueContainer.appendChild(document.createTextNode(value));
1187
+ valueContainer.appendChild(createTextNode(value));
1154
1188
  row.appendChild(valueContainer);
1155
1189
  table.appendChild(row);
1156
1190
  }
1157
1191
  section.appendChild(table);
1158
1192
  const showMoreButton = $("button.chat-element-hover-show-more", {
1159
1193
  type: "button"
1160
- }, ( localize(5420, "Show More...")));
1194
+ }, ( localize(5507, "Show More...")));
1161
1195
  this._register(
1162
1196
  addDisposableListener(showMoreButton, EventType.CLICK, async e => {
1163
1197
  EventHelper.stop(e, true);
@@ -1169,7 +1203,7 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1169
1203
  }
1170
1204
  if (attachment.ancestors && attachment.ancestors.length > 1) {
1171
1205
  const section = $("div.chat-element-hover-section");
1172
- const header = $("div.chat-element-hover-header", {}, ( localize(5421, "HTML PATH")));
1206
+ const header = $("div.chat-element-hover-header", {}, ( localize(5508, "HTML PATH")));
1173
1207
  section.appendChild(header);
1174
1208
  const lines = [];
1175
1209
  for (let i = 0; i < attachment.ancestors.length; i++) {
@@ -1192,7 +1226,7 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1192
1226
  }
1193
1227
  if (attachment.attributes && ( Object.keys(attachment.attributes)).length > 0) {
1194
1228
  const section = $("div.chat-element-hover-section");
1195
- const header = $("div.chat-element-hover-header", {}, ( localize(5422, "ATTRIBUTES")));
1229
+ const header = $("div.chat-element-hover-header", {}, ( localize(5509, "ATTRIBUTES")));
1196
1230
  section.appendChild(header);
1197
1231
  const table = $("div.chat-element-hover-table");
1198
1232
  for (const [name, value] of Object.entries(attachment.attributes)) {
@@ -1206,7 +1240,7 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1206
1240
  }
1207
1241
  if (attachment.dimensions) {
1208
1242
  const section = $("div.chat-element-hover-section");
1209
- const header = $("div.chat-element-hover-header", {}, ( localize(5423, "POSITION & SIZE")));
1243
+ const header = $("div.chat-element-hover-header", {}, ( localize(5510, "POSITION & SIZE")));
1210
1244
  section.appendChild(header);
1211
1245
  const table = $("div.chat-element-hover-table");
1212
1246
  const dims = [
@@ -1226,7 +1260,7 @@ let ElementChatAttachmentWidget = class ElementChatAttachmentWidget extends Abst
1226
1260
  }
1227
1261
  if (attachment.innerText) {
1228
1262
  const section = $("div.chat-element-hover-section");
1229
- const header = $("div.chat-element-hover-header", {}, ( localize(5424, "INNER TEXT")));
1263
+ const header = $("div.chat-element-hover-header", {}, ( localize(5511, "INNER TEXT")));
1230
1264
  section.appendChild(header);
1231
1265
  section.appendChild($("div.chat-element-hover-text", {}, attachment.innerText));
1232
1266
  scrollableContent.appendChild(section);
@@ -1372,7 +1406,7 @@ let SCMHistoryItemAttachmentWidget = class SCMHistoryItemAttachmentWidget extend
1372
1406
  );
1373
1407
  this.label.setLabel(attachment.name, undefined);
1374
1408
  this.element.style.cursor = "pointer";
1375
- this.element.ariaLabel = ( localize(5405, "Attached context, {0}", attachment.name));
1409
+ this.element.ariaLabel = this.appendDeletionHint(( localize(5492, "Attached context, {0}", attachment.name)));
1376
1410
  const {
1377
1411
  content,
1378
1412
  disposables
@@ -1434,7 +1468,7 @@ let SCMHistoryItemChangeAttachmentWidget = class SCMHistoryItemChangeAttachmentW
1434
1468
  hidePath: true,
1435
1469
  nameSuffix
1436
1470
  });
1437
- this.element.ariaLabel = ( localize(5405, "Attached context, {0}", attachment.name));
1471
+ this.element.ariaLabel = this.appendDeletionHint(( localize(5492, "Attached context, {0}", attachment.name)));
1438
1472
  const {
1439
1473
  content,
1440
1474
  disposables
@@ -1490,7 +1524,7 @@ let SCMHistoryItemChangeRangeAttachmentWidget = class SCMHistoryItemChangeRangeA
1490
1524
  hidePath: true,
1491
1525
  nameSuffix
1492
1526
  });
1493
- this.element.ariaLabel = ( localize(5405, "Attached context, {0}", attachment.name));
1527
+ this.element.ariaLabel = this.appendDeletionHint(( localize(5492, "Attached context, {0}", attachment.name)));
1494
1528
  this.addResourceOpenHandlers(attachment.value, undefined);
1495
1529
  }
1496
1530
  async openResource(resource, options, isDirectory, range) {
@@ -1555,23 +1589,30 @@ function hookUpSymbolAttachmentDragAndContextMenu(accessor, widget, parentContex
1555
1589
  }], e);
1556
1590
  e.dataTransfer?.setDragImage(widget, 0, 0);
1557
1591
  }));
1558
- const scopedContextKeyService = store.add(parentContextKeyService.createScoped(widget));
1559
- chatAttachmentResourceContextKey.bindTo(scopedContextKeyService).set(( attachment.value.uri.toString()));
1560
- setResourceContext(accessor, scopedContextKeyService, attachment.value.uri);
1592
+ let scopedContextKeyService;
1561
1593
  let providerContexts;
1594
+ const ensureContextKeyService = () => {
1595
+ if (!scopedContextKeyService) {
1596
+ scopedContextKeyService = store.add(parentContextKeyService.createScoped(widget));
1597
+ chatAttachmentResourceContextKey.bindTo(scopedContextKeyService).set(( attachment.value.uri.toString()));
1598
+ setResourceContext(accessor, scopedContextKeyService, attachment.value.uri);
1599
+ }
1600
+ return scopedContextKeyService;
1601
+ };
1562
1602
  const ensureProviderContexts = () => {
1603
+ const cks = ensureContextKeyService();
1563
1604
  if (!providerContexts) {
1564
1605
  providerContexts = [[
1565
- EditorContextKeys.hasDefinitionProvider.bindTo(scopedContextKeyService),
1606
+ EditorContextKeys.hasDefinitionProvider.bindTo(cks),
1566
1607
  languageFeaturesService.definitionProvider
1567
1608
  ], [
1568
- EditorContextKeys.hasReferenceProvider.bindTo(scopedContextKeyService),
1609
+ EditorContextKeys.hasReferenceProvider.bindTo(cks),
1569
1610
  languageFeaturesService.referenceProvider
1570
1611
  ], [
1571
- EditorContextKeys.hasImplementationProvider.bindTo(scopedContextKeyService),
1612
+ EditorContextKeys.hasImplementationProvider.bindTo(cks),
1572
1613
  languageFeaturesService.implementationProvider
1573
1614
  ], [
1574
- EditorContextKeys.hasTypeDefinitionProvider.bindTo(scopedContextKeyService),
1615
+ EditorContextKeys.hasTypeDefinitionProvider.bindTo(cks),
1575
1616
  languageFeaturesService.typeDefinitionProvider
1576
1617
  ]];
1577
1618
  }
@@ -1592,16 +1633,17 @@ function hookUpSymbolAttachmentDragAndContextMenu(accessor, widget, parentContex
1592
1633
  addDisposableListener(widget, EventType.CONTEXT_MENU, async domEvent => {
1593
1634
  const event = ( new StandardMouseEvent(getWindow(domEvent), domEvent));
1594
1635
  EventHelper.stop(domEvent, true);
1636
+ const cks = ensureContextKeyService();
1595
1637
  try {
1596
1638
  await updateContextKeys();
1597
1639
  } catch (e) {
1598
1640
  console.error(e);
1599
1641
  }
1600
1642
  contextMenuService.showContextMenu({
1601
- contextKeyService: scopedContextKeyService,
1643
+ contextKeyService: cks,
1602
1644
  getAnchor: () => event,
1603
1645
  getActions: () => {
1604
- const menu = menuService.getMenuActions(contextMenuId, scopedContextKeyService, {
1646
+ const menu = menuService.getMenuActions(contextMenuId, cks, {
1605
1647
  arg: attachment.value
1606
1648
  });
1607
1649
  return getFlatContextMenuActions(menu);
@@ -1644,7 +1686,7 @@ function addBasicContextMenu(accessor, widget, scopedContextKeyService, menuId,
1644
1686
  const chatAttachmentResourceContextKey = ( new RawContextKey("chatAttachmentResource", undefined, {
1645
1687
  type: "URI",
1646
1688
  description: ( localize(
1647
- 5425,
1689
+ 5512,
1648
1690
  "The full value of the chat attachment resource, including scheme and path"
1649
1691
  ))
1650
1692
  }));
@@ -20,7 +20,6 @@ import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/c
20
20
  import { isStringImplicitContextValue } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
21
21
  import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
22
22
  import { ILanguageModelIgnoredFilesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/ignoredFiles.service';
23
- import { getPromptsTypeForLanguageId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
24
23
  import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
25
24
  import { IChatContextService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.service';
26
25
  import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
@@ -239,7 +238,6 @@ let ChatImplicitContextContribution = class ChatImplicitContextContribution exte
239
238
  if (cancelTokenSource.token.isCancellationRequested) {
240
239
  return;
241
240
  }
242
- const isPromptFile = languageId && getPromptsTypeForLanguageId(languageId) !== undefined;
243
241
  const widgets = updateWidget ? [updateWidget] : [
244
242
  ...this.chatWidgetService.getWidgetsByLocations(ChatAgentLocation.Chat),
245
243
  ...this.chatWidgetService.getWidgetsByLocations(ChatAgentLocation.EditorInline)
@@ -250,7 +248,7 @@ let ChatImplicitContextContribution = class ChatImplicitContextContribution exte
250
248
  }
251
249
  const setting = this._implicitContextEnablement[widget.location];
252
250
  const isFirstInteraction = widget.viewModel?.getItems().length === 0;
253
- if ((setting === "always" || setting === "first" && isFirstInteraction) && !isPromptFile) {
251
+ if ((setting === "always" || setting === "first" && isFirstInteraction)) {
254
252
  const hasActiveEditor = !!this.editorService.activeEditor;
255
253
  if (newValue !== undefined || !widget.input.implicitContext.hasValue || !hasActiveEditor) {
256
254
  widget.input.implicitContext.setValues([{
@@ -93,11 +93,12 @@ let ImplicitContextAttachmentWidget = class ImplicitContextAttachmentWidget exte
93
93
  contextNode.tabIndex = 0;
94
94
  contextNode.classList.toggle("disabled", !context.enabled);
95
95
  const file = context.uri;
96
- const attachmentTypeName = file?.scheme === Schemas.vscodeNotebookCell ? ( localize(5427, "cell")) : ( localize(5428, "file"));
96
+ const attachmentTypeName = file?.scheme === Schemas.vscodeNotebookCell ? ( localize(5514, "cell")) : ( localize(5515, "file"));
97
+ const contextLabel = context.name ?? (file ? basename(file) : ( localize(5516, "context")));
97
98
  const isSuggestedEnabled = this.configService.getValue("chat.implicitContext.suggestedContext");
98
99
  if (isSuggestedEnabled) {
99
100
  if (!isSelection) {
100
- const buttonMsg = context.enabled ? ( localize(5429, "Disable current {0} context", attachmentTypeName)) : "";
101
+ const buttonMsg = context.enabled ? ( localize(5517, "Disable {0} context {1}", attachmentTypeName, contextLabel)) : ( localize(5518, "Add {0} to context", contextLabel));
101
102
  const toggleButton = this.renderDisposables.add(( new Button(contextNode, {
102
103
  supportIcons: true,
103
104
  title: buttonMsg
@@ -112,7 +113,7 @@ let ImplicitContextAttachmentWidget = class ImplicitContextAttachmentWidget exte
112
113
  context.enabled = false;
113
114
  }));
114
115
  } else {
115
- const pinButtonMsg = ( localize(5430, "Pin selection"));
116
+ const pinButtonMsg = ( localize(5519, "Pin selection"));
116
117
  const pinButton = this.renderDisposables.add(( new Button(contextNode, {
117
118
  supportIcons: true,
118
119
  title: pinButtonMsg
@@ -145,7 +146,7 @@ let ImplicitContextAttachmentWidget = class ImplicitContextAttachmentWidget exte
145
146
  })
146
147
  );
147
148
  } else {
148
- const buttonMsg = context.enabled ? ( localize(5429, "Disable current {0} context", attachmentTypeName)) : ( localize(5431, "Enable current {0} context", attachmentTypeName));
149
+ const buttonMsg = context.enabled ? ( localize(5520, "Disable current {0} context", attachmentTypeName)) : ( localize(5521, "Enable current {0} context", attachmentTypeName));
149
150
  const toggleButton = this.renderDisposables.add(( new Button(contextNode, {
150
151
  supportIcons: true,
151
152
  title: buttonMsg
@@ -169,8 +170,9 @@ let ImplicitContextAttachmentWidget = class ImplicitContextAttachmentWidget exte
169
170
  context.icon,
170
171
  context.value.resourceUri,
171
172
  markdownTooltip,
172
- ( localize(5432, "Current file context"))
173
+ ( localize(5522, "Current file context"))
173
174
  );
175
+ contextNode.ariaLabel = ( localize(5523, "Suggested context, {0}", context.name));
174
176
  } else {
175
177
  title = this.renderResource(context.value, context.isSelection, context.enabled, label, contextNode);
176
178
  }
@@ -227,23 +229,23 @@ let ImplicitContextAttachmentWidget = class ImplicitContextAttachmentWidget exte
227
229
  renderResource(attachmentValue, isSelection, enabled, label, contextNode) {
228
230
  const file = URI.isUri(attachmentValue) ? attachmentValue : attachmentValue.uri;
229
231
  const range = URI.isUri(attachmentValue) || !isSelection ? undefined : attachmentValue.range;
230
- const attachmentTypeName = file.scheme === Schemas.vscodeNotebookCell ? ( localize(5427, "cell")) : ( localize(5428, "file"));
232
+ const attachmentTypeName = file.scheme === Schemas.vscodeNotebookCell ? ( localize(5514, "cell")) : ( localize(5515, "file"));
231
233
  const fileBasename = basename(file);
232
234
  const fileDirname = dirname(file);
233
235
  const friendlyName = `${fileBasename} ${fileDirname}`;
234
236
  const ariaLabel = range ? ( localize(
235
- 5433,
236
- "Attached {0}, {1}, line {2} to line {3}",
237
+ 5524,
238
+ "Suggested context, {0}, {1}, line {2} to line {3}",
237
239
  attachmentTypeName,
238
240
  friendlyName,
239
241
  range.startLineNumber,
240
242
  range.endLineNumber
241
- )) : ( localize(5434, "Attached {0}, {1}", attachmentTypeName, friendlyName));
243
+ )) : ( localize(5525, "Suggested context, {0}, {1}", attachmentTypeName, friendlyName));
242
244
  const uriLabel = this.labelService.getUriLabel(file, {
243
245
  relative: true
244
246
  });
245
- const currentFile = ( localize(5435, "Current {0} context", attachmentTypeName));
246
- const inactive = ( localize(5436, "Enable current {0} context", attachmentTypeName));
247
+ const currentFile = ( localize(5526, "Current {0} context", attachmentTypeName));
248
+ const inactive = ( localize(5527, "Enable current {0} context", attachmentTypeName));
247
249
  const currentFileHint = enabled || isSelection ? currentFile : inactive;
248
250
  const title = `${currentFileHint}\n${uriLabel}`;
249
251
  label.setFile(file, {