@codingame/monaco-vscode-katex-common 24.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/empty.js +1 -0
- package/package.json +45 -0
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +37 -0
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +127 -0
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +27 -0
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +81 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +44 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +172 -0
- package/vscode/src/vs/platform/editor/browser/editor.d.ts +12 -0
- package/vscode/src/vs/platform/editor/browser/editor.js +51 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +295 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +65 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +650 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +364 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +207 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.js +216 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.js +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentModel.js +141 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.d.ts +169 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAttachmentWidgets.js +951 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentMarkdownRenderer.js +109 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAgentCommandContentPart.js +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAnonymousRateLimitedPart.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatChangesSummaryPart.js +286 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCodeCitationContentPart.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollapsibleContentPart.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.d.ts +116 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationWidget.js +417 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatContentCodePools.js +66 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.js +123 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorConfirmationPart.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatErrorContentPart.js +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatExtensionsContentPart.js +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.d.ts +94 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.js +567 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.js +224 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMultiDiffContentPart.js +259 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatPullRequestContentPart.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatQuotaExceededPart.js +117 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.d.ts +66 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.js +528 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatSuggestNextWidget.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.js +91 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.service.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatThinkingContentPart.js +429 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.js +347 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolInputOutputContentPart.js +164 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatToolOutputContentSubPart.js +224 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.js +173 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatConfirmationWidget.css +341 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatExtensionsContent.css +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMarkdownPart.css +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatMcpServersInteractionContent.css +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatPullRequestContent.css +75 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css +221 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatThinkingContent.css +162 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +94 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +96 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +147 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatResultListSubPart.js +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +353 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +100 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +1085 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +275 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +119 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +36 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolOutputPart.js +130 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +225 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolProgressPart.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDiffBlockPart.js +127 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDragAndDrop.js +388 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +721 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInlineAnchorWidget.js +409 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.d.ts +334 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +2008 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPartWidgets.js +93 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.d.ts +217 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1573 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +249 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +84 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSelectedTools.js +174 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/common.js +76 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionAction.css +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.d.ts +292 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +2014 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css +171 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.d.ts +173 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +797 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatImplicitContext.js +345 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +1069 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +139 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css +2880 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatAgentHover.css +87 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatCodeBlockPill.css +139 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatInlineAnchorWidget.css +61 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewWelcome.css +209 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modePickerActionItem.js +135 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/modelPicker/modelPickerActionItem.js +147 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +279 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +28 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatColors.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +176 -0
- package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.js +207 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +48 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +373 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +171 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +1442 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +199 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +482 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +37 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +95 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +497 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +76 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +464 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +124 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +562 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +279 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +411 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +66 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +154 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +201 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +372 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +594 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1746 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +269 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +806 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +116 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +62 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +295 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +241 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +146 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +90 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +42 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +77 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +823 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +567 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +189 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +439 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +263 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +48 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +89 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +108 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +145 -0
|
@@ -0,0 +1,1069 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
+
import { raceTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
5
|
+
import { decodeBase64 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
6
|
+
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
7
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
8
|
+
import { isPatternInWord } from '@codingame/monaco-vscode-api/vscode/vs/base/common/filters';
|
|
9
|
+
import { Disposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
10
|
+
import { ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
11
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
12
|
+
import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
13
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
14
|
+
import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
15
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
16
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
17
|
+
import { isCodeEditor, getCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
18
|
+
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
19
|
+
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
20
|
+
import { getWordAtText } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/wordHelper';
|
|
21
|
+
import { CompletionItemKind, SymbolKinds } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
22
|
+
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
|
|
23
|
+
import { IOutlineModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/documentSymbols/browser/outlineModel.service';
|
|
24
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
25
|
+
import { Action2, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
26
|
+
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
27
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
28
|
+
import { FileKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
29
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
30
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
31
|
+
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
32
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
33
|
+
import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
|
|
34
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
35
|
+
import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
36
|
+
import { EditorsOrder } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
37
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
38
|
+
import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
|
|
39
|
+
import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
40
|
+
import { ISearchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/search/common/search.service';
|
|
41
|
+
import { McpPromptArgumentPick } from '../../../mcp/browser/mcpPromptArgumentPick.js';
|
|
42
|
+
import { McpResourceURI } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
43
|
+
import { IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
44
|
+
import { searchFilesAndFolders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/search/browser/searchChatContext';
|
|
45
|
+
import { getFullyQualifiedId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
46
|
+
import { IChatAgentService, IChatAgentNameService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
47
|
+
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
48
|
+
import { getAttachableImageExtension } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
49
|
+
import { ChatRequestAgentPart, chatSubcommandLeader, chatAgentLeader, ChatRequestAgentSubcommandPart, ChatRequestSlashPromptPart, ChatRequestTextPart, chatVariableLeader, ChatRequestToolPart, ChatRequestToolSetPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
50
|
+
import { IChatSlashCommandService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service';
|
|
51
|
+
import { ChatAgentLocation, ChatModeKind, isSupportedChatFileScheme } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
52
|
+
import { ToolSet } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService';
|
|
53
|
+
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
|
|
54
|
+
import { ChatSubmitAction } from '../actions/chatExecuteActions.js';
|
|
55
|
+
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
56
|
+
import { resizeImage } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/imageUtils';
|
|
57
|
+
import { ChatDynamicVariableModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
|
|
58
|
+
|
|
59
|
+
var BuiltinDynamicCompletions_1, ToolCompletions_1;
|
|
60
|
+
let SlashCommandCompletions = class SlashCommandCompletions extends Disposable {
|
|
61
|
+
constructor(languageFeaturesService, chatWidgetService, chatSlashCommandService, promptsService, mcpService) {
|
|
62
|
+
super();
|
|
63
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
64
|
+
this.chatWidgetService = chatWidgetService;
|
|
65
|
+
this.chatSlashCommandService = chatSlashCommandService;
|
|
66
|
+
this.promptsService = promptsService;
|
|
67
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
68
|
+
_debugDisplayName: 'globalSlashCommands',
|
|
69
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
70
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
71
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
72
|
+
if (!widget || !widget.viewModel) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
if (widget.lockedAgentId) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const range = computeCompletionRanges(model, position, /\/\w*/g);
|
|
79
|
+
if (!range) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const parsedRequest = widget.parsedInput.parts;
|
|
86
|
+
const usedAgent = parsedRequest.find(p => p instanceof ChatRequestAgentPart);
|
|
87
|
+
if (usedAgent) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const slashCommands = this.chatSlashCommandService.getCommands(widget.location, widget.input.currentModeKind);
|
|
91
|
+
if (!slashCommands) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
suggestions: ( slashCommands.map((c, i) => {
|
|
96
|
+
const withSlash = `/${c.command}`;
|
|
97
|
+
return {
|
|
98
|
+
label: withSlash,
|
|
99
|
+
insertText: c.executeImmediately ? '' : `${withSlash} `,
|
|
100
|
+
documentation: c.detail,
|
|
101
|
+
range,
|
|
102
|
+
sortText: c.sortText ?? 'a'.repeat(i + 1),
|
|
103
|
+
kind: CompletionItemKind.Text,
|
|
104
|
+
command: c.executeImmediately ? { id: ChatSubmitAction.ID, title: withSlash, arguments: [{ widget, inputValue: `${withSlash} ` }] } : undefined,
|
|
105
|
+
};
|
|
106
|
+
}))
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
111
|
+
_debugDisplayName: 'globalSlashCommandsAt',
|
|
112
|
+
triggerCharacters: [chatAgentLeader],
|
|
113
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
114
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
115
|
+
if (!widget || !widget.viewModel) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const range = computeCompletionRanges(model, position, /@\w*/g);
|
|
119
|
+
if (!range) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const slashCommands = this.chatSlashCommandService.getCommands(widget.location, widget.input.currentModeKind);
|
|
126
|
+
if (!slashCommands) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
if (widget.lockedAgentId) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
suggestions: ( slashCommands.map((c, i) => {
|
|
134
|
+
const withSlash = `${chatSubcommandLeader}${c.command}`;
|
|
135
|
+
return {
|
|
136
|
+
label: withSlash,
|
|
137
|
+
insertText: c.executeImmediately ? '' : `${withSlash} `,
|
|
138
|
+
documentation: c.detail,
|
|
139
|
+
range,
|
|
140
|
+
filterText: `${chatAgentLeader}${c.command}`,
|
|
141
|
+
sortText: c.sortText ?? 'z'.repeat(i + 1),
|
|
142
|
+
kind: CompletionItemKind.Text,
|
|
143
|
+
command: c.executeImmediately ? { id: ChatSubmitAction.ID, title: withSlash, arguments: [{ widget, inputValue: `${withSlash} ` }] } : undefined,
|
|
144
|
+
};
|
|
145
|
+
}))
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
150
|
+
_debugDisplayName: 'promptSlashCommands',
|
|
151
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
152
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
153
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
154
|
+
if (!widget || !widget.viewModel) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
const range = computeCompletionRanges(model, position, /\/\w*/g);
|
|
158
|
+
if (!range) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const parsedRequest = widget.parsedInput.parts;
|
|
165
|
+
const usedAgent = parsedRequest.find(p => p instanceof ChatRequestAgentPart);
|
|
166
|
+
if (usedAgent) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const promptCommands = await this.promptsService.getPromptSlashCommands(token);
|
|
170
|
+
if (promptCommands.length === 0) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
if (widget.lockedAgentId) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
suggestions: ( promptCommands.map((c, i) => {
|
|
178
|
+
const label = `/${c.name}`;
|
|
179
|
+
const description = c.description;
|
|
180
|
+
return {
|
|
181
|
+
label: { label, description },
|
|
182
|
+
insertText: `${label} `,
|
|
183
|
+
documentation: c.description,
|
|
184
|
+
range,
|
|
185
|
+
sortText: 'a'.repeat(i + 1),
|
|
186
|
+
kind: CompletionItemKind.Text,
|
|
187
|
+
};
|
|
188
|
+
}))
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
193
|
+
_debugDisplayName: 'mcpPromptSlashCommands',
|
|
194
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
195
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
196
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
197
|
+
if (!widget || !widget.viewModel) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const range = computeCompletionRanges(model, position, /\/[a-z0-9_.-]*/g);
|
|
201
|
+
if (!range) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (widget.lockedAgentId) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
suggestions: mcpService.servers.get().flatMap(server => ( server.prompts.get().map((prompt) => {
|
|
212
|
+
const label = `/mcp.${prompt.id}`;
|
|
213
|
+
return {
|
|
214
|
+
label: { label, description: prompt.description },
|
|
215
|
+
command: {
|
|
216
|
+
id: StartParameterizedPromptAction.ID,
|
|
217
|
+
title: prompt.name,
|
|
218
|
+
arguments: [model, server, prompt, `${label} `],
|
|
219
|
+
},
|
|
220
|
+
insertText: `${label} `,
|
|
221
|
+
range,
|
|
222
|
+
kind: CompletionItemKind.Text,
|
|
223
|
+
};
|
|
224
|
+
})))
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
SlashCommandCompletions = ( __decorate([
|
|
231
|
+
( __param(0, ILanguageFeaturesService)),
|
|
232
|
+
( __param(1, IChatWidgetService)),
|
|
233
|
+
( __param(2, IChatSlashCommandService)),
|
|
234
|
+
( __param(3, IPromptsService)),
|
|
235
|
+
( __param(4, IMcpService))
|
|
236
|
+
], SlashCommandCompletions));
|
|
237
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(SlashCommandCompletions, LifecyclePhase.Eventually);
|
|
238
|
+
let AgentCompletions = class AgentCompletions extends Disposable {
|
|
239
|
+
constructor(languageFeaturesService, chatWidgetService, chatAgentService, chatAgentNameService) {
|
|
240
|
+
super();
|
|
241
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
242
|
+
this.chatWidgetService = chatWidgetService;
|
|
243
|
+
this.chatAgentService = chatAgentService;
|
|
244
|
+
this.chatAgentNameService = chatAgentNameService;
|
|
245
|
+
const subCommandProvider = {
|
|
246
|
+
_debugDisplayName: 'chatAgentSubcommand',
|
|
247
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
248
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
249
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
250
|
+
if (!widget || !widget.viewModel) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const range = computeCompletionRanges(model, position, /\/\w*/g);
|
|
254
|
+
if (!range) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const usedAgent = this.getCurrentAgentForWidget(widget);
|
|
258
|
+
if (!usedAgent || usedAgent.command) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
suggestions: ( usedAgent.agent.slashCommands.map((c, i) => {
|
|
263
|
+
const withSlash = `/${c.name}`;
|
|
264
|
+
return {
|
|
265
|
+
label: withSlash,
|
|
266
|
+
insertText: `${withSlash} `,
|
|
267
|
+
documentation: c.description,
|
|
268
|
+
range,
|
|
269
|
+
kind: CompletionItemKind.Text,
|
|
270
|
+
};
|
|
271
|
+
}))
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, subCommandProvider));
|
|
276
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
277
|
+
_debugDisplayName: 'chatAgentAndSubcommand',
|
|
278
|
+
triggerCharacters: [chatAgentLeader],
|
|
279
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
280
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
281
|
+
const viewModel = widget?.viewModel;
|
|
282
|
+
if (!widget || !viewModel) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (widget.lockedAgentId) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
const range = computeCompletionRanges(model, position, /(@|\/)\w*/g);
|
|
289
|
+
if (!range) {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const agents = this.chatAgentService.getAgents()
|
|
296
|
+
.filter(a => a.locations.includes(widget.location));
|
|
297
|
+
const getFilterText = (agent, command) => {
|
|
298
|
+
const dummyPrefix = agent.id === 'github.copilot.terminalPanel' ? `0000` : ``;
|
|
299
|
+
return `${chatAgentLeader}${dummyPrefix}${agent.name}.${command}`;
|
|
300
|
+
};
|
|
301
|
+
const justAgents = ( agents
|
|
302
|
+
.filter(a => !a.isDefault)
|
|
303
|
+
.map(agent => {
|
|
304
|
+
const { label: agentLabel, isDupe } = this.getAgentCompletionDetails(agent);
|
|
305
|
+
const detail = agent.description;
|
|
306
|
+
return {
|
|
307
|
+
label: isDupe ?
|
|
308
|
+
{ label: agentLabel, description: agent.description, detail: ` (${agent.publisherDisplayName})` } :
|
|
309
|
+
agentLabel,
|
|
310
|
+
documentation: detail,
|
|
311
|
+
filterText: `${chatAgentLeader}${agent.name}`,
|
|
312
|
+
insertText: `${agentLabel} `,
|
|
313
|
+
range,
|
|
314
|
+
kind: CompletionItemKind.Text,
|
|
315
|
+
sortText: `${chatAgentLeader}${agent.name}`,
|
|
316
|
+
command: { id: AssignSelectedAgentAction.ID, title: AssignSelectedAgentAction.ID, arguments: [{ agent, widget }] },
|
|
317
|
+
};
|
|
318
|
+
}));
|
|
319
|
+
return {
|
|
320
|
+
suggestions: justAgents.concat(coalesce(agents.flatMap(agent => ( agent.slashCommands.map((c, i) => {
|
|
321
|
+
if (agent.isDefault && this.chatAgentService.getDefaultAgent(widget.location, widget.input.currentModeKind)?.id !== agent.id) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const { label: agentLabel, isDupe } = this.getAgentCompletionDetails(agent);
|
|
325
|
+
const label = `${agentLabel} ${chatSubcommandLeader}${c.name}`;
|
|
326
|
+
const item = {
|
|
327
|
+
label: isDupe ?
|
|
328
|
+
{ label, description: c.description, detail: isDupe ? ` (${agent.publisherDisplayName})` : undefined } :
|
|
329
|
+
label,
|
|
330
|
+
documentation: c.description,
|
|
331
|
+
filterText: getFilterText(agent, c.name),
|
|
332
|
+
commitCharacters: [' '],
|
|
333
|
+
insertText: label + ' ',
|
|
334
|
+
range,
|
|
335
|
+
kind: CompletionItemKind.Text,
|
|
336
|
+
sortText: `x${chatAgentLeader}${agent.name}${c.name}`,
|
|
337
|
+
command: { id: AssignSelectedAgentAction.ID, title: AssignSelectedAgentAction.ID, arguments: [{ agent, widget }] },
|
|
338
|
+
};
|
|
339
|
+
if (agent.isDefault) {
|
|
340
|
+
const label = `${chatSubcommandLeader}${c.name}`;
|
|
341
|
+
item.label = label;
|
|
342
|
+
item.insertText = `${label} `;
|
|
343
|
+
item.documentation = c.description;
|
|
344
|
+
}
|
|
345
|
+
return item;
|
|
346
|
+
})))))
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}));
|
|
350
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
351
|
+
_debugDisplayName: 'chatAgentAndSubcommand',
|
|
352
|
+
triggerCharacters: [chatSubcommandLeader],
|
|
353
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
354
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
355
|
+
const viewModel = widget?.viewModel;
|
|
356
|
+
if (!widget || !viewModel) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (widget.lockedAgentId) {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
const range = computeCompletionRanges(model, position, /(@|\/)\w*/g);
|
|
363
|
+
if (!range) {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const agents = this.chatAgentService.getAgents()
|
|
370
|
+
.filter(a => a.locations.includes(widget.location) && a.modes.includes(widget.input.currentModeKind));
|
|
371
|
+
return {
|
|
372
|
+
suggestions: coalesce(agents.flatMap(agent => ( agent.slashCommands.map((c, i) => {
|
|
373
|
+
if (agent.isDefault && this.chatAgentService.getDefaultAgent(widget.location, widget.input.currentModeKind)?.id !== agent.id) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const { label: agentLabel, isDupe } = this.getAgentCompletionDetails(agent);
|
|
377
|
+
const withSlash = `${chatSubcommandLeader}${c.name}`;
|
|
378
|
+
const extraSortText = agent.id === 'github.copilot.terminalPanel' ? `z` : ``;
|
|
379
|
+
const sortText = `${chatSubcommandLeader}${extraSortText}${agent.name}${c.name}`;
|
|
380
|
+
const item = {
|
|
381
|
+
label: { label: withSlash, description: agentLabel, detail: isDupe ? ` (${agent.publisherDisplayName})` : undefined },
|
|
382
|
+
commitCharacters: [' '],
|
|
383
|
+
insertText: `${agentLabel} ${withSlash} `,
|
|
384
|
+
documentation: `(${agentLabel}) ${c.description ?? ''}`,
|
|
385
|
+
range,
|
|
386
|
+
kind: CompletionItemKind.Text,
|
|
387
|
+
sortText,
|
|
388
|
+
command: { id: AssignSelectedAgentAction.ID, title: AssignSelectedAgentAction.ID, arguments: [{ agent, widget }] },
|
|
389
|
+
};
|
|
390
|
+
if (agent.isDefault) {
|
|
391
|
+
const label = `${chatSubcommandLeader}${c.name}`;
|
|
392
|
+
item.label = label;
|
|
393
|
+
item.insertText = `${label} `;
|
|
394
|
+
item.documentation = c.description;
|
|
395
|
+
}
|
|
396
|
+
return item;
|
|
397
|
+
}))))
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
}));
|
|
401
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
402
|
+
_debugDisplayName: 'installChatExtensions',
|
|
403
|
+
triggerCharacters: [chatAgentLeader],
|
|
404
|
+
provideCompletionItems: async (model, position, _context, token) => {
|
|
405
|
+
if (!model.getLineContent(1).startsWith(chatAgentLeader)) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
409
|
+
if (widget?.location !== ChatAgentLocation.Chat || widget.input.currentModeKind !== ChatModeKind.Ask) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (widget.lockedAgentId) {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
const range = computeCompletionRanges(model, position, /(@|\/)\w*/g);
|
|
416
|
+
if (!range) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (!isEmptyUpToCompletionWord(model, range)) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const label = ( localize(5687, "Install Chat Extensions..."));
|
|
423
|
+
const item = {
|
|
424
|
+
label,
|
|
425
|
+
insertText: '',
|
|
426
|
+
range,
|
|
427
|
+
kind: CompletionItemKind.Text,
|
|
428
|
+
command: { id: 'workbench.extensions.search', title: '', arguments: ['@tag:chat-participant'] },
|
|
429
|
+
filterText: chatAgentLeader + label,
|
|
430
|
+
sortText: 'zzz'
|
|
431
|
+
};
|
|
432
|
+
return {
|
|
433
|
+
suggestions: [item]
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
}));
|
|
437
|
+
}
|
|
438
|
+
getCurrentAgentForWidget(widget) {
|
|
439
|
+
if (widget.lockedAgentId) {
|
|
440
|
+
const usedAgent = this.chatAgentService.getAgent(widget.lockedAgentId);
|
|
441
|
+
return usedAgent && { agent: usedAgent };
|
|
442
|
+
}
|
|
443
|
+
const parsedRequest = widget.parsedInput.parts;
|
|
444
|
+
const usedAgentIdx = parsedRequest.findIndex((p) => p instanceof ChatRequestAgentPart);
|
|
445
|
+
if (usedAgentIdx < 0) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const usedAgent = parsedRequest[usedAgentIdx];
|
|
449
|
+
const usedOtherCommand = parsedRequest.find(p => p instanceof ChatRequestAgentSubcommandPart || p instanceof ChatRequestSlashPromptPart);
|
|
450
|
+
if (usedOtherCommand) {
|
|
451
|
+
return {
|
|
452
|
+
agent: usedAgent.agent,
|
|
453
|
+
command: usedOtherCommand instanceof ChatRequestAgentSubcommandPart ? usedOtherCommand.command.name : undefined
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
for (const partAfterAgent of parsedRequest.slice(usedAgentIdx + 1)) {
|
|
457
|
+
if (!(partAfterAgent instanceof ChatRequestTextPart) || !partAfterAgent.text.trim().match(/^(\/\w*)?$/)) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return { agent: usedAgent.agent };
|
|
462
|
+
}
|
|
463
|
+
getAgentCompletionDetails(agent) {
|
|
464
|
+
const isAllowed = this.chatAgentNameService.getAgentNameRestriction(agent);
|
|
465
|
+
const agentLabel = `${chatAgentLeader}${isAllowed ? agent.name : getFullyQualifiedId(agent)}`;
|
|
466
|
+
const isDupe = isAllowed && this.chatAgentService.agentHasDupeName(agent.id);
|
|
467
|
+
return { label: agentLabel, isDupe };
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
AgentCompletions = ( __decorate([
|
|
471
|
+
( __param(0, ILanguageFeaturesService)),
|
|
472
|
+
( __param(1, IChatWidgetService)),
|
|
473
|
+
( __param(2, IChatAgentService)),
|
|
474
|
+
( __param(3, IChatAgentNameService))
|
|
475
|
+
], AgentCompletions));
|
|
476
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(AgentCompletions, LifecyclePhase.Eventually);
|
|
477
|
+
class AssignSelectedAgentAction extends Action2 {
|
|
478
|
+
static { this.ID = 'workbench.action.chat.assignSelectedAgent'; }
|
|
479
|
+
constructor() {
|
|
480
|
+
super({
|
|
481
|
+
id: AssignSelectedAgentAction.ID,
|
|
482
|
+
title: ''
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
async run(accessor, ...args) {
|
|
486
|
+
const arg = args[0];
|
|
487
|
+
if (!arg || !arg.widget || !arg.agent) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
if (!arg.agent.modes.includes(arg.widget.input.currentModeKind)) {
|
|
491
|
+
arg.widget.input.setChatMode(arg.agent.modes[0]);
|
|
492
|
+
}
|
|
493
|
+
arg.widget.lastSelectedAgent = arg.agent;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
registerAction2(AssignSelectedAgentAction);
|
|
497
|
+
class StartParameterizedPromptAction extends Action2 {
|
|
498
|
+
static { this.ID = 'workbench.action.chat.startParameterizedPrompt'; }
|
|
499
|
+
constructor() {
|
|
500
|
+
super({
|
|
501
|
+
id: StartParameterizedPromptAction.ID,
|
|
502
|
+
title: ''
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
async run(accessor, model, server, prompt, textToReplace) {
|
|
506
|
+
if (!model || !prompt) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
510
|
+
const notificationService = accessor.get(INotificationService);
|
|
511
|
+
const widgetService = accessor.get(IChatWidgetService);
|
|
512
|
+
const fileService = accessor.get(IFileService);
|
|
513
|
+
const chatWidget = await widgetService.revealWidget(true);
|
|
514
|
+
if (!chatWidget) {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
const lastPosition = model.getFullModelRange().collapseToEnd();
|
|
518
|
+
const getPromptIndex = () => model.findMatches(textToReplace, true, false, true, null, false)[0];
|
|
519
|
+
const replaceTextWith = (value) => model.applyEdits([{
|
|
520
|
+
range: getPromptIndex()?.range || lastPosition,
|
|
521
|
+
text: value,
|
|
522
|
+
}]);
|
|
523
|
+
const store = ( new DisposableStore());
|
|
524
|
+
const cts = store.add(( new CancellationTokenSource()));
|
|
525
|
+
store.add(chatWidget.input.startGenerating());
|
|
526
|
+
store.add(model.onDidChangeContent(() => {
|
|
527
|
+
if (getPromptIndex()) {
|
|
528
|
+
cts.cancel();
|
|
529
|
+
}
|
|
530
|
+
}));
|
|
531
|
+
model.changeDecorations(accessor => {
|
|
532
|
+
const id = accessor.addDecoration(lastPosition, {
|
|
533
|
+
description: 'mcp-prompt-spinner',
|
|
534
|
+
showIfCollapsed: true,
|
|
535
|
+
after: {
|
|
536
|
+
content: ' ',
|
|
537
|
+
inlineClassNameAffectsLetterSpacing: true,
|
|
538
|
+
inlineClassName: ThemeIcon.asClassName(ThemeIcon.modify(Codicon.loading, 'spin')) + ' chat-prompt-spinner',
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
store.add(toDisposable(() => {
|
|
542
|
+
model.changeDecorations(a => a.removeDecoration(id));
|
|
543
|
+
}));
|
|
544
|
+
});
|
|
545
|
+
const pick = store.add(instantiationService.createInstance(McpPromptArgumentPick, prompt));
|
|
546
|
+
try {
|
|
547
|
+
await server.start();
|
|
548
|
+
const args = await pick.createArgs();
|
|
549
|
+
if (!args) {
|
|
550
|
+
replaceTextWith('');
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
let messages;
|
|
554
|
+
try {
|
|
555
|
+
messages = await prompt.resolve(args, cts.token);
|
|
556
|
+
}
|
|
557
|
+
catch (e) {
|
|
558
|
+
if (!cts.token.isCancellationRequested) {
|
|
559
|
+
notificationService.error(( localize(5688, "Error resolving prompt: {0}", String(e))));
|
|
560
|
+
}
|
|
561
|
+
replaceTextWith('');
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const toAttach = [];
|
|
565
|
+
const attachBlob = async (mimeType, contents, uriStr, isText = false) => {
|
|
566
|
+
let validURI;
|
|
567
|
+
if (uriStr) {
|
|
568
|
+
for (const uri of [( URI.parse(uriStr)), McpResourceURI.fromServer(server.definition, uriStr)]) {
|
|
569
|
+
try {
|
|
570
|
+
validURI ||= (await fileService.exists(uri)) ? uri : undefined;
|
|
571
|
+
}
|
|
572
|
+
catch {
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (isText) {
|
|
577
|
+
if (validURI) {
|
|
578
|
+
toAttach.push({
|
|
579
|
+
id: generateUuid(),
|
|
580
|
+
kind: 'file',
|
|
581
|
+
value: validURI,
|
|
582
|
+
name: basename(validURI),
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
toAttach.push({
|
|
587
|
+
id: generateUuid(),
|
|
588
|
+
kind: 'generic',
|
|
589
|
+
value: contents,
|
|
590
|
+
name: ( localize(5689, 'Prompt Resource')),
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
else if (mimeType && getAttachableImageExtension(mimeType)) {
|
|
595
|
+
const resized = await resizeImage(contents)
|
|
596
|
+
.catch(() => decodeBase64(contents).buffer);
|
|
597
|
+
chatWidget.attachmentModel.addContext({
|
|
598
|
+
id: generateUuid(),
|
|
599
|
+
name: ( localize(5690, 'Prompt Image')),
|
|
600
|
+
fullName: ( localize(5690, 'Prompt Image')),
|
|
601
|
+
value: resized,
|
|
602
|
+
kind: 'image',
|
|
603
|
+
references: validURI && [{ reference: validURI, kind: 'reference' }],
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
else if (validURI) {
|
|
607
|
+
toAttach.push({
|
|
608
|
+
id: generateUuid(),
|
|
609
|
+
kind: 'file',
|
|
610
|
+
value: validURI,
|
|
611
|
+
name: basename(validURI),
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
const hasMultipleRoles = ( messages.some(m => m.role !== messages[0].role));
|
|
618
|
+
let input = '';
|
|
619
|
+
for (const message of messages) {
|
|
620
|
+
switch (message.content.type) {
|
|
621
|
+
case 'text':
|
|
622
|
+
if (input) {
|
|
623
|
+
input += '\n\n';
|
|
624
|
+
}
|
|
625
|
+
if (hasMultipleRoles) {
|
|
626
|
+
input += `--${message.role.toUpperCase()}\n`;
|
|
627
|
+
}
|
|
628
|
+
input += message.content.text;
|
|
629
|
+
break;
|
|
630
|
+
case 'resource':
|
|
631
|
+
if ('text' in message.content.resource) {
|
|
632
|
+
await attachBlob(message.content.resource.mimeType, message.content.resource.text, message.content.resource.uri, true);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
await attachBlob(message.content.resource.mimeType, message.content.resource.blob, message.content.resource.uri);
|
|
636
|
+
}
|
|
637
|
+
break;
|
|
638
|
+
case 'image':
|
|
639
|
+
case 'audio':
|
|
640
|
+
await attachBlob(message.content.mimeType, message.content.data);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if (toAttach.length) {
|
|
645
|
+
chatWidget.attachmentModel.addContext(...toAttach);
|
|
646
|
+
}
|
|
647
|
+
replaceTextWith(input);
|
|
648
|
+
}
|
|
649
|
+
finally {
|
|
650
|
+
store.dispose();
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
registerAction2(StartParameterizedPromptAction);
|
|
655
|
+
class ReferenceArgument {
|
|
656
|
+
constructor(widget, variable) {
|
|
657
|
+
this.widget = widget;
|
|
658
|
+
this.variable = variable;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
let BuiltinDynamicCompletions = class BuiltinDynamicCompletions extends Disposable {
|
|
662
|
+
static { BuiltinDynamicCompletions_1 = this; }
|
|
663
|
+
static { this.addReferenceCommand = '_addReferenceCmd'; }
|
|
664
|
+
static { this.VariableNameDef = ( new RegExp(`${chatVariableLeader}[\\w:-]*`, 'g')); }
|
|
665
|
+
constructor(historyService, workspaceContextService, searchService, labelService, languageFeaturesService, chatWidgetService, _chatEditingService, outlineService, editorService, configurationService, codeEditorService, chatAgentService, instantiationService) {
|
|
666
|
+
super();
|
|
667
|
+
this.historyService = historyService;
|
|
668
|
+
this.workspaceContextService = workspaceContextService;
|
|
669
|
+
this.searchService = searchService;
|
|
670
|
+
this.labelService = labelService;
|
|
671
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
672
|
+
this.chatWidgetService = chatWidgetService;
|
|
673
|
+
this._chatEditingService = _chatEditingService;
|
|
674
|
+
this.outlineService = outlineService;
|
|
675
|
+
this.editorService = editorService;
|
|
676
|
+
this.configurationService = configurationService;
|
|
677
|
+
this.codeEditorService = codeEditorService;
|
|
678
|
+
this.chatAgentService = chatAgentService;
|
|
679
|
+
this.instantiationService = instantiationService;
|
|
680
|
+
const fileWordPattern = ( new RegExp(`${chatVariableLeader}[^\\s]*`, 'g'));
|
|
681
|
+
this.registerVariableCompletions('fileAndFolder', async ({ widget, range }, token) => {
|
|
682
|
+
if (!widget.supportsFileReferences) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
const result = { suggestions: [] };
|
|
686
|
+
if (widget.lockedAgentId) {
|
|
687
|
+
const agent = this.chatAgentService.getAgent(widget.lockedAgentId);
|
|
688
|
+
if (agent && !agent.capabilities?.supportsFileAttachments) {
|
|
689
|
+
return result;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
await this.addFileAndFolderEntries(widget, result, range, token);
|
|
693
|
+
return result;
|
|
694
|
+
}, fileWordPattern);
|
|
695
|
+
this.registerVariableCompletions('selection', ({ widget, range }, token) => {
|
|
696
|
+
if (!widget.supportsFileReferences) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (widget.location === ChatAgentLocation.EditorInline) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
const active = this.findActiveCodeEditor();
|
|
703
|
+
if (!isCodeEditor(active)) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
const currentResource = active.getModel()?.uri;
|
|
707
|
+
const currentSelection = active.getSelection();
|
|
708
|
+
if (!currentSelection || !currentResource || currentSelection.isEmpty()) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
const basename = this.labelService.getUriBasenameLabel(currentResource);
|
|
712
|
+
const text = `${chatVariableLeader}file:${basename}:${currentSelection.startLineNumber}-${currentSelection.endLineNumber}`;
|
|
713
|
+
const fullRangeText = `:${currentSelection.startLineNumber}:${currentSelection.startColumn}-${currentSelection.endLineNumber}:${currentSelection.endColumn}`;
|
|
714
|
+
const description = this.labelService.getUriLabel(currentResource, { relative: true }) + fullRangeText;
|
|
715
|
+
const result = { suggestions: [] };
|
|
716
|
+
result.suggestions.push({
|
|
717
|
+
label: { label: `${chatVariableLeader}selection`, description },
|
|
718
|
+
filterText: `${chatVariableLeader}selection`,
|
|
719
|
+
insertText: range.varWord?.endColumn === range.replace.endColumn ? `${text} ` : text,
|
|
720
|
+
range,
|
|
721
|
+
kind: CompletionItemKind.Text,
|
|
722
|
+
sortText: 'z',
|
|
723
|
+
command: {
|
|
724
|
+
id: BuiltinDynamicCompletions_1.addReferenceCommand, title: '', arguments: [( new ReferenceArgument(widget, {
|
|
725
|
+
id: 'vscode.selection',
|
|
726
|
+
isFile: true,
|
|
727
|
+
range: { startLineNumber: range.replace.startLineNumber, startColumn: range.replace.startColumn, endLineNumber: range.replace.endLineNumber, endColumn: range.replace.startColumn + text.length },
|
|
728
|
+
data: { range: currentSelection, uri: currentResource }
|
|
729
|
+
}))]
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
return result;
|
|
733
|
+
});
|
|
734
|
+
this.registerVariableCompletions('symbol', ({ widget, range, position, model }, token) => {
|
|
735
|
+
if (!widget.supportsFileReferences) {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
const result = { suggestions: [] };
|
|
739
|
+
const range2 = computeCompletionRanges(model, position, ( new RegExp(`${chatVariableLeader}[^\\s]*`, 'g')), true);
|
|
740
|
+
if (range2) {
|
|
741
|
+
this.addSymbolEntries(widget, result, range2, token);
|
|
742
|
+
}
|
|
743
|
+
return result;
|
|
744
|
+
});
|
|
745
|
+
this._register(CommandsRegistry.registerCommand(BuiltinDynamicCompletions_1.addReferenceCommand, (_services, arg) => {
|
|
746
|
+
assertType(arg instanceof ReferenceArgument);
|
|
747
|
+
return this.cmdAddReference(arg);
|
|
748
|
+
}));
|
|
749
|
+
}
|
|
750
|
+
findActiveCodeEditor() {
|
|
751
|
+
const codeEditor = this.codeEditorService.getActiveCodeEditor();
|
|
752
|
+
if (codeEditor) {
|
|
753
|
+
const model = codeEditor.getModel();
|
|
754
|
+
if (model?.uri.scheme === Schemas.vscodeNotebookCell) {
|
|
755
|
+
return undefined;
|
|
756
|
+
}
|
|
757
|
+
if (model) {
|
|
758
|
+
return codeEditor;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
for (const codeOrDiffEditor of this.editorService.getVisibleTextEditorControls(EditorsOrder.MOST_RECENTLY_ACTIVE)) {
|
|
762
|
+
const codeEditor = getCodeEditor(codeOrDiffEditor);
|
|
763
|
+
if (!codeEditor) {
|
|
764
|
+
continue;
|
|
765
|
+
}
|
|
766
|
+
const model = codeEditor.getModel();
|
|
767
|
+
if (model) {
|
|
768
|
+
return codeEditor;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return undefined;
|
|
772
|
+
}
|
|
773
|
+
registerVariableCompletions(debugName, provider, wordPattern = BuiltinDynamicCompletions_1.VariableNameDef) {
|
|
774
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
775
|
+
_debugDisplayName: `chatVarCompletions-${debugName}`,
|
|
776
|
+
triggerCharacters: [chatVariableLeader],
|
|
777
|
+
provideCompletionItems: async (model, position, context, token) => {
|
|
778
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
779
|
+
if (!widget) {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
const range = computeCompletionRanges(model, position, wordPattern, true);
|
|
783
|
+
if (range) {
|
|
784
|
+
return provider({ model, position, widget, range, context }, token);
|
|
785
|
+
}
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
}));
|
|
789
|
+
}
|
|
790
|
+
async addFileAndFolderEntries(widget, result, info, token) {
|
|
791
|
+
const makeCompletionItem = (resource, kind, description, boostPriority) => {
|
|
792
|
+
const basename = this.labelService.getUriBasenameLabel(resource);
|
|
793
|
+
const text = `${chatVariableLeader}file:${basename}`;
|
|
794
|
+
const uriLabel = this.labelService.getUriLabel(resource, { relative: true });
|
|
795
|
+
const labelDescription = description
|
|
796
|
+
? ( localize(5691, '{0} ({1})', uriLabel, description))
|
|
797
|
+
: uriLabel;
|
|
798
|
+
const sortText = boostPriority ? ' ' : '!';
|
|
799
|
+
return {
|
|
800
|
+
label: { label: basename, description: labelDescription },
|
|
801
|
+
filterText: `${chatVariableLeader}${basename}`,
|
|
802
|
+
insertText: info.varWord?.endColumn === info.replace.endColumn ? `${text} ` : text,
|
|
803
|
+
range: info,
|
|
804
|
+
kind: kind === FileKind.FILE ? CompletionItemKind.File : CompletionItemKind.Folder,
|
|
805
|
+
sortText,
|
|
806
|
+
command: {
|
|
807
|
+
id: BuiltinDynamicCompletions_1.addReferenceCommand, title: '', arguments: [( new ReferenceArgument(widget, {
|
|
808
|
+
id: ( resource.toString()),
|
|
809
|
+
isFile: kind === FileKind.FILE,
|
|
810
|
+
isDirectory: kind === FileKind.FOLDER,
|
|
811
|
+
range: { startLineNumber: info.replace.startLineNumber, startColumn: info.replace.startColumn, endLineNumber: info.replace.endLineNumber, endColumn: info.replace.startColumn + text.length },
|
|
812
|
+
data: resource
|
|
813
|
+
}))]
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
let pattern;
|
|
818
|
+
if (info.varWord?.word && info.varWord.word.startsWith(chatVariableLeader)) {
|
|
819
|
+
pattern = info.varWord.word.toLowerCase().slice(1);
|
|
820
|
+
}
|
|
821
|
+
const seen = ( new ResourceSet());
|
|
822
|
+
const len = result.suggestions.length;
|
|
823
|
+
for (const [i, item] of this.historyService.getHistory().entries()) {
|
|
824
|
+
if (!item.resource || ( seen.has(item.resource)) || !this.instantiationService.invokeFunction(accessor => isSupportedChatFileScheme(accessor, item.resource.scheme))) {
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
if (pattern) {
|
|
828
|
+
const basename = this.labelService.getUriBasenameLabel(item.resource).toLowerCase();
|
|
829
|
+
if (!isPatternInWord(pattern, 0, pattern.length, basename, 0, basename.length)) {
|
|
830
|
+
continue;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
seen.add(item.resource);
|
|
834
|
+
const newLen = result.suggestions.push(makeCompletionItem(item.resource, FileKind.FILE, i === 0 ? ( localize(5692, 'Active file')) : undefined, i === 0));
|
|
835
|
+
if (newLen - len >= 5) {
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (widget.input.currentModeKind !== ChatModeKind.Ask && widget.viewModel && widget.viewModel.model.editingSession) {
|
|
840
|
+
const relatedFiles = (await raceTimeout(this._chatEditingService.getRelatedFiles(widget.viewModel.sessionResource, widget.getInput(), widget.attachmentModel.fileAttachments, token), 200)) ?? [];
|
|
841
|
+
for (const relatedFileGroup of relatedFiles) {
|
|
842
|
+
for (const relatedFile of relatedFileGroup.files) {
|
|
843
|
+
if (!( seen.has(relatedFile.uri))) {
|
|
844
|
+
seen.add(relatedFile.uri);
|
|
845
|
+
result.suggestions.push(makeCompletionItem(relatedFile.uri, FileKind.FILE, relatedFile.description));
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (pattern) {
|
|
851
|
+
const cacheKey = this.updateCacheKey();
|
|
852
|
+
const workspaces = ( this.workspaceContextService.getWorkspace().folders.map(folder => folder.uri));
|
|
853
|
+
for (const workspace of workspaces) {
|
|
854
|
+
const { folders, files } = await searchFilesAndFolders(workspace, pattern, true, token, cacheKey.key, this.configurationService, this.searchService);
|
|
855
|
+
for (const file of files) {
|
|
856
|
+
if (!( seen.has(file))) {
|
|
857
|
+
result.suggestions.push(makeCompletionItem(file, FileKind.FILE));
|
|
858
|
+
seen.add(file);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
for (const folder of folders) {
|
|
862
|
+
if (!( seen.has(folder))) {
|
|
863
|
+
result.suggestions.push(makeCompletionItem(folder, FileKind.FOLDER));
|
|
864
|
+
seen.add(folder);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
result.incomplete = true;
|
|
870
|
+
}
|
|
871
|
+
addSymbolEntries(widget, result, info, token) {
|
|
872
|
+
const makeSymbolCompletionItem = (symbolItem, pattern) => {
|
|
873
|
+
const text = `${chatVariableLeader}sym:${symbolItem.name}`;
|
|
874
|
+
const resource = symbolItem.location.uri;
|
|
875
|
+
const uriLabel = this.labelService.getUriLabel(resource, { relative: true });
|
|
876
|
+
const sortText = pattern ? '{' : '|' ;
|
|
877
|
+
return {
|
|
878
|
+
label: { label: symbolItem.name, description: uriLabel },
|
|
879
|
+
filterText: `${chatVariableLeader}${symbolItem.name}`,
|
|
880
|
+
insertText: info.varWord?.endColumn === info.replace.endColumn ? `${text} ` : text,
|
|
881
|
+
range: info,
|
|
882
|
+
kind: SymbolKinds.toCompletionKind(symbolItem.kind),
|
|
883
|
+
sortText,
|
|
884
|
+
command: {
|
|
885
|
+
id: BuiltinDynamicCompletions_1.addReferenceCommand, title: '', arguments: [( new ReferenceArgument(widget, {
|
|
886
|
+
id: `vscode.symbol/${JSON.stringify(symbolItem.location)}`,
|
|
887
|
+
fullName: symbolItem.name,
|
|
888
|
+
range: { startLineNumber: info.replace.startLineNumber, startColumn: info.replace.startColumn, endLineNumber: info.replace.endLineNumber, endColumn: info.replace.startColumn + text.length },
|
|
889
|
+
data: symbolItem.location,
|
|
890
|
+
icon: SymbolKinds.toIcon(symbolItem.kind)
|
|
891
|
+
}))]
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
};
|
|
895
|
+
let pattern;
|
|
896
|
+
if (info.varWord?.word && info.varWord.word.startsWith(chatVariableLeader)) {
|
|
897
|
+
pattern = info.varWord.word.toLowerCase().slice(1);
|
|
898
|
+
}
|
|
899
|
+
const symbolsToAdd = [];
|
|
900
|
+
for (const outlineModel of this.outlineService.getCachedModels()) {
|
|
901
|
+
const symbols = outlineModel.asListOfDocumentSymbols();
|
|
902
|
+
for (const symbol of symbols) {
|
|
903
|
+
symbolsToAdd.push({ symbol, uri: outlineModel.uri });
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
for (const symbol of symbolsToAdd) {
|
|
907
|
+
result.suggestions.push(makeSymbolCompletionItem({ ...symbol.symbol, location: { uri: symbol.uri, range: symbol.symbol.range } }, pattern ?? ''));
|
|
908
|
+
}
|
|
909
|
+
result.incomplete = !!pattern;
|
|
910
|
+
}
|
|
911
|
+
updateCacheKey() {
|
|
912
|
+
if (this.cacheKey && Date.now() - this.cacheKey.time > 60000) {
|
|
913
|
+
this.searchService.clearCache(this.cacheKey.key);
|
|
914
|
+
this.cacheKey = undefined;
|
|
915
|
+
}
|
|
916
|
+
if (!this.cacheKey) {
|
|
917
|
+
this.cacheKey = {
|
|
918
|
+
key: generateUuid(),
|
|
919
|
+
time: Date.now()
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
this.cacheKey.time = Date.now();
|
|
923
|
+
return this.cacheKey;
|
|
924
|
+
}
|
|
925
|
+
cmdAddReference(arg) {
|
|
926
|
+
arg.widget.getContrib(ChatDynamicVariableModel.ID)?.addReference(arg.variable);
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
BuiltinDynamicCompletions = BuiltinDynamicCompletions_1 = ( __decorate([
|
|
930
|
+
( __param(0, IHistoryService)),
|
|
931
|
+
( __param(1, IWorkspaceContextService)),
|
|
932
|
+
( __param(2, ISearchService)),
|
|
933
|
+
( __param(3, ILabelService)),
|
|
934
|
+
( __param(4, ILanguageFeaturesService)),
|
|
935
|
+
( __param(5, IChatWidgetService)),
|
|
936
|
+
( __param(6, IChatEditingService)),
|
|
937
|
+
( __param(7, IOutlineModelService)),
|
|
938
|
+
( __param(8, IEditorService)),
|
|
939
|
+
( __param(9, IConfigurationService)),
|
|
940
|
+
( __param(10, ICodeEditorService)),
|
|
941
|
+
( __param(11, IChatAgentService)),
|
|
942
|
+
( __param(12, IInstantiationService))
|
|
943
|
+
], BuiltinDynamicCompletions));
|
|
944
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(BuiltinDynamicCompletions, LifecyclePhase.Eventually);
|
|
945
|
+
function computeCompletionRanges(model, position, reg, onlyOnWordStart = false) {
|
|
946
|
+
const varWord = getWordAtText(position.column, reg, model.getLineContent(position.lineNumber), 0);
|
|
947
|
+
if (!varWord && model.getWordUntilPosition(position).word) {
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
if (!varWord && position.column > 1) {
|
|
951
|
+
const textBefore = model.getValueInRange(( new Range(
|
|
952
|
+
position.lineNumber,
|
|
953
|
+
position.column - 1,
|
|
954
|
+
position.lineNumber,
|
|
955
|
+
position.column
|
|
956
|
+
)));
|
|
957
|
+
if (textBefore !== ' ') {
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
if (varWord && onlyOnWordStart) {
|
|
962
|
+
const wordBefore = model.getWordUntilPosition({ lineNumber: position.lineNumber, column: varWord.startColumn });
|
|
963
|
+
if (wordBefore.word) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
let insert;
|
|
968
|
+
let replace;
|
|
969
|
+
if (!varWord) {
|
|
970
|
+
insert = replace = Range.fromPositions(position);
|
|
971
|
+
}
|
|
972
|
+
else {
|
|
973
|
+
insert = ( new Range(
|
|
974
|
+
position.lineNumber,
|
|
975
|
+
varWord.startColumn,
|
|
976
|
+
position.lineNumber,
|
|
977
|
+
position.column
|
|
978
|
+
));
|
|
979
|
+
replace = ( new Range(
|
|
980
|
+
position.lineNumber,
|
|
981
|
+
varWord.startColumn,
|
|
982
|
+
position.lineNumber,
|
|
983
|
+
varWord.endColumn
|
|
984
|
+
));
|
|
985
|
+
}
|
|
986
|
+
return { insert, replace, varWord };
|
|
987
|
+
}
|
|
988
|
+
function isEmptyUpToCompletionWord(model, rangeResult) {
|
|
989
|
+
const startToCompletionWordStart = ( new Range(1, 1, rangeResult.replace.startLineNumber, rangeResult.replace.startColumn));
|
|
990
|
+
return !!model.getValueInRange(startToCompletionWordStart).match(/^\s*$/);
|
|
991
|
+
}
|
|
992
|
+
let ToolCompletions = class ToolCompletions extends Disposable {
|
|
993
|
+
static { ToolCompletions_1 = this; }
|
|
994
|
+
static { this.VariableNameDef = ( new RegExp(`(?<=^|\\s)${chatVariableLeader}\\w*`, 'g')); }
|
|
995
|
+
constructor(languageFeaturesService, chatWidgetService, chatAgentService) {
|
|
996
|
+
super();
|
|
997
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
998
|
+
this.chatWidgetService = chatWidgetService;
|
|
999
|
+
this.chatAgentService = chatAgentService;
|
|
1000
|
+
this._register(this.languageFeaturesService.completionProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, {
|
|
1001
|
+
_debugDisplayName: 'chatVariables',
|
|
1002
|
+
triggerCharacters: [chatVariableLeader],
|
|
1003
|
+
provideCompletionItems: async (model, position, _context, _token) => {
|
|
1004
|
+
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
|
|
1005
|
+
if (!widget) {
|
|
1006
|
+
return null;
|
|
1007
|
+
}
|
|
1008
|
+
if (widget.lockedAgentId) {
|
|
1009
|
+
const agent = this.chatAgentService.getAgent(widget.lockedAgentId);
|
|
1010
|
+
if (agent && !agent.capabilities?.supportsToolAttachments) {
|
|
1011
|
+
return null;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
const range = computeCompletionRanges(model, position, ToolCompletions_1.VariableNameDef, true);
|
|
1015
|
+
if (!range) {
|
|
1016
|
+
return null;
|
|
1017
|
+
}
|
|
1018
|
+
const usedNames = ( new Set());
|
|
1019
|
+
for (const part of widget.parsedInput.parts) {
|
|
1020
|
+
if (part instanceof ChatRequestToolPart) {
|
|
1021
|
+
usedNames.add(part.toolName);
|
|
1022
|
+
}
|
|
1023
|
+
else if (part instanceof ChatRequestToolSetPart) {
|
|
1024
|
+
usedNames.add(part.name);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
const suggestions = [];
|
|
1028
|
+
const iter = widget.input.selectedToolsModel.entriesMap.get();
|
|
1029
|
+
for (const [item, enabled] of iter) {
|
|
1030
|
+
if (!enabled) {
|
|
1031
|
+
continue;
|
|
1032
|
+
}
|
|
1033
|
+
let detail;
|
|
1034
|
+
let name;
|
|
1035
|
+
if (item instanceof ToolSet) {
|
|
1036
|
+
detail = item.description;
|
|
1037
|
+
name = item.referenceName;
|
|
1038
|
+
}
|
|
1039
|
+
else {
|
|
1040
|
+
const source = item.source;
|
|
1041
|
+
detail = ( localize(5693, "{0}: {1}", source.label, item.displayName));
|
|
1042
|
+
name = item.toolReferenceName ?? item.displayName;
|
|
1043
|
+
}
|
|
1044
|
+
if (( usedNames.has(name))) {
|
|
1045
|
+
continue;
|
|
1046
|
+
}
|
|
1047
|
+
const withLeader = `${chatVariableLeader}${name}`;
|
|
1048
|
+
suggestions.push({
|
|
1049
|
+
label: withLeader,
|
|
1050
|
+
range,
|
|
1051
|
+
detail,
|
|
1052
|
+
insertText: withLeader + ' ',
|
|
1053
|
+
kind: CompletionItemKind.Tool,
|
|
1054
|
+
sortText: 'z',
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
return { suggestions };
|
|
1058
|
+
}
|
|
1059
|
+
}));
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
ToolCompletions = ToolCompletions_1 = ( __decorate([
|
|
1063
|
+
( __param(0, ILanguageFeaturesService)),
|
|
1064
|
+
( __param(1, IChatWidgetService)),
|
|
1065
|
+
( __param(2, IChatAgentService))
|
|
1066
|
+
], ToolCompletions));
|
|
1067
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ToolCompletions, LifecyclePhase.Eventually);
|
|
1068
|
+
|
|
1069
|
+
export { computeCompletionRanges };
|