@codingame/monaco-vscode-notebook-service-override 2.2.2 → 3.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 (31) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +6 -1
  3. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +101 -161
  4. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +4 -5
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +85 -3
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +8 -11
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +3 -5
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +34 -12
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +55 -17
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +39 -3
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -41
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +17 -26
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +3 -4
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +565 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +31 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +744 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +28 -23
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +41 -42
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +31 -13
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +4 -4
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +4 -4
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +25 -16
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +118 -6
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +6 -6
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +6 -9
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +2 -3
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +3 -39
  30. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +43 -11
  31. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +5 -1
@@ -0,0 +1,565 @@
1
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
2
+ import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
3
+ import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
4
+ import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
5
+ import { registerAction2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
6
+ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
+ import { InputFocusedContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
8
+ import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_RESPONSE_TYPES, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, CTX_INLINE_CHAT_HAS_PROVIDER } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
9
+ import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED, MENU_CELL_CHAT_INPUT, CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST, MENU_CELL_CHAT_WIDGET, CTX_NOTEBOOK_CHAT_USER_DID_EDIT, CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION, MENU_CELL_CHAT_WIDGET_STATUS, MENU_CELL_CHAT_WIDGET_FEEDBACK } from './notebookChatContext.js';
10
+ import { NotebookChatController } from './notebookChatController.js';
11
+ import { NotebookAction, NotebookCellAction, getEditorFromArgsOrActivePane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
12
+ import { CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
13
+ import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
14
+ import { NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
15
+
16
+ registerAction2(class extends NotebookAction {
17
+ constructor() {
18
+ super({
19
+ id: 'notebook.cell.chat.accept',
20
+ title: ( localize2WithPath(
21
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
22
+ 'notebook.cell.chat.accept',
23
+ "Make Request"
24
+ )),
25
+ icon: Codicon.send,
26
+ keybinding: {
27
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
28
+ weight: 0 + 7,
29
+ primary: 3
30
+ },
31
+ menu: {
32
+ id: MENU_CELL_CHAT_INPUT,
33
+ group: 'main',
34
+ order: 1,
35
+ when: ( CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST.negate())
36
+ }
37
+ });
38
+ }
39
+ async runWithContext(accessor, context) {
40
+ NotebookChatController.get(context.notebookEditor)?.acceptInput();
41
+ }
42
+ });
43
+ registerAction2(class extends NotebookCellAction {
44
+ constructor() {
45
+ super({
46
+ id: 'notebook.cell.chat.arrowOutUp',
47
+ title: ( localizeWithPath(
48
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
49
+ 'arrowUp',
50
+ 'Cursor Up'
51
+ )),
52
+ keybinding: {
53
+ when: ( ContextKeyExpr.and(
54
+ CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
55
+ CTX_INLINE_CHAT_FOCUSED,
56
+ CTX_INLINE_CHAT_INNER_CURSOR_FIRST,
57
+ ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
58
+ )),
59
+ weight: 0 + 7,
60
+ primary: 2048 | 16
61
+ }
62
+ });
63
+ }
64
+ async runWithContext(accessor, context) {
65
+ const editor = context.notebookEditor;
66
+ const activeCell = context.cell;
67
+ const idx = editor.getCellIndex(activeCell);
68
+ if (typeof idx !== 'number') {
69
+ return;
70
+ }
71
+ if (idx < 1 || editor.getLength() === 0) {
72
+ return;
73
+ }
74
+ const newCell = editor.cellAt(idx - 1);
75
+ const newFocusMode = newCell.cellKind === CellKind.Markup && newCell.getEditState() === CellEditState.Preview ? 'container' : 'editor';
76
+ const focusEditorLine = newCell.textBuffer.getLineCount();
77
+ await editor.focusNotebookCell(newCell, newFocusMode, { focusEditorLine: focusEditorLine });
78
+ }
79
+ });
80
+ registerAction2(class extends NotebookAction {
81
+ constructor() {
82
+ super({
83
+ id: 'notebook.cell.chat.arrowOutDown',
84
+ title: ( localizeWithPath(
85
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
86
+ 'arrowDown',
87
+ 'Cursor Down'
88
+ )),
89
+ keybinding: {
90
+ when: ( ContextKeyExpr.and(
91
+ CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
92
+ CTX_INLINE_CHAT_FOCUSED,
93
+ CTX_INLINE_CHAT_INNER_CURSOR_LAST,
94
+ ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
95
+ )),
96
+ weight: 0 + 7,
97
+ primary: 2048 | 18
98
+ }
99
+ });
100
+ }
101
+ async runWithContext(accessor, context) {
102
+ await NotebookChatController.get(context.notebookEditor)?.focusNext();
103
+ }
104
+ });
105
+ registerAction2(class extends NotebookCellAction {
106
+ constructor() {
107
+ super({
108
+ id: 'notebook.cell.focusChatWidget',
109
+ title: ( localizeWithPath(
110
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
111
+ 'focusChatWidget',
112
+ 'Focus Chat Widget'
113
+ )),
114
+ keybinding: {
115
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.and(( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus, ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('bottom')), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')))), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
116
+ weight: 0 + 7,
117
+ primary: 2048 | 16
118
+ }
119
+ });
120
+ }
121
+ async runWithContext(accessor, context) {
122
+ const index = context.notebookEditor.getCellIndex(context.cell);
123
+ await NotebookChatController.get(context.notebookEditor)?.focusNearestWidget(index, 'above');
124
+ }
125
+ });
126
+ registerAction2(class extends NotebookCellAction {
127
+ constructor() {
128
+ super({
129
+ id: 'notebook.cell.focusNextChatWidget',
130
+ title: ( localizeWithPath(
131
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
132
+ 'focusNextChatWidget',
133
+ 'Focus Next Cell Chat Widget'
134
+ )),
135
+ keybinding: {
136
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.and(( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus, ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top')), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')))), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
137
+ weight: 0 + 7,
138
+ primary: 2048 | 18
139
+ }
140
+ });
141
+ }
142
+ async runWithContext(accessor, context) {
143
+ const index = context.notebookEditor.getCellIndex(context.cell);
144
+ await NotebookChatController.get(context.notebookEditor)?.focusNearestWidget(index, 'below');
145
+ }
146
+ });
147
+ registerAction2(class extends NotebookAction {
148
+ constructor() {
149
+ super({
150
+ id: 'notebook.cell.chat.stop',
151
+ title: ( localize2WithPath(
152
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
153
+ 'notebook.cell.chat.stop',
154
+ "Stop Request"
155
+ )),
156
+ icon: Codicon.debugStop,
157
+ menu: {
158
+ id: MENU_CELL_CHAT_INPUT,
159
+ group: 'main',
160
+ order: 1,
161
+ when: CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST
162
+ }
163
+ });
164
+ }
165
+ async runWithContext(accessor, context) {
166
+ NotebookChatController.get(context.notebookEditor)?.cancelCurrentRequest(false);
167
+ }
168
+ });
169
+ registerAction2(class extends NotebookAction {
170
+ constructor() {
171
+ super({
172
+ id: 'notebook.cell.chat.close',
173
+ title: ( localize2WithPath(
174
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
175
+ 'notebook.cell.chat.close',
176
+ "Close Chat"
177
+ )),
178
+ icon: Codicon.close,
179
+ menu: {
180
+ id: MENU_CELL_CHAT_WIDGET,
181
+ group: 'main',
182
+ order: 2
183
+ }
184
+ });
185
+ }
186
+ async runWithContext(accessor, context) {
187
+ NotebookChatController.get(context.notebookEditor)?.dismiss();
188
+ }
189
+ });
190
+ registerAction2(class extends NotebookAction {
191
+ constructor() {
192
+ super({
193
+ id: 'notebook.cell.chat.acceptChanges',
194
+ title: ( localize2WithPath(
195
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
196
+ 'apply1',
197
+ "Accept Changes"
198
+ )),
199
+ shortTitle: ( localizeWithPath(
200
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
201
+ 'apply2',
202
+ 'Accept'
203
+ )),
204
+ icon: Codicon.check,
205
+ tooltip: ( localizeWithPath(
206
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
207
+ 'apply3',
208
+ 'Accept Changes'
209
+ )),
210
+ keybinding: [
211
+ {
212
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
213
+ weight: 100 + 10,
214
+ primary: 2048 | 3 ,
215
+ },
216
+ {
217
+ when: ( ContextKeyExpr.and(
218
+ CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
219
+ CTX_INLINE_CHAT_FOCUSED,
220
+ CTX_NOTEBOOK_CHAT_USER_DID_EDIT
221
+ )),
222
+ weight: 0 + 10,
223
+ primary: 9
224
+ },
225
+ {
226
+ when: ( ContextKeyExpr.and(
227
+ NOTEBOOK_EDITOR_FOCUSED,
228
+ ContextKeyExpr.not(InputFocusedContextKey),
229
+ ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('below'))
230
+ )),
231
+ primary: 2048 | 3 ,
232
+ weight: 200
233
+ }
234
+ ],
235
+ menu: [
236
+ {
237
+ id: MENU_CELL_CHAT_WIDGET_STATUS,
238
+ group: 'inline',
239
+ order: 0,
240
+ when: ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" )),
241
+ }
242
+ ]
243
+ });
244
+ }
245
+ async runWithContext(accessor, context) {
246
+ NotebookChatController.get(context.notebookEditor)?.acceptSession();
247
+ }
248
+ });
249
+ registerAction2(class extends NotebookAction {
250
+ constructor() {
251
+ super({
252
+ id: 'notebook.cell.chat.discard',
253
+ title: ( localizeWithPath(
254
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
255
+ 'discard',
256
+ 'Discard'
257
+ )),
258
+ icon: Codicon.discard,
259
+ keybinding: {
260
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( CTX_NOTEBOOK_CHAT_USER_DID_EDIT.negate()))),
261
+ weight: 100 ,
262
+ primary: 9
263
+ },
264
+ menu: {
265
+ id: MENU_CELL_CHAT_WIDGET_STATUS,
266
+ group: 'main',
267
+ order: 1
268
+ }
269
+ });
270
+ }
271
+ async runWithContext(accessor, context) {
272
+ NotebookChatController.get(context.notebookEditor)?.discard();
273
+ }
274
+ });
275
+ registerAction2(class extends NotebookAction {
276
+ constructor() {
277
+ super({
278
+ id: 'notebook.cell.feedbackHelpful',
279
+ title: ( localizeWithPath(
280
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
281
+ 'feedback.helpful',
282
+ 'Helpful'
283
+ )),
284
+ icon: Codicon.thumbsup,
285
+ menu: {
286
+ id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
287
+ group: 'inline',
288
+ order: 1,
289
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
290
+ }
291
+ });
292
+ }
293
+ async runWithContext(accessor, context) {
294
+ NotebookChatController.get(context.notebookEditor)?.feedbackLast(1 );
295
+ }
296
+ });
297
+ registerAction2(class extends NotebookAction {
298
+ constructor() {
299
+ super({
300
+ id: 'notebook.cell.feedbackUnhelpful',
301
+ title: ( localizeWithPath(
302
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
303
+ 'feedback.unhelpful',
304
+ 'Unhelpful'
305
+ )),
306
+ icon: Codicon.thumbsdown,
307
+ menu: {
308
+ id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
309
+ group: 'inline',
310
+ order: 2,
311
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
312
+ }
313
+ });
314
+ }
315
+ async runWithContext(accessor, context) {
316
+ NotebookChatController.get(context.notebookEditor)?.feedbackLast(0 );
317
+ }
318
+ });
319
+ registerAction2(class extends NotebookAction {
320
+ constructor() {
321
+ super({
322
+ id: 'notebook.cell.reportIssueForBug',
323
+ title: ( localizeWithPath(
324
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
325
+ 'feedback.reportIssueForBug',
326
+ 'Report Issue'
327
+ )),
328
+ icon: Codicon.report,
329
+ menu: {
330
+ id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
331
+ group: 'inline',
332
+ order: 3,
333
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
334
+ }
335
+ });
336
+ }
337
+ async runWithContext(accessor, context) {
338
+ NotebookChatController.get(context.notebookEditor)?.feedbackLast(4 );
339
+ }
340
+ });
341
+ registerAction2(class extends NotebookAction {
342
+ constructor() {
343
+ super({
344
+ id: 'notebook.cell.insertCodeCellWithChat',
345
+ title: {
346
+ value: '$(sparkle) ' + ( localizeWithPath(
347
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
348
+ 'notebookActions.menu.insertCodeCellWithChat',
349
+ "Generate"
350
+ )),
351
+ original: '$(sparkle) Generate',
352
+ },
353
+ tooltip: ( localizeWithPath(
354
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
355
+ 'notebookActions.menu.insertCodeCellWithChat.tooltip',
356
+ "Generate Code Cell with Chat"
357
+ )),
358
+ metadata: {
359
+ description: ( localizeWithPath(
360
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
361
+ 'notebookActions.menu.insertCodeCellWithChat.tooltip',
362
+ "Generate Code Cell with Chat"
363
+ )),
364
+ args: [
365
+ {
366
+ name: 'args',
367
+ schema: {
368
+ type: 'object',
369
+ required: ['index'],
370
+ properties: {
371
+ 'index': {
372
+ type: 'number'
373
+ },
374
+ 'input': {
375
+ type: 'string'
376
+ },
377
+ 'autoSend': {
378
+ type: 'boolean'
379
+ }
380
+ }
381
+ }
382
+ }
383
+ ]
384
+ },
385
+ f1: false,
386
+ menu: [
387
+ {
388
+ id: MenuId.NotebookCellBetween,
389
+ group: 'inline',
390
+ order: -1,
391
+ when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_INLINE_CHAT_HAS_PROVIDER, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true))))
392
+ }
393
+ ]
394
+ });
395
+ }
396
+ getEditorContextFromArgsOrActive(accessor, ...args) {
397
+ const [firstArg] = args;
398
+ if (!firstArg) {
399
+ const notebookEditor = getEditorFromArgsOrActivePane(accessor);
400
+ if (!notebookEditor) {
401
+ return undefined;
402
+ }
403
+ const activeCell = notebookEditor.getActiveCell();
404
+ if (!activeCell) {
405
+ return undefined;
406
+ }
407
+ return {
408
+ cell: activeCell,
409
+ notebookEditor,
410
+ input: undefined,
411
+ autoSend: undefined
412
+ };
413
+ }
414
+ if (typeof firstArg !== 'object' || typeof firstArg.index !== 'number') {
415
+ return undefined;
416
+ }
417
+ const notebookEditor = getEditorFromArgsOrActivePane(accessor);
418
+ if (!notebookEditor) {
419
+ return undefined;
420
+ }
421
+ const cell = firstArg.index <= 0 ? undefined : notebookEditor.cellAt(firstArg.index - 1);
422
+ return {
423
+ cell,
424
+ notebookEditor,
425
+ input: firstArg.input,
426
+ autoSend: firstArg.autoSend
427
+ };
428
+ }
429
+ async runWithContext(accessor, context) {
430
+ const index = Math.max(0, context.cell ? context.notebookEditor.getCellIndex(context.cell) + 1 : 0);
431
+ context.notebookEditor.focusContainer();
432
+ NotebookChatController.get(context.notebookEditor)?.run(index, context.input, context.autoSend);
433
+ }
434
+ });
435
+ registerAction2(class extends NotebookAction {
436
+ constructor() {
437
+ super({
438
+ id: 'notebook.cell.insertCodeCellWithChatAtTop',
439
+ title: {
440
+ value: '$(sparkle) ' + ( localizeWithPath(
441
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
442
+ 'notebookActions.menu.insertCodeCellWithChat',
443
+ "Generate"
444
+ )),
445
+ original: '$(sparkle) Generate',
446
+ },
447
+ tooltip: ( localizeWithPath(
448
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
449
+ 'notebookActions.menu.insertCodeCellWithChat.tooltip',
450
+ "Generate Code Cell with Chat"
451
+ )),
452
+ f1: false,
453
+ menu: [
454
+ {
455
+ id: MenuId.NotebookCellListTop,
456
+ group: 'inline',
457
+ order: -1,
458
+ when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_INLINE_CHAT_HAS_PROVIDER, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true))))
459
+ },
460
+ ]
461
+ });
462
+ }
463
+ async runWithContext(accessor, context) {
464
+ context.notebookEditor.focusContainer();
465
+ NotebookChatController.get(context.notebookEditor)?.run(0, '', false);
466
+ }
467
+ });
468
+ MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
469
+ command: {
470
+ id: 'notebook.cell.insertCodeCellWithChat',
471
+ icon: Codicon.sparkle,
472
+ title: ( localizeWithPath(
473
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
474
+ 'notebookActions.menu.insertCode.ontoolbar',
475
+ "Generate"
476
+ )),
477
+ tooltip: ( localizeWithPath(
478
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
479
+ 'notebookActions.menu.insertCode.tooltip',
480
+ "Generate Code Cell with Chat"
481
+ ))
482
+ },
483
+ order: -10,
484
+ group: 'navigation/add',
485
+ when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'betweenCells')), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'hidden')), CTX_INLINE_CHAT_HAS_PROVIDER, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true))))
486
+ });
487
+ registerAction2(class extends NotebookAction {
488
+ constructor() {
489
+ super({
490
+ id: 'notebook.cell.chat.focus',
491
+ title: ( localizeWithPath(
492
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
493
+ 'focusNotebookChat',
494
+ 'Focus Chat'
495
+ )),
496
+ keybinding: [
497
+ {
498
+ when: ( ContextKeyExpr.and(
499
+ NOTEBOOK_EDITOR_FOCUSED,
500
+ ContextKeyExpr.not(InputFocusedContextKey),
501
+ ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('above'))
502
+ )),
503
+ primary: 2048 | 18 ,
504
+ weight: 200
505
+ },
506
+ {
507
+ when: ( ContextKeyExpr.and(
508
+ NOTEBOOK_EDITOR_FOCUSED,
509
+ ContextKeyExpr.not(InputFocusedContextKey),
510
+ ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('below'))
511
+ )),
512
+ primary: 2048 | 16 ,
513
+ weight: 200
514
+ }
515
+ ],
516
+ });
517
+ }
518
+ async runWithContext(accessor, context) {
519
+ NotebookChatController.get(context.notebookEditor)?.focus();
520
+ }
521
+ });
522
+ registerAction2(class extends NotebookAction {
523
+ constructor() {
524
+ super({
525
+ id: 'notebook.cell.chat.focusNextCell',
526
+ title: ( localizeWithPath(
527
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
528
+ 'focusNextCell',
529
+ 'Focus Next Cell'
530
+ )),
531
+ keybinding: [
532
+ {
533
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
534
+ primary: 2048 | 18 ,
535
+ weight: 200
536
+ }
537
+ ],
538
+ });
539
+ }
540
+ async runWithContext(accessor, context) {
541
+ NotebookChatController.get(context.notebookEditor)?.focusNext();
542
+ }
543
+ });
544
+ registerAction2(class extends NotebookAction {
545
+ constructor() {
546
+ super({
547
+ id: 'notebook.cell.chat.focusPreviousCell',
548
+ title: ( localizeWithPath(
549
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
550
+ 'focusPreviousCell',
551
+ 'Focus Previous Cell'
552
+ )),
553
+ keybinding: [
554
+ {
555
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
556
+ primary: 2048 | 16 ,
557
+ weight: 200
558
+ }
559
+ ],
560
+ });
561
+ }
562
+ async runWithContext(accessor, context) {
563
+ NotebookChatController.get(context.notebookEditor)?.focusAbove();
564
+ }
565
+ });
@@ -0,0 +1,31 @@
1
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
+ import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
+ import { RawContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
4
+
5
+ const CTX_NOTEBOOK_CELL_CHAT_FOCUSED = ( new RawContextKey('notebookCellChatFocused', false, ( localizeWithPath(
6
+ 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext',
7
+ 'notebookCellChatFocused',
8
+ "Whether the cell chat editor is focused"
9
+ ))));
10
+ const CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST = ( new RawContextKey('notebookChatHasActiveRequest', false, ( localizeWithPath(
11
+ 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext',
12
+ 'notebookChatHasActiveRequest',
13
+ "Whether the cell chat editor has an active request"
14
+ ))));
15
+ const CTX_NOTEBOOK_CHAT_USER_DID_EDIT = ( new RawContextKey('notebookChatUserDidEdit', false, ( localizeWithPath(
16
+ 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext',
17
+ 'notebookChatUserDidEdit',
18
+ "Whether the user did changes ontop of the notebook cell chat"
19
+ ))));
20
+ const CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION = ( new RawContextKey('notebookChatOuterFocusPosition', '', ( localizeWithPath(
21
+ 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext',
22
+ 'notebookChatOuterFocusPosition',
23
+ "Whether the focus of the notebook editor is above or below the cell chat"
24
+ ))));
25
+ const MENU_CELL_CHAT_INPUT = MenuId.for('cellChatInput');
26
+ const MENU_CELL_CHAT_WIDGET = MenuId.for('cellChatWidget');
27
+ const MENU_CELL_CHAT_WIDGET_STATUS = MenuId.for('cellChatWidget.status');
28
+ const MENU_CELL_CHAT_WIDGET_FEEDBACK = MenuId.for('cellChatWidget.feedback');
29
+ MenuId.for('cellChatWidget.toolbar');
30
+
31
+ export { CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST, CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION, CTX_NOTEBOOK_CHAT_USER_DID_EDIT, MENU_CELL_CHAT_INPUT, MENU_CELL_CHAT_WIDGET, MENU_CELL_CHAT_WIDGET_FEEDBACK, MENU_CELL_CHAT_WIDGET_STATUS };