@codingame/monaco-vscode-katex-common 25.1.2 → 26.0.1
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/package.json +2 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +23 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +64 -27
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +3 -1
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +31 -28
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +2 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +71 -50
- package/vscode/src/vs/platform/editor/browser/editor.js +17 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +112 -129
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +110 -85
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +21 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +308 -216
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +153 -148
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +247 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +347 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +287 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +89 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +188 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +677 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentSessionHoverWidget.css +98 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +263 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.js +34 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +19 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +762 -359
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +22 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +188 -99
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +9 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +166 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +12 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +279 -213
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +533 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +382 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.d.ts +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +509 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +130 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +276 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +24 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +128 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +153 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +1218 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionPickerActionItem.css +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +93 -89
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +42 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +58 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +18 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +17 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +132 -68
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +68 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +14 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +36 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.js +15 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +22 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +34 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +198 -135
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +38 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +29 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.js +41 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +23 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +20 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +291 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +227 -162
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.js +68 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +76 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +2 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +96 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +74 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +107 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +814 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +34 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +8 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +236 -197
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +123 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +492 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +75 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +31 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +42 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +55 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +714 -148
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +2 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +143 -153
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +14 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +79 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +10 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +209 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +9 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +71 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +248 -190
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +1 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatPullRequestContent.css +5 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +493 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatSubagentContent.css +63 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +121 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +51 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +46 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +99 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +112 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +634 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +132 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.js +15 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +196 -149
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +577 -193
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +119 -86
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +10 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +165 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +5 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +75 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +30 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +102 -106
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +44 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +122 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +39 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +1110 -597
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +291 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +485 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatOptions.js +38 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +9 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +650 -689
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +21 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +102 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +1253 -790
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.js +51 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +102 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +16 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +192 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +11 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +99 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +188 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +129 -167
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +16 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +143 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +206 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +152 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +67 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +170 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +80 -19
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatWidgetHistoryService.js +20 -28
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +22 -19
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +122 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +19 -104
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +316 -1040
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +162 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +98 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +416 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +1 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +194 -215
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +74 -104
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +45 -91
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +22 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +98 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +96 -68
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.js +11 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +150 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +141 -147
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.d.ts +64 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.js +200 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +548 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.js +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +338 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +364 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/interactiveEditor.css +21 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/media/interactive.css +36 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.d.ts +110 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +692 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +158 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +80 -21
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +440 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.d.ts +0 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.js +0 -139
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +0 -1081
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +0 -199
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +0 -482
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +0 -37
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +0 -94
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +0 -495
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +0 -72
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +0 -454
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +0 -66
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +0 -372
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +0 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +0 -594
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +0 -273
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1746
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -269
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +0 -258
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -806
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -116
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +0 -62
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +0 -295
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +0 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +0 -241
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +0 -146
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +0 -90
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +0 -42
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +0 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +0 -469
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +0 -149
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -823
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +0 -180
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +0 -102
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -567
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -189
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +0 -75
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +0 -439
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +0 -263
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +0 -48
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +0 -89
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +0 -33
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -108
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { $ as $$1, clearNode, h, append, addStandardDisposableListener, EventType, setVisibility, isKeyboardEvent, getActiveElement, getWindow, addDisposableListener,
|
|
3
|
+
import { $ as $$1, clearNode, h, append, addStandardDisposableListener, EventType, DisposableResizeObserver, setVisibility, isKeyboardEvent, getActiveElement, getWindow, addDisposableListener, getTotalWidth, reset } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
4
|
import { DEFAULT_FONT_FAMILY } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/fonts';
|
|
5
5
|
import { hasModifierKeys } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
|
|
6
|
-
import { ActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
6
|
+
import { BaseActionViewItem, ActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
7
7
|
import { status } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
|
|
8
|
-
import { ButtonWithIcon
|
|
9
|
-
import { createInstantHoverDelegate
|
|
8
|
+
import { ButtonWithIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
|
|
9
|
+
import { createInstantHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
10
|
+
import { HoverPosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverWidget';
|
|
10
11
|
import { renderLabelWithIcons } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
11
12
|
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
12
13
|
import { RunOnceScheduler, DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
@@ -20,6 +21,7 @@ import { Disposable, MutableDisposable, DisposableStore, toDisposable } from '@c
|
|
|
20
21
|
import { ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
21
22
|
import { MarshalledId } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
|
|
22
23
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
24
|
+
import { mixin } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
23
25
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
24
26
|
import { isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
25
27
|
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
@@ -52,7 +54,6 @@ import { registerAndCreateHistoryNavigationContext } from '@codingame/monaco-vsc
|
|
|
52
54
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
53
55
|
import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
54
56
|
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
55
|
-
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
56
57
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
57
58
|
import { observableMemento } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/observableMemento';
|
|
58
59
|
import { bindContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
@@ -60,6 +61,12 @@ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode
|
|
|
60
61
|
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
61
62
|
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
62
63
|
import { ISharedWebContentExtractorService } from '@codingame/monaco-vscode-api/vscode/vs/platform/webContentExtractor/common/webContentExtractor.service';
|
|
64
|
+
import { WorkbenchState } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
|
|
65
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
66
|
+
import { Position } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
67
|
+
import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
68
|
+
import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
|
|
69
|
+
import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
|
|
63
70
|
import { ResourceLabels } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/labels';
|
|
64
71
|
import { IWorkbenchAssignmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/assignment/common/assignmentService.service';
|
|
65
72
|
import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
|
|
@@ -69,70 +76,105 @@ import { AccessibilityVerbositySettingId } from '@codingame/monaco-vscode-api/vs
|
|
|
69
76
|
import { AccessibilityCommandId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/accessibility/common/accessibilityCommands';
|
|
70
77
|
import { getSimpleEditorOptions, getSimpleCodeEditorWidgetOptions, setupSimpleEditorSelectionStyling } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
|
|
71
78
|
import { InlineChatConfigKeys } from '../../../../inlineChat/common/inlineChat.js';
|
|
72
|
-
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
|
|
73
79
|
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
74
|
-
import {
|
|
80
|
+
import { ChatRequestVariableSet, isImageVariableEntry, isNotebookOutputVariableEntry, isPromptFileVariableEntry, isPromptTextVariableEntry, isElementVariableEntry, isPasteVariableEntry, isSCMHistoryItemVariableEntry, isSCMHistoryItemChangeVariableEntry, isSCMHistoryItemChangeRangeVariableEntry, isStringVariableEntry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
|
|
75
81
|
import { ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
|
|
76
82
|
import { IChatModeService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service';
|
|
77
83
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
78
|
-
import { localChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
84
|
+
import { agentOptionId, localChatSessionType, isIChatSessionFileChange2 } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
79
85
|
import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import { ChatHistoryNavigator } from '../../../common/widget/chatWidgetHistoryService.js';
|
|
83
|
-
import { ChatModeKind, ChatConfiguration, validateChatMode, ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
86
|
+
import { ChatAgentLocation, ChatModeKind, ChatConfiguration, validateChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
87
|
+
import { ModifiedFileEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatEditingService';
|
|
84
88
|
import { ILanguageModelChatMetadata } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
85
89
|
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
90
|
+
import { getChatSessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
|
|
91
|
+
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
|
|
86
92
|
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
|
|
87
|
-
import {
|
|
88
|
-
import { ChatSubmitAction,
|
|
93
|
+
import { ChatHistoryNavigator } from '../../../common/widget/chatWidgetHistoryService.js';
|
|
94
|
+
import { ChatSubmitAction, OpenModelPickerAction, OpenModePickerAction, OpenSessionTargetPickerAction, OpenDelegationPickerAction, OpenWorkspacePickerAction, ChatSessionPrimaryPickerAction } from '../../actions/chatExecuteActions.js';
|
|
95
|
+
import { getAgentSessionProvider, AgentSessionProviders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
89
96
|
import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
|
|
90
|
-
import { ImplicitContextAttachmentWidget } from '../../attachments/implicitContextAttachment.js';
|
|
91
97
|
import { ChatAttachmentModel } from '../../attachments/chatAttachmentModel.js';
|
|
92
98
|
import { ToolSetOrToolItemAttachmentWidget, NotebookCellOutputChatAttachmentWidget, PromptFileAttachmentWidget, PromptTextAttachmentWidget, FileAttachmentWidget, TerminalCommandAttachmentWidget, ImageAttachmentWidget, ElementChatAttachmentWidget, PasteAttachmentWidget, SCMHistoryItemAttachmentWidget, SCMHistoryItemChangeAttachmentWidget, SCMHistoryItemChangeRangeAttachmentWidget, DefaultChatAttachmentWidget } from '../../attachments/chatAttachmentWidgets.js';
|
|
99
|
+
import { ChatImplicitContexts } from '../../attachments/chatImplicitContext.js';
|
|
100
|
+
import { ImplicitContextAttachmentWidget } from '../../attachments/implicitContextAttachment.js';
|
|
101
|
+
import { isIChatResourceViewContext, isIChatViewViewContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
102
|
+
import { ChatEditingShowChangesAction, ViewPreviousEditsAction, ViewAllSessionChangesAction } from '../../chatEditing/chatEditingActions.js';
|
|
103
|
+
import { resizeImage } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatImageUtils';
|
|
104
|
+
import { ChatSessionPickerActionItem } from '../../chatSessions/chatSessionPickerActionItem.js';
|
|
105
|
+
import { SearchableOptionPickerActionItem } from '../../chatSessions/searchableOptionPickerActionItem.js';
|
|
106
|
+
import { IChatContextService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.service';
|
|
93
107
|
import { CollapsibleListPool } from '../chatContentParts/chatReferencesContentPart.js';
|
|
94
108
|
import { ChatTodoListWidget } from '../chatContentParts/chatTodoListWidget.js';
|
|
95
|
-
import { IChatContextService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.service';
|
|
96
109
|
import { ChatDragAndDrop } from '../chatDragAndDrop.js';
|
|
97
|
-
import { ChatEditingShowChangesAction, ViewPreviousEditsAction, ViewAllSessionChangesAction } from '../../chatEditing/chatEditingActions.js';
|
|
98
110
|
import { ChatFollowups } from './chatFollowups.js';
|
|
99
111
|
import { ChatInputPartWidgetController } from './chatInputPartWidgets.js';
|
|
100
112
|
import { ChatSelectedTools } from './chatSelectedTools.js';
|
|
101
|
-
import {
|
|
102
|
-
import { ChatImplicitContext } from '../../attachments/chatImplicitContext.js';
|
|
103
|
-
import { ChatRelatedFiles } from '../../attachments/chatInputRelatedFilesContrib.js';
|
|
104
|
-
import { resizeImage } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatImageUtils';
|
|
113
|
+
import { DelegationSessionPickerActionItem } from './delegationSessionPickerActionItem.js';
|
|
105
114
|
import { ModelPickerActionItem } from './modelPickerActionItem.js';
|
|
106
115
|
import { ModePickerActionItem } from './modePickerActionItem.js';
|
|
116
|
+
import { SessionTypePickerActionItem } from './sessionTargetPickerActionItem.js';
|
|
117
|
+
import { WorkspacePickerActionItem } from './workspacePickerActionItem.js';
|
|
118
|
+
import { ChatContextUsageWidget } from '../../widgetHosts/viewPane/chatContextUsageWidget.js';
|
|
107
119
|
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
108
120
|
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
109
|
-
import { derivedOpts, derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
110
121
|
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
122
|
+
import { derivedOpts, derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
111
123
|
|
|
112
124
|
var ChatInputPart_1;
|
|
113
125
|
const $ = $$1;
|
|
114
126
|
const INPUT_EDITOR_MAX_HEIGHT = 250;
|
|
127
|
+
const CachedLanguageModelsKey = "chat.cachedLanguageModels.v2";
|
|
128
|
+
var ChatWidgetLocation;
|
|
129
|
+
(function(ChatWidgetLocation) {
|
|
130
|
+
ChatWidgetLocation["SidebarLeft"] = "sidebarLeft";
|
|
131
|
+
ChatWidgetLocation["SidebarRight"] = "sidebarRight";
|
|
132
|
+
ChatWidgetLocation["Panel"] = "panel";
|
|
133
|
+
ChatWidgetLocation["Editor"] = "editor";
|
|
134
|
+
})(ChatWidgetLocation || (ChatWidgetLocation = {}));
|
|
115
135
|
const emptyInputState = observableMemento({
|
|
116
136
|
defaultValue: undefined,
|
|
117
|
-
key:
|
|
137
|
+
key: "chat.untitledInputState",
|
|
118
138
|
toStorage: JSON.stringify,
|
|
119
|
-
fromStorage
|
|
139
|
+
fromStorage(value) {
|
|
140
|
+
const obj = JSON.parse(value);
|
|
141
|
+
if (obj.selectedModel && !obj.selectedModel.metadata.isDefaultForLocation) {
|
|
142
|
+
const oldIsDefault = obj.selectedModel.metadata.isDefault;
|
|
143
|
+
const isDefaultForLocation = {
|
|
144
|
+
[ChatAgentLocation.Chat]: Boolean(oldIsDefault)
|
|
145
|
+
};
|
|
146
|
+
mixin(obj.selectedModel.metadata, {
|
|
147
|
+
isDefaultForLocation: isDefaultForLocation
|
|
148
|
+
});
|
|
149
|
+
delete obj.selectedModel.metadata.isDefault;
|
|
150
|
+
}
|
|
151
|
+
return obj;
|
|
152
|
+
}
|
|
120
153
|
});
|
|
121
154
|
let ChatInputPart = class ChatInputPart extends Disposable {
|
|
122
|
-
static {
|
|
123
|
-
|
|
155
|
+
static {
|
|
156
|
+
ChatInputPart_1 = this;
|
|
157
|
+
}
|
|
158
|
+
static {
|
|
159
|
+
this._counter = 0;
|
|
160
|
+
}
|
|
124
161
|
get attachmentModel() {
|
|
125
162
|
return this._attachmentModel;
|
|
126
163
|
}
|
|
127
164
|
getAttachedContext(sessionResource) {
|
|
128
165
|
const contextArr = ( new ChatRequestVariableSet());
|
|
129
|
-
contextArr.add(
|
|
166
|
+
contextArr.add(
|
|
167
|
+
...this.attachmentModel.attachments,
|
|
168
|
+
...this.chatContextService.getWorkspaceContextItems()
|
|
169
|
+
);
|
|
130
170
|
return contextArr;
|
|
131
171
|
}
|
|
132
172
|
getAttachedAndImplicitContext(sessionResource) {
|
|
133
173
|
const contextArr = this.getAttachedContext(sessionResource);
|
|
134
|
-
if (
|
|
135
|
-
const implicitChatVariables = this.implicitContext.
|
|
174
|
+
if (this.implicitContext) {
|
|
175
|
+
const implicitChatVariables = this.implicitContext.enabledBaseEntries(
|
|
176
|
+
this.configurationService.getValue("chat.implicitContext.suggestedContext")
|
|
177
|
+
);
|
|
136
178
|
contextArr.add(...implicitChatVariables);
|
|
137
179
|
}
|
|
138
180
|
return contextArr;
|
|
@@ -140,48 +182,25 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
140
182
|
get implicitContext() {
|
|
141
183
|
return this._implicitContext;
|
|
142
184
|
}
|
|
143
|
-
get relatedFiles() {
|
|
144
|
-
return this._relatedFiles;
|
|
145
|
-
}
|
|
146
|
-
get inputPartHeight() {
|
|
147
|
-
return this._inputPartHeight;
|
|
148
|
-
}
|
|
149
|
-
get followupsHeight() {
|
|
150
|
-
return this._followupsHeight;
|
|
151
|
-
}
|
|
152
|
-
get editSessionWidgetHeight() {
|
|
153
|
-
return this._editSessionWidgetHeight;
|
|
154
|
-
}
|
|
155
|
-
get todoListWidgetHeight() {
|
|
156
|
-
return this.chatInputTodoListWidgetContainer.offsetHeight;
|
|
157
|
-
}
|
|
158
|
-
get inputWidgetsHeight() {
|
|
159
|
-
return this.chatInputWidgetsContainer?.offsetHeight ?? 0;
|
|
160
|
-
}
|
|
161
|
-
get attachmentsHeight() {
|
|
162
|
-
return this.attachmentsContainer.offsetHeight + (this.attachmentsContainer.checkVisibility() ? 6 : 0);
|
|
163
|
-
}
|
|
164
185
|
get inputEditor() {
|
|
165
186
|
return this._inputEditor;
|
|
166
187
|
}
|
|
167
188
|
get currentLanguageModel() {
|
|
168
|
-
return this._currentLanguageModel?.identifier;
|
|
189
|
+
return this._currentLanguageModel.get()?.identifier;
|
|
169
190
|
}
|
|
170
191
|
get selectedLanguageModel() {
|
|
171
192
|
return this._currentLanguageModel;
|
|
172
193
|
}
|
|
173
194
|
get currentModeKind() {
|
|
174
195
|
const mode = this._currentModeObservable.get();
|
|
175
|
-
return mode.kind === ChatModeKind.Agent && !this.agentService.hasToolsAgent ?
|
|
176
|
-
ChatModeKind.Edit :
|
|
177
|
-
mode.kind;
|
|
196
|
+
return mode.kind === ChatModeKind.Agent && !this.agentService.hasToolsAgent ? ChatModeKind.Edit : mode.kind;
|
|
178
197
|
}
|
|
179
198
|
get currentModeObs() {
|
|
180
199
|
return this._currentModeObservable;
|
|
181
200
|
}
|
|
182
201
|
get currentModeInfo() {
|
|
183
202
|
const mode = this._currentModeObservable.get();
|
|
184
|
-
const modeId = mode.isBuiltin ? this.currentModeKind :
|
|
203
|
+
const modeId = mode.isBuiltin ? this.currentModeKind : "custom";
|
|
185
204
|
const modeInstructions = mode.modeInstructions?.get();
|
|
186
205
|
return {
|
|
187
206
|
kind: this.currentModeKind,
|
|
@@ -190,10 +209,10 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
190
209
|
name: mode.name.get(),
|
|
191
210
|
content: modeInstructions.content,
|
|
192
211
|
toolReferences: this.toolService.toToolReferences(modeInstructions.toolReferences),
|
|
193
|
-
metadata: modeInstructions.metadata
|
|
212
|
+
metadata: modeInstructions.metadata
|
|
194
213
|
} : undefined,
|
|
195
214
|
modeId: modeId,
|
|
196
|
-
applyCodeBlockSuggestionId: undefined
|
|
215
|
+
applyCodeBlockSuggestionId: undefined
|
|
197
216
|
};
|
|
198
217
|
}
|
|
199
218
|
get selectedElements() {
|
|
@@ -201,7 +220,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
201
220
|
const editsList = this._chatEditList?.object;
|
|
202
221
|
const selectedElements = editsList?.getSelectedElements() ?? [];
|
|
203
222
|
for (const element of selectedElements) {
|
|
204
|
-
if (element.kind ===
|
|
223
|
+
if (element.kind === "reference" && URI.isUri(element.reference)) {
|
|
205
224
|
edits.push(element.reference);
|
|
206
225
|
}
|
|
207
226
|
}
|
|
@@ -210,8 +229,41 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
210
229
|
get attemptedWorkingSetEntriesCount() {
|
|
211
230
|
return this._attemptedWorkingSetEntriesCount;
|
|
212
231
|
}
|
|
232
|
+
get pendingDelegationTarget() {
|
|
233
|
+
return this._pendingDelegationTarget;
|
|
234
|
+
}
|
|
213
235
|
constructor(
|
|
214
|
-
|
|
236
|
+
location,
|
|
237
|
+
options,
|
|
238
|
+
styles,
|
|
239
|
+
inline,
|
|
240
|
+
modelService,
|
|
241
|
+
instantiationService,
|
|
242
|
+
contextKeyService,
|
|
243
|
+
configurationService,
|
|
244
|
+
keybindingService,
|
|
245
|
+
accessibilityService,
|
|
246
|
+
languageModelsService,
|
|
247
|
+
logService,
|
|
248
|
+
fileService,
|
|
249
|
+
editorService,
|
|
250
|
+
themeService,
|
|
251
|
+
textModelResolverService,
|
|
252
|
+
storageService,
|
|
253
|
+
agentService,
|
|
254
|
+
sharedWebExtracterService,
|
|
255
|
+
experimentService,
|
|
256
|
+
entitlementService,
|
|
257
|
+
chatModeService,
|
|
258
|
+
toolService,
|
|
259
|
+
chatService,
|
|
260
|
+
chatSessionsService,
|
|
261
|
+
chatContextService,
|
|
262
|
+
agentSessionsService,
|
|
263
|
+
workspaceContextService,
|
|
264
|
+
layoutService,
|
|
265
|
+
viewDescriptorService
|
|
266
|
+
) {
|
|
215
267
|
super();
|
|
216
268
|
this.location = location;
|
|
217
269
|
this.options = options;
|
|
@@ -229,7 +281,6 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
229
281
|
this.themeService = themeService;
|
|
230
282
|
this.textModelResolverService = textModelResolverService;
|
|
231
283
|
this.storageService = storageService;
|
|
232
|
-
this.labelService = labelService;
|
|
233
284
|
this.agentService = agentService;
|
|
234
285
|
this.sharedWebExtracterService = sharedWebExtracterService;
|
|
235
286
|
this.experimentService = experimentService;
|
|
@@ -240,13 +291,14 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
240
291
|
this.chatSessionsService = chatSessionsService;
|
|
241
292
|
this.chatContextService = chatContextService;
|
|
242
293
|
this.agentSessionsService = agentSessionsService;
|
|
243
|
-
this.
|
|
294
|
+
this.workspaceContextService = workspaceContextService;
|
|
295
|
+
this.layoutService = layoutService;
|
|
296
|
+
this.viewDescriptorService = viewDescriptorService;
|
|
297
|
+
this._workingSetCollapsed = observableValue("chatInputPart.workingSetCollapsed", true);
|
|
244
298
|
this._chatInputTodoListWidget = this._register(( new MutableDisposable()));
|
|
245
299
|
this._chatEditingTodosDisposables = this._register(( new DisposableStore()));
|
|
246
300
|
this._onDidLoadInputState = this._register(( new Emitter()));
|
|
247
301
|
this.onDidLoadInputState = this._onDidLoadInputState.event;
|
|
248
|
-
this._onDidChangeHeight = this._register(( new Emitter()));
|
|
249
|
-
this.onDidChangeHeight = this._onDidChangeHeight.event;
|
|
250
302
|
this._onDidFocus = this._register(( new Emitter()));
|
|
251
303
|
this.onDidFocus = this._onDidFocus.event;
|
|
252
304
|
this._onDidBlur = this._register(( new Emitter()));
|
|
@@ -257,6 +309,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
257
309
|
this.onDidAcceptFollowup = this._onDidAcceptFollowup.event;
|
|
258
310
|
this._onDidClickOverlay = this._register(( new Emitter()));
|
|
259
311
|
this.onDidClickOverlay = this._onDidClickOverlay.event;
|
|
312
|
+
this._implicitContextWidget = this._register(( new MutableDisposable()));
|
|
260
313
|
this._indexOfLastAttachedContextDeletedWithKeyboard = -1;
|
|
261
314
|
this._indexOfLastOpenedContext = -1;
|
|
262
315
|
this._onDidChangeVisibility = this._register(( new Emitter()));
|
|
@@ -265,30 +318,34 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
265
318
|
this.overlayClickListener = this._register(( new MutableDisposable()));
|
|
266
319
|
this.attachedContextDisposables = this._register(( new MutableDisposable()));
|
|
267
320
|
this._widgetController = this._register(( new MutableDisposable()));
|
|
268
|
-
this.
|
|
269
|
-
this.
|
|
270
|
-
this._editSessionWidgetHeight = 0;
|
|
321
|
+
this._contextUsageDisposables = this._register(( new MutableDisposable()));
|
|
322
|
+
this.height = observableValue(this, 0);
|
|
271
323
|
this._modelSyncDisposables = this._register(( new DisposableStore()));
|
|
272
324
|
this._isSyncingToOrFromInputModel = false;
|
|
273
325
|
this.chatSessionPickerWidgets = ( new Map());
|
|
274
326
|
this._waitForPersistedLanguageModel = this._register(( new MutableDisposable()));
|
|
275
|
-
this._onDidChangeCurrentLanguageModel = this._register(( new Emitter()));
|
|
276
327
|
this._chatSessionOptionEmitters = ( new Map());
|
|
277
328
|
this._optionContextKeys = ( new Map());
|
|
329
|
+
this._currentLanguageModel = observableValue("_currentLanguageModel", undefined);
|
|
278
330
|
this._onDidChangeCurrentChatMode = this._register(( new Emitter()));
|
|
279
331
|
this.onDidChangeCurrentChatMode = this._onDidChangeCurrentChatMode.event;
|
|
280
332
|
this.inputUri = ( URI.parse(`${Schemas.vscodeChatInput}:input-${ChatInputPart_1._counter++}`));
|
|
281
|
-
this._workingSetLinesAddedSpan = ( new Lazy(() => $$1(
|
|
282
|
-
this._workingSetLinesRemovedSpan = ( new Lazy(() => $$1(
|
|
333
|
+
this._workingSetLinesAddedSpan = ( new Lazy(() => $$1(".working-set-lines-added")));
|
|
334
|
+
this._workingSetLinesRemovedSpan = ( new Lazy(() => $$1(".working-set-lines-removed")));
|
|
283
335
|
this._chatEditsActionsDisposables = this._register(( new DisposableStore()));
|
|
284
336
|
this._chatEditsDisposables = this._register(( new DisposableStore()));
|
|
285
337
|
this._renderingChatEdits = this._register(( new MutableDisposable()));
|
|
286
338
|
this._attemptedWorkingSetEntriesCount = 0;
|
|
287
339
|
this._chatSessionIsEmpty = false;
|
|
340
|
+
this._pendingDelegationTarget = undefined;
|
|
288
341
|
this._syncTextDebounced = this._register(( new RunOnceScheduler(() => this._syncInputStateToModel(), 150)));
|
|
289
|
-
this._emptyInputState = this._register(
|
|
290
|
-
|
|
291
|
-
|
|
342
|
+
this._emptyInputState = this._register(
|
|
343
|
+
emptyInputState(StorageScope.WORKSPACE, StorageTarget.USER, this.storageService)
|
|
344
|
+
);
|
|
345
|
+
this._contextResourceLabels = this._register(this.instantiationService.createInstance(ResourceLabels, {
|
|
346
|
+
onDidChangeVisibility: this._onDidChangeVisibility.event
|
|
347
|
+
}));
|
|
348
|
+
this._currentModeObservable = observableValue("currentMode", this.options.defaultMode ?? ChatMode.Agent);
|
|
292
349
|
this._register(this.editorService.onDidActiveEditorChange(() => {
|
|
293
350
|
this._indexOfLastOpenedContext = -1;
|
|
294
351
|
this.refreshChatSessionPickers();
|
|
@@ -303,60 +360,88 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
303
360
|
const sessionResource = this._widget?.viewModel?.model.sessionResource;
|
|
304
361
|
if (sessionResource) {
|
|
305
362
|
const ctx = this.chatService.getChatSessionFromInternalUri(sessionResource);
|
|
306
|
-
|
|
363
|
+
const delegateSessionType = this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();
|
|
364
|
+
if (ctx?.chatSessionType === chatSessionType || delegateSessionType === chatSessionType) {
|
|
307
365
|
this.refreshChatSessionPickers();
|
|
308
366
|
}
|
|
309
367
|
}
|
|
310
368
|
}));
|
|
369
|
+
if (this.options.sessionTypePickerDelegate?.onDidChangeActiveSessionProvider) {
|
|
370
|
+
this._register(
|
|
371
|
+
this.options.sessionTypePickerDelegate.onDidChangeActiveSessionProvider(async newSessionType => {
|
|
372
|
+
this.computeVisibleOptionGroups();
|
|
373
|
+
this.agentSessionTypeKey.set(newSessionType);
|
|
374
|
+
this.updateWidgetLockStateFromSessionType(newSessionType);
|
|
375
|
+
this.refreshChatSessionPickers();
|
|
376
|
+
})
|
|
377
|
+
);
|
|
378
|
+
}
|
|
311
379
|
this._attachmentModel = this._register(this.instantiationService.createInstance(ChatAttachmentModel));
|
|
312
380
|
this._register(this._attachmentModel.onDidChange(() => this._syncInputStateToModel()));
|
|
313
|
-
this.selectedToolsModel = this._register(
|
|
314
|
-
|
|
315
|
-
|
|
381
|
+
this.selectedToolsModel = this._register(
|
|
382
|
+
this.instantiationService.createInstance(ChatSelectedTools, this.currentModeObs, this._currentLanguageModel)
|
|
383
|
+
);
|
|
384
|
+
this.dnd = this._register(
|
|
385
|
+
this.instantiationService.createInstance(ChatDragAndDrop, () => this._widget, this._attachmentModel, styles)
|
|
386
|
+
);
|
|
387
|
+
this.inputEditorMaxHeight = this.options.renderStyle === "compact" ? INPUT_EDITOR_MAX_HEIGHT / 3 : INPUT_EDITOR_MAX_HEIGHT;
|
|
316
388
|
this.inputEditorHasText = ChatContextKeys.inputHasText.bindTo(contextKeyService);
|
|
317
389
|
this.chatCursorAtTop = ChatContextKeys.inputCursorAtTop.bindTo(contextKeyService);
|
|
318
390
|
this.inputEditorHasFocus = ChatContextKeys.inputHasFocus.bindTo(contextKeyService);
|
|
319
391
|
this.chatModeKindKey = ChatContextKeys.chatModeKind.bindTo(contextKeyService);
|
|
392
|
+
this.chatModeNameKey = ChatContextKeys.chatModeName.bindTo(contextKeyService);
|
|
320
393
|
this.withinEditSessionKey = ChatContextKeys.withinEditSessionDiff.bindTo(contextKeyService);
|
|
321
394
|
this.filePartOfEditSessionKey = ChatContextKeys.filePartOfEditSession.bindTo(contextKeyService);
|
|
322
395
|
this.chatSessionHasOptions = ChatContextKeys.chatSessionHasModels.bindTo(contextKeyService);
|
|
323
|
-
|
|
324
|
-
this.
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
396
|
+
this.chatSessionOptionsValid = ChatContextKeys.chatSessionOptionsValid.bindTo(contextKeyService);
|
|
397
|
+
this.agentSessionTypeKey = ChatContextKeys.agentSessionType.bindTo(contextKeyService);
|
|
398
|
+
if (this.options.sessionTypePickerDelegate?.getActiveSessionProvider) {
|
|
399
|
+
const initialSessionType = this.options.sessionTypePickerDelegate.getActiveSessionProvider();
|
|
400
|
+
if (initialSessionType) {
|
|
401
|
+
this.agentSessionTypeKey.set(initialSessionType);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
this.chatSessionHasCustomAgentTarget = ChatContextKeys.chatSessionHasCustomAgentTarget.bindTo(contextKeyService);
|
|
405
|
+
this.history = this._register(
|
|
406
|
+
this.instantiationService.createInstance(ChatHistoryNavigator, this.location)
|
|
407
|
+
);
|
|
335
408
|
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
336
409
|
const newOptions = {};
|
|
337
410
|
if (e.affectsConfiguration(AccessibilityVerbositySettingId.Chat)) {
|
|
338
411
|
newOptions.ariaLabel = this._getAriaLabel();
|
|
339
412
|
}
|
|
340
|
-
if (e.affectsConfiguration(
|
|
341
|
-
newOptions.wordSegmenterLocales = this.configurationService.getValue(
|
|
413
|
+
if (e.affectsConfiguration("editor.wordSegmenterLocales")) {
|
|
414
|
+
newOptions.wordSegmenterLocales = this.configurationService.getValue("editor.wordSegmenterLocales");
|
|
342
415
|
}
|
|
343
|
-
if (e.affectsConfiguration(
|
|
344
|
-
newOptions.autoClosingBrackets = this.configurationService.getValue(
|
|
416
|
+
if (e.affectsConfiguration("editor.autoClosingBrackets")) {
|
|
417
|
+
newOptions.autoClosingBrackets = this.configurationService.getValue("editor.autoClosingBrackets");
|
|
345
418
|
}
|
|
346
|
-
if (e.affectsConfiguration(
|
|
347
|
-
newOptions.autoClosingQuotes = this.configurationService.getValue(
|
|
419
|
+
if (e.affectsConfiguration("editor.autoClosingQuotes")) {
|
|
420
|
+
newOptions.autoClosingQuotes = this.configurationService.getValue("editor.autoClosingQuotes");
|
|
348
421
|
}
|
|
349
|
-
if (e.affectsConfiguration(
|
|
350
|
-
newOptions.autoSurround = this.configurationService.getValue(
|
|
422
|
+
if (e.affectsConfiguration("editor.autoSurround")) {
|
|
423
|
+
newOptions.autoSurround = this.configurationService.getValue("editor.autoSurround");
|
|
351
424
|
}
|
|
352
425
|
this.inputEditor.updateOptions(newOptions);
|
|
353
426
|
}));
|
|
354
|
-
this._chatEditsListPool = this._register(this.instantiationService.createInstance(
|
|
427
|
+
this._chatEditsListPool = this._register(this.instantiationService.createInstance(
|
|
428
|
+
CollapsibleListPool,
|
|
429
|
+
this._onDidChangeVisibility.event,
|
|
430
|
+
MenuId.ChatEditingWidgetModifiedFilesToolbar,
|
|
431
|
+
{
|
|
432
|
+
verticalScrollMode: ScrollbarVisibility.Visible
|
|
433
|
+
}
|
|
434
|
+
));
|
|
355
435
|
this._hasFileAttachmentContextKey = ChatContextKeys.hasFileAttachments.bindTo(contextKeyService);
|
|
356
436
|
this.initSelectedModel();
|
|
357
|
-
this._register(this.languageModelsService.onDidChangeLanguageModels(
|
|
358
|
-
this.storageService.store(
|
|
359
|
-
|
|
437
|
+
this._register(this.languageModelsService.onDidChangeLanguageModels(vendor => {
|
|
438
|
+
this.storageService.store(
|
|
439
|
+
CachedLanguageModelsKey,
|
|
440
|
+
this.storageService.getObject(CachedLanguageModelsKey, StorageScope.APPLICATION, []).filter(m => !m.identifier.startsWith(vendor)),
|
|
441
|
+
StorageScope.APPLICATION,
|
|
442
|
+
StorageTarget.MACHINE
|
|
443
|
+
);
|
|
444
|
+
const selectedModel = this._currentLanguageModel ? this.getModels().find(m => m.identifier === this._currentLanguageModel.get()?.identifier) : undefined;
|
|
360
445
|
const selectedModelNotAvailable = this._currentLanguageModel && (!selectedModel?.metadata.isUserSelectable);
|
|
361
446
|
if (!this.currentLanguageModel || selectedModelNotAvailable) {
|
|
362
447
|
this.setCurrentLanguageModelToDefault();
|
|
@@ -365,30 +450,54 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
365
450
|
this._register(this.onDidChangeCurrentChatMode(() => {
|
|
366
451
|
this.accessibilityService.alert(this._currentModeObservable.get().label.get());
|
|
367
452
|
if (this._inputEditor) {
|
|
368
|
-
this._inputEditor.updateOptions({
|
|
453
|
+
this._inputEditor.updateOptions({
|
|
454
|
+
ariaLabel: this._getAriaLabel()
|
|
455
|
+
});
|
|
369
456
|
}
|
|
370
457
|
this.setImplicitContextEnablement();
|
|
371
458
|
}));
|
|
372
|
-
this._register(
|
|
373
|
-
|
|
374
|
-
|
|
459
|
+
this._register(autorun(reader => {
|
|
460
|
+
const lm = this._currentLanguageModel.read(reader);
|
|
461
|
+
if (lm?.metadata.name) {
|
|
462
|
+
this.accessibilityService.alert(lm.metadata.name);
|
|
375
463
|
}
|
|
376
|
-
this._inputEditor?.updateOptions({
|
|
464
|
+
this._inputEditor?.updateOptions({
|
|
465
|
+
ariaLabel: this._getAriaLabel()
|
|
466
|
+
});
|
|
377
467
|
}));
|
|
378
|
-
this._register(
|
|
468
|
+
this._register(
|
|
469
|
+
this.chatModeService.onDidChangeChatModes(() => this.validateCurrentChatMode())
|
|
470
|
+
);
|
|
379
471
|
this._register(autorun(r => {
|
|
380
472
|
const mode = this._currentModeObservable.read(r);
|
|
381
473
|
this.chatModeKindKey.set(mode.kind);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
474
|
+
this.chatModeNameKey.set(mode.name.read(r));
|
|
475
|
+
const models = mode.model?.read(r);
|
|
476
|
+
if (models) {
|
|
477
|
+
this.switchModelByQualifiedName(models);
|
|
478
|
+
}
|
|
479
|
+
}));
|
|
480
|
+
this._register(autorun(r => {
|
|
481
|
+
const mode = this._currentModeObservable.read(r);
|
|
482
|
+
const modeName = mode.name.read(r);
|
|
483
|
+
const sessionResource = this._widget?.viewModel?.model.sessionResource;
|
|
484
|
+
if (sessionResource) {
|
|
485
|
+
const ctx = this.chatService.getChatSessionFromInternalUri(sessionResource);
|
|
486
|
+
if (ctx) {
|
|
487
|
+
this.chatSessionsService.notifySessionOptionsChange(ctx.chatSessionResource, [{
|
|
488
|
+
optionId: agentOptionId,
|
|
489
|
+
value: mode.isBuiltin ? "" : modeName
|
|
490
|
+
}]).catch(
|
|
491
|
+
err => this.logService.error("Failed to notify extension of agent change:", err)
|
|
492
|
+
);
|
|
493
|
+
}
|
|
385
494
|
}
|
|
386
495
|
}));
|
|
387
496
|
this.validateCurrentChatMode();
|
|
388
497
|
}
|
|
389
498
|
setImplicitContextEnablement() {
|
|
390
|
-
if (this.implicitContext && this.configurationService.getValue(
|
|
391
|
-
this.implicitContext.
|
|
499
|
+
if (this.implicitContext && this.configurationService.getValue("chat.implicitContext.suggestedContext")) {
|
|
500
|
+
this.implicitContext.setEnabled(this._currentModeObservable.get().kind !== ChatMode.Agent.kind);
|
|
392
501
|
}
|
|
393
502
|
}
|
|
394
503
|
setIsWithinEditSession(inInsideDiff, isFilePartOfEditSession) {
|
|
@@ -403,28 +512,33 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
403
512
|
}
|
|
404
513
|
initSelectedModel() {
|
|
405
514
|
const persistedSelection = this.storageService.get(this.getSelectedModelStorageKey(), StorageScope.APPLICATION);
|
|
406
|
-
const persistedAsDefault = this.storageService.getBoolean(
|
|
515
|
+
const persistedAsDefault = this.storageService.getBoolean(
|
|
516
|
+
this.getSelectedModelIsDefaultStorageKey(),
|
|
517
|
+
StorageScope.APPLICATION,
|
|
518
|
+
persistedSelection === "copilot/gpt-4.1"
|
|
519
|
+
);
|
|
407
520
|
if (persistedSelection) {
|
|
408
521
|
const model = this.getModels().find(m => m.identifier === persistedSelection);
|
|
409
522
|
if (model) {
|
|
410
|
-
if (!persistedAsDefault || model.metadata.
|
|
523
|
+
if (!persistedAsDefault || model.metadata.isDefaultForLocation[this.location]) {
|
|
411
524
|
this.setCurrentLanguageModel(model);
|
|
412
525
|
this.checkModelSupported();
|
|
413
526
|
}
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
527
|
+
} else {
|
|
416
528
|
this._waitForPersistedLanguageModel.value = this.languageModelsService.onDidChangeLanguageModels(e => {
|
|
417
529
|
const persistedModel = this.languageModelsService.lookupLanguageModel(persistedSelection);
|
|
418
530
|
if (persistedModel) {
|
|
419
531
|
this._waitForPersistedLanguageModel.clear();
|
|
420
|
-
if (!persistedAsDefault || persistedModel.
|
|
532
|
+
if (!persistedAsDefault || persistedModel.isDefaultForLocation[this.location]) {
|
|
421
533
|
if (persistedModel.isUserSelectable) {
|
|
422
|
-
this.setCurrentLanguageModel({
|
|
534
|
+
this.setCurrentLanguageModel({
|
|
535
|
+
metadata: persistedModel,
|
|
536
|
+
identifier: persistedSelection
|
|
537
|
+
});
|
|
423
538
|
this.checkModelSupported();
|
|
424
539
|
}
|
|
425
540
|
}
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
541
|
+
} else {
|
|
428
542
|
this.setCurrentLanguageModelToDefault();
|
|
429
543
|
}
|
|
430
544
|
});
|
|
@@ -444,24 +558,33 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
444
558
|
}
|
|
445
559
|
switchModel(modelMetadata) {
|
|
446
560
|
const models = this.getModels();
|
|
447
|
-
const model = models.find(
|
|
561
|
+
const model = models.find(
|
|
562
|
+
m => m.metadata.vendor === modelMetadata.vendor && m.metadata.id === modelMetadata.id && m.metadata.family === modelMetadata.family
|
|
563
|
+
);
|
|
448
564
|
if (model) {
|
|
449
565
|
this.setCurrentLanguageModel(model);
|
|
450
566
|
}
|
|
451
567
|
}
|
|
452
|
-
switchModelByQualifiedName(
|
|
568
|
+
switchModelByQualifiedName(qualifiedModelNames) {
|
|
453
569
|
const models = this.getModels();
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
570
|
+
for (const qualifiedModelName of qualifiedModelNames) {
|
|
571
|
+
const model = models.find(
|
|
572
|
+
m => ILanguageModelChatMetadata.matchesQualifiedName(qualifiedModelName, m.metadata)
|
|
573
|
+
);
|
|
574
|
+
if (model) {
|
|
575
|
+
this.setCurrentLanguageModel(model);
|
|
576
|
+
return true;
|
|
577
|
+
}
|
|
458
578
|
}
|
|
579
|
+
this.logService.warn(
|
|
580
|
+
`[chat] Node of the models "${qualifiedModelNames.join(", ")}" not found. Use format "<name> (<vendor>)", e.g. "GPT-4o (copilot)".`
|
|
581
|
+
);
|
|
459
582
|
return false;
|
|
460
583
|
}
|
|
461
584
|
switchToNextModel() {
|
|
462
585
|
const models = this.getModels();
|
|
463
586
|
if (models.length > 0) {
|
|
464
|
-
const currentIndex = models.findIndex(model => model.identifier === this._currentLanguageModel?.identifier);
|
|
587
|
+
const currentIndex = models.findIndex(model => model.identifier === this._currentLanguageModel.get()?.identifier);
|
|
465
588
|
const nextIndex = (currentIndex + 1) % models.length;
|
|
466
589
|
this.setCurrentLanguageModel(models[nextIndex]);
|
|
467
590
|
}
|
|
@@ -472,72 +595,70 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
472
595
|
openModePicker() {
|
|
473
596
|
this.modeWidget?.show();
|
|
474
597
|
}
|
|
598
|
+
openSessionTargetPicker() {
|
|
599
|
+
this.sessionTargetWidget?.show();
|
|
600
|
+
}
|
|
601
|
+
openDelegationPicker() {
|
|
602
|
+
this.delegationWidget?.show();
|
|
603
|
+
}
|
|
475
604
|
openChatSessionPicker() {
|
|
476
605
|
const firstWidget = this.chatSessionPickerWidgets?.values()?.next().value;
|
|
477
606
|
firstWidget?.show();
|
|
478
607
|
}
|
|
479
608
|
createChatSessionPickerWidgets(action) {
|
|
480
609
|
this._lastSessionPickerAction = action;
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
if (!sessionResource) {
|
|
484
|
-
return undefined;
|
|
485
|
-
}
|
|
486
|
-
return this.chatService.getChatSessionFromInternalUri(sessionResource);
|
|
487
|
-
};
|
|
488
|
-
const ctx = resolveChatSessionContext();
|
|
489
|
-
const optionGroups = ctx ? this.chatSessionsService.getOptionGroupsForSessionType(ctx.chatSessionType) : undefined;
|
|
490
|
-
if (!optionGroups || optionGroups.length === 0) {
|
|
610
|
+
const result = this.computeVisibleOptionGroups();
|
|
611
|
+
if (!result) {
|
|
491
612
|
return [];
|
|
492
613
|
}
|
|
614
|
+
const {
|
|
615
|
+
visibleGroupIds,
|
|
616
|
+
optionGroups,
|
|
617
|
+
effectiveSessionType
|
|
618
|
+
} = result;
|
|
493
619
|
this.disposeSessionPickerWidgets();
|
|
494
|
-
for (const optionGroup of optionGroups) {
|
|
495
|
-
if (!ctx) {
|
|
496
|
-
continue;
|
|
497
|
-
}
|
|
498
|
-
const currentOption = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, optionGroup.id);
|
|
499
|
-
if (currentOption) {
|
|
500
|
-
const optionId = typeof currentOption === 'string' ? currentOption : currentOption.id;
|
|
501
|
-
this.updateOptionContextKey(optionGroup.id, optionId);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
620
|
const widgets = [];
|
|
505
621
|
for (const optionGroup of optionGroups) {
|
|
506
|
-
if (!
|
|
507
|
-
continue;
|
|
508
|
-
}
|
|
509
|
-
if (!this.chatSessionsService.getSessionOption(ctx.chatSessionResource, optionGroup.id)) {
|
|
510
|
-
continue;
|
|
511
|
-
}
|
|
512
|
-
if (!this.evaluateOptionGroupVisibility(optionGroup)) {
|
|
622
|
+
if (!( visibleGroupIds.has(optionGroup.id))) {
|
|
513
623
|
continue;
|
|
514
624
|
}
|
|
515
625
|
const initialItem = this.getCurrentOptionForGroup(optionGroup.id);
|
|
516
|
-
const initialState = {
|
|
626
|
+
const initialState = {
|
|
627
|
+
group: optionGroup,
|
|
628
|
+
item: initialItem
|
|
629
|
+
};
|
|
517
630
|
const itemDelegate = {
|
|
518
631
|
getCurrentOption: () => this.getCurrentOptionForGroup(optionGroup.id),
|
|
519
632
|
onDidChangeOption: this.getOrCreateOptionEmitter(optionGroup.id).event,
|
|
520
|
-
setOption:
|
|
521
|
-
const ctx = resolveChatSessionContext();
|
|
522
|
-
if (!ctx) {
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
633
|
+
setOption: option => {
|
|
525
634
|
this.updateOptionContextKey(optionGroup.id, option.id);
|
|
526
635
|
this.getOrCreateOptionEmitter(optionGroup.id).fire(option);
|
|
527
|
-
|
|
636
|
+
const sessionResource = this._widget?.viewModel?.model.sessionResource;
|
|
637
|
+
const currentCtx = sessionResource ? this.chatService.getChatSessionFromInternalUri(sessionResource) : undefined;
|
|
638
|
+
if (currentCtx) {
|
|
639
|
+
this.chatSessionsService.notifySessionOptionsChange(currentCtx.chatSessionResource, [{
|
|
640
|
+
optionId: optionGroup.id,
|
|
641
|
+
value: option
|
|
642
|
+
}]).catch(
|
|
643
|
+
err => this.logService.error(`Failed to notify extension of ${optionGroup.id} change:`, err)
|
|
644
|
+
);
|
|
645
|
+
}
|
|
528
646
|
this.refreshChatSessionPickers();
|
|
529
647
|
},
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
const group = groups?.find(g => g.id === optionGroup.id);
|
|
537
|
-
return group?.items ?? [];
|
|
648
|
+
getOptionGroup: () => {
|
|
649
|
+
const groups = this.chatSessionsService.getOptionGroupsForSessionType(effectiveSessionType);
|
|
650
|
+
return groups?.find(g => g.id === optionGroup.id);
|
|
651
|
+
},
|
|
652
|
+
getSessionResource: () => {
|
|
653
|
+
return this._widget?.viewModel?.model.sessionResource;
|
|
538
654
|
}
|
|
539
655
|
};
|
|
540
|
-
const widget = this.instantiationService.createInstance(
|
|
656
|
+
const widget = this.instantiationService.createInstance(
|
|
657
|
+
optionGroup.searchable ? SearchableOptionPickerActionItem : ChatSessionPickerActionItem,
|
|
658
|
+
action,
|
|
659
|
+
initialState,
|
|
660
|
+
itemDelegate
|
|
661
|
+
);
|
|
541
662
|
this.chatSessionPickerWidgets.set(optionGroup.id, widget);
|
|
542
663
|
widgets.push(widget);
|
|
543
664
|
}
|
|
@@ -564,12 +685,11 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
564
685
|
const hasSetDefaultMode = this.storageService.getBoolean(storageKey, StorageScope.WORKSPACE, false);
|
|
565
686
|
if (!hasSetDefaultMode) {
|
|
566
687
|
const isAnonymous = this.entitlementService.anonymous;
|
|
567
|
-
this.experimentService.getTreatment(
|
|
568
|
-
.then((defaultModeTreatment => {
|
|
688
|
+
this.experimentService.getTreatment("chat.defaultMode").then((defaultModeTreatment => {
|
|
569
689
|
if (isAnonymous) {
|
|
570
690
|
defaultModeTreatment = ChatModeKind.Agent;
|
|
571
691
|
}
|
|
572
|
-
if (typeof defaultModeTreatment ===
|
|
692
|
+
if (typeof defaultModeTreatment === "string") {
|
|
573
693
|
this.storageService.store(storageKey, true, StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
|
574
694
|
const defaultMode = validateChatMode(defaultModeTreatment);
|
|
575
695
|
if (defaultMode) {
|
|
@@ -594,19 +714,19 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
594
714
|
}
|
|
595
715
|
}
|
|
596
716
|
if (state?.selectedModel) {
|
|
597
|
-
|
|
717
|
+
const lm = this._currentLanguageModel.get();
|
|
718
|
+
if (!lm || lm.identifier !== state.selectedModel.identifier) {
|
|
598
719
|
this.setCurrentLanguageModel(state.selectedModel);
|
|
599
720
|
}
|
|
600
721
|
}
|
|
601
722
|
const currentAttachments = this._attachmentModel.attachments;
|
|
602
723
|
if (!state) {
|
|
603
724
|
this._attachmentModel.clear();
|
|
604
|
-
}
|
|
605
|
-
else if (!equals(currentAttachments, state.attachments)) {
|
|
725
|
+
} else if (!equals(currentAttachments, state.attachments)) {
|
|
606
726
|
this._attachmentModel.clearAndSetContext(...state.attachments);
|
|
607
727
|
}
|
|
608
728
|
if (this._inputEditor) {
|
|
609
|
-
this._inputEditor.setValue(state?.inputText ||
|
|
729
|
+
this._inputEditor.setValue(state?.inputText || "");
|
|
610
730
|
if (state?.selections.length) {
|
|
611
731
|
this._inputEditor.setSelections(state.selections);
|
|
612
732
|
}
|
|
@@ -616,8 +736,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
616
736
|
contrib.setInputState?.(state.contrib);
|
|
617
737
|
});
|
|
618
738
|
}
|
|
619
|
-
}
|
|
620
|
-
finally {
|
|
739
|
+
} finally {
|
|
621
740
|
this._isSyncingToOrFromInputModel = false;
|
|
622
741
|
}
|
|
623
742
|
}
|
|
@@ -634,17 +753,27 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
634
753
|
this._isSyncingToOrFromInputModel = false;
|
|
635
754
|
}
|
|
636
755
|
setCurrentLanguageModel(model) {
|
|
637
|
-
this._currentLanguageModel
|
|
638
|
-
if (this.
|
|
639
|
-
this.layout(this.
|
|
640
|
-
}
|
|
641
|
-
this.storageService.store(
|
|
642
|
-
|
|
643
|
-
|
|
756
|
+
this._currentLanguageModel.set(model, undefined);
|
|
757
|
+
if (this.cachedWidth) {
|
|
758
|
+
this.layout(this.cachedWidth);
|
|
759
|
+
}
|
|
760
|
+
this.storageService.store(
|
|
761
|
+
this.getSelectedModelStorageKey(),
|
|
762
|
+
model.identifier,
|
|
763
|
+
StorageScope.APPLICATION,
|
|
764
|
+
StorageTarget.USER
|
|
765
|
+
);
|
|
766
|
+
this.storageService.store(
|
|
767
|
+
this.getSelectedModelIsDefaultStorageKey(),
|
|
768
|
+
!!model.metadata.isDefaultForLocation[this.location],
|
|
769
|
+
StorageScope.APPLICATION,
|
|
770
|
+
StorageTarget.USER
|
|
771
|
+
);
|
|
644
772
|
this._syncInputStateToModel();
|
|
645
773
|
}
|
|
646
774
|
checkModelSupported() {
|
|
647
|
-
|
|
775
|
+
const lm = this._currentLanguageModel.get();
|
|
776
|
+
if (lm && (!this.modelSupportedForDefaultAgent(lm) || !this.modelSupportedForInlineChat(lm))) {
|
|
648
777
|
this.setCurrentLanguageModelToDefault();
|
|
649
778
|
}
|
|
650
779
|
}
|
|
@@ -652,9 +781,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
652
781
|
if (!this.options.supportsChangingModes) {
|
|
653
782
|
return;
|
|
654
783
|
}
|
|
655
|
-
const mode2 = this.chatModeService.findModeById(mode) ??
|
|
656
|
-
this.chatModeService.findModeById(ChatModeKind.Agent) ??
|
|
657
|
-
ChatMode.Ask;
|
|
784
|
+
const mode2 = this.chatModeService.findModeById(mode) ?? this.chatModeService.findModeById(ChatModeKind.Agent) ?? ChatMode.Ask;
|
|
658
785
|
this.setChatMode2(mode2, storeSelection);
|
|
659
786
|
}
|
|
660
787
|
setChatMode2(mode, storeSelection = true) {
|
|
@@ -678,23 +805,29 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
678
805
|
return !!model.metadata.capabilities?.toolCalling;
|
|
679
806
|
}
|
|
680
807
|
getModels() {
|
|
681
|
-
const cachedModels = this.storageService.getObject(
|
|
682
|
-
let models = ( this.languageModelsService.getLanguageModelIds()
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
));
|
|
686
|
-
if (models.length === 0 || ( models.some(m => m.metadata.
|
|
808
|
+
const cachedModels = this.storageService.getObject(CachedLanguageModelsKey, StorageScope.APPLICATION, []);
|
|
809
|
+
let models = ( this.languageModelsService.getLanguageModelIds().map(modelId => ({
|
|
810
|
+
identifier: modelId,
|
|
811
|
+
metadata: this.languageModelsService.lookupLanguageModel(modelId)
|
|
812
|
+
})));
|
|
813
|
+
if (models.length === 0 || ( models.some(m => m.metadata.isDefaultForLocation[this.location])) === false) {
|
|
687
814
|
models = cachedModels;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
|
|
815
|
+
} else {
|
|
816
|
+
this.storageService.store(
|
|
817
|
+
CachedLanguageModelsKey,
|
|
818
|
+
models,
|
|
819
|
+
StorageScope.APPLICATION,
|
|
820
|
+
StorageTarget.MACHINE
|
|
821
|
+
);
|
|
691
822
|
}
|
|
692
823
|
models.sort((a, b) => a.metadata.name.localeCompare(b.metadata.name));
|
|
693
|
-
return models.filter(
|
|
824
|
+
return models.filter(
|
|
825
|
+
entry => entry.metadata?.isUserSelectable && this.modelSupportedForDefaultAgent(entry) && this.modelSupportedForInlineChat(entry)
|
|
826
|
+
);
|
|
694
827
|
}
|
|
695
828
|
setCurrentLanguageModelToDefault() {
|
|
696
829
|
const allModels = this.getModels();
|
|
697
|
-
const defaultModel = allModels.find(m => m.metadata.
|
|
830
|
+
const defaultModel = allModels.find(m => m.metadata.isDefaultForLocation[this.location]) || allModels.find(m => m.metadata.isUserSelectable);
|
|
698
831
|
if (defaultModel) {
|
|
699
832
|
this.setCurrentLanguageModel(defaultModel);
|
|
700
833
|
}
|
|
@@ -702,15 +835,15 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
702
835
|
getCurrentInputState() {
|
|
703
836
|
const mode = this._currentModeObservable.get();
|
|
704
837
|
const state = {
|
|
705
|
-
inputText: this._inputEditor?.getValue() ??
|
|
838
|
+
inputText: this._inputEditor?.getValue() ?? "",
|
|
706
839
|
attachments: this._attachmentModel.attachments,
|
|
707
840
|
mode: {
|
|
708
841
|
id: mode.id,
|
|
709
842
|
kind: mode.kind
|
|
710
843
|
},
|
|
711
|
-
selectedModel: this._currentLanguageModel,
|
|
844
|
+
selectedModel: this._currentLanguageModel.get(),
|
|
712
845
|
selections: this._inputEditor?.getSelections() || [],
|
|
713
|
-
contrib: {}
|
|
846
|
+
contrib: {}
|
|
714
847
|
};
|
|
715
848
|
for (const contrib of this._widget?.contribs || Iterable.empty()) {
|
|
716
849
|
contrib.getInputState?.(state.contrib);
|
|
@@ -724,45 +857,41 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
724
857
|
kbLabel = this.keybindingService.lookupKeybinding(AccessibilityCommandId.OpenAccessibilityHelp)?.getLabel();
|
|
725
858
|
}
|
|
726
859
|
const mode = this._currentModeObservable.get();
|
|
727
|
-
const modelName = this._currentLanguageModel?.metadata.name;
|
|
728
|
-
const modelInfo = modelName ? ( localize(
|
|
729
|
-
let modeLabel =
|
|
860
|
+
const modelName = this._currentLanguageModel.get()?.metadata.name;
|
|
861
|
+
const modelInfo = modelName ? ( localize(6067, ", {0}. ", modelName)) : "";
|
|
862
|
+
let modeLabel = "";
|
|
730
863
|
if (!mode.isBuiltin) {
|
|
731
864
|
const mode = this.currentModeObs.get();
|
|
732
|
-
modeLabel = ( localize(
|
|
733
|
-
}
|
|
734
|
-
else {
|
|
865
|
+
modeLabel = ( localize(6068, "({0}), {1}", mode.label.get(), mode.description.get()));
|
|
866
|
+
} else {
|
|
735
867
|
switch (this.currentModeKind) {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
868
|
+
case ChatModeKind.Agent:
|
|
869
|
+
modeLabel = ( localize(6069, "(Agent), edit files in your workspace."));
|
|
870
|
+
break;
|
|
871
|
+
case ChatModeKind.Edit:
|
|
872
|
+
modeLabel = ( localize(6070, "(Edit), edit files in your workspace."));
|
|
873
|
+
break;
|
|
874
|
+
case ChatModeKind.Ask:
|
|
875
|
+
default:
|
|
876
|
+
modeLabel = ( localize(6071, "(Ask), ask questions or type / for topics."));
|
|
877
|
+
break;
|
|
746
878
|
}
|
|
747
879
|
}
|
|
748
880
|
if (verbose) {
|
|
749
|
-
return kbLabel
|
|
750
|
-
|
|
751
|
-
5817,
|
|
881
|
+
return kbLabel ? ( localize(
|
|
882
|
+
6072,
|
|
752
883
|
"Chat Input {0}{1} Press Enter to send out the request. Use {2} for Chat Accessibility Help.",
|
|
753
884
|
modeLabel,
|
|
754
885
|
modelInfo,
|
|
755
886
|
kbLabel
|
|
756
|
-
))
|
|
757
|
-
|
|
758
|
-
5818,
|
|
887
|
+
)) : ( localize(
|
|
888
|
+
6073,
|
|
759
889
|
"Chat Input {0}{1} Press Enter to send out the request. Use the Chat Accessibility Help command for more information.",
|
|
760
890
|
modeLabel,
|
|
761
891
|
modelInfo
|
|
762
892
|
));
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
return localize(5819, "Chat Input {0}{1}.", modeLabel, modelInfo);
|
|
893
|
+
} else {
|
|
894
|
+
return localize(6074, "Chat Input {0}{1}.", modeLabel, modelInfo);
|
|
766
895
|
}
|
|
767
896
|
}
|
|
768
897
|
validateCurrentChatMode() {
|
|
@@ -783,7 +912,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
783
912
|
return `chat.${tag}.hasSetDefaultModeByExperiment`;
|
|
784
913
|
}
|
|
785
914
|
logInputHistory() {
|
|
786
|
-
const historyStr = ( this.history.values.map(entry => JSON.stringify(entry))).join(
|
|
915
|
+
const historyStr = ( this.history.values.map(entry => JSON.stringify(entry))).join("\n");
|
|
787
916
|
this.logService.info(`[${this.location}] Chat input history:`, historyStr);
|
|
788
917
|
}
|
|
789
918
|
setVisible(visible) {
|
|
@@ -793,15 +922,17 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
793
922
|
return this._generating?.defer.p;
|
|
794
923
|
}
|
|
795
924
|
startGenerating() {
|
|
796
|
-
this.logService.trace(
|
|
925
|
+
this.logService.trace("ChatWidget#startGenerating");
|
|
797
926
|
if (this._generating) {
|
|
798
927
|
this._generating.rc++;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
928
|
+
} else {
|
|
929
|
+
this._generating = {
|
|
930
|
+
rc: 1,
|
|
931
|
+
defer: ( new DeferredPromise())
|
|
932
|
+
};
|
|
802
933
|
}
|
|
803
934
|
return toDisposable(() => {
|
|
804
|
-
this.logService.trace(
|
|
935
|
+
this.logService.trace("ChatWidget#doneGenerating");
|
|
805
936
|
if (this._generating && !--this._generating.rc) {
|
|
806
937
|
this._generating.defer.complete();
|
|
807
938
|
this._generating = undefined;
|
|
@@ -832,24 +963,24 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
832
963
|
this.navigateHistory(false);
|
|
833
964
|
}
|
|
834
965
|
async navigateHistory(previous) {
|
|
835
|
-
const historyEntry = previous ?
|
|
836
|
-
this.history.previous() : this.history.next();
|
|
966
|
+
const historyEntry = previous ? this.history.previous() : this.history.next();
|
|
837
967
|
let historyAttachments = historyEntry?.attachments ?? [];
|
|
838
968
|
if (historyAttachments.length > 0) {
|
|
839
|
-
historyAttachments = (await Promise.all(( historyAttachments.map(async
|
|
969
|
+
historyAttachments = (await Promise.all(( historyAttachments.map(async attachment => {
|
|
840
970
|
if (isImageVariableEntry(attachment) && attachment.references?.length && URI.isUri(attachment.references[0].reference)) {
|
|
841
971
|
const currReference = attachment.references[0].reference;
|
|
842
972
|
try {
|
|
843
|
-
const imageBinary = ( currReference.toString(true)).startsWith(
|
|
973
|
+
const imageBinary = ( currReference.toString(true)).startsWith("http") ? await this.sharedWebExtracterService.readImage(currReference, CancellationToken.None) : (await this.fileService.readFile(currReference)).value;
|
|
844
974
|
if (!imageBinary) {
|
|
845
975
|
return undefined;
|
|
846
976
|
}
|
|
847
|
-
const newAttachment = {
|
|
977
|
+
const newAttachment = {
|
|
978
|
+
...attachment
|
|
979
|
+
};
|
|
848
980
|
newAttachment.value = (isImageVariableEntry(attachment) && attachment.isPasted) ? imageBinary.buffer : await resizeImage(imageBinary.buffer);
|
|
849
981
|
return newAttachment;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
this.logService.error('Failed to fetch and reference.', err);
|
|
982
|
+
} catch (err) {
|
|
983
|
+
this.logService.error("Failed to fetch and reference.", err);
|
|
853
984
|
return undefined;
|
|
854
985
|
}
|
|
855
986
|
}
|
|
@@ -857,7 +988,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
857
988
|
})))).filter(attachment => attachment !== undefined);
|
|
858
989
|
}
|
|
859
990
|
this._attachmentModel.clearAndSetContext(...historyAttachments);
|
|
860
|
-
const inputText = historyEntry?.inputText ??
|
|
991
|
+
const inputText = historyEntry?.inputText ?? "";
|
|
861
992
|
const contribData = historyEntry?.contrib ?? {};
|
|
862
993
|
status(inputText);
|
|
863
994
|
this.setValue(inputText, true);
|
|
@@ -870,9 +1001,11 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
870
1001
|
return;
|
|
871
1002
|
}
|
|
872
1003
|
if (previous) {
|
|
873
|
-
this._inputEditor.setPosition({
|
|
874
|
-
|
|
875
|
-
|
|
1004
|
+
this._inputEditor.setPosition({
|
|
1005
|
+
lineNumber: 1,
|
|
1006
|
+
column: 1
|
|
1007
|
+
});
|
|
1008
|
+
} else {
|
|
876
1009
|
this._inputEditor.setPosition(getLastPosition(model));
|
|
877
1010
|
}
|
|
878
1011
|
}
|
|
@@ -902,10 +1035,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
902
1035
|
this._onDidLoadInputState.fire();
|
|
903
1036
|
if (this.accessibilityService.isScreenReaderOptimized() && isMacintosh) {
|
|
904
1037
|
this._acceptInputForVoiceover();
|
|
905
|
-
}
|
|
906
|
-
else {
|
|
1038
|
+
} else {
|
|
907
1039
|
this._inputEditor.focus();
|
|
908
|
-
this._inputEditor.setValue(
|
|
1040
|
+
this._inputEditor.setValue("");
|
|
909
1041
|
}
|
|
910
1042
|
}
|
|
911
1043
|
validateAgentMode() {
|
|
@@ -916,13 +1048,18 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
916
1048
|
_getFilteredEntry(inputState) {
|
|
917
1049
|
const attachmentsWithoutImageValues = ( inputState.attachments.map(attachment => {
|
|
918
1050
|
if (isImageVariableEntry(attachment) && attachment.references?.length && attachment.value) {
|
|
919
|
-
const newAttachment = {
|
|
1051
|
+
const newAttachment = {
|
|
1052
|
+
...attachment
|
|
1053
|
+
};
|
|
920
1054
|
newAttachment.value = undefined;
|
|
921
1055
|
return newAttachment;
|
|
922
1056
|
}
|
|
923
1057
|
return attachment;
|
|
924
1058
|
}));
|
|
925
|
-
return {
|
|
1059
|
+
return {
|
|
1060
|
+
...inputState,
|
|
1061
|
+
attachments: attachmentsWithoutImageValues
|
|
1062
|
+
};
|
|
926
1063
|
}
|
|
927
1064
|
_acceptInputForVoiceover() {
|
|
928
1065
|
const domNode = this._inputEditor.getDomNode();
|
|
@@ -930,12 +1067,12 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
930
1067
|
return;
|
|
931
1068
|
}
|
|
932
1069
|
domNode.remove();
|
|
933
|
-
this._inputEditor.setValue(
|
|
1070
|
+
this._inputEditor.setValue("");
|
|
934
1071
|
this._inputEditorElement.appendChild(domNode);
|
|
935
1072
|
this._inputEditor.focus();
|
|
936
1073
|
}
|
|
937
1074
|
_handleAttachedContextChange() {
|
|
938
|
-
this._hasFileAttachmentContextKey.set(Boolean(this._attachmentModel.attachments.find(a => a.kind ===
|
|
1075
|
+
this._hasFileAttachmentContextKey.set(Boolean(this._attachmentModel.attachments.find(a => a.kind === "file")));
|
|
939
1076
|
this.renderAttachedContext();
|
|
940
1077
|
}
|
|
941
1078
|
getOrCreateOptionEmitter(optionGroupId) {
|
|
@@ -952,7 +1089,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
952
1089
|
}
|
|
953
1090
|
let contextKey = this._optionContextKeys.get(optionGroupId);
|
|
954
1091
|
if (!contextKey) {
|
|
955
|
-
const rawKey = ( new RawContextKey(`chatSessionOption.${optionGroupId}`,
|
|
1092
|
+
const rawKey = ( new RawContextKey(`chatSessionOption.${optionGroupId}`, ""));
|
|
956
1093
|
contextKey = rawKey.bindTo(this._scopedContextKeyService);
|
|
957
1094
|
this._optionContextKeys.set(optionGroupId, contextKey);
|
|
958
1095
|
}
|
|
@@ -978,76 +1115,119 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
978
1115
|
}
|
|
979
1116
|
return this._scopedContextKeyService.contextMatchesRules(expr);
|
|
980
1117
|
}
|
|
981
|
-
|
|
982
|
-
const
|
|
983
|
-
const hideAll = () => {
|
|
1118
|
+
computeVisibleOptionGroups() {
|
|
1119
|
+
const setNoOptions = () => {
|
|
984
1120
|
this.chatSessionHasOptions.set(false);
|
|
985
|
-
this.
|
|
1121
|
+
this.chatSessionOptionsValid.set(true);
|
|
986
1122
|
};
|
|
987
|
-
|
|
988
|
-
|
|
1123
|
+
const sessionResource = this._widget?.viewModel?.model.sessionResource;
|
|
1124
|
+
const ctx = sessionResource ? this.chatService.getChatSessionFromInternalUri(sessionResource) : undefined;
|
|
1125
|
+
const customAgentTarget = ctx && this.chatSessionsService.getCustomAgentTargetForSessionType(ctx.chatSessionType);
|
|
1126
|
+
this.chatSessionHasCustomAgentTarget.set(!!customAgentTarget);
|
|
1127
|
+
if (customAgentTarget) {
|
|
1128
|
+
const agentOption = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, agentOptionId);
|
|
1129
|
+
if (typeof agentOption !== "undefined") {
|
|
1130
|
+
const agentId = (typeof agentOption === "string" ? agentOption : agentOption.id) || ChatMode.Agent.id;
|
|
1131
|
+
const currentMode = this._currentModeObservable.get();
|
|
1132
|
+
const isDefaultAgent = agentId === ChatMode.Agent.id;
|
|
1133
|
+
const needsUpdate = isDefaultAgent ? currentMode.id !== ChatMode.Agent.id : currentMode.label.get() !== agentId;
|
|
1134
|
+
if (needsUpdate) {
|
|
1135
|
+
this.setChatMode(agentId);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
989
1138
|
}
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
|
|
1139
|
+
const delegateSessionType = this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();
|
|
1140
|
+
const effectiveSessionType = delegateSessionType ?? ctx?.chatSessionType;
|
|
1141
|
+
if (!effectiveSessionType) {
|
|
1142
|
+
setNoOptions();
|
|
1143
|
+
return undefined;
|
|
993
1144
|
}
|
|
994
|
-
const optionGroups = this.chatSessionsService.getOptionGroupsForSessionType(
|
|
1145
|
+
const optionGroups = this.chatSessionsService.getOptionGroupsForSessionType(effectiveSessionType);
|
|
995
1146
|
if (!optionGroups || optionGroups.length === 0) {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if (!this.chatSessionsService.hasAnySessionOptions(ctx.chatSessionResource)) {
|
|
999
|
-
return hideAll();
|
|
1147
|
+
setNoOptions();
|
|
1148
|
+
return undefined;
|
|
1000
1149
|
}
|
|
1001
|
-
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
this.logService.trace(`[ChatInputPart] No session option set for group '${optionGroup.id}'`);
|
|
1150
|
+
if (ctx) {
|
|
1151
|
+
for (const optionGroup of optionGroups) {
|
|
1152
|
+
const currentOption = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, optionGroup.id);
|
|
1153
|
+
if (currentOption) {
|
|
1154
|
+
const optionId = typeof currentOption === "string" ? currentOption : currentOption.id;
|
|
1155
|
+
this.updateOptionContextKey(optionGroup.id, optionId);
|
|
1156
|
+
}
|
|
1009
1157
|
}
|
|
1010
1158
|
}
|
|
1011
1159
|
const visibleGroupIds = ( new Set());
|
|
1012
1160
|
for (const optionGroup of optionGroups) {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
if (
|
|
1161
|
+
const hasItems = optionGroup.items.length > 0 || (optionGroup.commands || []).length > 0;
|
|
1162
|
+
const passesWhenClause = this.evaluateOptionGroupVisibility(optionGroup);
|
|
1163
|
+
const sessionHasOption = !ctx || this.chatSessionsService.getSessionOption(ctx.chatSessionResource, optionGroup.id) !== undefined;
|
|
1164
|
+
if (hasItems && passesWhenClause && sessionHasOption) {
|
|
1017
1165
|
visibleGroupIds.add(optionGroup.id);
|
|
1018
1166
|
}
|
|
1019
1167
|
}
|
|
1020
1168
|
if (visibleGroupIds.size === 0) {
|
|
1021
|
-
|
|
1169
|
+
setNoOptions();
|
|
1170
|
+
return undefined;
|
|
1171
|
+
}
|
|
1172
|
+
let allOptionsValid = true;
|
|
1173
|
+
if (ctx) {
|
|
1174
|
+
for (const groupId of visibleGroupIds) {
|
|
1175
|
+
const optionGroup = optionGroups.find(g => g.id === groupId);
|
|
1176
|
+
const currentOption = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, groupId);
|
|
1177
|
+
if (optionGroup && currentOption) {
|
|
1178
|
+
const currentOptionId = typeof currentOption === "string" ? currentOption : currentOption.id;
|
|
1179
|
+
if (!( optionGroup.items.some(item => item.id === currentOptionId)) && typeof currentOption === "string") {
|
|
1180
|
+
allOptionsValid = false;
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1022
1185
|
}
|
|
1023
1186
|
this.chatSessionHasOptions.set(true);
|
|
1187
|
+
this.chatSessionOptionsValid.set(allOptionsValid);
|
|
1188
|
+
return {
|
|
1189
|
+
visibleGroupIds,
|
|
1190
|
+
optionGroups,
|
|
1191
|
+
ctx,
|
|
1192
|
+
effectiveSessionType
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
refreshChatSessionPickers() {
|
|
1196
|
+
const result = this.computeVisibleOptionGroups();
|
|
1197
|
+
if (!result) {
|
|
1198
|
+
this.hideAllSessionPickerWidgets();
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
const {
|
|
1202
|
+
visibleGroupIds,
|
|
1203
|
+
optionGroups,
|
|
1204
|
+
ctx
|
|
1205
|
+
} = result;
|
|
1024
1206
|
const currentWidgetGroupIds = ( new Set(( this.chatSessionPickerWidgets.keys())));
|
|
1025
|
-
const needsRecreation = currentWidgetGroupIds.size !== visibleGroupIds.size ||
|
|
1026
|
-
!Array.from(visibleGroupIds).every(id => ( currentWidgetGroupIds.has(id)));
|
|
1207
|
+
const needsRecreation = currentWidgetGroupIds.size !== visibleGroupIds.size || !Array.from(visibleGroupIds).every(id => ( currentWidgetGroupIds.has(id)));
|
|
1027
1208
|
if (needsRecreation && this._lastSessionPickerAction && this.chatSessionPickerContainer) {
|
|
1028
1209
|
const widgets = this.createChatSessionPickerWidgets(this._lastSessionPickerAction);
|
|
1029
1210
|
clearNode(this.chatSessionPickerContainer);
|
|
1030
1211
|
for (const widget of widgets) {
|
|
1031
|
-
const container = $$1(
|
|
1212
|
+
const container = $$1(".action-item.chat-sessionPicker-item");
|
|
1032
1213
|
widget.render(container);
|
|
1033
1214
|
this.chatSessionPickerContainer.appendChild(container);
|
|
1034
1215
|
}
|
|
1035
1216
|
}
|
|
1036
1217
|
if (this.chatSessionPickerContainer) {
|
|
1037
|
-
this.chatSessionPickerContainer.style.display =
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
if (typeof currentOption ===
|
|
1218
|
+
this.chatSessionPickerContainer.style.display = "";
|
|
1219
|
+
}
|
|
1220
|
+
if (ctx) {
|
|
1221
|
+
for (const [optionGroupId] of this.chatSessionPickerWidgets.entries()) {
|
|
1222
|
+
const currentOption = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, optionGroupId);
|
|
1223
|
+
if (currentOption) {
|
|
1224
|
+
const optionGroup = optionGroups.find(g => g.id === optionGroupId);
|
|
1225
|
+
if (optionGroup) {
|
|
1226
|
+
const currentOptionId = typeof currentOption === "string" ? currentOption : currentOption.id;
|
|
1227
|
+
const item = optionGroup.items.find(m => m.id === currentOptionId);
|
|
1228
|
+
if (item && typeof currentOption === "string") {
|
|
1048
1229
|
this.getOrCreateOptionEmitter(optionGroupId).fire(item);
|
|
1049
|
-
}
|
|
1050
|
-
else {
|
|
1230
|
+
} else if (typeof currentOption !== "string") {
|
|
1051
1231
|
this.getOrCreateOptionEmitter(optionGroupId).fire(currentOption);
|
|
1052
1232
|
}
|
|
1053
1233
|
}
|
|
@@ -1057,7 +1237,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1057
1237
|
}
|
|
1058
1238
|
hideAllSessionPickerWidgets() {
|
|
1059
1239
|
if (this.chatSessionPickerContainer) {
|
|
1060
|
-
this.chatSessionPickerContainer.style.display =
|
|
1240
|
+
this.chatSessionPickerContainer.style.display = "none";
|
|
1061
1241
|
}
|
|
1062
1242
|
}
|
|
1063
1243
|
disposeSessionPickerWidgets() {
|
|
@@ -1075,29 +1255,57 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1075
1255
|
if (!ctx) {
|
|
1076
1256
|
return;
|
|
1077
1257
|
}
|
|
1078
|
-
|
|
1258
|
+
if (this.chatSessionsService.getSessionOption(ctx.chatSessionResource, optionGroupId) === undefined) {
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
const effectiveSessionType = this.getEffectiveSessionType(ctx, this.options.sessionTypePickerDelegate);
|
|
1262
|
+
const optionGroups = this.chatSessionsService.getOptionGroupsForSessionType(effectiveSessionType);
|
|
1079
1263
|
const optionGroup = optionGroups?.find(g => g.id === optionGroupId);
|
|
1080
1264
|
if (!optionGroup || optionGroup.items.length === 0) {
|
|
1081
1265
|
return;
|
|
1082
1266
|
}
|
|
1083
1267
|
const currentOptionValue = this.chatSessionsService.getSessionOption(ctx.chatSessionResource, optionGroupId);
|
|
1084
1268
|
if (!currentOptionValue) {
|
|
1085
|
-
|
|
1269
|
+
const defaultItem = optionGroup.items.find(item => item.default);
|
|
1270
|
+
return defaultItem;
|
|
1086
1271
|
}
|
|
1087
|
-
if (typeof currentOptionValue ===
|
|
1272
|
+
if (typeof currentOptionValue === "string") {
|
|
1088
1273
|
const normalizedOptionId = currentOptionValue.trim();
|
|
1089
1274
|
return optionGroup.items.find(m => m.id === normalizedOptionId);
|
|
1090
|
-
}
|
|
1091
|
-
else {
|
|
1275
|
+
} else {
|
|
1092
1276
|
return currentOptionValue;
|
|
1093
1277
|
}
|
|
1094
1278
|
}
|
|
1279
|
+
getEffectiveSessionType(ctx, delegate) {
|
|
1280
|
+
return this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.() || ctx?.chatSessionType || "";
|
|
1281
|
+
}
|
|
1282
|
+
updateAgentSessionTypeContextKey() {
|
|
1283
|
+
const sessionResource = this._widget?.viewModel?.model.sessionResource;
|
|
1284
|
+
const delegate = this.options.sessionTypePickerDelegate;
|
|
1285
|
+
const delegateSessionType = delegate?.setActiveSessionProvider && delegate?.getActiveSessionProvider?.();
|
|
1286
|
+
const sessionType = delegateSessionType || (sessionResource ? getChatSessionType(sessionResource) : "");
|
|
1287
|
+
this.agentSessionTypeKey.set(sessionType);
|
|
1288
|
+
}
|
|
1289
|
+
updateWidgetLockStateFromSessionType(sessionType) {
|
|
1290
|
+
if (sessionType === localChatSessionType) {
|
|
1291
|
+
this._widget?.unlockFromCodingAgent();
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
const contribution = this.chatSessionsService.getChatSessionContribution(sessionType);
|
|
1295
|
+
if (contribution) {
|
|
1296
|
+
this._widget?.lockToCodingAgent(contribution.name, contribution.displayName, contribution.type);
|
|
1297
|
+
} else {
|
|
1298
|
+
this._widget?.unlockFromCodingAgent();
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1095
1301
|
tryUpdateWidgetController() {
|
|
1096
1302
|
const sessionResource = this._widget?.viewModel?.model.sessionResource;
|
|
1097
1303
|
if (!sessionResource) {
|
|
1098
1304
|
return;
|
|
1099
1305
|
}
|
|
1100
|
-
const
|
|
1306
|
+
const delegate = this.options.sessionTypePickerDelegate;
|
|
1307
|
+
const delegateSessionType = delegate?.setActiveSessionProvider && delegate?.getActiveSessionProvider?.();
|
|
1308
|
+
const sessionType = delegateSessionType || this._pendingDelegationTarget || getChatSessionType(sessionResource);
|
|
1101
1309
|
const isLocalSession = sessionType === localChatSessionType;
|
|
1102
1310
|
if (!isLocalSession) {
|
|
1103
1311
|
this._widgetController.clear();
|
|
@@ -1105,61 +1313,85 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1105
1313
|
}
|
|
1106
1314
|
if (!this._widgetController.value) {
|
|
1107
1315
|
this._widgetController.value = this.instantiationService.createInstance(ChatInputPartWidgetController, this.chatInputWidgetsContainer);
|
|
1108
|
-
this._register(this._widgetController.value.onDidChangeHeight(() => this._onDidChangeHeight.fire()));
|
|
1109
1316
|
}
|
|
1110
1317
|
}
|
|
1318
|
+
updateContextUsageWidget() {
|
|
1319
|
+
this._contextUsageDisposables.clear();
|
|
1320
|
+
const model = this._widget?.viewModel?.model;
|
|
1321
|
+
if (!model || !this.contextUsageWidget) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
const store = ( new DisposableStore());
|
|
1325
|
+
this._contextUsageDisposables.value = store;
|
|
1326
|
+
store.add(model.onDidChange(e => {
|
|
1327
|
+
if (e.kind === "completedRequest") {
|
|
1328
|
+
this.contextUsageWidget?.update(model.lastRequest);
|
|
1329
|
+
}
|
|
1330
|
+
}));
|
|
1331
|
+
this.contextUsageWidget.update(model.lastRequest);
|
|
1332
|
+
}
|
|
1111
1333
|
render(container, initialValue, widget) {
|
|
1112
1334
|
this._widget = widget;
|
|
1335
|
+
this.computeVisibleOptionGroups();
|
|
1336
|
+
const delegate = this.options.sessionTypePickerDelegate;
|
|
1337
|
+
if (delegate?.setActiveSessionProvider && delegate?.getActiveSessionProvider) {
|
|
1338
|
+
const initialSessionType = delegate.getActiveSessionProvider();
|
|
1339
|
+
if (initialSessionType) {
|
|
1340
|
+
this.updateWidgetLockStateFromSessionType(initialSessionType);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1113
1343
|
this._register(widget.onDidChangeViewModel(() => {
|
|
1344
|
+
this._pendingDelegationTarget = undefined;
|
|
1345
|
+
this.updateAgentSessionTypeContextKey();
|
|
1114
1346
|
this.refreshChatSessionPickers();
|
|
1115
1347
|
this.tryUpdateWidgetController();
|
|
1348
|
+
this.updateContextUsageWidget();
|
|
1116
1349
|
}));
|
|
1117
1350
|
let elements;
|
|
1118
|
-
if (this.options.renderStyle ===
|
|
1119
|
-
elements = h(
|
|
1120
|
-
h(
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
])
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
]),
|
|
1135
|
-
h('.interactive-input-followups@followupsContainer'),
|
|
1136
|
-
])
|
|
1137
|
-
]);
|
|
1138
|
-
}
|
|
1139
|
-
else {
|
|
1140
|
-
elements = h('.interactive-input-part', [
|
|
1141
|
-
h('.interactive-input-followups@followupsContainer'),
|
|
1142
|
-
h('.chat-input-widgets-container@chatInputWidgetsContainer'),
|
|
1143
|
-
h('.chat-todo-list-widget-container@chatInputTodoListWidgetContainer'),
|
|
1144
|
-
h('.chat-editing-session@chatEditingSessionWidgetContainer'),
|
|
1145
|
-
h('.interactive-input-and-side-toolbar@inputAndSideToolbar', [
|
|
1146
|
-
h('.chat-input-container@inputContainer', [
|
|
1147
|
-
h('.chat-attachments-container@attachmentsContainer', [
|
|
1148
|
-
h('.chat-attachment-toolbar@attachmentToolbar'),
|
|
1149
|
-
h('.chat-related-files@relatedFilesContainer'),
|
|
1150
|
-
h('.chat-attached-context@attachedContextContainer'),
|
|
1151
|
-
]),
|
|
1152
|
-
h('.chat-editor-container@editorContainer'),
|
|
1153
|
-
h('.chat-input-toolbars@inputToolbars'),
|
|
1154
|
-
]),
|
|
1351
|
+
if (this.options.renderStyle === "compact") {
|
|
1352
|
+
elements = h(".interactive-input-part", [h(".interactive-input-and-edit-session", [
|
|
1353
|
+
h(".chat-input-widgets-container@chatInputWidgetsContainer"),
|
|
1354
|
+
h(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),
|
|
1355
|
+
h(".chat-editing-session@chatEditingSessionWidgetContainer"),
|
|
1356
|
+
h(
|
|
1357
|
+
".interactive-input-and-side-toolbar@inputAndSideToolbar",
|
|
1358
|
+
[h(".chat-input-container@inputContainer", [
|
|
1359
|
+
h(".chat-context-usage-container@contextUsageWidgetContainer"),
|
|
1360
|
+
h(".chat-editor-container@editorContainer"),
|
|
1361
|
+
h(".chat-input-toolbars@inputToolbars")
|
|
1362
|
+
])]
|
|
1363
|
+
),
|
|
1364
|
+
h(".chat-attachments-container@attachmentsContainer", [
|
|
1365
|
+
h(".chat-attachment-toolbar@attachmentToolbar"),
|
|
1366
|
+
h(".chat-attached-context@attachedContextContainer")
|
|
1155
1367
|
]),
|
|
1368
|
+
h(".interactive-input-followups@followupsContainer")
|
|
1369
|
+
])]);
|
|
1370
|
+
} else {
|
|
1371
|
+
elements = h(".interactive-input-part", [
|
|
1372
|
+
h(".interactive-input-followups@followupsContainer"),
|
|
1373
|
+
h(".chat-input-widgets-container@chatInputWidgetsContainer"),
|
|
1374
|
+
h(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),
|
|
1375
|
+
h(".chat-editing-session@chatEditingSessionWidgetContainer"),
|
|
1376
|
+
h(
|
|
1377
|
+
".interactive-input-and-side-toolbar@inputAndSideToolbar",
|
|
1378
|
+
[h(".chat-input-container@inputContainer", [
|
|
1379
|
+
h(".chat-context-usage-container@contextUsageWidgetContainer"),
|
|
1380
|
+
h(".chat-attachments-container@attachmentsContainer", [
|
|
1381
|
+
h(".chat-attachment-toolbar@attachmentToolbar"),
|
|
1382
|
+
h(".chat-attached-context@attachedContextContainer")
|
|
1383
|
+
]),
|
|
1384
|
+
h(".chat-editor-container@editorContainer"),
|
|
1385
|
+
h(".chat-input-toolbars@inputToolbars")
|
|
1386
|
+
])]
|
|
1387
|
+
)
|
|
1156
1388
|
]);
|
|
1157
1389
|
}
|
|
1158
1390
|
this.container = elements.root;
|
|
1159
|
-
this.chatInputOverlay = $$1(
|
|
1391
|
+
this.chatInputOverlay = $$1(".chat-input-overlay");
|
|
1160
1392
|
container.append(this.container);
|
|
1161
1393
|
this.container.append(this.chatInputOverlay);
|
|
1162
|
-
this.container.classList.toggle(
|
|
1394
|
+
this.container.classList.toggle("compact", this.options.renderStyle === "compact");
|
|
1163
1395
|
this._scopedContextKeyService = this._register(this.contextKeyService.createScoped(this.container));
|
|
1164
1396
|
this.followupsContainer = elements.followupsContainer;
|
|
1165
1397
|
const inputAndSideToolbar = elements.inputAndSideToolbar;
|
|
@@ -1167,43 +1399,47 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1167
1399
|
const editorContainer = elements.editorContainer;
|
|
1168
1400
|
this.attachmentsContainer = elements.attachmentsContainer;
|
|
1169
1401
|
this.attachedContextContainer = elements.attachedContextContainer;
|
|
1170
|
-
this.relatedFilesContainer = elements.relatedFilesContainer;
|
|
1171
1402
|
const toolbarsContainer = elements.inputToolbars;
|
|
1172
1403
|
const attachmentToolbarContainer = elements.attachmentToolbar;
|
|
1173
1404
|
this.chatEditingSessionWidgetContainer = elements.chatEditingSessionWidgetContainer;
|
|
1174
1405
|
this.chatInputTodoListWidgetContainer = elements.chatInputTodoListWidgetContainer;
|
|
1175
1406
|
this.chatInputWidgetsContainer = elements.chatInputWidgetsContainer;
|
|
1407
|
+
this.contextUsageWidgetContainer = elements.contextUsageWidgetContainer;
|
|
1408
|
+
this.contextUsageWidget = this._register(this.instantiationService.createInstance(ChatContextUsageWidget));
|
|
1409
|
+
this.contextUsageWidgetContainer.appendChild(this.contextUsageWidget.domNode);
|
|
1176
1410
|
if (this.options.enableImplicitContext && !this._implicitContext) {
|
|
1177
|
-
this._implicitContext = this._register(this.instantiationService.createInstance(
|
|
1411
|
+
this._implicitContext = this._register(this.instantiationService.createInstance(ChatImplicitContexts));
|
|
1178
1412
|
this.setImplicitContextEnablement();
|
|
1179
1413
|
this._register(this._implicitContext.onDidChangeValue(() => {
|
|
1180
1414
|
this._indexOfLastAttachedContextDeletedWithKeyboard = -1;
|
|
1181
1415
|
this._handleAttachedContextChange();
|
|
1182
1416
|
}));
|
|
1183
|
-
}
|
|
1184
|
-
else if (!this.options.enableImplicitContext && this._implicitContext) {
|
|
1417
|
+
} else if (!this.options.enableImplicitContext && this._implicitContext) {
|
|
1185
1418
|
this._implicitContext?.dispose();
|
|
1186
1419
|
this._implicitContext = undefined;
|
|
1187
1420
|
}
|
|
1188
1421
|
this.tryUpdateWidgetController();
|
|
1189
|
-
this._register(this._attachmentModel.onDidChange(
|
|
1422
|
+
this._register(this._attachmentModel.onDidChange(e => {
|
|
1190
1423
|
if (e.added.length > 0) {
|
|
1191
1424
|
this._indexOfLastAttachedContextDeletedWithKeyboard = -1;
|
|
1192
1425
|
}
|
|
1193
1426
|
this._handleAttachedContextChange();
|
|
1194
1427
|
}));
|
|
1195
1428
|
this.renderChatEditingSessionState(null);
|
|
1196
|
-
|
|
1197
|
-
this.
|
|
1198
|
-
this.
|
|
1199
|
-
|
|
1200
|
-
this.renderChatRelatedFiles();
|
|
1201
|
-
this.dnd.addOverlay(this.options.dndContainer ?? container, this.options.dndContainer ?? container);
|
|
1429
|
+
this.dnd.addOverlay(
|
|
1430
|
+
this.options.dndContainer ?? container,
|
|
1431
|
+
this.options.dndContainer ?? container
|
|
1432
|
+
);
|
|
1202
1433
|
const inputScopedContextKeyService = this._register(this.contextKeyService.createScoped(inputContainer));
|
|
1203
1434
|
ChatContextKeys.inChatInput.bindTo(inputScopedContextKeyService).set(true);
|
|
1204
1435
|
this.currentlyEditingInputKey = ChatContextKeys.currentlyEditingInput.bindTo(inputScopedContextKeyService);
|
|
1205
1436
|
const scopedInstantiationService = this._register(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, inputScopedContextKeyService]))));
|
|
1206
|
-
const {
|
|
1437
|
+
const {
|
|
1438
|
+
historyNavigationBackwardsEnablement,
|
|
1439
|
+
historyNavigationForwardsEnablement
|
|
1440
|
+
} = this._register(
|
|
1441
|
+
registerAndCreateHistoryNavigationContext(inputScopedContextKeyService, this)
|
|
1442
|
+
);
|
|
1207
1443
|
this.historyNavigationBackwardsEnablement = historyNavigationBackwardsEnablement;
|
|
1208
1444
|
this.historyNavigationForewardsEnablement = historyNavigationForwardsEnablement;
|
|
1209
1445
|
const options = getSimpleEditorOptions(this.configurationService);
|
|
@@ -1214,34 +1450,55 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1214
1450
|
options.fontFamily = DEFAULT_FONT_FAMILY;
|
|
1215
1451
|
options.fontSize = 13;
|
|
1216
1452
|
options.lineHeight = 20;
|
|
1217
|
-
options.padding = this.options.renderStyle ===
|
|
1453
|
+
options.padding = this.options.renderStyle === "compact" ? {
|
|
1454
|
+
top: 2,
|
|
1455
|
+
bottom: 2
|
|
1456
|
+
} : {
|
|
1457
|
+
top: 8,
|
|
1458
|
+
bottom: 8
|
|
1459
|
+
};
|
|
1218
1460
|
options.cursorWidth = 1;
|
|
1219
|
-
options.wrappingStrategy =
|
|
1220
|
-
options.bracketPairColorization = {
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
options.
|
|
1461
|
+
options.wrappingStrategy = "advanced";
|
|
1462
|
+
options.bracketPairColorization = {
|
|
1463
|
+
enabled: false
|
|
1464
|
+
};
|
|
1465
|
+
options.autoClosingBrackets = this.configurationService.getValue("editor.autoClosingBrackets");
|
|
1466
|
+
options.autoClosingQuotes = this.configurationService.getValue("editor.autoClosingQuotes");
|
|
1467
|
+
options.autoSurround = this.configurationService.getValue("editor.autoSurround");
|
|
1224
1468
|
options.suggest = {
|
|
1225
1469
|
showIcons: true,
|
|
1226
1470
|
showSnippets: false,
|
|
1227
1471
|
showWords: true,
|
|
1228
1472
|
showStatusBar: false,
|
|
1229
|
-
insertMode:
|
|
1473
|
+
insertMode: "insert"
|
|
1474
|
+
};
|
|
1475
|
+
options.scrollbar = {
|
|
1476
|
+
...(options.scrollbar ?? {}),
|
|
1477
|
+
vertical: "hidden"
|
|
1478
|
+
};
|
|
1479
|
+
options.stickyScroll = {
|
|
1480
|
+
enabled: false
|
|
1230
1481
|
};
|
|
1231
|
-
options.scrollbar = { ...(options.scrollbar ?? {}), vertical: 'hidden' };
|
|
1232
|
-
options.stickyScroll = { enabled: false };
|
|
1233
1482
|
this._inputEditorElement = append(editorContainer, $(chatInputEditorContainerSelector));
|
|
1234
1483
|
const editorOptions = getSimpleCodeEditorWidgetOptions();
|
|
1235
|
-
editorOptions.contributions?.push(...EditorExtensionsRegistry.getSomeEditorContributions([
|
|
1236
|
-
|
|
1484
|
+
editorOptions.contributions?.push(...EditorExtensionsRegistry.getSomeEditorContributions([
|
|
1485
|
+
ContentHoverController.ID,
|
|
1486
|
+
GlyphHoverController.ID,
|
|
1487
|
+
DropIntoEditorController.ID,
|
|
1488
|
+
CopyPasteController.ID,
|
|
1489
|
+
LinkDetector.ID
|
|
1490
|
+
]));
|
|
1491
|
+
this._inputEditor = this._register(
|
|
1492
|
+
scopedInstantiationService.createInstance(CodeEditorWidget, this._inputEditorElement, options, editorOptions)
|
|
1493
|
+
);
|
|
1237
1494
|
SuggestController.get(this._inputEditor)?.forceRenderingAbove();
|
|
1238
|
-
options.overflowWidgetsDomNode?.classList.add(
|
|
1239
|
-
this._inputEditorElement.classList.add(
|
|
1240
|
-
this._register(this._inputEditor.onKeyDown(
|
|
1495
|
+
options.overflowWidgetsDomNode?.classList.add("hideSuggestTextIcons");
|
|
1496
|
+
this._inputEditorElement.classList.add("hideSuggestTextIcons");
|
|
1497
|
+
this._register(this._inputEditor.onKeyDown(e => {
|
|
1241
1498
|
if (e.keyCode === KeyCode.Enter && !hasModifierKeys(e)) {
|
|
1242
1499
|
for (const keybinding of this.keybindingService.lookupKeybindings(ChatSubmitAction.ID)) {
|
|
1243
1500
|
const chords = keybinding.getDispatchChords();
|
|
1244
|
-
const isPlainEnter = chords.length === 1 && chords[0] ===
|
|
1501
|
+
const isPlainEnter = chords.length === 1 && chords[0] === "[Enter]";
|
|
1245
1502
|
if (isPlainEnter) {
|
|
1246
1503
|
e.preventDefault();
|
|
1247
1504
|
break;
|
|
@@ -1249,14 +1506,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1249
1506
|
}
|
|
1250
1507
|
}
|
|
1251
1508
|
}));
|
|
1252
|
-
this._register(this._inputEditor.onDidScrollChange(e => {
|
|
1253
|
-
toolbarsContainer.classList.toggle('scroll-top-decoration', e.scrollTop > 0);
|
|
1254
|
-
}));
|
|
1255
1509
|
this._register(this._inputEditor.onDidChangeModelContent(() => {
|
|
1256
1510
|
const currentHeight = Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight);
|
|
1257
1511
|
if (currentHeight !== this.inputEditorHeight) {
|
|
1258
1512
|
this.inputEditorHeight = currentHeight;
|
|
1259
|
-
this.
|
|
1513
|
+
if (this.cachedWidth) {
|
|
1514
|
+
this._layout(this.cachedWidth);
|
|
1515
|
+
}
|
|
1260
1516
|
}
|
|
1261
1517
|
const model = this._inputEditor.getModel();
|
|
1262
1518
|
const inputHasText = !!model && model.getValue().trim().length > 0;
|
|
@@ -1266,17 +1522,19 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1266
1522
|
this._register(this._inputEditor.onDidContentSizeChange(e => {
|
|
1267
1523
|
if (e.contentHeightChanged) {
|
|
1268
1524
|
this.inputEditorHeight = !this.inline ? e.contentHeight : this.inputEditorHeight;
|
|
1269
|
-
this.
|
|
1525
|
+
if (this.cachedWidth) {
|
|
1526
|
+
this._layout(this.cachedWidth);
|
|
1527
|
+
}
|
|
1270
1528
|
}
|
|
1271
1529
|
}));
|
|
1272
1530
|
this._register(this._inputEditor.onDidFocusEditorText(() => {
|
|
1273
1531
|
this.inputEditorHasFocus.set(true);
|
|
1274
1532
|
this._onDidFocus.fire();
|
|
1275
|
-
inputContainer.classList.toggle(
|
|
1533
|
+
inputContainer.classList.toggle("focused", true);
|
|
1276
1534
|
}));
|
|
1277
1535
|
this._register(this._inputEditor.onDidBlurEditorText(() => {
|
|
1278
1536
|
this.inputEditorHasFocus.set(false);
|
|
1279
|
-
inputContainer.classList.toggle(
|
|
1537
|
+
inputContainer.classList.toggle("focused", false);
|
|
1280
1538
|
this._onDidBlur.fire();
|
|
1281
1539
|
}));
|
|
1282
1540
|
this._register(this._inputEditor.onDidBlurEditorWidget(() => {
|
|
@@ -1284,93 +1542,186 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1284
1542
|
DropIntoEditorController.get(this._inputEditor)?.clearWidgets();
|
|
1285
1543
|
}));
|
|
1286
1544
|
const hoverDelegate = this._register(createInstantHoverDelegate());
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1545
|
+
const {
|
|
1546
|
+
location,
|
|
1547
|
+
isMaximized
|
|
1548
|
+
} = this.getWidgetLocationInfo(widget);
|
|
1549
|
+
const pickerOptions = {
|
|
1550
|
+
getOverflowAnchor: () => this.inputActionsToolbar.getElement(),
|
|
1551
|
+
actionContext: {
|
|
1552
|
+
widget
|
|
1553
|
+
},
|
|
1554
|
+
onlyShowIconsForDefaultActions: observableFromEvent(
|
|
1555
|
+
this._inputEditor.onDidLayoutChange,
|
|
1556
|
+
l => (l?.width ?? this._inputEditor.getLayoutInfo().width) < 650
|
|
1557
|
+
).recomputeInitiallyAndOnChange(this._store),
|
|
1558
|
+
hoverPosition: {
|
|
1559
|
+
forcePosition: true,
|
|
1560
|
+
hoverPosition: location === ChatWidgetLocation.SidebarRight && !isMaximized ? HoverPosition.LEFT : HoverPosition.RIGHT
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
this._register(
|
|
1564
|
+
addStandardDisposableListener(toolbarsContainer, EventType.CLICK, e => this.inputEditor.focus())
|
|
1565
|
+
);
|
|
1566
|
+
this._register(addStandardDisposableListener(
|
|
1567
|
+
this.attachmentsContainer,
|
|
1568
|
+
EventType.CLICK,
|
|
1569
|
+
e => this.inputEditor.focus()
|
|
1570
|
+
));
|
|
1571
|
+
this.inputActionsToolbar = this._register(this.instantiationService.createInstance(
|
|
1572
|
+
MenuWorkbenchToolBar,
|
|
1573
|
+
this.options.renderInputToolbarBelowInput ? this.attachmentsContainer : toolbarsContainer,
|
|
1574
|
+
MenuId.ChatInput,
|
|
1575
|
+
{
|
|
1576
|
+
telemetrySource: this.options.menus.telemetrySource,
|
|
1577
|
+
menuOptions: {
|
|
1578
|
+
shouldForwardArgs: true
|
|
1579
|
+
},
|
|
1580
|
+
hiddenItemStrategy: HiddenItemStrategy.NoHide,
|
|
1581
|
+
hoverDelegate,
|
|
1582
|
+
responsiveBehavior: {
|
|
1583
|
+
enabled: true,
|
|
1584
|
+
kind: "last",
|
|
1585
|
+
minItems: 1,
|
|
1586
|
+
actionMinWidth: 40
|
|
1587
|
+
},
|
|
1588
|
+
actionViewItemProvider: (action, options) => {
|
|
1589
|
+
if (action.id === OpenModelPickerAction.ID && action instanceof MenuItemAction) {
|
|
1590
|
+
if (!this._currentLanguageModel) {
|
|
1591
|
+
this.setCurrentLanguageModelToDefault();
|
|
1592
|
+
}
|
|
1593
|
+
const itemDelegate = {
|
|
1594
|
+
currentModel: this._currentLanguageModel,
|
|
1595
|
+
setModel: model => {
|
|
1596
|
+
this._waitForPersistedLanguageModel.clear();
|
|
1597
|
+
this.setCurrentLanguageModel(model);
|
|
1598
|
+
this.renderAttachedContext();
|
|
1599
|
+
},
|
|
1600
|
+
getModels: () => this.getModels()
|
|
1601
|
+
};
|
|
1602
|
+
return this.modelWidget = this.instantiationService.createInstance(ModelPickerActionItem, action, undefined, itemDelegate, pickerOptions);
|
|
1603
|
+
} else if (action.id === OpenModePickerAction.ID && action instanceof MenuItemAction) {
|
|
1604
|
+
const delegate = {
|
|
1605
|
+
currentMode: this._currentModeObservable,
|
|
1606
|
+
sessionResource: () => this._widget?.viewModel?.sessionResource,
|
|
1607
|
+
customAgentTarget: () => {
|
|
1608
|
+
const sessionResource = this._widget?.viewModel?.model.sessionResource;
|
|
1609
|
+
const ctx = sessionResource && this.chatService.getChatSessionFromInternalUri(sessionResource);
|
|
1610
|
+
return ctx && this.chatSessionsService.getCustomAgentTargetForSessionType(ctx.chatSessionType);
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
return this.modeWidget = this.instantiationService.createInstance(ModePickerActionItem, action, delegate, pickerOptions);
|
|
1614
|
+
} else if ((action.id === OpenSessionTargetPickerAction.ID || action.id === OpenDelegationPickerAction.ID) && action instanceof MenuItemAction) {
|
|
1615
|
+
const getActiveSessionType = () => {
|
|
1616
|
+
const sessionResource = this._widget?.viewModel?.sessionResource;
|
|
1617
|
+
return sessionResource ? getAgentSessionProvider(sessionResource) : undefined;
|
|
1618
|
+
};
|
|
1619
|
+
const delegate = this.options.sessionTypePickerDelegate ?? {
|
|
1620
|
+
getActiveSessionProvider: () => {
|
|
1621
|
+
return getActiveSessionType();
|
|
1622
|
+
},
|
|
1623
|
+
getPendingDelegationTarget: () => {
|
|
1624
|
+
return this._pendingDelegationTarget;
|
|
1625
|
+
},
|
|
1626
|
+
setPendingDelegationTarget: provider => {
|
|
1627
|
+
const isActive = getActiveSessionType() === provider;
|
|
1628
|
+
this._pendingDelegationTarget = isActive ? undefined : provider;
|
|
1629
|
+
this.updateWidgetLockStateFromSessionType(provider);
|
|
1630
|
+
this.updateAgentSessionTypeContextKey();
|
|
1631
|
+
this.refreshChatSessionPickers();
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
const isWelcomeViewMode = !!this.options.sessionTypePickerDelegate?.setActiveSessionProvider;
|
|
1635
|
+
const Picker = (action.id === OpenSessionTargetPickerAction.ID || isWelcomeViewMode) ? SessionTypePickerActionItem : DelegationSessionPickerActionItem;
|
|
1636
|
+
return this.sessionTargetWidget = this.instantiationService.createInstance(
|
|
1637
|
+
Picker,
|
|
1638
|
+
action,
|
|
1639
|
+
location === ChatWidgetLocation.Editor ? "editor" : "sidebar",
|
|
1640
|
+
delegate,
|
|
1641
|
+
pickerOptions
|
|
1642
|
+
);
|
|
1643
|
+
} else if (action.id === OpenWorkspacePickerAction.ID && action instanceof MenuItemAction) {
|
|
1644
|
+
if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY && this.options.workspacePickerDelegate) {
|
|
1645
|
+
return this.instantiationService.createInstance(
|
|
1646
|
+
WorkspacePickerActionItem,
|
|
1647
|
+
action,
|
|
1648
|
+
this.options.workspacePickerDelegate,
|
|
1649
|
+
pickerOptions
|
|
1650
|
+
);
|
|
1651
|
+
} else {
|
|
1652
|
+
const empty = ( new BaseActionViewItem(undefined, action));
|
|
1653
|
+
if (empty.element) {
|
|
1654
|
+
empty.element.style.display = "none";
|
|
1655
|
+
}
|
|
1656
|
+
return empty;
|
|
1657
|
+
}
|
|
1658
|
+
} else if (action.id === ChatSessionPrimaryPickerAction.ID && action instanceof MenuItemAction) {
|
|
1659
|
+
const widgets = this.createChatSessionPickerWidgets(action);
|
|
1660
|
+
if (widgets.length === 0) {
|
|
1661
|
+
return undefined;
|
|
1662
|
+
}
|
|
1663
|
+
return this.instantiationService.createInstance(ChatSessionPickersContainerActionItem, action, widgets);
|
|
1322
1664
|
}
|
|
1323
|
-
return
|
|
1665
|
+
return undefined;
|
|
1324
1666
|
}
|
|
1325
|
-
return undefined;
|
|
1326
1667
|
}
|
|
1327
|
-
|
|
1328
|
-
this.inputActionsToolbar.getElement().classList.add(
|
|
1329
|
-
this.inputActionsToolbar.context = {
|
|
1668
|
+
));
|
|
1669
|
+
this.inputActionsToolbar.getElement().classList.add("chat-input-toolbar");
|
|
1670
|
+
this.inputActionsToolbar.context = {
|
|
1671
|
+
widget
|
|
1672
|
+
};
|
|
1330
1673
|
this._register(this.inputActionsToolbar.onDidChangeMenuItems(() => {
|
|
1331
1674
|
const toolbarElement = this.inputActionsToolbar.getElement();
|
|
1332
|
-
const container = toolbarElement.querySelector(
|
|
1675
|
+
const container = toolbarElement.querySelector(".chat-sessionPicker-container");
|
|
1333
1676
|
this.chatSessionPickerContainer = container;
|
|
1334
|
-
if (this.
|
|
1335
|
-
this.layout(this.
|
|
1677
|
+
if (this.cachedWidth && typeof this.cachedInputToolbarWidth === "number" && this.cachedInputToolbarWidth !== this.inputActionsToolbar.getItemsWidth()) {
|
|
1678
|
+
this.layout(this.cachedWidth);
|
|
1336
1679
|
}
|
|
1337
1680
|
}));
|
|
1338
|
-
this.executeToolbar = this._register(this.instantiationService.createInstance(
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
return undefined;
|
|
1681
|
+
this.executeToolbar = this._register(this.instantiationService.createInstance(
|
|
1682
|
+
MenuWorkbenchToolBar,
|
|
1683
|
+
toolbarsContainer,
|
|
1684
|
+
this.options.menus.executeToolbar,
|
|
1685
|
+
{
|
|
1686
|
+
telemetrySource: this.options.menus.telemetrySource,
|
|
1687
|
+
menuOptions: {
|
|
1688
|
+
shouldForwardArgs: true
|
|
1689
|
+
},
|
|
1690
|
+
hoverDelegate,
|
|
1691
|
+
hiddenItemStrategy: HiddenItemStrategy.NoHide
|
|
1350
1692
|
}
|
|
1351
|
-
|
|
1352
|
-
this.executeToolbar.getElement().classList.add(
|
|
1353
|
-
this.executeToolbar.context = {
|
|
1693
|
+
));
|
|
1694
|
+
this.executeToolbar.getElement().classList.add("chat-execute-toolbar");
|
|
1695
|
+
this.executeToolbar.context = {
|
|
1696
|
+
widget
|
|
1697
|
+
};
|
|
1354
1698
|
this._register(this.executeToolbar.onDidChangeMenuItems(() => {
|
|
1355
|
-
if (this.
|
|
1356
|
-
this.layout(this.
|
|
1699
|
+
if (this.cachedWidth && typeof this.cachedExecuteToolbarWidth === "number" && this.cachedExecuteToolbarWidth !== this.executeToolbar.getItemsWidth()) {
|
|
1700
|
+
this.layout(this.cachedWidth);
|
|
1357
1701
|
}
|
|
1358
1702
|
}));
|
|
1359
1703
|
if (this.options.menus.inputSideToolbar) {
|
|
1360
|
-
const toolbarSide = this._register(this.instantiationService.createInstance(
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1704
|
+
const toolbarSide = this._register(this.instantiationService.createInstance(
|
|
1705
|
+
MenuWorkbenchToolBar,
|
|
1706
|
+
inputAndSideToolbar,
|
|
1707
|
+
this.options.menus.inputSideToolbar,
|
|
1708
|
+
{
|
|
1709
|
+
telemetrySource: this.options.menus.telemetrySource,
|
|
1710
|
+
menuOptions: {
|
|
1711
|
+
shouldForwardArgs: true
|
|
1712
|
+
},
|
|
1713
|
+
hoverDelegate
|
|
1714
|
+
}
|
|
1715
|
+
));
|
|
1367
1716
|
this.inputSideToolbarContainer = toolbarSide.getElement();
|
|
1368
|
-
toolbarSide.getElement().classList.add(
|
|
1369
|
-
toolbarSide.context = {
|
|
1717
|
+
toolbarSide.getElement().classList.add("chat-side-toolbar");
|
|
1718
|
+
toolbarSide.context = {
|
|
1719
|
+
widget
|
|
1720
|
+
};
|
|
1370
1721
|
}
|
|
1371
1722
|
let inputModel = this.modelService.getModel(this.inputUri);
|
|
1372
1723
|
if (!inputModel) {
|
|
1373
|
-
inputModel = this.modelService.createModel(
|
|
1724
|
+
inputModel = this.modelService.createModel("", null, this.inputUri, true);
|
|
1374
1725
|
}
|
|
1375
1726
|
this.textModelResolverService.createModelReference(this.inputUri).then(ref => {
|
|
1376
1727
|
if (this._store.isDisposed) {
|
|
@@ -1380,12 +1731,20 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1380
1731
|
this._register(ref);
|
|
1381
1732
|
});
|
|
1382
1733
|
this.inputModel = inputModel;
|
|
1383
|
-
this.inputModel.updateOptions({
|
|
1734
|
+
this.inputModel.updateOptions({
|
|
1735
|
+
bracketColorizationOptions: {
|
|
1736
|
+
enabled: false,
|
|
1737
|
+
independentColorPoolPerBracketType: false
|
|
1738
|
+
}
|
|
1739
|
+
});
|
|
1384
1740
|
this._inputEditor.setModel(this.inputModel);
|
|
1385
1741
|
if (initialValue) {
|
|
1386
1742
|
this.inputModel.setValue(initialValue);
|
|
1387
1743
|
const lineNumber = this.inputModel.getLineCount();
|
|
1388
|
-
this._inputEditor.setPosition({
|
|
1744
|
+
this._inputEditor.setPosition({
|
|
1745
|
+
lineNumber,
|
|
1746
|
+
column: this.inputModel.getLineMaxColumn(lineNumber)
|
|
1747
|
+
});
|
|
1389
1748
|
}
|
|
1390
1749
|
const onDidChangeCursorPosition = () => {
|
|
1391
1750
|
const model = this._inputEditor.getModel();
|
|
@@ -1402,114 +1761,229 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1402
1761
|
this.historyNavigationForewardsEnablement.set(position.equals(getLastPosition(model)));
|
|
1403
1762
|
this._syncInputStateToModel();
|
|
1404
1763
|
};
|
|
1405
|
-
this._register(
|
|
1764
|
+
this._register(
|
|
1765
|
+
this._inputEditor.onDidChangeCursorPosition(e => onDidChangeCursorPosition())
|
|
1766
|
+
);
|
|
1406
1767
|
onDidChangeCursorPosition();
|
|
1407
1768
|
this._register(this.themeService.onDidFileIconThemeChange(() => {
|
|
1408
1769
|
this.renderAttachedContext();
|
|
1409
1770
|
}));
|
|
1410
|
-
this.addFilesToolbar = this._register(this.instantiationService.createInstance(
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1771
|
+
this.addFilesToolbar = this._register(this.instantiationService.createInstance(
|
|
1772
|
+
MenuWorkbenchToolBar,
|
|
1773
|
+
attachmentToolbarContainer,
|
|
1774
|
+
MenuId.ChatInputAttachmentToolbar,
|
|
1775
|
+
{
|
|
1776
|
+
telemetrySource: this.options.menus.telemetrySource,
|
|
1777
|
+
label: true,
|
|
1778
|
+
menuOptions: {
|
|
1779
|
+
shouldForwardArgs: true,
|
|
1780
|
+
renderShortTitle: true
|
|
1781
|
+
},
|
|
1782
|
+
hiddenItemStrategy: HiddenItemStrategy.NoHide,
|
|
1783
|
+
hoverDelegate,
|
|
1784
|
+
actionViewItemProvider: (action, options) => {
|
|
1785
|
+
if (action.id === "workbench.action.chat.attachContext") {
|
|
1786
|
+
const viewItem = this.instantiationService.createInstance(AddFilesButton, this._attachmentModel, action, options);
|
|
1787
|
+
viewItem.setShowLabel(
|
|
1788
|
+
this._attachmentModel.size === 0 && !this._implicitContextWidget.value?.hasRenderedContexts
|
|
1789
|
+
);
|
|
1790
|
+
this.addFilesButton = viewItem;
|
|
1791
|
+
return this.addFilesButton;
|
|
1792
|
+
}
|
|
1793
|
+
return undefined;
|
|
1422
1794
|
}
|
|
1423
|
-
return undefined;
|
|
1424
1795
|
}
|
|
1425
|
-
|
|
1426
|
-
this.addFilesToolbar.context = {
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
}
|
|
1431
|
-
}));
|
|
1796
|
+
));
|
|
1797
|
+
this.addFilesToolbar.context = {
|
|
1798
|
+
widget,
|
|
1799
|
+
placeholder: ( localize(6075, "Search for files and context to add to your request"))
|
|
1800
|
+
};
|
|
1432
1801
|
this.renderAttachedContext();
|
|
1802
|
+
const inputResizeObserver = this._register(new DisposableResizeObserver(() => {
|
|
1803
|
+
const newHeight = this.container.offsetHeight;
|
|
1804
|
+
this.height.set(newHeight, undefined);
|
|
1805
|
+
}));
|
|
1806
|
+
this._register(inputResizeObserver.observe(this.container));
|
|
1807
|
+
if (this.options.renderStyle === "compact" && this.options.isQuickChat) {
|
|
1808
|
+
const toolbarsResizeObserver = this._register(new DisposableResizeObserver(() => {
|
|
1809
|
+
if (this.cachedWidth) {
|
|
1810
|
+
this.layout(this.cachedWidth);
|
|
1811
|
+
}
|
|
1812
|
+
}));
|
|
1813
|
+
this._register(toolbarsResizeObserver.observe(toolbarsContainer));
|
|
1814
|
+
}
|
|
1433
1815
|
}
|
|
1434
1816
|
toggleChatInputOverlay(editing) {
|
|
1435
|
-
this.chatInputOverlay.classList.toggle(
|
|
1817
|
+
this.chatInputOverlay.classList.toggle("disabled", editing);
|
|
1436
1818
|
if (editing) {
|
|
1437
1819
|
this.overlayClickListener.value = addStandardDisposableListener(this.chatInputOverlay, EventType.CLICK, e => {
|
|
1438
1820
|
e.preventDefault();
|
|
1439
1821
|
e.stopPropagation();
|
|
1440
1822
|
this._onDidClickOverlay.fire();
|
|
1441
1823
|
});
|
|
1442
|
-
}
|
|
1443
|
-
else {
|
|
1824
|
+
} else {
|
|
1444
1825
|
this.overlayClickListener.clear();
|
|
1445
1826
|
}
|
|
1446
1827
|
}
|
|
1447
1828
|
renderAttachedContext() {
|
|
1448
1829
|
const container = this.attachedContextContainer;
|
|
1449
|
-
const oldHeight = this.attachmentsContainer.offsetHeight;
|
|
1450
1830
|
const store = ( new DisposableStore());
|
|
1451
1831
|
this.attachedContextDisposables.value = store;
|
|
1452
1832
|
clearNode(container);
|
|
1453
|
-
store.add(
|
|
1454
|
-
this.
|
|
1455
|
-
|
|
1833
|
+
store.add(
|
|
1834
|
+
addStandardDisposableListener(this.attachmentsContainer, EventType.KEY_DOWN, e => {
|
|
1835
|
+
this.handleAttachmentNavigation(e);
|
|
1836
|
+
})
|
|
1837
|
+
);
|
|
1456
1838
|
const attachments = [...this.attachmentModel.attachments.entries()];
|
|
1457
|
-
const hasAttachments = Boolean(attachments.length) || Boolean(this.implicitContext?.
|
|
1458
|
-
setVisibility(Boolean(
|
|
1839
|
+
const hasAttachments = Boolean(attachments.length) || Boolean(this.implicitContext?.hasValue);
|
|
1840
|
+
setVisibility(Boolean(
|
|
1841
|
+
this.options.renderInputToolbarBelowInput || hasAttachments || (this.addFilesToolbar && !this.addFilesToolbar.isEmpty())
|
|
1842
|
+
), this.attachmentsContainer);
|
|
1459
1843
|
setVisibility(hasAttachments, this.attachedContextContainer);
|
|
1460
1844
|
if (!attachments.length) {
|
|
1461
1845
|
this._indexOfLastAttachedContextDeletedWithKeyboard = -1;
|
|
1462
1846
|
this._indexOfLastOpenedContext = -1;
|
|
1463
1847
|
}
|
|
1464
|
-
const isSuggestedEnabled = this.configurationService.getValue(
|
|
1465
|
-
if (this.implicitContext?.value && !isSuggestedEnabled) {
|
|
1466
|
-
const implicitPart = store.add(this.instantiationService.createInstance(ImplicitContextAttachmentWidget, () => this._widget, this.implicitContext, this._contextResourceLabels, this.attachmentModel));
|
|
1467
|
-
container.appendChild(implicitPart.domNode);
|
|
1468
|
-
}
|
|
1848
|
+
const isSuggestedEnabled = this.configurationService.getValue("chat.implicitContext.suggestedContext");
|
|
1469
1849
|
for (const [index, attachment] of attachments) {
|
|
1470
1850
|
const resource = URI.isUri(attachment.value) ? attachment.value : isLocation(attachment.value) ? attachment.value.uri : undefined;
|
|
1471
1851
|
const range = isLocation(attachment.value) ? attachment.value.range : undefined;
|
|
1472
|
-
const shouldFocusClearButton = index === Math.min(
|
|
1852
|
+
const shouldFocusClearButton = index === Math.min(
|
|
1853
|
+
this._indexOfLastAttachedContextDeletedWithKeyboard,
|
|
1854
|
+
this.attachmentModel.size - 1
|
|
1855
|
+
) && this._indexOfLastAttachedContextDeletedWithKeyboard > -1;
|
|
1473
1856
|
let attachmentWidget;
|
|
1474
|
-
const options = {
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1857
|
+
const options = {
|
|
1858
|
+
shouldFocusClearButton,
|
|
1859
|
+
supportsDeletion: true
|
|
1860
|
+
};
|
|
1861
|
+
const lm = this._currentLanguageModel.get();
|
|
1862
|
+
if (attachment.kind === "tool" || attachment.kind === "toolset") {
|
|
1863
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1864
|
+
ToolSetOrToolItemAttachmentWidget,
|
|
1865
|
+
attachment,
|
|
1866
|
+
lm,
|
|
1867
|
+
options,
|
|
1868
|
+
container,
|
|
1869
|
+
this._contextResourceLabels
|
|
1870
|
+
);
|
|
1871
|
+
} else if (resource && isNotebookOutputVariableEntry(attachment)) {
|
|
1872
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1873
|
+
NotebookCellOutputChatAttachmentWidget,
|
|
1874
|
+
resource,
|
|
1875
|
+
attachment,
|
|
1876
|
+
lm,
|
|
1877
|
+
options,
|
|
1878
|
+
container,
|
|
1879
|
+
this._contextResourceLabels
|
|
1880
|
+
);
|
|
1881
|
+
} else if (isPromptFileVariableEntry(attachment)) {
|
|
1882
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1883
|
+
PromptFileAttachmentWidget,
|
|
1884
|
+
attachment,
|
|
1885
|
+
lm,
|
|
1886
|
+
options,
|
|
1887
|
+
container,
|
|
1888
|
+
this._contextResourceLabels
|
|
1889
|
+
);
|
|
1890
|
+
} else if (isPromptTextVariableEntry(attachment)) {
|
|
1891
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1892
|
+
PromptTextAttachmentWidget,
|
|
1893
|
+
attachment,
|
|
1894
|
+
undefined,
|
|
1895
|
+
options,
|
|
1896
|
+
container,
|
|
1897
|
+
this._contextResourceLabels
|
|
1898
|
+
);
|
|
1899
|
+
} else if (resource && (attachment.kind === "file" || attachment.kind === "directory")) {
|
|
1900
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1901
|
+
FileAttachmentWidget,
|
|
1902
|
+
resource,
|
|
1903
|
+
range,
|
|
1904
|
+
attachment,
|
|
1905
|
+
undefined,
|
|
1906
|
+
lm,
|
|
1907
|
+
options,
|
|
1908
|
+
container,
|
|
1909
|
+
this._contextResourceLabels
|
|
1910
|
+
);
|
|
1911
|
+
} else if (attachment.kind === "terminalCommand") {
|
|
1912
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1913
|
+
TerminalCommandAttachmentWidget,
|
|
1914
|
+
attachment,
|
|
1915
|
+
lm,
|
|
1916
|
+
options,
|
|
1917
|
+
container,
|
|
1918
|
+
this._contextResourceLabels
|
|
1919
|
+
);
|
|
1920
|
+
} else if (isImageVariableEntry(attachment)) {
|
|
1921
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1922
|
+
ImageAttachmentWidget,
|
|
1923
|
+
resource,
|
|
1924
|
+
attachment,
|
|
1925
|
+
lm,
|
|
1926
|
+
options,
|
|
1927
|
+
container,
|
|
1928
|
+
this._contextResourceLabels
|
|
1929
|
+
);
|
|
1930
|
+
} else if (isElementVariableEntry(attachment)) {
|
|
1931
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1932
|
+
ElementChatAttachmentWidget,
|
|
1933
|
+
attachment,
|
|
1934
|
+
lm,
|
|
1935
|
+
options,
|
|
1936
|
+
container,
|
|
1937
|
+
this._contextResourceLabels
|
|
1938
|
+
);
|
|
1939
|
+
} else if (isPasteVariableEntry(attachment)) {
|
|
1940
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1941
|
+
PasteAttachmentWidget,
|
|
1942
|
+
attachment,
|
|
1943
|
+
lm,
|
|
1944
|
+
options,
|
|
1945
|
+
container,
|
|
1946
|
+
this._contextResourceLabels
|
|
1947
|
+
);
|
|
1948
|
+
} else if (isSCMHistoryItemVariableEntry(attachment)) {
|
|
1949
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1950
|
+
SCMHistoryItemAttachmentWidget,
|
|
1951
|
+
attachment,
|
|
1952
|
+
lm,
|
|
1953
|
+
options,
|
|
1954
|
+
container,
|
|
1955
|
+
this._contextResourceLabels
|
|
1956
|
+
);
|
|
1957
|
+
} else if (isSCMHistoryItemChangeVariableEntry(attachment)) {
|
|
1958
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1959
|
+
SCMHistoryItemChangeAttachmentWidget,
|
|
1960
|
+
attachment,
|
|
1961
|
+
lm,
|
|
1962
|
+
options,
|
|
1963
|
+
container,
|
|
1964
|
+
this._contextResourceLabels
|
|
1965
|
+
);
|
|
1966
|
+
} else if (isSCMHistoryItemChangeRangeVariableEntry(attachment)) {
|
|
1967
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1968
|
+
SCMHistoryItemChangeRangeAttachmentWidget,
|
|
1969
|
+
attachment,
|
|
1970
|
+
lm,
|
|
1971
|
+
options,
|
|
1972
|
+
container,
|
|
1973
|
+
this._contextResourceLabels
|
|
1974
|
+
);
|
|
1975
|
+
} else {
|
|
1976
|
+
attachmentWidget = this.instantiationService.createInstance(
|
|
1977
|
+
DefaultChatAttachmentWidget,
|
|
1978
|
+
resource,
|
|
1979
|
+
range,
|
|
1980
|
+
attachment,
|
|
1981
|
+
undefined,
|
|
1982
|
+
lm,
|
|
1983
|
+
options,
|
|
1984
|
+
container,
|
|
1985
|
+
this._contextResourceLabels
|
|
1986
|
+
);
|
|
1513
1987
|
}
|
|
1514
1988
|
if (shouldFocusClearButton) {
|
|
1515
1989
|
attachmentWidget.element.focus();
|
|
@@ -1525,55 +1999,43 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1525
1999
|
this.handleAttachmentOpen(index, attachment);
|
|
1526
2000
|
}));
|
|
1527
2001
|
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
container
|
|
1537
|
-
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
2002
|
+
if (isSuggestedEnabled && this.implicitContext?.hasValue) {
|
|
2003
|
+
this._implicitContextWidget.value = this.instantiationService.createInstance(
|
|
2004
|
+
ImplicitContextAttachmentWidget,
|
|
2005
|
+
() => this._widget,
|
|
2006
|
+
(targetUri, targetRange, targetHandle) => this.isAttachmentAlreadyAttached(targetUri, targetRange, targetHandle, ( attachments.map(([, a]) => a))),
|
|
2007
|
+
this.implicitContext,
|
|
2008
|
+
this._contextResourceLabels,
|
|
2009
|
+
this._attachmentModel,
|
|
2010
|
+
container
|
|
2011
|
+
);
|
|
2012
|
+
} else {
|
|
2013
|
+
this._implicitContextWidget.clear();
|
|
2014
|
+
}
|
|
2015
|
+
this.addFilesButton?.setShowLabel(
|
|
2016
|
+
this._attachmentModel.size === 0 && !this._implicitContextWidget.value?.hasRenderedContexts
|
|
2017
|
+
);
|
|
1543
2018
|
this._indexOfLastOpenedContext = -1;
|
|
1544
2019
|
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
if (!implicit) {
|
|
1548
|
-
return false;
|
|
1549
|
-
}
|
|
1550
|
-
const isSuggestedEnabled = this.configurationService.getValue('chat.implicitContext.suggestedContext');
|
|
1551
|
-
if (!isSuggestedEnabled) {
|
|
1552
|
-
return true;
|
|
1553
|
-
}
|
|
1554
|
-
const isUri = URI.isUri(implicit);
|
|
1555
|
-
if (isUri || isLocation(implicit)) {
|
|
1556
|
-
const targetUri = isUri ? implicit : implicit.uri;
|
|
1557
|
-
const targetRange = isLocation(implicit) ? implicit.range : undefined;
|
|
1558
|
-
const attachments = [...( this._attachmentModel.attachments.values())];
|
|
1559
|
-
const currentlyAttached = this.isAttachmentAlreadyAttached(targetUri, targetRange, attachments);
|
|
1560
|
-
return !currentlyAttached;
|
|
1561
|
-
}
|
|
1562
|
-
return false;
|
|
1563
|
-
}
|
|
1564
|
-
isAttachmentAlreadyAttached(targetUri, targetRange, attachments) {
|
|
1565
|
-
return ( attachments.some((attachment) => {
|
|
2020
|
+
isAttachmentAlreadyAttached(targetUri, targetRange, targetHandle, attachments) {
|
|
2021
|
+
return ( attachments.some(attachment => {
|
|
1566
2022
|
let uri;
|
|
1567
2023
|
let range;
|
|
2024
|
+
let handle;
|
|
1568
2025
|
if (URI.isUri(attachment.value)) {
|
|
1569
2026
|
uri = attachment.value;
|
|
1570
|
-
}
|
|
1571
|
-
else if (isLocation(attachment.value)) {
|
|
2027
|
+
} else if (isLocation(attachment.value)) {
|
|
1572
2028
|
uri = attachment.value.uri;
|
|
1573
2029
|
range = attachment.value.range;
|
|
1574
|
-
}
|
|
1575
|
-
else if (isStringVariableEntry(attachment)) {
|
|
2030
|
+
} else if (isStringVariableEntry(attachment)) {
|
|
1576
2031
|
uri = attachment.uri;
|
|
2032
|
+
handle = attachment.handle;
|
|
2033
|
+
}
|
|
2034
|
+
if ((handle !== undefined && targetHandle === undefined) || (handle === undefined && targetHandle !== undefined)) {
|
|
2035
|
+
return false;
|
|
2036
|
+
}
|
|
2037
|
+
if (handle !== undefined && targetHandle !== undefined && handle !== targetHandle) {
|
|
2038
|
+
return false;
|
|
1577
2039
|
}
|
|
1578
2040
|
if (!uri || !isEqual(uri, targetUri)) {
|
|
1579
2041
|
return false;
|
|
@@ -1589,16 +2051,20 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1589
2051
|
this._indexOfLastAttachedContextDeletedWithKeyboard = index;
|
|
1590
2052
|
}
|
|
1591
2053
|
this._attachmentModel.delete(attachment.id);
|
|
1592
|
-
if (this.configurationService.getValue(
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
|
|
2054
|
+
if (this.configurationService.getValue("chat.implicitContext.enableImplicitContext")) {
|
|
2055
|
+
for (const implicitContext of (this._implicitContext?.values || [])) {
|
|
2056
|
+
const implicitValue = URI.isUri(implicitContext?.value) && URI.isUri(attachment.value) && isEqual(implicitContext.value, attachment.value);
|
|
2057
|
+
if (implicitContext?.isFile && implicitValue) {
|
|
2058
|
+
implicitContext.enabled = false;
|
|
2059
|
+
}
|
|
1596
2060
|
}
|
|
1597
2061
|
}
|
|
1598
2062
|
if (this._attachmentModel.size === 0) {
|
|
1599
2063
|
this.focus();
|
|
1600
2064
|
}
|
|
1601
|
-
this._onDidChangeContext.fire({
|
|
2065
|
+
this._onDidChangeContext.fire({
|
|
2066
|
+
removed: [attachment]
|
|
2067
|
+
});
|
|
1602
2068
|
this.renderAttachedContext();
|
|
1603
2069
|
}
|
|
1604
2070
|
handleAttachmentOpen(index, attachment) {
|
|
@@ -1612,11 +2078,13 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1612
2078
|
if (!e.equals(KeyCode.LeftArrow) && !e.equals(KeyCode.RightArrow)) {
|
|
1613
2079
|
return;
|
|
1614
2080
|
}
|
|
1615
|
-
const toolbar = this.addFilesToolbar?.getElement().querySelector(
|
|
2081
|
+
const toolbar = this.addFilesToolbar?.getElement().querySelector(".action-label");
|
|
1616
2082
|
if (!toolbar) {
|
|
1617
2083
|
return;
|
|
1618
2084
|
}
|
|
1619
|
-
const attachments = Array.from(
|
|
2085
|
+
const attachments = Array.from(
|
|
2086
|
+
this.attachedContextContainer.querySelectorAll(".chat-attached-context-attachment")
|
|
2087
|
+
);
|
|
1620
2088
|
if (!attachments.length) {
|
|
1621
2089
|
return;
|
|
1622
2090
|
}
|
|
@@ -1626,8 +2094,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1626
2094
|
let newIndex = currentIndex;
|
|
1627
2095
|
if (e.equals(KeyCode.LeftArrow)) {
|
|
1628
2096
|
newIndex = currentIndex > 0 ? currentIndex - 1 : attachments.length - 1;
|
|
1629
|
-
}
|
|
1630
|
-
else if (e.equals(KeyCode.RightArrow)) {
|
|
2097
|
+
} else if (e.equals(KeyCode.RightArrow)) {
|
|
1631
2098
|
newIndex = currentIndex < attachments.length - 1 ? currentIndex + 1 : 0;
|
|
1632
2099
|
}
|
|
1633
2100
|
if (newIndex !== -1) {
|
|
@@ -1647,15 +2114,15 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1647
2114
|
this._chatInputTodoListWidget.value = widget;
|
|
1648
2115
|
clearNode(this.chatInputTodoListWidgetContainer);
|
|
1649
2116
|
append(this.chatInputTodoListWidgetContainer, widget.domNode);
|
|
1650
|
-
this._chatEditingTodosDisposables.add(widget.onDidChangeHeight(() => {
|
|
1651
|
-
this._onDidChangeHeight.fire();
|
|
1652
|
-
}));
|
|
1653
2117
|
}
|
|
1654
2118
|
this._chatInputTodoListWidget.value.render(chatSessionResource);
|
|
1655
2119
|
}
|
|
1656
2120
|
clearTodoListWidget(sessionResource, force) {
|
|
1657
2121
|
this._chatInputTodoListWidget.value?.clear(sessionResource, force);
|
|
1658
2122
|
}
|
|
2123
|
+
setWorkingSetCollapsed(collapsed) {
|
|
2124
|
+
this._workingSetCollapsed.set(collapsed, undefined);
|
|
2125
|
+
}
|
|
1659
2126
|
renderChatEditingSessionState(chatEditingSession) {
|
|
1660
2127
|
setVisibility(Boolean(chatEditingSession), this.chatEditingSessionWidgetContainer);
|
|
1661
2128
|
if (chatEditingSession) {
|
|
@@ -1664,10 +2131,16 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1664
2131
|
}
|
|
1665
2132
|
this._lastEditingSessionResource = chatEditingSession.chatSessionResource;
|
|
1666
2133
|
}
|
|
1667
|
-
const modifiedEntries = derivedOpts({
|
|
2134
|
+
const modifiedEntries = derivedOpts({
|
|
2135
|
+
equalsFn: equals
|
|
2136
|
+
}, r => {
|
|
2137
|
+
const sessionResource = chatEditingSession?.chatSessionResource ?? this._widget?.viewModel?.model.sessionResource;
|
|
2138
|
+
if (sessionResource && getChatSessionType(sessionResource) === AgentSessionProviders.Background) {
|
|
2139
|
+
return [];
|
|
2140
|
+
}
|
|
1668
2141
|
return chatEditingSession?.entries.read(r).filter(entry => entry.state.read(r) === ModifiedFileEntryState.Modified) || [];
|
|
1669
2142
|
});
|
|
1670
|
-
const editSessionEntries = derived(
|
|
2143
|
+
const editSessionEntries = derived(reader => {
|
|
1671
2144
|
const seenEntries = ( new ResourceSet());
|
|
1672
2145
|
const entries = [];
|
|
1673
2146
|
for (const entry of modifiedEntries.read(reader)) {
|
|
@@ -1681,16 +2154,21 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1681
2154
|
entries.push({
|
|
1682
2155
|
reference: entry.modifiedURI,
|
|
1683
2156
|
state: ModifiedFileEntryState.Modified,
|
|
1684
|
-
kind:
|
|
2157
|
+
kind: "reference",
|
|
1685
2158
|
options: {
|
|
1686
2159
|
status: undefined,
|
|
1687
|
-
diffMeta: {
|
|
2160
|
+
diffMeta: {
|
|
2161
|
+
added: linesAdded ?? 0,
|
|
2162
|
+
removed: linesRemoved ?? 0
|
|
2163
|
+
},
|
|
2164
|
+
isDeletion: !!entry.isDeletion,
|
|
2165
|
+
originalUri: entry.isDeletion ? entry.originalURI : undefined
|
|
1688
2166
|
}
|
|
1689
2167
|
});
|
|
1690
2168
|
}
|
|
1691
2169
|
}
|
|
1692
2170
|
entries.sort((a, b) => {
|
|
1693
|
-
if (a.kind ===
|
|
2171
|
+
if (a.kind === "reference" && b.kind === "reference") {
|
|
1694
2172
|
if (a.state === b.state || a.state === undefined || b.state === undefined) {
|
|
1695
2173
|
return ( a.reference.toString()).localeCompare(( b.reference.toString()));
|
|
1696
2174
|
}
|
|
@@ -1708,104 +2186,140 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1708
2186
|
const model = this.agentSessionsService.getSession(sessionResource);
|
|
1709
2187
|
return model?.changes instanceof Array ? model.changes : Iterable.empty();
|
|
1710
2188
|
});
|
|
1711
|
-
const sessionFiles = derived(reader => ( sessionFileChanges.read(reader).map(
|
|
1712
|
-
reference: entry.modifiedUri,
|
|
2189
|
+
const sessionFiles = derived(reader => ( sessionFileChanges.read(reader).map(entry => ({
|
|
2190
|
+
reference: isIChatSessionFileChange2(entry) ? entry.modifiedUri ?? entry.uri : entry.modifiedUri,
|
|
1713
2191
|
state: ModifiedFileEntryState.Accepted,
|
|
1714
|
-
kind:
|
|
2192
|
+
kind: "reference",
|
|
1715
2193
|
options: {
|
|
1716
|
-
|
|
1717
|
-
|
|
2194
|
+
diffMeta: {
|
|
2195
|
+
added: entry.insertions,
|
|
2196
|
+
removed: entry.deletions
|
|
2197
|
+
},
|
|
2198
|
+
isDeletion: entry.modifiedUri === undefined,
|
|
1718
2199
|
originalUri: entry.originalUri,
|
|
2200
|
+
status: undefined
|
|
1719
2201
|
}
|
|
1720
2202
|
}))));
|
|
1721
|
-
const shouldRender = derived(
|
|
2203
|
+
const shouldRender = derived(
|
|
2204
|
+
reader => editSessionEntries.read(reader).length > 0 || sessionFiles.read(reader).length > 0
|
|
2205
|
+
);
|
|
1722
2206
|
this._renderingChatEdits.value = autorun(reader => {
|
|
1723
2207
|
if (this.options.renderWorkingSet && shouldRender.read(reader)) {
|
|
1724
|
-
this.renderChatEditingSessionWithEntries(reader.store, chatEditingSession,
|
|
1725
|
-
}
|
|
1726
|
-
else {
|
|
2208
|
+
this.renderChatEditingSessionWithEntries(reader.store, chatEditingSession, editSessionEntries, sessionFiles);
|
|
2209
|
+
} else {
|
|
1727
2210
|
clearNode(this.chatEditingSessionWidgetContainer);
|
|
1728
2211
|
this._chatEditsDisposables.clear();
|
|
1729
2212
|
this._chatEditList = undefined;
|
|
1730
2213
|
}
|
|
1731
2214
|
});
|
|
1732
2215
|
}
|
|
1733
|
-
renderChatEditingSessionWithEntries(store, chatEditingSession,
|
|
1734
|
-
const innerContainer = this.chatEditingSessionWidgetContainer.querySelector(
|
|
1735
|
-
|
|
1736
|
-
|
|
2216
|
+
renderChatEditingSessionWithEntries(store, chatEditingSession, editSessionEntriesObs, sessionEntriesObs) {
|
|
2217
|
+
const innerContainer = this.chatEditingSessionWidgetContainer.querySelector(".chat-editing-session-container.show-file-icons") ?? append(
|
|
2218
|
+
this.chatEditingSessionWidgetContainer,
|
|
2219
|
+
$(".chat-editing-session-container.show-file-icons")
|
|
2220
|
+
);
|
|
2221
|
+
const overviewRegion = innerContainer.querySelector(".chat-editing-session-overview") ?? append(innerContainer, $(".chat-editing-session-overview"));
|
|
2222
|
+
const overviewTitle = overviewRegion.querySelector(".working-set-title") ?? append(overviewRegion, $(".working-set-title"));
|
|
1737
2223
|
this._chatEditsActionsDisposables.clear();
|
|
1738
|
-
const actionsContainer = overviewRegion.querySelector(
|
|
2224
|
+
const actionsContainer = overviewRegion.querySelector(".chat-editing-session-actions") ?? append(overviewRegion, $(".chat-editing-session-actions"));
|
|
1739
2225
|
const sessionResource = chatEditingSession?.chatSessionResource || this._widget?.viewModel?.model.sessionResource;
|
|
1740
2226
|
const scopedContextKeyService = this._chatEditsActionsDisposables.add(this.contextKeyService.createScoped(actionsContainer));
|
|
1741
2227
|
if (sessionResource) {
|
|
1742
2228
|
scopedContextKeyService.createKey(ChatContextKeys.agentSessionType.key, getChatSessionType(sessionResource));
|
|
1743
2229
|
}
|
|
1744
|
-
this._chatEditsActionsDisposables.add(bindContextKey(
|
|
2230
|
+
this._chatEditsActionsDisposables.add(bindContextKey(
|
|
2231
|
+
ChatContextKeys.hasAgentSessionChanges,
|
|
2232
|
+
scopedContextKeyService,
|
|
2233
|
+
r => !!sessionEntriesObs.read(r)?.length
|
|
2234
|
+
));
|
|
1745
2235
|
const scopedInstantiationService = this._chatEditsActionsDisposables.add(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, scopedContextKeyService]))));
|
|
1746
|
-
const workingSetContainer = innerContainer.querySelector(
|
|
2236
|
+
const workingSetContainer = innerContainer.querySelector(".chat-editing-session-list") ?? append(innerContainer, $(".chat-editing-session-list"));
|
|
1747
2237
|
const button = this._chatEditsActionsDisposables.add(( new ButtonWithIcon(overviewTitle, {
|
|
1748
2238
|
supportIcons: true,
|
|
1749
2239
|
secondary: true,
|
|
1750
|
-
ariaLabel: ( localize(
|
|
2240
|
+
ariaLabel: ( localize(6076, "Toggle changed files."))
|
|
1751
2241
|
})));
|
|
1752
2242
|
const topLevelStats = derived(reader => {
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
2243
|
+
const entries = editSessionEntriesObs.read(reader);
|
|
2244
|
+
const sessionEntries = sessionEntriesObs.read(reader);
|
|
2245
|
+
let added = 0, removed = 0;
|
|
2246
|
+
if (entries.length > 0) {
|
|
2247
|
+
for (const entry of entries) {
|
|
2248
|
+
if (entry.kind === "reference" && entry.options?.diffMeta) {
|
|
2249
|
+
added += entry.options.diffMeta.added;
|
|
2250
|
+
removed += entry.options.diffMeta.removed;
|
|
2251
|
+
}
|
|
1760
2252
|
}
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
for (const entry of sessionValue) {
|
|
1768
|
-
added += entry.insertions;
|
|
1769
|
-
removed += entry.deletions;
|
|
2253
|
+
} else {
|
|
2254
|
+
for (const entry of sessionEntries) {
|
|
2255
|
+
if (entry.kind === "reference" && entry.options?.diffMeta) {
|
|
2256
|
+
added += entry.options.diffMeta.added;
|
|
2257
|
+
removed += entry.options.diffMeta.removed;
|
|
2258
|
+
}
|
|
1770
2259
|
}
|
|
1771
|
-
shouldShowEditingSession = sessionValue.length > 0;
|
|
1772
|
-
baseLabel = sessionValue.length === 1 ? ( localize(5824, '1 file ready to merge')) : ( localize(5825, '{0} files ready to merge', sessionValue.length));
|
|
1773
|
-
topLevelIsSessionMenu = true;
|
|
1774
2260
|
}
|
|
1775
|
-
|
|
1776
|
-
|
|
2261
|
+
const files = entries.length > 0 ? entries.length : sessionEntries.length;
|
|
2262
|
+
const topLevelIsSessionMenu = entries.length === 0 && sessionEntries.length > 0;
|
|
2263
|
+
const shouldShowEditingSession = entries.length > 0 || sessionEntries.length > 0;
|
|
2264
|
+
return {
|
|
2265
|
+
files,
|
|
2266
|
+
added,
|
|
2267
|
+
removed,
|
|
2268
|
+
shouldShowEditingSession,
|
|
2269
|
+
topLevelIsSessionMenu
|
|
2270
|
+
};
|
|
1777
2271
|
});
|
|
1778
2272
|
const topLevelIsSessionMenu = ( topLevelStats.map(t => t.topLevelIsSessionMenu));
|
|
1779
2273
|
store.add(autorun(reader => {
|
|
1780
2274
|
const isSessionMenu = topLevelIsSessionMenu.read(reader);
|
|
1781
|
-
reader.store.add(scopedInstantiationService.createInstance(
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
2275
|
+
reader.store.add(scopedInstantiationService.createInstance(
|
|
2276
|
+
MenuWorkbenchButtonBar,
|
|
2277
|
+
actionsContainer,
|
|
2278
|
+
isSessionMenu ? MenuId.ChatEditingSessionChangesToolbar : MenuId.ChatEditingWidgetToolbar,
|
|
2279
|
+
{
|
|
2280
|
+
telemetrySource: this.options.menus.telemetrySource,
|
|
2281
|
+
small: true,
|
|
2282
|
+
menuOptions: {
|
|
2283
|
+
arg: sessionResource && (isSessionMenu ? sessionResource : {
|
|
2284
|
+
$mid: MarshalledId.ChatViewContext,
|
|
2285
|
+
sessionResource
|
|
2286
|
+
})
|
|
2287
|
+
},
|
|
2288
|
+
disableWhileRunning: isSessionMenu,
|
|
2289
|
+
buttonConfigProvider: action => {
|
|
2290
|
+
if (action.id === ChatEditingShowChangesAction.ID || action.id === ViewPreviousEditsAction.Id || action.id === ViewAllSessionChangesAction.ID) {
|
|
2291
|
+
return {
|
|
2292
|
+
showIcon: true,
|
|
2293
|
+
showLabel: false,
|
|
2294
|
+
isSecondary: true
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
return undefined;
|
|
1792
2298
|
}
|
|
1793
|
-
return undefined;
|
|
1794
2299
|
}
|
|
1795
|
-
|
|
2300
|
+
));
|
|
1796
2301
|
}));
|
|
1797
2302
|
store.add(autorun(reader => {
|
|
1798
|
-
const {
|
|
1799
|
-
|
|
2303
|
+
const {
|
|
2304
|
+
files,
|
|
2305
|
+
added,
|
|
2306
|
+
removed,
|
|
2307
|
+
shouldShowEditingSession
|
|
2308
|
+
} = topLevelStats.read(reader);
|
|
2309
|
+
const buttonLabel = files === 1 ? ( localize(6077, "1 file changed")) : ( localize(6078, "{0} files changed", files));
|
|
2310
|
+
button.label = buttonLabel;
|
|
2311
|
+
button.element.setAttribute("aria-label", ( localize(
|
|
2312
|
+
6079,
|
|
2313
|
+
"{0}, {1} lines added, {2} lines removed",
|
|
2314
|
+
buttonLabel,
|
|
2315
|
+
added,
|
|
2316
|
+
removed
|
|
2317
|
+
)));
|
|
1800
2318
|
this._workingSetLinesAddedSpan.value.textContent = `+${added}`;
|
|
1801
2319
|
this._workingSetLinesRemovedSpan.value.textContent = `-${removed}`;
|
|
1802
|
-
button.element.setAttribute('aria-label', ( localize(5826, '{0}, {1} lines added, {2} lines removed', baseLabel, added, removed)));
|
|
1803
2320
|
setVisibility(shouldShowEditingSession, this.chatEditingSessionWidgetContainer);
|
|
1804
|
-
if (!shouldShowEditingSession) {
|
|
1805
|
-
this._onDidChangeHeight.fire();
|
|
1806
|
-
}
|
|
1807
2321
|
}));
|
|
1808
|
-
const countsContainer = $$1(
|
|
2322
|
+
const countsContainer = $$1(".working-set-line-counts");
|
|
1809
2323
|
button.element.appendChild(countsContainer);
|
|
1810
2324
|
countsContainer.appendChild(this._workingSetLinesAddedSpan.value);
|
|
1811
2325
|
countsContainer.appendChild(this._workingSetLinesRemovedSpan.value);
|
|
@@ -1813,12 +2327,12 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1813
2327
|
this._workingSetCollapsed.set(!this._workingSetCollapsed.get(), undefined);
|
|
1814
2328
|
};
|
|
1815
2329
|
this._chatEditsActionsDisposables.add(button.onDidClick(toggleWorkingSet));
|
|
1816
|
-
this._chatEditsActionsDisposables.add(addDisposableListener(overviewRegion,
|
|
2330
|
+
this._chatEditsActionsDisposables.add(addDisposableListener(overviewRegion, "click", e => {
|
|
1817
2331
|
if (e.defaultPrevented) {
|
|
1818
2332
|
return;
|
|
1819
2333
|
}
|
|
1820
2334
|
const target = e.target;
|
|
1821
|
-
if (target.closest(
|
|
2335
|
+
if (target.closest(".monaco-button")) {
|
|
1822
2336
|
return;
|
|
1823
2337
|
}
|
|
1824
2338
|
toggleWorkingSet();
|
|
@@ -1826,8 +2340,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1826
2340
|
this._chatEditsActionsDisposables.add(autorun(reader => {
|
|
1827
2341
|
const collapsed = this._workingSetCollapsed.read(reader);
|
|
1828
2342
|
button.icon = collapsed ? Codicon.chevronRight : Codicon.chevronDown;
|
|
1829
|
-
workingSetContainer.classList.toggle(
|
|
1830
|
-
this._onDidChangeHeight.fire();
|
|
2343
|
+
workingSetContainer.classList.toggle("collapsed", collapsed);
|
|
1831
2344
|
}));
|
|
1832
2345
|
if (!this._chatEditList) {
|
|
1833
2346
|
this._chatEditList = this._chatEditsListPool.get();
|
|
@@ -1836,14 +2349,25 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1836
2349
|
this._chatEditsDisposables.add(list.onDidFocus(() => {
|
|
1837
2350
|
this._onDidFocus.fire();
|
|
1838
2351
|
}));
|
|
1839
|
-
this._chatEditsDisposables.add(list.onDidOpen(async
|
|
1840
|
-
if (e.element?.kind ===
|
|
2352
|
+
this._chatEditsDisposables.add(list.onDidOpen(async e => {
|
|
2353
|
+
if (e.element?.kind === "reference" && URI.isUri(e.element.reference)) {
|
|
1841
2354
|
const modifiedFileUri = e.element.reference;
|
|
1842
2355
|
const originalUri = e.element.options?.originalUri;
|
|
2356
|
+
if (e.element.options?.isDeletion && originalUri) {
|
|
2357
|
+
await this.editorService.openEditor({
|
|
2358
|
+
resource: originalUri,
|
|
2359
|
+
options: e.editorOptions
|
|
2360
|
+
}, e.sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
|
|
2361
|
+
return;
|
|
2362
|
+
}
|
|
1843
2363
|
if (originalUri) {
|
|
1844
2364
|
await this.editorService.openEditor({
|
|
1845
|
-
original: {
|
|
1846
|
-
|
|
2365
|
+
original: {
|
|
2366
|
+
resource: originalUri
|
|
2367
|
+
},
|
|
2368
|
+
modified: {
|
|
2369
|
+
resource: modifiedFileUri
|
|
2370
|
+
},
|
|
1847
2371
|
options: e.editorOptions
|
|
1848
2372
|
}, e.sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
|
|
1849
2373
|
return;
|
|
@@ -1858,7 +2382,7 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1858
2382
|
}
|
|
1859
2383
|
}
|
|
1860
2384
|
}));
|
|
1861
|
-
this._chatEditsDisposables.add(addDisposableListener(list.getHTMLElement(),
|
|
2385
|
+
this._chatEditsDisposables.add(addDisposableListener(list.getHTMLElement(), "click", e => {
|
|
1862
2386
|
if (!this.hasFocus()) {
|
|
1863
2387
|
this._onDidFocus.fire();
|
|
1864
2388
|
}
|
|
@@ -1867,21 +2391,9 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1867
2391
|
append(innerContainer, workingSetContainer);
|
|
1868
2392
|
}
|
|
1869
2393
|
store.add(autorun(reader => {
|
|
1870
|
-
const editEntries =
|
|
1871
|
-
const sessionFileEntries =
|
|
1872
|
-
const allEntries =
|
|
1873
|
-
if (sessionFileEntries.length > 0) {
|
|
1874
|
-
if (editEntries.length > 0) {
|
|
1875
|
-
allEntries.push({
|
|
1876
|
-
kind: 'divider',
|
|
1877
|
-
label: ( localize(5827, 'Worktree Changes')),
|
|
1878
|
-
menuId: MenuId.ChatEditingSessionChangesToolbar,
|
|
1879
|
-
menuArg: sessionResource,
|
|
1880
|
-
scopedInstantiationService,
|
|
1881
|
-
});
|
|
1882
|
-
}
|
|
1883
|
-
allEntries.push(...sessionFileEntries);
|
|
1884
|
-
}
|
|
2394
|
+
const editEntries = editSessionEntriesObs.read(reader);
|
|
2395
|
+
const sessionFileEntries = sessionEntriesObs.read(reader);
|
|
2396
|
+
const allEntries = editEntries.concat(sessionFileEntries);
|
|
1885
2397
|
const maxItemsShown = 6;
|
|
1886
2398
|
const itemsShown = Math.min(allEntries.length, maxItemsShown);
|
|
1887
2399
|
const height = itemsShown * 22;
|
|
@@ -1889,68 +2401,8 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1889
2401
|
list.layout(height);
|
|
1890
2402
|
list.getHTMLElement().style.height = `${height}px`;
|
|
1891
2403
|
list.splice(0, list.length, allEntries);
|
|
1892
|
-
this._onDidChangeHeight.fire();
|
|
1893
2404
|
}));
|
|
1894
2405
|
}
|
|
1895
|
-
async renderChatRelatedFiles() {
|
|
1896
|
-
const anchor = this.relatedFilesContainer;
|
|
1897
|
-
clearNode(anchor);
|
|
1898
|
-
const shouldRender = this.configurationService.getValue('chat.renderRelatedFiles');
|
|
1899
|
-
setVisibility(Boolean(this.relatedFiles?.value.length && shouldRender), anchor);
|
|
1900
|
-
if (!shouldRender || !this.relatedFiles?.value.length) {
|
|
1901
|
-
return;
|
|
1902
|
-
}
|
|
1903
|
-
const hoverDelegate = getDefaultHoverDelegate('element');
|
|
1904
|
-
for (const { uri, description } of this.relatedFiles.value) {
|
|
1905
|
-
const uriLabel = this._chatEditsActionsDisposables.add(( new Button(anchor, {
|
|
1906
|
-
supportIcons: true,
|
|
1907
|
-
secondary: true,
|
|
1908
|
-
hoverDelegate
|
|
1909
|
-
})));
|
|
1910
|
-
uriLabel.label = this.labelService.getUriBasenameLabel(uri);
|
|
1911
|
-
uriLabel.element.classList.add('monaco-icon-label');
|
|
1912
|
-
uriLabel.element.title = ( localize(
|
|
1913
|
-
5828,
|
|
1914
|
-
"{0} - {1}",
|
|
1915
|
-
this.labelService.getUriLabel(uri, { relative: true }),
|
|
1916
|
-
description ?? ''
|
|
1917
|
-
));
|
|
1918
|
-
this._chatEditsActionsDisposables.add(uriLabel.onDidClick(async () => {
|
|
1919
|
-
group.remove();
|
|
1920
|
-
await this._attachmentModel.addFile(uri);
|
|
1921
|
-
this.relatedFiles?.remove(uri);
|
|
1922
|
-
}));
|
|
1923
|
-
const addButton = this._chatEditsActionsDisposables.add(( new Button(anchor, {
|
|
1924
|
-
supportIcons: false,
|
|
1925
|
-
secondary: true,
|
|
1926
|
-
hoverDelegate,
|
|
1927
|
-
ariaLabel: ( localize(
|
|
1928
|
-
5829,
|
|
1929
|
-
'Add suggestion {0}',
|
|
1930
|
-
this.labelService.getUriLabel(uri, { relative: true })
|
|
1931
|
-
)),
|
|
1932
|
-
})));
|
|
1933
|
-
addButton.icon = Codicon.add;
|
|
1934
|
-
addButton.setTitle(( localize(5830, 'Add suggestion')));
|
|
1935
|
-
this._chatEditsActionsDisposables.add(addButton.onDidClick(async () => {
|
|
1936
|
-
group.remove();
|
|
1937
|
-
await this._attachmentModel.addFile(uri);
|
|
1938
|
-
this.relatedFiles?.remove(uri);
|
|
1939
|
-
}));
|
|
1940
|
-
const sep = createElement('div');
|
|
1941
|
-
sep.classList.add('separator');
|
|
1942
|
-
const group = createElement('span');
|
|
1943
|
-
group.classList.add('monaco-button-dropdown', 'sidebyside-button');
|
|
1944
|
-
group.appendChild(addButton.element);
|
|
1945
|
-
group.appendChild(sep);
|
|
1946
|
-
group.appendChild(uriLabel.element);
|
|
1947
|
-
append(anchor, group);
|
|
1948
|
-
this._chatEditsActionsDisposables.add(toDisposable(() => {
|
|
1949
|
-
group.remove();
|
|
1950
|
-
}));
|
|
1951
|
-
}
|
|
1952
|
-
this._onDidChangeHeight.fire();
|
|
1953
|
-
}
|
|
1954
2406
|
async renderFollowups(items, response) {
|
|
1955
2407
|
if (!this.options.renderFollowups) {
|
|
1956
2408
|
return;
|
|
@@ -1958,91 +2410,102 @@ let ChatInputPart = class ChatInputPart extends Disposable {
|
|
|
1958
2410
|
this.followupsDisposables.clear();
|
|
1959
2411
|
clearNode(this.followupsContainer);
|
|
1960
2412
|
if (items && items.length > 0) {
|
|
1961
|
-
this.followupsDisposables.add(this.instantiationService.createInstance(
|
|
2413
|
+
this.followupsDisposables.add(this.instantiationService.createInstance(
|
|
2414
|
+
ChatFollowups,
|
|
2415
|
+
this.followupsContainer,
|
|
2416
|
+
items,
|
|
2417
|
+
this.location,
|
|
2418
|
+
undefined,
|
|
2419
|
+
followup => this._onDidAcceptFollowup.fire({
|
|
2420
|
+
followup,
|
|
2421
|
+
response
|
|
2422
|
+
})
|
|
2423
|
+
));
|
|
1962
2424
|
}
|
|
1963
|
-
this._onDidChangeHeight.fire();
|
|
1964
|
-
}
|
|
1965
|
-
get contentHeight() {
|
|
1966
|
-
const data = this.getLayoutData();
|
|
1967
|
-
return data.followupsHeight + data.inputPartEditorHeight + data.inputPartVerticalPadding + data.inputEditorBorder + data.attachmentsHeight + data.toolbarsHeight + data.chatEditingStateHeight + data.todoListWidgetContainerHeight + data.inputWidgetsContainerHeight;
|
|
1968
2425
|
}
|
|
1969
|
-
layout(
|
|
1970
|
-
this.
|
|
1971
|
-
return this._layout(
|
|
2426
|
+
layout(width) {
|
|
2427
|
+
this.cachedWidth = width;
|
|
2428
|
+
return this._layout(width);
|
|
1972
2429
|
}
|
|
1973
|
-
_layout(
|
|
2430
|
+
_layout(width, allowRecurse = true) {
|
|
1974
2431
|
const data = this.getLayoutData();
|
|
1975
|
-
const inputEditorHeight = Math.min(data.inputPartEditorHeight, height - data.followupsHeight - data.attachmentsHeight - data.inputPartVerticalPadding - data.toolbarsHeight - data.chatEditingStateHeight - data.todoListWidgetContainerHeight - data.inputWidgetsContainerHeight);
|
|
1976
2432
|
const followupsWidth = width - data.inputPartHorizontalPadding;
|
|
1977
2433
|
this.followupsContainer.style.width = `${followupsWidth}px`;
|
|
1978
|
-
this._inputPartHeight = data.inputPartVerticalPadding + data.followupsHeight + inputEditorHeight + data.inputEditorBorder + data.attachmentsHeight + data.toolbarsHeight + data.chatEditingStateHeight + data.todoListWidgetContainerHeight + data.inputWidgetsContainerHeight;
|
|
1979
|
-
this._followupsHeight = data.followupsHeight;
|
|
1980
|
-
this._editSessionWidgetHeight = data.chatEditingStateHeight;
|
|
1981
2434
|
const initialEditorScrollWidth = this._inputEditor.getScrollWidth();
|
|
1982
2435
|
const newEditorWidth = width - data.inputPartHorizontalPadding - data.editorBorder - data.inputPartHorizontalPaddingInside - data.toolbarsWidth - data.sideToolbarWidth;
|
|
1983
|
-
const
|
|
2436
|
+
const inputEditorHeight = Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight);
|
|
2437
|
+
const newDimension = {
|
|
2438
|
+
width: newEditorWidth,
|
|
2439
|
+
height: inputEditorHeight
|
|
2440
|
+
};
|
|
1984
2441
|
if (!this.previousInputEditorDimension || (this.previousInputEditorDimension.width !== newDimension.width || this.previousInputEditorDimension.height !== newDimension.height)) {
|
|
1985
2442
|
this._inputEditor.layout(newDimension);
|
|
1986
2443
|
this.previousInputEditorDimension = newDimension;
|
|
1987
2444
|
}
|
|
1988
2445
|
if (allowRecurse && initialEditorScrollWidth < 10) {
|
|
1989
|
-
return this._layout(
|
|
2446
|
+
return this._layout(width, false);
|
|
1990
2447
|
}
|
|
1991
2448
|
}
|
|
1992
2449
|
getLayoutData() {
|
|
1993
|
-
const executeToolbarWidth = this.cachedExecuteToolbarWidth = this.executeToolbar.getItemsWidth();
|
|
1994
|
-
const inputToolbarWidth = this.cachedInputToolbarWidth = this.inputActionsToolbar.getItemsWidth();
|
|
1995
2450
|
const inputSideToolbarWidth = this.inputSideToolbarContainer ? getTotalWidth(this.inputSideToolbarContainer) : 0;
|
|
1996
|
-
const
|
|
1997
|
-
|
|
2451
|
+
const getToolbarsWidthCompact = () => {
|
|
2452
|
+
const executeToolbarWidth = this.cachedExecuteToolbarWidth = this.executeToolbar.getItemsWidth();
|
|
2453
|
+
const inputToolbarWidth = this.cachedInputToolbarWidth = this.inputActionsToolbar.getItemsWidth();
|
|
2454
|
+
const executeToolbarPadding = (this.executeToolbar.getItemsLength() - 1) * 4;
|
|
2455
|
+
const inputToolbarPadding = this.inputActionsToolbar.getItemsLength() ? (this.inputActionsToolbar.getItemsLength() - 1) * 4 : 0;
|
|
2456
|
+
return executeToolbarWidth + executeToolbarPadding + (this.options.renderInputToolbarBelowInput ? 0 : inputToolbarWidth + inputToolbarPadding);
|
|
2457
|
+
};
|
|
1998
2458
|
return {
|
|
1999
|
-
inputEditorBorder: 2,
|
|
2000
|
-
followupsHeight: this.followupsContainer.offsetHeight,
|
|
2001
|
-
inputPartEditorHeight: Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight),
|
|
2002
|
-
inputPartHorizontalPadding: this.options.renderStyle === 'compact' ? 16 : 32,
|
|
2003
|
-
inputPartVerticalPadding: this.options.renderStyle === 'compact' ? 12 : ((16 + 6 + (2 * 4)) ),
|
|
2004
|
-
attachmentsHeight: this.attachmentsHeight,
|
|
2005
2459
|
editorBorder: 2,
|
|
2460
|
+
inputPartHorizontalPadding: this.options.renderStyle === "compact" ? 16 : 32,
|
|
2006
2461
|
inputPartHorizontalPaddingInside: 12,
|
|
2007
|
-
toolbarsWidth: this.options.renderStyle ===
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2462
|
+
toolbarsWidth: this.options.renderStyle === "compact" ? getToolbarsWidthCompact() : 0,
|
|
2463
|
+
sideToolbarWidth: inputSideToolbarWidth > 0 ? inputSideToolbarWidth + 4 : 0
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
getWidgetLocationInfo(widget) {
|
|
2467
|
+
if (isIChatResourceViewContext(widget.viewContext)) {
|
|
2468
|
+
return {
|
|
2469
|
+
location: ChatWidgetLocation.Editor,
|
|
2470
|
+
isMaximized: false
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
if (isIChatViewViewContext(widget.viewContext)) {
|
|
2474
|
+
const viewLocation = this.viewDescriptorService.getViewLocationById(widget.viewContext.viewId);
|
|
2475
|
+
const sideBarPosition = this.layoutService.getSideBarPosition();
|
|
2476
|
+
switch (viewLocation) {
|
|
2477
|
+
case ViewContainerLocation.Panel:
|
|
2478
|
+
return {
|
|
2479
|
+
location: ChatWidgetLocation.Panel,
|
|
2480
|
+
isMaximized: this.layoutService.isPanelMaximized()
|
|
2481
|
+
};
|
|
2482
|
+
case ViewContainerLocation.AuxiliaryBar:
|
|
2483
|
+
return {
|
|
2484
|
+
location: sideBarPosition === Position.LEFT ? ChatWidgetLocation.SidebarRight : ChatWidgetLocation.SidebarLeft,
|
|
2485
|
+
isMaximized: this.layoutService.isAuxiliaryBarMaximized()
|
|
2486
|
+
};
|
|
2487
|
+
case ViewContainerLocation.Sidebar:
|
|
2488
|
+
default:
|
|
2489
|
+
return {
|
|
2490
|
+
location: sideBarPosition === Position.LEFT ? ChatWidgetLocation.SidebarLeft : ChatWidgetLocation.SidebarRight,
|
|
2491
|
+
isMaximized: false
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
return {
|
|
2496
|
+
location: ChatWidgetLocation.Editor,
|
|
2497
|
+
isMaximized: false
|
|
2013
2498
|
};
|
|
2014
2499
|
}
|
|
2015
2500
|
};
|
|
2016
|
-
ChatInputPart = ChatInputPart_1 = ( __decorate([
|
|
2017
|
-
( __param(4, IModelService)),
|
|
2018
|
-
( __param(5, IInstantiationService)),
|
|
2019
|
-
( __param(6, IContextKeyService)),
|
|
2020
|
-
( __param(7, IConfigurationService)),
|
|
2021
|
-
( __param(8, IKeybindingService)),
|
|
2022
|
-
( __param(9, IAccessibilityService)),
|
|
2023
|
-
( __param(10, ILanguageModelsService)),
|
|
2024
|
-
( __param(11, ILogService)),
|
|
2025
|
-
( __param(12, IFileService)),
|
|
2026
|
-
( __param(13, IEditorService)),
|
|
2027
|
-
( __param(14, IThemeService)),
|
|
2028
|
-
( __param(15, ITextModelService)),
|
|
2029
|
-
( __param(16, IStorageService)),
|
|
2030
|
-
( __param(17, ILabelService)),
|
|
2031
|
-
( __param(18, IChatAgentService)),
|
|
2032
|
-
( __param(19, ISharedWebContentExtractorService)),
|
|
2033
|
-
( __param(20, IWorkbenchAssignmentService)),
|
|
2034
|
-
( __param(21, IChatEntitlementService)),
|
|
2035
|
-
( __param(22, IChatModeService)),
|
|
2036
|
-
( __param(23, ILanguageModelToolsService)),
|
|
2037
|
-
( __param(24, IChatService)),
|
|
2038
|
-
( __param(25, IChatSessionsService)),
|
|
2039
|
-
( __param(26, IChatContextService)),
|
|
2040
|
-
( __param(27, IAgentSessionsService))
|
|
2041
|
-
], ChatInputPart));
|
|
2501
|
+
ChatInputPart = ChatInputPart_1 = ( __decorate([( __param(4, IModelService)), ( __param(5, IInstantiationService)), ( __param(6, IContextKeyService)), ( __param(7, IConfigurationService)), ( __param(8, IKeybindingService)), ( __param(9, IAccessibilityService)), ( __param(10, ILanguageModelsService)), ( __param(11, ILogService)), ( __param(12, IFileService)), ( __param(13, IEditorService)), ( __param(14, IThemeService)), ( __param(15, ITextModelService)), ( __param(16, IStorageService)), ( __param(17, IChatAgentService)), ( __param(18, ISharedWebContentExtractorService)), ( __param(19, IWorkbenchAssignmentService)), ( __param(20, IChatEntitlementService)), ( __param(21, IChatModeService)), ( __param(22, ILanguageModelToolsService)), ( __param(23, IChatService)), ( __param(24, IChatSessionsService)), ( __param(25, IChatContextService)), ( __param(26, IAgentSessionsService)), ( __param(27, IWorkspaceContextService)), ( __param(28, IWorkbenchLayoutService)), ( __param(29, IViewDescriptorService))], ChatInputPart));
|
|
2042
2502
|
function getLastPosition(model) {
|
|
2043
|
-
return {
|
|
2503
|
+
return {
|
|
2504
|
+
lineNumber: model.getLineCount(),
|
|
2505
|
+
column: model.getLineLength(model.getLineCount()) + 1
|
|
2506
|
+
};
|
|
2044
2507
|
}
|
|
2045
|
-
const chatInputEditorContainerSelector =
|
|
2508
|
+
const chatInputEditorContainerSelector = ".interactive-input-editor";
|
|
2046
2509
|
setupSimpleEditorSelectionStyling(chatInputEditorContainerSelector);
|
|
2047
2510
|
class ChatSessionPickersContainerActionItem extends ActionViewItem {
|
|
2048
2511
|
constructor(action, widgets, options) {
|
|
@@ -2050,9 +2513,9 @@ class ChatSessionPickersContainerActionItem extends ActionViewItem {
|
|
|
2050
2513
|
this.widgets = widgets;
|
|
2051
2514
|
}
|
|
2052
2515
|
render(container) {
|
|
2053
|
-
container.classList.add(
|
|
2516
|
+
container.classList.add("chat-sessionPicker-container");
|
|
2054
2517
|
for (const widget of this.widgets) {
|
|
2055
|
-
const itemContainer = $$1(
|
|
2518
|
+
const itemContainer = $$1(".action-item.chat-sessionPicker-item");
|
|
2056
2519
|
widget.render(itemContainer);
|
|
2057
2520
|
container.appendChild(itemContainer);
|
|
2058
2521
|
}
|
|
@@ -2070,7 +2533,7 @@ class AddFilesButton extends ActionViewItem {
|
|
|
2070
2533
|
...options,
|
|
2071
2534
|
icon: false,
|
|
2072
2535
|
label: true,
|
|
2073
|
-
keybindingNotRenderedWithLabel: true
|
|
2536
|
+
keybindingNotRenderedWithLabel: true
|
|
2074
2537
|
});
|
|
2075
2538
|
}
|
|
2076
2539
|
setShowLabel(show) {
|
|
@@ -2078,7 +2541,7 @@ class AddFilesButton extends ActionViewItem {
|
|
|
2078
2541
|
this.updateLabel();
|
|
2079
2542
|
}
|
|
2080
2543
|
render(container) {
|
|
2081
|
-
container.classList.add(
|
|
2544
|
+
container.classList.add("chat-attachment-button");
|
|
2082
2545
|
super.render(container);
|
|
2083
2546
|
this.updateLabel();
|
|
2084
2547
|
}
|
|
@@ -2087,10 +2550,10 @@ class AddFilesButton extends ActionViewItem {
|
|
|
2087
2550
|
return;
|
|
2088
2551
|
}
|
|
2089
2552
|
assertType(this.label);
|
|
2090
|
-
this.label.classList.toggle(
|
|
2553
|
+
this.label.classList.toggle("has-label", this.showLabel);
|
|
2091
2554
|
const message = this.showLabel ? `$(attach) ${this.action.label}` : `$(attach)`;
|
|
2092
2555
|
reset(this.label, ...renderLabelWithIcons(message));
|
|
2093
2556
|
}
|
|
2094
2557
|
}
|
|
2095
2558
|
|
|
2096
|
-
export { ChatInputPart };
|
|
2559
|
+
export { ChatInputPart, ChatWidgetLocation };
|