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