@codingame/monaco-vscode-notebook-service-override 4.1.0 → 4.1.2

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 (77) hide show
  1. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/notebook.js +12 -12
  4. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  5. package/package.json +2 -2
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +391 -0
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +544 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +320 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +84 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +101 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +393 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +97 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +120 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +60 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +150 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +656 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +77 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +517 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +159 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +56 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +652 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +721 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +315 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +47 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +115 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +911 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +395 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +185 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1187 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +451 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +192 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +510 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +130 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +341 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +641 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +90 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1002 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +203 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +386 -0
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +408 -0
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
@@ -0,0 +1,652 @@
1
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
2
+ import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
3
+ import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
4
+ import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
5
+ import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
6
+ import { registerAction2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
7
+ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
8
+ import { InputFocusedContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
9
+ 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';
10
+ 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 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
11
+ import { NotebookChatController } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController';
12
+ import { NotebookAction, NotebookCellAction, getEditorFromArgsOrActivePane, CELL_TITLE_CELL_GROUP_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
13
+ import { CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
14
+ import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
15
+ import { NOTEBOOK_CELL_EDITOR_FOCUSED, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_GENERATED_BY_CHAT } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
16
+
17
+ registerAction2(class extends NotebookAction {
18
+ constructor() {
19
+ super({
20
+ id: 'notebook.cell.chat.accept',
21
+ title: ( localize2WithPath(
22
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
23
+ 'notebook.cell.chat.accept',
24
+ "Make Request"
25
+ )),
26
+ icon: Codicon.send,
27
+ keybinding: {
28
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()))),
29
+ weight: 200 ,
30
+ primary: 3
31
+ },
32
+ menu: {
33
+ id: MENU_CELL_CHAT_INPUT,
34
+ group: 'navigation',
35
+ order: 1,
36
+ when: ( CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST.negate())
37
+ }
38
+ });
39
+ }
40
+ async runWithContext(accessor, context) {
41
+ NotebookChatController.get(context.notebookEditor)?.acceptInput();
42
+ }
43
+ });
44
+ registerAction2(class extends NotebookCellAction {
45
+ constructor() {
46
+ super({
47
+ id: 'notebook.cell.chat.arrowOutUp',
48
+ title: ( localizeWithPath(
49
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
50
+ 'arrowUp',
51
+ 'Cursor Up'
52
+ )),
53
+ keybinding: {
54
+ when: ( ContextKeyExpr.and(
55
+ CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
56
+ CTX_INLINE_CHAT_FOCUSED,
57
+ CTX_INLINE_CHAT_INNER_CURSOR_FIRST,
58
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()),
59
+ ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
60
+ )),
61
+ weight: 0 + 7,
62
+ primary: 2048 | 16
63
+ }
64
+ });
65
+ }
66
+ async runWithContext(accessor, context) {
67
+ const editor = context.notebookEditor;
68
+ const activeCell = context.cell;
69
+ const idx = editor.getCellIndex(activeCell);
70
+ if (typeof idx !== 'number') {
71
+ return;
72
+ }
73
+ if (idx < 1 || editor.getLength() === 0) {
74
+ return;
75
+ }
76
+ const newCell = editor.cellAt(idx - 1);
77
+ const newFocusMode = newCell.cellKind === CellKind.Markup && newCell.getEditState() === CellEditState.Preview ? 'container' : 'editor';
78
+ const focusEditorLine = newCell.textBuffer.getLineCount();
79
+ await editor.focusNotebookCell(newCell, newFocusMode, { focusEditorLine: focusEditorLine });
80
+ }
81
+ });
82
+ registerAction2(class extends NotebookAction {
83
+ constructor() {
84
+ super({
85
+ id: 'notebook.cell.chat.arrowOutDown',
86
+ title: ( localizeWithPath(
87
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
88
+ 'arrowDown',
89
+ 'Cursor Down'
90
+ )),
91
+ keybinding: {
92
+ when: ( ContextKeyExpr.and(
93
+ CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
94
+ CTX_INLINE_CHAT_FOCUSED,
95
+ CTX_INLINE_CHAT_INNER_CURSOR_LAST,
96
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()),
97
+ ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
98
+ )),
99
+ weight: 0 + 7,
100
+ primary: 2048 | 18
101
+ }
102
+ });
103
+ }
104
+ async runWithContext(accessor, context) {
105
+ await NotebookChatController.get(context.notebookEditor)?.focusNext();
106
+ }
107
+ });
108
+ registerAction2(class extends NotebookCellAction {
109
+ constructor() {
110
+ super({
111
+ id: 'notebook.cell.focusChatWidget',
112
+ title: ( localizeWithPath(
113
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
114
+ 'focusChatWidget',
115
+ 'Focus Chat Widget'
116
+ )),
117
+ keybinding: {
118
+ 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()))),
119
+ weight: 0 + 7,
120
+ primary: 2048 | 16
121
+ }
122
+ });
123
+ }
124
+ async runWithContext(accessor, context) {
125
+ const index = context.notebookEditor.getCellIndex(context.cell);
126
+ await NotebookChatController.get(context.notebookEditor)?.focusNearestWidget(index, 'above');
127
+ }
128
+ });
129
+ registerAction2(class extends NotebookCellAction {
130
+ constructor() {
131
+ super({
132
+ id: 'notebook.cell.focusNextChatWidget',
133
+ title: ( localizeWithPath(
134
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
135
+ 'focusNextChatWidget',
136
+ 'Focus Next Cell Chat Widget'
137
+ )),
138
+ keybinding: {
139
+ 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()))),
140
+ weight: 0 + 7,
141
+ primary: 2048 | 18
142
+ }
143
+ });
144
+ }
145
+ async runWithContext(accessor, context) {
146
+ const index = context.notebookEditor.getCellIndex(context.cell);
147
+ await NotebookChatController.get(context.notebookEditor)?.focusNearestWidget(index, 'below');
148
+ }
149
+ });
150
+ registerAction2(class extends NotebookAction {
151
+ constructor() {
152
+ super({
153
+ id: 'notebook.cell.chat.stop',
154
+ title: ( localize2WithPath(
155
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
156
+ 'notebook.cell.chat.stop',
157
+ "Stop Request"
158
+ )),
159
+ icon: Codicon.debugStop,
160
+ menu: {
161
+ id: MENU_CELL_CHAT_INPUT,
162
+ group: 'navigation',
163
+ order: 1,
164
+ when: CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST
165
+ }
166
+ });
167
+ }
168
+ async runWithContext(accessor, context) {
169
+ NotebookChatController.get(context.notebookEditor)?.cancelCurrentRequest(false);
170
+ }
171
+ });
172
+ registerAction2(class extends NotebookAction {
173
+ constructor() {
174
+ super({
175
+ id: 'notebook.cell.chat.close',
176
+ title: ( localize2WithPath(
177
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
178
+ 'notebook.cell.chat.close',
179
+ "Close Chat"
180
+ )),
181
+ icon: Codicon.close,
182
+ menu: {
183
+ id: MENU_CELL_CHAT_WIDGET,
184
+ group: 'navigation',
185
+ order: 2
186
+ }
187
+ });
188
+ }
189
+ async runWithContext(accessor, context) {
190
+ NotebookChatController.get(context.notebookEditor)?.dismiss(false);
191
+ }
192
+ });
193
+ registerAction2(class extends NotebookAction {
194
+ constructor() {
195
+ super({
196
+ id: 'notebook.cell.chat.acceptChanges',
197
+ title: ( localize2WithPath(
198
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
199
+ 'apply1',
200
+ "Accept Changes"
201
+ )),
202
+ shortTitle: ( localizeWithPath(
203
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
204
+ 'apply2',
205
+ 'Accept'
206
+ )),
207
+ icon: Codicon.check,
208
+ tooltip: ( localizeWithPath(
209
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
210
+ 'apply3',
211
+ 'Accept Changes'
212
+ )),
213
+ keybinding: [
214
+ {
215
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()))),
216
+ weight: 100 + 10,
217
+ primary: 2048 | 3 ,
218
+ },
219
+ {
220
+ when: ( ContextKeyExpr.and(
221
+ CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
222
+ CTX_INLINE_CHAT_FOCUSED,
223
+ CTX_NOTEBOOK_CHAT_USER_DID_EDIT,
224
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate())
225
+ )),
226
+ weight: 0 + 10,
227
+ primary: 9
228
+ },
229
+ {
230
+ when: ( ContextKeyExpr.and(
231
+ NOTEBOOK_EDITOR_FOCUSED,
232
+ ContextKeyExpr.not(InputFocusedContextKey),
233
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()),
234
+ ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('below'))
235
+ )),
236
+ primary: 2048 | 3 ,
237
+ weight: 200
238
+ }
239
+ ],
240
+ menu: [
241
+ {
242
+ id: MENU_CELL_CHAT_WIDGET_STATUS,
243
+ group: 'inline',
244
+ order: 0,
245
+ when: ( CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo("onlyMessages" )),
246
+ }
247
+ ]
248
+ });
249
+ }
250
+ async runWithContext(accessor, context) {
251
+ NotebookChatController.get(context.notebookEditor)?.acceptSession();
252
+ }
253
+ });
254
+ registerAction2(class extends NotebookAction {
255
+ constructor() {
256
+ super({
257
+ id: 'notebook.cell.chat.discard',
258
+ title: ( localizeWithPath(
259
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
260
+ 'discard',
261
+ 'Discard'
262
+ )),
263
+ icon: Codicon.discard,
264
+ keybinding: {
265
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( CTX_NOTEBOOK_CHAT_USER_DID_EDIT.negate()), ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()))),
266
+ weight: 100 ,
267
+ primary: 9
268
+ },
269
+ menu: {
270
+ id: MENU_CELL_CHAT_WIDGET_STATUS,
271
+ group: 'main',
272
+ order: 1
273
+ }
274
+ });
275
+ }
276
+ async runWithContext(accessor, context) {
277
+ NotebookChatController.get(context.notebookEditor)?.discard();
278
+ }
279
+ });
280
+ registerAction2(class extends NotebookAction {
281
+ constructor() {
282
+ super({
283
+ id: 'notebook.cell.feedbackHelpful',
284
+ title: ( localizeWithPath(
285
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
286
+ 'feedback.helpful',
287
+ 'Helpful'
288
+ )),
289
+ icon: Codicon.thumbsup,
290
+ menu: {
291
+ id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
292
+ group: 'inline',
293
+ order: 1,
294
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
295
+ }
296
+ });
297
+ }
298
+ async runWithContext(accessor, context) {
299
+ NotebookChatController.get(context.notebookEditor)?.feedbackLast(1 );
300
+ }
301
+ });
302
+ registerAction2(class extends NotebookAction {
303
+ constructor() {
304
+ super({
305
+ id: 'notebook.cell.feedbackUnhelpful',
306
+ title: ( localizeWithPath(
307
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
308
+ 'feedback.unhelpful',
309
+ 'Unhelpful'
310
+ )),
311
+ icon: Codicon.thumbsdown,
312
+ menu: {
313
+ id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
314
+ group: 'inline',
315
+ order: 2,
316
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
317
+ }
318
+ });
319
+ }
320
+ async runWithContext(accessor, context) {
321
+ NotebookChatController.get(context.notebookEditor)?.feedbackLast(0 );
322
+ }
323
+ });
324
+ registerAction2(class extends NotebookAction {
325
+ constructor() {
326
+ super({
327
+ id: 'notebook.cell.reportIssueForBug',
328
+ title: ( localizeWithPath(
329
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
330
+ 'feedback.reportIssueForBug',
331
+ 'Report Issue'
332
+ )),
333
+ icon: Codicon.report,
334
+ menu: {
335
+ id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
336
+ group: 'inline',
337
+ order: 3,
338
+ when: ( CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined)),
339
+ }
340
+ });
341
+ }
342
+ async runWithContext(accessor, context) {
343
+ NotebookChatController.get(context.notebookEditor)?.feedbackLast(4 );
344
+ }
345
+ });
346
+ registerAction2(class extends NotebookAction {
347
+ constructor() {
348
+ super({
349
+ id: 'notebook.cell.chat.start',
350
+ title: {
351
+ value: '$(sparkle) ' + ( localizeWithPath(
352
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
353
+ 'notebookActions.menu.insertCodeCellWithChat',
354
+ "Generate"
355
+ )),
356
+ original: '$(sparkle) Generate',
357
+ },
358
+ tooltip: ( localizeWithPath(
359
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
360
+ 'notebookActions.menu.insertCodeCellWithChat.tooltip',
361
+ "Start Chat to Generate Code"
362
+ )),
363
+ metadata: {
364
+ description: ( localizeWithPath(
365
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
366
+ 'notebookActions.menu.insertCodeCellWithChat.tooltip',
367
+ "Start Chat to Generate Code"
368
+ )),
369
+ args: [
370
+ {
371
+ name: 'args',
372
+ schema: {
373
+ type: 'object',
374
+ required: ['index'],
375
+ properties: {
376
+ 'index': {
377
+ type: 'number'
378
+ },
379
+ 'input': {
380
+ type: 'string'
381
+ },
382
+ 'autoSend': {
383
+ type: 'boolean'
384
+ }
385
+ }
386
+ }
387
+ }
388
+ ]
389
+ },
390
+ f1: false,
391
+ keybinding: {
392
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ContextKeyExpr.not(InputFocusedContextKey), CTX_INLINE_CHAT_HAS_PROVIDER, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)))),
393
+ weight: 200 ,
394
+ primary: 2048 | 39 ,
395
+ secondary: [KeyChord(2048 | 41 , 39 )],
396
+ },
397
+ menu: [
398
+ {
399
+ id: MenuId.NotebookCellBetween,
400
+ group: 'inline',
401
+ order: -1,
402
+ when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_INLINE_CHAT_HAS_PROVIDER, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true))))
403
+ }
404
+ ]
405
+ });
406
+ }
407
+ getEditorContextFromArgsOrActive(accessor, ...args) {
408
+ const [firstArg] = args;
409
+ if (!firstArg) {
410
+ const notebookEditor = getEditorFromArgsOrActivePane(accessor);
411
+ if (!notebookEditor) {
412
+ return undefined;
413
+ }
414
+ const activeCell = notebookEditor.getActiveCell();
415
+ if (!activeCell) {
416
+ return undefined;
417
+ }
418
+ return {
419
+ cell: activeCell,
420
+ notebookEditor,
421
+ input: undefined,
422
+ autoSend: undefined
423
+ };
424
+ }
425
+ if (typeof firstArg !== 'object' || typeof firstArg.index !== 'number') {
426
+ return undefined;
427
+ }
428
+ const notebookEditor = getEditorFromArgsOrActivePane(accessor);
429
+ if (!notebookEditor) {
430
+ return undefined;
431
+ }
432
+ const cell = firstArg.index <= 0 ? undefined : notebookEditor.cellAt(firstArg.index - 1);
433
+ return {
434
+ cell,
435
+ notebookEditor,
436
+ input: firstArg.input,
437
+ autoSend: firstArg.autoSend
438
+ };
439
+ }
440
+ async runWithContext(accessor, context) {
441
+ const index = Math.max(0, context.cell ? context.notebookEditor.getCellIndex(context.cell) + 1 : 0);
442
+ context.notebookEditor.focusContainer();
443
+ NotebookChatController.get(context.notebookEditor)?.run(index, context.input, context.autoSend);
444
+ }
445
+ });
446
+ registerAction2(class extends NotebookAction {
447
+ constructor() {
448
+ super({
449
+ id: 'notebook.cell.chat.startAtTop',
450
+ title: {
451
+ value: '$(sparkle) ' + ( localizeWithPath(
452
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
453
+ 'notebookActions.menu.insertCodeCellWithChat',
454
+ "Generate"
455
+ )),
456
+ original: '$(sparkle) Generate',
457
+ },
458
+ tooltip: ( localizeWithPath(
459
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
460
+ 'notebookActions.menu.insertCodeCellWithChat.tooltip',
461
+ "Start Chat to Generate Code"
462
+ )),
463
+ f1: false,
464
+ menu: [
465
+ {
466
+ id: MenuId.NotebookCellListTop,
467
+ group: 'inline',
468
+ order: -1,
469
+ when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_INLINE_CHAT_HAS_PROVIDER, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true))))
470
+ },
471
+ ]
472
+ });
473
+ }
474
+ async runWithContext(accessor, context) {
475
+ context.notebookEditor.focusContainer();
476
+ NotebookChatController.get(context.notebookEditor)?.run(0, '', false);
477
+ }
478
+ });
479
+ MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
480
+ command: {
481
+ id: 'notebook.cell.chat.start',
482
+ icon: Codicon.sparkle,
483
+ title: ( localizeWithPath(
484
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
485
+ 'notebookActions.menu.insertCode.ontoolbar',
486
+ "Generate"
487
+ )),
488
+ tooltip: ( localizeWithPath(
489
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
490
+ 'notebookActions.menu.insertCode.tooltip',
491
+ "Start Chat to Generate Code"
492
+ ))
493
+ },
494
+ order: -10,
495
+ group: 'navigation/add',
496
+ 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))))
497
+ });
498
+ registerAction2(class extends NotebookAction {
499
+ constructor() {
500
+ super({
501
+ id: 'notebook.cell.chat.focus',
502
+ title: ( localizeWithPath(
503
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
504
+ 'focusNotebookChat',
505
+ 'Focus Chat'
506
+ )),
507
+ keybinding: [
508
+ {
509
+ when: ( ContextKeyExpr.and(
510
+ NOTEBOOK_EDITOR_FOCUSED,
511
+ ContextKeyExpr.not(InputFocusedContextKey),
512
+ ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('above'))
513
+ )),
514
+ primary: 2048 | 18 ,
515
+ weight: 200
516
+ },
517
+ {
518
+ when: ( ContextKeyExpr.and(
519
+ NOTEBOOK_EDITOR_FOCUSED,
520
+ ContextKeyExpr.not(InputFocusedContextKey),
521
+ ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('below'))
522
+ )),
523
+ primary: 2048 | 16 ,
524
+ weight: 200
525
+ }
526
+ ],
527
+ });
528
+ }
529
+ async runWithContext(accessor, context) {
530
+ NotebookChatController.get(context.notebookEditor)?.focus();
531
+ }
532
+ });
533
+ registerAction2(class extends NotebookAction {
534
+ constructor() {
535
+ super({
536
+ id: 'notebook.cell.chat.focusNextCell',
537
+ title: ( localizeWithPath(
538
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
539
+ 'focusNextCell',
540
+ 'Focus Next Cell'
541
+ )),
542
+ keybinding: [
543
+ {
544
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
545
+ primary: 2048 | 18 ,
546
+ weight: 200
547
+ }
548
+ ],
549
+ });
550
+ }
551
+ async runWithContext(accessor, context) {
552
+ NotebookChatController.get(context.notebookEditor)?.focusNext();
553
+ }
554
+ });
555
+ registerAction2(class extends NotebookAction {
556
+ constructor() {
557
+ super({
558
+ id: 'notebook.cell.chat.focusPreviousCell',
559
+ title: ( localizeWithPath(
560
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
561
+ 'focusPreviousCell',
562
+ 'Focus Previous Cell'
563
+ )),
564
+ keybinding: [
565
+ {
566
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
567
+ primary: 2048 | 16 ,
568
+ weight: 200
569
+ }
570
+ ],
571
+ });
572
+ }
573
+ async runWithContext(accessor, context) {
574
+ NotebookChatController.get(context.notebookEditor)?.focusAbove();
575
+ }
576
+ });
577
+ registerAction2(class extends NotebookAction {
578
+ constructor() {
579
+ super({
580
+ id: 'notebook.cell.chat.previousFromHistory',
581
+ title: ( localize2WithPath(
582
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
583
+ 'notebook.cell.chat.previousFromHistory',
584
+ "Previous From History"
585
+ )),
586
+ precondition: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
587
+ keybinding: {
588
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
589
+ weight: 0 + 10,
590
+ primary: 16 ,
591
+ }
592
+ });
593
+ }
594
+ async runWithContext(accessor, context) {
595
+ NotebookChatController.get(context.notebookEditor)?.populateHistory(true);
596
+ }
597
+ });
598
+ registerAction2(class extends NotebookAction {
599
+ constructor() {
600
+ super({
601
+ id: 'notebook.cell.chat.nextFromHistory',
602
+ title: ( localize2WithPath(
603
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
604
+ 'notebook.cell.chat.nextFromHistory',
605
+ "Next From History"
606
+ )),
607
+ precondition: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
608
+ keybinding: {
609
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
610
+ weight: 0 + 10,
611
+ primary: 18
612
+ }
613
+ });
614
+ }
615
+ async runWithContext(accessor, context) {
616
+ NotebookChatController.get(context.notebookEditor)?.populateHistory(false);
617
+ }
618
+ });
619
+ registerAction2(class extends NotebookCellAction {
620
+ constructor() {
621
+ super({
622
+ id: 'notebook.cell.chat.restore',
623
+ title: ( localize2WithPath(
624
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
625
+ 'notebookActions.restoreCellprompt',
626
+ "Generate"
627
+ )),
628
+ icon: Codicon.sparkle,
629
+ menu: {
630
+ id: MenuId.NotebookCellTitle,
631
+ group: CELL_TITLE_CELL_GROUP_ID,
632
+ order: 0,
633
+ when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_INLINE_CHAT_HAS_PROVIDER, NOTEBOOK_CELL_GENERATED_BY_CHAT, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true))))
634
+ }
635
+ });
636
+ }
637
+ async runWithContext(accessor, context) {
638
+ const cell = context.cell;
639
+ if (!cell) {
640
+ return;
641
+ }
642
+ const notebookEditor = context.notebookEditor;
643
+ const controller = NotebookChatController.get(notebookEditor);
644
+ if (!controller) {
645
+ return;
646
+ }
647
+ const prompt = controller.getPromptFromCache(cell);
648
+ if (prompt) {
649
+ controller.restore(cell, prompt);
650
+ }
651
+ }
652
+ });