@codingame/monaco-vscode-chat-service-override 14.0.6 → 15.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 +14 -8
- package/package.json +20 -20
- 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 +43 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +142 -0
- 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 +25 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +252 -260
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
- 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 +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +12 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +31 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +151 -69
- 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.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +379 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/{chatEditingService.d.ts → chatEditingServiceImpl.d.ts} +12 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +423 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +38 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +16 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +93 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +21 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +101 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +146 -126
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +386 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +8 -91
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +7 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +45 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +11 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +78 -0
- 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/chatEntitlementsService.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +12 -10
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +26 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +85 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -27
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +4 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +15 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +175 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +17 -17
- 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 +12 -12
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +31 -36
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +0 -505
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +0 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +0 -871
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +0 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -245
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +0 -39
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +0 -314
|
@@ -4,11 +4,12 @@ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codi
|
|
|
4
4
|
import { KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
5
5
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
6
6
|
import { isElectron } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
|
-
import {
|
|
7
|
+
import { basename, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
8
8
|
import { compare } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
9
9
|
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
10
10
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
11
11
|
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
12
|
+
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
12
13
|
import { AbstractGotoSymbolQuickAccessProvider } from '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess';
|
|
13
14
|
import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
14
15
|
import { registerAction2, Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
@@ -17,23 +18,24 @@ import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
17
18
|
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
18
19
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
19
20
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
21
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
22
|
+
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
20
23
|
import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
21
24
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
22
|
-
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
23
25
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
24
26
|
import { ActiveEditorContext, TextCompareEditorActiveContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
25
27
|
import { EditorResourceAccessor, SideBySideEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
26
|
-
import { DiffEditorInput } from '@codingame/monaco-vscode-
|
|
28
|
+
import { DiffEditorInput } from '@codingame/monaco-vscode-09d6ed79-77bb-525d-bd17-ed2bf3adbb38-common/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
27
29
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
28
30
|
import { isProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
|
|
29
31
|
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
30
32
|
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
31
33
|
import { VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/search/common/search';
|
|
32
|
-
import { UntitledTextEditorInput } from '@codingame/monaco-vscode-
|
|
34
|
+
import { UntitledTextEditorInput } from '@codingame/monaco-vscode-c4e2825a-b5b1-5f0e-b547-068c32e06d50-common/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput';
|
|
33
35
|
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
34
|
-
import { FileEditorInput } from '@codingame/monaco-vscode-
|
|
35
|
-
import { TEXT_FILE_EDITOR_ID } from '@codingame/monaco-vscode-
|
|
36
|
-
import { NotebookEditorInput } from '@codingame/monaco-vscode-
|
|
36
|
+
import { FileEditorInput } from '@codingame/monaco-vscode-c4e2825a-b5b1-5f0e-b547-068c32e06d50-common/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
37
|
+
import { TEXT_FILE_EDITOR_ID } from '@codingame/monaco-vscode-a4c2011e-8775-52bd-abf0-4a3c07a9696b-common/vscode/vs/workbench/contrib/files/common/files';
|
|
38
|
+
import { NotebookEditorInput } from '@codingame/monaco-vscode-9b5a5e82-d649-5455-b4bf-ef90d6afd294-common/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
37
39
|
import { AnythingQuickAccessProvider } from '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/workbench/contrib/search/browser/anythingQuickAccess';
|
|
38
40
|
import { isSearchTreeFileMatch, isSearchTreeMatch } from '@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common/vscode/vs/workbench/contrib/search/browser/searchTreeModel/searchTreeCommon';
|
|
39
41
|
import { SymbolsQuickAccessProvider } from '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/workbench/contrib/search/browser/symbolsQuickAccess';
|
|
@@ -41,20 +43,21 @@ import { SearchContext } from '@codingame/monaco-vscode-42931eb9-e564-530c-bafc-
|
|
|
41
43
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
42
44
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
43
45
|
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
44
|
-
import { WorkingSetEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
45
46
|
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
46
|
-
import {
|
|
47
|
+
import { IDiagnosticVariableEntryFilterData } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
48
|
+
import { ChatRequestAgentPart } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
47
49
|
import { IChatVariablesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
|
|
48
50
|
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
49
|
-
import {
|
|
50
|
-
import { PROMPT_SNIPPET_FILE_EXTENSION } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/promptContentsProviderBase';
|
|
51
|
-
import { showChatView, showEditsView } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
51
|
+
import { showChatView, showEditsView } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
52
52
|
import { IChatWidgetService, IQuickChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
53
53
|
import { imageToHash, isImage } from '../chatPasteProviders.js';
|
|
54
|
-
import { isQuickChat } from '@codingame/monaco-vscode-
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
54
|
+
import { isQuickChat } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
55
|
+
import { createMarkersQuickPick, createFolderQuickPick } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
|
|
56
|
+
import { convertBufferToScreenshotVariable, ScreenshotVariableId } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/contrib/screenshot';
|
|
57
|
+
import { resizeImage } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/imageUtils';
|
|
58
|
+
import { COMMAND_ID } from '../promptSyntax/contributions/usePromptCommand.js';
|
|
59
|
+
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
60
|
+
import { ATTACH_PROMPT_ACTION_ID, AttachPromptAction } from './chatAttachPromptAction/chatAttachPromptAction.js';
|
|
58
61
|
|
|
59
62
|
function registerChatContextActions() {
|
|
60
63
|
registerAction2(AttachContextAction);
|
|
@@ -74,6 +77,14 @@ function isISymbolQuickPickItem(obj) {
|
|
|
74
77
|
&& typeof obj.symbol === 'object'
|
|
75
78
|
&& !!obj.symbol);
|
|
76
79
|
}
|
|
80
|
+
function isIFolderSearchResultQuickPickItem(obj) {
|
|
81
|
+
return (typeof obj === 'object'
|
|
82
|
+
&& obj.kind === 'folder-search-result');
|
|
83
|
+
}
|
|
84
|
+
function isIDiagnosticsQuickPickItemWithFilter(obj) {
|
|
85
|
+
return (typeof obj === 'object'
|
|
86
|
+
&& obj.kind === 'diagnostic-filter');
|
|
87
|
+
}
|
|
77
88
|
function isIQuickPickItemWithResource(obj) {
|
|
78
89
|
return (typeof obj === 'object'
|
|
79
90
|
&& typeof obj.resource === 'object'
|
|
@@ -99,8 +110,9 @@ function isPromptInstructionsQuickPickItem(obj) {
|
|
|
99
110
|
if (!obj || typeof obj !== 'object') {
|
|
100
111
|
return false;
|
|
101
112
|
}
|
|
102
|
-
return ('kind' in obj && obj.kind === 'prompt
|
|
113
|
+
return ('kind' in obj && obj.kind === 'reusable-prompt');
|
|
103
114
|
}
|
|
115
|
+
const REUSABLE_PROMPT_PICK_ID = 'reusable-prompt';
|
|
104
116
|
class AttachFileAction extends Action2 {
|
|
105
117
|
getFiles(accessor, ...args) {
|
|
106
118
|
const editorService = accessor.get(IEditorService);
|
|
@@ -132,15 +144,11 @@ class AttachFileToChatAction extends AttachFileAction {
|
|
|
132
144
|
constructor() {
|
|
133
145
|
super({
|
|
134
146
|
id: AttachFileToChatAction.ID,
|
|
135
|
-
title: ( localize2(
|
|
147
|
+
title: ( localize2(4312, "Add File to Chat")),
|
|
136
148
|
category: CHAT_CATEGORY,
|
|
137
149
|
f1: false,
|
|
138
150
|
precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.or(( ActiveEditorContext.isEqualTo(TEXT_FILE_EDITOR_ID)), TextCompareEditorActiveContext)))),
|
|
139
151
|
menu: [{
|
|
140
|
-
id: MenuId.ChatCommandCenter,
|
|
141
|
-
group: 'b_chat_context',
|
|
142
|
-
order: 15,
|
|
143
|
-
}, {
|
|
144
152
|
id: MenuId.SearchContext,
|
|
145
153
|
group: 'z_chat',
|
|
146
154
|
order: 1
|
|
@@ -163,15 +171,11 @@ class AttachSelectionToChatAction extends Action2 {
|
|
|
163
171
|
constructor() {
|
|
164
172
|
super({
|
|
165
173
|
id: AttachSelectionToChatAction.ID,
|
|
166
|
-
title: ( localize2(
|
|
174
|
+
title: ( localize2(4313, "Add Selection to Chat")),
|
|
167
175
|
category: CHAT_CATEGORY,
|
|
168
176
|
f1: false,
|
|
169
177
|
precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.or(( ActiveEditorContext.isEqualTo(TEXT_FILE_EDITOR_ID)), TextCompareEditorActiveContext)))),
|
|
170
178
|
menu: [{
|
|
171
|
-
id: MenuId.ChatCommandCenter,
|
|
172
|
-
group: 'b_chat_context',
|
|
173
|
-
order: 10,
|
|
174
|
-
}, {
|
|
175
179
|
id: MenuId.SearchContext,
|
|
176
180
|
group: 'z_chat',
|
|
177
181
|
order: 2
|
|
@@ -224,15 +228,11 @@ class AttachFileToEditingSessionAction extends AttachFileAction {
|
|
|
224
228
|
constructor() {
|
|
225
229
|
super({
|
|
226
230
|
id: AttachFileToEditingSessionAction.ID,
|
|
227
|
-
title: ( localize2(
|
|
231
|
+
title: ( localize2(4314, "Add File to {0}", 'Copilot Edits')),
|
|
228
232
|
category: CHAT_CATEGORY,
|
|
229
233
|
f1: false,
|
|
230
234
|
precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.or(( ActiveEditorContext.isEqualTo(TEXT_FILE_EDITOR_ID)), TextCompareEditorActiveContext)))),
|
|
231
235
|
menu: [{
|
|
232
|
-
id: MenuId.ChatCommandCenter,
|
|
233
|
-
group: 'c_edits_context',
|
|
234
|
-
order: 15,
|
|
235
|
-
}, {
|
|
236
236
|
id: MenuId.SearchContext,
|
|
237
237
|
group: 'z_chat',
|
|
238
238
|
order: 2
|
|
@@ -255,15 +255,10 @@ class AttachSelectionToEditingSessionAction extends Action2 {
|
|
|
255
255
|
constructor() {
|
|
256
256
|
super({
|
|
257
257
|
id: AttachSelectionToEditingSessionAction.ID,
|
|
258
|
-
title: ( localize2(
|
|
258
|
+
title: ( localize2(4315, "Add Selection to {0}", 'Copilot Edits')),
|
|
259
259
|
category: CHAT_CATEGORY,
|
|
260
260
|
f1: false,
|
|
261
|
-
precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.or(( ActiveEditorContext.isEqualTo(TEXT_FILE_EDITOR_ID)), TextCompareEditorActiveContext))))
|
|
262
|
-
menu: {
|
|
263
|
-
id: MenuId.ChatCommandCenter,
|
|
264
|
-
group: 'c_edits_context',
|
|
265
|
-
order: 10,
|
|
266
|
-
}
|
|
261
|
+
precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.or(( ActiveEditorContext.isEqualTo(TEXT_FILE_EDITOR_ID)), TextCompareEditorActiveContext))))
|
|
267
262
|
});
|
|
268
263
|
}
|
|
269
264
|
async run(accessor, ...args) {
|
|
@@ -286,18 +281,18 @@ class AttachContextAction extends Action2 {
|
|
|
286
281
|
static { this._cdt = ( ContextKeyExpr.or(( ContextKeyExpr.and(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel)))), ( ContextKeyExpr.and(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Editor)))), ( ContextKeyExpr.and(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Notebook)))), ( ContextKeyExpr.and(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Terminal)))))); }
|
|
287
282
|
constructor(desc = {
|
|
288
283
|
id: AttachContextAction.ID,
|
|
289
|
-
title: ( localize2(
|
|
284
|
+
title: ( localize2(4316, "Attach Context")),
|
|
290
285
|
icon: Codicon.attach,
|
|
291
286
|
category: CHAT_CATEGORY,
|
|
292
287
|
precondition: ( ContextKeyExpr.or(AttachContextAction._cdt, ( ContextKeyExpr.and(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession)))))),
|
|
293
288
|
keybinding: {
|
|
294
|
-
when: ChatContextKeys.inChatInput,
|
|
289
|
+
when: ( ContextKeyExpr.and(( ChatContextKeys.location.notEqualsTo(ChatAgentLocation.EditingSession)), ChatContextKeys.inChatInput)),
|
|
295
290
|
primary: KeyMod.CtrlCmd | KeyCode.Slash,
|
|
296
291
|
weight: KeybindingWeight.EditorContrib
|
|
297
292
|
},
|
|
298
293
|
menu: [
|
|
299
294
|
{
|
|
300
|
-
when: (
|
|
295
|
+
when: ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel)),
|
|
301
296
|
id: MenuId.ChatInput,
|
|
302
297
|
group: 'navigation',
|
|
303
298
|
order: 2
|
|
@@ -320,7 +315,7 @@ class AttachContextAction extends Action2 {
|
|
|
320
315
|
`:${item.range.startLineNumber}-${item.range.endLineNumber}` :
|
|
321
316
|
`:${item.range.startLineNumber}`);
|
|
322
317
|
}
|
|
323
|
-
async _attachContext(widget, quickInputService, commandService, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService,
|
|
318
|
+
async _attachContext(widget, quickInputService, commandService, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, isInBackground, ...picks) {
|
|
324
319
|
const toAttach = [];
|
|
325
320
|
for (const pick of picks) {
|
|
326
321
|
if (isISymbolQuickPickItem(pick) && pick.symbol) {
|
|
@@ -331,7 +326,26 @@ class AttachContextAction extends Action2 {
|
|
|
331
326
|
symbolKind: pick.symbol.kind,
|
|
332
327
|
fullName: pick.label,
|
|
333
328
|
name: pick.symbol.name,
|
|
334
|
-
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
else if (isIFolderSearchResultQuickPickItem(pick)) {
|
|
332
|
+
const folder = pick.resource;
|
|
333
|
+
toAttach.push({
|
|
334
|
+
id: pick.id,
|
|
335
|
+
value: folder,
|
|
336
|
+
name: basename(folder),
|
|
337
|
+
isFile: false,
|
|
338
|
+
isDirectory: true,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
else if (isIDiagnosticsQuickPickItemWithFilter(pick)) {
|
|
342
|
+
toAttach.push({
|
|
343
|
+
id: pick.id,
|
|
344
|
+
name: pick.label,
|
|
345
|
+
value: pick.filter,
|
|
346
|
+
kind: 'diagnostic',
|
|
347
|
+
icon: pick.icon,
|
|
348
|
+
...pick.filter,
|
|
335
349
|
});
|
|
336
350
|
}
|
|
337
351
|
else if (isIQuickPickItemWithResource(pick) && pick.resource) {
|
|
@@ -344,24 +358,26 @@ class AttachContextAction extends Action2 {
|
|
|
344
358
|
name: pick.label,
|
|
345
359
|
fullName: pick.label,
|
|
346
360
|
value: resizedImage,
|
|
347
|
-
isDynamic: true,
|
|
348
361
|
isImage: true
|
|
349
362
|
});
|
|
350
363
|
}
|
|
351
364
|
}
|
|
352
365
|
else {
|
|
353
|
-
|
|
354
|
-
|
|
366
|
+
let isOmitted = false;
|
|
367
|
+
try {
|
|
368
|
+
const createdModel = await textModelService.createModelReference(pick.resource);
|
|
369
|
+
createdModel.dispose();
|
|
355
370
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
id: this._getFileContextId({ resource: pick.resource }),
|
|
359
|
-
value: pick.resource,
|
|
360
|
-
name: pick.label,
|
|
361
|
-
isFile: true,
|
|
362
|
-
isDynamic: true,
|
|
363
|
-
});
|
|
371
|
+
catch {
|
|
372
|
+
isOmitted = true;
|
|
364
373
|
}
|
|
374
|
+
toAttach.push({
|
|
375
|
+
id: this._getFileContextId({ resource: pick.resource }),
|
|
376
|
+
value: pick.resource,
|
|
377
|
+
name: pick.label,
|
|
378
|
+
isFile: true,
|
|
379
|
+
isOmitted
|
|
380
|
+
});
|
|
365
381
|
}
|
|
366
382
|
}
|
|
367
383
|
else if (isIGotoSymbolQuickPickItem(pick) && pick.uri && pick.range) {
|
|
@@ -371,43 +387,30 @@ class AttachContextAction extends Action2 {
|
|
|
371
387
|
value: { uri: pick.uri, range: pick.range.decoration },
|
|
372
388
|
fullName: pick.label,
|
|
373
389
|
name: pick.symbolName,
|
|
374
|
-
isDynamic: true
|
|
375
390
|
});
|
|
376
391
|
}
|
|
377
392
|
else if (isIOpenEditorsQuickPickItem(pick)) {
|
|
378
393
|
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput || e instanceof NotebookEditorInput)) {
|
|
379
394
|
const uri = editor instanceof DiffEditorInput ? editor.modified.resource : editor.resource;
|
|
380
395
|
if (uri) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
value: uri,
|
|
388
|
-
name: labelService.getUriBasenameLabel(uri),
|
|
389
|
-
isFile: true,
|
|
390
|
-
isDynamic: true
|
|
391
|
-
});
|
|
392
|
-
}
|
|
396
|
+
toAttach.push({
|
|
397
|
+
id: this._getFileContextId({ resource: uri }),
|
|
398
|
+
value: uri,
|
|
399
|
+
name: labelService.getUriBasenameLabel(uri),
|
|
400
|
+
isFile: true,
|
|
401
|
+
});
|
|
393
402
|
}
|
|
394
403
|
}
|
|
395
404
|
}
|
|
396
405
|
else if (isISearchResultsQuickPickItem(pick)) {
|
|
397
406
|
const searchView = viewsService.getViewWithId(VIEW_ID);
|
|
398
407
|
for (const result of searchView.model.searchResult.matches()) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
value: result.resource,
|
|
406
|
-
name: labelService.getUriBasenameLabel(result.resource),
|
|
407
|
-
isFile: true,
|
|
408
|
-
isDynamic: true
|
|
409
|
-
});
|
|
410
|
-
}
|
|
408
|
+
toAttach.push({
|
|
409
|
+
id: this._getFileContextId({ resource: result.resource }),
|
|
410
|
+
value: result.resource,
|
|
411
|
+
name: labelService.getUriBasenameLabel(result.resource),
|
|
412
|
+
isFile: true,
|
|
413
|
+
});
|
|
411
414
|
}
|
|
412
415
|
}
|
|
413
416
|
else if (isRelatedFileQuickPickItem(pick)) {
|
|
@@ -415,12 +418,12 @@ class AttachContextAction extends Action2 {
|
|
|
415
418
|
if (!chatSessionId || !chatEditingService) {
|
|
416
419
|
continue;
|
|
417
420
|
}
|
|
418
|
-
const relatedFiles = await chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), CancellationToken.None);
|
|
421
|
+
const relatedFiles = await chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None);
|
|
419
422
|
if (!relatedFiles) {
|
|
420
423
|
continue;
|
|
421
424
|
}
|
|
422
425
|
const attachments = widget.attachmentModel.getAttachmentIDs();
|
|
423
|
-
const itemsPromise = chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), CancellationToken.None)
|
|
426
|
+
const itemsPromise = chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), widget.attachmentModel.fileAttachments, CancellationToken.None)
|
|
424
427
|
.then((files) => (files ?? []).reduce((acc, cur) => {
|
|
425
428
|
acc.push({ type: 'separator', label: cur.group });
|
|
426
429
|
for (const file of cur.files) {
|
|
@@ -435,9 +438,9 @@ class AttachContextAction extends Action2 {
|
|
|
435
438
|
}
|
|
436
439
|
return acc;
|
|
437
440
|
}, []));
|
|
438
|
-
const selectedFiles = await quickInputService.pick(itemsPromise, { placeHolder: ( localize(
|
|
441
|
+
const selectedFiles = await quickInputService.pick(itemsPromise, { placeHolder: ( localize(4317, 'Add related files to your working set')), canPickMany: true });
|
|
439
442
|
for (const file of selectedFiles ?? []) {
|
|
440
|
-
chatEditingService
|
|
443
|
+
chatEditingService.getEditingSession(chatSessionId)?.addFileToWorkingSet(file.value);
|
|
441
444
|
}
|
|
442
445
|
}
|
|
443
446
|
else if (isScreenshotQuickPickItem(pick)) {
|
|
@@ -447,12 +450,8 @@ class AttachContextAction extends Action2 {
|
|
|
447
450
|
}
|
|
448
451
|
}
|
|
449
452
|
else if (isPromptInstructionsQuickPickItem(pick)) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
quickInputService,
|
|
453
|
-
labelService,
|
|
454
|
-
openerService,
|
|
455
|
-
});
|
|
453
|
+
const options = { widget, viewsService };
|
|
454
|
+
await commandService.executeCommand(ATTACH_PROMPT_ACTION_ID, options);
|
|
456
455
|
}
|
|
457
456
|
else {
|
|
458
457
|
const attachmentPick = pick;
|
|
@@ -463,7 +462,6 @@ class AttachContextAction extends Action2 {
|
|
|
463
462
|
}
|
|
464
463
|
toAttach.push({
|
|
465
464
|
...attachmentPick,
|
|
466
|
-
isDynamic: attachmentPick.isDynamic,
|
|
467
465
|
value: attachmentPick.value,
|
|
468
466
|
name: `${typeof attachmentPick.value === 'string' && attachmentPick.value.startsWith('#') ? attachmentPick.value.slice(1) : ''}${selection}`,
|
|
469
467
|
fullName: selection
|
|
@@ -483,23 +481,12 @@ class AttachContextAction extends Action2 {
|
|
|
483
481
|
const fileBuffer = await clipboardService.readImage();
|
|
484
482
|
toAttach.push({
|
|
485
483
|
id: await imageToHash(fileBuffer),
|
|
486
|
-
name: ( localize(
|
|
487
|
-
fullName: ( localize(
|
|
484
|
+
name: ( localize(4318, 'Pasted Image')),
|
|
485
|
+
fullName: ( localize(4318, 'Pasted Image')),
|
|
488
486
|
value: fileBuffer,
|
|
489
|
-
isDynamic: true,
|
|
490
487
|
isImage: true
|
|
491
488
|
});
|
|
492
489
|
}
|
|
493
|
-
else if (attachmentPick.kind === 'variable') {
|
|
494
|
-
toAttach.push({
|
|
495
|
-
range: undefined,
|
|
496
|
-
id: pick.id ?? '',
|
|
497
|
-
value: undefined,
|
|
498
|
-
fullName: pick.label,
|
|
499
|
-
name: attachmentPick.variable.name,
|
|
500
|
-
icon: attachmentPick.variable.icon
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
490
|
}
|
|
504
491
|
}
|
|
505
492
|
widget.attachmentModel.addContext(...toAttach);
|
|
@@ -510,7 +497,6 @@ class AttachContextAction extends Action2 {
|
|
|
510
497
|
async run(accessor, ...args) {
|
|
511
498
|
const quickInputService = accessor.get(IQuickInputService);
|
|
512
499
|
const chatAgentService = accessor.get(IChatAgentService);
|
|
513
|
-
const chatVariablesService = accessor.get(IChatVariablesService);
|
|
514
500
|
const commandService = accessor.get(ICommandService);
|
|
515
501
|
const widgetService = accessor.get(IChatWidgetService);
|
|
516
502
|
const languageModelToolsService = accessor.get(ILanguageModelToolsService);
|
|
@@ -523,142 +509,141 @@ class AttachContextAction extends Action2 {
|
|
|
523
509
|
const hostService = accessor.get(IHostService);
|
|
524
510
|
const extensionService = accessor.get(IExtensionService);
|
|
525
511
|
const fileService = accessor.get(IFileService);
|
|
526
|
-
const
|
|
512
|
+
const textModelService = accessor.get(ITextModelService);
|
|
513
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
514
|
+
const keybindingService = accessor.get(IKeybindingService);
|
|
527
515
|
const context = args[0];
|
|
528
516
|
const widget = context?.widget ?? widgetService.lastFocusedWidget;
|
|
529
517
|
if (!widget) {
|
|
530
518
|
return;
|
|
531
519
|
}
|
|
532
520
|
const chatEditingService = widget.location === ChatAgentLocation.EditingSession ? accessor.get(IChatEditingService) : undefined;
|
|
533
|
-
const usedAgent = widget.parsedInput.parts.find(p => p instanceof ChatRequestAgentPart);
|
|
534
|
-
const slowSupported = usedAgent ? usedAgent.agent.metadata.supportsSlowVariables : true;
|
|
535
521
|
const quickPickItems = [];
|
|
536
|
-
if (
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
quickPickItems.push({
|
|
540
|
-
kind: 'variable',
|
|
541
|
-
variable,
|
|
542
|
-
label: variable.fullName,
|
|
543
|
-
id: variable.id,
|
|
544
|
-
iconClass: variable.icon ? ThemeIcon.asClassName(variable.icon) : undefined,
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
if (( extensionService.extensions.some(ext => isProposedApiEnabled(ext, 'chatReferenceBinaryData')))) {
|
|
549
|
-
const imageData = await clipboardService.readImage();
|
|
550
|
-
if (isImage(imageData)) {
|
|
551
|
-
quickPickItems.push({
|
|
552
|
-
kind: 'image',
|
|
553
|
-
id: await imageToHash(imageData),
|
|
554
|
-
label: ( localize(4288, 'Image from Clipboard')),
|
|
555
|
-
iconClass: ThemeIcon.asClassName(Codicon.fileMedia),
|
|
556
|
-
});
|
|
557
|
-
}
|
|
522
|
+
if (( extensionService.extensions.some(ext => isProposedApiEnabled(ext, 'chatReferenceBinaryData')))) {
|
|
523
|
+
const imageData = await clipboardService.readImage();
|
|
524
|
+
if (isImage(imageData)) {
|
|
558
525
|
quickPickItems.push({
|
|
559
|
-
kind: '
|
|
560
|
-
id:
|
|
561
|
-
|
|
562
|
-
iconClass: ThemeIcon.asClassName(Codicon.
|
|
563
|
-
label: (isElectron
|
|
564
|
-
? ( localize(4289, 'Screenshot Window'))
|
|
565
|
-
: ( localize(4290, 'Screenshot'))),
|
|
526
|
+
kind: 'image',
|
|
527
|
+
id: await imageToHash(imageData),
|
|
528
|
+
label: ( localize(4319, 'Image from Clipboard')),
|
|
529
|
+
iconClass: ThemeIcon.asClassName(Codicon.fileMedia),
|
|
566
530
|
});
|
|
567
531
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
532
|
+
quickPickItems.push({
|
|
533
|
+
kind: 'screenshot',
|
|
534
|
+
id: ScreenshotVariableId,
|
|
535
|
+
icon: ThemeIcon.fromId(Codicon.deviceCamera.id),
|
|
536
|
+
iconClass: ThemeIcon.asClassName(Codicon.deviceCamera),
|
|
537
|
+
label: (isElectron
|
|
538
|
+
? ( localize(4320, 'Screenshot Window'))
|
|
539
|
+
: ( localize(4321, 'Screenshot'))),
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
if (widget.viewModel?.sessionId) {
|
|
543
|
+
const agentPart = widget.parsedInput.parts.find((part) => part instanceof ChatRequestAgentPart);
|
|
544
|
+
if (agentPart) {
|
|
545
|
+
const completions = await chatAgentService.getAgentCompletionItems(agentPart.agent.id, '', CancellationToken.None);
|
|
546
|
+
for (const variable of completions) {
|
|
547
|
+
if (variable.fullName && variable.command) {
|
|
548
|
+
quickPickItems.push({
|
|
549
|
+
kind: 'command',
|
|
550
|
+
label: variable.fullName,
|
|
551
|
+
id: variable.id,
|
|
552
|
+
command: variable.command,
|
|
553
|
+
icon: variable.icon,
|
|
554
|
+
iconClass: variable.icon ? ThemeIcon.asClassName(variable.icon) : undefined,
|
|
555
|
+
value: variable.value,
|
|
556
|
+
name: variable.name
|
|
557
|
+
});
|
|
586
558
|
}
|
|
587
559
|
}
|
|
588
560
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
quickPickItems.push(item);
|
|
561
|
+
}
|
|
562
|
+
for (const tool of languageModelToolsService.getTools()) {
|
|
563
|
+
if (tool.canBeReferencedInPrompt) {
|
|
564
|
+
const item = {
|
|
565
|
+
kind: 'tool',
|
|
566
|
+
label: tool.displayName ?? '',
|
|
567
|
+
id: tool.id,
|
|
568
|
+
icon: ThemeIcon.isThemeIcon(tool.icon) ? tool.icon : undefined
|
|
569
|
+
};
|
|
570
|
+
if (ThemeIcon.isThemeIcon(tool.icon)) {
|
|
571
|
+
item.iconClass = ThemeIcon.asClassName(tool.icon);
|
|
572
|
+
}
|
|
573
|
+
else if (tool.icon) {
|
|
574
|
+
item.iconPath = tool.icon;
|
|
604
575
|
}
|
|
576
|
+
quickPickItems.push(item);
|
|
605
577
|
}
|
|
578
|
+
}
|
|
579
|
+
quickPickItems.push({
|
|
580
|
+
kind: 'quickaccess',
|
|
581
|
+
label: ( localize(4322, 'Symbol...')),
|
|
582
|
+
iconClass: ThemeIcon.asClassName(Codicon.symbolField),
|
|
583
|
+
prefix: SymbolsQuickAccessProvider.PREFIX,
|
|
584
|
+
id: 'symbol'
|
|
585
|
+
});
|
|
586
|
+
quickPickItems.push({
|
|
587
|
+
kind: 'folder',
|
|
588
|
+
label: ( localize(4323, 'Folder...')),
|
|
589
|
+
iconClass: ThemeIcon.asClassName(Codicon.folder),
|
|
590
|
+
id: 'folder',
|
|
591
|
+
});
|
|
592
|
+
quickPickItems.push({
|
|
593
|
+
kind: 'diagnostic',
|
|
594
|
+
label: ( localize(4324, 'Problem...')),
|
|
595
|
+
iconClass: ThemeIcon.asClassName(Codicon.error),
|
|
596
|
+
id: 'diagnostic'
|
|
597
|
+
});
|
|
598
|
+
if (widget.location === ChatAgentLocation.Notebook) {
|
|
606
599
|
quickPickItems.push({
|
|
607
|
-
kind: '
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
600
|
+
kind: 'command',
|
|
601
|
+
id: 'chatContext.notebook.kernelVariable',
|
|
602
|
+
icon: ThemeIcon.fromId(Codicon.serverEnvironment.id),
|
|
603
|
+
iconClass: ThemeIcon.asClassName(Codicon.serverEnvironment),
|
|
604
|
+
value: 'kernelVariable',
|
|
605
|
+
label: ( localize(4325, 'Kernel Variable...')),
|
|
606
|
+
command: {
|
|
607
|
+
id: 'notebook.chat.selectAndInsertKernelVariable',
|
|
608
|
+
title: ( localize(4326, 'Select and Insert Kernel Variable')),
|
|
609
|
+
arguments: [{ widget, range: undefined }]
|
|
610
|
+
}
|
|
612
611
|
});
|
|
613
|
-
if (widget.location === ChatAgentLocation.Notebook) {
|
|
614
|
-
quickPickItems.push({
|
|
615
|
-
kind: 'command',
|
|
616
|
-
id: 'chatContext.notebook.kernelVariable',
|
|
617
|
-
isDynamic: true,
|
|
618
|
-
icon: ThemeIcon.fromId(Codicon.serverEnvironment.id),
|
|
619
|
-
iconClass: ThemeIcon.asClassName(Codicon.serverEnvironment),
|
|
620
|
-
value: 'kernelVariable',
|
|
621
|
-
label: ( localize(4292, 'Kernel Variable...')),
|
|
622
|
-
command: {
|
|
623
|
-
id: 'notebook.chat.selectAndInsertKernelVariable',
|
|
624
|
-
title: ( localize(4293, 'Select and Insert Kernel Variable')),
|
|
625
|
-
arguments: [{ widget, range: undefined }]
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
612
|
}
|
|
630
|
-
|
|
631
|
-
if (chatEditingService?.hasRelatedFilesProviders() && (widget.getInput() || chatEditingService
|
|
632
|
-
quickPickItems.
|
|
613
|
+
if (context?.showFilesOnly) {
|
|
614
|
+
if (chatEditingService?.hasRelatedFilesProviders() && (widget.getInput() || (getEditingSession(chatEditingService, widget)?.workingSet.size))) {
|
|
615
|
+
quickPickItems.unshift({
|
|
633
616
|
kind: 'related-files',
|
|
634
617
|
id: 'related-files',
|
|
635
|
-
label: ( localize(
|
|
618
|
+
label: ( localize(4327, 'Related Files')),
|
|
636
619
|
iconClass: ThemeIcon.asClassName(Codicon.sparkle),
|
|
637
620
|
});
|
|
638
621
|
}
|
|
639
622
|
if (editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput).length > 0) {
|
|
640
|
-
quickPickItems.
|
|
623
|
+
quickPickItems.unshift({
|
|
641
624
|
kind: 'open-editors',
|
|
642
625
|
id: 'open-editors',
|
|
643
|
-
label: ( localize(
|
|
626
|
+
label: ( localize(4328, 'Open Editors')),
|
|
644
627
|
iconClass: ThemeIcon.asClassName(Codicon.files),
|
|
645
628
|
});
|
|
646
629
|
}
|
|
647
630
|
if (SearchContext.HasSearchResults.getValue(contextKeyService)) {
|
|
648
|
-
quickPickItems.
|
|
631
|
+
quickPickItems.unshift({
|
|
649
632
|
kind: 'search-results',
|
|
650
633
|
id: 'search-results',
|
|
651
|
-
label: ( localize(
|
|
634
|
+
label: ( localize(4329, 'Search Results')),
|
|
652
635
|
iconClass: ThemeIcon.asClassName(Codicon.search),
|
|
653
636
|
});
|
|
654
637
|
}
|
|
655
638
|
}
|
|
656
639
|
if (widget.attachmentModel.promptInstructions.featureEnabled) {
|
|
640
|
+
const keybinding = keybindingService.lookupKeybinding(COMMAND_ID, contextKeyService);
|
|
657
641
|
quickPickItems.push({
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
label: ( localize(
|
|
642
|
+
id: REUSABLE_PROMPT_PICK_ID,
|
|
643
|
+
kind: REUSABLE_PROMPT_PICK_ID,
|
|
644
|
+
label: ( localize(4330, 'Prompt...')),
|
|
661
645
|
iconClass: ThemeIcon.asClassName(Codicon.bookmark),
|
|
646
|
+
keybinding,
|
|
662
647
|
});
|
|
663
648
|
}
|
|
664
649
|
function extractTextFromIconLabel(label) {
|
|
@@ -669,22 +654,53 @@ class AttachContextAction extends Action2 {
|
|
|
669
654
|
return match ? match[1] : label;
|
|
670
655
|
}
|
|
671
656
|
this._show(quickInputService, commandService, widget, quickChatService, quickPickItems.sort(function (a, b) {
|
|
657
|
+
if (a.kind === 'open-editors') {
|
|
658
|
+
return -1;
|
|
659
|
+
}
|
|
660
|
+
if (b.kind === 'open-editors') {
|
|
661
|
+
return 1;
|
|
662
|
+
}
|
|
672
663
|
const first = extractTextFromIconLabel(a.label).toUpperCase();
|
|
673
664
|
const second = extractTextFromIconLabel(b.label).toUpperCase();
|
|
674
665
|
return compare(first, second);
|
|
675
|
-
}), clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService,
|
|
666
|
+
}), clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, instantiationService, '', context?.placeholder);
|
|
667
|
+
}
|
|
668
|
+
async _showDiagnosticsPick(instantiationService, onBackgroundAccept) {
|
|
669
|
+
const convert = (item) => ({
|
|
670
|
+
kind: 'diagnostic-filter',
|
|
671
|
+
id: IDiagnosticVariableEntryFilterData.id(item),
|
|
672
|
+
label: IDiagnosticVariableEntryFilterData.label(item),
|
|
673
|
+
icon: IDiagnosticVariableEntryFilterData.icon,
|
|
674
|
+
filter: item,
|
|
675
|
+
});
|
|
676
|
+
const filter = await instantiationService.invokeFunction(accessor => createMarkersQuickPick(accessor, 'problem', items => onBackgroundAccept(( items.map(convert)))));
|
|
677
|
+
return filter && convert(filter);
|
|
676
678
|
}
|
|
677
|
-
_show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService,
|
|
679
|
+
_show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, instantiationService, query = '', placeholder) {
|
|
680
|
+
const attach = (isBackgroundAccept, ...items) => {
|
|
681
|
+
this._attachContext(widget, quickInputService, commandService, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, isBackgroundAccept, ...items);
|
|
682
|
+
};
|
|
678
683
|
const providerOptions = {
|
|
679
|
-
handleAccept: (
|
|
684
|
+
handleAccept: async (inputItem, isBackgroundAccept) => {
|
|
685
|
+
let item = inputItem;
|
|
686
|
+
if ('kind' in item && item.kind === 'folder') {
|
|
687
|
+
item = await this._showFolders(instantiationService);
|
|
688
|
+
}
|
|
689
|
+
else if ('kind' in item && item.kind === 'diagnostic') {
|
|
690
|
+
item = await this._showDiagnosticsPick(instantiationService, i => attach(true, ...i));
|
|
691
|
+
}
|
|
692
|
+
if (!item) {
|
|
693
|
+
this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, instantiationService, '', placeholder);
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
680
696
|
if ('prefix' in item) {
|
|
681
|
-
this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService,
|
|
697
|
+
this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, fileService, textModelService, instantiationService, item.prefix, placeholder);
|
|
682
698
|
}
|
|
683
699
|
else {
|
|
684
700
|
if (!clipboardService) {
|
|
685
701
|
return;
|
|
686
702
|
}
|
|
687
|
-
|
|
703
|
+
attach(isBackgroundAccept, item);
|
|
688
704
|
if (isQuickChat(widget)) {
|
|
689
705
|
quickChatService.open();
|
|
690
706
|
}
|
|
@@ -693,13 +709,6 @@ class AttachContextAction extends Action2 {
|
|
|
693
709
|
additionPicks: quickPickItems,
|
|
694
710
|
filter: (item) => {
|
|
695
711
|
const attachedContext = widget.attachmentModel.getAttachmentIDs();
|
|
696
|
-
if (chatEditingService) {
|
|
697
|
-
for (const [file, state] of chatEditingService.currentEditingSessionObs.get()?.workingSet.entries() ?? []) {
|
|
698
|
-
if (state.state !== WorkingSetEntryState.Suggested) {
|
|
699
|
-
attachedContext.add(this._getFileContextId({ resource: file }));
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
712
|
if (isIOpenEditorsQuickPickItem(item)) {
|
|
704
713
|
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput)) {
|
|
705
714
|
if (editor.resource && !( attachedContext.has(this._getFileContextId({ resource: editor.resource })))) {
|
|
@@ -733,70 +742,53 @@ class AttachContextAction extends Action2 {
|
|
|
733
742
|
SymbolsQuickAccessProvider.PREFIX,
|
|
734
743
|
AbstractGotoSymbolQuickAccessProvider.PREFIX
|
|
735
744
|
],
|
|
736
|
-
placeholder: placeholder ?? ( localize(
|
|
745
|
+
placeholder: placeholder ?? ( localize(4331, 'Search attachments')),
|
|
737
746
|
providerOptions,
|
|
738
747
|
});
|
|
739
748
|
}
|
|
749
|
+
async _showFolders(instantiationService) {
|
|
750
|
+
const folder = await instantiationService.invokeFunction(accessor => createFolderQuickPick(accessor));
|
|
751
|
+
if (!folder) {
|
|
752
|
+
return undefined;
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
kind: 'folder-search-result',
|
|
756
|
+
id: ( folder.toString()),
|
|
757
|
+
label: basename(folder),
|
|
758
|
+
resource: folder,
|
|
759
|
+
};
|
|
760
|
+
}
|
|
740
761
|
}
|
|
741
762
|
registerAction2(class AttachFilesAction extends AttachContextAction {
|
|
742
763
|
constructor() {
|
|
743
764
|
super({
|
|
744
765
|
id: 'workbench.action.chat.editing.attachFiles',
|
|
745
|
-
title: ( localize2(
|
|
766
|
+
title: ( localize2(4332, "Add Files to Copilot Edits")),
|
|
767
|
+
shortTitle: ( localize2(4333, "Add Files...")),
|
|
746
768
|
f1: false,
|
|
747
769
|
category: CHAT_CATEGORY,
|
|
748
|
-
|
|
770
|
+
menu: { id: MenuId.ChatInputAttachmentToolbar, group: 'navigation' },
|
|
771
|
+
icon: Codicon.attach,
|
|
772
|
+
precondition: ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession)),
|
|
773
|
+
keybinding: {
|
|
774
|
+
when: ( ContextKeyExpr.and(ChatContextKeys.inChatInput, ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession)))),
|
|
775
|
+
primary: KeyMod.CtrlCmd | KeyCode.Slash,
|
|
776
|
+
weight: KeybindingWeight.EditorContrib
|
|
777
|
+
}
|
|
749
778
|
});
|
|
750
779
|
}
|
|
751
780
|
async run(accessor, ...args) {
|
|
752
781
|
const context = args[0];
|
|
753
|
-
const attachFilesContext = { ...context, showFilesOnly: true
|
|
782
|
+
const attachFilesContext = { ...context, showFilesOnly: true };
|
|
754
783
|
return super.run(accessor, attachFilesContext);
|
|
755
784
|
}
|
|
756
785
|
});
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
const { promptInstructions } = widget.attachmentModel;
|
|
760
|
-
const files = await promptInstructions.listNonAttachedFiles()
|
|
761
|
-
.then((files) => {
|
|
762
|
-
return ( files.map((file) => {
|
|
763
|
-
const fileBasename = basename(file);
|
|
764
|
-
const fileWithoutExtension = fileBasename.replace(PROMPT_SNIPPET_FILE_EXTENSION, '');
|
|
765
|
-
const result = {
|
|
766
|
-
type: 'item',
|
|
767
|
-
label: fileWithoutExtension,
|
|
768
|
-
description: labelService.getUriLabel(dirname(file), { relative: true }),
|
|
769
|
-
tooltip: file.fsPath,
|
|
770
|
-
value: file,
|
|
771
|
-
};
|
|
772
|
-
return result;
|
|
773
|
-
}));
|
|
774
|
-
});
|
|
775
|
-
if (files.length === 0) {
|
|
776
|
-
const docsQuickPick = {
|
|
777
|
-
type: 'item',
|
|
778
|
-
label: ( localize(4301, 'Learn how create reusable prompts')),
|
|
779
|
-
description: PromptFilesConfig.DOCUMENTATION_URL,
|
|
780
|
-
tooltip: PromptFilesConfig.DOCUMENTATION_URL,
|
|
781
|
-
value: ( URI.parse(PromptFilesConfig.DOCUMENTATION_URL)),
|
|
782
|
-
};
|
|
783
|
-
const result = await quickInputService.pick([docsQuickPick], {
|
|
784
|
-
placeHolder: ( localize(4302, 'No prompt files found.')),
|
|
785
|
-
canPickMany: false,
|
|
786
|
-
});
|
|
787
|
-
if (!result) {
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
await openerService.open(result.value);
|
|
786
|
+
function getEditingSession(chatEditingService, chatWidget) {
|
|
787
|
+
if (!chatWidget.viewModel?.sessionId) {
|
|
791
788
|
return;
|
|
792
789
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
});
|
|
797
|
-
if (selectedFile) {
|
|
798
|
-
promptInstructions.add(selectedFile.value);
|
|
799
|
-
}
|
|
800
|
-
};
|
|
790
|
+
return chatEditingService.getEditingSession(chatWidget.viewModel.sessionId);
|
|
791
|
+
}
|
|
792
|
+
registerAction2(AttachPromptAction);
|
|
801
793
|
|
|
802
794
|
export { AttachContextAction, registerChatContextActions };
|