@codingame/monaco-vscode-chat-service-override 3.2.2 → 4.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.
@@ -1,10 +1,13 @@
1
1
  import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
2
3
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
3
- import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { DisposableStore, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
4
5
  import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
5
6
  import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
6
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
+ import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
8
  import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
9
+ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
10
+ import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
8
11
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
9
12
  import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
10
13
  import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
@@ -14,7 +17,9 @@ import { getNewChatAction } from './actions/chatClearActions.js';
14
17
  import { getMoveToEditorAction, getMoveToNewWindowAction } from './actions/chatMoveActions.js';
15
18
  import { getQuickChatActionForProvider } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
16
19
  import { ChatViewPane, CHAT_SIDEBAR_PANEL_ID } from './chatViewPane.js';
20
+ import { ChatAgentLocation, IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
17
21
  import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService';
22
+ import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
18
23
  import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
19
24
 
20
25
  const chatExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
@@ -73,14 +78,207 @@ const chatExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
73
78
  }
74
79
  },
75
80
  });
81
+ const chatParticipantExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
82
+ extensionPoint: 'chatParticipants',
83
+ jsonSchema: {
84
+ description: ( localizeWithPath(
85
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
86
+ 'vscode.extension.contributes.chatParticipant',
87
+ 'Contributes a chat participant'
88
+ )),
89
+ type: 'array',
90
+ items: {
91
+ additionalProperties: false,
92
+ type: 'object',
93
+ defaultSnippets: [{ body: { name: '', description: '' } }],
94
+ required: ['name', 'id'],
95
+ properties: {
96
+ id: {
97
+ description: ( localizeWithPath(
98
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
99
+ 'chatParticipantId',
100
+ "A unique id for this chat participant."
101
+ )),
102
+ type: 'string'
103
+ },
104
+ name: {
105
+ description: ( localizeWithPath(
106
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
107
+ 'chatParticipantName',
108
+ "User-facing display name for this chat participant. The user will use '@' with this name to invoke the participant."
109
+ )),
110
+ type: 'string'
111
+ },
112
+ description: {
113
+ description: ( localizeWithPath(
114
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
115
+ 'chatParticipantDescription',
116
+ "A description of this chat participant, shown in the UI."
117
+ )),
118
+ type: 'string'
119
+ },
120
+ isDefault: {
121
+ markdownDescription: ( localizeWithPath(
122
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
123
+ 'chatParticipantIsDefaultDescription',
124
+ "**Only** allowed for extensions that have the `defaultChatParticipant` proposal."
125
+ )),
126
+ type: 'boolean',
127
+ },
128
+ isSticky: {
129
+ description: ( localizeWithPath(
130
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
131
+ 'chatCommandSticky',
132
+ "Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
133
+ )),
134
+ type: 'boolean'
135
+ },
136
+ defaultImplicitVariables: {
137
+ markdownDescription: '**Only** allowed for extensions that have the `chatParticipantAdditions` proposal. The names of the variables that are invoked by default',
138
+ type: 'array',
139
+ items: {
140
+ type: 'string'
141
+ }
142
+ },
143
+ commands: {
144
+ markdownDescription: ( localizeWithPath(
145
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
146
+ 'chatCommandsDescription',
147
+ "Commands available for this chat participant, which the user can invoke with a `/`."
148
+ )),
149
+ type: 'array',
150
+ items: {
151
+ additionalProperties: false,
152
+ type: 'object',
153
+ defaultSnippets: [{ body: { name: '', description: '' } }],
154
+ required: ['name'],
155
+ properties: {
156
+ name: {
157
+ description: ( localizeWithPath(
158
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
159
+ 'chatCommand',
160
+ "A short name by which this command is referred to in the UI, e.g. `fix` or * `explain` for commands that fix an issue or explain code. The name should be unique among the commands provided by this participant."
161
+ )),
162
+ type: 'string'
163
+ },
164
+ description: {
165
+ description: ( localizeWithPath(
166
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
167
+ 'chatCommandDescription',
168
+ "A description of this command."
169
+ )),
170
+ type: 'string'
171
+ },
172
+ when: {
173
+ description: ( localizeWithPath(
174
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
175
+ 'chatCommandWhen',
176
+ "A condition which must be true to enable this command."
177
+ )),
178
+ type: 'string'
179
+ },
180
+ sampleRequest: {
181
+ description: ( localizeWithPath(
182
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
183
+ 'chatCommandSampleRequest',
184
+ "When the user clicks this command in `/help`, this text will be submitted to this participant."
185
+ )),
186
+ type: 'string'
187
+ },
188
+ isSticky: {
189
+ description: ( localizeWithPath(
190
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
191
+ 'chatCommandSticky',
192
+ "Whether invoking the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message."
193
+ )),
194
+ type: 'boolean'
195
+ },
196
+ defaultImplicitVariables: {
197
+ markdownDescription: ( localizeWithPath(
198
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
199
+ 'defaultImplicitVariables',
200
+ "**Only** allowed for extensions that have the `chatParticipantAdditions` proposal. The names of the variables that are invoked by default"
201
+ )),
202
+ type: 'array',
203
+ items: {
204
+ type: 'string'
205
+ }
206
+ },
207
+ }
208
+ }
209
+ },
210
+ locations: {
211
+ markdownDescription: ( localizeWithPath(
212
+ 'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
213
+ 'chatLocationsDescription',
214
+ "Locations in which this chat participant is available."
215
+ )),
216
+ type: 'array',
217
+ default: ['panel'],
218
+ items: {
219
+ type: 'string',
220
+ enum: ['panel', 'terminal', 'notebook']
221
+ }
222
+ }
223
+ }
224
+ }
225
+ },
226
+ activationEventsGenerator: (contributions, result) => {
227
+ for (const contrib of contributions) {
228
+ result.push(`onChatParticipant:${contrib.id}`);
229
+ }
230
+ },
231
+ });
76
232
  let ChatExtensionPointHandler = class ChatExtensionPointHandler {
77
233
  static { this.ID = 'workbench.contrib.chatExtensionPointHandler'; }
78
- constructor(_chatContributionService) {
234
+ constructor(_chatContributionService, _chatAgentService, productService, contextService, logService) {
79
235
  this._chatContributionService = _chatContributionService;
236
+ this._chatAgentService = _chatAgentService;
237
+ this.productService = productService;
238
+ this.contextService = contextService;
239
+ this.logService = logService;
240
+ this.disposables = ( new DisposableStore());
80
241
  this._registrationDisposables = ( new Map());
242
+ this._participantRegistrationDisposables = ( new DisposableMap());
81
243
  this._viewContainer = this.registerViewContainer();
244
+ this.registerListeners();
82
245
  this.handleAndRegisterChatExtensions();
83
246
  }
247
+ registerListeners() {
248
+ this.contextService.onDidChangeContext(e => {
249
+ if (!this.productService.chatWelcomeView) {
250
+ return;
251
+ }
252
+ const showWelcomeViewConfigKey = 'workbench.chat.experimental.showWelcomeView';
253
+ const keys = ( new Set([showWelcomeViewConfigKey]));
254
+ if (e.affectsSome(keys)) {
255
+ const contextKeyExpr = ( ContextKeyExpr.equals(showWelcomeViewConfigKey, true));
256
+ const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
257
+ if (this.contextService.contextMatchesRules(contextKeyExpr)) {
258
+ const viewId = this._chatContributionService.getViewIdForProvider(this.productService.chatWelcomeView.welcomeViewId);
259
+ this._welcomeViewDescriptor = {
260
+ id: viewId,
261
+ name: { original: this.productService.chatWelcomeView.welcomeViewTitle, value: this.productService.chatWelcomeView.welcomeViewTitle },
262
+ containerIcon: this._viewContainer.icon,
263
+ ctorDescriptor: ( new SyncDescriptor(
264
+ ChatViewPane,
265
+ [{ providerId: this.productService.chatWelcomeView.welcomeViewId }]
266
+ )),
267
+ canToggleVisibility: false,
268
+ canMoveView: true,
269
+ order: 100
270
+ };
271
+ viewsRegistry.registerViews([this._welcomeViewDescriptor], this._viewContainer);
272
+ viewsRegistry.registerViewWelcomeContent(viewId, {
273
+ content: this.productService.chatWelcomeView.welcomeViewContent,
274
+ });
275
+ }
276
+ else if (this._welcomeViewDescriptor) {
277
+ viewsRegistry.deregisterViews([this._welcomeViewDescriptor], this._viewContainer);
278
+ }
279
+ }
280
+ }, null, this.disposables);
281
+ }
84
282
  handleAndRegisterChatExtensions() {
85
283
  chatExtensionPoint.setHandler((extensions, delta) => {
86
284
  for (const extension of delta.added) {
@@ -102,6 +300,44 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
102
300
  }
103
301
  }
104
302
  });
303
+ chatParticipantExtensionPoint.setHandler((extensions, delta) => {
304
+ for (const extension of delta.added) {
305
+ for (const providerDescriptor of extension.value) {
306
+ if (providerDescriptor.isDefault && !isProposedApiEnabled(extension.description, 'defaultChatParticipant')) {
307
+ this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT use API proposal: defaultChatParticipant.`);
308
+ continue;
309
+ }
310
+ if (providerDescriptor.defaultImplicitVariables && !isProposedApiEnabled(extension.description, 'chatParticipantAdditions')) {
311
+ this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT use API proposal: chatParticipantAdditions.`);
312
+ continue;
313
+ }
314
+ if (!providerDescriptor.id || !providerDescriptor.name) {
315
+ this.logService.error(`Extension '${extension.description.identifier.value}' CANNOT register participant without both id and name.`);
316
+ continue;
317
+ }
318
+ this._participantRegistrationDisposables.set(getParticipantKey(extension.description.identifier, providerDescriptor.name), this._chatAgentService.registerAgent(providerDescriptor.id, {
319
+ extensionId: extension.description.identifier,
320
+ id: providerDescriptor.id,
321
+ description: providerDescriptor.description,
322
+ metadata: {
323
+ isSticky: providerDescriptor.isSticky,
324
+ },
325
+ name: providerDescriptor.name,
326
+ isDefault: providerDescriptor.isDefault,
327
+ defaultImplicitVariables: providerDescriptor.defaultImplicitVariables,
328
+ locations: isNonEmptyArray(providerDescriptor.locations) ?
329
+ ( providerDescriptor.locations.map(ChatAgentLocation.fromRaw)) :
330
+ [ChatAgentLocation.Panel],
331
+ slashCommands: providerDescriptor.commands ?? []
332
+ }));
333
+ }
334
+ }
335
+ for (const extension of delta.removed) {
336
+ for (const providerDescriptor of extension.value) {
337
+ this._participantRegistrationDisposables.deleteAndDispose(getParticipantKey(extension.description.identifier, providerDescriptor.name));
338
+ }
339
+ }
340
+ });
105
341
  }
106
342
  registerViewContainer() {
107
343
  const title = ( localize2WithPath(
@@ -131,6 +367,7 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
131
367
  id: viewId,
132
368
  containerIcon: this._viewContainer.icon,
133
369
  containerTitle: this._viewContainer.title.value,
370
+ singleViewPaneContainerTitle: this._viewContainer.title.value,
134
371
  name: { value: providerDescriptor.label, original: providerDescriptor.label },
135
372
  canToggleVisibility: false,
136
373
  canMoveView: true,
@@ -155,9 +392,16 @@ let ChatExtensionPointHandler = class ChatExtensionPointHandler {
155
392
  }
156
393
  };
157
394
  ChatExtensionPointHandler = ( __decorate([
158
- ( __param(0, IChatContributionService))
395
+ ( __param(0, IChatContributionService)),
396
+ ( __param(1, IChatAgentService)),
397
+ ( __param(2, IProductService)),
398
+ ( __param(3, IContextKeyService)),
399
+ ( __param(4, ILogService))
159
400
  ], ChatExtensionPointHandler));
160
401
  registerWorkbenchContribution2(ChatExtensionPointHandler.ID, ChatExtensionPointHandler, 1 );
402
+ function getParticipantKey(extensionId, participantName) {
403
+ return `${extensionId.value}_${participantName}`;
404
+ }
161
405
  class ChatContributionService {
162
406
  constructor() {
163
407
  this._registeredProviders = ( new Map());
@@ -4,20 +4,31 @@ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/c
4
4
  import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
5
5
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
6
6
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
7
- import { editorForeground, editorBackground, inputBackground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
7
+ import 'vscode/vscode/vs/platform/theme/common/colorUtils';
8
+ import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
9
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
10
+ import { editorForeground, editorBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
11
+ import { inputBackground } from 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
12
+ import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
13
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
14
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
15
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
16
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
17
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
8
18
  import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
9
19
  import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
10
20
  import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
11
21
  import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
12
22
  import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
13
23
  import { clearChatEditor } from './actions/chatClear.js';
24
+ import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
14
25
 
15
26
  let ChatEditor = class ChatEditor extends EditorPane {
16
27
  get scopedContextKeyService() {
17
28
  return this._scopedContextKeyService;
18
29
  }
19
- constructor(telemetryService, themeService, instantiationService, storageService, contextKeyService) {
20
- super(ChatEditorInput.EditorID, telemetryService, themeService, storageService);
30
+ constructor(group, telemetryService, themeService, instantiationService, storageService, contextKeyService) {
31
+ super(ChatEditorInput.EditorID, group, telemetryService, themeService, storageService);
21
32
  this.instantiationService = instantiationService;
22
33
  this.storageService = storageService;
23
34
  this.contextKeyService = contextKeyService;
@@ -28,7 +39,7 @@ let ChatEditor = class ChatEditor extends EditorPane {
28
39
  createEditor(parent) {
29
40
  this._scopedContextKeyService = this._register(this.contextKeyService.createScoped(parent));
30
41
  const scopedInstantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService])));
31
- this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, { resource: true }, { supportsFileReferences: true }, {
42
+ this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { resource: true }, { supportsFileReferences: true }, {
32
43
  listForeground: editorForeground,
33
44
  listBackground: editorBackground,
34
45
  inputEditorBackground: inputBackground,
@@ -77,11 +88,11 @@ let ChatEditor = class ChatEditor extends EditorPane {
77
88
  }
78
89
  };
79
90
  ChatEditor = ( __decorate([
80
- ( __param(0, ITelemetryService)),
81
- ( __param(1, IThemeService)),
82
- ( __param(2, IInstantiationService)),
83
- ( __param(3, IStorageService)),
84
- ( __param(4, IContextKeyService))
91
+ ( __param(1, ITelemetryService)),
92
+ ( __param(2, IThemeService)),
93
+ ( __param(3, IInstantiationService)),
94
+ ( __param(4, IStorageService)),
95
+ ( __param(5, IContextKeyService))
85
96
  ], ChatEditor));
86
97
 
87
98
  export { ChatEditor };
@@ -5,14 +5,26 @@ import { disposableTimeout } from 'vscode/vscode/vs/base/common/async';
5
5
  import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
6
6
  import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
7
7
  import { Disposable, MutableDisposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
8
+ import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
8
9
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
9
10
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
10
11
  import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
11
12
  import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService';
12
13
  import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
13
- import { quickInputForeground, quickInputBackground, inputBackground, editorBackground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
14
+ import 'vscode/vscode/vs/platform/theme/common/colorUtils';
15
+ import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
16
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
17
+ import { editorBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
18
+ import { inputBackground } from 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
19
+ import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
20
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
21
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
22
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
23
+ import { quickInputForeground, quickInputBackground } from 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
24
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
14
25
  import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
15
26
  import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
27
+ import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
16
28
  import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
17
29
 
18
30
  var QuickChat_1;
@@ -52,10 +64,12 @@ let QuickChatService = class QuickChatService extends Disposable {
52
64
  open(providerId, options) {
53
65
  if (this._input) {
54
66
  if (this._currentChat && options?.query) {
67
+ this._currentChat.focus();
55
68
  this._currentChat.setValue(options.query, options.selection);
56
69
  if (!options.isPartialQuery) {
57
70
  this._currentChat.acceptInput();
58
71
  }
72
+ return;
59
73
  }
60
74
  return this.focus();
61
75
  }
@@ -172,7 +186,7 @@ let QuickChat = class QuickChat extends Disposable {
172
186
  IContextKeyService,
173
187
  this._register(this.contextKeyService.createScoped(parent))
174
188
  ])));
175
- this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, { resource: true }, { renderInputOnTop: true, renderStyle: 'compact' }, {
189
+ this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { resource: true }, { renderInputOnTop: true, renderStyle: 'compact', menus: { inputSideToolbar: MenuId.ChatInputSide } }, {
176
190
  listForeground: quickInputForeground,
177
191
  listBackground: quickInputBackground,
178
192
  inputEditorBackground: inputBackground,
@@ -20,10 +20,16 @@ let ChatVariablesService = class ChatVariablesService {
20
20
  if (part instanceof ChatRequestVariablePart) {
21
21
  const data = this._resolver.get(part.variableName.toLowerCase());
22
22
  if (data) {
23
- jobs.push(data.resolver(prompt.text, part.variableArg, model, progress, token).then(values => {
24
- if (values?.length) {
25
- resolvedVariables[i] = { name: part.variableName, range: part.range, values };
23
+ const references = [];
24
+ const variableProgressCallback = (item) => {
25
+ if (item.kind === 'reference') {
26
+ references.push(item);
27
+ return;
26
28
  }
29
+ progress(item);
30
+ };
31
+ jobs.push(data.resolver(prompt.text, part.variableArg, model, variableProgressCallback, token).then(values => {
32
+ resolvedVariables[i] = { name: part.variableName, range: part.range, values: values ?? [], references };
27
33
  }).catch(onUnexpectedExternalError));
28
34
  }
29
35
  }
@@ -38,9 +44,19 @@ let ChatVariablesService = class ChatVariablesService {
38
44
  variables: resolvedVariables,
39
45
  };
40
46
  }
47
+ async resolveVariable(variableName, promptText, model, progress, token) {
48
+ const data = this._resolver.get(variableName.toLowerCase());
49
+ if (!data) {
50
+ return Promise.resolve([]);
51
+ }
52
+ return (await data.resolver(promptText, undefined, model, progress, token)) ?? [];
53
+ }
41
54
  hasVariable(name) {
42
55
  return ( this._resolver.has(name.toLowerCase()));
43
56
  }
57
+ getVariable(name) {
58
+ return this._resolver.get(name.toLowerCase())?.data;
59
+ }
44
60
  getVariables() {
45
61
  const all = ( Iterable.map(( this._resolver.values()), data => data.data));
46
62
  return Iterable.filter(all, data => !data.hidden);
@@ -11,13 +11,24 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
11
11
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
12
12
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
13
13
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
14
- import { editorBackground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
14
+ import 'vscode/vscode/vs/platform/theme/common/colorUtils';
15
+ import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
16
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
17
+ import { editorBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
18
+ import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
19
+ import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
20
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
21
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
22
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
23
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
24
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
15
25
  import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
16
26
  import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
17
27
  import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
18
28
  import { SIDE_BAR_FOREGROUND } from 'vscode/vscode/vs/workbench/common/theme';
19
29
  import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
20
30
  import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
31
+ import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
21
32
  import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
22
33
 
23
34
  const CHAT_SIDEBAR_PANEL_ID = 'workbench.panel.chatSidebar';
@@ -91,7 +102,7 @@ let ChatViewPane = class ChatViewPane extends ViewPane {
91
102
  try {
92
103
  super.renderBody(parent);
93
104
  const scopedInstantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService])));
94
- this._widget = this._register(scopedInstantiationService.createInstance(ChatWidget, { viewId: this.id }, { supportsFileReferences: true }, {
105
+ this._widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { viewId: this.id }, { supportsFileReferences: true }, {
95
106
  listForeground: SIDE_BAR_FOREGROUND,
96
107
  listBackground: this.getBackgroundColor(),
97
108
  inputEditorBackground: this.getBackgroundColor(),
@@ -0,0 +1,16 @@
1
+ import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
2
+
3
+ class ChatCodeBlockContextProviderService {
4
+ constructor() {
5
+ this._providers = ( new Map());
6
+ }
7
+ get providers() {
8
+ return [...( this._providers.values())];
9
+ }
10
+ registerProvider(provider, id) {
11
+ this._providers.set(id, provider);
12
+ return toDisposable(() => this._providers.delete(id));
13
+ }
14
+ }
15
+
16
+ export { ChatCodeBlockContextProviderService };