@codingame/monaco-vscode-chat-service-override 2.2.2 → 3.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 (24) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +2 -2
  3. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +45 -53
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +11 -17
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +11 -17
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +20 -27
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +29 -41
  8. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +25 -9
  9. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +10 -10
  10. package/vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js +10 -10
  11. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -4
  12. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +2 -2
  13. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +9 -26
  14. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +10 -1
  15. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatHistoryVariables.js +1 -1
  16. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +71 -112
  17. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +6 -1
  18. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +101 -73
  19. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +4 -4
  20. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +94 -24
  21. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +4 -4
  22. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +37 -24
  23. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl.js +4 -6
  24. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions2.js +0 -94
@@ -6,7 +6,6 @@ import { Range } from 'vscode/vscode/vs/editor/common/core/range';
6
6
  import { getWordAtText } from 'vscode/vscode/vs/editor/common/core/wordHelper';
7
7
  import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
8
8
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
9
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
10
9
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
11
10
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
12
11
  import { inputPlaceholderForeground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
@@ -19,12 +18,11 @@ import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat
19
18
  import { SelectAndInsertFileAction, dynamicVariableDecorationType } from 'vscode/vscode/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
20
19
  import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
21
20
  import { chatSlashCommandForeground, chatSlashCommandBackground } from '../../common/chatColors.js';
22
- import { chatVariableLeader, ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, ChatRequestTextPart, ChatRequestVariablePart, chatAgentLeader, chatSubcommandLeader } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
21
+ import { getHistoryEntriesFromModel } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
22
+ import { chatVariableLeader, ChatRequestVariablePart, ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, ChatRequestTextPart, chatAgentLeader, chatSubcommandLeader } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
23
23
  import { ChatRequestParser } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
24
- import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
25
24
  import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatSlashCommands';
26
25
  import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables';
27
- import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
28
26
 
29
27
  var BuiltinDynamicCompletions_1, VariableCompletions_1;
30
28
  const decorationDescription = 'chat';
@@ -32,16 +30,14 @@ const placeholderDecorationType = 'chat-session-detail';
32
30
  const slashCommandTextDecorationType = 'chat-session-text';
33
31
  const variableTextDecorationType = 'chat-variable-text';
34
32
  function agentAndCommandToKey(agent, subcommand) {
35
- return `${agent}__${subcommand}`;
33
+ return subcommand ? `${agent}__${subcommand}` : agent;
36
34
  }
37
35
  let InputEditorDecorations = class InputEditorDecorations extends Disposable {
38
- constructor(widget, instantiationService, codeEditorService, themeService, chatService, chatAgentService) {
36
+ constructor(widget, codeEditorService, themeService, chatAgentService) {
39
37
  super();
40
38
  this.widget = widget;
41
- this.instantiationService = instantiationService;
42
39
  this.codeEditorService = codeEditorService;
43
40
  this.themeService = themeService;
44
- this.chatService = chatService;
45
41
  this.chatAgentService = chatAgentService;
46
42
  this.id = 'inputEditorDecorations';
47
43
  this.previouslyUsedAgents = ( new Set());
@@ -56,10 +52,8 @@ let InputEditorDecorations = class InputEditorDecorations extends Disposable {
56
52
  this.previouslyUsedAgents.clear();
57
53
  this.updateInputEditorDecorations();
58
54
  }));
59
- this._register(this.chatService.onDidSubmitAgent((e) => {
60
- if (e.sessionId === this.widget.viewModel?.sessionId) {
61
- this.previouslyUsedAgents.add(agentAndCommandToKey(e.agent.id, e.slashCommand.name));
62
- }
55
+ this._register(this.widget.onDidSubmitAgent((e) => {
56
+ this.previouslyUsedAgents.add(agentAndCommandToKey(e.agent.id, e.slashCommand?.name));
63
57
  }));
64
58
  this._register(this.chatAgentService.onDidChangeAgents(() => this.updateInputEditorDecorations()));
65
59
  this.registerViewModelListeners();
@@ -126,7 +120,7 @@ let InputEditorDecorations = class InputEditorDecorations extends Disposable {
126
120
  this.widget.inputEditor.setDecorationsByType(decorationDescription, placeholderDecorationType, decoration);
127
121
  return;
128
122
  }
129
- const parsedRequest = (await this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(viewModel.sessionId, inputValue)).parts;
123
+ const parsedRequest = this.widget.parsedInput.parts;
130
124
  let placeholderDecoration;
131
125
  const agentPart = parsedRequest.find((p) => p instanceof ChatRequestAgentPart);
132
126
  const agentSubcommandPart = parsedRequest.find((p) => p instanceof ChatRequestAgentSubcommandPart);
@@ -139,19 +133,22 @@ let InputEditorDecorations = class InputEditorDecorations extends Disposable {
139
133
  const nextPart = parsedRequest[partIdx + 1];
140
134
  return nextPart && nextPart instanceof ChatRequestTextPart && nextPart.text === ' ';
141
135
  };
136
+ const getRangeForPlaceholder = (part) => ({
137
+ startLineNumber: part.editorRange.startLineNumber,
138
+ endLineNumber: part.editorRange.endLineNumber,
139
+ startColumn: part.editorRange.endColumn + 1,
140
+ endColumn: 1000
141
+ });
142
142
  const onlyAgentAndWhitespace = agentPart && parsedRequest.every(p => p instanceof ChatRequestTextPart && !p.text.trim().length || p instanceof ChatRequestAgentPart);
143
143
  if (onlyAgentAndWhitespace) {
144
+ const isFollowupSlashCommand = ( this.previouslyUsedAgents.has(agentAndCommandToKey(agentPart.agent.id, undefined)));
145
+ const shouldRenderFollowupPlaceholder = isFollowupSlashCommand && agentPart.agent.metadata.followupPlaceholder;
144
146
  if (agentPart.agent.metadata.description && exactlyOneSpaceAfterPart(agentPart)) {
145
147
  placeholderDecoration = [{
146
- range: {
147
- startLineNumber: agentPart.editorRange.startLineNumber,
148
- endLineNumber: agentPart.editorRange.endLineNumber,
149
- startColumn: agentPart.editorRange.endColumn + 1,
150
- endColumn: 1000
151
- },
148
+ range: getRangeForPlaceholder(agentPart),
152
149
  renderOptions: {
153
150
  after: {
154
- contentText: agentPart.agent.metadata.description,
151
+ contentText: shouldRenderFollowupPlaceholder ? agentPart.agent.metadata.followupPlaceholder : agentPart.agent.metadata.description,
155
152
  color: this.getPlaceholderColor(),
156
153
  }
157
154
  }
@@ -164,12 +161,7 @@ let InputEditorDecorations = class InputEditorDecorations extends Disposable {
164
161
  const shouldRenderFollowupPlaceholder = isFollowupSlashCommand && agentSubcommandPart.command.followupPlaceholder;
165
162
  if (agentSubcommandPart?.command.description && exactlyOneSpaceAfterPart(agentSubcommandPart)) {
166
163
  placeholderDecoration = [{
167
- range: {
168
- startLineNumber: agentSubcommandPart.editorRange.startLineNumber,
169
- endLineNumber: agentSubcommandPart.editorRange.endLineNumber,
170
- startColumn: agentSubcommandPart.editorRange.endColumn + 1,
171
- endColumn: 1000
172
- },
164
+ range: getRangeForPlaceholder(agentSubcommandPart),
173
165
  renderOptions: {
174
166
  after: {
175
167
  contentText: shouldRenderFollowupPlaceholder ? agentSubcommandPart.command.followupPlaceholder : agentSubcommandPart.command.description,
@@ -179,25 +171,6 @@ let InputEditorDecorations = class InputEditorDecorations extends Disposable {
179
171
  }];
180
172
  }
181
173
  }
182
- const onlySlashCommandAndWhitespace = slashCommandPart && parsedRequest.every(p => p instanceof ChatRequestTextPart && !p.text.trim().length || p instanceof ChatRequestSlashCommandPart);
183
- if (onlySlashCommandAndWhitespace) {
184
- if (slashCommandPart.slashCommand.detail && exactlyOneSpaceAfterPart(slashCommandPart)) {
185
- placeholderDecoration = [{
186
- range: {
187
- startLineNumber: slashCommandPart.editorRange.startLineNumber,
188
- endLineNumber: slashCommandPart.editorRange.endLineNumber,
189
- startColumn: slashCommandPart.editorRange.endColumn + 1,
190
- endColumn: 1000
191
- },
192
- renderOptions: {
193
- after: {
194
- contentText: slashCommandPart.slashCommand.detail,
195
- color: this.getPlaceholderColor(),
196
- }
197
- }
198
- }];
199
- }
200
- }
201
174
  this.widget.inputEditor.setDecorationsByType(decorationDescription, placeholderDecorationType, placeholderDecoration ?? []);
202
175
  const textDecorations = [];
203
176
  if (agentPart) {
@@ -219,43 +192,39 @@ let InputEditorDecorations = class InputEditorDecorations extends Disposable {
219
192
  }
220
193
  };
221
194
  InputEditorDecorations = ( __decorate([
222
- ( __param(1, IInstantiationService)),
223
- ( __param(2, ICodeEditorService)),
224
- ( __param(3, IThemeService)),
225
- ( __param(4, IChatService)),
226
- ( __param(5, IChatAgentService))
195
+ ( __param(1, ICodeEditorService)),
196
+ ( __param(2, IThemeService)),
197
+ ( __param(3, IChatAgentService))
227
198
  ], InputEditorDecorations));
228
- let InputEditorSlashCommandMode = class InputEditorSlashCommandMode extends Disposable {
229
- constructor(widget, chatService) {
199
+ class InputEditorSlashCommandMode extends Disposable {
200
+ constructor(widget) {
230
201
  super();
231
202
  this.widget = widget;
232
- this.chatService = chatService;
233
203
  this.id = 'InputEditorSlashCommandMode';
234
- this._register(this.chatService.onDidSubmitAgent(e => {
235
- if (this.widget.viewModel?.sessionId !== e.sessionId) {
236
- return;
237
- }
204
+ this._register(this.widget.onDidSubmitAgent(e => {
238
205
  this.repopulateAgentCommand(e.agent, e.slashCommand);
239
206
  }));
240
207
  }
241
208
  async repopulateAgentCommand(agent, slashCommand) {
242
- if (slashCommand.shouldRepopulate) {
243
- const value = `${chatAgentLeader}${agent.id} ${chatSubcommandLeader}${slashCommand.name} `;
209
+ let value;
210
+ if (slashCommand && slashCommand.isSticky) {
211
+ value = `${chatAgentLeader}${agent.id} ${chatSubcommandLeader}${slashCommand.name} `;
212
+ }
213
+ else if (agent.metadata.isSticky) {
214
+ value = `${chatAgentLeader}${agent.id} `;
215
+ }
216
+ if (value) {
244
217
  this.widget.inputEditor.setValue(value);
245
218
  this.widget.inputEditor.setPosition({ lineNumber: 1, column: value.length + 1 });
246
219
  }
247
220
  }
248
- };
249
- InputEditorSlashCommandMode = ( __decorate([
250
- ( __param(1, IChatService))
251
- ], InputEditorSlashCommandMode));
221
+ }
252
222
  ChatWidget.CONTRIBS.push(InputEditorDecorations, InputEditorSlashCommandMode);
253
223
  let SlashCommandCompletions = class SlashCommandCompletions extends Disposable {
254
- constructor(languageFeaturesService, chatWidgetService, instantiationService, chatSlashCommandService) {
224
+ constructor(languageFeaturesService, chatWidgetService, chatSlashCommandService) {
255
225
  super();
256
226
  this.languageFeaturesService = languageFeaturesService;
257
227
  this.chatWidgetService = chatWidgetService;
258
- this.instantiationService = instantiationService;
259
228
  this.chatSlashCommandService = chatSlashCommandService;
260
229
  this._register(this.languageFeaturesService.completionProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, hasAccessToAllModels: true }, {
261
230
  _debugDisplayName: 'globalSlashCommands',
@@ -269,7 +238,7 @@ let SlashCommandCompletions = class SlashCommandCompletions extends Disposable {
269
238
  if (!range) {
270
239
  return null;
271
240
  }
272
- const parsedRequest = (await this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue())).parts;
241
+ const parsedRequest = widget.parsedInput.parts;
273
242
  const usedAgent = parsedRequest.find(p => p instanceof ChatRequestAgentPart);
274
243
  if (usedAgent) {
275
244
  return;
@@ -299,17 +268,15 @@ let SlashCommandCompletions = class SlashCommandCompletions extends Disposable {
299
268
  SlashCommandCompletions = ( __decorate([
300
269
  ( __param(0, ILanguageFeaturesService)),
301
270
  ( __param(1, IChatWidgetService)),
302
- ( __param(2, IInstantiationService)),
303
- ( __param(3, IChatSlashCommandService))
271
+ ( __param(2, IChatSlashCommandService))
304
272
  ], SlashCommandCompletions));
305
273
  ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(SlashCommandCompletions, 4 );
306
274
  let AgentCompletions = class AgentCompletions extends Disposable {
307
- constructor(languageFeaturesService, chatWidgetService, chatAgentService, instantiationService) {
275
+ constructor(languageFeaturesService, chatWidgetService, chatAgentService) {
308
276
  super();
309
277
  this.languageFeaturesService = languageFeaturesService;
310
278
  this.chatWidgetService = chatWidgetService;
311
279
  this.chatAgentService = chatAgentService;
312
- this.instantiationService = instantiationService;
313
280
  this._register(this.languageFeaturesService.completionProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, hasAccessToAllModels: true }, {
314
281
  _debugDisplayName: 'chatAgent',
315
282
  triggerCharacters: ['@'],
@@ -318,7 +285,7 @@ let AgentCompletions = class AgentCompletions extends Disposable {
318
285
  if (!widget || !widget.viewModel) {
319
286
  return null;
320
287
  }
321
- const parsedRequest = (await this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue())).parts;
288
+ const parsedRequest = widget.parsedInput.parts;
322
289
  const usedAgent = parsedRequest.find(p => p instanceof ChatRequestAgentPart);
323
290
  if (usedAgent && !Range.containsPosition(usedAgent.editorRange, position)) {
324
291
  return;
@@ -336,7 +303,7 @@ let AgentCompletions = class AgentCompletions extends Disposable {
336
303
  label: withAt,
337
304
  insertText: `${withAt} `,
338
305
  detail: c.metadata.description,
339
- range,
306
+ range: ( new Range(1, 1, 1, 1)),
340
307
  kind: 18 ,
341
308
  };
342
309
  }))
@@ -355,7 +322,7 @@ let AgentCompletions = class AgentCompletions extends Disposable {
355
322
  if (!range) {
356
323
  return null;
357
324
  }
358
- const parsedRequest = (await this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue())).parts;
325
+ const parsedRequest = widget.parsedInput.parts;
359
326
  const usedAgentIdx = parsedRequest.findIndex((p) => p instanceof ChatRequestAgentPart);
360
327
  if (usedAgentIdx < 0) {
361
328
  return;
@@ -370,7 +337,7 @@ let AgentCompletions = class AgentCompletions extends Disposable {
370
337
  }
371
338
  }
372
339
  const usedAgent = parsedRequest[usedAgentIdx];
373
- const commands = await usedAgent.agent.provideSlashCommands(token);
340
+ const commands = await usedAgent.agent.provideSlashCommands(widget.viewModel.model, getHistoryEntriesFromModel(widget.viewModel.model), token);
374
341
  return {
375
342
  suggestions: ( commands.map((c, i) => {
376
343
  const withSlash = `/${c.name}`;
@@ -390,7 +357,8 @@ let AgentCompletions = class AgentCompletions extends Disposable {
390
357
  triggerCharacters: ['/'],
391
358
  provideCompletionItems: async (model, position, _context, token) => {
392
359
  const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
393
- if (!widget) {
360
+ const viewModel = widget?.viewModel;
361
+ if (!widget || !viewModel) {
394
362
  return;
395
363
  }
396
364
  const range = computeCompletionRanges(model, position, /\/\w*/g);
@@ -398,7 +366,9 @@ let AgentCompletions = class AgentCompletions extends Disposable {
398
366
  return null;
399
367
  }
400
368
  const agents = this.chatAgentService.getAgents();
401
- const all = ( agents.map(agent => agent.provideSlashCommands(token)));
369
+ const all = ( agents.map(
370
+ agent => agent.provideSlashCommands(viewModel.model, getHistoryEntriesFromModel(viewModel.model), token)
371
+ ));
402
372
  const commands = await raceCancellation(Promise.all(all), token);
403
373
  if (!commands) {
404
374
  return;
@@ -439,8 +409,7 @@ let AgentCompletions = class AgentCompletions extends Disposable {
439
409
  AgentCompletions = ( __decorate([
440
410
  ( __param(0, ILanguageFeaturesService)),
441
411
  ( __param(1, IChatWidgetService)),
442
- ( __param(2, IChatAgentService)),
443
- ( __param(3, IInstantiationService))
412
+ ( __param(2, IChatAgentService))
444
413
  ], AgentCompletions));
445
414
  ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(AgentCompletions, 4 );
446
415
  let BuiltinDynamicCompletions = class BuiltinDynamicCompletions extends Disposable {
@@ -523,12 +492,11 @@ function computeCompletionRanges(model, position, reg) {
523
492
  let VariableCompletions = class VariableCompletions extends Disposable {
524
493
  static { VariableCompletions_1 = this; }
525
494
  static { this.VariableNameDef = ( new RegExp(`${chatVariableLeader}\\w*`, 'g')); }
526
- constructor(languageFeaturesService, chatWidgetService, chatVariablesService, configurationService) {
495
+ constructor(languageFeaturesService, chatWidgetService, chatVariablesService) {
527
496
  super();
528
497
  this.languageFeaturesService = languageFeaturesService;
529
498
  this.chatWidgetService = chatWidgetService;
530
499
  this.chatVariablesService = chatVariablesService;
531
- this.configurationService = configurationService;
532
500
  this._register(this.languageFeaturesService.completionProvider.register({ scheme: ChatInputPart.INPUT_SCHEME, hasAccessToAllModels: true }, {
533
501
  _debugDisplayName: 'chatVariables',
534
502
  triggerCharacters: [chatVariableLeader],
@@ -541,17 +509,10 @@ let VariableCompletions = class VariableCompletions extends Disposable {
541
509
  if (!range) {
542
510
  return null;
543
511
  }
544
- const history = widget.viewModel.getItems()
545
- .filter(isResponseVM);
546
- const historyVariablesEnabled = this.configurationService.getValue('chat.experimental.historyVariables');
547
- const historyItems = historyVariablesEnabled ? ( history.map((h, i) => ({
548
- label: `${chatVariableLeader}response:${i + 1}`,
549
- detail: h.response.asString(),
550
- insertText: `${chatVariableLeader}response:${String(i + 1).padStart(String(history.length).length, '0')} `,
551
- kind: 18 ,
552
- range,
553
- }))) : [];
554
- const variableItems = ( Array.from(this.chatVariablesService.getVariables()).map(v => {
512
+ const usedVariables = widget.parsedInput.parts.filter((p) => p instanceof ChatRequestVariablePart);
513
+ const variableItems = ( Array.from(this.chatVariablesService.getVariables())
514
+ .filter(v => !( usedVariables.some(usedVar => usedVar.variableName === v.name)))
515
+ .map(v => {
555
516
  const withLeader = `${chatVariableLeader}${v.name}`;
556
517
  return {
557
518
  label: withLeader,
@@ -563,7 +524,7 @@ let VariableCompletions = class VariableCompletions extends Disposable {
563
524
  };
564
525
  }));
565
526
  return {
566
- suggestions: [...variableItems, ...historyItems]
527
+ suggestions: variableItems
567
528
  };
568
529
  }
569
530
  }));
@@ -572,8 +533,7 @@ let VariableCompletions = class VariableCompletions extends Disposable {
572
533
  VariableCompletions = VariableCompletions_1 = ( __decorate([
573
534
  ( __param(0, ILanguageFeaturesService)),
574
535
  ( __param(1, IChatWidgetService)),
575
- ( __param(2, IChatVariablesService)),
576
- ( __param(3, IConfigurationService))
536
+ ( __param(2, IChatVariablesService))
577
537
  ], VariableCompletions));
578
538
  ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(VariableCompletions, 4 );
579
539
  let ChatTokenDeleter = class ChatTokenDeleter extends Disposable {
@@ -591,24 +551,23 @@ let ChatTokenDeleter = class ChatTokenDeleter extends Disposable {
591
551
  }
592
552
  const change = e.changes[0];
593
553
  if (!change.text && this.widget.viewModel) {
594
- parser.parseChatRequest(this.widget.viewModel.sessionId, previousInputValue).then(previousParsedValue => {
595
- const deletableTokens = previousParsedValue.parts.filter(p => p instanceof ChatRequestAgentPart || p instanceof ChatRequestAgentSubcommandPart || p instanceof ChatRequestSlashCommandPart || p instanceof ChatRequestVariablePart);
596
- deletableTokens.forEach(token => {
597
- const deletedRangeOfToken = Range.intersectRanges(token.editorRange, change.range);
598
- if ((deletedRangeOfToken && !deletedRangeOfToken.isEmpty()) && Range.compareRangesUsingStarts(token.editorRange, change.range) < 0) {
599
- const length = deletedRangeOfToken.endColumn - deletedRangeOfToken.startColumn;
600
- const rangeToDelete = ( new Range(
601
- token.editorRange.startLineNumber,
602
- token.editorRange.startColumn,
603
- token.editorRange.endLineNumber,
604
- token.editorRange.endColumn - length
605
- ));
606
- this.widget.inputEditor.executeEdits(this.id, [{
607
- range: rangeToDelete,
608
- text: '',
609
- }]);
610
- }
611
- });
554
+ const previousParsedValue = parser.parseChatRequest(this.widget.viewModel.sessionId, previousInputValue);
555
+ const deletableTokens = previousParsedValue.parts.filter(p => p instanceof ChatRequestAgentPart || p instanceof ChatRequestAgentSubcommandPart || p instanceof ChatRequestSlashCommandPart || p instanceof ChatRequestVariablePart);
556
+ deletableTokens.forEach(token => {
557
+ const deletedRangeOfToken = Range.intersectRanges(token.editorRange, change.range);
558
+ if (deletedRangeOfToken && Range.compareRangesUsingStarts(token.editorRange, change.range) < 0) {
559
+ const length = deletedRangeOfToken.endColumn - deletedRangeOfToken.startColumn;
560
+ const rangeToDelete = ( new Range(
561
+ token.editorRange.startLineNumber,
562
+ token.editorRange.startColumn,
563
+ token.editorRange.endLineNumber,
564
+ token.editorRange.endColumn - length
565
+ ));
566
+ this.widget.inputEditor.executeEdits(this.id, [{
567
+ range: rangeToDelete,
568
+ text: '',
569
+ }]);
570
+ }
612
571
  });
613
572
  }
614
573
  previousInputValue = this.widget.inputEditor.getValue();
@@ -1,12 +1,17 @@
1
1
  import { Color, RGBA } from 'vscode/vscode/vs/base/common/color';
2
2
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { registerColor, contrastBorder, badgeBackground, badgeForeground, foreground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
3
+ import { registerColor, contrastBorder, transparent, editorBackground, editorWidgetBackground, badgeBackground, badgeForeground, foreground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
4
4
 
5
5
  registerColor('chat.requestBorder', { dark: ( new Color(( new RGBA(255, 255, 255, 0.10)))), light: ( new Color(( new RGBA(0, 0, 0, 0.10)))), hcDark: contrastBorder, hcLight: contrastBorder, }, ( localizeWithPath(
6
6
  'vs/workbench/contrib/chat/common/chatColors',
7
7
  'chat.requestBorder',
8
8
  'The border color of a chat request.'
9
9
  )));
10
+ registerColor('chat.requestBackground', { dark: ( transparent(editorBackground, 0.62)), light: ( transparent(editorBackground, 0.62)), hcDark: editorWidgetBackground, hcLight: null }, ( localizeWithPath(
11
+ 'vs/workbench/contrib/chat/common/chatColors',
12
+ 'chat.requestBackground',
13
+ 'The background color of a chat request.'
14
+ )));
10
15
  const chatSlashCommandBackground = registerColor('chat.slashCommandBackground', { dark: '#34414B', light: '#D2ECFF', hcDark: Color.white, hcLight: badgeBackground }, ( localizeWithPath(
11
16
  'vs/workbench/contrib/chat/common/chatColors',
12
17
  'chat.slashCommandBackground',