@codingame/monaco-vscode-notebook-service-override 4.0.0 → 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 (77) hide show
  1. package/notebook.js +12 -12
  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 -10
  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 -391
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -544
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -101
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -120
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -60
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -150
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -656
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -517
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -652
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -721
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -315
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +0 -199
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -47
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -115
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -911
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -395
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -185
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1187
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -510
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -90
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1002
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -203
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -386
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
@@ -1,721 +0,0 @@
1
- import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
2
- import { isEqual } from 'vscode/vscode/vs/base/common/resources';
3
- import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
4
- import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
5
- import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
6
- import { registerAction2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
7
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
8
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
9
- import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
10
- import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
11
- import { CTX_INLINE_CHAT_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
12
- import { insertCell } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/cellOperations';
13
- import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
14
- import { NotebookChatController } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController';
15
- import { NotebookAction, executeNotebookCondition, getContextFromUri, getContextFromActiveEditor, NotebookMultiCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, cellExecutionArgs, parseMultiCellExecutionArgs, CELL_TITLE_CELL_GROUP_ID, NotebookCellAction } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
16
- import { EXECUTE_CELL_COMMAND_ID, ScrollToRevealBehavior, CellEditState, CellFocusMode } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
17
- import { executeAllIcon, executeIcon, executeAboveIcon, executeBelowIcon, stopIcon, executingStateIcon, errorStateIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
18
- import { NotebookSetting, CellKind, CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
19
- import { NOTEBOOK_CELL_TYPE, NOTEBOOK_KERNEL_COUNT, NOTEBOOK_KERNEL_SOURCE_COUNT, NOTEBOOK_MISSING_KERNEL_EXTENSION, NOTEBOOK_CELL_EXECUTING, NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_INTERRUPTIBLE_KERNEL, NOTEBOOK_HAS_SOMETHING_RUNNING, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_EXECUTION_STATE, NOTEBOOK_HAS_RUNNING_CELL, NOTEBOOK_LAST_CELL_FAILED } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
20
- import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
21
- import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
22
- import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
23
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
24
-
25
- const EXECUTE_NOTEBOOK_COMMAND_ID = 'notebook.execute';
26
- const CANCEL_NOTEBOOK_COMMAND_ID = 'notebook.cancelExecution';
27
- const INTERRUPT_NOTEBOOK_COMMAND_ID = 'notebook.interruptExecution';
28
- const CANCEL_CELL_COMMAND_ID = 'notebook.cell.cancelExecution';
29
- const EXECUTE_CELL_FOCUS_CONTAINER_COMMAND_ID = 'notebook.cell.executeAndFocusContainer';
30
- const EXECUTE_CELL_SELECT_BELOW = 'notebook.cell.executeAndSelectBelow';
31
- const EXECUTE_CELL_INSERT_BELOW = 'notebook.cell.executeAndInsertBelow';
32
- const EXECUTE_CELL_AND_BELOW = 'notebook.cell.executeCellAndBelow';
33
- const EXECUTE_CELLS_ABOVE = 'notebook.cell.executeCellsAbove';
34
- const RENDER_ALL_MARKDOWN_CELLS = 'notebook.renderAllMarkdownCells';
35
- const REVEAL_RUNNING_CELL = 'notebook.revealRunningCell';
36
- const REVEAL_LAST_FAILED_CELL = 'notebook.revealLastFailedCell';
37
- const executeCondition = ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo('code')), ( ContextKeyExpr.or(
38
- ContextKeyExpr.greater(NOTEBOOK_KERNEL_COUNT.key, 0),
39
- ContextKeyExpr.greater(NOTEBOOK_KERNEL_SOURCE_COUNT.key, 0),
40
- NOTEBOOK_MISSING_KERNEL_EXTENSION
41
- ))));
42
- const executeThisCellCondition = ( ContextKeyExpr.and(executeCondition, ( NOTEBOOK_CELL_EXECUTING.toNegated())));
43
- function renderAllMarkdownCells(context) {
44
- for (let i = 0; i < context.notebookEditor.getLength(); i++) {
45
- const cell = context.notebookEditor.cellAt(i);
46
- if (cell.cellKind === CellKind.Markup) {
47
- cell.updateEditState(CellEditState.Preview, 'renderAllMarkdownCells');
48
- }
49
- }
50
- }
51
- async function runCell(editorGroupsService, context) {
52
- const group = editorGroupsService.activeGroup;
53
- if (group) {
54
- if (group.activeEditor) {
55
- group.pinEditor(group.activeEditor);
56
- }
57
- }
58
- if (context.ui && context.cell) {
59
- await context.notebookEditor.executeNotebookCells(Iterable.single(context.cell));
60
- if (context.autoReveal) {
61
- const cellIndex = context.notebookEditor.getCellIndex(context.cell);
62
- context.notebookEditor.revealCellRangeInView({ start: cellIndex, end: cellIndex + 1 });
63
- }
64
- }
65
- else if (context.selectedCells?.length || context.cell) {
66
- const selectedCells = context.selectedCells?.length ? context.selectedCells : [context.cell];
67
- await context.notebookEditor.executeNotebookCells(selectedCells);
68
- const firstCell = selectedCells[0];
69
- if (firstCell && context.autoReveal) {
70
- const cellIndex = context.notebookEditor.getCellIndex(firstCell);
71
- context.notebookEditor.revealCellRangeInView({ start: cellIndex, end: cellIndex + 1 });
72
- }
73
- }
74
- let foundEditor = undefined;
75
- for (const [, codeEditor] of context.notebookEditor.codeEditors) {
76
- if (isEqual(codeEditor.getModel()?.uri, (context.cell ?? context.selectedCells?.[0])?.uri)) {
77
- foundEditor = codeEditor;
78
- break;
79
- }
80
- }
81
- if (!foundEditor) {
82
- return;
83
- }
84
- const controller = InlineChatController.get(foundEditor);
85
- if (!controller) {
86
- return;
87
- }
88
- controller.createSnapshot();
89
- }
90
- registerAction2(class RenderAllMarkdownCellsAction extends NotebookAction {
91
- constructor() {
92
- super({
93
- id: RENDER_ALL_MARKDOWN_CELLS,
94
- title: ( localizeWithPath(
95
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
96
- 'notebookActions.renderMarkdown',
97
- "Render All Markdown Cells"
98
- )),
99
- });
100
- }
101
- async runWithContext(accessor, context) {
102
- renderAllMarkdownCells(context);
103
- }
104
- });
105
- registerAction2(class ExecuteNotebookAction extends NotebookAction {
106
- constructor() {
107
- super({
108
- id: EXECUTE_NOTEBOOK_COMMAND_ID,
109
- title: ( localizeWithPath(
110
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
111
- 'notebookActions.executeNotebook',
112
- "Run All"
113
- )),
114
- icon: executeAllIcon,
115
- metadata: {
116
- description: ( localizeWithPath(
117
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
118
- 'notebookActions.executeNotebook',
119
- "Run All"
120
- )),
121
- args: [
122
- {
123
- name: 'uri',
124
- description: 'The document uri'
125
- }
126
- ]
127
- },
128
- menu: [
129
- {
130
- id: MenuId.EditorTitle,
131
- order: -1,
132
- group: 'navigation',
133
- when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, executeNotebookCondition, ( ContextKeyExpr.or(( NOTEBOOK_INTERRUPTIBLE_KERNEL.toNegated()), ( NOTEBOOK_HAS_SOMETHING_RUNNING.toNegated()))), ( ContextKeyExpr.notEquals('config.notebook.globalToolbar', true))))
134
- },
135
- {
136
- id: MenuId.NotebookToolbar,
137
- order: -1,
138
- group: 'navigation/execute',
139
- when: ( ContextKeyExpr.and(executeNotebookCondition, ( ContextKeyExpr.or(( NOTEBOOK_INTERRUPTIBLE_KERNEL.toNegated()), ( NOTEBOOK_HAS_SOMETHING_RUNNING.toNegated()))), ( ContextKeyExpr.and(NOTEBOOK_HAS_SOMETHING_RUNNING, ( NOTEBOOK_INTERRUPTIBLE_KERNEL.toNegated())))?.negate(), ( ContextKeyExpr.equals('config.notebook.globalToolbar', true))))
140
- }
141
- ]
142
- });
143
- }
144
- getEditorContextFromArgsOrActive(accessor, context) {
145
- return getContextFromUri(accessor, context) ?? getContextFromActiveEditor(accessor.get(IEditorService));
146
- }
147
- async runWithContext(accessor, context) {
148
- renderAllMarkdownCells(context);
149
- const editorService = accessor.get(IEditorService);
150
- const editor = editorService.getEditors(0 ).find(editor => editor.editor instanceof NotebookEditorInput && editor.editor.viewType === context.notebookEditor.textModel.viewType && ( editor.editor.resource.toString()) === ( context.notebookEditor.textModel.uri.toString()));
151
- const editorGroupService = accessor.get(IEditorGroupsService);
152
- if (editor) {
153
- const group = editorGroupService.getGroup(editor.groupId);
154
- group?.pinEditor(editor.editor);
155
- }
156
- return context.notebookEditor.executeNotebookCells();
157
- }
158
- });
159
- registerAction2(class ExecuteCell extends NotebookMultiCellAction {
160
- constructor() {
161
- super({
162
- id: EXECUTE_CELL_COMMAND_ID,
163
- precondition: executeThisCellCondition,
164
- title: ( localizeWithPath(
165
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
166
- 'notebookActions.execute',
167
- "Execute Cell"
168
- )),
169
- keybinding: {
170
- when: ( ContextKeyExpr.or(NOTEBOOK_CELL_LIST_FOCUSED, ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)))),
171
- primary: 256 | 3 ,
172
- win: {
173
- primary: 2048 | 512 | 3
174
- },
175
- weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
176
- },
177
- menu: {
178
- id: MenuId.NotebookCellExecutePrimary,
179
- when: executeThisCellCondition,
180
- group: 'inline'
181
- },
182
- metadata: {
183
- description: ( localizeWithPath(
184
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
185
- 'notebookActions.execute',
186
- "Execute Cell"
187
- )),
188
- args: cellExecutionArgs
189
- },
190
- icon: executeIcon
191
- });
192
- }
193
- parseArgs(accessor, ...args) {
194
- return parseMultiCellExecutionArgs(accessor, ...args);
195
- }
196
- async runWithContext(accessor, context) {
197
- const editorGroupsService = accessor.get(IEditorGroupsService);
198
- if (context.ui) {
199
- await context.notebookEditor.focusNotebookCell(context.cell, 'container', { skipReveal: true });
200
- }
201
- const chatController = NotebookChatController.get(context.notebookEditor);
202
- const editingCell = chatController?.getEditingCell();
203
- if (chatController?.hasFocus() && editingCell) {
204
- const group = editorGroupsService.activeGroup;
205
- if (group) {
206
- if (group.activeEditor) {
207
- group.pinEditor(group.activeEditor);
208
- }
209
- }
210
- await context.notebookEditor.executeNotebookCells([editingCell]);
211
- return;
212
- }
213
- await runCell(editorGroupsService, context);
214
- }
215
- });
216
- registerAction2(class ExecuteAboveCells extends NotebookMultiCellAction {
217
- constructor() {
218
- super({
219
- id: EXECUTE_CELLS_ABOVE,
220
- precondition: executeCondition,
221
- title: ( localizeWithPath(
222
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
223
- 'notebookActions.executeAbove',
224
- "Execute Above Cells"
225
- )),
226
- menu: [
227
- {
228
- id: MenuId.NotebookCellExecute,
229
- when: ( ContextKeyExpr.and(executeCondition, ( ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, true))))
230
- },
231
- {
232
- id: MenuId.NotebookCellTitle,
233
- order: 1 ,
234
- group: CELL_TITLE_CELL_GROUP_ID,
235
- when: ( ContextKeyExpr.and(executeCondition, ( ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, false))))
236
- }
237
- ],
238
- icon: executeAboveIcon
239
- });
240
- }
241
- parseArgs(accessor, ...args) {
242
- return parseMultiCellExecutionArgs(accessor, ...args);
243
- }
244
- async runWithContext(accessor, context) {
245
- let endCellIdx = undefined;
246
- if (context.ui) {
247
- endCellIdx = context.notebookEditor.getCellIndex(context.cell);
248
- await context.notebookEditor.focusNotebookCell(context.cell, 'container', { skipReveal: true });
249
- }
250
- else {
251
- endCellIdx = Math.min(...( context.selectedCells.map(cell => context.notebookEditor.getCellIndex(cell))));
252
- }
253
- if (typeof endCellIdx === 'number') {
254
- const range = { start: 0, end: endCellIdx };
255
- const cells = context.notebookEditor.getCellsInRange(range);
256
- context.notebookEditor.executeNotebookCells(cells);
257
- }
258
- }
259
- });
260
- registerAction2(class ExecuteCellAndBelow extends NotebookMultiCellAction {
261
- constructor() {
262
- super({
263
- id: EXECUTE_CELL_AND_BELOW,
264
- precondition: executeCondition,
265
- title: ( localizeWithPath(
266
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
267
- 'notebookActions.executeBelow',
268
- "Execute Cell and Below"
269
- )),
270
- menu: [
271
- {
272
- id: MenuId.NotebookCellExecute,
273
- when: ( ContextKeyExpr.and(executeCondition, ( ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, true))))
274
- },
275
- {
276
- id: MenuId.NotebookCellTitle,
277
- order: 2 ,
278
- group: CELL_TITLE_CELL_GROUP_ID,
279
- when: ( ContextKeyExpr.and(executeCondition, ( ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, false))))
280
- }
281
- ],
282
- icon: executeBelowIcon
283
- });
284
- }
285
- parseArgs(accessor, ...args) {
286
- return parseMultiCellExecutionArgs(accessor, ...args);
287
- }
288
- async runWithContext(accessor, context) {
289
- let startCellIdx = undefined;
290
- if (context.ui) {
291
- startCellIdx = context.notebookEditor.getCellIndex(context.cell);
292
- await context.notebookEditor.focusNotebookCell(context.cell, 'container', { skipReveal: true });
293
- }
294
- else {
295
- startCellIdx = Math.min(...( context.selectedCells.map(cell => context.notebookEditor.getCellIndex(cell))));
296
- }
297
- if (typeof startCellIdx === 'number') {
298
- const range = { start: startCellIdx, end: context.notebookEditor.getLength() };
299
- const cells = context.notebookEditor.getCellsInRange(range);
300
- context.notebookEditor.executeNotebookCells(cells);
301
- }
302
- }
303
- });
304
- registerAction2(class ExecuteCellFocusContainer extends NotebookMultiCellAction {
305
- constructor() {
306
- super({
307
- id: EXECUTE_CELL_FOCUS_CONTAINER_COMMAND_ID,
308
- precondition: executeThisCellCondition,
309
- title: ( localizeWithPath(
310
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
311
- 'notebookActions.executeAndFocusContainer',
312
- "Execute Cell and Focus Container"
313
- )),
314
- metadata: {
315
- description: ( localizeWithPath(
316
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
317
- 'notebookActions.executeAndFocusContainer',
318
- "Execute Cell and Focus Container"
319
- )),
320
- args: cellExecutionArgs
321
- },
322
- icon: executeIcon
323
- });
324
- }
325
- parseArgs(accessor, ...args) {
326
- return parseMultiCellExecutionArgs(accessor, ...args);
327
- }
328
- async runWithContext(accessor, context) {
329
- const editorGroupsService = accessor.get(IEditorGroupsService);
330
- if (context.ui) {
331
- await context.notebookEditor.focusNotebookCell(context.cell, 'container', { skipReveal: true });
332
- }
333
- else {
334
- const firstCell = context.selectedCells[0];
335
- if (firstCell) {
336
- await context.notebookEditor.focusNotebookCell(firstCell, 'container', { skipReveal: true });
337
- }
338
- }
339
- await runCell(editorGroupsService, context);
340
- }
341
- });
342
- const cellCancelCondition = ( ContextKeyExpr.or(( ContextKeyExpr.equals(NOTEBOOK_CELL_EXECUTION_STATE.key, 'executing')), ( ContextKeyExpr.equals(NOTEBOOK_CELL_EXECUTION_STATE.key, 'pending'))));
343
- registerAction2(class CancelExecuteCell extends NotebookMultiCellAction {
344
- constructor() {
345
- super({
346
- id: CANCEL_CELL_COMMAND_ID,
347
- precondition: cellCancelCondition,
348
- title: ( localizeWithPath(
349
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
350
- 'notebookActions.cancel',
351
- "Stop Cell Execution"
352
- )),
353
- icon: stopIcon,
354
- menu: {
355
- id: MenuId.NotebookCellExecutePrimary,
356
- when: cellCancelCondition,
357
- group: 'inline'
358
- },
359
- metadata: {
360
- description: ( localizeWithPath(
361
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
362
- 'notebookActions.cancel',
363
- "Stop Cell Execution"
364
- )),
365
- args: [
366
- {
367
- name: 'options',
368
- description: 'The cell range options',
369
- schema: {
370
- 'type': 'object',
371
- 'required': ['ranges'],
372
- 'properties': {
373
- 'ranges': {
374
- 'type': 'array',
375
- items: [
376
- {
377
- 'type': 'object',
378
- 'required': ['start', 'end'],
379
- 'properties': {
380
- 'start': {
381
- 'type': 'number'
382
- },
383
- 'end': {
384
- 'type': 'number'
385
- }
386
- }
387
- }
388
- ]
389
- },
390
- 'document': {
391
- 'type': 'object',
392
- 'description': 'The document uri',
393
- }
394
- }
395
- }
396
- }
397
- ]
398
- },
399
- });
400
- }
401
- parseArgs(accessor, ...args) {
402
- return parseMultiCellExecutionArgs(accessor, ...args);
403
- }
404
- async runWithContext(accessor, context) {
405
- if (context.ui) {
406
- await context.notebookEditor.focusNotebookCell(context.cell, 'container', { skipReveal: true });
407
- return context.notebookEditor.cancelNotebookCells(Iterable.single(context.cell));
408
- }
409
- else {
410
- return context.notebookEditor.cancelNotebookCells(context.selectedCells);
411
- }
412
- }
413
- });
414
- registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
415
- constructor() {
416
- super({
417
- id: EXECUTE_CELL_SELECT_BELOW,
418
- precondition: ( ContextKeyExpr.or(executeThisCellCondition, ( NOTEBOOK_CELL_TYPE.isEqualTo('markup')))),
419
- title: ( localizeWithPath(
420
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
421
- 'notebookActions.executeAndSelectBelow',
422
- "Execute Notebook Cell and Select Below"
423
- )),
424
- keybinding: {
425
- when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, ( CTX_INLINE_CHAT_FOCUSED.negate()))),
426
- primary: 1024 | 3 ,
427
- weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
428
- },
429
- });
430
- }
431
- async runWithContext(accessor, context) {
432
- const editorGroupsService = accessor.get(IEditorGroupsService);
433
- const idx = context.notebookEditor.getCellIndex(context.cell);
434
- if (typeof idx !== 'number') {
435
- return;
436
- }
437
- const languageService = accessor.get(ILanguageService);
438
- const config = accessor.get(IConfigurationService);
439
- const scrollBehavior = config.getValue(NotebookSetting.scrollToRevealCell);
440
- let focusOptions;
441
- if (scrollBehavior === 'none') {
442
- focusOptions = { skipReveal: true };
443
- }
444
- else {
445
- focusOptions = {
446
- revealBehavior: scrollBehavior === 'fullCell' ? ScrollToRevealBehavior.fullCell : ScrollToRevealBehavior.firstLine
447
- };
448
- }
449
- if (context.cell.cellKind === CellKind.Markup) {
450
- const nextCell = context.notebookEditor.cellAt(idx + 1);
451
- context.cell.updateEditState(CellEditState.Preview, EXECUTE_CELL_SELECT_BELOW);
452
- if (nextCell) {
453
- await context.notebookEditor.focusNotebookCell(nextCell, 'container', focusOptions);
454
- }
455
- else {
456
- const newCell = insertCell(languageService, context.notebookEditor, idx, CellKind.Markup, 'below');
457
- if (newCell) {
458
- await context.notebookEditor.focusNotebookCell(newCell, 'editor', focusOptions);
459
- }
460
- }
461
- return;
462
- }
463
- else {
464
- const nextCell = context.notebookEditor.cellAt(idx + 1);
465
- if (nextCell) {
466
- await context.notebookEditor.focusNotebookCell(nextCell, 'container', focusOptions);
467
- }
468
- else {
469
- const newCell = insertCell(languageService, context.notebookEditor, idx, CellKind.Code, 'below');
470
- if (newCell) {
471
- await context.notebookEditor.focusNotebookCell(newCell, 'editor', focusOptions);
472
- }
473
- }
474
- return runCell(editorGroupsService, context);
475
- }
476
- }
477
- });
478
- registerAction2(class ExecuteCellInsertBelow extends NotebookCellAction {
479
- constructor() {
480
- super({
481
- id: EXECUTE_CELL_INSERT_BELOW,
482
- precondition: ( ContextKeyExpr.or(executeThisCellCondition, ( NOTEBOOK_CELL_TYPE.isEqualTo('markup')))),
483
- title: ( localizeWithPath(
484
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
485
- 'notebookActions.executeAndInsertBelow',
486
- "Execute Notebook Cell and Insert Below"
487
- )),
488
- keybinding: {
489
- when: NOTEBOOK_CELL_LIST_FOCUSED,
490
- primary: 512 | 3 ,
491
- weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
492
- },
493
- });
494
- }
495
- async runWithContext(accessor, context) {
496
- const editorGroupsService = accessor.get(IEditorGroupsService);
497
- const idx = context.notebookEditor.getCellIndex(context.cell);
498
- const languageService = accessor.get(ILanguageService);
499
- const newFocusMode = context.cell.focusMode === CellFocusMode.Editor ? 'editor' : 'container';
500
- const newCell = insertCell(languageService, context.notebookEditor, idx, context.cell.cellKind, 'below');
501
- if (newCell) {
502
- await context.notebookEditor.focusNotebookCell(newCell, newFocusMode);
503
- }
504
- if (context.cell.cellKind === CellKind.Markup) {
505
- context.cell.updateEditState(CellEditState.Preview, EXECUTE_CELL_INSERT_BELOW);
506
- }
507
- else {
508
- runCell(editorGroupsService, context);
509
- }
510
- }
511
- });
512
- class CancelNotebook extends NotebookAction {
513
- getEditorContextFromArgsOrActive(accessor, context) {
514
- return getContextFromUri(accessor, context) ?? getContextFromActiveEditor(accessor.get(IEditorService));
515
- }
516
- async runWithContext(accessor, context) {
517
- return context.notebookEditor.cancelNotebookCells();
518
- }
519
- }
520
- registerAction2(class CancelAllNotebook extends CancelNotebook {
521
- constructor() {
522
- super({
523
- id: CANCEL_NOTEBOOK_COMMAND_ID,
524
- title: ( localize2WithPath(
525
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
526
- 'notebookActions.cancelNotebook',
527
- "Stop Execution"
528
- )),
529
- icon: stopIcon,
530
- menu: [
531
- {
532
- id: MenuId.EditorTitle,
533
- order: -1,
534
- group: 'navigation',
535
- when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_HAS_SOMETHING_RUNNING, ( NOTEBOOK_INTERRUPTIBLE_KERNEL.toNegated()), ( ContextKeyExpr.notEquals('config.notebook.globalToolbar', true))))
536
- },
537
- {
538
- id: MenuId.NotebookToolbar,
539
- order: -1,
540
- group: 'navigation/execute',
541
- when: ( ContextKeyExpr.and(NOTEBOOK_HAS_SOMETHING_RUNNING, ( NOTEBOOK_INTERRUPTIBLE_KERNEL.toNegated()), ( ContextKeyExpr.equals('config.notebook.globalToolbar', true))))
542
- }
543
- ]
544
- });
545
- }
546
- });
547
- registerAction2(class InterruptNotebook extends CancelNotebook {
548
- constructor() {
549
- super({
550
- id: INTERRUPT_NOTEBOOK_COMMAND_ID,
551
- title: ( localize2WithPath(
552
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
553
- 'notebookActions.interruptNotebook',
554
- "Interrupt"
555
- )),
556
- precondition: ( ContextKeyExpr.and(NOTEBOOK_HAS_SOMETHING_RUNNING, NOTEBOOK_INTERRUPTIBLE_KERNEL)),
557
- icon: stopIcon,
558
- menu: [
559
- {
560
- id: MenuId.EditorTitle,
561
- order: -1,
562
- group: 'navigation',
563
- when: ( ContextKeyExpr.and(
564
- NOTEBOOK_IS_ACTIVE_EDITOR,
565
- NOTEBOOK_HAS_SOMETHING_RUNNING,
566
- NOTEBOOK_INTERRUPTIBLE_KERNEL,
567
- ( ContextKeyExpr.notEquals('config.notebook.globalToolbar', true))
568
- ))
569
- },
570
- {
571
- id: MenuId.NotebookToolbar,
572
- order: -1,
573
- group: 'navigation/execute',
574
- when: ( ContextKeyExpr.and(
575
- NOTEBOOK_HAS_SOMETHING_RUNNING,
576
- NOTEBOOK_INTERRUPTIBLE_KERNEL,
577
- ( ContextKeyExpr.equals('config.notebook.globalToolbar', true))
578
- ))
579
- },
580
- {
581
- id: MenuId.InteractiveToolbar,
582
- group: 'navigation/execute'
583
- }
584
- ]
585
- });
586
- }
587
- });
588
- MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
589
- title: ( localizeWithPath(
590
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
591
- 'revealRunningCellShort',
592
- "Go To"
593
- )),
594
- submenu: MenuId.NotebookCellExecuteGoTo,
595
- group: 'navigation/execute',
596
- order: 20,
597
- icon: ThemeIcon.modify(executingStateIcon, 'spin')
598
- });
599
- registerAction2(class RevealRunningCellAction extends NotebookAction {
600
- constructor() {
601
- super({
602
- id: REVEAL_RUNNING_CELL,
603
- title: ( localizeWithPath(
604
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
605
- 'revealRunningCell',
606
- "Go to Running Cell"
607
- )),
608
- tooltip: ( localizeWithPath(
609
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
610
- 'revealRunningCell',
611
- "Go to Running Cell"
612
- )),
613
- shortTitle: ( localizeWithPath(
614
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
615
- 'revealRunningCell',
616
- "Go to Running Cell"
617
- )),
618
- precondition: NOTEBOOK_HAS_RUNNING_CELL,
619
- menu: [
620
- {
621
- id: MenuId.EditorTitle,
622
- when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_HAS_RUNNING_CELL, ( ContextKeyExpr.notEquals('config.notebook.globalToolbar', true)))),
623
- group: 'navigation',
624
- order: 0
625
- },
626
- {
627
- id: MenuId.NotebookCellExecuteGoTo,
628
- when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_HAS_RUNNING_CELL, ( ContextKeyExpr.equals('config.notebook.globalToolbar', true)))),
629
- group: 'navigation/execute',
630
- order: 20
631
- },
632
- {
633
- id: MenuId.InteractiveToolbar,
634
- when: ( ContextKeyExpr.and(NOTEBOOK_HAS_RUNNING_CELL, ( ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive')))),
635
- group: 'navigation',
636
- order: 10
637
- }
638
- ],
639
- icon: ThemeIcon.modify(executingStateIcon, 'spin')
640
- });
641
- }
642
- async runWithContext(accessor, context) {
643
- const notebookExecutionStateService = accessor.get(INotebookExecutionStateService);
644
- const notebook = context.notebookEditor.textModel.uri;
645
- const executingCells = notebookExecutionStateService.getCellExecutionsForNotebook(notebook);
646
- if (executingCells[0]) {
647
- const topStackFrameCell = this.findCellAtTopFrame(accessor, notebook);
648
- const focusHandle = topStackFrameCell ?? executingCells[0].cellHandle;
649
- const cell = context.notebookEditor.getCellByHandle(focusHandle);
650
- if (cell) {
651
- context.notebookEditor.focusNotebookCell(cell, 'container');
652
- }
653
- }
654
- }
655
- findCellAtTopFrame(accessor, notebook) {
656
- const debugService = accessor.get(IDebugService);
657
- for (const session of debugService.getModel().getSessions()) {
658
- for (const thread of session.getAllThreads()) {
659
- const sf = thread.getTopStackFrame();
660
- if (sf) {
661
- const parsed = CellUri.parse(sf.source.uri);
662
- if (parsed && ( parsed.notebook.toString()) === ( notebook.toString())) {
663
- return parsed.handle;
664
- }
665
- }
666
- }
667
- }
668
- return undefined;
669
- }
670
- });
671
- registerAction2(class RevealLastFailedCellAction extends NotebookAction {
672
- constructor() {
673
- super({
674
- id: REVEAL_LAST_FAILED_CELL,
675
- title: ( localizeWithPath(
676
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
677
- 'revealLastFailedCell',
678
- "Go to Most Recently Failed Cell"
679
- )),
680
- tooltip: ( localizeWithPath(
681
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
682
- 'revealLastFailedCell',
683
- "Go to Most Recently Failed Cell"
684
- )),
685
- shortTitle: ( localizeWithPath(
686
- 'vs/workbench/contrib/notebook/browser/controller/executeActions',
687
- 'revealLastFailedCellShort',
688
- "Go to Most Recently Failed Cell"
689
- )),
690
- precondition: NOTEBOOK_LAST_CELL_FAILED,
691
- menu: [
692
- {
693
- id: MenuId.EditorTitle,
694
- when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_LAST_CELL_FAILED, ( NOTEBOOK_HAS_RUNNING_CELL.toNegated()), ( ContextKeyExpr.notEquals('config.notebook.globalToolbar', true)))),
695
- group: 'navigation',
696
- order: 0
697
- },
698
- {
699
- id: MenuId.NotebookCellExecuteGoTo,
700
- when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_LAST_CELL_FAILED, ( NOTEBOOK_HAS_RUNNING_CELL.toNegated()), ( ContextKeyExpr.equals('config.notebook.globalToolbar', true)))),
701
- group: 'navigation/execute',
702
- order: 20
703
- },
704
- ],
705
- icon: errorStateIcon,
706
- });
707
- }
708
- async runWithContext(accessor, context) {
709
- const notebookExecutionStateService = accessor.get(INotebookExecutionStateService);
710
- const notebook = context.notebookEditor.textModel.uri;
711
- const lastFailedCellHandle = notebookExecutionStateService.getLastFailedCellForNotebook(notebook);
712
- if (lastFailedCellHandle !== undefined) {
713
- const lastFailedCell = context.notebookEditor.getCellByHandle(lastFailedCellHandle);
714
- if (lastFailedCell) {
715
- context.notebookEditor.focusNotebookCell(lastFailedCell, 'container');
716
- }
717
- }
718
- }
719
- });
720
-
721
- export { executeCondition, executeThisCellCondition };