@codingame/monaco-vscode-chat-service-override 11.1.2 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -1
- package/index.js +64 -1
- package/package.json +32 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +73 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +73 -81
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +73 -112
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +253 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +16 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +30 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +22 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +23 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +50 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +124 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.d.ts +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +203 -182
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +103 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +458 -165
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +14 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatParticipantContributions.js → chatParticipant.contribution.js} +101 -92
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +164 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +10 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +941 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +32 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +8 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +16 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +108 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.js +3 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +70 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/{chatViewsWelcomeContributions.js → chatViewsWelcomeHandler.js} +13 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +80 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +152 -104
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +6 -4
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +23 -21
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +20 -19
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.service.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +30 -33
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +6 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +9 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +247 -83
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +5 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +35 -35
- package/chat.js +0 -59
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +0 -326
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +0 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorActions.js +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorController.js +0 -287
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +0 -130
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +0 -172
|
@@ -1,52 +1,60 @@
|
|
|
1
|
+
|
|
1
2
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
2
3
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
4
|
+
import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
3
5
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
4
6
|
import { isElectron } from 'vscode/vscode/vs/base/common/platform';
|
|
7
|
+
import { dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
5
8
|
import { compare } from 'vscode/vscode/vs/base/common/strings';
|
|
6
9
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
7
10
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
8
11
|
import { EditorType } from 'vscode/vscode/vs/editor/common/editorCommon';
|
|
9
|
-
import { AbstractGotoSymbolQuickAccessProvider } from 'vscode/vscode/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess';
|
|
12
|
+
import { AbstractGotoSymbolQuickAccessProvider } from '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess';
|
|
10
13
|
import { localize2, localize } from 'vscode/vscode/vs/nls';
|
|
11
14
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
12
15
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
13
16
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
14
17
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
15
18
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
19
|
+
import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
16
20
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
17
21
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
18
22
|
import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
19
|
-
import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
23
|
+
import { DiffEditorInput } from '@codingame/monaco-vscode-5108c2c9-4ada-52d8-8c4b-fe03b3160e71-common/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
20
24
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
21
25
|
import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
22
26
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
23
27
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
24
28
|
import { VIEW_ID } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
25
|
-
import { UntitledTextEditorInput } from 'vscode/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput';
|
|
29
|
+
import { UntitledTextEditorInput } from '@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput';
|
|
26
30
|
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
27
|
-
import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
+
import { FileEditorInput } from '@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
32
|
+
import { NotebookEditorInput } from '@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
33
|
+
import { AnythingQuickAccessProvider } from '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/workbench/contrib/search/browser/anythingQuickAccess';
|
|
34
|
+
import { isSearchTreeFileMatch, isSearchTreeMatch } from '@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common/vscode/vs/workbench/contrib/search/browser/searchTreeModel/searchTreeCommon';
|
|
35
|
+
import { SymbolsQuickAccessProvider } from '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/workbench/contrib/search/browser/symbolsQuickAccess';
|
|
36
|
+
import { SearchContext } from '@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common/vscode/vs/workbench/contrib/search/common/constants';
|
|
31
37
|
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
32
38
|
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
|
|
33
|
-
import {
|
|
39
|
+
import { ChatContextKeys } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
40
|
+
import { WorkingSetEntryState } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
34
41
|
import { IChatEditingService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
35
|
-
import { ChatRequestAgentPart } from '@codingame/monaco-vscode-
|
|
42
|
+
import { ChatRequestAgentPart } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
36
43
|
import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
|
|
37
44
|
import { ILanguageModelToolsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
38
|
-
import { showChatView } from '@codingame/monaco-vscode-
|
|
45
|
+
import { showChatView, showEditsView } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
39
46
|
import { IChatWidgetService, IQuickChatService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
40
47
|
import { imageToHash, isImage } from '../chatPasteProviders.js';
|
|
41
|
-
import { isQuickChat } from '@codingame/monaco-vscode-
|
|
42
|
-
import { convertBufferToScreenshotVariable, ScreenshotVariableId } from '@codingame/monaco-vscode-
|
|
43
|
-
import '@codingame/monaco-vscode-
|
|
44
|
-
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatConstants';
|
|
48
|
+
import { isQuickChat } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
49
|
+
import { convertBufferToScreenshotVariable, ScreenshotVariableId } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/contrib/screenshot';
|
|
50
|
+
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
45
51
|
|
|
46
52
|
function registerChatContextActions() {
|
|
47
53
|
registerAction2(AttachContextAction);
|
|
48
|
-
registerAction2(
|
|
49
|
-
registerAction2(
|
|
54
|
+
registerAction2(AttachFileToChatAction);
|
|
55
|
+
registerAction2(AttachSelectionToChatAction);
|
|
56
|
+
registerAction2(AttachFileToEditingSessionAction);
|
|
57
|
+
registerAction2(AttachSelectionToEditingSessionAction);
|
|
50
58
|
}
|
|
51
59
|
function isIGotoSymbolQuickPickItem(obj) {
|
|
52
60
|
return (typeof obj === 'object'
|
|
@@ -76,51 +84,174 @@ function isScreenshotQuickPickItem(obj) {
|
|
|
76
84
|
return (typeof obj === 'object'
|
|
77
85
|
&& obj.kind === 'screenshot');
|
|
78
86
|
}
|
|
87
|
+
function isRelatedFileQuickPickItem(obj) {
|
|
88
|
+
return (typeof obj === 'object'
|
|
89
|
+
&& obj.kind === 'related-files');
|
|
90
|
+
}
|
|
79
91
|
class AttachFileAction extends Action2 {
|
|
92
|
+
getFiles(accessor, ...args) {
|
|
93
|
+
const textEditorService = accessor.get(IEditorService);
|
|
94
|
+
const contexts = Array.isArray(args[1]) ? args[1] : [args[0]];
|
|
95
|
+
const files = [];
|
|
96
|
+
for (const context of contexts) {
|
|
97
|
+
let uri;
|
|
98
|
+
if (URI.isUri(context)) {
|
|
99
|
+
uri = context;
|
|
100
|
+
}
|
|
101
|
+
else if (isSearchTreeFileMatch(context)) {
|
|
102
|
+
uri = context.resource;
|
|
103
|
+
}
|
|
104
|
+
else if (isSearchTreeMatch(context)) {
|
|
105
|
+
uri = context.parent().resource;
|
|
106
|
+
}
|
|
107
|
+
else if (!context && textEditorService.activeTextEditorControl?.getEditorType() === EditorType.ICodeEditor) {
|
|
108
|
+
uri = textEditorService.activeEditor?.resource;
|
|
109
|
+
}
|
|
110
|
+
if (uri && [Schemas.file, Schemas.vscodeRemote, Schemas.untitled].includes(uri.scheme)) {
|
|
111
|
+
files.push(uri);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return files;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
class AttachFileToChatAction extends AttachFileAction {
|
|
80
118
|
static { this.ID = 'workbench.action.chat.attachFile'; }
|
|
81
119
|
constructor() {
|
|
82
120
|
super({
|
|
83
|
-
id:
|
|
84
|
-
title: ( localize2(
|
|
121
|
+
id: AttachFileToChatAction.ID,
|
|
122
|
+
title: ( localize2(4196, "Add File to Chat")),
|
|
85
123
|
category: CHAT_CATEGORY,
|
|
86
124
|
f1: false,
|
|
87
|
-
precondition:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
125
|
+
precondition: ChatContextKeys.enabled,
|
|
126
|
+
menu: [{
|
|
127
|
+
id: MenuId.ChatCommandCenter,
|
|
128
|
+
group: 'b_chat_context',
|
|
129
|
+
when: ( ActiveEditorContext.isEqualTo('workbench.editors.files.textFileEditor')),
|
|
130
|
+
order: 10,
|
|
131
|
+
}, {
|
|
132
|
+
id: MenuId.SearchContext,
|
|
133
|
+
group: 'z_chat',
|
|
134
|
+
order: 1
|
|
135
|
+
}]
|
|
96
136
|
});
|
|
97
137
|
}
|
|
98
138
|
async run(accessor, ...args) {
|
|
99
139
|
const variablesService = accessor.get(IChatVariablesService);
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
if (textEditorService.activeTextEditorControl?.getEditorType() === EditorType.ICodeEditor && activeUri && [Schemas.file, Schemas.vscodeRemote, Schemas.untitled].includes(activeUri.scheme)) {
|
|
140
|
+
const files = this.getFiles(accessor, ...args);
|
|
141
|
+
if (files.length) {
|
|
103
142
|
(await showChatView(accessor.get(IViewsService)))?.focusInput();
|
|
104
|
-
|
|
143
|
+
for (const file of files) {
|
|
144
|
+
variablesService.attachContext('file', file, ChatAgentLocation.Panel);
|
|
145
|
+
}
|
|
105
146
|
}
|
|
106
147
|
}
|
|
107
148
|
}
|
|
108
|
-
class
|
|
149
|
+
class AttachSelectionToChatAction extends Action2 {
|
|
109
150
|
static { this.ID = 'workbench.action.chat.attachSelection'; }
|
|
110
151
|
constructor() {
|
|
111
152
|
super({
|
|
112
|
-
id:
|
|
113
|
-
title: ( localize2(
|
|
153
|
+
id: AttachSelectionToChatAction.ID,
|
|
154
|
+
title: ( localize2(4197, "Add Selection to Chat")),
|
|
114
155
|
category: CHAT_CATEGORY,
|
|
115
156
|
f1: false,
|
|
116
|
-
precondition:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
157
|
+
precondition: ChatContextKeys.enabled,
|
|
158
|
+
menu: [{
|
|
159
|
+
id: MenuId.ChatCommandCenter,
|
|
160
|
+
group: 'b_chat_context',
|
|
161
|
+
when: ( ActiveEditorContext.isEqualTo('workbench.editors.files.textFileEditor')),
|
|
162
|
+
order: 15,
|
|
163
|
+
}, {
|
|
164
|
+
id: MenuId.SearchContext,
|
|
165
|
+
group: 'z_chat',
|
|
166
|
+
order: 2
|
|
167
|
+
}]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
async run(accessor, ...args) {
|
|
171
|
+
const variablesService = accessor.get(IChatVariablesService);
|
|
172
|
+
const textEditorService = accessor.get(IEditorService);
|
|
173
|
+
const [_, matches] = args;
|
|
174
|
+
if (matches && matches.length > 0) {
|
|
175
|
+
const uris = ( new Map());
|
|
176
|
+
for (const match of matches) {
|
|
177
|
+
if (isSearchTreeFileMatch(match)) {
|
|
178
|
+
uris.set(match.resource, undefined);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
const context = { uri: match._parent.resource, range: match._range };
|
|
182
|
+
const range = uris.get(context.uri);
|
|
183
|
+
if (!range ||
|
|
184
|
+
range.startLineNumber !== context.range.startLineNumber && range.endLineNumber !== context.range.endLineNumber) {
|
|
185
|
+
uris.set(context.uri, context.range);
|
|
186
|
+
variablesService.attachContext('file', context, ChatAgentLocation.Panel);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
for (const uri of uris) {
|
|
191
|
+
const [resource, range] = uri;
|
|
192
|
+
if (!range) {
|
|
193
|
+
variablesService.attachContext('file', { uri: resource }, ChatAgentLocation.Panel);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const activeEditor = textEditorService.activeTextEditorControl;
|
|
199
|
+
const activeUri = textEditorService.activeEditor?.resource;
|
|
200
|
+
if (textEditorService.activeTextEditorControl?.getEditorType() === EditorType.ICodeEditor && activeUri && [Schemas.file, Schemas.vscodeRemote, Schemas.untitled].includes(activeUri.scheme)) {
|
|
201
|
+
const selection = activeEditor?.getSelection();
|
|
202
|
+
if (selection) {
|
|
203
|
+
(await showChatView(accessor.get(IViewsService)))?.focusInput();
|
|
204
|
+
variablesService.attachContext('file', { uri: activeUri, range: selection }, ChatAgentLocation.Panel);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
class AttachFileToEditingSessionAction extends AttachFileAction {
|
|
211
|
+
static { this.ID = 'workbench.action.edits.attachFile'; }
|
|
212
|
+
constructor() {
|
|
213
|
+
super({
|
|
214
|
+
id: AttachFileToEditingSessionAction.ID,
|
|
215
|
+
title: ( localize2(4198, "Add File to {0}", 'Copilot Edits')),
|
|
216
|
+
category: CHAT_CATEGORY,
|
|
217
|
+
f1: false,
|
|
218
|
+
precondition: ChatContextKeys.enabled,
|
|
219
|
+
menu: [{
|
|
220
|
+
id: MenuId.ChatCommandCenter,
|
|
221
|
+
group: 'c_edits_context',
|
|
222
|
+
when: ( ActiveEditorContext.isEqualTo('workbench.editors.files.textFileEditor')),
|
|
223
|
+
order: 10,
|
|
224
|
+
}, {
|
|
225
|
+
id: MenuId.SearchContext,
|
|
226
|
+
group: 'z_chat',
|
|
227
|
+
order: 2
|
|
228
|
+
}]
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
async run(accessor, ...args) {
|
|
232
|
+
const variablesService = accessor.get(IChatVariablesService);
|
|
233
|
+
const files = this.getFiles(accessor, ...args);
|
|
234
|
+
if (files.length) {
|
|
235
|
+
(await showEditsView(accessor.get(IViewsService)))?.focusInput();
|
|
236
|
+
for (const file of files) {
|
|
237
|
+
variablesService.attachContext('file', file, ChatAgentLocation.EditingSession);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
class AttachSelectionToEditingSessionAction extends Action2 {
|
|
243
|
+
static { this.ID = 'workbench.action.edits.attachSelection'; }
|
|
244
|
+
constructor() {
|
|
245
|
+
super({
|
|
246
|
+
id: AttachSelectionToEditingSessionAction.ID,
|
|
247
|
+
title: ( localize2(4199, "Add Selection to {0}", 'Copilot Edits')),
|
|
248
|
+
category: CHAT_CATEGORY,
|
|
249
|
+
f1: false,
|
|
250
|
+
precondition: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ActiveEditorContext.isEqualTo('workbench.editors.files.textFileEditor')))),
|
|
120
251
|
menu: {
|
|
121
252
|
id: MenuId.ChatCommandCenter,
|
|
122
|
-
group: '
|
|
123
|
-
order:
|
|
253
|
+
group: 'c_edits_context',
|
|
254
|
+
order: 15,
|
|
124
255
|
}
|
|
125
256
|
});
|
|
126
257
|
}
|
|
@@ -132,54 +263,35 @@ class AttachSelectionAction extends Action2 {
|
|
|
132
263
|
if (textEditorService.activeTextEditorControl?.getEditorType() === EditorType.ICodeEditor && activeUri && [Schemas.file, Schemas.vscodeRemote, Schemas.untitled].includes(activeUri.scheme)) {
|
|
133
264
|
const selection = activeEditor?.getSelection();
|
|
134
265
|
if (selection) {
|
|
135
|
-
(await
|
|
136
|
-
variablesService.attachContext('file', { uri: activeUri, range: selection }, ChatAgentLocation.
|
|
266
|
+
(await showEditsView(accessor.get(IViewsService)))?.focusInput();
|
|
267
|
+
variablesService.attachContext('file', { uri: activeUri, range: selection }, ChatAgentLocation.EditingSession);
|
|
137
268
|
}
|
|
138
269
|
}
|
|
139
270
|
}
|
|
140
271
|
}
|
|
141
272
|
class AttachContextAction extends Action2 {
|
|
142
273
|
static { this.ID = 'workbench.action.chat.attachContext'; }
|
|
143
|
-
static { this._cdt = (
|
|
144
|
-
(ContextKeyExpr.and( (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Panel)))),
|
|
145
|
-
(ContextKeyExpr.and( (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Editor)))),
|
|
146
|
-
(ContextKeyExpr.and(
|
|
147
|
-
(CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Notebook))
|
|
148
|
-
)),
|
|
149
|
-
(ContextKeyExpr.and(
|
|
150
|
-
(CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Terminal))
|
|
151
|
-
))
|
|
152
|
-
))); }
|
|
274
|
+
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)))))); }
|
|
153
275
|
constructor(desc = {
|
|
154
276
|
id: AttachContextAction.ID,
|
|
155
|
-
title: ( localize2(
|
|
277
|
+
title: ( localize2(4200, "Attach Context")),
|
|
156
278
|
icon: Codicon.attach,
|
|
157
279
|
category: CHAT_CATEGORY,
|
|
158
|
-
precondition: (
|
|
159
|
-
(CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.EditingSession))
|
|
160
|
-
))))),
|
|
280
|
+
precondition: ( ContextKeyExpr.or(AttachContextAction._cdt, ( ContextKeyExpr.and(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession)))))),
|
|
161
281
|
keybinding: {
|
|
162
|
-
when:
|
|
163
|
-
primary:
|
|
164
|
-
weight:
|
|
282
|
+
when: ChatContextKeys.inChatInput,
|
|
283
|
+
primary: KeyMod.CtrlCmd | KeyCode.Slash,
|
|
284
|
+
weight: KeybindingWeight.EditorContrib
|
|
165
285
|
},
|
|
166
286
|
menu: [
|
|
167
287
|
{
|
|
168
|
-
when: (
|
|
169
|
-
(CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.EditingSession))
|
|
170
|
-
)), (ContextKeyExpr.and( (ContextKeyExpr.or(
|
|
171
|
-
(CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Panel)),
|
|
172
|
-
(CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.EditingSession))
|
|
173
|
-
)), AttachContextAction._cdt))))),
|
|
288
|
+
when: ( ContextKeyExpr.or(( ContextKeyExpr.and(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession)))), ( ContextKeyExpr.and(( ContextKeyExpr.or(( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel)), ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession)))), AttachContextAction._cdt)))),
|
|
174
289
|
id: MenuId.ChatInput,
|
|
175
290
|
group: 'navigation',
|
|
176
291
|
order: 2
|
|
177
292
|
},
|
|
178
293
|
{
|
|
179
|
-
when: (
|
|
180
|
-
(( (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Panel))).negate()),
|
|
181
|
-
AttachContextAction._cdt
|
|
182
|
-
))),
|
|
294
|
+
when: ( ContextKeyExpr.and(( ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel)).negate()), AttachContextAction._cdt)),
|
|
183
295
|
id: MenuId.ChatExecute,
|
|
184
296
|
group: 'navigation',
|
|
185
297
|
order: 1
|
|
@@ -190,21 +302,21 @@ class AttachContextAction extends Action2 {
|
|
|
190
302
|
}
|
|
191
303
|
_getFileContextId(item) {
|
|
192
304
|
if ('resource' in item) {
|
|
193
|
-
return (
|
|
194
|
-
(item.resource.toString())
|
|
195
|
-
);
|
|
305
|
+
return ( item.resource.toString());
|
|
196
306
|
}
|
|
197
|
-
return (
|
|
307
|
+
return ( item.uri.toString()) + (item.range.startLineNumber !== item.range.endLineNumber ?
|
|
198
308
|
`:${item.range.startLineNumber}-${item.range.endLineNumber}` :
|
|
199
309
|
`:${item.range.startLineNumber}`);
|
|
200
310
|
}
|
|
201
|
-
async _attachContext(widget, commandService, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, isInBackground, ...picks) {
|
|
311
|
+
async _attachContext(widget, quickInputService, commandService, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, isInBackground, ...picks) {
|
|
202
312
|
const toAttach = [];
|
|
203
313
|
for (const pick of picks) {
|
|
204
314
|
if (isISymbolQuickPickItem(pick) && pick.symbol) {
|
|
205
315
|
toAttach.push({
|
|
316
|
+
kind: 'symbol',
|
|
206
317
|
id: this._getFileContextId(pick.symbol.location),
|
|
207
318
|
value: pick.symbol.location,
|
|
319
|
+
symbolKind: pick.symbol.kind,
|
|
208
320
|
fullName: pick.label,
|
|
209
321
|
name: pick.symbol.name,
|
|
210
322
|
isDynamic: true
|
|
@@ -213,7 +325,7 @@ class AttachContextAction extends Action2 {
|
|
|
213
325
|
else if (isIQuickPickItemWithResource(pick) && pick.resource) {
|
|
214
326
|
if (/\.(png|jpg|jpeg|bmp|gif|tiff)$/i.test(pick.resource.path)) {
|
|
215
327
|
toAttach.push({
|
|
216
|
-
id: (
|
|
328
|
+
id: ( pick.resource.toString()),
|
|
217
329
|
name: pick.label,
|
|
218
330
|
fullName: pick.label,
|
|
219
331
|
value: pick.resource,
|
|
@@ -247,7 +359,7 @@ class AttachContextAction extends Action2 {
|
|
|
247
359
|
});
|
|
248
360
|
}
|
|
249
361
|
else if (isIOpenEditorsQuickPickItem(pick)) {
|
|
250
|
-
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput)) {
|
|
362
|
+
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput || e instanceof NotebookEditorInput)) {
|
|
251
363
|
const uri = editor instanceof DiffEditorInput ? editor.modified.resource : editor.resource;
|
|
252
364
|
if (uri) {
|
|
253
365
|
if (chatEditingService) {
|
|
@@ -282,6 +394,36 @@ class AttachContextAction extends Action2 {
|
|
|
282
394
|
}
|
|
283
395
|
}
|
|
284
396
|
}
|
|
397
|
+
else if (isRelatedFileQuickPickItem(pick)) {
|
|
398
|
+
const chatSessionId = widget.viewModel?.sessionId;
|
|
399
|
+
if (!chatSessionId || !chatEditingService) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
const relatedFiles = await chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), CancellationToken.None);
|
|
403
|
+
if (!relatedFiles) {
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
const attachments = widget.attachmentModel.getAttachmentIDs();
|
|
407
|
+
const itemsPromise = chatEditingService.getRelatedFiles(chatSessionId, widget.getInput(), CancellationToken.None)
|
|
408
|
+
.then((files) => (files ?? []).reduce((acc, cur) => {
|
|
409
|
+
acc.push({ type: 'separator', label: cur.group });
|
|
410
|
+
for (const file of cur.files) {
|
|
411
|
+
acc.push({
|
|
412
|
+
type: 'item',
|
|
413
|
+
label: labelService.getUriBasenameLabel(file.uri),
|
|
414
|
+
description: labelService.getUriLabel(dirname(file.uri), { relative: true }),
|
|
415
|
+
value: file.uri,
|
|
416
|
+
disabled: ( attachments.has(this._getFileContextId({ resource: file.uri }))),
|
|
417
|
+
picked: true
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return acc;
|
|
421
|
+
}, []));
|
|
422
|
+
const selectedFiles = await quickInputService.pick(itemsPromise, { placeHolder: ( localize(4201, 'Add related files to your working set')), canPickMany: true });
|
|
423
|
+
for (const file of selectedFiles ?? []) {
|
|
424
|
+
chatEditingService?.currentEditingSessionObs.get()?.addFileToWorkingSet(file.value);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
285
427
|
else if (isScreenshotQuickPickItem(pick)) {
|
|
286
428
|
const blob = await hostService.getScreenshot();
|
|
287
429
|
if (blob) {
|
|
@@ -317,8 +459,8 @@ class AttachContextAction extends Action2 {
|
|
|
317
459
|
const fileBuffer = await clipboardService.readImage();
|
|
318
460
|
toAttach.push({
|
|
319
461
|
id: await imageToHash(fileBuffer),
|
|
320
|
-
name: ( localize(
|
|
321
|
-
fullName: ( localize(
|
|
462
|
+
name: ( localize(4202, 'Pasted Image')),
|
|
463
|
+
fullName: ( localize(4202, 'Pasted Image')),
|
|
322
464
|
value: fileBuffer,
|
|
323
465
|
isDynamic: true,
|
|
324
466
|
isImage: true
|
|
@@ -377,13 +519,13 @@ class AttachContextAction extends Action2 {
|
|
|
377
519
|
});
|
|
378
520
|
}
|
|
379
521
|
}
|
|
380
|
-
if ((
|
|
522
|
+
if (( extensionService.extensions.some(ext => isProposedApiEnabled(ext, 'chatReferenceBinaryData')))) {
|
|
381
523
|
const imageData = await clipboardService.readImage();
|
|
382
524
|
if (isImage(imageData)) {
|
|
383
525
|
quickPickItems.push({
|
|
384
526
|
kind: 'image',
|
|
385
527
|
id: await imageToHash(imageData),
|
|
386
|
-
label: ( localize(
|
|
528
|
+
label: ( localize(4203, 'Image from Clipboard')),
|
|
387
529
|
iconClass: ThemeIcon.asClassName(Codicon.fileMedia),
|
|
388
530
|
});
|
|
389
531
|
}
|
|
@@ -393,8 +535,8 @@ class AttachContextAction extends Action2 {
|
|
|
393
535
|
icon: ThemeIcon.fromId(Codicon.deviceCamera.id),
|
|
394
536
|
iconClass: ThemeIcon.asClassName(Codicon.deviceCamera),
|
|
395
537
|
label: (isElectron
|
|
396
|
-
? ( localize(
|
|
397
|
-
: ( localize(
|
|
538
|
+
? ( localize(4204, 'Screenshot Window'))
|
|
539
|
+
: ( localize(4205, 'Screenshot'))),
|
|
398
540
|
});
|
|
399
541
|
}
|
|
400
542
|
if (widget.viewModel?.sessionId) {
|
|
@@ -437,7 +579,7 @@ class AttachContextAction extends Action2 {
|
|
|
437
579
|
}
|
|
438
580
|
quickPickItems.push({
|
|
439
581
|
kind: 'quickaccess',
|
|
440
|
-
label: ( localize(
|
|
582
|
+
label: ( localize(4206, 'Symbol...')),
|
|
441
583
|
iconClass: ThemeIcon.asClassName(Codicon.symbolField),
|
|
442
584
|
prefix: SymbolsQuickAccessProvider.PREFIX,
|
|
443
585
|
id: 'symbol'
|
|
@@ -450,21 +592,29 @@ class AttachContextAction extends Action2 {
|
|
|
450
592
|
icon: ThemeIcon.fromId(Codicon.serverEnvironment.id),
|
|
451
593
|
iconClass: ThemeIcon.asClassName(Codicon.serverEnvironment),
|
|
452
594
|
value: 'kernelVariable',
|
|
453
|
-
label: ( localize(
|
|
595
|
+
label: ( localize(4207, 'Kernel Variable...')),
|
|
454
596
|
command: {
|
|
455
597
|
id: 'notebook.chat.selectAndInsertKernelVariable',
|
|
456
|
-
title: ( localize(
|
|
598
|
+
title: ( localize(4208, 'Select and Insert Kernel Variable')),
|
|
457
599
|
arguments: [{ widget, range: undefined }]
|
|
458
600
|
}
|
|
459
601
|
});
|
|
460
602
|
}
|
|
461
603
|
}
|
|
462
604
|
else if (context.showFilesOnly) {
|
|
605
|
+
if (chatEditingService?.hasRelatedFilesProviders() && (widget.getInput() || chatEditingService.currentEditingSessionObs.get()?.workingSet.size)) {
|
|
606
|
+
quickPickItems.push({
|
|
607
|
+
kind: 'related-files',
|
|
608
|
+
id: 'related-files',
|
|
609
|
+
label: ( localize(4209, 'Related Files')),
|
|
610
|
+
iconClass: ThemeIcon.asClassName(Codicon.sparkle),
|
|
611
|
+
});
|
|
612
|
+
}
|
|
463
613
|
if (editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput).length > 0) {
|
|
464
614
|
quickPickItems.push({
|
|
465
615
|
kind: 'open-editors',
|
|
466
616
|
id: 'open-editors',
|
|
467
|
-
label: ( localize(
|
|
617
|
+
label: ( localize(4210, 'Open Editors')),
|
|
468
618
|
iconClass: ThemeIcon.asClassName(Codicon.files),
|
|
469
619
|
});
|
|
470
620
|
}
|
|
@@ -472,7 +622,7 @@ class AttachContextAction extends Action2 {
|
|
|
472
622
|
quickPickItems.push({
|
|
473
623
|
kind: 'search-results',
|
|
474
624
|
id: 'search-results',
|
|
475
|
-
label: ( localize(
|
|
625
|
+
label: ( localize(4211, 'Search Results')),
|
|
476
626
|
iconClass: ThemeIcon.asClassName(Codicon.search),
|
|
477
627
|
});
|
|
478
628
|
}
|
|
@@ -500,7 +650,7 @@ class AttachContextAction extends Action2 {
|
|
|
500
650
|
if (!clipboardService) {
|
|
501
651
|
return;
|
|
502
652
|
}
|
|
503
|
-
this._attachContext(widget, commandService, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, isBackgroundAccept, item);
|
|
653
|
+
this._attachContext(widget, quickInputService, commandService, clipboardService, editorService, labelService, viewsService, chatEditingService, hostService, isBackgroundAccept, item);
|
|
504
654
|
if (isQuickChat(widget)) {
|
|
505
655
|
quickChatService.open();
|
|
506
656
|
}
|
|
@@ -510,33 +660,35 @@ class AttachContextAction extends Action2 {
|
|
|
510
660
|
filter: (item) => {
|
|
511
661
|
const attachedContext = widget.attachmentModel.getAttachmentIDs();
|
|
512
662
|
if (chatEditingService) {
|
|
513
|
-
for (const file of chatEditingService.currentEditingSessionObs.get()?.workingSet.
|
|
514
|
-
|
|
663
|
+
for (const [file, state] of chatEditingService.currentEditingSessionObs.get()?.workingSet.entries() ?? []) {
|
|
664
|
+
if (state.state !== WorkingSetEntryState.Suggested) {
|
|
665
|
+
attachedContext.add(this._getFileContextId({ resource: file }));
|
|
666
|
+
}
|
|
515
667
|
}
|
|
516
668
|
}
|
|
517
669
|
if (isIOpenEditorsQuickPickItem(item)) {
|
|
518
670
|
for (const editor of editorService.editors.filter(e => e instanceof FileEditorInput || e instanceof DiffEditorInput || e instanceof UntitledTextEditorInput)) {
|
|
519
|
-
if (editor.resource && !(
|
|
671
|
+
if (editor.resource && !( attachedContext.has(this._getFileContextId({ resource: editor.resource })))) {
|
|
520
672
|
return true;
|
|
521
673
|
}
|
|
522
674
|
}
|
|
523
675
|
return false;
|
|
524
676
|
}
|
|
525
677
|
if ('kind' in item && item.kind === 'image') {
|
|
526
|
-
return !(
|
|
678
|
+
return !( attachedContext.has(item.id));
|
|
527
679
|
}
|
|
528
680
|
if ('symbol' in item && item.symbol) {
|
|
529
|
-
return !(
|
|
681
|
+
return !( attachedContext.has(this._getFileContextId(item.symbol.location)));
|
|
530
682
|
}
|
|
531
683
|
if (item && typeof item === 'object' && 'resource' in item && URI.isUri(item.resource)) {
|
|
532
|
-
return [Schemas.file, Schemas.vscodeRemote].includes(item.resource.scheme)
|
|
533
|
-
&& !(
|
|
684
|
+
return [Schemas.file, Schemas.vscodeRemote, Schemas.untitled].includes(item.resource.scheme)
|
|
685
|
+
&& !( attachedContext.has(this._getFileContextId({ resource: item.resource })));
|
|
534
686
|
}
|
|
535
687
|
if (item && typeof item === 'object' && 'uri' in item && item.uri && item.range) {
|
|
536
|
-
return !(
|
|
688
|
+
return !( attachedContext.has(this._getFileContextId({ uri: item.uri, range: item.range.decoration })));
|
|
537
689
|
}
|
|
538
690
|
if (!('command' in item) && item.id) {
|
|
539
|
-
return !(
|
|
691
|
+
return !( attachedContext.has(item.id));
|
|
540
692
|
}
|
|
541
693
|
return true;
|
|
542
694
|
}
|
|
@@ -547,7 +699,7 @@ class AttachContextAction extends Action2 {
|
|
|
547
699
|
SymbolsQuickAccessProvider.PREFIX,
|
|
548
700
|
AbstractGotoSymbolQuickAccessProvider.PREFIX
|
|
549
701
|
],
|
|
550
|
-
placeholder: placeholder ?? ( localize(
|
|
702
|
+
placeholder: placeholder ?? ( localize(4212, 'Search attachments')),
|
|
551
703
|
providerOptions,
|
|
552
704
|
});
|
|
553
705
|
}
|
|
@@ -556,15 +708,15 @@ registerAction2(class AttachFilesAction extends AttachContextAction {
|
|
|
556
708
|
constructor() {
|
|
557
709
|
super({
|
|
558
710
|
id: 'workbench.action.chat.editing.attachFiles',
|
|
559
|
-
title: ( localize2(
|
|
711
|
+
title: ( localize2(4213, "Add Files to Working Set")),
|
|
560
712
|
f1: false,
|
|
561
713
|
category: CHAT_CATEGORY,
|
|
562
|
-
precondition: (
|
|
714
|
+
precondition: ( ChatContextKeys.location.isEqualTo(ChatAgentLocation.EditingSession))
|
|
563
715
|
});
|
|
564
716
|
}
|
|
565
717
|
async run(accessor, ...args) {
|
|
566
718
|
const context = args[0];
|
|
567
|
-
const attachFilesContext = { ...context, showFilesOnly: true, placeholder: ( localize(
|
|
719
|
+
const attachFilesContext = { ...context, showFilesOnly: true, placeholder: ( localize(4214, 'Search for files to add to your working set')) };
|
|
568
720
|
return super.run(accessor, attachFilesContext);
|
|
569
721
|
}
|
|
570
722
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerChatCopyActions(): void;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
+
|
|
1
2
|
import { localize2 } from 'vscode/vscode/vs/nls';
|
|
2
3
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
4
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
4
|
-
import { stringifyItem } from '@codingame/monaco-vscode-
|
|
5
|
+
import { CHAT_CATEGORY, stringifyItem } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
5
6
|
import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
6
|
-
import {
|
|
7
|
-
import { isRequestVM, isResponseVM } from '@codingame/monaco-vscode-
|
|
8
|
-
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatConstants';
|
|
7
|
+
import { ChatContextKeys } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
8
|
+
import { isRequestVM, isResponseVM } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/chatViewModel';
|
|
9
9
|
|
|
10
10
|
function registerChatCopyActions() {
|
|
11
11
|
registerAction2(class CopyAllAction extends Action2 {
|
|
12
12
|
constructor() {
|
|
13
13
|
super({
|
|
14
14
|
id: 'workbench.action.chat.copyAll',
|
|
15
|
-
title: ( localize2(
|
|
15
|
+
title: ( localize2(4215, "Copy All")),
|
|
16
16
|
f1: false,
|
|
17
17
|
category: CHAT_CATEGORY,
|
|
18
18
|
menu: {
|
|
19
19
|
id: MenuId.ChatContext,
|
|
20
|
-
when: (
|
|
20
|
+
when: ( ChatContextKeys.responseIsFiltered.toNegated()),
|
|
21
21
|
group: 'copy',
|
|
22
22
|
}
|
|
23
23
|
});
|
|
@@ -42,12 +42,12 @@ function registerChatCopyActions() {
|
|
|
42
42
|
constructor() {
|
|
43
43
|
super({
|
|
44
44
|
id: 'workbench.action.chat.copyItem',
|
|
45
|
-
title: ( localize2(
|
|
45
|
+
title: ( localize2(4216, "Copy")),
|
|
46
46
|
f1: false,
|
|
47
47
|
category: CHAT_CATEGORY,
|
|
48
48
|
menu: {
|
|
49
49
|
id: MenuId.ChatContext,
|
|
50
|
-
when: (
|
|
50
|
+
when: ( ChatContextKeys.responseIsFiltered.toNegated()),
|
|
51
51
|
group: 'copy',
|
|
52
52
|
}
|
|
53
53
|
});
|