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