@codingame/monaco-vscode-chat-service-override 8.0.3 → 9.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.
Files changed (33) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +24 -24
  3. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +2 -2
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +73 -22
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +47 -36
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +2 -2
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +5 -4
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +5 -4
  11. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +27 -21
  12. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +10 -3
  13. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +2 -2
  14. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +179 -35
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +2 -9
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +14 -4
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +14 -7
  19. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatContextAttachments.js +0 -5
  20. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.js +37 -9
  21. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +6 -2
  22. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
  23. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +253 -67
  24. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +16 -0
  25. package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +2 -2
  26. package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.js +59 -18
  27. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +51 -20
  28. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +28 -49
  30. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +130 -0
  31. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +10 -2
  32. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +2 -2
  33. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +0 -258
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-chat-service-override",
3
- "version": "8.0.3",
3
+ "version": "9.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@8.0.3"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@9.0.0"
30
30
  }
31
31
  }
@@ -28,93 +28,93 @@ function getAccessibilityHelpText(type) {
28
28
  const content = [];
29
29
  if (type === 'panelChat') {
30
30
  content.push(( localize(
31
- 7087,
31
+ 7042,
32
32
  'The chat view is comprised of an input box and a request/response list. The input box is used to make requests and the list is used to display responses.'
33
33
  )));
34
34
  content.push(( localize(
35
- 7088,
35
+ 7043,
36
36
  'In the input box, use up and down arrows to navigate your request history. Edit input and use enter or the submit button to run a new request.'
37
37
  )));
38
38
  content.push(( localize(
39
- 7089,
39
+ 7044,
40
40
  'In the input box, inspect the last response in the accessible view{0}.',
41
41
  '<keybinding:editor.action.accessibleView>'
42
42
  )));
43
43
  content.push(( localize(
44
- 7090,
44
+ 7045,
45
45
  'In the input box, navigate to the suggested follow up question (Shift+Tab) and press Enter to run it.'
46
46
  )));
47
47
  content.push(( localize(
48
- 7091,
48
+ 7046,
49
49
  'Chat responses will be announced as they come in. A response will indicate the number of code blocks, if any, and then the rest of the response.'
50
50
  )));
51
51
  content.push(( localize(
52
- 7092,
52
+ 7047,
53
53
  'To focus the chat request/response list, which can be navigated with up and down arrows, invoke the Focus Chat command{0}.',
54
54
  '<keybinding:chat.action.focus>'
55
55
  )));
56
56
  content.push(( localize(
57
- 7093,
57
+ 7048,
58
58
  'To focus the input box for chat requests, invoke the Focus Chat Input command{0}.',
59
59
  '<keybinding:workbench.action.chat.focusInput>'
60
60
  )));
61
61
  content.push(( localize(
62
- 7094,
62
+ 7049,
63
63
  'To focus the next code block within a response, invoke the Chat: Next Code Block command{0}.',
64
64
  '<keybinding:workbench.action.chat.nextCodeBlock>'
65
65
  )));
66
66
  content.push(( localize(
67
- 7095,
67
+ 7050,
68
68
  'To focus the next file tree within a response, invoke the Chat: Next File Tree command{0}.',
69
69
  '<keybinding:workbench.action.chat.nextFileTree>'
70
70
  )));
71
71
  content.push(( localize(
72
- 7096,
73
- 'To clear the request/response list, invoke the Chat Clear command{0}.',
74
- '<keybinding:workbench.action.chat.clear>'
72
+ 7051,
73
+ 'To create a new chat session, invoke the New Chat command{0}.',
74
+ '<keybinding:workbench.action.chat.new>'
75
75
  )));
76
76
  }
77
77
  else {
78
78
  content.push(( localize(
79
- 7097,
79
+ 7052,
80
80
  "Inline chat occurs within a code editor and takes into account the current selection. It is useful for making changes to the current editor. For example, fixing diagnostics, documenting or refactoring code. Keep in mind that AI generated code may be incorrect."
81
81
  )));
82
82
  content.push(( localize(
83
- 7098,
83
+ 7053,
84
84
  "It can be activated via code actions or directly using the command: Inline Chat: Start Inline Chat{0}.",
85
85
  '<keybinding:inlineChat.start>'
86
86
  )));
87
87
  content.push(( localize(
88
- 7099,
89
- 'In the input box, use{0} and{1} to navigate your request history. Edit input and use enter or the submit button to run a new request.',
90
- '<keybinding:inlineChat.previousFromHistory>',
91
- '<keybinding:inlineChat.nextFromHistory>'
88
+ 7054,
89
+ 'In the input box, use Show Previous{0} and Show Next{1} to navigate your request history. Edit input and use enter or the submit button to run a new request.',
90
+ '<keybinding:history.showPrevious>',
91
+ '<keybinding:history.showNext>'
92
92
  )));
93
93
  content.push(( localize(
94
- 7100,
94
+ 7055,
95
95
  'In the input box, inspect the response in the accessible view{0}.',
96
96
  '<keybinding:editor.action.accessibleView>'
97
97
  )));
98
98
  content.push(( localize(
99
- 7101,
99
+ 7056,
100
100
  "Context menu actions may run a request prefixed with a /. Type / to discover such ready-made commands."
101
101
  )));
102
102
  content.push(( localize(
103
- 7102,
103
+ 7057,
104
104
  "If a fix action is invoked, a response will indicate the problem with the current code. A diff editor will be rendered and can be reached by tabbing."
105
105
  )));
106
106
  content.push(( localize(
107
- 7103,
107
+ 7058,
108
108
  "Once in the diff editor, enter review mode with{0}. Use up and down arrows to navigate lines with the proposed changes.",
109
109
  AccessibleDiffViewerNext.id
110
110
  )));
111
111
  content.push(( localize(
112
- 7104,
112
+ 7059,
113
113
  "Use tab to reach conditional parts like commands, status, message responses and more."
114
114
  )));
115
115
  }
116
116
  content.push(( localize(
117
- 7105,
117
+ 7060,
118
118
  "Accessibility Signals can be changed via settings with a prefix of signals.chat. By default, if a request takes more than 4 seconds, you will hear a sound indicating that progress is still occurring."
119
119
  )));
120
120
  return content.join('\n');
@@ -21,7 +21,7 @@ function registerNewChatActions() {
21
21
  constructor() {
22
22
  super({
23
23
  id: 'workbench.action.chatEditor.newChat',
24
- title: ( localize2(7106, "New Chat")),
24
+ title: ( localize2(7061, "New Chat")),
25
25
  icon: Codicon.plus,
26
26
  f1: false,
27
27
  precondition: CONTEXT_CHAT_ENABLED,
@@ -42,7 +42,7 @@ function registerNewChatActions() {
42
42
  constructor() {
43
43
  super({
44
44
  id: ACTION_ID_NEW_CHAT,
45
- title: ( localize2(7106, "New Chat")),
45
+ title: ( localize2(7061, "New Chat")),
46
46
  category: CHAT_CATEGORY,
47
47
  icon: Codicon.plus,
48
48
  precondition: CONTEXT_CHAT_ENABLED,
@@ -1,6 +1,7 @@
1
1
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
2
2
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
3
3
  import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
4
+ import { isEqual } from 'vscode/vscode/vs/base/common/resources';
4
5
  import { isDiffEditor, isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
5
6
  import { ResourceTextEdit, IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
6
7
  import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
@@ -35,6 +36,9 @@ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/commo
35
36
  import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
36
37
  import { splitLines } from 'vscode/vscode/vs/base/common/strings';
37
38
  import { CharCode } from 'vscode/vscode/vs/base/common/charCode';
39
+ import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
40
+ import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
41
+ import { AsyncIterableObject } from 'vscode/vscode/vs/base/common/async';
38
42
  import Severity$1 from 'vscode/vscode/vs/base/common/severity';
39
43
 
40
44
  function isCodeBlockActionContext(thing) {
@@ -107,29 +111,70 @@ class InsertCodeBlockAction extends ChatCodeBlockAction {
107
111
  }
108
112
  }
109
113
  const languageService = accessor.get(ILanguageService);
114
+ const chatService = accessor.get(IChatService);
110
115
  const focusRange = notebookEditor.getFocus();
111
116
  const next = Math.max(focusRange.end - 1, 0);
112
117
  insertCell(languageService, notebookEditor, next, CellKind.Code, 'below', context.code, true);
113
- this.notifyUserAction(accessor, context);
118
+ this.notifyUserAction(chatService, context);
114
119
  }
115
120
  async computeEdits(accessor, codeEditor, codeBlockActionContext) {
116
121
  const activeModel = codeEditor.getModel();
117
122
  const range = codeEditor.getSelection() ?? ( (new Range(activeModel.getLineCount(), 1, activeModel.getLineCount(), 1)));
118
123
  const text = reindent(codeBlockActionContext.code, activeModel, range.startLineNumber);
119
- return [( (new ResourceTextEdit(activeModel.uri, { range, text })))];
124
+ return { edits: [( (new ResourceTextEdit(activeModel.uri, { range, text })))] };
125
+ }
126
+ get showPreview() {
127
+ return false;
120
128
  }
121
129
  async handleTextEditor(accessor, codeEditor, codeBlockActionContext) {
122
130
  const bulkEditService = accessor.get(IBulkEditService);
123
131
  const codeEditorService = accessor.get(ICodeEditorService);
124
- this.notifyUserAction(accessor, codeBlockActionContext);
125
- const activeModel = codeEditor.getModel();
126
- const mappedEdits = await this.computeEdits(accessor, codeEditor, codeBlockActionContext);
127
- await bulkEditService.apply(mappedEdits);
128
- codeEditorService.listCodeEditors().find(editor => editor.getModel()?.uri.toString() === ( (activeModel.uri.toString())))?.focus();
132
+ const chatService = accessor.get(IChatService);
133
+ const result = await this.computeEdits(accessor, codeEditor, codeBlockActionContext);
134
+ this.notifyUserAction(chatService, codeBlockActionContext, result);
135
+ if (this.showPreview) {
136
+ const showWithPreview = await this.applyWithInlinePreview(codeEditorService, result.edits, codeEditor);
137
+ if (!showWithPreview) {
138
+ await bulkEditService.apply(result.edits, { showPreview: true });
139
+ const activeModel = codeEditor.getModel();
140
+ codeEditorService.listCodeEditors().find(editor => editor.getModel()?.uri.toString() === ( (activeModel.uri.toString())))?.focus();
141
+ }
142
+ }
143
+ else {
144
+ await bulkEditService.apply(result.edits);
145
+ const activeModel = codeEditor.getModel();
146
+ codeEditorService.listCodeEditors().find(editor => editor.getModel()?.uri.toString() === ( (activeModel.uri.toString())))?.focus();
147
+ }
129
148
  }
130
- notifyUserAction(accessor, context) {
149
+ async applyWithInlinePreview(codeEditorService, edits, codeEditor) {
150
+ const firstEdit = edits[0];
151
+ if (!ResourceTextEdit.is(firstEdit)) {
152
+ return false;
153
+ }
154
+ const resource = firstEdit.resource;
155
+ const textEdits = coalesce(( (edits.map(
156
+ edit => ResourceTextEdit.is(edit) && isEqual(resource, edit.resource) ? edit.textEdit : undefined
157
+ ))));
158
+ if (textEdits.length !== edits.length) {
159
+ return false;
160
+ }
161
+ const editorToApply = await codeEditorService.openCodeEditor({ resource }, codeEditor);
162
+ if (editorToApply) {
163
+ const inlineChatController = InlineChatController.get(editorToApply);
164
+ if (inlineChatController) {
165
+ const cancellationTokenSource = ( (new CancellationTokenSource()));
166
+ try {
167
+ return await inlineChatController.reviewEdits(textEdits[0].range, AsyncIterableObject.fromArray(textEdits), cancellationTokenSource.token);
168
+ }
169
+ finally {
170
+ cancellationTokenSource.dispose();
171
+ }
172
+ }
173
+ }
174
+ return false;
175
+ }
176
+ notifyUserAction(chatService, context, result) {
131
177
  if (isResponseVM(context.element)) {
132
- const chatService = accessor.get(IChatService);
133
178
  chatService.notifyUserAction({
134
179
  agentId: context.element.agent?.id,
135
180
  command: context.element.slashCommand?.name,
@@ -140,6 +185,8 @@ class InsertCodeBlockAction extends ChatCodeBlockAction {
140
185
  kind: 'insert',
141
186
  codeBlockIndex: context.codeBlockIndex,
142
187
  totalCharacters: context.code.length,
188
+ userAction: this.desc.id,
189
+ codeMapper: result?.codeMapper,
143
190
  }
144
191
  });
145
192
  }
@@ -204,7 +251,7 @@ function registerChatCodeBlockActions() {
204
251
  constructor() {
205
252
  super({
206
253
  id: 'workbench.action.chat.copyCodeBlock',
207
- title: ( localize2(7107, "Copy")),
254
+ title: ( localize2(7062, "Copy")),
208
255
  f1: false,
209
256
  category: CHAT_CATEGORY,
210
257
  icon: Codicon.copy,
@@ -289,7 +336,7 @@ function registerChatCodeBlockActions() {
289
336
  constructor() {
290
337
  super({
291
338
  id: 'workbench.action.chat.applyInEditor',
292
- title: ( localize2(7108, "Apply in Editor")),
339
+ title: ( localize2(7063, "Apply in Editor")),
293
340
  precondition: CONTEXT_CHAT_ENABLED,
294
341
  f1: true,
295
342
  category: CHAT_CATEGORY,
@@ -338,10 +385,10 @@ function registerChatCodeBlockActions() {
338
385
  try {
339
386
  const edits = await progressService.withProgress({ location: ProgressLocation.Notification, delay: 500, sticky: true, cancellable: true }, async (progress) => {
340
387
  for (const provider of mappedEditsProviders) {
341
- progress.report({ message: ( localize(7109, "Applying code block using {0}...", provider.displayName)) });
388
+ progress.report({ message: ( localize(7064, "Applying code block using {0}...", provider.displayName)) });
342
389
  const mappedEdits = await provider.provideMappedEdits(activeModel, [codeBlockActionContext.code], { documents: docRefs }, cancellationTokenSource.token);
343
390
  if (mappedEdits) {
344
- return mappedEdits;
391
+ return { edits: mappedEdits.edits, codeMapper: provider.displayName };
345
392
  }
346
393
  }
347
394
  return undefined;
@@ -351,7 +398,7 @@ function registerChatCodeBlockActions() {
351
398
  }
352
399
  }
353
400
  catch (e) {
354
- notificationService.notify({ severity: Severity$1.Error, message: ( localize(7110, "Failed to apply code block: {0}", e.message)) });
401
+ notificationService.notify({ severity: Severity$1.Error, message: ( localize(7065, "Failed to apply code block: {0}", e.message)) });
355
402
  }
356
403
  finally {
357
404
  cancellationTokenSource.dispose();
@@ -359,12 +406,15 @@ function registerChatCodeBlockActions() {
359
406
  }
360
407
  return super.computeEdits(accessor, codeEditor, codeBlockActionContext);
361
408
  }
409
+ get showPreview() {
410
+ return true;
411
+ }
362
412
  });
363
413
  registerAction2(class SmartApplyInEditorAction extends InsertCodeBlockAction {
364
414
  constructor() {
365
415
  super({
366
416
  id: 'workbench.action.chat.insertCodeBlock',
367
- title: ( localize2(7111, "Insert At Cursor")),
417
+ title: ( localize2(7066, "Insert At Cursor")),
368
418
  precondition: CONTEXT_CHAT_ENABLED,
369
419
  f1: true,
370
420
  category: CHAT_CATEGORY,
@@ -391,7 +441,7 @@ function registerChatCodeBlockActions() {
391
441
  constructor() {
392
442
  super({
393
443
  id: 'workbench.action.chat.insertIntoNewFile',
394
- title: ( localize2(7112, "Insert into New File")),
444
+ title: ( localize2(7067, "Insert into New File")),
395
445
  precondition: CONTEXT_CHAT_ENABLED,
396
446
  f1: true,
397
447
  category: CHAT_CATEGORY,
@@ -422,7 +472,8 @@ function registerChatCodeBlockActions() {
422
472
  kind: 'insert',
423
473
  codeBlockIndex: context.codeBlockIndex,
424
474
  totalCharacters: context.code.length,
425
- newFile: true
475
+ newFile: true,
476
+ userAction: this.desc.id,
426
477
  }
427
478
  });
428
479
  }
@@ -441,7 +492,7 @@ function registerChatCodeBlockActions() {
441
492
  constructor() {
442
493
  super({
443
494
  id: 'workbench.action.chat.runInTerminal',
444
- title: ( localize2(7113, "Insert into Terminal")),
495
+ title: ( localize2(7068, "Insert into Terminal")),
445
496
  precondition: CONTEXT_CHAT_ENABLED,
446
497
  f1: true,
447
498
  category: CHAT_CATEGORY,
@@ -541,7 +592,7 @@ function registerChatCodeBlockActions() {
541
592
  constructor() {
542
593
  super({
543
594
  id: 'workbench.action.chat.nextCodeBlock',
544
- title: ( localize2(7114, "Next Code Block")),
595
+ title: ( localize2(7069, "Next Code Block")),
545
596
  keybinding: {
546
597
  primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.PageDown,
547
598
  mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.PageDown, },
@@ -561,7 +612,7 @@ function registerChatCodeBlockActions() {
561
612
  constructor() {
562
613
  super({
563
614
  id: 'workbench.action.chat.previousCodeBlock',
564
- title: ( localize2(7115, "Previous Code Block")),
615
+ title: ( localize2(7070, "Previous Code Block")),
565
616
  keybinding: {
566
617
  primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.PageUp,
567
618
  mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.PageUp, },
@@ -617,7 +668,7 @@ function registerChatCodeCompareBlockActions() {
617
668
  constructor() {
618
669
  super({
619
670
  id: 'workbench.action.chat.applyCompareEdits',
620
- title: ( localize2(7116, "Apply Edits")),
671
+ title: ( localize2(7071, "Apply Edits")),
621
672
  f1: false,
622
673
  category: CHAT_CATEGORY,
623
674
  icon: Codicon.check,
@@ -647,7 +698,7 @@ function registerChatCodeCompareBlockActions() {
647
698
  constructor() {
648
699
  super({
649
700
  id: 'workbench.action.chat.discardCompareEdits',
650
- title: ( localize2(7117, "Discard Edits")),
701
+ title: ( localize2(7072, "Discard Edits")),
651
702
  f1: false,
652
703
  category: CHAT_CATEGORY,
653
704
  icon: Codicon.trash,
@@ -14,11 +14,12 @@ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/cont
14
14
  import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
15
15
  import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
16
16
  import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
17
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
17
+ import { IChatWidgetService, IQuickChatService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
18
+ import { isQuickChat } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
18
19
  import { ChatContextAttachments } from '../contrib/chatContextAttachments.js';
19
20
  import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
20
21
  import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
21
- import { CONTEXT_CHAT_LOCATION, CONTEXT_IN_QUICK_CHAT, CONTEXT_IN_CHAT_INPUT } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
22
+ import { CONTEXT_CHAT_LOCATION, CONTEXT_IN_CHAT_INPUT } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
22
23
  import { ChatRequestAgentPart } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
23
24
  import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
24
25
  import { ILanguageModelToolsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
@@ -36,7 +37,7 @@ class AttachFileAction extends Action2 {
36
37
  constructor() {
37
38
  super({
38
39
  id: AttachFileAction.ID,
39
- title: ( localize2(7162, "Attach File")),
40
+ title: ( localize2(7073, "Attach File")),
40
41
  category: CHAT_CATEGORY,
41
42
  f1: false
42
43
  });
@@ -55,7 +56,7 @@ class AttachSelectionAction extends Action2 {
55
56
  constructor() {
56
57
  super({
57
58
  id: AttachSelectionAction.ID,
58
- title: ( localize2(7163, "Add Selection to Chat")),
59
+ title: ( localize2(7074, "Add Selection to Chat")),
59
60
  category: CHAT_CATEGORY,
60
61
  f1: false
61
62
  });
@@ -75,23 +76,25 @@ class AttachSelectionAction extends Action2 {
75
76
  }
76
77
  class AttachContextAction extends Action2 {
77
78
  static { this.ID = 'workbench.action.chat.attachContext'; }
78
- static { this._cdt = ( (ContextKeyExpr.or( (ContextKeyExpr.and(
79
- (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Panel)),
80
- (CONTEXT_IN_QUICK_CHAT.isEqualTo(false))
81
- )), (ContextKeyExpr.and(
82
- (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Editor)),
83
- (ContextKeyExpr.equals('config.chat.experimental.variables.editor', true))
84
- )), (ContextKeyExpr.and(
85
- (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Notebook)),
86
- (ContextKeyExpr.equals('config.chat.experimental.variables.notebook', true))
87
- )), (ContextKeyExpr.and(
88
- (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Terminal)),
89
- (ContextKeyExpr.equals('config.chat.experimental.variables.terminal', true))
90
- ))))); }
79
+ static { this._cdt = ( (ContextKeyExpr.or(
80
+ (ContextKeyExpr.and( (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Panel)))),
81
+ (ContextKeyExpr.and(
82
+ (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Editor)),
83
+ (ContextKeyExpr.equals('config.chat.experimental.variables.editor', true))
84
+ )),
85
+ (ContextKeyExpr.and(
86
+ (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Notebook)),
87
+ (ContextKeyExpr.equals('config.chat.experimental.variables.notebook', true))
88
+ )),
89
+ (ContextKeyExpr.and(
90
+ (CONTEXT_CHAT_LOCATION.isEqualTo(ChatAgentLocation.Terminal)),
91
+ (ContextKeyExpr.equals('config.chat.experimental.variables.terminal', true))
92
+ ))
93
+ ))); }
91
94
  constructor() {
92
95
  super({
93
96
  id: AttachContextAction.ID,
94
- title: ( localize2(7164, "Attach Context")),
97
+ title: ( localize2(7075, "Attach Context")),
95
98
  icon: Codicon.attach,
96
99
  category: CHAT_CATEGORY,
97
100
  precondition: AttachContextAction._cdt,
@@ -172,6 +175,7 @@ class AttachContextAction extends Action2 {
172
175
  name: pick.label,
173
176
  fullName: pick.label,
174
177
  value: undefined,
178
+ icon: pick.icon,
175
179
  isTool: true
176
180
  });
177
181
  }
@@ -196,6 +200,7 @@ class AttachContextAction extends Action2 {
196
200
  const commandService = accessor.get(ICommandService);
197
201
  const widgetService = accessor.get(IChatWidgetService);
198
202
  const languageModelToolsService = accessor.get(ILanguageModelToolsService);
203
+ const quickChatService = accessor.get(IQuickChatService);
199
204
  const context = args[0];
200
205
  const widget = context?.widget ?? widgetService.lastFocusedWidget;
201
206
  if (!widget) {
@@ -235,24 +240,27 @@ class AttachContextAction extends Action2 {
235
240
  }
236
241
  }
237
242
  }
238
- for (const tool of languageModelToolsService.getTools()) {
239
- if (tool.canBeInvokedManually) {
240
- const item = {
241
- kind: 'tool',
242
- label: tool.displayName ?? tool.name,
243
- id: tool.name,
244
- };
245
- if (ThemeIcon.isThemeIcon(tool.icon)) {
246
- item.iconClass = ThemeIcon.asClassName(tool.icon);
247
- }
248
- else if (tool.icon) {
249
- item.iconPath = tool.icon;
243
+ if (!usedAgent || usedAgent.agent.supportsToolReferences) {
244
+ for (const tool of languageModelToolsService.getTools()) {
245
+ if (tool.canBeInvokedManually) {
246
+ const item = {
247
+ kind: 'tool',
248
+ label: tool.displayName ?? tool.name ?? '',
249
+ id: tool.id,
250
+ icon: ThemeIcon.isThemeIcon(tool.icon) ? tool.icon : undefined
251
+ };
252
+ if (ThemeIcon.isThemeIcon(tool.icon)) {
253
+ item.iconClass = ThemeIcon.asClassName(tool.icon);
254
+ }
255
+ else if (tool.icon) {
256
+ item.iconPath = tool.icon;
257
+ }
258
+ quickPickItems.push(item);
250
259
  }
251
- quickPickItems.push(item);
252
260
  }
253
261
  }
254
262
  quickPickItems.push({
255
- label: ( localize(7165, 'Symbol...')),
263
+ label: ( localize(7076, 'Symbol...')),
256
264
  icon: ThemeIcon.fromId(Codicon.symbolField.id),
257
265
  iconClass: ThemeIcon.asClassName(Codicon.symbolField),
258
266
  prefix: SymbolsQuickAccessProvider.PREFIX
@@ -264,27 +272,30 @@ class AttachContextAction extends Action2 {
264
272
  const match = label.match(/\$\([^\)]+\)\s*(.+)/);
265
273
  return match ? match[1] : label;
266
274
  }
267
- this._show(quickInputService, commandService, widget, quickPickItems.sort(function (a, b) {
275
+ this._show(quickInputService, commandService, widget, quickChatService, quickPickItems.sort(function (a, b) {
268
276
  const first = extractTextFromIconLabel(a.label).toUpperCase();
269
277
  const second = extractTextFromIconLabel(b.label).toUpperCase();
270
278
  return compare(first, second);
271
279
  }));
272
280
  }
273
- _show(quickInputService, commandService, widget, quickPickItems, query = '') {
281
+ _show(quickInputService, commandService, widget, quickChatService, quickPickItems, query = '') {
274
282
  quickInputService.quickAccess.show(query, {
275
283
  enabledProviderPrefixes: [
276
284
  AnythingQuickAccessProvider.PREFIX,
277
285
  SymbolsQuickAccessProvider.PREFIX,
278
286
  AbstractGotoSymbolQuickAccessProvider.PREFIX
279
287
  ],
280
- placeholder: ( localize(7166, 'Search attachments')),
288
+ placeholder: ( localize(7077, 'Search attachments')),
281
289
  providerOptions: {
282
290
  handleAccept: (item) => {
283
291
  if ('prefix' in item) {
284
- this._show(quickInputService, commandService, widget, quickPickItems, item.prefix);
292
+ this._show(quickInputService, commandService, widget, quickChatService, quickPickItems, item.prefix);
285
293
  }
286
294
  else {
287
295
  this._attachContext(widget, commandService, item);
296
+ if (isQuickChat(widget)) {
297
+ quickChatService.open();
298
+ }
288
299
  }
289
300
  },
290
301
  additionPicks: quickPickItems,
@@ -11,7 +11,7 @@ function registerChatCopyActions() {
11
11
  constructor() {
12
12
  super({
13
13
  id: 'workbench.action.chat.copyAll',
14
- title: ( localize2(7118, "Copy All")),
14
+ title: ( localize2(7078, "Copy All")),
15
15
  f1: false,
16
16
  category: CHAT_CATEGORY,
17
17
  menu: {
@@ -41,7 +41,7 @@ function registerChatCopyActions() {
41
41
  constructor() {
42
42
  super({
43
43
  id: 'workbench.action.chat.copyItem',
44
- title: ( localize2(7119, "Copy")),
44
+ title: ( localize2(7079, "Copy")),
45
45
  f1: false,
46
46
  category: CHAT_CATEGORY,
47
47
  menu: {
@@ -12,7 +12,7 @@ class LogChatInputHistoryAction extends Action2 {
12
12
  constructor() {
13
13
  super({
14
14
  id: LogChatInputHistoryAction.ID,
15
- title: ( localize2(7167, "Log Chat Input History")),
15
+ title: ( localize2(7080, "Log Chat Input History")),
16
16
  icon: Codicon.attach,
17
17
  category: Categories.Developer,
18
18
  f1: true
@@ -12,7 +12,7 @@ function registerChatFileTreeActions() {
12
12
  constructor() {
13
13
  super({
14
14
  id: 'workbench.action.chat.nextFileTree',
15
- title: ( localize2(7124, "Next File Tree")),
15
+ title: ( localize2(7085, "Next File Tree")),
16
16
  keybinding: {
17
17
  primary: KeyMod.CtrlCmd | KeyCode.F9,
18
18
  weight: KeybindingWeight.WorkbenchContrib,
@@ -31,7 +31,7 @@ function registerChatFileTreeActions() {
31
31
  constructor() {
32
32
  super({
33
33
  id: 'workbench.action.chat.previousFileTree',
34
- title: ( localize2(7125, "Previous File Tree")),
34
+ title: ( localize2(7086, "Previous File Tree")),
35
35
  keybinding: {
36
36
  primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F9,
37
37
  weight: KeybindingWeight.WorkbenchContrib,
@@ -13,14 +13,14 @@ import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/cha
13
13
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
14
14
 
15
15
  const defaultFileName = 'chat.json';
16
- const filters = [{ name: ( localize(7126, "Chat Session")), extensions: ['json'] }];
16
+ const filters = [{ name: ( localize(7087, "Chat Session")), extensions: ['json'] }];
17
17
  function registerChatExportActions() {
18
18
  registerAction2(class ExportChatAction extends Action2 {
19
19
  constructor() {
20
20
  super({
21
21
  id: 'workbench.action.chat.export',
22
22
  category: CHAT_CATEGORY,
23
- title: ( localize2(7127, "Export Chat...")),
23
+ title: ( localize2(7088, "Export Chat...")),
24
24
  precondition: CONTEXT_CHAT_ENABLED,
25
25
  f1: true,
26
26
  });
@@ -54,7 +54,7 @@ function registerChatExportActions() {
54
54
  constructor() {
55
55
  super({
56
56
  id: 'workbench.action.chat.import',
57
- title: ( localize2(7128, "Import Chat...")),
57
+ title: ( localize2(7089, "Import Chat...")),
58
58
  category: CHAT_CATEGORY,
59
59
  precondition: CONTEXT_CHAT_ENABLED,
60
60
  f1: true,
@@ -79,7 +79,8 @@ function registerChatExportActions() {
79
79
  if (!isExportableSessionData(data)) {
80
80
  throw ( (new Error('Invalid chat session data')));
81
81
  }
82
- await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { data }, pinned: true } });
82
+ const options = { target: { data }, pinned: true };
83
+ await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options });
83
84
  }
84
85
  catch (err) {
85
86
  throw err;