@codingame/monaco-vscode-chat-service-override 1.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/chat.d.ts +5 -0
  2. package/chat.js +39 -0
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  4. package/external/tslib/tslib.es6.js +11 -0
  5. package/index.d.ts +1 -0
  6. package/index.js +1 -0
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +24 -0
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +17 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +115 -0
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +509 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +88 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +83 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +110 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +223 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +283 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +283 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +61 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js +179 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +88 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +271 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +91 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +165 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatHistoryVariables.js +26 -0
  25. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +626 -0
  26. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditor.css.js +6 -0
  27. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +31 -0
  28. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +564 -0
  29. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +41 -0
  30. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +41 -0
  31. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +748 -0
  32. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDecorations.js +250 -0
  33. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +62 -0
  34. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl.js +35 -0
@@ -0,0 +1,748 @@
1
+ import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
2
+ import { KeyChord } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
3
+ import { EditorAction2 } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
4
+ import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'monaco-editor/esm/vs/editor/browser/widget/embeddedCodeEditorWidget.js';
5
+ import { EditorContextKeys } from 'monaco-editor/esm/vs/editor/common/editorContextKeys.js';
6
+ import { InlineChatController, InlineChatRunOptions } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
7
+ import { CTX_INLINE_CHAT_HAS_PROVIDER, MENU_INLINE_CHAT_WIDGET_STATUS, MENU_INLINE_CHAT_WIDGET_DISCARD, CTX_INLINE_CHAT_EDIT_MODE, CTX_INLINE_CHAT_RESPONSE_TYPES, CTX_INLINE_CHAT_TOOLBAR_ICON_ENABLED, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_HAS_STASHED_SESSION, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_FOCUSED, MENU_INLINE_CHAT_WIDGET, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, ACTION_REGENERATE_RESPONSE, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_INNER_CURSOR_START, CTX_INLINE_CHAT_INNER_CURSOR_END, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, MENU_INLINE_CHAT_WIDGET_FEEDBACK, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, MENU_INLINE_CHAT_WIDGET_TOGGLE, ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_DOCUMENT_CHANGED, ACTION_VIEW_IN_CHAT, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, CTX_INLINE_CHAT_MESSAGE_CROP_STATE, CTX_INLINE_CHAT_RESPONSE_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
8
+ import { localizeWithPath, localize2WithPath } from 'monaco-editor/esm/vs/nls.js';
9
+ import { MenuRegistry, MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
10
+ import { IClipboardService } from 'monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js';
11
+ import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
12
+ import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
13
+ import { IEditorService, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
14
+ import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
15
+ import { fromNow } from 'vscode/vscode/vs/base/common/date';
16
+ import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSession';
17
+ import { runAccessibilityHelpAction } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp';
18
+ import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
19
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
20
+ import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
21
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
22
+ import { AccessibilityHelpAction } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleViewActions';
23
+ import { registerIcon } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
24
+
25
+ CommandsRegistry.registerCommandAlias('interactiveEditor.start', 'inlineChat.start');
26
+ const LOCALIZED_START_INLINE_CHAT_STRING = ( localizeWithPath(
27
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
28
+ 'run',
29
+ 'Start Inline Chat'
30
+ ));
31
+ const START_INLINE_CHAT = registerIcon('start-inline-chat', Codicon.sparkle, ( localizeWithPath(
32
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
33
+ 'startInlineChat',
34
+ 'Icon which spawns the inline chat from the editor toolbar.'
35
+ )));
36
+ class StartSessionAction extends EditorAction2 {
37
+ constructor() {
38
+ super({
39
+ id: 'inlineChat.start',
40
+ title: { value: LOCALIZED_START_INLINE_CHAT_STRING, original: 'Start Inline Chat' },
41
+ category: AbstractInlineChatAction.category,
42
+ f1: true,
43
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, EditorContextKeys.writable)),
44
+ keybinding: {
45
+ when: EditorContextKeys.focus,
46
+ weight: 200 ,
47
+ primary: 2048 | 39 ,
48
+ secondary: [KeyChord(2048 | 41 , 39 )],
49
+ },
50
+ icon: START_INLINE_CHAT,
51
+ menu: [{
52
+ id: MenuId.EditorTitle,
53
+ when: ( ContextKeyExpr.and(
54
+ CTX_INLINE_CHAT_TOOLBAR_ICON_ENABLED,
55
+ CTX_INLINE_CHAT_HAS_PROVIDER,
56
+ ( CTX_INLINE_CHAT_VISIBLE.toNegated()),
57
+ EditorContextKeys.focus
58
+ )),
59
+ group: 'navigation',
60
+ order: -1000000,
61
+ }],
62
+ });
63
+ }
64
+ runEditorCommand(_accessor, editor, ..._args) {
65
+ let options;
66
+ const arg = _args[0];
67
+ if (arg && InlineChatRunOptions.isInteractiveEditorOptions(arg)) {
68
+ options = arg;
69
+ }
70
+ InlineChatController.get(editor)?.run({ ...options });
71
+ }
72
+ }
73
+ class UnstashSessionAction extends EditorAction2 {
74
+ constructor() {
75
+ super({
76
+ id: 'inlineChat.unstash',
77
+ title: { value: ( localizeWithPath(
78
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
79
+ 'unstash',
80
+ 'Resume Last Dismissed Inline Chat'
81
+ )), original: 'Resume Last Dismissed Inline Chat' },
82
+ category: AbstractInlineChatAction.category,
83
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_STASHED_SESSION, EditorContextKeys.writable)),
84
+ keybinding: {
85
+ weight: 200 ,
86
+ primary: 2048 | 56 ,
87
+ }
88
+ });
89
+ }
90
+ runEditorCommand(_accessor, editor, ..._args) {
91
+ const ctrl = InlineChatController.get(editor);
92
+ if (ctrl) {
93
+ const session = ctrl.unstashLastSession();
94
+ if (session) {
95
+ ctrl.run({
96
+ existingSession: session,
97
+ isUnstashed: true
98
+ });
99
+ }
100
+ }
101
+ }
102
+ }
103
+ class AbstractInlineChatAction extends EditorAction2 {
104
+ static { this.category = { value: ( localizeWithPath(
105
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
106
+ 'cat',
107
+ 'Inline Chat'
108
+ )), original: 'Inline Chat' }; }
109
+ constructor(desc) {
110
+ super({
111
+ ...desc,
112
+ category: AbstractInlineChatAction.category,
113
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, desc.precondition))
114
+ });
115
+ }
116
+ runEditorCommand(accessor, editor, ..._args) {
117
+ if (editor instanceof EmbeddedCodeEditorWidget) {
118
+ editor = editor.getParentEditor();
119
+ }
120
+ const ctrl = InlineChatController.get(editor);
121
+ if (!ctrl) {
122
+ for (const diffEditor of accessor.get(ICodeEditorService).listDiffEditors()) {
123
+ if (diffEditor.getOriginalEditor() === editor || diffEditor.getModifiedEditor() === editor) {
124
+ if (diffEditor instanceof EmbeddedDiffEditorWidget) {
125
+ this.runEditorCommand(accessor, diffEditor.getParentEditor(), ..._args);
126
+ }
127
+ }
128
+ }
129
+ return;
130
+ }
131
+ this.runInlineChatCommand(accessor, ctrl, editor, ..._args);
132
+ }
133
+ }
134
+ class MakeRequestAction extends AbstractInlineChatAction {
135
+ constructor() {
136
+ super({
137
+ id: 'inlineChat.accept',
138
+ title: ( localizeWithPath(
139
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
140
+ 'accept',
141
+ 'Make Request'
142
+ )),
143
+ icon: Codicon.send,
144
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EMPTY.negate()))),
145
+ keybinding: {
146
+ when: CTX_INLINE_CHAT_FOCUSED,
147
+ weight: 0 + 7,
148
+ primary: 3
149
+ },
150
+ menu: {
151
+ id: MENU_INLINE_CHAT_WIDGET,
152
+ group: 'main',
153
+ order: 1,
154
+ when: ( CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST.isEqualTo(false))
155
+ }
156
+ });
157
+ }
158
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
159
+ ctrl.acceptInput();
160
+ }
161
+ }
162
+ class ReRunRequestAction extends AbstractInlineChatAction {
163
+ constructor() {
164
+ super({
165
+ id: ACTION_REGENERATE_RESPONSE,
166
+ title: ( localizeWithPath(
167
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
168
+ 'rerun',
169
+ 'Regenerate Response'
170
+ )),
171
+ shortTitle: ( localizeWithPath(
172
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
173
+ 'rerunShort',
174
+ 'Regenerate'
175
+ )),
176
+ icon: Codicon.refresh,
177
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EMPTY.negate()), CTX_INLINE_CHAT_LAST_RESPONSE_TYPE)),
178
+ menu: {
179
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
180
+ group: '2_feedback',
181
+ order: 3,
182
+ }
183
+ });
184
+ }
185
+ runInlineChatCommand(_accessor, ctrl) {
186
+ ctrl.regenerate();
187
+ }
188
+ }
189
+ class StopRequestAction extends AbstractInlineChatAction {
190
+ constructor() {
191
+ super({
192
+ id: 'inlineChat.stop',
193
+ title: ( localizeWithPath(
194
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
195
+ 'stop',
196
+ 'Stop Request'
197
+ )),
198
+ icon: Codicon.debugStop,
199
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EMPTY.negate()), CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST)),
200
+ menu: {
201
+ id: MENU_INLINE_CHAT_WIDGET,
202
+ group: 'main',
203
+ order: 1,
204
+ when: CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST
205
+ },
206
+ keybinding: {
207
+ weight: 100 ,
208
+ primary: 9
209
+ }
210
+ });
211
+ }
212
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
213
+ ctrl.cancelCurrentRequest();
214
+ }
215
+ }
216
+ class ArrowOutUpAction extends AbstractInlineChatAction {
217
+ constructor() {
218
+ super({
219
+ id: 'inlineChat.arrowOutUp',
220
+ title: ( localizeWithPath(
221
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
222
+ 'arrowUp',
223
+ 'Cursor Up'
224
+ )),
225
+ precondition: ( ContextKeyExpr.and(
226
+ CTX_INLINE_CHAT_FOCUSED,
227
+ CTX_INLINE_CHAT_INNER_CURSOR_FIRST,
228
+ ( EditorContextKeys.isEmbeddedDiffEditor.negate()),
229
+ ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
230
+ )),
231
+ keybinding: {
232
+ weight: 0 ,
233
+ primary: 2048 | 16
234
+ }
235
+ });
236
+ }
237
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
238
+ ctrl.arrowOut(true);
239
+ }
240
+ }
241
+ class ArrowOutDownAction extends AbstractInlineChatAction {
242
+ constructor() {
243
+ super({
244
+ id: 'inlineChat.arrowOutDown',
245
+ title: ( localizeWithPath(
246
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
247
+ 'arrowDown',
248
+ 'Cursor Down'
249
+ )),
250
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, ( EditorContextKeys.isEmbeddedDiffEditor.negate()), ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()))),
251
+ keybinding: {
252
+ weight: 0 ,
253
+ primary: 2048 | 18
254
+ }
255
+ });
256
+ }
257
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
258
+ ctrl.arrowOut(false);
259
+ }
260
+ }
261
+ class FocusInlineChat extends EditorAction2 {
262
+ constructor() {
263
+ super({
264
+ id: 'inlineChat.focus',
265
+ title: { value: ( localizeWithPath(
266
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
267
+ 'focus',
268
+ 'Focus Input'
269
+ )), original: 'Focus Input' },
270
+ f1: true,
271
+ category: AbstractInlineChatAction.category,
272
+ precondition: ( ContextKeyExpr.and(EditorContextKeys.editorTextFocus, CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_FOCUSED.negate()), ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()))),
273
+ keybinding: [{
274
+ weight: 0 + 10,
275
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('above')), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
276
+ primary: 2048 | 18 ,
277
+ }, {
278
+ weight: 0 + 10,
279
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('below')), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
280
+ primary: 2048 | 16 ,
281
+ }]
282
+ });
283
+ }
284
+ runEditorCommand(_accessor, editor, ..._args) {
285
+ InlineChatController.get(editor)?.focus();
286
+ }
287
+ }
288
+ class PreviousFromHistory extends AbstractInlineChatAction {
289
+ constructor() {
290
+ super({
291
+ id: 'inlineChat.previousFromHistory',
292
+ title: ( localizeWithPath(
293
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
294
+ 'previousFromHistory',
295
+ 'Previous From History'
296
+ )),
297
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_START)),
298
+ keybinding: {
299
+ weight: 0 + 10,
300
+ primary: 16 ,
301
+ }
302
+ });
303
+ }
304
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
305
+ ctrl.populateHistory(true);
306
+ }
307
+ }
308
+ class NextFromHistory extends AbstractInlineChatAction {
309
+ constructor() {
310
+ super({
311
+ id: 'inlineChat.nextFromHistory',
312
+ title: ( localizeWithPath(
313
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
314
+ 'nextFromHistory',
315
+ 'Next From History'
316
+ )),
317
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_END)),
318
+ keybinding: {
319
+ weight: 0 + 10,
320
+ primary: 18 ,
321
+ }
322
+ });
323
+ }
324
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
325
+ ctrl.populateHistory(false);
326
+ }
327
+ }
328
+ MenuRegistry.appendMenuItem(MENU_INLINE_CHAT_WIDGET_STATUS, {
329
+ submenu: MENU_INLINE_CHAT_WIDGET_DISCARD,
330
+ title: ( localizeWithPath(
331
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
332
+ 'discardMenu',
333
+ "Discard..."
334
+ )),
335
+ icon: Codicon.discard,
336
+ group: '0_main',
337
+ order: 2,
338
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("preview" )), ( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("live3" )), ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" )))),
339
+ rememberDefaultAction: true
340
+ });
341
+ class DiscardAction extends AbstractInlineChatAction {
342
+ constructor() {
343
+ super({
344
+ id: 'inlineChat.discard',
345
+ title: ( localizeWithPath(
346
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
347
+ 'discard',
348
+ 'Discard'
349
+ )),
350
+ icon: Codicon.discard,
351
+ precondition: CTX_INLINE_CHAT_VISIBLE,
352
+ keybinding: {
353
+ weight: 100 ,
354
+ primary: 9 ,
355
+ when: ( CTX_INLINE_CHAT_USER_DID_EDIT.negate())
356
+ },
357
+ menu: {
358
+ id: MENU_INLINE_CHAT_WIDGET_DISCARD,
359
+ group: '0_main',
360
+ order: 0
361
+ }
362
+ });
363
+ }
364
+ async runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
365
+ await ctrl.cancelSession();
366
+ }
367
+ }
368
+ class DiscardToClipboardAction extends AbstractInlineChatAction {
369
+ constructor() {
370
+ super({
371
+ id: 'inlineChat.discardToClipboard',
372
+ title: ( localizeWithPath(
373
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
374
+ 'undo.clipboard',
375
+ 'Discard to Clipboard'
376
+ )),
377
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT)),
378
+ menu: {
379
+ id: MENU_INLINE_CHAT_WIDGET_DISCARD,
380
+ group: '0_main',
381
+ order: 1
382
+ }
383
+ });
384
+ }
385
+ async runInlineChatCommand(accessor, ctrl) {
386
+ const clipboardService = accessor.get(IClipboardService);
387
+ const changedText = await ctrl.cancelSession();
388
+ if (changedText !== undefined) {
389
+ clipboardService.writeText(changedText);
390
+ }
391
+ }
392
+ }
393
+ class DiscardUndoToNewFileAction extends AbstractInlineChatAction {
394
+ constructor() {
395
+ super({
396
+ id: 'inlineChat.discardToFile',
397
+ title: ( localizeWithPath(
398
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
399
+ 'undo.newfile',
400
+ 'Discard to New File'
401
+ )),
402
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT)),
403
+ menu: {
404
+ id: MENU_INLINE_CHAT_WIDGET_DISCARD,
405
+ group: '0_main',
406
+ order: 2
407
+ }
408
+ });
409
+ }
410
+ async runInlineChatCommand(accessor, ctrl, editor, ..._args) {
411
+ const editorService = accessor.get(IEditorService);
412
+ const changedText = await ctrl.cancelSession();
413
+ if (changedText !== undefined) {
414
+ const input = { forceUntitled: true, resource: undefined, contents: changedText, languageId: editor.getModel()?.getLanguageId() };
415
+ editorService.openEditor(input, SIDE_GROUP);
416
+ }
417
+ }
418
+ }
419
+ class ToggleDiffForChange extends AbstractInlineChatAction {
420
+ constructor() {
421
+ super({
422
+ id: 'inlineChat.toggleDiff',
423
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("live3" )), CTX_INLINE_CHAT_CHANGE_HAS_DIFF)),
424
+ title: ( localize2WithPath(
425
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
426
+ 'showChanges',
427
+ 'Show Changes'
428
+ )),
429
+ icon: Codicon.diffSingle,
430
+ toggled: {
431
+ condition: CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF,
432
+ },
433
+ menu: [
434
+ {
435
+ id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
436
+ group: '1_main',
437
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("live3" )), CTX_INLINE_CHAT_CHANGE_HAS_DIFF))
438
+ }
439
+ ]
440
+ });
441
+ }
442
+ runInlineChatCommand(accessor, ctrl) {
443
+ ctrl.toggleDiff();
444
+ }
445
+ }
446
+ class FeebackHelpfulCommand extends AbstractInlineChatAction {
447
+ constructor() {
448
+ super({
449
+ id: 'inlineChat.feedbackHelpful',
450
+ title: ( localizeWithPath(
451
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
452
+ 'feedback.helpful',
453
+ 'Helpful'
454
+ )),
455
+ icon: Codicon.thumbsup,
456
+ precondition: CTX_INLINE_CHAT_VISIBLE,
457
+ toggled: ( CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('helpful')),
458
+ menu: {
459
+ id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
460
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
461
+ group: '2_feedback',
462
+ order: 1
463
+ }
464
+ });
465
+ }
466
+ runInlineChatCommand(_accessor, ctrl) {
467
+ ctrl.feedbackLast(1 );
468
+ }
469
+ }
470
+ class FeebackUnhelpfulCommand extends AbstractInlineChatAction {
471
+ constructor() {
472
+ super({
473
+ id: 'inlineChat.feedbackunhelpful',
474
+ title: ( localizeWithPath(
475
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
476
+ 'feedback.unhelpful',
477
+ 'Unhelpful'
478
+ )),
479
+ icon: Codicon.thumbsdown,
480
+ precondition: CTX_INLINE_CHAT_VISIBLE,
481
+ toggled: ( CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('unhelpful')),
482
+ menu: {
483
+ id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
484
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
485
+ group: '2_feedback',
486
+ order: 2
487
+ }
488
+ });
489
+ }
490
+ runInlineChatCommand(_accessor, ctrl) {
491
+ ctrl.feedbackLast(0 );
492
+ }
493
+ }
494
+ class ReportIssueForBugCommand extends AbstractInlineChatAction {
495
+ constructor() {
496
+ super({
497
+ id: 'inlineChat.reportIssueForBug',
498
+ title: ( localizeWithPath(
499
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
500
+ 'feedback.reportIssueForBug',
501
+ 'Report Issue'
502
+ )),
503
+ icon: Codicon.report,
504
+ precondition: CTX_INLINE_CHAT_VISIBLE,
505
+ menu: {
506
+ id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
507
+ when: ( ContextKeyExpr.and(CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)))),
508
+ group: '2_feedback',
509
+ order: 3
510
+ }
511
+ });
512
+ }
513
+ runInlineChatCommand(_accessor, ctrl) {
514
+ ctrl.feedbackLast(4 );
515
+ }
516
+ }
517
+ class ToggleInlineDiff extends AbstractInlineChatAction {
518
+ constructor() {
519
+ super({
520
+ id: 'inlineChat.toggleDiff',
521
+ title: {
522
+ original: 'Show Diff',
523
+ value: ( localizeWithPath(
524
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
525
+ 'showDiff',
526
+ 'Show Diff'
527
+ )),
528
+ mnemonicTitle: ( localizeWithPath(
529
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
530
+ { key: 'miShowDiff', comment: ['&& denotes a mnemonic'] },
531
+ "&&Show Diff"
532
+ )),
533
+ },
534
+ toggled: {
535
+ condition: ( ContextKeyExpr.equals('config.inlineChat.showDiff', true)),
536
+ title: ( localizeWithPath(
537
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
538
+ 'showDiff2',
539
+ "Show Diff"
540
+ )),
541
+ mnemonicTitle: ( localizeWithPath(
542
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
543
+ { key: 'miShowDiff2', comment: ['&& denotes a mnemonic'] },
544
+ "&&Show Diff"
545
+ ))
546
+ },
547
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("live" )))),
548
+ menu: [
549
+ { id: MENU_INLINE_CHAT_WIDGET_TOGGLE }
550
+ ]
551
+ });
552
+ }
553
+ runInlineChatCommand(accessor, _ctrl) {
554
+ const configurationService = accessor.get(IConfigurationService);
555
+ const newValue = !configurationService.getValue('inlineChat.showDiff');
556
+ configurationService.updateValue('inlineChat.showDiff', newValue);
557
+ }
558
+ }
559
+ class ApplyPreviewEdits extends AbstractInlineChatAction {
560
+ constructor() {
561
+ super({
562
+ id: ACTION_ACCEPT_CHANGES,
563
+ title: { value: ( localizeWithPath(
564
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
565
+ 'apply1',
566
+ 'Accept Changes'
567
+ )), original: 'Accept Changes' },
568
+ shortTitle: ( localizeWithPath(
569
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
570
+ 'apply2',
571
+ 'Accept'
572
+ )),
573
+ icon: Codicon.check,
574
+ f1: true,
575
+ precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ( ContextKeyExpr.or(( CTX_INLINE_CHAT_DOCUMENT_CHANGED.toNegated()), ( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("preview" )))))),
576
+ keybinding: [{
577
+ weight: 100 + 10,
578
+ primary: 2048 | 3 ,
579
+ }, {
580
+ primary: 9 ,
581
+ weight: 100 ,
582
+ when: CTX_INLINE_CHAT_USER_DID_EDIT
583
+ }],
584
+ menu: {
585
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" )), ( CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo("live3" )))),
586
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
587
+ group: '0_main',
588
+ order: 0
589
+ }
590
+ });
591
+ }
592
+ async runInlineChatCommand(_accessor, ctrl) {
593
+ ctrl.acceptSession();
594
+ }
595
+ }
596
+ class CancelSessionAction extends AbstractInlineChatAction {
597
+ constructor() {
598
+ super({
599
+ id: 'inlineChat.cancel',
600
+ title: ( localizeWithPath(
601
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
602
+ 'cancel',
603
+ 'Cancel'
604
+ )),
605
+ icon: Codicon.clearAll,
606
+ precondition: CTX_INLINE_CHAT_VISIBLE,
607
+ keybinding: {
608
+ weight: 100 - 1,
609
+ primary: 9
610
+ },
611
+ menu: {
612
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
613
+ when: ( ContextKeyExpr.or(( CTX_INLINE_CHAT_EDIT_MODE.isEqualTo("preview" )), ( CTX_INLINE_CHAT_RESPONSE_TYPES.isEqualTo("onlyMessages" )))),
614
+ group: '0_main',
615
+ order: 3
616
+ }
617
+ });
618
+ }
619
+ async runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
620
+ ctrl.cancelSession();
621
+ }
622
+ }
623
+ class CopyRecordings extends AbstractInlineChatAction {
624
+ constructor() {
625
+ super({
626
+ id: 'inlineChat.copyRecordings',
627
+ f1: true,
628
+ title: {
629
+ value: ( localizeWithPath(
630
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
631
+ 'copyRecordings',
632
+ '(Developer) Write Exchange to Clipboard'
633
+ )),
634
+ original: '(Developer) Write Exchange to Clipboard'
635
+ }
636
+ });
637
+ }
638
+ async runInlineChatCommand(accessor) {
639
+ const clipboardService = accessor.get(IClipboardService);
640
+ const quickPickService = accessor.get(IQuickInputService);
641
+ const ieSessionService = accessor.get(IInlineChatSessionService);
642
+ const recordings = ieSessionService.recordings().filter(r => r.exchanges.length > 0);
643
+ if (recordings.length === 0) {
644
+ return;
645
+ }
646
+ const picks = ( recordings.map(rec => {
647
+ return {
648
+ rec,
649
+ label: ( localizeWithPath(
650
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
651
+ 'label',
652
+ "'{0}' and {1} follow ups ({2})",
653
+ rec.exchanges[0].prompt,
654
+ rec.exchanges.length - 1,
655
+ fromNow(rec.when, true)
656
+ )),
657
+ tooltip: ( rec.exchanges.map(ex => ex.prompt)).join('\n'),
658
+ };
659
+ }));
660
+ const pick = await quickPickService.pick(picks, { canPickMany: false });
661
+ if (pick) {
662
+ clipboardService.writeText(JSON.stringify(pick.rec, undefined, 2));
663
+ }
664
+ }
665
+ }
666
+ class ViewInChatAction extends AbstractInlineChatAction {
667
+ constructor() {
668
+ super({
669
+ id: ACTION_VIEW_IN_CHAT,
670
+ title: ( localizeWithPath(
671
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
672
+ 'viewInChat',
673
+ 'View in Chat'
674
+ )),
675
+ icon: Codicon.commentDiscussion,
676
+ precondition: CTX_INLINE_CHAT_VISIBLE,
677
+ menu: {
678
+ id: MENU_INLINE_CHAT_WIDGET_STATUS,
679
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo("message" )),
680
+ group: '0_main',
681
+ order: 1
682
+ }
683
+ });
684
+ }
685
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
686
+ ctrl.viewInChat();
687
+ }
688
+ }
689
+ class ExpandMessageAction extends AbstractInlineChatAction {
690
+ constructor() {
691
+ super({
692
+ id: 'inlineChat.expandMessageAction',
693
+ title: ( localizeWithPath(
694
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
695
+ 'expandMessage',
696
+ 'Show More'
697
+ )),
698
+ icon: Codicon.chevronDown,
699
+ precondition: CTX_INLINE_CHAT_VISIBLE,
700
+ menu: {
701
+ id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
702
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message')), ( CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('cropped')))),
703
+ group: '2_expandOrContract',
704
+ order: 1
705
+ }
706
+ });
707
+ }
708
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
709
+ ctrl.updateExpansionState(true);
710
+ }
711
+ }
712
+ class ContractMessageAction extends AbstractInlineChatAction {
713
+ constructor() {
714
+ super({
715
+ id: 'inlineChat.contractMessageAction',
716
+ title: ( localizeWithPath(
717
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatActions',
718
+ 'contractMessage',
719
+ 'Show Less'
720
+ )),
721
+ icon: Codicon.chevronUp,
722
+ precondition: CTX_INLINE_CHAT_VISIBLE,
723
+ menu: {
724
+ id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
725
+ when: ( ContextKeyExpr.and(( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message')), ( CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('expanded')))),
726
+ group: '2_expandOrContract',
727
+ order: 1
728
+ }
729
+ });
730
+ }
731
+ runInlineChatCommand(_accessor, ctrl, _editor, ..._args) {
732
+ ctrl.updateExpansionState(false);
733
+ }
734
+ }
735
+ class InlineAccessibilityHelpContribution extends Disposable {
736
+ constructor() {
737
+ super();
738
+ this._register(AccessibilityHelpAction.addImplementation(106, 'inlineChat', async (accessor) => {
739
+ const codeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor() || accessor.get(ICodeEditorService).getFocusedCodeEditor();
740
+ if (!codeEditor) {
741
+ return;
742
+ }
743
+ runAccessibilityHelpAction(accessor, codeEditor, 'inlineChat');
744
+ }, ( ContextKeyExpr.or(CTX_INLINE_CHAT_RESPONSE_FOCUSED, CTX_INLINE_CHAT_FOCUSED))));
745
+ }
746
+ }
747
+
748
+ export { ApplyPreviewEdits, ArrowOutDownAction, ArrowOutUpAction, CancelSessionAction, ContractMessageAction, CopyRecordings, DiscardAction, DiscardToClipboardAction, DiscardUndoToNewFileAction, ExpandMessageAction, FeebackHelpfulCommand, FeebackUnhelpfulCommand, FocusInlineChat, InlineAccessibilityHelpContribution, LOCALIZED_START_INLINE_CHAT_STRING, MakeRequestAction, NextFromHistory, PreviousFromHistory, ReRunRequestAction, ReportIssueForBugCommand, StartSessionAction, StopRequestAction, ToggleDiffForChange, ToggleInlineDiff, UnstashSessionAction, ViewInChatAction };