@codingame/monaco-vscode-notebook-service-override 3.2.3 → 4.0.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 (35) hide show
  1. package/notebook.js +1 -1
  2. package/override/vs/platform/dialogs/common/dialogs.js +2 -0
  3. package/package.json +2 -2
  4. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +9 -7
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +61 -5
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +11 -1
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +3 -3
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +9 -7
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +1 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +3 -1
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +293 -20
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +16 -10
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +107 -20
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +15 -1
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +1 -1
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +48 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +2 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +7 -7
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +7 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +47 -26
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +6 -4
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +11 -1
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +20 -7
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +1 -1
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +1 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +15 -5
  29. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +54 -55
  30. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +3 -2
  31. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +11 -1
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -31
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +0 -744
  35. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
@@ -1,608 +0,0 @@
1
- import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
2
- import { Mimes } from 'vscode/vscode/vs/base/common/mime';
3
- import { IBulkEditService, ResourceTextEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
4
- import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
5
- import { registerAction2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
6
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
- import { InputFocusedContext, InputFocusedContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
8
- import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
9
- import { moveCellRange, copyCellRange, computeCellLinesContents, joinCellsWithSurrounds, joinSelectedCells, changeCellToKind } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/cellOperations';
10
- import { NotebookCellAction, CELL_TITLE_CELL_GROUP_ID, NotebookMultiCellAction, parseMultiCellExecutionArgs, cellExecutionArgs } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
11
- import { CellFocusMode, EXPAND_CELL_INPUT_COMMAND_ID, EXPAND_CELL_OUTPUT_COMMAND_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
12
- import { NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE, NOTEBOOK_CELL_INPUT_COLLAPSED, NOTEBOOK_OUTPUT_FOCUSED, NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_TYPE, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_OUTPUT_COLLAPSED, NOTEBOOK_CELL_HAS_OUTPUTS } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
13
- import { moveUpIcon, moveDownIcon, splitCellIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
14
- import { CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
15
- import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
16
- import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
17
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
18
-
19
- const MOVE_CELL_UP_COMMAND_ID = 'notebook.cell.moveUp';
20
- const MOVE_CELL_DOWN_COMMAND_ID = 'notebook.cell.moveDown';
21
- const COPY_CELL_UP_COMMAND_ID = 'notebook.cell.copyUp';
22
- const COPY_CELL_DOWN_COMMAND_ID = 'notebook.cell.copyDown';
23
- registerAction2(class extends NotebookCellAction {
24
- constructor() {
25
- super({
26
- id: MOVE_CELL_UP_COMMAND_ID,
27
- title: ( localize2WithPath(
28
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
29
- 'notebookActions.moveCellUp',
30
- "Move Cell Up"
31
- )),
32
- icon: moveUpIcon,
33
- keybinding: {
34
- primary: 512 | 16 ,
35
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( InputFocusedContext.toNegated()))),
36
- weight: 200
37
- },
38
- menu: {
39
- id: MenuId.NotebookCellTitle,
40
- when: ( ContextKeyExpr.equals('config.notebook.dragAndDropEnabled', false)),
41
- group: "3_edit" ,
42
- order: 14
43
- }
44
- });
45
- }
46
- async runWithContext(accessor, context) {
47
- return moveCellRange(context, 'up');
48
- }
49
- });
50
- registerAction2(class extends NotebookCellAction {
51
- constructor() {
52
- super({
53
- id: MOVE_CELL_DOWN_COMMAND_ID,
54
- title: ( localize2WithPath(
55
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
56
- 'notebookActions.moveCellDown',
57
- "Move Cell Down"
58
- )),
59
- icon: moveDownIcon,
60
- keybinding: {
61
- primary: 512 | 18 ,
62
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( InputFocusedContext.toNegated()))),
63
- weight: 200
64
- },
65
- menu: {
66
- id: MenuId.NotebookCellTitle,
67
- when: ( ContextKeyExpr.equals('config.notebook.dragAndDropEnabled', false)),
68
- group: "3_edit" ,
69
- order: 14
70
- }
71
- });
72
- }
73
- async runWithContext(accessor, context) {
74
- return moveCellRange(context, 'down');
75
- }
76
- });
77
- registerAction2(class extends NotebookCellAction {
78
- constructor() {
79
- super({
80
- id: COPY_CELL_UP_COMMAND_ID,
81
- title: ( localize2WithPath(
82
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
83
- 'notebookActions.copyCellUp',
84
- "Copy Cell Up"
85
- )),
86
- keybinding: {
87
- primary: 512 | 1024 | 16 ,
88
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( InputFocusedContext.toNegated()))),
89
- weight: 200
90
- }
91
- });
92
- }
93
- async runWithContext(accessor, context) {
94
- return copyCellRange(context, 'up');
95
- }
96
- });
97
- registerAction2(class extends NotebookCellAction {
98
- constructor() {
99
- super({
100
- id: COPY_CELL_DOWN_COMMAND_ID,
101
- title: ( localize2WithPath(
102
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
103
- 'notebookActions.copyCellDown',
104
- "Copy Cell Down"
105
- )),
106
- keybinding: {
107
- primary: 512 | 1024 | 18 ,
108
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( InputFocusedContext.toNegated()))),
109
- weight: 200
110
- },
111
- menu: {
112
- id: MenuId.NotebookCellTitle,
113
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE)),
114
- group: "3_edit" ,
115
- order: 13
116
- }
117
- });
118
- }
119
- async runWithContext(accessor, context) {
120
- return copyCellRange(context, 'down');
121
- }
122
- });
123
- const SPLIT_CELL_COMMAND_ID = 'notebook.cell.split';
124
- const JOIN_SELECTED_CELLS_COMMAND_ID = 'notebook.cell.joinSelected';
125
- const JOIN_CELL_ABOVE_COMMAND_ID = 'notebook.cell.joinAbove';
126
- const JOIN_CELL_BELOW_COMMAND_ID = 'notebook.cell.joinBelow';
127
- registerAction2(class extends NotebookCellAction {
128
- constructor() {
129
- super({
130
- id: SPLIT_CELL_COMMAND_ID,
131
- title: ( localize2WithPath(
132
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
133
- 'notebookActions.splitCell',
134
- "Split Cell"
135
- )),
136
- menu: {
137
- id: MenuId.NotebookCellTitle,
138
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE, ( NOTEBOOK_CELL_INPUT_COLLAPSED.toNegated()))),
139
- order: 4 ,
140
- group: CELL_TITLE_CELL_GROUP_ID
141
- },
142
- icon: splitCellIcon,
143
- keybinding: {
144
- when: ( ContextKeyExpr.and(
145
- NOTEBOOK_EDITOR_FOCUSED,
146
- NOTEBOOK_EDITOR_EDITABLE,
147
- NOTEBOOK_CELL_EDITABLE,
148
- EditorContextKeys.editorTextFocus
149
- )),
150
- primary: KeyChord(2048 | 41 , 2048 | 1024 | 93 ),
151
- weight: 200
152
- },
153
- });
154
- }
155
- async runWithContext(accessor, context) {
156
- if (context.notebookEditor.isReadOnly) {
157
- return;
158
- }
159
- const bulkEditService = accessor.get(IBulkEditService);
160
- const cell = context.cell;
161
- const index = context.notebookEditor.getCellIndex(cell);
162
- const splitPoints = cell.focusMode === CellFocusMode.Container ? [{ lineNumber: 1, column: 1 }] : cell.getSelectionsStartPosition();
163
- if (splitPoints && splitPoints.length > 0) {
164
- await cell.resolveTextModel();
165
- if (!cell.hasModel()) {
166
- return;
167
- }
168
- const newLinesContents = computeCellLinesContents(cell, splitPoints);
169
- if (newLinesContents) {
170
- const language = cell.language;
171
- const kind = cell.cellKind;
172
- const mime = cell.mime;
173
- const textModel = await cell.resolveTextModel();
174
- await bulkEditService.apply([
175
- ( new ResourceTextEdit(
176
- cell.uri,
177
- { range: textModel.getFullModelRange(), text: newLinesContents[0] }
178
- )),
179
- ( new ResourceNotebookCellEdit(context.notebookEditor.textModel.uri, {
180
- editType: 1 ,
181
- index: index + 1,
182
- count: 0,
183
- cells: ( newLinesContents.slice(1).map(line => ({
184
- cellKind: kind,
185
- language,
186
- mime,
187
- source: line,
188
- outputs: [],
189
- metadata: {}
190
- })))
191
- }))
192
- ], { quotableLabel: 'Split Notebook Cell' });
193
- }
194
- }
195
- }
196
- });
197
- registerAction2(class extends NotebookCellAction {
198
- constructor() {
199
- super({
200
- id: JOIN_CELL_ABOVE_COMMAND_ID,
201
- title: ( localize2WithPath(
202
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
203
- 'notebookActions.joinCellAbove',
204
- "Join With Previous Cell"
205
- )),
206
- keybinding: {
207
- when: NOTEBOOK_EDITOR_FOCUSED,
208
- primary: 256 | 512 | 1024 | 40 ,
209
- weight: 200
210
- },
211
- menu: {
212
- id: MenuId.NotebookCellTitle,
213
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE)),
214
- group: "3_edit" ,
215
- order: 10
216
- }
217
- });
218
- }
219
- async runWithContext(accessor, context) {
220
- const bulkEditService = accessor.get(IBulkEditService);
221
- return joinCellsWithSurrounds(bulkEditService, context, 'above');
222
- }
223
- });
224
- registerAction2(class extends NotebookCellAction {
225
- constructor() {
226
- super({
227
- id: JOIN_CELL_BELOW_COMMAND_ID,
228
- title: ( localize2WithPath(
229
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
230
- 'notebookActions.joinCellBelow',
231
- "Join With Next Cell"
232
- )),
233
- keybinding: {
234
- when: NOTEBOOK_EDITOR_FOCUSED,
235
- primary: 256 | 512 | 40 ,
236
- weight: 200
237
- },
238
- menu: {
239
- id: MenuId.NotebookCellTitle,
240
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE)),
241
- group: "3_edit" ,
242
- order: 11
243
- }
244
- });
245
- }
246
- async runWithContext(accessor, context) {
247
- const bulkEditService = accessor.get(IBulkEditService);
248
- return joinCellsWithSurrounds(bulkEditService, context, 'below');
249
- }
250
- });
251
- registerAction2(class extends NotebookCellAction {
252
- constructor() {
253
- super({
254
- id: JOIN_SELECTED_CELLS_COMMAND_ID,
255
- title: ( localize2WithPath(
256
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
257
- 'notebookActions.joinSelectedCells',
258
- "Join Selected Cells"
259
- )),
260
- menu: {
261
- id: MenuId.NotebookCellTitle,
262
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE)),
263
- group: "3_edit" ,
264
- order: 12
265
- }
266
- });
267
- }
268
- async runWithContext(accessor, context) {
269
- const bulkEditService = accessor.get(IBulkEditService);
270
- const notificationService = accessor.get(INotificationService);
271
- return joinSelectedCells(bulkEditService, notificationService, context);
272
- }
273
- });
274
- const CHANGE_CELL_TO_CODE_COMMAND_ID = 'notebook.cell.changeToCode';
275
- const CHANGE_CELL_TO_MARKDOWN_COMMAND_ID = 'notebook.cell.changeToMarkdown';
276
- registerAction2(class ChangeCellToCodeAction extends NotebookMultiCellAction {
277
- constructor() {
278
- super({
279
- id: CHANGE_CELL_TO_CODE_COMMAND_ID,
280
- title: ( localize2WithPath(
281
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
282
- 'notebookActions.changeCellToCode',
283
- "Change Cell to Code"
284
- )),
285
- keybinding: {
286
- when: ( ContextKeyExpr.and(
287
- NOTEBOOK_EDITOR_FOCUSED,
288
- ContextKeyExpr.not(InputFocusedContextKey),
289
- ( NOTEBOOK_OUTPUT_FOCUSED.toNegated())
290
- )),
291
- primary: 55 ,
292
- weight: 200
293
- },
294
- precondition: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, ( NOTEBOOK_CELL_TYPE.isEqualTo('markup')))),
295
- menu: {
296
- id: MenuId.NotebookCellTitle,
297
- when: ( ContextKeyExpr.and(
298
- NOTEBOOK_EDITOR_FOCUSED,
299
- NOTEBOOK_EDITOR_EDITABLE,
300
- NOTEBOOK_CELL_EDITABLE,
301
- ( NOTEBOOK_CELL_TYPE.isEqualTo('markup'))
302
- )),
303
- group: "3_edit" ,
304
- }
305
- });
306
- }
307
- async runWithContext(accessor, context) {
308
- await changeCellToKind(CellKind.Code, context);
309
- }
310
- });
311
- registerAction2(class ChangeCellToMarkdownAction extends NotebookMultiCellAction {
312
- constructor() {
313
- super({
314
- id: CHANGE_CELL_TO_MARKDOWN_COMMAND_ID,
315
- title: ( localize2WithPath(
316
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
317
- 'notebookActions.changeCellToMarkdown',
318
- "Change Cell to Markdown"
319
- )),
320
- keybinding: {
321
- when: ( ContextKeyExpr.and(
322
- NOTEBOOK_EDITOR_FOCUSED,
323
- ContextKeyExpr.not(InputFocusedContextKey),
324
- ( NOTEBOOK_OUTPUT_FOCUSED.toNegated())
325
- )),
326
- primary: 43 ,
327
- weight: 200
328
- },
329
- precondition: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, ( NOTEBOOK_CELL_TYPE.isEqualTo('code')))),
330
- menu: {
331
- id: MenuId.NotebookCellTitle,
332
- when: ( ContextKeyExpr.and(
333
- NOTEBOOK_EDITOR_FOCUSED,
334
- NOTEBOOK_EDITOR_EDITABLE,
335
- NOTEBOOK_CELL_EDITABLE,
336
- ( NOTEBOOK_CELL_TYPE.isEqualTo('code'))
337
- )),
338
- group: "3_edit" ,
339
- }
340
- });
341
- }
342
- async runWithContext(accessor, context) {
343
- await changeCellToKind(CellKind.Markup, context, 'markdown', Mimes.markdown);
344
- }
345
- });
346
- const COLLAPSE_CELL_INPUT_COMMAND_ID = 'notebook.cell.collapseCellInput';
347
- const COLLAPSE_CELL_OUTPUT_COMMAND_ID = 'notebook.cell.collapseCellOutput';
348
- const COLLAPSE_ALL_CELL_INPUTS_COMMAND_ID = 'notebook.cell.collapseAllCellInputs';
349
- const EXPAND_ALL_CELL_INPUTS_COMMAND_ID = 'notebook.cell.expandAllCellInputs';
350
- const COLLAPSE_ALL_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.collapseAllCellOutputs';
351
- const EXPAND_ALL_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.expandAllCellOutputs';
352
- const TOGGLE_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.toggleOutputs';
353
- const TOGGLE_CELL_OUTPUT_SCROLLING = 'notebook.cell.toggleOutputScrolling';
354
- registerAction2(class CollapseCellInputAction extends NotebookMultiCellAction {
355
- constructor() {
356
- super({
357
- id: COLLAPSE_CELL_INPUT_COMMAND_ID,
358
- title: ( localize2WithPath(
359
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
360
- 'notebookActions.collapseCellInput',
361
- "Collapse Cell Input"
362
- )),
363
- keybinding: {
364
- when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, ( NOTEBOOK_CELL_INPUT_COLLAPSED.toNegated()), ( InputFocusedContext.toNegated()))),
365
- primary: KeyChord(2048 | 41 , 2048 | 33 ),
366
- weight: 200
367
- }
368
- });
369
- }
370
- parseArgs(accessor, ...args) {
371
- return parseMultiCellExecutionArgs(accessor, ...args);
372
- }
373
- async runWithContext(accessor, context) {
374
- if (context.ui) {
375
- context.cell.isInputCollapsed = true;
376
- }
377
- else {
378
- context.selectedCells.forEach(cell => cell.isInputCollapsed = true);
379
- }
380
- }
381
- });
382
- registerAction2(class ExpandCellInputAction extends NotebookMultiCellAction {
383
- constructor() {
384
- super({
385
- id: EXPAND_CELL_INPUT_COMMAND_ID,
386
- title: ( localize2WithPath(
387
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
388
- 'notebookActions.expandCellInput',
389
- "Expand Cell Input"
390
- )),
391
- keybinding: {
392
- when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_INPUT_COLLAPSED)),
393
- primary: KeyChord(2048 | 41 , 2048 | 33 ),
394
- weight: 200
395
- }
396
- });
397
- }
398
- parseArgs(accessor, ...args) {
399
- return parseMultiCellExecutionArgs(accessor, ...args);
400
- }
401
- async runWithContext(accessor, context) {
402
- if (context.ui) {
403
- context.cell.isInputCollapsed = false;
404
- }
405
- else {
406
- context.selectedCells.forEach(cell => cell.isInputCollapsed = false);
407
- }
408
- }
409
- });
410
- registerAction2(class CollapseCellOutputAction extends NotebookMultiCellAction {
411
- constructor() {
412
- super({
413
- id: COLLAPSE_CELL_OUTPUT_COMMAND_ID,
414
- title: ( localize2WithPath(
415
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
416
- 'notebookActions.collapseCellOutput',
417
- "Collapse Cell Output"
418
- )),
419
- keybinding: {
420
- when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, ( NOTEBOOK_CELL_OUTPUT_COLLAPSED.toNegated()), ( InputFocusedContext.toNegated()), NOTEBOOK_CELL_HAS_OUTPUTS)),
421
- primary: KeyChord(2048 | 41 , 50 ),
422
- weight: 200
423
- }
424
- });
425
- }
426
- async runWithContext(accessor, context) {
427
- if (context.ui) {
428
- context.cell.isOutputCollapsed = true;
429
- }
430
- else {
431
- context.selectedCells.forEach(cell => cell.isOutputCollapsed = true);
432
- }
433
- }
434
- });
435
- registerAction2(class ExpandCellOuputAction extends NotebookMultiCellAction {
436
- constructor() {
437
- super({
438
- id: EXPAND_CELL_OUTPUT_COMMAND_ID,
439
- title: ( localize2WithPath(
440
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
441
- 'notebookActions.expandCellOutput',
442
- "Expand Cell Output"
443
- )),
444
- keybinding: {
445
- when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_OUTPUT_COLLAPSED)),
446
- primary: KeyChord(2048 | 41 , 50 ),
447
- weight: 200
448
- }
449
- });
450
- }
451
- async runWithContext(accessor, context) {
452
- if (context.ui) {
453
- context.cell.isOutputCollapsed = false;
454
- }
455
- else {
456
- context.selectedCells.forEach(cell => cell.isOutputCollapsed = false);
457
- }
458
- }
459
- });
460
- registerAction2(class extends NotebookMultiCellAction {
461
- constructor() {
462
- super({
463
- id: TOGGLE_CELL_OUTPUTS_COMMAND_ID,
464
- precondition: NOTEBOOK_CELL_LIST_FOCUSED,
465
- title: ( localize2WithPath(
466
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
467
- 'notebookActions.toggleOutputs',
468
- "Toggle Outputs"
469
- )),
470
- metadata: {
471
- description: ( localizeWithPath(
472
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
473
- 'notebookActions.toggleOutputs',
474
- "Toggle Outputs"
475
- )),
476
- args: cellExecutionArgs
477
- }
478
- });
479
- }
480
- parseArgs(accessor, ...args) {
481
- return parseMultiCellExecutionArgs(accessor, ...args);
482
- }
483
- async runWithContext(accessor, context) {
484
- let cells = [];
485
- if (context.ui) {
486
- cells = [context.cell];
487
- }
488
- else if (context.selectedCells) {
489
- cells = context.selectedCells;
490
- }
491
- for (const cell of cells) {
492
- cell.isOutputCollapsed = !cell.isOutputCollapsed;
493
- }
494
- }
495
- });
496
- registerAction2(class CollapseAllCellInputsAction extends NotebookMultiCellAction {
497
- constructor() {
498
- super({
499
- id: COLLAPSE_ALL_CELL_INPUTS_COMMAND_ID,
500
- title: ( localize2WithPath(
501
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
502
- 'notebookActions.collapseAllCellInput',
503
- "Collapse All Cell Inputs"
504
- )),
505
- f1: true,
506
- });
507
- }
508
- async runWithContext(accessor, context) {
509
- forEachCell(context.notebookEditor, cell => cell.isInputCollapsed = true);
510
- }
511
- });
512
- registerAction2(class ExpandAllCellInputsAction extends NotebookMultiCellAction {
513
- constructor() {
514
- super({
515
- id: EXPAND_ALL_CELL_INPUTS_COMMAND_ID,
516
- title: ( localize2WithPath(
517
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
518
- 'notebookActions.expandAllCellInput',
519
- "Expand All Cell Inputs"
520
- )),
521
- f1: true
522
- });
523
- }
524
- async runWithContext(accessor, context) {
525
- forEachCell(context.notebookEditor, cell => cell.isInputCollapsed = false);
526
- }
527
- });
528
- registerAction2(class CollapseAllCellOutputsAction extends NotebookMultiCellAction {
529
- constructor() {
530
- super({
531
- id: COLLAPSE_ALL_CELL_OUTPUTS_COMMAND_ID,
532
- title: ( localize2WithPath(
533
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
534
- 'notebookActions.collapseAllCellOutput',
535
- "Collapse All Cell Outputs"
536
- )),
537
- f1: true,
538
- });
539
- }
540
- async runWithContext(accessor, context) {
541
- forEachCell(context.notebookEditor, cell => cell.isOutputCollapsed = true);
542
- }
543
- });
544
- registerAction2(class ExpandAllCellOutputsAction extends NotebookMultiCellAction {
545
- constructor() {
546
- super({
547
- id: EXPAND_ALL_CELL_OUTPUTS_COMMAND_ID,
548
- title: ( localize2WithPath(
549
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
550
- 'notebookActions.expandAllCellOutput',
551
- "Expand All Cell Outputs"
552
- )),
553
- f1: true
554
- });
555
- }
556
- async runWithContext(accessor, context) {
557
- forEachCell(context.notebookEditor, cell => cell.isOutputCollapsed = false);
558
- }
559
- });
560
- registerAction2(class ToggleCellOutputScrolling extends NotebookMultiCellAction {
561
- constructor() {
562
- super({
563
- id: TOGGLE_CELL_OUTPUT_SCROLLING,
564
- title: ( localize2WithPath(
565
- 'vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands',
566
- 'notebookActions.toggleScrolling',
567
- "Toggle Scroll Cell Output"
568
- )),
569
- keybinding: {
570
- when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, ( InputFocusedContext.toNegated()), NOTEBOOK_CELL_HAS_OUTPUTS)),
571
- primary: KeyChord(2048 | 41 , 55 ),
572
- weight: 200
573
- }
574
- });
575
- }
576
- toggleOutputScrolling(viewModel, globalScrollSetting, collapsed) {
577
- const cellMetadata = viewModel.model.metadata;
578
- if (cellMetadata) {
579
- const currentlyEnabled = cellMetadata['scrollable'] !== undefined ? cellMetadata['scrollable'] : globalScrollSetting;
580
- const shouldEnableScrolling = collapsed || !currentlyEnabled;
581
- cellMetadata['scrollable'] = shouldEnableScrolling;
582
- viewModel.resetRenderer();
583
- }
584
- }
585
- async runWithContext(accessor, context) {
586
- const globalScrolling = accessor.get(IConfigurationService).getValue(NotebookSetting.outputScrolling);
587
- if (context.ui) {
588
- context.cell.outputsViewModels.forEach((viewModel) => {
589
- this.toggleOutputScrolling(viewModel, globalScrolling, context.cell.isOutputCollapsed);
590
- });
591
- context.cell.isOutputCollapsed = false;
592
- }
593
- else {
594
- context.selectedCells.forEach(cell => {
595
- cell.outputsViewModels.forEach((viewModel) => {
596
- this.toggleOutputScrolling(viewModel, globalScrolling, cell.isOutputCollapsed);
597
- });
598
- cell.isOutputCollapsed = false;
599
- });
600
- }
601
- }
602
- });
603
- function forEachCell(editor, callback) {
604
- for (let i = 0; i < editor.getLength(); i++) {
605
- const cell = editor.cellAt(i);
606
- callback(cell, i);
607
- }
608
- }
@@ -1,31 +0,0 @@
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 };