@codingame/monaco-vscode-notebook-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 (80) hide show
  1. package/notebook.js +13 -13
  2. package/package.json +2 -2
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +0 -389
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -488
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -91
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -118
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -59
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -148
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -383
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -511
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -565
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -31
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +0 -744
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -707
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -267
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -45
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -108
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -890
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -393
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -175
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1174
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -509
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
  69. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -80
  70. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1003
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -202
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
  75. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
  76. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
  77. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -376
  78. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
  79. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
  80. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
@@ -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
- }