@codingame/monaco-vscode-chat-service-override 16.1.1 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -6
- package/package.json +30 -27
- package/vscode/src/vs/base/common/objectCache.d.ts +1 -1
- package/vscode/src/vs/base/common/objectCache.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +41 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +16 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +4 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +410 -443
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +1 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +3 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +9 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +32 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatAttachInstructionsAction.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatAttachInstructionsAction.js +61 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatRunPromptAction.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatRunPromptAction.js +159 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatSaveToPromptAction.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatSaveToPromptAction.js +140 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/promptFilePickers.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/promptFilePickers.js +244 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/attachInstructions.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/attachInstructions.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/runPrompt.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/runPrompt.js +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/index.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/index.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +171 -168
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +48 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +46 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +118 -123
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +5 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +45 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +12 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +48 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +53 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +32 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +9 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +80 -268
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +214 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +7 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +26 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +186 -106
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +129 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +313 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +4 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +12 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +42 -181
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +2 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +484 -384
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +187 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusItemService.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +3 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +8 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +264 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +28 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +41 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +8 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +2 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css +20 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/media/simpleBrowserOverlay.css +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/attachInstructionsCommand.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/attachInstructionsCommand.js +73 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +82 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +44 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +24 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +7 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +14 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +8 -7
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +84 -80
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.js +27 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/index.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/index.js +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/index.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/index.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterDecoration.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterDecoration.js +74 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterMarkerDecoration.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterMarkerDecoration.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/decorationBase.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/decorationBase.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/index.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/index.js +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/reactiveDecorationBase.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/reactiveDecorationBase.js +68 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/types.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/promptDecorationsProvider.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/promptDecorationsProvider.js +121 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/types.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/types.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptHeaderDiagnosticsProvider.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptHeaderDiagnosticsProvider.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkDiagnosticsProvider.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkDiagnosticsProvider.js +65 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/{languageFeatures → contributions/languageFeatures/providers}/promptLinkProvider.js +3 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/{languageFeatures → contributions/languageFeatures/providers}/promptPathAutocompletion.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/{languageFeatures → contributions/languageFeatures/providers}/promptPathAutocompletion.js +14 -19
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceBase.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceBase.js +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceManagerBase.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceManagerBase.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +8 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +17 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +223 -21
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +5 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +28 -22
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/treeUtils.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/treeUtils.js +25 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +20 -31
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +15 -12
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +12 -12
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.d.ts +0 -2
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.js +1 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +0 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/askToSelectPrompt.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/askToSelectPrompt.js +0 -79
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.js +0 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.js +0 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.js +0 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.js +0 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.js +0 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +0 -80
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +0 -64
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.js +0 -117
- /package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/{languageFeatures → contributions/languageFeatures/providers}/promptLinkProvider.d.ts +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
|
|
2
|
+
import { groupBy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
2
3
|
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
3
4
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
4
5
|
import { KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
6
|
+
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
7
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
6
8
|
import { isElectron } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
|
-
import { basename, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
8
|
-
import { compare } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
9
|
+
import { basename, dirname, extUri } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
9
10
|
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
10
11
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
11
12
|
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
13
|
+
import { SymbolKinds } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
12
14
|
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
13
15
|
import { AbstractGotoSymbolQuickAccessProvider } from '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess';
|
|
14
16
|
import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
@@ -23,53 +25,66 @@ import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platf
|
|
|
23
25
|
import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
24
26
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
25
27
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
28
|
+
import { MarkerSeverity } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers';
|
|
29
|
+
import { IMarkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service';
|
|
26
30
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
27
31
|
import { ActiveEditorContext, TextCompareEditorActiveContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
28
32
|
import { EditorResourceAccessor, SideBySideEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
29
|
-
import { DiffEditorInput } from '@codingame/monaco-vscode-
|
|
33
|
+
import { DiffEditorInput } from '@codingame/monaco-vscode-9c72783f-914c-50be-b9ef-da16356d81a8-common/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
30
34
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
31
|
-
import { isProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
|
|
32
|
-
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
33
35
|
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
34
36
|
import { VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/search/common/search';
|
|
35
|
-
import { UntitledTextEditorInput } from '@codingame/monaco-vscode-
|
|
37
|
+
import { UntitledTextEditorInput } from '@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput';
|
|
36
38
|
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
37
|
-
import { FileEditorInput } from '@codingame/monaco-vscode-
|
|
38
|
-
import { TEXT_FILE_EDITOR_ID } from '@codingame/monaco-vscode-
|
|
39
|
-
import { NotebookEditorInput } from '@codingame/monaco-vscode-
|
|
39
|
+
import { FileEditorInput } from '@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
40
|
+
import { TEXT_FILE_EDITOR_ID } from '@codingame/monaco-vscode-97284942-b044-5fbb-b53b-3f46d2468746-common/vscode/vs/workbench/contrib/files/common/files';
|
|
41
|
+
import { NotebookEditorInput } from '@codingame/monaco-vscode-324f9a6e-6231-5bfc-af17-e147abd2dfd2-common/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
40
42
|
import { AnythingQuickAccessProvider } from '@codingame/monaco-vscode-64322fa2-7385-5f46-935b-8f243d98004b-common/vscode/vs/workbench/contrib/search/browser/anythingQuickAccess';
|
|
41
43
|
import { isSearchTreeFileMatch, isSearchTreeMatch } from '@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common/vscode/vs/workbench/contrib/search/browser/searchTreeModel/searchTreeCommon';
|
|
42
44
|
import { SymbolsQuickAccessProvider } from '@codingame/monaco-vscode-64322fa2-7385-5f46-935b-8f243d98004b-common/vscode/vs/workbench/contrib/search/browser/symbolsQuickAccess';
|
|
43
45
|
import { SearchContext } from '@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common/vscode/vs/workbench/contrib/search/common/constants';
|
|
44
46
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
45
|
-
import { ChatContextKeys
|
|
47
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
46
48
|
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
47
|
-
import { IDiagnosticVariableEntryFilterData } from '@codingame/monaco-vscode-
|
|
48
|
-
import { ChatRequestAgentPart } from '@codingame/monaco-vscode-
|
|
49
|
-
import { IChatVariablesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
|
|
49
|
+
import { OmittedState, IDiagnosticVariableEntryFilterData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
50
|
+
import { ChatRequestAgentPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
50
51
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
51
|
-
import {
|
|
52
|
-
import { showChatView, showEditsView } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
52
|
+
import { showChatView } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
53
53
|
import { IChatWidgetService, IQuickChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
54
|
-
import { imageToHash, isImage } from '@codingame/monaco-vscode-
|
|
55
|
-
import { isQuickChat } from '@codingame/monaco-vscode-
|
|
56
|
-
import {
|
|
57
|
-
import { convertBufferToScreenshotVariable, ScreenshotVariableId } from '@codingame/monaco-vscode-
|
|
58
|
-
import { resizeImage } from '@codingame/monaco-vscode-
|
|
59
|
-
import {
|
|
60
|
-
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-
|
|
61
|
-
import {
|
|
54
|
+
import { imageToHash, isImage } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/chatPasteProviders';
|
|
55
|
+
import { isQuickChat } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
56
|
+
import { createFilesAndFolderQuickPick } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
|
|
57
|
+
import { convertBufferToScreenshotVariable, ScreenshotVariableId } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/contrib/screenshot';
|
|
58
|
+
import { resizeImage } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/imageUtils';
|
|
59
|
+
import { INSTRUCTIONS_COMMAND_ID } from '../promptSyntax/contributions/attachInstructionsCommand.js';
|
|
60
|
+
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
61
|
+
import { registerPromptActions } from './promptActions/index.js';
|
|
62
|
+
import { runAttachInstructionsAction } from './promptActions/chatAttachInstructionsAction.js';
|
|
62
63
|
|
|
63
64
|
function registerChatContextActions() {
|
|
64
65
|
registerAction2(AttachContextAction);
|
|
65
66
|
registerAction2(AttachFileToChatAction);
|
|
66
67
|
registerAction2(AttachFolderToChatAction);
|
|
67
68
|
registerAction2(AttachSelectionToChatAction);
|
|
68
|
-
registerAction2(AttachFileToEditingSessionAction);
|
|
69
|
-
registerAction2(AttachFolderToEditingSessionAction);
|
|
70
|
-
registerAction2(AttachSelectionToEditingSessionAction);
|
|
71
69
|
registerAction2(AttachSearchResultAction);
|
|
72
70
|
}
|
|
71
|
+
function isIAttachmentQuickPickItem(obj) {
|
|
72
|
+
return (typeof obj === 'object'
|
|
73
|
+
&& obj !== null
|
|
74
|
+
&& typeof obj.kind === 'string');
|
|
75
|
+
}
|
|
76
|
+
const attachmentsOrdinals = [
|
|
77
|
+
'tools',
|
|
78
|
+
'command',
|
|
79
|
+
'screenshot',
|
|
80
|
+
'image',
|
|
81
|
+
'workspaceSymbol',
|
|
82
|
+
'diagnostic',
|
|
83
|
+
'instructions',
|
|
84
|
+
'related-files',
|
|
85
|
+
'folder',
|
|
86
|
+
'open-editors',
|
|
87
|
+
];
|
|
73
88
|
function isIGotoSymbolQuickPickItem(obj) {
|
|
74
89
|
return (typeof obj === 'object'
|
|
75
90
|
&& typeof obj.symbolName === 'string'
|
|
@@ -81,42 +96,12 @@ function isISymbolQuickPickItem(obj) {
|
|
|
81
96
|
&& typeof obj.symbol === 'object'
|
|
82
97
|
&& !!obj.symbol);
|
|
83
98
|
}
|
|
84
|
-
function isIFolderSearchResultQuickPickItem(obj) {
|
|
85
|
-
return (typeof obj === 'object'
|
|
86
|
-
&& obj.kind === 'folder-search-result');
|
|
87
|
-
}
|
|
88
|
-
function isIDiagnosticsQuickPickItemWithFilter(obj) {
|
|
89
|
-
return (typeof obj === 'object'
|
|
90
|
-
&& obj.kind === 'diagnostic-filter');
|
|
91
|
-
}
|
|
92
99
|
function isIQuickPickItemWithResource(obj) {
|
|
93
100
|
return (typeof obj === 'object'
|
|
94
101
|
&& typeof obj.resource === 'object'
|
|
95
102
|
&& URI.isUri(obj.resource));
|
|
96
103
|
}
|
|
97
|
-
|
|
98
|
-
return (typeof obj === 'object'
|
|
99
|
-
&& obj.id === 'open-editors');
|
|
100
|
-
}
|
|
101
|
-
function isISearchResultsQuickPickItem(obj) {
|
|
102
|
-
return (typeof obj === 'object'
|
|
103
|
-
&& obj.kind === 'search-results');
|
|
104
|
-
}
|
|
105
|
-
function isScreenshotQuickPickItem(obj) {
|
|
106
|
-
return (typeof obj === 'object'
|
|
107
|
-
&& obj.kind === 'screenshot');
|
|
108
|
-
}
|
|
109
|
-
function isRelatedFileQuickPickItem(obj) {
|
|
110
|
-
return (typeof obj === 'object'
|
|
111
|
-
&& obj.kind === 'related-files');
|
|
112
|
-
}
|
|
113
|
-
function isPromptInstructionsQuickPickItem(obj) {
|
|
114
|
-
if (!obj || typeof obj !== 'object') {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
return ('kind' in obj && obj.kind === 'reusable-prompt');
|
|
118
|
-
}
|
|
119
|
-
const REUSABLE_PROMPT_PICK_ID = 'reusable-prompt';
|
|
104
|
+
const INSTRUCTION_PICK_ID = 'instructions';
|
|
120
105
|
class AttachResourceAction extends Action2 {
|
|
121
106
|
getResources(accessor, ...args) {
|
|
122
107
|
const editorService = accessor.get(IEditorService);
|
|
@@ -148,7 +133,7 @@ class AttachFileToChatAction extends AttachResourceAction {
|
|
|
148
133
|
constructor() {
|
|
149
134
|
super({
|
|
150
135
|
id: AttachFileToChatAction.ID,
|
|
151
|
-
title: ( localize2(
|
|
136
|
+
title: ( localize2(4399, "Add File to Chat")),
|
|
152
137
|
category: CHAT_CATEGORY,
|
|
153
138
|
f1: false,
|
|
154
139
|
menu: [{
|
|
@@ -160,12 +145,16 @@ class AttachFileToChatAction extends AttachResourceAction {
|
|
|
160
145
|
});
|
|
161
146
|
}
|
|
162
147
|
async run(accessor, ...args) {
|
|
163
|
-
const
|
|
148
|
+
const viewsService = accessor.get(IViewsService);
|
|
164
149
|
const files = this.getResources(accessor, ...args);
|
|
165
|
-
if (files.length) {
|
|
166
|
-
|
|
150
|
+
if (!files.length) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const widget = await showChatView(viewsService);
|
|
154
|
+
if (widget) {
|
|
155
|
+
widget.focusInput();
|
|
167
156
|
for (const file of files) {
|
|
168
|
-
|
|
157
|
+
widget.attachmentModel.addFile(file);
|
|
169
158
|
}
|
|
170
159
|
}
|
|
171
160
|
}
|
|
@@ -175,18 +164,22 @@ class AttachFolderToChatAction extends AttachResourceAction {
|
|
|
175
164
|
constructor() {
|
|
176
165
|
super({
|
|
177
166
|
id: AttachFolderToChatAction.ID,
|
|
178
|
-
title: ( localize2(
|
|
167
|
+
title: ( localize2(4400, "Add Folder to Chat")),
|
|
179
168
|
category: CHAT_CATEGORY,
|
|
180
169
|
f1: false,
|
|
181
170
|
});
|
|
182
171
|
}
|
|
183
172
|
async run(accessor, ...args) {
|
|
184
|
-
const
|
|
173
|
+
const viewsService = accessor.get(IViewsService);
|
|
185
174
|
const folders = this.getResources(accessor, ...args);
|
|
186
|
-
if (folders.length) {
|
|
187
|
-
|
|
175
|
+
if (!folders.length) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const widget = await showChatView(viewsService);
|
|
179
|
+
if (widget) {
|
|
180
|
+
widget.focusInput();
|
|
188
181
|
for (const folder of folders) {
|
|
189
|
-
|
|
182
|
+
widget.attachmentModel.addFolder(folder);
|
|
190
183
|
}
|
|
191
184
|
}
|
|
192
185
|
}
|
|
@@ -196,14 +189,18 @@ class AttachSelectionToChatAction extends Action2 {
|
|
|
196
189
|
constructor() {
|
|
197
190
|
super({
|
|
198
191
|
id: AttachSelectionToChatAction.ID,
|
|
199
|
-
title: ( localize2(
|
|
192
|
+
title: ( localize2(4401, "Add Selection to Chat")),
|
|
200
193
|
category: CHAT_CATEGORY,
|
|
201
194
|
f1: false,
|
|
202
195
|
});
|
|
203
196
|
}
|
|
204
197
|
async run(accessor, ...args) {
|
|
205
|
-
const variablesService = accessor.get(IChatVariablesService);
|
|
206
198
|
const editorService = accessor.get(IEditorService);
|
|
199
|
+
const viewsService = accessor.get(IViewsService);
|
|
200
|
+
const widget = await showChatView(viewsService);
|
|
201
|
+
if (!widget) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
207
204
|
const [_, matches] = args;
|
|
208
205
|
if (matches && matches.length > 0) {
|
|
209
206
|
const uris = ( new Map());
|
|
@@ -217,65 +214,37 @@ class AttachSelectionToChatAction extends Action2 {
|
|
|
217
214
|
if (!range ||
|
|
218
215
|
range.startLineNumber !== context.range.startLineNumber && range.endLineNumber !== context.range.endLineNumber) {
|
|
219
216
|
uris.set(context.uri, context.range);
|
|
220
|
-
|
|
217
|
+
widget.attachmentModel.addFile(context.uri, context.range);
|
|
221
218
|
}
|
|
222
219
|
}
|
|
223
220
|
}
|
|
224
221
|
for (const uri of uris) {
|
|
225
222
|
const [resource, range] = uri;
|
|
226
223
|
if (!range) {
|
|
227
|
-
|
|
224
|
+
widget.attachmentModel.addFile(resource);
|
|
228
225
|
}
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
else {
|
|
232
229
|
const activeEditor = editorService.activeTextEditorControl;
|
|
233
230
|
const activeUri = EditorResourceAccessor.getCanonicalUri(editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
234
|
-
if (
|
|
235
|
-
const selection = activeEditor
|
|
231
|
+
if (activeEditor && activeUri && [Schemas.file, Schemas.vscodeRemote, Schemas.untitled].includes(activeUri.scheme)) {
|
|
232
|
+
const selection = activeEditor.getSelection();
|
|
236
233
|
if (selection) {
|
|
237
|
-
|
|
234
|
+
widget.focusInput();
|
|
238
235
|
const range = selection.isEmpty() ? ( new Range(selection.startLineNumber, 1, selection.startLineNumber + 1, 1)) : selection;
|
|
239
|
-
|
|
236
|
+
widget.attachmentModel.addFile(activeUri, range);
|
|
240
237
|
}
|
|
241
238
|
}
|
|
242
239
|
}
|
|
243
240
|
}
|
|
244
241
|
}
|
|
245
|
-
class AttachFileToEditingSessionAction extends AttachResourceAction {
|
|
246
|
-
static { this.ID = 'workbench.action.edits.attachFile'; }
|
|
247
|
-
constructor() {
|
|
248
|
-
super({
|
|
249
|
-
id: AttachFileToEditingSessionAction.ID,
|
|
250
|
-
title: ( localize2(4385, "Add File to {0}", 'Copilot Edits')),
|
|
251
|
-
category: CHAT_CATEGORY,
|
|
252
|
-
f1: false,
|
|
253
|
-
menu: [{
|
|
254
|
-
id: MenuId.SearchContext,
|
|
255
|
-
group: 'z_chat',
|
|
256
|
-
order: 2,
|
|
257
|
-
when: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.or(( ActiveEditorContext.isEqualTo(TEXT_FILE_EDITOR_ID)), TextCompareEditorActiveContext)), ( ChatContextKeyExprs.unifiedChatEnabled.negate()), ( SearchContext.SearchResultHeaderFocused.negate()))),
|
|
258
|
-
}]
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
async run(accessor, ...args) {
|
|
262
|
-
const variablesService = accessor.get(IChatVariablesService);
|
|
263
|
-
const files = this.getResources(accessor, ...args);
|
|
264
|
-
if (files.length) {
|
|
265
|
-
(await showEditsView(accessor.get(IViewsService)))?.focusInput();
|
|
266
|
-
for (const file of files) {
|
|
267
|
-
variablesService.attachContext('file', file, ChatAgentLocation.EditingSession);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
242
|
class AttachSearchResultAction extends Action2 {
|
|
273
243
|
static { this.Name = 'searchResults'; }
|
|
274
|
-
static { this.ID = 'workbench.action.chat.insertSearchResults'; }
|
|
275
244
|
constructor() {
|
|
276
245
|
super({
|
|
277
|
-
id:
|
|
278
|
-
title: ( localize2(
|
|
246
|
+
id: 'workbench.action.chat.insertSearchResults',
|
|
247
|
+
title: ( localize2(4402, 'Add Search Results to Chat')),
|
|
279
248
|
category: CHAT_CATEGORY,
|
|
280
249
|
f1: false,
|
|
281
250
|
menu: [{
|
|
@@ -286,9 +255,9 @@ class AttachSearchResultAction extends Action2 {
|
|
|
286
255
|
}]
|
|
287
256
|
});
|
|
288
257
|
}
|
|
289
|
-
async run(accessor
|
|
258
|
+
async run(accessor) {
|
|
290
259
|
const logService = accessor.get(ILogService);
|
|
291
|
-
const widget =
|
|
260
|
+
const widget = await showChatView(accessor.get(IViewsService));
|
|
292
261
|
if (!widget) {
|
|
293
262
|
logService.trace('InsertSearchResultAction: no chat view available');
|
|
294
263
|
return;
|
|
@@ -304,7 +273,7 @@ class AttachSearchResultAction extends Action2 {
|
|
|
304
273
|
originalRange.startLineNumber,
|
|
305
274
|
originalRange.startColumn,
|
|
306
275
|
originalRange.endLineNumber,
|
|
307
|
-
originalRange.
|
|
276
|
+
originalRange.startLineNumber + insertText.length
|
|
308
277
|
));
|
|
309
278
|
const model = editor.getModel();
|
|
310
279
|
if (model && model.getValueInRange(( new Range(
|
|
@@ -322,76 +291,25 @@ class AttachSearchResultAction extends Action2 {
|
|
|
322
291
|
}
|
|
323
292
|
}
|
|
324
293
|
}
|
|
325
|
-
class
|
|
326
|
-
static { this.ID = 'workbench.action.edits.attachFolder'; }
|
|
327
|
-
constructor() {
|
|
328
|
-
super({
|
|
329
|
-
id: AttachFolderToEditingSessionAction.ID,
|
|
330
|
-
title: ( localize2(4387, "Add Folder to {0}", 'Copilot Edits')),
|
|
331
|
-
category: CHAT_CATEGORY,
|
|
332
|
-
f1: false,
|
|
333
|
-
precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ChatContextKeyExprs.unifiedChatEnabled.negate()))),
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
async run(accessor, ...args) {
|
|
337
|
-
const variablesService = accessor.get(IChatVariablesService);
|
|
338
|
-
const folders = this.getResources(accessor, ...args);
|
|
339
|
-
if (folders.length) {
|
|
340
|
-
(await showEditsView(accessor.get(IViewsService)))?.focusInput();
|
|
341
|
-
for (const folder of folders) {
|
|
342
|
-
variablesService.attachContext('folder', folder, ChatAgentLocation.EditingSession);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
class AttachSelectionToEditingSessionAction extends Action2 {
|
|
348
|
-
static { this.ID = 'workbench.action.edits.attachSelection'; }
|
|
294
|
+
class AttachContextAction extends Action2 {
|
|
349
295
|
constructor() {
|
|
350
296
|
super({
|
|
351
|
-
id:
|
|
352
|
-
title: ( localize2(
|
|
297
|
+
id: 'workbench.action.chat.attachContext',
|
|
298
|
+
title: ( localize2(4403, "Add Context...")),
|
|
299
|
+
icon: Codicon.attach,
|
|
353
300
|
category: CHAT_CATEGORY,
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const activeEditor = editorService.activeTextEditorControl;
|
|
362
|
-
const activeUri = EditorResourceAccessor.getCanonicalUri(editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
363
|
-
if (editorService.activeTextEditorControl && activeUri && [Schemas.file, Schemas.vscodeRemote, Schemas.untitled].includes(activeUri.scheme)) {
|
|
364
|
-
const selection = activeEditor?.getSelection();
|
|
365
|
-
if (selection) {
|
|
366
|
-
(await showEditsView(accessor.get(IViewsService)))?.focusInput();
|
|
367
|
-
const range = selection.isEmpty() ? ( new Range(selection.startLineNumber, 1, selection.startLineNumber + 1, 1)) : selection;
|
|
368
|
-
variablesService.attachContext('file', { uri: activeUri, range }, ChatAgentLocation.EditingSession);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
class AttachContextAction extends Action2 {
|
|
374
|
-
static { this.ID = 'workbench.action.chat.attachContext'; }
|
|
375
|
-
constructor(desc = {
|
|
376
|
-
id: AttachContextAction.ID,
|
|
377
|
-
title: ( localize2(4389, "Add Context")),
|
|
378
|
-
icon: Codicon.attach,
|
|
379
|
-
category: CHAT_CATEGORY,
|
|
380
|
-
keybinding: {
|
|
381
|
-
when: ( ContextKeyExpr.and(( ChatContextKeys.location.notEqualsTo(ChatAgentLocation.EditingSession)), ChatContextKeys.inChatInput, ChatContextKeyExprs.inNonUnifiedPanel)),
|
|
382
|
-
primary: KeyMod.CtrlCmd | KeyCode.Slash,
|
|
383
|
-
weight: KeybindingWeight.EditorContrib
|
|
384
|
-
},
|
|
385
|
-
menu: [
|
|
386
|
-
{
|
|
387
|
-
when: ChatContextKeyExprs.inNonUnifiedPanel,
|
|
301
|
+
keybinding: {
|
|
302
|
+
when: ( ContextKeyExpr.and(ChatContextKeys.inChatInput, ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel)))),
|
|
303
|
+
primary: KeyMod.CtrlCmd | KeyCode.Slash,
|
|
304
|
+
weight: KeybindingWeight.EditorContrib
|
|
305
|
+
},
|
|
306
|
+
menu: {
|
|
307
|
+
when: ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel)),
|
|
388
308
|
id: MenuId.ChatInputAttachmentToolbar,
|
|
389
309
|
group: 'navigation',
|
|
390
|
-
order:
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
}) {
|
|
394
|
-
super(desc);
|
|
310
|
+
order: 3
|
|
311
|
+
},
|
|
312
|
+
});
|
|
395
313
|
}
|
|
396
314
|
_getFileContextId(item) {
|
|
397
315
|
if ('resource' in item) {
|
|
@@ -401,39 +319,148 @@ class AttachContextAction extends Action2 {
|
|
|
401
319
|
`:${item.range.startLineNumber}-${item.range.endLineNumber}` :
|
|
402
320
|
`:${item.range.startLineNumber}`);
|
|
403
321
|
}
|
|
404
|
-
async _attachContext(
|
|
322
|
+
async _attachContext(accessor, widget, isInBackground, ...picks) {
|
|
323
|
+
const commandService = accessor.get(ICommandService);
|
|
324
|
+
const clipboardService = accessor.get(IClipboardService);
|
|
325
|
+
const editorService = accessor.get(IEditorService);
|
|
326
|
+
const labelService = accessor.get(ILabelService);
|
|
327
|
+
const viewsService = accessor.get(IViewsService);
|
|
328
|
+
const chatEditingService = accessor.get(IChatEditingService);
|
|
329
|
+
const hostService = accessor.get(IHostService);
|
|
330
|
+
const fileService = accessor.get(IFileService);
|
|
331
|
+
const textModelService = accessor.get(ITextModelService);
|
|
332
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
405
333
|
const toAttach = [];
|
|
406
334
|
for (const pick of picks) {
|
|
407
|
-
if (
|
|
335
|
+
if (isIAttachmentQuickPickItem(pick)) {
|
|
336
|
+
if (pick.kind === 'folder-search-result') {
|
|
337
|
+
toAttach.push({
|
|
338
|
+
kind: 'directory',
|
|
339
|
+
id: pick.id,
|
|
340
|
+
value: pick.resource,
|
|
341
|
+
name: basename(pick.resource),
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
else if (pick.kind === 'diagnostic-filter') {
|
|
345
|
+
toAttach.push({
|
|
346
|
+
id: pick.id,
|
|
347
|
+
name: pick.label,
|
|
348
|
+
value: pick.filter,
|
|
349
|
+
kind: 'diagnostic',
|
|
350
|
+
icon: pick.icon,
|
|
351
|
+
...pick.filter,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
else if (pick.kind === 'open-editors') {
|
|
355
|
+
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput || e instanceof NotebookEditorInput)) {
|
|
356
|
+
const uri = editor instanceof DiffEditorInput ? editor.modified.resource : editor.resource;
|
|
357
|
+
if (uri) {
|
|
358
|
+
toAttach.push({
|
|
359
|
+
kind: 'file',
|
|
360
|
+
id: this._getFileContextId({ resource: uri }),
|
|
361
|
+
value: uri,
|
|
362
|
+
name: labelService.getUriBasenameLabel(uri),
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
else if (pick.kind === 'search-results') {
|
|
368
|
+
const searchView = viewsService.getViewWithId(VIEW_ID);
|
|
369
|
+
for (const result of searchView.model.searchResult.matches()) {
|
|
370
|
+
toAttach.push({
|
|
371
|
+
kind: 'file',
|
|
372
|
+
id: this._getFileContextId({ resource: result.resource }),
|
|
373
|
+
value: result.resource,
|
|
374
|
+
name: labelService.getUriBasenameLabel(result.resource),
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else if (pick.kind === 'related-files') {
|
|
379
|
+
const chatSessionId = widget.viewModel?.sessionId;
|
|
380
|
+
if (!chatSessionId || !chatEditingService) {
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
const relatedFiles = await chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None);
|
|
384
|
+
if (!relatedFiles) {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
const attachments = widget.attachmentModel.getAttachmentIDs();
|
|
388
|
+
const itemsPromise = chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None)
|
|
389
|
+
.then((files) => (files ?? []).reduce((acc, cur) => {
|
|
390
|
+
acc.push({ type: 'separator', label: cur.group });
|
|
391
|
+
for (const file of cur.files) {
|
|
392
|
+
acc.push({
|
|
393
|
+
type: 'item',
|
|
394
|
+
label: labelService.getUriBasenameLabel(file.uri),
|
|
395
|
+
description: labelService.getUriLabel(dirname(file.uri), { relative: true }),
|
|
396
|
+
value: file.uri,
|
|
397
|
+
disabled: ( attachments.has(this._getFileContextId({ resource: file.uri }))),
|
|
398
|
+
picked: true
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return acc;
|
|
402
|
+
}, []));
|
|
403
|
+
const selectedFile = await quickInputService.pick(itemsPromise, { placeHolder: ( localize(4404, 'Add related files to your working set')) });
|
|
404
|
+
if (selectedFile) {
|
|
405
|
+
toAttach.push({
|
|
406
|
+
kind: 'file',
|
|
407
|
+
id: this._getFileContextId({ resource: selectedFile.value }),
|
|
408
|
+
value: selectedFile.value,
|
|
409
|
+
name: selectedFile.label,
|
|
410
|
+
omittedState: OmittedState.NotOmitted
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
else if (pick.kind === 'screenshot') {
|
|
415
|
+
const blob = await hostService.getScreenshot();
|
|
416
|
+
if (blob) {
|
|
417
|
+
toAttach.push(convertBufferToScreenshotVariable(blob));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
else if (pick.kind === 'command') {
|
|
421
|
+
const selection = await commandService.executeCommand(pick.command.id, ...(pick.command.arguments ?? []));
|
|
422
|
+
if (!selection) {
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
toAttach.push({
|
|
426
|
+
...pick,
|
|
427
|
+
value: pick.value,
|
|
428
|
+
name: `${typeof pick.value === 'string' && pick.value.startsWith('#') ? pick.value.slice(1) : ''}${selection}`,
|
|
429
|
+
fullName: selection
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
else if (pick.kind === 'tool') {
|
|
433
|
+
toAttach.push({
|
|
434
|
+
id: pick.id,
|
|
435
|
+
name: pick.tool.displayName,
|
|
436
|
+
fullName: pick.tool.displayName,
|
|
437
|
+
value: undefined,
|
|
438
|
+
icon: pick.icon,
|
|
439
|
+
kind: 'tool'
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
else if (pick.kind === 'image') {
|
|
443
|
+
const fileBuffer = await clipboardService.readImage();
|
|
444
|
+
toAttach.push({
|
|
445
|
+
id: await imageToHash(fileBuffer),
|
|
446
|
+
name: ( localize(4405, 'Pasted Image')),
|
|
447
|
+
fullName: ( localize(4405, 'Pasted Image')),
|
|
448
|
+
value: fileBuffer,
|
|
449
|
+
kind: 'image',
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
else if (isISymbolQuickPickItem(pick) && pick.symbol) {
|
|
408
454
|
toAttach.push({
|
|
409
455
|
kind: 'symbol',
|
|
410
456
|
id: this._getFileContextId(pick.symbol.location),
|
|
411
457
|
value: pick.symbol.location,
|
|
412
458
|
symbolKind: pick.symbol.kind,
|
|
459
|
+
icon: SymbolKinds.toIcon(pick.symbol.kind),
|
|
413
460
|
fullName: pick.label,
|
|
414
461
|
name: pick.symbol.name,
|
|
415
462
|
});
|
|
416
463
|
}
|
|
417
|
-
else if (isIFolderSearchResultQuickPickItem(pick)) {
|
|
418
|
-
const folder = pick.resource;
|
|
419
|
-
toAttach.push({
|
|
420
|
-
id: pick.id,
|
|
421
|
-
value: folder,
|
|
422
|
-
name: basename(folder),
|
|
423
|
-
isFile: false,
|
|
424
|
-
isDirectory: true,
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
else if (isIDiagnosticsQuickPickItemWithFilter(pick)) {
|
|
428
|
-
toAttach.push({
|
|
429
|
-
id: pick.id,
|
|
430
|
-
name: pick.label,
|
|
431
|
-
value: pick.filter,
|
|
432
|
-
kind: 'diagnostic',
|
|
433
|
-
icon: pick.icon,
|
|
434
|
-
...pick.filter,
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
464
|
else if (isIQuickPickItemWithResource(pick) && pick.resource) {
|
|
438
465
|
if (/\.(png|jpg|jpeg|bmp|gif|tiff)$/i.test(pick.resource.path)) {
|
|
439
466
|
if (URI.isUri(pick.resource)) {
|
|
@@ -444,142 +471,38 @@ class AttachContextAction extends Action2 {
|
|
|
444
471
|
name: pick.label,
|
|
445
472
|
fullName: pick.label,
|
|
446
473
|
value: resizedImage,
|
|
447
|
-
|
|
474
|
+
kind: 'image',
|
|
475
|
+
references: [{ reference: pick.resource, kind: 'reference' }]
|
|
448
476
|
});
|
|
449
477
|
}
|
|
450
478
|
}
|
|
451
479
|
else {
|
|
452
|
-
let
|
|
480
|
+
let omittedState = OmittedState.NotOmitted;
|
|
453
481
|
try {
|
|
454
482
|
const createdModel = await textModelService.createModelReference(pick.resource);
|
|
455
483
|
createdModel.dispose();
|
|
456
484
|
}
|
|
457
485
|
catch {
|
|
458
|
-
|
|
486
|
+
omittedState = OmittedState.Full;
|
|
459
487
|
}
|
|
460
488
|
toAttach.push({
|
|
489
|
+
kind: 'file',
|
|
461
490
|
id: this._getFileContextId({ resource: pick.resource }),
|
|
462
491
|
value: pick.resource,
|
|
463
492
|
name: pick.label,
|
|
464
|
-
|
|
465
|
-
isOmitted
|
|
493
|
+
omittedState
|
|
466
494
|
});
|
|
467
495
|
}
|
|
468
496
|
}
|
|
469
497
|
else if (isIGotoSymbolQuickPickItem(pick) && pick.uri && pick.range) {
|
|
470
498
|
toAttach.push({
|
|
471
|
-
|
|
499
|
+
kind: 'generic',
|
|
472
500
|
id: this._getFileContextId({ uri: pick.uri, range: pick.range.decoration }),
|
|
473
501
|
value: { uri: pick.uri, range: pick.range.decoration },
|
|
474
502
|
fullName: pick.label,
|
|
475
503
|
name: pick.symbolName,
|
|
476
504
|
});
|
|
477
505
|
}
|
|
478
|
-
else if (isIOpenEditorsQuickPickItem(pick)) {
|
|
479
|
-
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput || e instanceof NotebookEditorInput)) {
|
|
480
|
-
const uri = editor instanceof DiffEditorInput ? editor.modified.resource : editor.resource;
|
|
481
|
-
if (uri) {
|
|
482
|
-
toAttach.push({
|
|
483
|
-
id: this._getFileContextId({ resource: uri }),
|
|
484
|
-
value: uri,
|
|
485
|
-
name: labelService.getUriBasenameLabel(uri),
|
|
486
|
-
isFile: true,
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
else if (isISearchResultsQuickPickItem(pick)) {
|
|
492
|
-
const searchView = viewsService.getViewWithId(VIEW_ID);
|
|
493
|
-
for (const result of searchView.model.searchResult.matches()) {
|
|
494
|
-
toAttach.push({
|
|
495
|
-
id: this._getFileContextId({ resource: result.resource }),
|
|
496
|
-
value: result.resource,
|
|
497
|
-
name: labelService.getUriBasenameLabel(result.resource),
|
|
498
|
-
isFile: true,
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
else if (isRelatedFileQuickPickItem(pick)) {
|
|
503
|
-
const chatSessionId = widget.viewModel?.sessionId;
|
|
504
|
-
if (!chatSessionId || !chatEditingService) {
|
|
505
|
-
continue;
|
|
506
|
-
}
|
|
507
|
-
const relatedFiles = await chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None);
|
|
508
|
-
if (!relatedFiles) {
|
|
509
|
-
continue;
|
|
510
|
-
}
|
|
511
|
-
const attachments = widget.attachmentModel.getAttachmentIDs();
|
|
512
|
-
const itemsPromise = chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None)
|
|
513
|
-
.then((files) => (files ?? []).reduce((acc, cur) => {
|
|
514
|
-
acc.push({ type: 'separator', label: cur.group });
|
|
515
|
-
for (const file of cur.files) {
|
|
516
|
-
acc.push({
|
|
517
|
-
type: 'item',
|
|
518
|
-
label: labelService.getUriBasenameLabel(file.uri),
|
|
519
|
-
description: labelService.getUriLabel(dirname(file.uri), { relative: true }),
|
|
520
|
-
value: file.uri,
|
|
521
|
-
disabled: ( attachments.has(this._getFileContextId({ resource: file.uri }))),
|
|
522
|
-
picked: true
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
return acc;
|
|
526
|
-
}, []));
|
|
527
|
-
const selectedFiles = await quickInputService.pick(itemsPromise, { placeHolder: ( localize(4390, 'Add related files to your working set')), canPickMany: true });
|
|
528
|
-
for (const file of selectedFiles ?? []) {
|
|
529
|
-
toAttach.push({
|
|
530
|
-
id: this._getFileContextId({ resource: file.value }),
|
|
531
|
-
value: file.value,
|
|
532
|
-
name: file.label,
|
|
533
|
-
isFile: true,
|
|
534
|
-
isOmitted: false
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
else if (isScreenshotQuickPickItem(pick)) {
|
|
539
|
-
const blob = await hostService.getScreenshot();
|
|
540
|
-
if (blob) {
|
|
541
|
-
toAttach.push(convertBufferToScreenshotVariable(blob));
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
else if (isPromptInstructionsQuickPickItem(pick)) {
|
|
545
|
-
const options = { widget };
|
|
546
|
-
await commandService.executeCommand(ATTACH_PROMPT_ACTION_ID, options);
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
const attachmentPick = pick;
|
|
550
|
-
if (attachmentPick.kind === 'command') {
|
|
551
|
-
const selection = await commandService.executeCommand(attachmentPick.command.id, ...(attachmentPick.command.arguments ?? []));
|
|
552
|
-
if (!selection) {
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
toAttach.push({
|
|
556
|
-
...attachmentPick,
|
|
557
|
-
value: attachmentPick.value,
|
|
558
|
-
name: `${typeof attachmentPick.value === 'string' && attachmentPick.value.startsWith('#') ? attachmentPick.value.slice(1) : ''}${selection}`,
|
|
559
|
-
fullName: selection
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
else if (attachmentPick.kind === 'tool') {
|
|
563
|
-
toAttach.push({
|
|
564
|
-
id: attachmentPick.id,
|
|
565
|
-
name: attachmentPick.label,
|
|
566
|
-
fullName: attachmentPick.label,
|
|
567
|
-
value: undefined,
|
|
568
|
-
icon: attachmentPick.icon,
|
|
569
|
-
isTool: true
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
else if (attachmentPick.kind === 'image') {
|
|
573
|
-
const fileBuffer = await clipboardService.readImage();
|
|
574
|
-
toAttach.push({
|
|
575
|
-
id: await imageToHash(fileBuffer),
|
|
576
|
-
name: ( localize(4391, 'Pasted Image')),
|
|
577
|
-
fullName: ( localize(4391, 'Pasted Image')),
|
|
578
|
-
value: fileBuffer,
|
|
579
|
-
isImage: true
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
506
|
}
|
|
584
507
|
widget.attachmentModel.addContext(...toAttach);
|
|
585
508
|
if (!isInBackground) {
|
|
@@ -587,37 +510,27 @@ class AttachContextAction extends Action2 {
|
|
|
587
510
|
}
|
|
588
511
|
}
|
|
589
512
|
async run(accessor, ...args) {
|
|
590
|
-
const quickInputService = accessor.get(IQuickInputService);
|
|
591
513
|
const chatAgentService = accessor.get(IChatAgentService);
|
|
592
|
-
const commandService = accessor.get(ICommandService);
|
|
593
514
|
const widgetService = accessor.get(IChatWidgetService);
|
|
594
|
-
const languageModelToolsService = accessor.get(ILanguageModelToolsService);
|
|
595
|
-
const quickChatService = accessor.get(IQuickChatService);
|
|
596
515
|
const clipboardService = accessor.get(IClipboardService);
|
|
597
516
|
const editorService = accessor.get(IEditorService);
|
|
598
|
-
const labelService = accessor.get(ILabelService);
|
|
599
517
|
const contextKeyService = accessor.get(IContextKeyService);
|
|
600
|
-
const viewsService = accessor.get(IViewsService);
|
|
601
|
-
const hostService = accessor.get(IHostService);
|
|
602
|
-
const extensionService = accessor.get(IExtensionService);
|
|
603
|
-
const fileService = accessor.get(IFileService);
|
|
604
|
-
const textModelService = accessor.get(ITextModelService);
|
|
605
518
|
const instantiationService = accessor.get(IInstantiationService);
|
|
606
519
|
const keybindingService = accessor.get(IKeybindingService);
|
|
520
|
+
const chatEditingService = accessor.get(IChatEditingService);
|
|
607
521
|
const context = args[0];
|
|
608
522
|
const widget = context?.widget ?? widgetService.lastFocusedWidget;
|
|
609
523
|
if (!widget) {
|
|
610
524
|
return;
|
|
611
525
|
}
|
|
612
|
-
const chatEditingService = widget.location === ChatAgentLocation.EditingSession || widget.isUnifiedPanelWidget ? accessor.get(IChatEditingService) : undefined;
|
|
613
526
|
const quickPickItems = [];
|
|
614
|
-
if (
|
|
527
|
+
if (widget.input.selectedLanguageModel?.metadata.capabilities?.vision) {
|
|
615
528
|
const imageData = await clipboardService.readImage();
|
|
616
529
|
if (isImage(imageData)) {
|
|
617
530
|
quickPickItems.push({
|
|
618
531
|
kind: 'image',
|
|
619
532
|
id: await imageToHash(imageData),
|
|
620
|
-
label: ( localize(
|
|
533
|
+
label: ( localize(4406, 'Image from Clipboard')),
|
|
621
534
|
iconClass: ThemeIcon.asClassName(Codicon.fileMedia),
|
|
622
535
|
});
|
|
623
536
|
}
|
|
@@ -627,8 +540,8 @@ class AttachContextAction extends Action2 {
|
|
|
627
540
|
icon: ThemeIcon.fromId(Codicon.deviceCamera.id),
|
|
628
541
|
iconClass: ThemeIcon.asClassName(Codicon.deviceCamera),
|
|
629
542
|
label: (isElectron
|
|
630
|
-
? ( localize(
|
|
631
|
-
: ( localize(
|
|
543
|
+
? ( localize(4407, 'Screenshot Window'))
|
|
544
|
+
: ( localize(4408, 'Screenshot'))),
|
|
632
545
|
});
|
|
633
546
|
}
|
|
634
547
|
if (widget.viewModel?.sessionId) {
|
|
@@ -651,39 +564,27 @@ class AttachContextAction extends Action2 {
|
|
|
651
564
|
}
|
|
652
565
|
}
|
|
653
566
|
}
|
|
654
|
-
for (const tool of languageModelToolsService.getTools()) {
|
|
655
|
-
if (tool.canBeReferencedInPrompt) {
|
|
656
|
-
const item = {
|
|
657
|
-
kind: 'tool',
|
|
658
|
-
label: tool.displayName ?? '',
|
|
659
|
-
id: tool.id,
|
|
660
|
-
icon: ThemeIcon.isThemeIcon(tool.icon) ? tool.icon : undefined
|
|
661
|
-
};
|
|
662
|
-
if (ThemeIcon.isThemeIcon(tool.icon)) {
|
|
663
|
-
item.iconClass = ThemeIcon.asClassName(tool.icon);
|
|
664
|
-
}
|
|
665
|
-
else if (tool.icon) {
|
|
666
|
-
item.iconPath = tool.icon;
|
|
667
|
-
}
|
|
668
|
-
quickPickItems.push(item);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
567
|
quickPickItems.push({
|
|
672
|
-
kind: '
|
|
673
|
-
label: ( localize(
|
|
568
|
+
kind: 'tools',
|
|
569
|
+
label: ( localize(4409, 'Tools...')),
|
|
570
|
+
iconClass: ThemeIcon.asClassName(Codicon.tools),
|
|
571
|
+
id: 'tools',
|
|
572
|
+
});
|
|
573
|
+
quickPickItems.push({
|
|
574
|
+
kind: 'workspaceSymbol',
|
|
575
|
+
label: ( localize(4410, 'Symbols...')),
|
|
674
576
|
iconClass: ThemeIcon.asClassName(Codicon.symbolField),
|
|
675
|
-
prefix: SymbolsQuickAccessProvider.PREFIX,
|
|
676
577
|
id: 'symbol'
|
|
677
578
|
});
|
|
678
579
|
quickPickItems.push({
|
|
679
580
|
kind: 'folder',
|
|
680
|
-
label: ( localize(
|
|
581
|
+
label: ( localize(4411, 'Files & Folders...')),
|
|
681
582
|
iconClass: ThemeIcon.asClassName(Codicon.folder),
|
|
682
583
|
id: 'folder',
|
|
683
584
|
});
|
|
684
585
|
quickPickItems.push({
|
|
685
586
|
kind: 'diagnostic',
|
|
686
|
-
label: ( localize(
|
|
587
|
+
label: ( localize(4412, 'Problems...')),
|
|
687
588
|
iconClass: ThemeIcon.asClassName(Codicon.error),
|
|
688
589
|
id: 'diagnostic'
|
|
689
590
|
});
|
|
@@ -694,68 +595,56 @@ class AttachContextAction extends Action2 {
|
|
|
694
595
|
icon: ThemeIcon.fromId(Codicon.serverEnvironment.id),
|
|
695
596
|
iconClass: ThemeIcon.asClassName(Codicon.serverEnvironment),
|
|
696
597
|
value: 'kernelVariable',
|
|
697
|
-
label: ( localize(
|
|
598
|
+
label: ( localize(4413, 'Kernel Variable...')),
|
|
698
599
|
command: {
|
|
699
600
|
id: 'notebook.chat.selectAndInsertKernelVariable',
|
|
700
|
-
title: ( localize(
|
|
601
|
+
title: ( localize(4414, 'Select and Insert Kernel Variable')),
|
|
701
602
|
arguments: [{ widget, range: undefined }]
|
|
702
603
|
}
|
|
703
604
|
});
|
|
704
605
|
}
|
|
705
|
-
if (
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
});
|
|
729
|
-
}
|
|
606
|
+
if (chatEditingService?.hasRelatedFilesProviders() && (widget.getInput() || widget.attachmentModel.fileAttachments.length > 0)) {
|
|
607
|
+
quickPickItems.push({
|
|
608
|
+
kind: 'related-files',
|
|
609
|
+
id: 'related-files',
|
|
610
|
+
label: ( localize(4415, 'Related Files')),
|
|
611
|
+
iconClass: ThemeIcon.asClassName(Codicon.sparkle),
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
if (editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput).length > 0) {
|
|
615
|
+
quickPickItems.push({
|
|
616
|
+
kind: 'open-editors',
|
|
617
|
+
id: 'open-editors',
|
|
618
|
+
label: ( localize(4416, 'Open Editors')),
|
|
619
|
+
iconClass: ThemeIcon.asClassName(Codicon.files),
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
if (SearchContext.HasSearchResults.getValue(contextKeyService)) {
|
|
623
|
+
quickPickItems.push({
|
|
624
|
+
kind: 'search-results',
|
|
625
|
+
id: 'search-results',
|
|
626
|
+
label: ( localize(4417, 'Search Results')),
|
|
627
|
+
iconClass: ThemeIcon.asClassName(Codicon.search),
|
|
628
|
+
});
|
|
730
629
|
}
|
|
731
630
|
if (widget.attachmentModel.promptInstructions.featureEnabled) {
|
|
732
|
-
const keybinding = keybindingService.lookupKeybinding(
|
|
631
|
+
const keybinding = keybindingService.lookupKeybinding(INSTRUCTIONS_COMMAND_ID, contextKeyService);
|
|
733
632
|
quickPickItems.push({
|
|
734
|
-
id:
|
|
735
|
-
kind:
|
|
736
|
-
label: ( localize(
|
|
633
|
+
id: INSTRUCTION_PICK_ID,
|
|
634
|
+
kind: INSTRUCTION_PICK_ID,
|
|
635
|
+
label: ( localize(4418, 'Instructions...')),
|
|
737
636
|
iconClass: ThemeIcon.asClassName(Codicon.bookmark),
|
|
738
637
|
keybinding,
|
|
739
638
|
});
|
|
740
639
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
const match = label.match(/\$\([^\)]+\)\s*(.+)/);
|
|
746
|
-
return match ? match[1] : label;
|
|
747
|
-
}
|
|
748
|
-
this._show(quickInputService, commandService, widget, quickChatService, quickPickItems.sort(function (a, b) {
|
|
749
|
-
if (a.kind === 'open-editors') {
|
|
750
|
-
return -1;
|
|
751
|
-
}
|
|
752
|
-
if (b.kind === 'open-editors') {
|
|
753
|
-
return 1;
|
|
640
|
+
quickPickItems.sort((a, b) => {
|
|
641
|
+
let result = attachmentsOrdinals.indexOf(b.kind) - attachmentsOrdinals.indexOf(a.kind);
|
|
642
|
+
if (result === 0) {
|
|
643
|
+
result = a.label.localeCompare(b.label);
|
|
754
644
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}), clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, instantiationService, '', context?.placeholder);
|
|
645
|
+
return result;
|
|
646
|
+
});
|
|
647
|
+
instantiationService.invokeFunction(this._show.bind(this), widget, quickPickItems, '', context?.placeholder);
|
|
759
648
|
}
|
|
760
649
|
async _showDiagnosticsPick(instantiationService, onBackgroundAccept) {
|
|
761
650
|
const convert = (item) => ({
|
|
@@ -765,43 +654,53 @@ class AttachContextAction extends Action2 {
|
|
|
765
654
|
icon: IDiagnosticVariableEntryFilterData.icon,
|
|
766
655
|
filter: item,
|
|
767
656
|
});
|
|
768
|
-
const filter = await instantiationService.invokeFunction(
|
|
657
|
+
const filter = await instantiationService.invokeFunction(createMarkersQuickPick, items => onBackgroundAccept(( items.map(convert))));
|
|
769
658
|
return filter && convert(filter);
|
|
770
659
|
}
|
|
771
|
-
_show(
|
|
660
|
+
_show(accessor, widget, quickPickItems, query = '', placeholder) {
|
|
661
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
662
|
+
const quickChatService = accessor.get(IQuickChatService);
|
|
663
|
+
const editorService = accessor.get(IEditorService);
|
|
664
|
+
const commandService = accessor.get(ICommandService);
|
|
665
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
772
666
|
const attach = (isBackgroundAccept, ...items) => {
|
|
773
|
-
this._attachContext(
|
|
667
|
+
instantiationService.invokeFunction(this._attachContext.bind(this), widget, isBackgroundAccept, ...items);
|
|
774
668
|
};
|
|
775
669
|
const providerOptions = {
|
|
670
|
+
additionPicks: quickPickItems,
|
|
776
671
|
handleAccept: async (inputItem, isBackgroundAccept) => {
|
|
777
672
|
let item = inputItem;
|
|
778
|
-
if (
|
|
779
|
-
item
|
|
780
|
-
|
|
781
|
-
else if ('kind' in item && item.kind === 'diagnostic') {
|
|
782
|
-
item = await this._showDiagnosticsPick(instantiationService, i => attach(true, ...i));
|
|
783
|
-
}
|
|
784
|
-
if (!item) {
|
|
785
|
-
this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, instantiationService, '', placeholder);
|
|
786
|
-
return;
|
|
787
|
-
}
|
|
788
|
-
if ('prefix' in item) {
|
|
789
|
-
this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, instantiationService, item.prefix, placeholder);
|
|
790
|
-
}
|
|
791
|
-
else {
|
|
792
|
-
if (!clipboardService) {
|
|
673
|
+
if (isIAttachmentQuickPickItem(item)) {
|
|
674
|
+
if (item.kind === 'workspaceSymbol') {
|
|
675
|
+
instantiationService.invokeFunction(this._show.bind(this), widget, quickPickItems, SymbolsQuickAccessProvider.PREFIX, placeholder);
|
|
793
676
|
return;
|
|
794
677
|
}
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
678
|
+
else if (item.kind === 'instructions') {
|
|
679
|
+
runAttachInstructionsAction(commandService, { widget });
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (item.kind === 'folder') {
|
|
683
|
+
item = await this._showFolders(instantiationService);
|
|
684
|
+
}
|
|
685
|
+
else if (item.kind === 'diagnostic') {
|
|
686
|
+
item = await this._showDiagnosticsPick(instantiationService, i => attach(true, ...i));
|
|
687
|
+
}
|
|
688
|
+
else if (item.kind === 'tools') {
|
|
689
|
+
item = await instantiationService.invokeFunction(showToolsPick, widget);
|
|
690
|
+
}
|
|
691
|
+
if (!item) {
|
|
692
|
+
instantiationService.invokeFunction(this._show.bind(this), widget, quickPickItems, '', placeholder);
|
|
693
|
+
return;
|
|
798
694
|
}
|
|
799
695
|
}
|
|
696
|
+
attach(isBackgroundAccept, item);
|
|
697
|
+
if (isQuickChat(widget)) {
|
|
698
|
+
quickChatService.open();
|
|
699
|
+
}
|
|
800
700
|
},
|
|
801
|
-
additionPicks: quickPickItems,
|
|
802
701
|
filter: (item) => {
|
|
803
702
|
const attachedContext = widget.attachmentModel.getAttachmentIDs();
|
|
804
|
-
if (
|
|
703
|
+
if (isIAttachmentQuickPickItem(item) && item.kind === 'open-editors') {
|
|
805
704
|
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput)) {
|
|
806
705
|
if (editor.resource && !( attachedContext.has(this._getFileContextId({ resource: editor.resource })))) {
|
|
807
706
|
return true;
|
|
@@ -834,12 +733,12 @@ class AttachContextAction extends Action2 {
|
|
|
834
733
|
SymbolsQuickAccessProvider.PREFIX,
|
|
835
734
|
AbstractGotoSymbolQuickAccessProvider.PREFIX
|
|
836
735
|
],
|
|
837
|
-
placeholder: placeholder ?? ( localize(
|
|
736
|
+
placeholder: placeholder ?? ( localize(4419, 'Search attachments')),
|
|
838
737
|
providerOptions,
|
|
839
738
|
});
|
|
840
739
|
}
|
|
841
740
|
async _showFolders(instantiationService) {
|
|
842
|
-
const folder = await instantiationService.invokeFunction(
|
|
741
|
+
const folder = await instantiationService.invokeFunction(createFilesAndFolderQuickPick);
|
|
843
742
|
if (!folder) {
|
|
844
743
|
return undefined;
|
|
845
744
|
}
|
|
@@ -851,35 +750,103 @@ class AttachContextAction extends Action2 {
|
|
|
851
750
|
};
|
|
852
751
|
}
|
|
853
752
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
753
|
+
async function createMarkersQuickPick(accessor, onBackgroundAccept) {
|
|
754
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
755
|
+
const markerService = accessor.get(IMarkerService);
|
|
756
|
+
const labelService = accessor.get(ILabelService);
|
|
757
|
+
const markers = markerService.read({ severities: MarkerSeverity.Error | MarkerSeverity.Warning | MarkerSeverity.Info });
|
|
758
|
+
const grouped = groupBy(markers, (a, b) => extUri.compare(a.resource, b.resource));
|
|
759
|
+
const severities = ( new Set());
|
|
760
|
+
const items = [];
|
|
761
|
+
for (const group of grouped) {
|
|
762
|
+
const resource = group[0].resource;
|
|
763
|
+
items.push({ type: 'separator', label: labelService.getUriLabel(resource, { relative: true }) });
|
|
764
|
+
for (const marker of group) {
|
|
765
|
+
severities.add(marker.severity);
|
|
766
|
+
items.push({
|
|
767
|
+
type: 'item',
|
|
768
|
+
resource: marker.resource,
|
|
769
|
+
label: marker.message,
|
|
770
|
+
description: ( localize(
|
|
771
|
+
4420,
|
|
772
|
+
"[Ln {0}, Col {1}]",
|
|
773
|
+
'' + marker.startLineNumber,
|
|
774
|
+
'' + marker.startColumn
|
|
775
|
+
)),
|
|
776
|
+
entry: IDiagnosticVariableEntryFilterData.fromMarker(marker),
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
items.unshift({ type: 'item', label: ( localize(4421, 'All Problems')), entry: { filterSeverity: MarkerSeverity.Info } });
|
|
781
|
+
const store = ( new DisposableStore());
|
|
782
|
+
const quickPick = store.add(quickInputService.createQuickPick({ useSeparators: true }));
|
|
783
|
+
quickPick.canAcceptInBackground = !onBackgroundAccept;
|
|
784
|
+
quickPick.placeholder = ( localize(4422, 'Select a problem to attach'));
|
|
785
|
+
quickPick.items = items;
|
|
786
|
+
return ( new Promise(resolve => {
|
|
787
|
+
store.add(quickPick.onDidHide(() => resolve(undefined)));
|
|
788
|
+
store.add(quickPick.onDidAccept(ev => {
|
|
789
|
+
if (ev.inBackground) {
|
|
790
|
+
onBackgroundAccept?.(( quickPick.selectedItems.map(i => i.entry)));
|
|
874
791
|
}
|
|
875
|
-
|
|
792
|
+
else {
|
|
793
|
+
resolve(quickPick.selectedItems[0]?.entry);
|
|
794
|
+
quickPick.dispose();
|
|
795
|
+
}
|
|
796
|
+
}));
|
|
797
|
+
quickPick.show();
|
|
798
|
+
})).finally(() => store.dispose());
|
|
799
|
+
}
|
|
800
|
+
async function showToolsPick(accessor, widget) {
|
|
801
|
+
const quickPickService = accessor.get(IQuickInputService);
|
|
802
|
+
function classify(tool) {
|
|
803
|
+
if (tool.source.type === 'internal' || tool.source.type === 'extension' && !tool.source.isExternalTool) {
|
|
804
|
+
return { ordinal: 1, groupLabel: ( localize(4423, 'Built-In')) };
|
|
805
|
+
}
|
|
806
|
+
else if (tool.source.type === 'mcp') {
|
|
807
|
+
return { ordinal: 2, groupLabel: ( localize(4424, 'MCP Servers')) };
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
return { ordinal: 3, groupLabel: ( localize(4425, 'Extensions')) };
|
|
811
|
+
}
|
|
876
812
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
813
|
+
const items = [];
|
|
814
|
+
for (const tool of widget.input.selectedToolsModel.tools.get()) {
|
|
815
|
+
if (!tool.canBeReferencedInPrompt) {
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
818
|
+
const item = {
|
|
819
|
+
tool,
|
|
820
|
+
...classify(tool),
|
|
821
|
+
kind: 'tool',
|
|
822
|
+
label: tool.toolReferenceName ?? tool.id,
|
|
823
|
+
description: (tool.toolReferenceName ?? tool.id) !== tool.displayName ? tool.displayName : undefined,
|
|
824
|
+
id: tool.id,
|
|
825
|
+
};
|
|
826
|
+
items.push(item);
|
|
881
827
|
}
|
|
882
|
-
|
|
883
|
-
|
|
828
|
+
items.sort((a, b) => {
|
|
829
|
+
let res = a.ordinal - b.ordinal;
|
|
830
|
+
if (res === 0) {
|
|
831
|
+
res = a.label.localeCompare(b.label);
|
|
832
|
+
}
|
|
833
|
+
return res;
|
|
834
|
+
});
|
|
835
|
+
let lastGroupLabel;
|
|
836
|
+
const picks = [];
|
|
837
|
+
for (const item of items) {
|
|
838
|
+
if (lastGroupLabel !== item.groupLabel) {
|
|
839
|
+
picks.push({ type: 'separator', label: item.groupLabel });
|
|
840
|
+
lastGroupLabel = item.groupLabel;
|
|
841
|
+
}
|
|
842
|
+
picks.push(item);
|
|
843
|
+
}
|
|
844
|
+
const result = await quickPickService.pick(picks, {
|
|
845
|
+
placeHolder: ( localize(4426, 'Select a tool')),
|
|
846
|
+
canPickMany: false
|
|
847
|
+
});
|
|
848
|
+
return result;
|
|
849
|
+
}
|
|
850
|
+
registerPromptActions();
|
|
884
851
|
|
|
885
852
|
export { AttachContextAction, AttachSearchResultAction, registerChatContextActions };
|