@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.
- package/empty.js +1 -0
- package/package.json +45 -0
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +37 -0
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +127 -0
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +27 -0
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +81 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +44 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +172 -0
- package/vscode/src/vs/platform/editor/browser/editor.d.ts +12 -0
- package/vscode/src/vs/platform/editor/browser/editor.js +51 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +295 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +65 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +650 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +364 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +207 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.js +216 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.js +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.js +141 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.d.ts +169 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.js +951 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.js +109 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.js +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.js +286 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.d.ts +116 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.js +417 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.js +66 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.js +123 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.js +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.js +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.d.ts +94 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.js +567 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.js +224 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.js +259 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.js +117 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.d.ts +66 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.js +528 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.js +91 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.js +429 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.js +347 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.js +164 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.js +224 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.js +173 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatConfirmationWidget.css +341 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatExtensionsContent.css +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMarkdownPart.css +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMcpServersInteractionContent.css +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatPullRequestContent.css +75 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css +221 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatThinkingContent.css +162 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +94 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +96 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +147 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.js +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +353 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +100 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +1085 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +275 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +119 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +36 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.js +130 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +225 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.js +127 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.js +388 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +721 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.js +409 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.d.ts +334 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +2008 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.js +93 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.d.ts +217 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1573 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +249 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +84 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.js +174 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +76 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionAction.css +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.d.ts +292 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +2014 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css +171 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.d.ts +173 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +797 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.js +345 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +1069 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +139 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css +2880 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatAgentHover.css +87 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatCodeBlockPill.css +139 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatInlineAnchorWidget.css +61 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewWelcome.css +209 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.js +135 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.js +147 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +279 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +28 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatColors.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +176 -0
- package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.js +207 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +48 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +373 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +171 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +1442 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +199 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +482 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +37 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +95 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +497 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +76 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +464 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +124 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +562 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +279 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +411 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +66 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +154 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +201 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +372 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +594 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1746 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +269 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +806 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +116 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +62 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +295 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +241 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +146 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +90 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +42 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +77 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +823 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +567 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +189 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +439 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +263 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +48 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +89 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +108 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +145 -0
|
@@ -0,0 +1,1573 @@
|
|
|
1
|
+
|
|
2
|
+
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
4
|
+
import { $ as $$1, append, addDisposableListener, EventType, clearNode, addStandardDisposableListener, WindowIntervalTimer, getWindow, reset, scheduleAtNextAnimationFrame, findParentWithClass } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
5
|
+
import { renderFormattedText } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/formattedTextRenderer';
|
|
6
|
+
import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
|
|
7
|
+
import { alert } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
|
|
8
|
+
import { DropdownMenuActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/dropdown/dropdownActionViewItem';
|
|
9
|
+
import { getDefaultHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
10
|
+
import { coalesce, distinct } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
11
|
+
import { findLast } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arraysFind';
|
|
12
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
13
|
+
import { toErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errorMessage';
|
|
14
|
+
import { canceledName } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
15
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
16
|
+
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
17
|
+
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
18
|
+
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
19
|
+
import { Disposable, DisposableStore, dispose, toDisposable, thenIfNotDisposed } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
20
|
+
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
21
|
+
import { FileAccess, Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
22
|
+
import { clamp } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
|
|
23
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
24
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
25
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
26
|
+
import { createActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
27
|
+
import { MenuWorkbenchToolBar } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
|
|
28
|
+
import { MenuId, MenuItemAction } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
29
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
30
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
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 { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
34
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
35
|
+
import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
36
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
37
|
+
import { isDark } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/theme';
|
|
38
|
+
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
39
|
+
import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
|
|
40
|
+
import { IWorkbenchIssueService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/issue/common/issue.service';
|
|
41
|
+
import { CodiconActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView';
|
|
42
|
+
import { annotateSpecialMarkdownContent } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/annotations';
|
|
43
|
+
import { checkModeOption } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chat';
|
|
44
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
45
|
+
import { chatSubcommandLeader } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
46
|
+
import { ChatAgentVoteDirection, IChatToolInvocation, isChatFollowup, ChatErrorLevel, ChatAgentVoteDownReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
47
|
+
import { isResponseVM, isRequestVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatViewModel';
|
|
48
|
+
import { getNWords } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatWordCounter';
|
|
49
|
+
import { CodeBlockModelCollection } from '../common/codeBlockModelCollection.js';
|
|
50
|
+
import { ChatAgentLocation, ChatConfiguration, CollapsedToolsDisplayMode, ThinkingDisplayMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
51
|
+
import { localChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
52
|
+
import { getChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatUri';
|
|
53
|
+
import { MarkUnhelpfulActionId } from './actions/chatTitleActions.js';
|
|
54
|
+
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
55
|
+
import { ChatAgentHover, getChatAgentHoverOptions } from './chatAgentHover.js';
|
|
56
|
+
import { ChatContentMarkdownRenderer } from './chatContentMarkdownRenderer.js';
|
|
57
|
+
import { ChatAgentCommandContentPart } from './chatContentParts/chatAgentCommandContentPart.js';
|
|
58
|
+
import { ChatAnonymousRateLimitedPart } from './chatContentParts/chatAnonymousRateLimitedPart.js';
|
|
59
|
+
import { ChatAttachmentsContentPart } from './chatContentParts/chatAttachmentsContentPart.js';
|
|
60
|
+
import { ChatCheckpointFileChangesSummaryContentPart } from './chatContentParts/chatChangesSummaryPart.js';
|
|
61
|
+
import { ChatCodeCitationContentPart } from './chatContentParts/chatCodeCitationContentPart.js';
|
|
62
|
+
import { ChatCommandButtonContentPart } from './chatContentParts/chatCommandContentPart.js';
|
|
63
|
+
import { ChatConfirmationContentPart } from './chatContentParts/chatConfirmationContentPart.js';
|
|
64
|
+
import { EditorPool, DiffEditorPool } from './chatContentParts/chatContentCodePools.js';
|
|
65
|
+
import { ChatElicitationContentPart } from './chatContentParts/chatElicitationContentPart.js';
|
|
66
|
+
import { ChatErrorConfirmationContentPart } from './chatContentParts/chatErrorConfirmationPart.js';
|
|
67
|
+
import { ChatErrorContentPart } from './chatContentParts/chatErrorContentPart.js';
|
|
68
|
+
import { ChatExtensionsContentPart } from './chatContentParts/chatExtensionsContentPart.js';
|
|
69
|
+
import { ChatMarkdownContentPart } from './chatContentParts/chatMarkdownContentPart.js';
|
|
70
|
+
import { ChatMcpServersInteractionContentPart } from './chatContentParts/chatMcpServersInteractionContentPart.js';
|
|
71
|
+
import { ChatMultiDiffContentPart } from './chatContentParts/chatMultiDiffContentPart.js';
|
|
72
|
+
import { ChatWorkingProgressContentPart, ChatProgressContentPart } from './chatContentParts/chatProgressContentPart.js';
|
|
73
|
+
import { ChatPullRequestContentPart } from './chatContentParts/chatPullRequestContentPart.js';
|
|
74
|
+
import { ChatQuotaExceededPart } from './chatContentParts/chatQuotaExceededPart.js';
|
|
75
|
+
import { CollapsibleListPool, ChatUsedReferencesListContentPart } from './chatContentParts/chatReferencesContentPart.js';
|
|
76
|
+
import { ChatTaskContentPart } from './chatContentParts/chatTaskContentPart.js';
|
|
77
|
+
import { ChatTextEditContentPart } from './chatContentParts/chatTextEditContentPart.js';
|
|
78
|
+
import { ChatThinkingContentPart } from './chatContentParts/chatThinkingContentPart.js';
|
|
79
|
+
import { TreePool, ChatTreeContentPart } from './chatContentParts/chatTreeContentPart.js';
|
|
80
|
+
import * as chatMcpServersInteractionContent from './chatContentParts/media/chatMcpServersInteractionContent.css';
|
|
81
|
+
import { ChatToolInvocationPart } from './chatContentParts/toolInvocationParts/chatToolInvocationPart.js';
|
|
82
|
+
import { ChatMarkdownDecorationsRenderer } from './chatMarkdownDecorationsRenderer.js';
|
|
83
|
+
import { ChatCodeBlockContentProvider } from './codeBlockPart.js';
|
|
84
|
+
|
|
85
|
+
var ChatListItemRenderer_1;
|
|
86
|
+
registerCss(chatMcpServersInteractionContent);
|
|
87
|
+
const $ = $$1;
|
|
88
|
+
const COPILOT_USERNAME = 'GitHub Copilot';
|
|
89
|
+
const mostRecentResponseClassName = 'chat-most-recent-response';
|
|
90
|
+
let ChatListItemRenderer = class ChatListItemRenderer extends Disposable {
|
|
91
|
+
static { ChatListItemRenderer_1 = this; }
|
|
92
|
+
static { this.ID = 'item'; }
|
|
93
|
+
constructor(editorOptions, rendererOptions, delegate, codeBlockModelCollection, overflowWidgetsDomNode, viewModel, instantiationService, configService, logService, contextKeyService, themeService, commandService, hoverService, chatWidgetService, chatEntitlementService) {
|
|
94
|
+
super();
|
|
95
|
+
this.rendererOptions = rendererOptions;
|
|
96
|
+
this.delegate = delegate;
|
|
97
|
+
this.codeBlockModelCollection = codeBlockModelCollection;
|
|
98
|
+
this.viewModel = viewModel;
|
|
99
|
+
this.instantiationService = instantiationService;
|
|
100
|
+
this.configService = configService;
|
|
101
|
+
this.logService = logService;
|
|
102
|
+
this.contextKeyService = contextKeyService;
|
|
103
|
+
this.themeService = themeService;
|
|
104
|
+
this.commandService = commandService;
|
|
105
|
+
this.hoverService = hoverService;
|
|
106
|
+
this.chatWidgetService = chatWidgetService;
|
|
107
|
+
this.chatEntitlementService = chatEntitlementService;
|
|
108
|
+
this.codeBlocksByResponseId = ( new Map());
|
|
109
|
+
this.codeBlocksByEditorUri = ( new ResourceMap());
|
|
110
|
+
this.fileTreesByResponseId = ( new Map());
|
|
111
|
+
this.focusedFileTreesByResponseId = ( new Map());
|
|
112
|
+
this.templateDataByRequestId = ( new Map());
|
|
113
|
+
this._onDidClickFollowup = this._register(( new Emitter()));
|
|
114
|
+
this.onDidClickFollowup = this._onDidClickFollowup.event;
|
|
115
|
+
this._onDidClickRerunWithAgentOrCommandDetection = ( new Emitter());
|
|
116
|
+
this.onDidClickRerunWithAgentOrCommandDetection = this._onDidClickRerunWithAgentOrCommandDetection.event;
|
|
117
|
+
this._onDidClickRequest = this._register(( new Emitter()));
|
|
118
|
+
this.onDidClickRequest = this._onDidClickRequest.event;
|
|
119
|
+
this._onDidRerender = this._register(( new Emitter()));
|
|
120
|
+
this.onDidRerender = this._onDidRerender.event;
|
|
121
|
+
this._onDidDispose = this._register(( new Emitter()));
|
|
122
|
+
this.onDidDispose = this._onDidDispose.event;
|
|
123
|
+
this._onDidFocusOutside = this._register(( new Emitter()));
|
|
124
|
+
this.onDidFocusOutside = this._onDidFocusOutside.event;
|
|
125
|
+
this._onDidChangeItemHeight = this._register(( new Emitter()));
|
|
126
|
+
this.onDidChangeItemHeight = this._onDidChangeItemHeight.event;
|
|
127
|
+
this._currentLayoutWidth = 0;
|
|
128
|
+
this._isVisible = true;
|
|
129
|
+
this._onDidChangeVisibility = this._register(( new Emitter()));
|
|
130
|
+
this._announcedToolProgressKeys = ( new Set());
|
|
131
|
+
this.chatContentMarkdownRenderer = this.instantiationService.createInstance(ChatContentMarkdownRenderer);
|
|
132
|
+
this.markdownDecorationsRenderer = this.instantiationService.createInstance(ChatMarkdownDecorationsRenderer);
|
|
133
|
+
this._editorPool = this._register(this.instantiationService.createInstance(EditorPool, editorOptions, delegate, overflowWidgetsDomNode, false));
|
|
134
|
+
this._toolEditorPool = this._register(this.instantiationService.createInstance(EditorPool, editorOptions, delegate, overflowWidgetsDomNode, true));
|
|
135
|
+
this._diffEditorPool = this._register(this.instantiationService.createInstance(DiffEditorPool, editorOptions, delegate, overflowWidgetsDomNode, false));
|
|
136
|
+
this._treePool = this._register(this.instantiationService.createInstance(TreePool, this._onDidChangeVisibility.event));
|
|
137
|
+
this._contentReferencesListPool = this._register(this.instantiationService.createInstance(CollapsibleListPool, this._onDidChangeVisibility.event, undefined, undefined));
|
|
138
|
+
this._register(this.instantiationService.createInstance(ChatCodeBlockContentProvider));
|
|
139
|
+
this._toolInvocationCodeBlockCollection = this._register(this.instantiationService.createInstance(CodeBlockModelCollection, 'tools'));
|
|
140
|
+
}
|
|
141
|
+
updateOptions(options) {
|
|
142
|
+
this.rendererOptions = { ...this.rendererOptions, ...options };
|
|
143
|
+
}
|
|
144
|
+
get templateId() {
|
|
145
|
+
return ChatListItemRenderer_1.ID;
|
|
146
|
+
}
|
|
147
|
+
editorsInUse() {
|
|
148
|
+
return Iterable.concat(this._editorPool.inUse(), this._toolEditorPool.inUse());
|
|
149
|
+
}
|
|
150
|
+
traceLayout(method, message) {
|
|
151
|
+
{
|
|
152
|
+
this.logService.trace(`ChatListItemRenderer#${method}: ${message}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
getProgressiveRenderRate(element) {
|
|
156
|
+
let Rate;
|
|
157
|
+
(function (Rate) {
|
|
158
|
+
Rate[Rate["Min"] = 5] = "Min";
|
|
159
|
+
Rate[Rate["Max"] = 2000] = "Max";
|
|
160
|
+
})(Rate || (Rate = {}));
|
|
161
|
+
const minAfterComplete = 80;
|
|
162
|
+
const rate = element.contentUpdateTimings?.impliedWordLoadRate;
|
|
163
|
+
if (element.isComplete) {
|
|
164
|
+
if (typeof rate === 'number') {
|
|
165
|
+
return clamp(rate, minAfterComplete, Rate.Max);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return minAfterComplete;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (typeof rate === 'number') {
|
|
172
|
+
return clamp(rate, Rate.Min, Rate.Max);
|
|
173
|
+
}
|
|
174
|
+
return 8;
|
|
175
|
+
}
|
|
176
|
+
getCodeBlockInfosForResponse(response) {
|
|
177
|
+
const codeBlocks = this.codeBlocksByResponseId.get(response.id);
|
|
178
|
+
return codeBlocks ?? [];
|
|
179
|
+
}
|
|
180
|
+
updateViewModel(viewModel) {
|
|
181
|
+
this.viewModel = viewModel;
|
|
182
|
+
this._announcedToolProgressKeys.clear();
|
|
183
|
+
}
|
|
184
|
+
getCodeBlockInfoForEditor(uri) {
|
|
185
|
+
return this.codeBlocksByEditorUri.get(uri);
|
|
186
|
+
}
|
|
187
|
+
getFileTreeInfosForResponse(response) {
|
|
188
|
+
const fileTrees = this.fileTreesByResponseId.get(response.id);
|
|
189
|
+
return fileTrees ?? [];
|
|
190
|
+
}
|
|
191
|
+
getLastFocusedFileTreeForResponse(response) {
|
|
192
|
+
const fileTrees = this.fileTreesByResponseId.get(response.id);
|
|
193
|
+
const lastFocusedFileTreeIndex = this.focusedFileTreesByResponseId.get(response.id);
|
|
194
|
+
if (fileTrees?.length && lastFocusedFileTreeIndex !== undefined && lastFocusedFileTreeIndex < fileTrees.length) {
|
|
195
|
+
return fileTrees[lastFocusedFileTreeIndex];
|
|
196
|
+
}
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
getTemplateDataForRequestId(requestId) {
|
|
200
|
+
if (!requestId) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
const templateData = this.templateDataByRequestId.get(requestId);
|
|
204
|
+
if (templateData && templateData.currentElement?.id === requestId) {
|
|
205
|
+
return templateData;
|
|
206
|
+
}
|
|
207
|
+
if (templateData) {
|
|
208
|
+
this.templateDataByRequestId.delete(requestId);
|
|
209
|
+
}
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
setVisible(visible) {
|
|
213
|
+
this._isVisible = visible;
|
|
214
|
+
this._onDidChangeVisibility.fire(visible);
|
|
215
|
+
}
|
|
216
|
+
layout(width) {
|
|
217
|
+
const newWidth = width - 40;
|
|
218
|
+
if (newWidth !== this._currentLayoutWidth) {
|
|
219
|
+
this._currentLayoutWidth = newWidth;
|
|
220
|
+
for (const editor of this._editorPool.inUse()) {
|
|
221
|
+
editor.layout(this._currentLayoutWidth);
|
|
222
|
+
}
|
|
223
|
+
for (const toolEditor of this._toolEditorPool.inUse()) {
|
|
224
|
+
toolEditor.layout(this._currentLayoutWidth);
|
|
225
|
+
}
|
|
226
|
+
for (const diffEditor of this._diffEditorPool.inUse()) {
|
|
227
|
+
diffEditor.layout(this._currentLayoutWidth);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
renderTemplate(container) {
|
|
232
|
+
const templateDisposables = ( new DisposableStore());
|
|
233
|
+
const disabledOverlay = append(container, $('.chat-row-disabled-overlay'));
|
|
234
|
+
const rowContainer = append(container, $('.interactive-item-container'));
|
|
235
|
+
if (this.rendererOptions.renderStyle === 'compact') {
|
|
236
|
+
rowContainer.classList.add('interactive-item-compact');
|
|
237
|
+
}
|
|
238
|
+
let headerParent = rowContainer;
|
|
239
|
+
let valueParent = rowContainer;
|
|
240
|
+
let detailContainerParent;
|
|
241
|
+
if (this.rendererOptions.renderStyle === 'minimal') {
|
|
242
|
+
rowContainer.classList.add('interactive-item-compact');
|
|
243
|
+
rowContainer.classList.add('minimal');
|
|
244
|
+
const lhsContainer = append(rowContainer, $('.column.left'));
|
|
245
|
+
const rhsContainer = append(rowContainer, $('.column.right'));
|
|
246
|
+
headerParent = lhsContainer;
|
|
247
|
+
detailContainerParent = rhsContainer;
|
|
248
|
+
valueParent = rhsContainer;
|
|
249
|
+
}
|
|
250
|
+
const header = append(headerParent, $('.header'));
|
|
251
|
+
const contextKeyService = templateDisposables.add(this.contextKeyService.createScoped(rowContainer));
|
|
252
|
+
const scopedInstantiationService = templateDisposables.add(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, contextKeyService]))));
|
|
253
|
+
const requestHover = append(rowContainer, $('.request-hover'));
|
|
254
|
+
let titleToolbar;
|
|
255
|
+
if (this.rendererOptions.noHeader) {
|
|
256
|
+
header.classList.add('hidden');
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
titleToolbar = templateDisposables.add(scopedInstantiationService.createInstance(MenuWorkbenchToolBar, requestHover, MenuId.ChatMessageTitle, {
|
|
260
|
+
menuOptions: {
|
|
261
|
+
shouldForwardArgs: true
|
|
262
|
+
},
|
|
263
|
+
toolbarOptions: {
|
|
264
|
+
shouldInlineSubmenu: submenu => submenu.actions.length <= 1
|
|
265
|
+
},
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
this.hoverHidden(requestHover);
|
|
269
|
+
const checkpointContainer = append(rowContainer, $('.checkpoint-container'));
|
|
270
|
+
const codiconContainer = append(checkpointContainer, $('.codicon-container'));
|
|
271
|
+
append(codiconContainer, $('span.codicon.codicon-bookmark'));
|
|
272
|
+
const checkpointToolbar = templateDisposables.add(scopedInstantiationService.createInstance(MenuWorkbenchToolBar, checkpointContainer, MenuId.ChatMessageCheckpoint, {
|
|
273
|
+
actionViewItemProvider: (action, options) => {
|
|
274
|
+
if (action instanceof MenuItemAction) {
|
|
275
|
+
return this.instantiationService.createInstance(CodiconActionViewItem, action, { hoverDelegate: options.hoverDelegate });
|
|
276
|
+
}
|
|
277
|
+
return undefined;
|
|
278
|
+
},
|
|
279
|
+
renderDropdownAsChildElement: true,
|
|
280
|
+
menuOptions: {
|
|
281
|
+
shouldForwardArgs: true
|
|
282
|
+
},
|
|
283
|
+
toolbarOptions: {
|
|
284
|
+
shouldInlineSubmenu: submenu => submenu.actions.length <= 1
|
|
285
|
+
},
|
|
286
|
+
}));
|
|
287
|
+
append(checkpointContainer, $('.checkpoint-divider'));
|
|
288
|
+
const user = append(header, $('.user'));
|
|
289
|
+
const avatarContainer = append(user, $('.avatar-container'));
|
|
290
|
+
const username = append(user, $('h3.username'));
|
|
291
|
+
username.tabIndex = 0;
|
|
292
|
+
const detailContainer = append(detailContainerParent ?? user, $('span.detail-container'));
|
|
293
|
+
const detail = append(detailContainer, $('span.detail'));
|
|
294
|
+
append(detailContainer, $('span.chat-animated-ellipsis'));
|
|
295
|
+
const value = append(valueParent, $('.value'));
|
|
296
|
+
const elementDisposables = ( new DisposableStore());
|
|
297
|
+
const footerToolbarContainer = append(rowContainer, $('.chat-footer-toolbar'));
|
|
298
|
+
if (this.rendererOptions.noFooter) {
|
|
299
|
+
footerToolbarContainer.classList.add('hidden');
|
|
300
|
+
}
|
|
301
|
+
const footerToolbar = templateDisposables.add(scopedInstantiationService.createInstance(MenuWorkbenchToolBar, footerToolbarContainer, MenuId.ChatMessageFooter, {
|
|
302
|
+
eventDebounceDelay: 0,
|
|
303
|
+
menuOptions: { shouldForwardArgs: true, renderShortTitle: true },
|
|
304
|
+
toolbarOptions: { shouldInlineSubmenu: submenu => submenu.actions.length <= 1 },
|
|
305
|
+
actionViewItemProvider: (action, options) => {
|
|
306
|
+
if (action instanceof MenuItemAction && action.item.id === MarkUnhelpfulActionId) {
|
|
307
|
+
return scopedInstantiationService.createInstance(ChatVoteDownButton, action, options);
|
|
308
|
+
}
|
|
309
|
+
return createActionViewItem(scopedInstantiationService, action, options);
|
|
310
|
+
}
|
|
311
|
+
}));
|
|
312
|
+
const footerDetailsContainer = append(footerToolbar.getElement(), $('.chat-footer-details'));
|
|
313
|
+
footerDetailsContainer.tabIndex = 0;
|
|
314
|
+
const checkpointRestoreContainer = append(rowContainer, $('.checkpoint-restore-container'));
|
|
315
|
+
const codiconRestoreContainer = append(checkpointRestoreContainer, $('.codicon-container'));
|
|
316
|
+
append(codiconRestoreContainer, $('span.codicon.codicon-bookmark'));
|
|
317
|
+
const label = append(checkpointRestoreContainer, $('span.checkpoint-label-text'));
|
|
318
|
+
label.textContent = ( localize(5326, 'Checkpoint Restored'));
|
|
319
|
+
const checkpointRestoreToolbar = templateDisposables.add(scopedInstantiationService.createInstance(MenuWorkbenchToolBar, checkpointRestoreContainer, MenuId.ChatMessageRestoreCheckpoint, {
|
|
320
|
+
actionViewItemProvider: (action, options) => {
|
|
321
|
+
if (action instanceof MenuItemAction) {
|
|
322
|
+
return this.instantiationService.createInstance(CodiconActionViewItem, action, { hoverDelegate: options.hoverDelegate });
|
|
323
|
+
}
|
|
324
|
+
return undefined;
|
|
325
|
+
},
|
|
326
|
+
renderDropdownAsChildElement: true,
|
|
327
|
+
menuOptions: {
|
|
328
|
+
shouldForwardArgs: true
|
|
329
|
+
},
|
|
330
|
+
toolbarOptions: {
|
|
331
|
+
shouldInlineSubmenu: submenu => submenu.actions.length <= 1
|
|
332
|
+
},
|
|
333
|
+
}));
|
|
334
|
+
append(checkpointRestoreContainer, $('.checkpoint-divider'));
|
|
335
|
+
const agentHover = templateDisposables.add(this.instantiationService.createInstance(ChatAgentHover));
|
|
336
|
+
const hoverContent = () => {
|
|
337
|
+
if (isResponseVM(template.currentElement) && template.currentElement.agent && !template.currentElement.agent.isDefault) {
|
|
338
|
+
agentHover.setAgent(template.currentElement.agent.id);
|
|
339
|
+
return agentHover.domNode;
|
|
340
|
+
}
|
|
341
|
+
return undefined;
|
|
342
|
+
};
|
|
343
|
+
const hoverOptions = getChatAgentHoverOptions(() => isResponseVM(template.currentElement) ? template.currentElement.agent : undefined, this.commandService);
|
|
344
|
+
templateDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), user, hoverContent, hoverOptions));
|
|
345
|
+
templateDisposables.add(addDisposableListener(user, EventType.KEY_DOWN, e => {
|
|
346
|
+
const ev = ( new StandardKeyboardEvent(e));
|
|
347
|
+
if (ev.equals(KeyCode.Space) || ev.equals(KeyCode.Enter)) {
|
|
348
|
+
const content = hoverContent();
|
|
349
|
+
if (content) {
|
|
350
|
+
this.hoverService.showInstantHover({ content, target: user, trapFocus: true, actions: hoverOptions.actions }, true);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else if (ev.equals(KeyCode.Escape)) {
|
|
354
|
+
this.hoverService.hideHover();
|
|
355
|
+
}
|
|
356
|
+
}));
|
|
357
|
+
const template = { header, avatarContainer, requestHover, username, detail, value, rowContainer, elementDisposables, templateDisposables, contextKeyService, instantiationService: scopedInstantiationService, agentHover, titleToolbar, footerToolbar, footerDetailsContainer, disabledOverlay, checkpointToolbar, checkpointRestoreToolbar, checkpointContainer, checkpointRestoreContainer };
|
|
358
|
+
templateDisposables.add(addDisposableListener(disabledOverlay, EventType.CLICK, e => {
|
|
359
|
+
if (!this.viewModel?.editing) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const current = template.currentElement;
|
|
363
|
+
if (!current || current.id === this.viewModel.editing.id) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (disabledOverlay.classList.contains('disabled')) {
|
|
367
|
+
e.preventDefault();
|
|
368
|
+
e.stopPropagation();
|
|
369
|
+
this._onDidFocusOutside.fire();
|
|
370
|
+
}
|
|
371
|
+
}));
|
|
372
|
+
return template;
|
|
373
|
+
}
|
|
374
|
+
renderElement(node, index, templateData) {
|
|
375
|
+
this.renderChatTreeItem(node.element, index, templateData);
|
|
376
|
+
}
|
|
377
|
+
clearRenderedParts(templateData) {
|
|
378
|
+
if (templateData.renderedParts) {
|
|
379
|
+
dispose(coalesce(templateData.renderedParts));
|
|
380
|
+
templateData.renderedParts = undefined;
|
|
381
|
+
clearNode(templateData.value);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
renderChatTreeItem(element, index, templateData) {
|
|
385
|
+
if (templateData.currentElement && templateData.currentElement.id !== element.id) {
|
|
386
|
+
this.traceLayout('renderChatTreeItem', `Rendering a different element into the template, index=${index}`);
|
|
387
|
+
this.clearRenderedParts(templateData);
|
|
388
|
+
const mappedTemplateData = this.templateDataByRequestId.get(templateData.currentElement.id);
|
|
389
|
+
if (mappedTemplateData && (mappedTemplateData.currentElement?.id !== templateData.currentElement.id)) {
|
|
390
|
+
this.templateDataByRequestId.delete(templateData.currentElement.id);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
templateData.currentElement = element;
|
|
394
|
+
this.templateDataByRequestId.set(element.id, templateData);
|
|
395
|
+
const kind = isRequestVM(element) ? 'request' :
|
|
396
|
+
isResponseVM(element) ? 'response' :
|
|
397
|
+
'welcome';
|
|
398
|
+
this.traceLayout('renderElement', `${kind}, index=${index}`);
|
|
399
|
+
ChatContextKeys.isResponse.bindTo(templateData.contextKeyService).set(isResponseVM(element));
|
|
400
|
+
ChatContextKeys.itemId.bindTo(templateData.contextKeyService).set(element.id);
|
|
401
|
+
ChatContextKeys.isRequest.bindTo(templateData.contextKeyService).set(isRequestVM(element));
|
|
402
|
+
ChatContextKeys.responseDetectedAgentCommand.bindTo(templateData.contextKeyService).set(isResponseVM(element) && element.agentOrSlashCommandDetected);
|
|
403
|
+
if (isResponseVM(element)) {
|
|
404
|
+
ChatContextKeys.responseSupportsIssueReporting.bindTo(templateData.contextKeyService).set(!!element.agent?.metadata.supportIssueReporting);
|
|
405
|
+
ChatContextKeys.responseVote.bindTo(templateData.contextKeyService).set(element.vote === ChatAgentVoteDirection.Up ? 'up' : element.vote === ChatAgentVoteDirection.Down ? 'down' : '');
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
ChatContextKeys.responseVote.bindTo(templateData.contextKeyService).set('');
|
|
409
|
+
}
|
|
410
|
+
if (templateData.titleToolbar) {
|
|
411
|
+
templateData.titleToolbar.context = element;
|
|
412
|
+
}
|
|
413
|
+
templateData.footerToolbar.context = element;
|
|
414
|
+
if (isResponseVM(element) && element.result?.details) {
|
|
415
|
+
templateData.footerDetailsContainer.textContent = element.result.details;
|
|
416
|
+
templateData.footerDetailsContainer.classList.remove('hidden');
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
templateData.footerDetailsContainer.classList.add('hidden');
|
|
420
|
+
}
|
|
421
|
+
ChatContextKeys.responseHasError.bindTo(templateData.contextKeyService).set(isResponseVM(element) && !!element.errorDetails);
|
|
422
|
+
const isFiltered = !!(isResponseVM(element) && element.errorDetails?.responseIsFiltered);
|
|
423
|
+
ChatContextKeys.responseIsFiltered.bindTo(templateData.contextKeyService).set(isFiltered);
|
|
424
|
+
const location = this.chatWidgetService.getWidgetBySessionResource(element.sessionResource)?.location;
|
|
425
|
+
templateData.rowContainer.classList.toggle('editing-session', location === ChatAgentLocation.Chat);
|
|
426
|
+
templateData.rowContainer.classList.toggle('interactive-request', isRequestVM(element));
|
|
427
|
+
templateData.rowContainer.classList.toggle('interactive-response', isResponseVM(element));
|
|
428
|
+
const progressMessageAtBottomOfResponse = checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.progressMessageAtBottomOfResponse);
|
|
429
|
+
templateData.rowContainer.classList.toggle('show-detail-progress', isResponseVM(element) && !element.isComplete && !element.progressMessages.length && !progressMessageAtBottomOfResponse);
|
|
430
|
+
if (!this.rendererOptions.noHeader) {
|
|
431
|
+
this.renderAvatar(element, templateData);
|
|
432
|
+
}
|
|
433
|
+
templateData.username.textContent = element.username;
|
|
434
|
+
templateData.username.classList.toggle('hidden', element.username === COPILOT_USERNAME);
|
|
435
|
+
templateData.avatarContainer.classList.toggle('hidden', element.username === COPILOT_USERNAME);
|
|
436
|
+
this.hoverHidden(templateData.requestHover);
|
|
437
|
+
clearNode(templateData.detail);
|
|
438
|
+
if (isResponseVM(element)) {
|
|
439
|
+
this.renderDetail(element, templateData);
|
|
440
|
+
}
|
|
441
|
+
templateData.checkpointToolbar.context = element;
|
|
442
|
+
const checkpointEnabled = this.configService.getValue(ChatConfiguration.CheckpointsEnabled)
|
|
443
|
+
&& (this.rendererOptions.restorable ?? true);
|
|
444
|
+
templateData.checkpointContainer.classList.toggle('hidden', isResponseVM(element) || !(checkpointEnabled));
|
|
445
|
+
const shouldShowRestore = this.viewModel?.model.checkpoint && !this.viewModel?.editing && (index === this.delegate.getListLength() - 1);
|
|
446
|
+
templateData.checkpointRestoreContainer.classList.toggle('hidden', !(shouldShowRestore && checkpointEnabled));
|
|
447
|
+
const editing = element.id === this.viewModel?.editing?.id;
|
|
448
|
+
const isInput = this.configService.getValue('chat.editRequests') === 'input';
|
|
449
|
+
templateData.disabledOverlay.classList.toggle('disabled', element.shouldBeBlocked && !editing && this.viewModel?.editing !== undefined);
|
|
450
|
+
templateData.rowContainer.classList.toggle('editing', editing && !isInput);
|
|
451
|
+
templateData.rowContainer.classList.toggle('editing-input', editing && isInput);
|
|
452
|
+
templateData.requestHover.classList.toggle('editing', editing && isInput);
|
|
453
|
+
templateData.requestHover.classList.toggle('hidden', (!!this.viewModel?.editing && !editing) || isResponseVM(element));
|
|
454
|
+
templateData.requestHover.classList.toggle('expanded', this.configService.getValue('chat.editRequests') === 'hover');
|
|
455
|
+
templateData.requestHover.classList.toggle('checkpoints-enabled', checkpointEnabled);
|
|
456
|
+
templateData.elementDisposables.add(addStandardDisposableListener(templateData.rowContainer, EventType.CLICK, (e) => {
|
|
457
|
+
const current = templateData.currentElement;
|
|
458
|
+
if (current && this.viewModel?.editing && current.id !== this.viewModel.editing.id) {
|
|
459
|
+
e.stopPropagation();
|
|
460
|
+
e.preventDefault();
|
|
461
|
+
this._onDidFocusOutside.fire();
|
|
462
|
+
}
|
|
463
|
+
}));
|
|
464
|
+
templateData.rowContainer.parentElement?.parentElement?.parentElement?.classList.toggle('request', isRequestVM(element));
|
|
465
|
+
templateData.rowContainer.classList.toggle(mostRecentResponseClassName, index === this.delegate.getListLength() - 1);
|
|
466
|
+
templateData.rowContainer.classList.toggle('confirmation-message', isRequestVM(element) && !!element.confirmation);
|
|
467
|
+
const shouldShowHeader = isResponseVM(element) && !this.rendererOptions.noHeader;
|
|
468
|
+
templateData.header?.classList.toggle('header-disabled', !shouldShowHeader);
|
|
469
|
+
if (isRequestVM(element) && element.confirmation) {
|
|
470
|
+
this.renderConfirmationAction(element, templateData);
|
|
471
|
+
}
|
|
472
|
+
if (isResponseVM(element) && index === this.delegate.getListLength() - 1 && (!element.isComplete || element.renderData)) {
|
|
473
|
+
this.traceLayout('renderElement', `start progressive render, index=${index}`);
|
|
474
|
+
const timer = templateData.elementDisposables.add(new WindowIntervalTimer());
|
|
475
|
+
const runProgressiveRender = (initial) => {
|
|
476
|
+
try {
|
|
477
|
+
if (this.doNextProgressiveRender(element, index, templateData, !!initial)) {
|
|
478
|
+
timer.cancel();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
catch (err) {
|
|
482
|
+
timer.cancel();
|
|
483
|
+
this.logService.error(err);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
timer.cancelAndSet(runProgressiveRender, 50, getWindow(templateData.rowContainer));
|
|
487
|
+
runProgressiveRender(true);
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
if (isResponseVM(element)) {
|
|
491
|
+
this.renderChatResponseBasic(element, index, templateData);
|
|
492
|
+
}
|
|
493
|
+
else if (isRequestVM(element)) {
|
|
494
|
+
this.renderChatRequest(element, index, templateData);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
renderDetail(element, templateData) {
|
|
499
|
+
clearNode(templateData.detail);
|
|
500
|
+
if (element.agentOrSlashCommandDetected) {
|
|
501
|
+
const msg = element.slashCommand ? ( localize(
|
|
502
|
+
5327,
|
|
503
|
+
"used {0} [[(rerun without)]]",
|
|
504
|
+
`${chatSubcommandLeader}${element.slashCommand.name}`
|
|
505
|
+
)) : ( localize(5328, "[[(rerun without)]]"));
|
|
506
|
+
reset(templateData.detail, renderFormattedText(msg, {
|
|
507
|
+
actionHandler: {
|
|
508
|
+
disposables: templateData.elementDisposables,
|
|
509
|
+
callback: (content) => {
|
|
510
|
+
this._onDidClickRerunWithAgentOrCommandDetection.fire(element);
|
|
511
|
+
},
|
|
512
|
+
}
|
|
513
|
+
}, $('span.agentOrSlashCommandDetected')));
|
|
514
|
+
}
|
|
515
|
+
else if (this.rendererOptions.renderStyle !== 'minimal' && !element.isComplete && !checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.progressMessageAtBottomOfResponse)) {
|
|
516
|
+
templateData.detail.textContent = ( localize(5329, "Working"));
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
renderConfirmationAction(element, templateData) {
|
|
520
|
+
clearNode(templateData.detail);
|
|
521
|
+
if (element.confirmation) {
|
|
522
|
+
append(templateData.detail, $('span.codicon.codicon-check', { 'aria-hidden': 'true' }));
|
|
523
|
+
append(templateData.detail, $('span.confirmation-text', undefined, ( localize(5330, 'Selected "{0}"', element.confirmation))));
|
|
524
|
+
templateData.header?.classList.remove('header-disabled');
|
|
525
|
+
templateData.header?.classList.add('partially-disabled');
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
renderAvatar(element, templateData) {
|
|
529
|
+
const icon = isResponseVM(element) ?
|
|
530
|
+
this.getAgentIcon(element.agent?.metadata) :
|
|
531
|
+
(element.avatarIcon ?? Codicon.account);
|
|
532
|
+
if (icon instanceof URI) {
|
|
533
|
+
const avatarIcon = $$1('img.icon');
|
|
534
|
+
avatarIcon.src = ( FileAccess.uriToBrowserUri(icon).toString(true));
|
|
535
|
+
templateData.avatarContainer.replaceChildren($$1('.avatar', undefined, avatarIcon));
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
const avatarIcon = $$1(ThemeIcon.asCSSSelector(icon));
|
|
539
|
+
templateData.avatarContainer.replaceChildren($$1('.avatar.codicon-avatar', undefined, avatarIcon));
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
getAgentIcon(agent) {
|
|
543
|
+
if (agent?.themeIcon) {
|
|
544
|
+
return agent.themeIcon;
|
|
545
|
+
}
|
|
546
|
+
else if (agent?.iconDark && isDark(this.themeService.getColorTheme().type)) {
|
|
547
|
+
return agent.iconDark;
|
|
548
|
+
}
|
|
549
|
+
else if (agent?.icon) {
|
|
550
|
+
return agent.icon;
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
return Codicon.chatSparkle;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
renderChatResponseBasic(element, index, templateData) {
|
|
557
|
+
templateData.rowContainer.classList.toggle('chat-response-loading', (isResponseVM(element) && !element.isComplete));
|
|
558
|
+
if (element.isCanceled) {
|
|
559
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
560
|
+
if (lastThinking?.domNode) {
|
|
561
|
+
lastThinking.finalizeTitleIfDefault();
|
|
562
|
+
lastThinking.markAsInactive();
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
const content = [];
|
|
566
|
+
const isFiltered = !!element.errorDetails?.responseIsFiltered;
|
|
567
|
+
if (!isFiltered) {
|
|
568
|
+
content.push({ kind: 'references', references: element.contentReferences });
|
|
569
|
+
content.push(...annotateSpecialMarkdownContent(element.response.value));
|
|
570
|
+
if (element.codeCitations.length) {
|
|
571
|
+
content.push({ kind: 'codeCitations', citations: element.codeCitations });
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (element.model.response === element.model.entireResponse && element.errorDetails?.message && element.errorDetails.message !== canceledName) {
|
|
575
|
+
content.push({ kind: 'errorDetails', errorDetails: element.errorDetails, isLast: index === this.delegate.getListLength() - 1 });
|
|
576
|
+
}
|
|
577
|
+
const fileChangesSummaryPart = this.getChatFileChangesSummaryPart(element);
|
|
578
|
+
if (fileChangesSummaryPart) {
|
|
579
|
+
content.push(fileChangesSummaryPart);
|
|
580
|
+
}
|
|
581
|
+
const diff = this.diff(templateData.renderedParts ?? [], content, element);
|
|
582
|
+
this.renderChatContentDiff(diff, content, element, index, templateData);
|
|
583
|
+
this.updateItemHeightOnRender(element, templateData);
|
|
584
|
+
}
|
|
585
|
+
shouldShowWorkingProgress(element, partsToRender, templateData) {
|
|
586
|
+
if (element.agentOrSlashCommandDetected || this.rendererOptions.renderStyle === 'minimal' || element.isComplete || !checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.progressMessageAtBottomOfResponse)) {
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
const lastPart = findLast(partsToRender, part => part.kind !== 'markdownContent' || part.content.value.trim().length > 0);
|
|
590
|
+
const collapsedToolsMode = this.configService.getValue('chat.agent.thinking.collapsedTools');
|
|
591
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
592
|
+
if (lastThinking &&
|
|
593
|
+
(collapsedToolsMode === CollapsedToolsDisplayMode.Always ||
|
|
594
|
+
collapsedToolsMode === CollapsedToolsDisplayMode.WithThinking)) {
|
|
595
|
+
if (!lastPart || lastPart.kind === 'thinking' || lastPart.kind === 'toolInvocation' || lastPart.kind === 'prepareToolInvocation' || lastPart.kind === 'textEditGroup' || lastPart.kind === 'notebookEditGroup') {
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (!lastPart ||
|
|
600
|
+
lastPart.kind === 'references' ||
|
|
601
|
+
((lastPart.kind === 'toolInvocation' || lastPart.kind === 'toolInvocationSerialized') && (IChatToolInvocation.isComplete(lastPart) || lastPart.presentation === 'hidden')) ||
|
|
602
|
+
((lastPart.kind === 'textEditGroup' || lastPart.kind === 'notebookEditGroup') && lastPart.done && !( partsToRender.some(
|
|
603
|
+
part => part.kind === 'toolInvocation' && !IChatToolInvocation.isComplete(part)
|
|
604
|
+
))) ||
|
|
605
|
+
(lastPart.kind === 'progressTask' && lastPart.deferred.isSettled) ||
|
|
606
|
+
lastPart.kind === 'prepareToolInvocation' || lastPart.kind === 'mcpServersStarting') {
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
609
|
+
return false;
|
|
610
|
+
}
|
|
611
|
+
getChatFileChangesSummaryPart(element) {
|
|
612
|
+
if (!this.shouldShowFileChangesSummary(element)) {
|
|
613
|
+
return undefined;
|
|
614
|
+
}
|
|
615
|
+
const consideredFiles = ( new Set());
|
|
616
|
+
const fileChanges = [];
|
|
617
|
+
for (const part of element.model.entireResponse.value) {
|
|
618
|
+
if ((part.kind === 'textEditGroup' || part.kind === 'notebookEditGroup') && !( consideredFiles.has(( part.uri.toString(true))))) {
|
|
619
|
+
fileChanges.push({
|
|
620
|
+
kind: 'changesSummary',
|
|
621
|
+
reference: part.uri,
|
|
622
|
+
sessionId: element.sessionId,
|
|
623
|
+
requestId: element.requestId,
|
|
624
|
+
});
|
|
625
|
+
consideredFiles.add(( part.uri.toString(true)));
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (!fileChanges.length) {
|
|
629
|
+
return undefined;
|
|
630
|
+
}
|
|
631
|
+
return { kind: 'changesSummary', fileChanges };
|
|
632
|
+
}
|
|
633
|
+
renderChatRequest(element, index, templateData) {
|
|
634
|
+
templateData.rowContainer.classList.toggle('chat-response-loading', false);
|
|
635
|
+
if (element.id === this.viewModel?.editing?.id) {
|
|
636
|
+
this._onDidRerender.fire(templateData);
|
|
637
|
+
}
|
|
638
|
+
if (this.configService.getValue('chat.editRequests') !== 'none' && this.rendererOptions.editable) {
|
|
639
|
+
templateData.elementDisposables.add(addDisposableListener(templateData.rowContainer, EventType.KEY_DOWN, e => {
|
|
640
|
+
const ev = ( new StandardKeyboardEvent(e));
|
|
641
|
+
if (ev.equals(KeyCode.Space) || ev.equals(KeyCode.Enter)) {
|
|
642
|
+
if (this.viewModel?.editing?.id !== element.id) {
|
|
643
|
+
ev.preventDefault();
|
|
644
|
+
ev.stopPropagation();
|
|
645
|
+
this._onDidClickRequest.fire(templateData);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}));
|
|
649
|
+
}
|
|
650
|
+
let content = [];
|
|
651
|
+
if (!element.confirmation) {
|
|
652
|
+
const markdown = isChatFollowup(element.message) ?
|
|
653
|
+
element.message.message :
|
|
654
|
+
this.markdownDecorationsRenderer.convertParsedRequestToMarkdown(element.sessionResource, element.message);
|
|
655
|
+
content = [{ content: ( new MarkdownString(markdown)), kind: 'markdownContent' }];
|
|
656
|
+
if (this.rendererOptions.renderStyle === 'minimal' && !element.isComplete) {
|
|
657
|
+
templateData.value.classList.add('inline-progress');
|
|
658
|
+
templateData.elementDisposables.add(toDisposable(() => templateData.value.classList.remove('inline-progress')));
|
|
659
|
+
content.push({ content: ( new MarkdownString('<span></span>', { supportHtml: true })), kind: 'markdownContent' });
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
templateData.value.classList.remove('inline-progress');
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
clearNode(templateData.value);
|
|
666
|
+
const parts = [];
|
|
667
|
+
let inlineSlashCommandRendered = false;
|
|
668
|
+
content.forEach((data, contentIndex) => {
|
|
669
|
+
const context = {
|
|
670
|
+
element,
|
|
671
|
+
elementIndex: index,
|
|
672
|
+
contentIndex: contentIndex,
|
|
673
|
+
content: content,
|
|
674
|
+
preceedingContentParts: parts,
|
|
675
|
+
container: templateData.rowContainer,
|
|
676
|
+
editorPool: this._editorPool,
|
|
677
|
+
diffEditorPool: this._diffEditorPool,
|
|
678
|
+
codeBlockModelCollection: this.codeBlockModelCollection,
|
|
679
|
+
currentWidth: () => this._currentLayoutWidth,
|
|
680
|
+
get codeBlockStartIndex() {
|
|
681
|
+
return context.preceedingContentParts.reduce((acc, part) => acc + (part.codeblocks?.length ?? 0), 0);
|
|
682
|
+
},
|
|
683
|
+
};
|
|
684
|
+
const newPart = this.renderChatContentPart(data, templateData, context);
|
|
685
|
+
if (newPart) {
|
|
686
|
+
if (this.rendererOptions.renderDetectedCommandsWithRequest
|
|
687
|
+
&& !inlineSlashCommandRendered
|
|
688
|
+
&& element.agentOrSlashCommandDetected && element.slashCommand
|
|
689
|
+
&& data.kind === 'markdownContent'
|
|
690
|
+
) {
|
|
691
|
+
if (newPart.domNode) {
|
|
692
|
+
newPart.domNode.style.display = 'inline-flex';
|
|
693
|
+
}
|
|
694
|
+
const cmdPart = this.instantiationService.createInstance(ChatAgentCommandContentPart, element.slashCommand, () => this._onDidClickRerunWithAgentOrCommandDetection.fire({ sessionResource: element.sessionResource, requestId: element.id }));
|
|
695
|
+
templateData.value.appendChild(cmdPart.domNode);
|
|
696
|
+
parts.push(cmdPart);
|
|
697
|
+
inlineSlashCommandRendered = true;
|
|
698
|
+
}
|
|
699
|
+
if (newPart.domNode) {
|
|
700
|
+
templateData.value.appendChild(newPart.domNode);
|
|
701
|
+
}
|
|
702
|
+
parts.push(newPart);
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
if (templateData.renderedParts) {
|
|
706
|
+
dispose(templateData.renderedParts);
|
|
707
|
+
}
|
|
708
|
+
templateData.renderedParts = parts;
|
|
709
|
+
if (element.variables.length) {
|
|
710
|
+
const newPart = this.renderAttachments(element.variables, element.contentReferences, templateData);
|
|
711
|
+
if (newPart.domNode) {
|
|
712
|
+
templateData.value.appendChild(newPart.domNode);
|
|
713
|
+
}
|
|
714
|
+
templateData.elementDisposables.add(newPart);
|
|
715
|
+
}
|
|
716
|
+
this.updateItemHeightOnRender(element, templateData);
|
|
717
|
+
}
|
|
718
|
+
updateItemHeightOnRender(element, templateData) {
|
|
719
|
+
const newHeight = templateData.rowContainer.offsetHeight;
|
|
720
|
+
const fireEvent = !element.currentRenderedHeight || element.currentRenderedHeight !== newHeight;
|
|
721
|
+
element.currentRenderedHeight = newHeight;
|
|
722
|
+
if (fireEvent) {
|
|
723
|
+
const disposable = templateData.elementDisposables.add(scheduleAtNextAnimationFrame(getWindow(templateData.value), () => {
|
|
724
|
+
element.currentRenderedHeight = templateData.rowContainer.offsetHeight;
|
|
725
|
+
disposable.dispose();
|
|
726
|
+
this._onDidChangeItemHeight.fire({ element, height: element.currentRenderedHeight });
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
updateItemHeight(templateData) {
|
|
731
|
+
if (!templateData.currentElement) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
const newHeight = Math.max(templateData.rowContainer.offsetHeight, 1);
|
|
735
|
+
templateData.currentElement.currentRenderedHeight = newHeight;
|
|
736
|
+
this._onDidChangeItemHeight.fire({ element: templateData.currentElement, height: newHeight });
|
|
737
|
+
}
|
|
738
|
+
doNextProgressiveRender(element, index, templateData, isInRenderElement) {
|
|
739
|
+
if (!this._isVisible) {
|
|
740
|
+
return true;
|
|
741
|
+
}
|
|
742
|
+
if (element.isCanceled) {
|
|
743
|
+
this.traceLayout('doNextProgressiveRender', `canceled, index=${index}`);
|
|
744
|
+
element.renderData = undefined;
|
|
745
|
+
this.renderChatResponseBasic(element, index, templateData);
|
|
746
|
+
return true;
|
|
747
|
+
}
|
|
748
|
+
templateData.rowContainer.classList.toggle('chat-response-loading', true);
|
|
749
|
+
this.traceLayout('doNextProgressiveRender', `START progressive render, index=${index}, renderData=${JSON.stringify(element.renderData)}`);
|
|
750
|
+
const contentForThisTurn = this.getNextProgressiveRenderContent(element, templateData);
|
|
751
|
+
const partsToRender = this.diff(templateData.renderedParts ?? [], contentForThisTurn.content, element);
|
|
752
|
+
const contentIsAlreadyRendered = partsToRender.every(part => part === null);
|
|
753
|
+
if (contentIsAlreadyRendered) {
|
|
754
|
+
if (contentForThisTurn.moreContentAvailable) {
|
|
755
|
+
this.traceLayout('doNextProgressiveRender', 'not rendering any new content this tick, but more available');
|
|
756
|
+
return false;
|
|
757
|
+
}
|
|
758
|
+
else if (element.isComplete) {
|
|
759
|
+
this.traceLayout('doNextProgressiveRender', `END progressive render, index=${index} and clearing renderData, response is complete`);
|
|
760
|
+
element.renderData = undefined;
|
|
761
|
+
this.renderChatResponseBasic(element, index, templateData);
|
|
762
|
+
return true;
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
this.traceLayout('doNextProgressiveRender', 'caught up with the stream- no new content to render');
|
|
766
|
+
if (!templateData.renderedParts) {
|
|
767
|
+
const height = templateData.rowContainer.offsetHeight;
|
|
768
|
+
element.currentRenderedHeight = height;
|
|
769
|
+
}
|
|
770
|
+
return true;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
this.traceLayout('doNextProgressiveRender', `doing progressive render, ${partsToRender.length} parts to render`);
|
|
774
|
+
this.renderChatContentDiff(partsToRender, contentForThisTurn.content, element, index, templateData);
|
|
775
|
+
const height = templateData.rowContainer.offsetHeight;
|
|
776
|
+
element.currentRenderedHeight = height;
|
|
777
|
+
if (!isInRenderElement) {
|
|
778
|
+
this._onDidChangeItemHeight.fire({ element, height });
|
|
779
|
+
}
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
renderChatContentDiff(partsToRender, contentForThisTurn, element, elementIndex, templateData) {
|
|
783
|
+
const renderedParts = templateData.renderedParts ?? [];
|
|
784
|
+
templateData.renderedParts = renderedParts;
|
|
785
|
+
partsToRender.forEach((partToRender, contentIndex) => {
|
|
786
|
+
if (!partToRender) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
const alreadyRenderedPart = templateData.renderedParts?.[contentIndex];
|
|
790
|
+
if (alreadyRenderedPart) {
|
|
791
|
+
if (partToRender.kind === 'thinking' && alreadyRenderedPart instanceof ChatThinkingContentPart) {
|
|
792
|
+
if (!Array.isArray(partToRender.value)) {
|
|
793
|
+
alreadyRenderedPart.updateThinking(partToRender);
|
|
794
|
+
}
|
|
795
|
+
renderedParts[contentIndex] = alreadyRenderedPart;
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
else if (alreadyRenderedPart instanceof ChatThinkingContentPart && this.shouldPinPart(partToRender, element)) {
|
|
799
|
+
renderedParts[contentIndex] = alreadyRenderedPart;
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
alreadyRenderedPart.dispose();
|
|
803
|
+
}
|
|
804
|
+
const preceedingContentParts = renderedParts.slice(0, contentIndex);
|
|
805
|
+
const context = {
|
|
806
|
+
element,
|
|
807
|
+
elementIndex: elementIndex,
|
|
808
|
+
content: contentForThisTurn,
|
|
809
|
+
preceedingContentParts,
|
|
810
|
+
contentIndex: contentIndex,
|
|
811
|
+
container: templateData.rowContainer,
|
|
812
|
+
editorPool: this._editorPool,
|
|
813
|
+
diffEditorPool: this._diffEditorPool,
|
|
814
|
+
codeBlockModelCollection: this.codeBlockModelCollection,
|
|
815
|
+
currentWidth: () => this._currentLayoutWidth,
|
|
816
|
+
get codeBlockStartIndex() {
|
|
817
|
+
return context.preceedingContentParts.reduce((acc, part) => acc + (part.codeblocks?.length ?? 0), 0);
|
|
818
|
+
},
|
|
819
|
+
};
|
|
820
|
+
const lastThinking = this.getLastThinkingPart(renderedParts);
|
|
821
|
+
if (lastThinking && (partToRender.kind === 'toolInvocation' || partToRender.kind === 'toolInvocationSerialized') && this.shouldPinPart(partToRender, element)) {
|
|
822
|
+
const newPart = this.renderChatContentPart(partToRender, templateData, context);
|
|
823
|
+
if (newPart) {
|
|
824
|
+
renderedParts[contentIndex] = newPart;
|
|
825
|
+
if (alreadyRenderedPart instanceof ChatWorkingProgressContentPart && alreadyRenderedPart?.domNode) {
|
|
826
|
+
alreadyRenderedPart.domNode.remove();
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
const newPart = this.renderChatContentPart(partToRender, templateData, context);
|
|
832
|
+
if (newPart) {
|
|
833
|
+
renderedParts[contentIndex] = newPart;
|
|
834
|
+
try {
|
|
835
|
+
if (alreadyRenderedPart?.domNode) {
|
|
836
|
+
if (newPart.domNode) {
|
|
837
|
+
alreadyRenderedPart.domNode.replaceWith(newPart.domNode);
|
|
838
|
+
}
|
|
839
|
+
else {
|
|
840
|
+
alreadyRenderedPart.domNode.remove();
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
else if (newPart.domNode && !newPart.domNode.parentElement) {
|
|
844
|
+
templateData.value.appendChild(newPart.domNode);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
catch (err) {
|
|
848
|
+
this.logService.error('ChatListItemRenderer#renderChatContentDiff: error replacing part', err);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
alreadyRenderedPart?.domNode?.remove();
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
for (let i = partsToRender.length; i < renderedParts.length; i++) {
|
|
856
|
+
const part = renderedParts[i];
|
|
857
|
+
if (part) {
|
|
858
|
+
part.dispose();
|
|
859
|
+
part.domNode?.remove();
|
|
860
|
+
delete renderedParts[i];
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
getNextProgressiveRenderContent(element, templateData) {
|
|
865
|
+
const data = this.getDataForProgressiveRender(element);
|
|
866
|
+
const renderImmediately = this.configService.getValue('chat.experimental.renderMarkdownImmediately') === true;
|
|
867
|
+
const renderableResponse = annotateSpecialMarkdownContent(element.response.value);
|
|
868
|
+
this.traceLayout('getNextProgressiveRenderContent', `Want to render ${data.numWordsToRender} at ${data.rate} words/s, counting...`);
|
|
869
|
+
let numNeededWords = data.numWordsToRender;
|
|
870
|
+
const partsToRender = [];
|
|
871
|
+
partsToRender.push({ kind: 'references', references: element.contentReferences });
|
|
872
|
+
let moreContentAvailable = false;
|
|
873
|
+
for (let i = 0; i < renderableResponse.length; i++) {
|
|
874
|
+
const part = renderableResponse[i];
|
|
875
|
+
if (part.kind === 'markdownContent' && !renderImmediately) {
|
|
876
|
+
const wordCountResult = getNWords(part.content.value, numNeededWords);
|
|
877
|
+
this.traceLayout('getNextProgressiveRenderContent', ` Chunk ${i}: Want to render ${numNeededWords} words and found ${wordCountResult.returnedWordCount} words. Total words in chunk: ${wordCountResult.totalWordCount}`);
|
|
878
|
+
numNeededWords -= wordCountResult.returnedWordCount;
|
|
879
|
+
if (wordCountResult.isFullString) {
|
|
880
|
+
partsToRender.push(part);
|
|
881
|
+
for (const nextPart of renderableResponse.slice(i + 1)) {
|
|
882
|
+
if (nextPart.kind !== 'markdownContent') {
|
|
883
|
+
i++;
|
|
884
|
+
partsToRender.push(nextPart);
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
break;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
else {
|
|
892
|
+
moreContentAvailable = true;
|
|
893
|
+
partsToRender.push({ ...part, content: ( new MarkdownString(wordCountResult.value, part.content)) });
|
|
894
|
+
}
|
|
895
|
+
if (numNeededWords <= 0) {
|
|
896
|
+
if (( renderableResponse.slice(i + 1).some(part => part.kind === 'markdownContent'))) {
|
|
897
|
+
moreContentAvailable = true;
|
|
898
|
+
}
|
|
899
|
+
break;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
partsToRender.push(part);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
const lastWordCount = element.contentUpdateTimings?.lastWordCount ?? 0;
|
|
907
|
+
const newRenderedWordCount = data.numWordsToRender - numNeededWords;
|
|
908
|
+
const bufferWords = lastWordCount - newRenderedWordCount;
|
|
909
|
+
this.traceLayout('getNextProgressiveRenderContent', `Want to render ${data.numWordsToRender} words. Rendering ${newRenderedWordCount} words. Buffer: ${bufferWords} words`);
|
|
910
|
+
if (newRenderedWordCount > 0 && newRenderedWordCount !== element.renderData?.renderedWordCount) {
|
|
911
|
+
element.renderData = { lastRenderTime: Date.now(), renderedWordCount: newRenderedWordCount, renderedParts: partsToRender };
|
|
912
|
+
}
|
|
913
|
+
if (this.shouldShowWorkingProgress(element, partsToRender, templateData)) {
|
|
914
|
+
partsToRender.push({ kind: 'working' });
|
|
915
|
+
}
|
|
916
|
+
const fileChangesSummaryPart = this.getChatFileChangesSummaryPart(element);
|
|
917
|
+
if (fileChangesSummaryPart) {
|
|
918
|
+
partsToRender.push(fileChangesSummaryPart);
|
|
919
|
+
}
|
|
920
|
+
return { content: partsToRender, moreContentAvailable };
|
|
921
|
+
}
|
|
922
|
+
shouldShowFileChangesSummary(element) {
|
|
923
|
+
const isLocalSession = getChatSessionType(element.sessionResource) === localChatSessionType;
|
|
924
|
+
return element.isComplete && isLocalSession && this.configService.getValue('chat.checkpoints.showFileChanges');
|
|
925
|
+
}
|
|
926
|
+
getDataForProgressiveRender(element) {
|
|
927
|
+
const hasMarkdownParts = ( element.response.value.some(
|
|
928
|
+
part => part.kind === 'markdownContent' && part.content.value.trim().length > 0
|
|
929
|
+
));
|
|
930
|
+
if (!element.isComplete && hasMarkdownParts && (element.contentUpdateTimings ? element.contentUpdateTimings.lastWordCount : 0) === 0) {
|
|
931
|
+
return {
|
|
932
|
+
numWordsToRender: Number.MAX_SAFE_INTEGER,
|
|
933
|
+
rate: Number.MAX_SAFE_INTEGER
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
const renderData = element.renderData ?? { lastRenderTime: 0, renderedWordCount: 0 };
|
|
937
|
+
const rate = this.getProgressiveRenderRate(element);
|
|
938
|
+
const numWordsToRender = renderData.lastRenderTime === 0 ?
|
|
939
|
+
1 :
|
|
940
|
+
renderData.renderedWordCount +
|
|
941
|
+
Math.floor((Date.now() - renderData.lastRenderTime) / 1000 * rate);
|
|
942
|
+
return {
|
|
943
|
+
numWordsToRender,
|
|
944
|
+
rate
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
diff(renderedParts, contentToRender, element) {
|
|
948
|
+
const diff = [];
|
|
949
|
+
for (let i = 0; i < contentToRender.length; i++) {
|
|
950
|
+
const content = contentToRender[i];
|
|
951
|
+
const renderedPart = renderedParts[i];
|
|
952
|
+
if (!renderedPart || !renderedPart.hasSameContent(content, contentToRender.slice(i + 1), element)) {
|
|
953
|
+
diff.push(content);
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
diff.push(null);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
return diff;
|
|
960
|
+
}
|
|
961
|
+
shouldPinPart(part, element) {
|
|
962
|
+
const collapsedToolsMode = this.configService.getValue('chat.agent.thinking.collapsedTools');
|
|
963
|
+
if (collapsedToolsMode === CollapsedToolsDisplayMode.Off) {
|
|
964
|
+
return false;
|
|
965
|
+
}
|
|
966
|
+
const isMcpTool = (part.kind === 'toolInvocation' || part.kind === 'toolInvocationSerialized') && part.source.type === 'mcp';
|
|
967
|
+
if (isMcpTool) {
|
|
968
|
+
return false;
|
|
969
|
+
}
|
|
970
|
+
const isSubagentTool = (part.kind === 'toolInvocation' || part.kind === 'toolInvocationSerialized') && (part.fromSubAgent || part.toolId === 'runSubagent');
|
|
971
|
+
if (isSubagentTool) {
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
974
|
+
const isTerminalTool = (part.kind === 'toolInvocation' || part.kind === 'toolInvocationSerialized') && part.toolSpecificData?.kind === 'terminal';
|
|
975
|
+
const isContributedTerminalToolInvocation = element
|
|
976
|
+
&& (element.sessionResource.scheme !== Schemas.vscodeChatInput && element.sessionResource.scheme !== Schemas.vscodeLocalChatSession)
|
|
977
|
+
&& part.kind === 'toolInvocationSerialized' && part.toolSpecificData?.kind === 'terminal';
|
|
978
|
+
if (isTerminalTool && !isContributedTerminalToolInvocation) {
|
|
979
|
+
return false;
|
|
980
|
+
}
|
|
981
|
+
if (part.kind === 'toolInvocation') {
|
|
982
|
+
return !part.confirmationMessages;
|
|
983
|
+
}
|
|
984
|
+
if (part.kind === 'toolInvocationSerialized') {
|
|
985
|
+
return true;
|
|
986
|
+
}
|
|
987
|
+
return part.kind === 'prepareToolInvocation';
|
|
988
|
+
}
|
|
989
|
+
isCreateToolInvocationContent(content) {
|
|
990
|
+
if (!content || (content.kind !== 'toolInvocation' && content.kind !== 'toolInvocationSerialized')) {
|
|
991
|
+
return false;
|
|
992
|
+
}
|
|
993
|
+
const containsCreate = (value) => {
|
|
994
|
+
if (!value) {
|
|
995
|
+
return false;
|
|
996
|
+
}
|
|
997
|
+
const text = typeof value === 'string' ? value : value.value;
|
|
998
|
+
return text.toLowerCase().includes('create');
|
|
999
|
+
};
|
|
1000
|
+
if (containsCreate(content.invocationMessage) || containsCreate(content.pastTenseMessage)) {
|
|
1001
|
+
return true;
|
|
1002
|
+
}
|
|
1003
|
+
return content.toolId.toLowerCase().includes('create');
|
|
1004
|
+
}
|
|
1005
|
+
getLastThinkingPart(renderedParts) {
|
|
1006
|
+
if (!renderedParts || renderedParts.length === 0) {
|
|
1007
|
+
return undefined;
|
|
1008
|
+
}
|
|
1009
|
+
for (let i = renderedParts.length - 1; i >= 0; i--) {
|
|
1010
|
+
const part = renderedParts[i];
|
|
1011
|
+
if (part instanceof ChatThinkingContentPart && part.getIsActive()) {
|
|
1012
|
+
return part;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
return undefined;
|
|
1016
|
+
}
|
|
1017
|
+
finalizeCurrentThinkingPart(context, templateData) {
|
|
1018
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
1019
|
+
if (!lastThinking) {
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
const style = this.configService.getValue('chat.agent.thinkingStyle');
|
|
1023
|
+
if (style === ThinkingDisplayMode.CollapsedPreview) {
|
|
1024
|
+
lastThinking.collapseContent();
|
|
1025
|
+
}
|
|
1026
|
+
lastThinking.finalizeTitleIfDefault();
|
|
1027
|
+
lastThinking.resetId();
|
|
1028
|
+
lastThinking.markAsInactive();
|
|
1029
|
+
}
|
|
1030
|
+
renderChatContentPart(content, templateData, context) {
|
|
1031
|
+
try {
|
|
1032
|
+
const collapsedToolsMode = this.configService.getValue('chat.agent.thinking.collapsedTools');
|
|
1033
|
+
if (content.kind === 'thinking' && (Array.isArray(content.value) ? content.value.length === 0 : !content.value)) {
|
|
1034
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
1035
|
+
lastThinking?.resetId();
|
|
1036
|
+
return this.renderNoContent(other => content.kind === other.kind);
|
|
1037
|
+
}
|
|
1038
|
+
const lastRenderedPart = context.preceedingContentParts.length ? context.preceedingContentParts[context.preceedingContentParts.length - 1] : undefined;
|
|
1039
|
+
const previousContent = context.contentIndex > 0 ? context.content[context.contentIndex - 1] : undefined;
|
|
1040
|
+
const shouldKeepThinkingForCreateTool = collapsedToolsMode !== CollapsedToolsDisplayMode.Off && lastRenderedPart instanceof ChatToolInvocationPart && this.isCreateToolInvocationContent(previousContent);
|
|
1041
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
1042
|
+
const isResponseElement = isResponseVM(context.element);
|
|
1043
|
+
const isThinkingContent = content.kind === 'working' || content.kind === 'thinking';
|
|
1044
|
+
const isToolStreamingContent = isResponseElement && this.shouldPinPart(content, isResponseElement ? context.element : undefined);
|
|
1045
|
+
if (!shouldKeepThinkingForCreateTool && lastThinking && lastThinking.getIsActive()) {
|
|
1046
|
+
if (!isThinkingContent && !isToolStreamingContent) {
|
|
1047
|
+
const followsThinkingPart = previousContent?.kind === 'thinking' || previousContent?.kind === 'toolInvocation' || previousContent?.kind === 'prepareToolInvocation' || previousContent?.kind === 'toolInvocationSerialized';
|
|
1048
|
+
if (content.kind !== 'textEditGroup' && (context.element.isComplete || followsThinkingPart)) {
|
|
1049
|
+
this.finalizeCurrentThinkingPart(context, templateData);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
if (context.element.isComplete && !isThinkingContent && !this.shouldPinPart(content, isResponseElement ? context.element : undefined)) {
|
|
1054
|
+
for (const templateData of ( this.templateDataByRequestId.values())) {
|
|
1055
|
+
if (templateData.renderedParts) {
|
|
1056
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
1057
|
+
if (content.kind !== 'textEditGroup' && lastThinking?.getIsActive()) {
|
|
1058
|
+
this.finalizeCurrentThinkingPart(context, templateData);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
if (content.kind === 'treeData') {
|
|
1064
|
+
return this.renderTreeData(content, templateData, context);
|
|
1065
|
+
}
|
|
1066
|
+
else if (content.kind === 'multiDiffData') {
|
|
1067
|
+
return this.renderMultiDiffData(content, templateData, context);
|
|
1068
|
+
}
|
|
1069
|
+
else if (content.kind === 'progressMessage') {
|
|
1070
|
+
return this.instantiationService.createInstance(ChatProgressContentPart, content, this.chatContentMarkdownRenderer, context, undefined, undefined, undefined, undefined);
|
|
1071
|
+
}
|
|
1072
|
+
else if (content.kind === 'working') {
|
|
1073
|
+
return this.instantiationService.createInstance(ChatWorkingProgressContentPart, content, this.chatContentMarkdownRenderer, context);
|
|
1074
|
+
}
|
|
1075
|
+
else if (content.kind === 'progressTask' || content.kind === 'progressTaskSerialized') {
|
|
1076
|
+
return this.renderProgressTask(content, templateData, context);
|
|
1077
|
+
}
|
|
1078
|
+
else if (content.kind === 'command') {
|
|
1079
|
+
return this.instantiationService.createInstance(ChatCommandButtonContentPart, content, context);
|
|
1080
|
+
}
|
|
1081
|
+
else if (content.kind === 'textEditGroup') {
|
|
1082
|
+
return this.renderTextEdit(context, content, templateData);
|
|
1083
|
+
}
|
|
1084
|
+
else if (content.kind === 'confirmation') {
|
|
1085
|
+
return this.renderConfirmation(context, content, templateData);
|
|
1086
|
+
}
|
|
1087
|
+
else if (content.kind === 'warning') {
|
|
1088
|
+
return this.instantiationService.createInstance(ChatErrorContentPart, ChatErrorLevel.Warning, content.content, content, this.chatContentMarkdownRenderer);
|
|
1089
|
+
}
|
|
1090
|
+
else if (content.kind === 'markdownContent') {
|
|
1091
|
+
return this.renderMarkdown(content, templateData, context);
|
|
1092
|
+
}
|
|
1093
|
+
else if (content.kind === 'references') {
|
|
1094
|
+
return this.renderContentReferencesListData(content, undefined, context, templateData);
|
|
1095
|
+
}
|
|
1096
|
+
else if (content.kind === 'codeCitations') {
|
|
1097
|
+
return this.renderCodeCitations(content, context, templateData);
|
|
1098
|
+
}
|
|
1099
|
+
else if (content.kind === 'toolInvocation' || content.kind === 'toolInvocationSerialized') {
|
|
1100
|
+
return this.renderToolInvocation(content, context, templateData);
|
|
1101
|
+
}
|
|
1102
|
+
else if (content.kind === 'extensions') {
|
|
1103
|
+
return this.renderExtensionsContent(content, context, templateData);
|
|
1104
|
+
}
|
|
1105
|
+
else if (content.kind === 'pullRequest') {
|
|
1106
|
+
return this.renderPullRequestContent(content, context, templateData);
|
|
1107
|
+
}
|
|
1108
|
+
else if (content.kind === 'undoStop') {
|
|
1109
|
+
return this.renderUndoStop(content);
|
|
1110
|
+
}
|
|
1111
|
+
else if (content.kind === 'errorDetails') {
|
|
1112
|
+
return this.renderChatErrorDetails(context, content, templateData);
|
|
1113
|
+
}
|
|
1114
|
+
else if (content.kind === 'elicitation2' || content.kind === 'elicitationSerialized') {
|
|
1115
|
+
return this.renderElicitation(context, content, templateData);
|
|
1116
|
+
}
|
|
1117
|
+
else if (content.kind === 'changesSummary') {
|
|
1118
|
+
return this.renderChangesSummary(content, context, templateData);
|
|
1119
|
+
}
|
|
1120
|
+
else if (content.kind === 'mcpServersStarting') {
|
|
1121
|
+
return this.renderMcpServersInteractionRequired(content, context, templateData);
|
|
1122
|
+
}
|
|
1123
|
+
else if (content.kind === 'thinking') {
|
|
1124
|
+
return this.renderThinkingPart(content, context, templateData);
|
|
1125
|
+
}
|
|
1126
|
+
return this.renderNoContent(other => content.kind === other.kind);
|
|
1127
|
+
}
|
|
1128
|
+
catch (err) {
|
|
1129
|
+
alert(`Chat error: ${toErrorMessage(err, false)}`);
|
|
1130
|
+
this.logService.error('ChatListItemRenderer#renderChatContentPart: error rendering content', toErrorMessage(err, true));
|
|
1131
|
+
const errorPart = this.instantiationService.createInstance(ChatErrorContentPart, ChatErrorLevel.Error, ( new MarkdownString(( localize(5331, "Failed to render content")) + `: ${toErrorMessage(err, false)}`)), content, this.chatContentMarkdownRenderer);
|
|
1132
|
+
return {
|
|
1133
|
+
dispose: () => errorPart.dispose(),
|
|
1134
|
+
domNode: errorPart.domNode,
|
|
1135
|
+
hasSameContent: (other => content.kind === other.kind),
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
dispose() {
|
|
1140
|
+
this._announcedToolProgressKeys.clear();
|
|
1141
|
+
super.dispose();
|
|
1142
|
+
}
|
|
1143
|
+
renderChatErrorDetails(context, content, templateData) {
|
|
1144
|
+
if (!isResponseVM(context.element)) {
|
|
1145
|
+
return this.renderNoContent(other => content.kind === other.kind);
|
|
1146
|
+
}
|
|
1147
|
+
const isLast = context.elementIndex === this.delegate.getListLength() - 1;
|
|
1148
|
+
if (content.errorDetails.isQuotaExceeded) {
|
|
1149
|
+
const renderedError = this.instantiationService.createInstance(ChatQuotaExceededPart, context.element, content, this.chatContentMarkdownRenderer);
|
|
1150
|
+
renderedError.addDisposable(renderedError.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1151
|
+
return renderedError;
|
|
1152
|
+
}
|
|
1153
|
+
else if (content.errorDetails.isRateLimited && this.chatEntitlementService.anonymous) {
|
|
1154
|
+
const renderedError = this.instantiationService.createInstance(ChatAnonymousRateLimitedPart, content);
|
|
1155
|
+
return renderedError;
|
|
1156
|
+
}
|
|
1157
|
+
else if (content.errorDetails.confirmationButtons && isLast) {
|
|
1158
|
+
const level = content.errorDetails.level ?? ChatErrorLevel.Error;
|
|
1159
|
+
const errorConfirmation = this.instantiationService.createInstance(ChatErrorConfirmationContentPart, level, ( new MarkdownString(content.errorDetails.message)), content, content.errorDetails.confirmationButtons, this.chatContentMarkdownRenderer, context);
|
|
1160
|
+
errorConfirmation.addDisposable(errorConfirmation.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1161
|
+
return errorConfirmation;
|
|
1162
|
+
}
|
|
1163
|
+
else {
|
|
1164
|
+
const level = content.errorDetails.level ?? ChatErrorLevel.Error;
|
|
1165
|
+
return this.instantiationService.createInstance(ChatErrorContentPart, level, ( new MarkdownString(content.errorDetails.message)), content, this.chatContentMarkdownRenderer);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
renderUndoStop(content) {
|
|
1169
|
+
return this.renderNoContent(other => other.kind === content.kind && other.id === content.id);
|
|
1170
|
+
}
|
|
1171
|
+
renderNoContent(equals) {
|
|
1172
|
+
return {
|
|
1173
|
+
dispose: () => { },
|
|
1174
|
+
domNode: undefined,
|
|
1175
|
+
hasSameContent: equals,
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
renderTreeData(content, templateData, context) {
|
|
1179
|
+
const data = content.treeData;
|
|
1180
|
+
const treeDataIndex = context.preceedingContentParts.filter(part => part instanceof ChatTreeContentPart).length;
|
|
1181
|
+
const treePart = this.instantiationService.createInstance(ChatTreeContentPart, data, context.element, this._treePool, treeDataIndex);
|
|
1182
|
+
treePart.addDisposable(treePart.onDidChangeHeight(() => {
|
|
1183
|
+
this.updateItemHeight(templateData);
|
|
1184
|
+
}));
|
|
1185
|
+
if (isResponseVM(context.element)) {
|
|
1186
|
+
const fileTreeFocusInfo = {
|
|
1187
|
+
treeDataId: ( data.uri.toString()),
|
|
1188
|
+
treeIndex: treeDataIndex,
|
|
1189
|
+
focus() {
|
|
1190
|
+
treePart.domFocus();
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
treePart.addDisposable(treePart.onDidFocus(() => {
|
|
1194
|
+
this.focusedFileTreesByResponseId.set(context.element.id, fileTreeFocusInfo.treeIndex);
|
|
1195
|
+
}));
|
|
1196
|
+
const fileTrees = this.fileTreesByResponseId.get(context.element.id) ?? [];
|
|
1197
|
+
fileTrees.push(fileTreeFocusInfo);
|
|
1198
|
+
this.fileTreesByResponseId.set(context.element.id, distinct(fileTrees, (v) => v.treeDataId));
|
|
1199
|
+
treePart.addDisposable(toDisposable(() => this.fileTreesByResponseId.set(context.element.id, fileTrees.filter(v => v.treeDataId !== ( data.uri.toString())))));
|
|
1200
|
+
}
|
|
1201
|
+
return treePart;
|
|
1202
|
+
}
|
|
1203
|
+
renderMultiDiffData(content, templateData, context) {
|
|
1204
|
+
const multiDiffPart = this.instantiationService.createInstance(ChatMultiDiffContentPart, content, context.element);
|
|
1205
|
+
multiDiffPart.addDisposable(multiDiffPart.onDidChangeHeight(() => {
|
|
1206
|
+
this.updateItemHeight(templateData);
|
|
1207
|
+
}));
|
|
1208
|
+
return multiDiffPart;
|
|
1209
|
+
}
|
|
1210
|
+
renderContentReferencesListData(references, labelOverride, context, templateData) {
|
|
1211
|
+
const referencesPart = this.instantiationService.createInstance(ChatUsedReferencesListContentPart, references.references, labelOverride, context, this._contentReferencesListPool, { expandedWhenEmptyResponse: checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.referencesExpandedWhenEmptyResponse) });
|
|
1212
|
+
referencesPart.addDisposable(referencesPart.onDidChangeHeight(() => {
|
|
1213
|
+
this.updateItemHeight(templateData);
|
|
1214
|
+
}));
|
|
1215
|
+
return referencesPart;
|
|
1216
|
+
}
|
|
1217
|
+
renderCodeCitations(citations, context, templateData) {
|
|
1218
|
+
const citationsPart = this.instantiationService.createInstance(ChatCodeCitationContentPart, citations, context);
|
|
1219
|
+
return citationsPart;
|
|
1220
|
+
}
|
|
1221
|
+
handleRenderedCodeblocks(element, part, codeBlockStartIndex) {
|
|
1222
|
+
if (!part.addDisposable || part.codeblocksPartId === undefined) {
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
const codeBlocksByResponseId = this.codeBlocksByResponseId.get(element.id) ?? [];
|
|
1226
|
+
this.codeBlocksByResponseId.set(element.id, codeBlocksByResponseId);
|
|
1227
|
+
part.addDisposable(toDisposable(() => {
|
|
1228
|
+
const codeBlocksByResponseId = this.codeBlocksByResponseId.get(element.id);
|
|
1229
|
+
if (codeBlocksByResponseId) {
|
|
1230
|
+
part.codeblocks?.forEach((info, i) => {
|
|
1231
|
+
const codeblock = codeBlocksByResponseId[codeBlockStartIndex + i];
|
|
1232
|
+
if (codeblock?.ownerMarkdownPartId === part.codeblocksPartId) {
|
|
1233
|
+
delete codeBlocksByResponseId[codeBlockStartIndex + i];
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
}));
|
|
1238
|
+
part.codeblocks?.forEach((info, i) => {
|
|
1239
|
+
codeBlocksByResponseId[codeBlockStartIndex + i] = info;
|
|
1240
|
+
part.addDisposable(thenIfNotDisposed(info.uriPromise, uri => {
|
|
1241
|
+
if (!uri) {
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
this.codeBlocksByEditorUri.set(uri, info);
|
|
1245
|
+
part.addDisposable(toDisposable(() => {
|
|
1246
|
+
const codeblock = this.codeBlocksByEditorUri.get(uri);
|
|
1247
|
+
if (codeblock?.ownerMarkdownPartId === part.codeblocksPartId) {
|
|
1248
|
+
this.codeBlocksByEditorUri.delete(uri);
|
|
1249
|
+
}
|
|
1250
|
+
}));
|
|
1251
|
+
}));
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
renderToolInvocation(toolInvocation, context, templateData) {
|
|
1255
|
+
const codeBlockStartIndex = context.codeBlockStartIndex;
|
|
1256
|
+
const part = this.instantiationService.createInstance(ChatToolInvocationPart, toolInvocation, context, this.chatContentMarkdownRenderer, this._contentReferencesListPool, this._toolEditorPool, () => this._currentLayoutWidth, this._toolInvocationCodeBlockCollection, this._announcedToolProgressKeys, codeBlockStartIndex);
|
|
1257
|
+
part.addDisposable(part.onDidChangeHeight(() => {
|
|
1258
|
+
this.updateItemHeight(templateData);
|
|
1259
|
+
}));
|
|
1260
|
+
this.handleRenderedCodeblocks(context.element, part, codeBlockStartIndex);
|
|
1261
|
+
const collapsedToolsMode = this.configService.getValue('chat.agent.thinking.collapsedTools');
|
|
1262
|
+
if (isResponseVM(context.element) && collapsedToolsMode !== CollapsedToolsDisplayMode.Off) {
|
|
1263
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
1264
|
+
if (!lastThinking && part?.domNode && toolInvocation.presentation !== 'hidden' && this.shouldPinPart(toolInvocation, context.element) && collapsedToolsMode === CollapsedToolsDisplayMode.Always) {
|
|
1265
|
+
const thinkingPart = this.renderThinkingPart({
|
|
1266
|
+
kind: 'thinking',
|
|
1267
|
+
}, context, templateData);
|
|
1268
|
+
if (thinkingPart instanceof ChatThinkingContentPart) {
|
|
1269
|
+
thinkingPart.appendItem(part?.domNode, toolInvocation.toolId, toolInvocation);
|
|
1270
|
+
thinkingPart.addDisposable(part);
|
|
1271
|
+
thinkingPart.addDisposable(thinkingPart.onDidChangeHeight(() => {
|
|
1272
|
+
this.updateItemHeight(templateData);
|
|
1273
|
+
}));
|
|
1274
|
+
}
|
|
1275
|
+
return thinkingPart;
|
|
1276
|
+
}
|
|
1277
|
+
if (this.shouldPinPart(toolInvocation, context.element)) {
|
|
1278
|
+
if (lastThinking && part?.domNode && toolInvocation.presentation !== 'hidden') {
|
|
1279
|
+
lastThinking.appendItem(part?.domNode, toolInvocation.toolId, toolInvocation);
|
|
1280
|
+
lastThinking.addDisposable(part);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
else {
|
|
1284
|
+
this.finalizeCurrentThinkingPart(context, templateData);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return part;
|
|
1288
|
+
}
|
|
1289
|
+
renderExtensionsContent(extensionsContent, context, templateData) {
|
|
1290
|
+
const part = this.instantiationService.createInstance(ChatExtensionsContentPart, extensionsContent);
|
|
1291
|
+
part.addDisposable(part.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1292
|
+
return part;
|
|
1293
|
+
}
|
|
1294
|
+
renderPullRequestContent(pullRequestContent, context, templateData) {
|
|
1295
|
+
const part = this.instantiationService.createInstance(ChatPullRequestContentPart, pullRequestContent);
|
|
1296
|
+
part.addDisposable(part.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1297
|
+
return part;
|
|
1298
|
+
}
|
|
1299
|
+
renderProgressTask(task, templateData, context) {
|
|
1300
|
+
if (!isResponseVM(context.element)) {
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
const taskPart = this.instantiationService.createInstance(ChatTaskContentPart, task, this._contentReferencesListPool, this.chatContentMarkdownRenderer, context);
|
|
1304
|
+
taskPart.addDisposable(taskPart.onDidChangeHeight(() => {
|
|
1305
|
+
this.updateItemHeight(templateData);
|
|
1306
|
+
}));
|
|
1307
|
+
return taskPart;
|
|
1308
|
+
}
|
|
1309
|
+
renderConfirmation(context, confirmation, templateData) {
|
|
1310
|
+
const part = this.instantiationService.createInstance(ChatConfirmationContentPart, confirmation, context);
|
|
1311
|
+
part.addDisposable(part.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1312
|
+
return part;
|
|
1313
|
+
}
|
|
1314
|
+
renderElicitation(context, elicitation, templateData) {
|
|
1315
|
+
if (elicitation.kind === 'elicitationSerialized' ? elicitation.isHidden : elicitation.isHidden?.get()) {
|
|
1316
|
+
return this.renderNoContent(other => elicitation.kind === other.kind);
|
|
1317
|
+
}
|
|
1318
|
+
const part = this.instantiationService.createInstance(ChatElicitationContentPart, elicitation, context);
|
|
1319
|
+
part.addDisposable(part.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1320
|
+
return part;
|
|
1321
|
+
}
|
|
1322
|
+
renderChangesSummary(content, context, templateData) {
|
|
1323
|
+
const part = this.instantiationService.createInstance(ChatCheckpointFileChangesSummaryContentPart, content, context);
|
|
1324
|
+
part.addDisposable(part.onDidChangeHeight(() => { this.updateItemHeight(templateData); }));
|
|
1325
|
+
return part;
|
|
1326
|
+
}
|
|
1327
|
+
renderAttachments(variables, contentReferences, templateData) {
|
|
1328
|
+
return this.instantiationService.createInstance(ChatAttachmentsContentPart, {
|
|
1329
|
+
variables,
|
|
1330
|
+
contentReferences,
|
|
1331
|
+
domNode: undefined
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
renderTextEdit(context, chatTextEdit, templateData) {
|
|
1335
|
+
const textEditPart = this.instantiationService.createInstance(ChatTextEditContentPart, chatTextEdit, context, this.rendererOptions, this._diffEditorPool, this._currentLayoutWidth);
|
|
1336
|
+
textEditPart.addDisposable(textEditPart.onDidChangeHeight(() => {
|
|
1337
|
+
textEditPart.layout(this._currentLayoutWidth);
|
|
1338
|
+
this.updateItemHeight(templateData);
|
|
1339
|
+
}));
|
|
1340
|
+
return textEditPart;
|
|
1341
|
+
}
|
|
1342
|
+
renderMarkdown(markdown, templateData, context) {
|
|
1343
|
+
this.finalizeCurrentThinkingPart(context, templateData);
|
|
1344
|
+
const element = context.element;
|
|
1345
|
+
const fillInIncompleteTokens = isResponseVM(element) && (!element.isComplete || element.isCanceled || element.errorDetails?.responseIsFiltered || element.errorDetails?.responseIsIncomplete || !!element.renderData);
|
|
1346
|
+
const codeBlockStartIndex = context.codeBlockStartIndex;
|
|
1347
|
+
const markdownPart = templateData.instantiationService.createInstance(ChatMarkdownContentPart, markdown, context, this._editorPool, fillInIncompleteTokens, codeBlockStartIndex, this.chatContentMarkdownRenderer, undefined, this._currentLayoutWidth, this.codeBlockModelCollection, {});
|
|
1348
|
+
if (isRequestVM(element)) {
|
|
1349
|
+
markdownPart.domNode.tabIndex = 0;
|
|
1350
|
+
if (this.configService.getValue('chat.editRequests') === 'inline' && this.rendererOptions.editable) {
|
|
1351
|
+
markdownPart.domNode.classList.add('clickable');
|
|
1352
|
+
markdownPart.addDisposable(addDisposableListener(markdownPart.domNode, EventType.CLICK, (e) => {
|
|
1353
|
+
if (this.viewModel?.editing?.id === element.id) {
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
const clickedElement = e.target;
|
|
1357
|
+
if (clickedElement.tagName === 'A') {
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
const selection = getWindow(templateData.rowContainer).getSelection();
|
|
1361
|
+
if (selection && !selection.isCollapsed && ( selection.toString()).length > 0) {
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
const monacoEditor = findParentWithClass(clickedElement, 'monaco-editor');
|
|
1365
|
+
if (monacoEditor) {
|
|
1366
|
+
const editorPart = Array.from(this.editorsInUse()).find(editor => editor.element.contains(monacoEditor));
|
|
1367
|
+
if (editorPart?.editor.getSelection()?.isEmpty() === false) {
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
e.preventDefault();
|
|
1372
|
+
e.stopPropagation();
|
|
1373
|
+
this._onDidClickRequest.fire(templateData);
|
|
1374
|
+
}));
|
|
1375
|
+
this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), markdownPart.domNode, ( localize(5332, "Click to Edit")), { trapFocus: true }));
|
|
1376
|
+
}
|
|
1377
|
+
markdownPart.addDisposable(addDisposableListener(markdownPart.domNode, EventType.FOCUS, () => {
|
|
1378
|
+
this.hoverVisible(templateData.requestHover);
|
|
1379
|
+
}));
|
|
1380
|
+
markdownPart.addDisposable(addDisposableListener(markdownPart.domNode, EventType.BLUR, () => {
|
|
1381
|
+
this.hoverHidden(templateData.requestHover);
|
|
1382
|
+
}));
|
|
1383
|
+
}
|
|
1384
|
+
markdownPart.addDisposable(markdownPart.onDidChangeHeight(() => {
|
|
1385
|
+
markdownPart.layout(this._currentLayoutWidth);
|
|
1386
|
+
this.updateItemHeight(templateData);
|
|
1387
|
+
}));
|
|
1388
|
+
this.handleRenderedCodeblocks(element, markdownPart, codeBlockStartIndex);
|
|
1389
|
+
return markdownPart;
|
|
1390
|
+
}
|
|
1391
|
+
renderThinkingPart(content, context, templateData) {
|
|
1392
|
+
if (!content.id) {
|
|
1393
|
+
content.id = ( Date.now().toString());
|
|
1394
|
+
}
|
|
1395
|
+
if (Array.isArray(content.value)) {
|
|
1396
|
+
if (content.value.length < 1) {
|
|
1397
|
+
const lastThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
1398
|
+
lastThinking?.finalizeTitleIfDefault();
|
|
1399
|
+
return this.renderNoContent(other => content.kind === other.kind);
|
|
1400
|
+
}
|
|
1401
|
+
let lastPart;
|
|
1402
|
+
for (const item of content.value) {
|
|
1403
|
+
if (item) {
|
|
1404
|
+
const lastThinkingPart = lastPart instanceof ChatThinkingContentPart && lastPart.getIsActive() ? lastPart : undefined;
|
|
1405
|
+
if (lastThinkingPart) {
|
|
1406
|
+
lastThinkingPart.setupThinkingContainer({ ...content, value: item }, context);
|
|
1407
|
+
}
|
|
1408
|
+
else {
|
|
1409
|
+
const itemContent = { ...content, value: item };
|
|
1410
|
+
const itemPart = templateData.instantiationService.createInstance(ChatThinkingContentPart, itemContent, context, this.chatContentMarkdownRenderer);
|
|
1411
|
+
itemPart.addDisposable(itemPart.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1412
|
+
lastPart = itemPart;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
return lastPart ?? this.renderNoContent(other => content.kind === other.kind);
|
|
1417
|
+
}
|
|
1418
|
+
else {
|
|
1419
|
+
const lastActiveThinking = this.getLastThinkingPart(templateData.renderedParts);
|
|
1420
|
+
if (lastActiveThinking) {
|
|
1421
|
+
lastActiveThinking.setupThinkingContainer(content, context);
|
|
1422
|
+
return lastActiveThinking;
|
|
1423
|
+
}
|
|
1424
|
+
else {
|
|
1425
|
+
const part = templateData.instantiationService.createInstance(ChatThinkingContentPart, content, context, this.chatContentMarkdownRenderer);
|
|
1426
|
+
part.addDisposable(part.onDidChangeHeight(() => this.updateItemHeight(templateData)));
|
|
1427
|
+
return part;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
disposeElement(node, index, templateData, details) {
|
|
1432
|
+
this.traceLayout('disposeElement', `Disposing element, index=${index}`);
|
|
1433
|
+
templateData.elementDisposables.clear();
|
|
1434
|
+
if (templateData.currentElement && !this.viewModel?.editing) {
|
|
1435
|
+
this.templateDataByRequestId.delete(templateData.currentElement.id);
|
|
1436
|
+
}
|
|
1437
|
+
if (isRequestVM(node.element) && node.element.id === this.viewModel?.editing?.id && details?.onScroll) {
|
|
1438
|
+
this._onDidDispose.fire(templateData);
|
|
1439
|
+
}
|
|
1440
|
+
if (templateData.titleToolbar) {
|
|
1441
|
+
templateData.titleToolbar.context = undefined;
|
|
1442
|
+
}
|
|
1443
|
+
templateData.footerToolbar.context = undefined;
|
|
1444
|
+
}
|
|
1445
|
+
renderMcpServersInteractionRequired(content, context, templateData) {
|
|
1446
|
+
return this.instantiationService.createInstance(ChatMcpServersInteractionContentPart, content, context);
|
|
1447
|
+
}
|
|
1448
|
+
disposeTemplate(templateData) {
|
|
1449
|
+
templateData.templateDisposables.dispose();
|
|
1450
|
+
}
|
|
1451
|
+
hoverVisible(requestHover) {
|
|
1452
|
+
requestHover.style.opacity = '1';
|
|
1453
|
+
}
|
|
1454
|
+
hoverHidden(requestHover) {
|
|
1455
|
+
requestHover.style.opacity = '0';
|
|
1456
|
+
}
|
|
1457
|
+
};
|
|
1458
|
+
ChatListItemRenderer = ChatListItemRenderer_1 = ( __decorate([
|
|
1459
|
+
( __param(6, IInstantiationService)),
|
|
1460
|
+
( __param(7, IConfigurationService)),
|
|
1461
|
+
( __param(8, ILogService)),
|
|
1462
|
+
( __param(9, IContextKeyService)),
|
|
1463
|
+
( __param(10, IThemeService)),
|
|
1464
|
+
( __param(11, ICommandService)),
|
|
1465
|
+
( __param(12, IHoverService)),
|
|
1466
|
+
( __param(13, IChatWidgetService)),
|
|
1467
|
+
( __param(14, IChatEntitlementService))
|
|
1468
|
+
], ChatListItemRenderer));
|
|
1469
|
+
let ChatListDelegate = class ChatListDelegate {
|
|
1470
|
+
constructor(defaultElementHeight, logService) {
|
|
1471
|
+
this.defaultElementHeight = defaultElementHeight;
|
|
1472
|
+
this.logService = logService;
|
|
1473
|
+
}
|
|
1474
|
+
_traceLayout(method, message) {
|
|
1475
|
+
{
|
|
1476
|
+
this.logService.trace(`ChatListDelegate#${method}: ${message}`);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
getHeight(element) {
|
|
1480
|
+
const kind = isRequestVM(element) ? 'request' : 'response';
|
|
1481
|
+
const height = element.currentRenderedHeight ?? this.defaultElementHeight;
|
|
1482
|
+
this._traceLayout('getHeight', `${kind}, height=${height}`);
|
|
1483
|
+
return height;
|
|
1484
|
+
}
|
|
1485
|
+
getTemplateId(element) {
|
|
1486
|
+
return ChatListItemRenderer.ID;
|
|
1487
|
+
}
|
|
1488
|
+
hasDynamicHeight(element) {
|
|
1489
|
+
return true;
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
ChatListDelegate = ( __decorate([
|
|
1493
|
+
( __param(1, ILogService))
|
|
1494
|
+
], ChatListDelegate));
|
|
1495
|
+
const voteDownDetailLabels = {
|
|
1496
|
+
[ChatAgentVoteDownReason.IncorrectCode]: ( localize(5333, "Suggested incorrect code")),
|
|
1497
|
+
[ChatAgentVoteDownReason.DidNotFollowInstructions]: ( localize(5334, "Didn't follow instructions")),
|
|
1498
|
+
[ChatAgentVoteDownReason.MissingContext]: ( localize(5335, "Missing context")),
|
|
1499
|
+
[ChatAgentVoteDownReason.OffensiveOrUnsafe]: ( localize(5336, "Offensive or unsafe")),
|
|
1500
|
+
[ChatAgentVoteDownReason.PoorlyWrittenOrFormatted]: ( localize(5337, "Poorly written or formatted")),
|
|
1501
|
+
[ChatAgentVoteDownReason.RefusedAValidRequest]: ( localize(5338, "Refused a valid request")),
|
|
1502
|
+
[ChatAgentVoteDownReason.IncompleteCode]: ( localize(5339, "Incomplete code")),
|
|
1503
|
+
[ChatAgentVoteDownReason.WillReportIssue]: ( localize(5340, "Report an issue")),
|
|
1504
|
+
[ChatAgentVoteDownReason.Other]: ( localize(5341, "Other")),
|
|
1505
|
+
};
|
|
1506
|
+
let ChatVoteDownButton = class ChatVoteDownButton extends DropdownMenuActionViewItem {
|
|
1507
|
+
constructor(action, options, commandService, issueService, logService, contextMenuService) {
|
|
1508
|
+
super(action, { getActions: () => this.getActions(), }, contextMenuService, {
|
|
1509
|
+
...options,
|
|
1510
|
+
classNames: ThemeIcon.asClassNameArray(Codicon.thumbsdown),
|
|
1511
|
+
});
|
|
1512
|
+
this.commandService = commandService;
|
|
1513
|
+
this.issueService = issueService;
|
|
1514
|
+
this.logService = logService;
|
|
1515
|
+
}
|
|
1516
|
+
getActions() {
|
|
1517
|
+
return [
|
|
1518
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.IncorrectCode),
|
|
1519
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.DidNotFollowInstructions),
|
|
1520
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.IncompleteCode),
|
|
1521
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.MissingContext),
|
|
1522
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.PoorlyWrittenOrFormatted),
|
|
1523
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.RefusedAValidRequest),
|
|
1524
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.OffensiveOrUnsafe),
|
|
1525
|
+
this.getVoteDownDetailAction(ChatAgentVoteDownReason.Other),
|
|
1526
|
+
{
|
|
1527
|
+
id: 'reportIssue',
|
|
1528
|
+
label: voteDownDetailLabels[ChatAgentVoteDownReason.WillReportIssue],
|
|
1529
|
+
tooltip: '',
|
|
1530
|
+
enabled: true,
|
|
1531
|
+
class: undefined,
|
|
1532
|
+
run: async (context) => {
|
|
1533
|
+
if (!isResponseVM(context)) {
|
|
1534
|
+
this.logService.error('ChatVoteDownButton#run: invalid context');
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
await this.commandService.executeCommand(MarkUnhelpfulActionId, context, ChatAgentVoteDownReason.WillReportIssue);
|
|
1538
|
+
await this.issueService.openReporter({ extensionId: context.agent?.extensionId.value });
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
];
|
|
1542
|
+
}
|
|
1543
|
+
render(container) {
|
|
1544
|
+
super.render(container);
|
|
1545
|
+
this.element?.classList.toggle('checked', this.action.checked);
|
|
1546
|
+
}
|
|
1547
|
+
getVoteDownDetailAction(reason) {
|
|
1548
|
+
const label = voteDownDetailLabels[reason];
|
|
1549
|
+
return {
|
|
1550
|
+
id: MarkUnhelpfulActionId,
|
|
1551
|
+
label,
|
|
1552
|
+
tooltip: '',
|
|
1553
|
+
enabled: true,
|
|
1554
|
+
checked: this._context.voteDownReason === reason,
|
|
1555
|
+
class: undefined,
|
|
1556
|
+
run: async (context) => {
|
|
1557
|
+
if (!isResponseVM(context)) {
|
|
1558
|
+
this.logService.error('ChatVoteDownButton#getVoteDownDetailAction: invalid context');
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1561
|
+
await this.commandService.executeCommand(MarkUnhelpfulActionId, context, reason);
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
ChatVoteDownButton = ( __decorate([
|
|
1567
|
+
( __param(2, ICommandService)),
|
|
1568
|
+
( __param(3, IWorkbenchIssueService)),
|
|
1569
|
+
( __param(4, ILogService)),
|
|
1570
|
+
( __param(5, IContextMenuService))
|
|
1571
|
+
], ChatVoteDownButton));
|
|
1572
|
+
|
|
1573
|
+
export { ChatListDelegate, ChatListItemRenderer, ChatVoteDownButton };
|