@codingame/monaco-vscode-chat-service-override 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chat.js +9 -9
- package/package.json +2 -2
- package/external/tslib/tslib.es6.js +0 -11
- package/external/vscode-marked/lib/marked.esm.js +0 -2200
- package/override/vs/platform/dialogs/common/dialogs.js +0 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +0 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +0 -115
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +0 -503
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +0 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +0 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +0 -171
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +0 -271
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +0 -317
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +0 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js +0 -423
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +0 -98
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +0 -285
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +0 -90
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -185
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatHistoryVariables.js +0 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +0 -618
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +0 -600
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChat.js +0 -141
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +0 -40
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +0 -41
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +0 -72
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +0 -236
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl.js +0 -33
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
4
|
-
import { DisposableStore, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
6
|
-
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
|
-
import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
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';
|
|
11
|
-
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
12
|
-
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
13
|
-
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
14
|
-
import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
|
|
15
|
-
import { getHistoryAction, getOpenChatEditorAction } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
16
|
-
import { getNewChatAction } from './actions/chatClearActions.js';
|
|
17
|
-
import { getMoveToEditorAction, getMoveToNewWindowAction } from './actions/chatMoveActions.js';
|
|
18
|
-
import { getQuickChatActionForProvider } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
|
|
19
|
-
import { ChatViewPane, CHAT_SIDEBAR_PANEL_ID } from './chatViewPane.js';
|
|
20
|
-
import { ChatAgentLocation, IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
21
|
-
import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService';
|
|
22
|
-
import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
23
|
-
import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
24
|
-
|
|
25
|
-
const chatExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
26
|
-
extensionPoint: 'interactiveSession',
|
|
27
|
-
jsonSchema: {
|
|
28
|
-
description: ( localizeWithPath(
|
|
29
|
-
'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
|
|
30
|
-
'vscode.extension.contributes.interactiveSession',
|
|
31
|
-
'Contributes an Interactive Session provider'
|
|
32
|
-
)),
|
|
33
|
-
type: 'array',
|
|
34
|
-
items: {
|
|
35
|
-
additionalProperties: false,
|
|
36
|
-
type: 'object',
|
|
37
|
-
defaultSnippets: [{ body: { id: '', program: '', runtime: '' } }],
|
|
38
|
-
required: ['id', 'label'],
|
|
39
|
-
properties: {
|
|
40
|
-
id: {
|
|
41
|
-
description: ( localizeWithPath(
|
|
42
|
-
'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
|
|
43
|
-
'vscode.extension.contributes.interactiveSession.id',
|
|
44
|
-
"Unique identifier for this Interactive Session provider."
|
|
45
|
-
)),
|
|
46
|
-
type: 'string'
|
|
47
|
-
},
|
|
48
|
-
label: {
|
|
49
|
-
description: ( localizeWithPath(
|
|
50
|
-
'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
|
|
51
|
-
'vscode.extension.contributes.interactiveSession.label',
|
|
52
|
-
"Display name for this Interactive Session provider."
|
|
53
|
-
)),
|
|
54
|
-
type: 'string'
|
|
55
|
-
},
|
|
56
|
-
icon: {
|
|
57
|
-
description: ( localizeWithPath(
|
|
58
|
-
'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
|
|
59
|
-
'vscode.extension.contributes.interactiveSession.icon',
|
|
60
|
-
"An icon for this Interactive Session provider."
|
|
61
|
-
)),
|
|
62
|
-
type: 'string'
|
|
63
|
-
},
|
|
64
|
-
when: {
|
|
65
|
-
description: ( localizeWithPath(
|
|
66
|
-
'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
|
|
67
|
-
'vscode.extension.contributes.interactiveSession.when',
|
|
68
|
-
"A condition which must be true to enable this Interactive Session provider."
|
|
69
|
-
)),
|
|
70
|
-
type: 'string'
|
|
71
|
-
},
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
activationEventsGenerator: (contributions, result) => {
|
|
76
|
-
for (const contrib of contributions) {
|
|
77
|
-
result.push(`onInteractiveSession:${contrib.id}`);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
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
|
-
});
|
|
232
|
-
let ChatExtensionPointHandler = class ChatExtensionPointHandler {
|
|
233
|
-
static { this.ID = 'workbench.contrib.chatExtensionPointHandler'; }
|
|
234
|
-
constructor(_chatContributionService, _chatAgentService, productService, contextService, logService) {
|
|
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());
|
|
241
|
-
this._registrationDisposables = ( new Map());
|
|
242
|
-
this._participantRegistrationDisposables = ( new DisposableMap());
|
|
243
|
-
this._viewContainer = this.registerViewContainer();
|
|
244
|
-
this.registerListeners();
|
|
245
|
-
this.handleAndRegisterChatExtensions();
|
|
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
|
-
}
|
|
282
|
-
handleAndRegisterChatExtensions() {
|
|
283
|
-
chatExtensionPoint.setHandler((extensions, delta) => {
|
|
284
|
-
for (const extension of delta.added) {
|
|
285
|
-
const extensionDisposable = ( new DisposableStore());
|
|
286
|
-
for (const providerDescriptor of extension.value) {
|
|
287
|
-
this.registerChatProvider(providerDescriptor);
|
|
288
|
-
this._chatContributionService.registerChatProvider(providerDescriptor);
|
|
289
|
-
}
|
|
290
|
-
this._registrationDisposables.set(extension.description.identifier.value, extensionDisposable);
|
|
291
|
-
}
|
|
292
|
-
for (const extension of delta.removed) {
|
|
293
|
-
const registration = this._registrationDisposables.get(extension.description.identifier.value);
|
|
294
|
-
if (registration) {
|
|
295
|
-
registration.dispose();
|
|
296
|
-
this._registrationDisposables.delete(extension.description.identifier.value);
|
|
297
|
-
}
|
|
298
|
-
for (const providerDescriptor of extension.value) {
|
|
299
|
-
this._chatContributionService.deregisterChatProvider(providerDescriptor.id);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
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
|
-
});
|
|
341
|
-
}
|
|
342
|
-
registerViewContainer() {
|
|
343
|
-
const title = ( localize2WithPath(
|
|
344
|
-
'vs/workbench/contrib/chat/browser/chatContributionServiceImpl',
|
|
345
|
-
'chat.viewContainer.label',
|
|
346
|
-
"Chat"
|
|
347
|
-
));
|
|
348
|
-
const icon = Codicon.commentDiscussion;
|
|
349
|
-
const viewContainerId = CHAT_SIDEBAR_PANEL_ID;
|
|
350
|
-
const viewContainer = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
|
|
351
|
-
id: viewContainerId,
|
|
352
|
-
title,
|
|
353
|
-
icon,
|
|
354
|
-
ctorDescriptor: ( new SyncDescriptor(
|
|
355
|
-
ViewPaneContainer,
|
|
356
|
-
[viewContainerId, { mergeViewWithContainerWhenSingleView: true }]
|
|
357
|
-
)),
|
|
358
|
-
storageId: viewContainerId,
|
|
359
|
-
hideIfEmpty: true,
|
|
360
|
-
order: 100,
|
|
361
|
-
}, 0 );
|
|
362
|
-
return viewContainer;
|
|
363
|
-
}
|
|
364
|
-
registerChatProvider(providerDescriptor) {
|
|
365
|
-
const viewId = this._chatContributionService.getViewIdForProvider(providerDescriptor.id);
|
|
366
|
-
const viewDescriptor = [{
|
|
367
|
-
id: viewId,
|
|
368
|
-
containerIcon: this._viewContainer.icon,
|
|
369
|
-
containerTitle: this._viewContainer.title.value,
|
|
370
|
-
singleViewPaneContainerTitle: this._viewContainer.title.value,
|
|
371
|
-
name: { value: providerDescriptor.label, original: providerDescriptor.label },
|
|
372
|
-
canToggleVisibility: false,
|
|
373
|
-
canMoveView: true,
|
|
374
|
-
ctorDescriptor: ( new SyncDescriptor(ChatViewPane, [{ providerId: providerDescriptor.id }])),
|
|
375
|
-
when: ContextKeyExpr.deserialize(providerDescriptor.when)
|
|
376
|
-
}];
|
|
377
|
-
( Registry.as(Extensions.ViewsRegistry)).registerViews(viewDescriptor, this._viewContainer);
|
|
378
|
-
const disposables = ( new DisposableStore());
|
|
379
|
-
disposables.add(registerAction2(getHistoryAction(viewId, providerDescriptor.id)));
|
|
380
|
-
disposables.add(registerAction2(getNewChatAction(viewId, providerDescriptor.id)));
|
|
381
|
-
disposables.add(registerAction2(getMoveToEditorAction(viewId, providerDescriptor.id)));
|
|
382
|
-
disposables.add(registerAction2(getMoveToNewWindowAction(viewId, providerDescriptor.id)));
|
|
383
|
-
disposables.add(registerAction2(getOpenChatEditorAction(providerDescriptor.id, providerDescriptor.label, providerDescriptor.when)));
|
|
384
|
-
disposables.add(registerAction2(getQuickChatActionForProvider(providerDescriptor.id, providerDescriptor.label)));
|
|
385
|
-
return {
|
|
386
|
-
dispose: () => {
|
|
387
|
-
( Registry.as(Extensions.ViewsRegistry)).deregisterViews(viewDescriptor, this._viewContainer);
|
|
388
|
-
( Registry.as(Extensions.ViewContainersRegistry)).deregisterViewContainer(this._viewContainer);
|
|
389
|
-
disposables.dispose();
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
ChatExtensionPointHandler = ( __decorate([
|
|
395
|
-
( __param(0, IChatContributionService)),
|
|
396
|
-
( __param(1, IChatAgentService)),
|
|
397
|
-
( __param(2, IProductService)),
|
|
398
|
-
( __param(3, IContextKeyService)),
|
|
399
|
-
( __param(4, ILogService))
|
|
400
|
-
], ChatExtensionPointHandler));
|
|
401
|
-
registerWorkbenchContribution2(ChatExtensionPointHandler.ID, ChatExtensionPointHandler, 1 );
|
|
402
|
-
function getParticipantKey(extensionId, participantName) {
|
|
403
|
-
return `${extensionId.value}_${participantName}`;
|
|
404
|
-
}
|
|
405
|
-
class ChatContributionService {
|
|
406
|
-
constructor() {
|
|
407
|
-
this._registeredProviders = ( new Map());
|
|
408
|
-
}
|
|
409
|
-
getViewIdForProvider(providerId) {
|
|
410
|
-
return ChatViewPane.ID + '.' + providerId;
|
|
411
|
-
}
|
|
412
|
-
registerChatProvider(provider) {
|
|
413
|
-
this._registeredProviders.set(provider.id, provider);
|
|
414
|
-
}
|
|
415
|
-
deregisterChatProvider(providerId) {
|
|
416
|
-
this._registeredProviders.delete(providerId);
|
|
417
|
-
}
|
|
418
|
-
get registeredProviders() {
|
|
419
|
-
return Array.from(( this._registeredProviders.values()));
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export { ChatContributionService, ChatExtensionPointHandler };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
3
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
|
-
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
5
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
6
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
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';
|
|
18
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
19
|
-
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
20
|
-
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
21
|
-
import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
|
|
22
|
-
import { ChatWidget } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatWidget';
|
|
23
|
-
import { clearChatEditor } from './actions/chatClear.js';
|
|
24
|
-
import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
25
|
-
|
|
26
|
-
let ChatEditor = class ChatEditor extends EditorPane {
|
|
27
|
-
get scopedContextKeyService() {
|
|
28
|
-
return this._scopedContextKeyService;
|
|
29
|
-
}
|
|
30
|
-
constructor(group, telemetryService, themeService, instantiationService, storageService, contextKeyService) {
|
|
31
|
-
super(ChatEditorInput.EditorID, group, telemetryService, themeService, storageService);
|
|
32
|
-
this.instantiationService = instantiationService;
|
|
33
|
-
this.storageService = storageService;
|
|
34
|
-
this.contextKeyService = contextKeyService;
|
|
35
|
-
}
|
|
36
|
-
async clear() {
|
|
37
|
-
return this.instantiationService.invokeFunction(clearChatEditor);
|
|
38
|
-
}
|
|
39
|
-
createEditor(parent) {
|
|
40
|
-
this._scopedContextKeyService = this._register(this.contextKeyService.createScoped(parent));
|
|
41
|
-
const scopedInstantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService])));
|
|
42
|
-
this.widget = this._register(scopedInstantiationService.createInstance(ChatWidget, ChatAgentLocation.Panel, { resource: true }, { supportsFileReferences: true }, {
|
|
43
|
-
listForeground: editorForeground,
|
|
44
|
-
listBackground: editorBackground,
|
|
45
|
-
inputEditorBackground: inputBackground,
|
|
46
|
-
resultEditorBackground: editorBackground
|
|
47
|
-
}));
|
|
48
|
-
this._register(this.widget.onDidClear(() => this.clear()));
|
|
49
|
-
this.widget.render(parent);
|
|
50
|
-
this.widget.setVisible(true);
|
|
51
|
-
}
|
|
52
|
-
focus() {
|
|
53
|
-
super.focus();
|
|
54
|
-
this.widget?.focusInput();
|
|
55
|
-
}
|
|
56
|
-
clearInput() {
|
|
57
|
-
this.saveState();
|
|
58
|
-
super.clearInput();
|
|
59
|
-
}
|
|
60
|
-
async setInput(input, options, context, token) {
|
|
61
|
-
super.setInput(input, options, context, token);
|
|
62
|
-
const editorModel = await input.resolve();
|
|
63
|
-
if (!editorModel) {
|
|
64
|
-
throw new Error(`Failed to get model for chat editor. id: ${input.sessionId}`);
|
|
65
|
-
}
|
|
66
|
-
if (!this.widget) {
|
|
67
|
-
throw new Error('ChatEditor lifecycle issue: no editor widget');
|
|
68
|
-
}
|
|
69
|
-
this.updateModel(editorModel.model, options?.viewState ?? input.options.viewState);
|
|
70
|
-
}
|
|
71
|
-
updateModel(model, viewState) {
|
|
72
|
-
this._memento = ( new Memento('interactive-session-editor-' + model.providerId, this.storageService));
|
|
73
|
-
this._viewState = viewState ?? this._memento.getMemento(1 , 1 );
|
|
74
|
-
this.widget.setModel(model, { ...this._viewState });
|
|
75
|
-
}
|
|
76
|
-
saveState() {
|
|
77
|
-
this.widget?.saveState();
|
|
78
|
-
if (this._memento && this._viewState) {
|
|
79
|
-
const widgetViewState = this.widget.getViewState();
|
|
80
|
-
this._viewState.inputValue = widgetViewState.inputValue;
|
|
81
|
-
this._memento.saveMemento();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
layout(dimension, position) {
|
|
85
|
-
if (this.widget) {
|
|
86
|
-
this.widget.layout(dimension.height, dimension.width);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
ChatEditor = ( __decorate([
|
|
91
|
-
( __param(1, ITelemetryService)),
|
|
92
|
-
( __param(2, IThemeService)),
|
|
93
|
-
( __param(3, IInstantiationService)),
|
|
94
|
-
( __param(4, IStorageService)),
|
|
95
|
-
( __param(5, IContextKeyService))
|
|
96
|
-
], ChatEditor));
|
|
97
|
-
|
|
98
|
-
export { ChatEditor };
|