@codingame/monaco-vscode-notebook-service-override 1.85.1
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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/notebook.d.ts +5 -0
- package/notebook.js +44 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/package.json +32 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
- package/worker.js +1 -0
- package/workers/notebook.worker.js +9 -0
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
3
|
+
import { NotebookEditorWidget, getDefaultNotebookCreationOptions } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorWidget';
|
|
4
|
+
import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
6
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
7
|
+
import { NotebookEditorInput, isCompositeNotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
8
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
9
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
10
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
11
|
+
import { InteractiveWindowOpen } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
12
|
+
|
|
13
|
+
let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
14
|
+
constructor(editorGroupService, editorService, contextKeyService) {
|
|
15
|
+
this._tokenPool = 1;
|
|
16
|
+
this._disposables = ( new DisposableStore());
|
|
17
|
+
this._notebookEditors = ( new Map());
|
|
18
|
+
this._onNotebookEditorAdd = ( new Emitter());
|
|
19
|
+
this._onNotebookEditorsRemove = ( new Emitter());
|
|
20
|
+
this.onDidAddNotebookEditor = this._onNotebookEditorAdd.event;
|
|
21
|
+
this.onDidRemoveNotebookEditor = this._onNotebookEditorsRemove.event;
|
|
22
|
+
this._borrowableEditors = ( new Map());
|
|
23
|
+
const groupListener = ( new Map());
|
|
24
|
+
const onNewGroup = (group) => {
|
|
25
|
+
const { id } = group;
|
|
26
|
+
const listeners = [];
|
|
27
|
+
listeners.push(group.onDidCloseEditor(e => {
|
|
28
|
+
const widgets = this._borrowableEditors.get(group.id);
|
|
29
|
+
if (!widgets) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const inputs = e.editor instanceof NotebookEditorInput ? [e.editor] : (isCompositeNotebookEditorInput(e.editor) ? e.editor.editorInputs : []);
|
|
33
|
+
inputs.forEach(input => {
|
|
34
|
+
const value = widgets.get(input.resource);
|
|
35
|
+
if (!value) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
value.token = undefined;
|
|
39
|
+
this._disposeWidget(value.widget);
|
|
40
|
+
widgets.delete(input.resource);
|
|
41
|
+
value.widget = undefined;
|
|
42
|
+
});
|
|
43
|
+
}));
|
|
44
|
+
listeners.push(group.onWillMoveEditor(e => {
|
|
45
|
+
if (e.editor instanceof NotebookEditorInput) {
|
|
46
|
+
this._allowWidgetMove(e.editor, e.groupId, e.target);
|
|
47
|
+
}
|
|
48
|
+
if (isCompositeNotebookEditorInput(e.editor)) {
|
|
49
|
+
e.editor.editorInputs.forEach(input => {
|
|
50
|
+
this._allowWidgetMove(input, e.groupId, e.target);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
groupListener.set(id, listeners);
|
|
55
|
+
};
|
|
56
|
+
this._disposables.add(editorGroupService.onDidAddGroup(onNewGroup));
|
|
57
|
+
editorGroupService.mainPart.whenReady.then(() => editorGroupService.groups.forEach(onNewGroup));
|
|
58
|
+
this._disposables.add(editorGroupService.onDidRemoveGroup(group => {
|
|
59
|
+
const listeners = groupListener.get(group.id);
|
|
60
|
+
if (listeners) {
|
|
61
|
+
listeners.forEach(listener => listener.dispose());
|
|
62
|
+
groupListener.delete(group.id);
|
|
63
|
+
}
|
|
64
|
+
const widgets = this._borrowableEditors.get(group.id);
|
|
65
|
+
this._borrowableEditors.delete(group.id);
|
|
66
|
+
if (widgets) {
|
|
67
|
+
for (const value of ( widgets.values())) {
|
|
68
|
+
value.token = undefined;
|
|
69
|
+
this._disposeWidget(value.widget);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
const interactiveWindowOpen = InteractiveWindowOpen.bindTo(contextKeyService);
|
|
74
|
+
this._disposables.add(editorService.onDidEditorsChange(e => {
|
|
75
|
+
if (e.event.kind === 4 && !interactiveWindowOpen.get()) {
|
|
76
|
+
if (editorService.editors.find(editor => editor.editorId === 'interactive')) {
|
|
77
|
+
interactiveWindowOpen.set(true);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (e.event.kind === 5 && interactiveWindowOpen.get()) {
|
|
81
|
+
if (!editorService.editors.find(editor => editor.editorId === 'interactive')) {
|
|
82
|
+
interactiveWindowOpen.set(false);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
dispose() {
|
|
88
|
+
this._disposables.dispose();
|
|
89
|
+
this._onNotebookEditorAdd.dispose();
|
|
90
|
+
this._onNotebookEditorsRemove.dispose();
|
|
91
|
+
}
|
|
92
|
+
_disposeWidget(widget) {
|
|
93
|
+
widget.onWillHide();
|
|
94
|
+
const domNode = widget.getDomNode();
|
|
95
|
+
widget.dispose();
|
|
96
|
+
domNode.remove();
|
|
97
|
+
}
|
|
98
|
+
_allowWidgetMove(input, sourceID, targetID) {
|
|
99
|
+
const targetWidget = this._borrowableEditors.get(targetID)?.get(input.resource);
|
|
100
|
+
if (targetWidget) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const widget = this._borrowableEditors.get(sourceID)?.get(input.resource);
|
|
104
|
+
if (!widget) {
|
|
105
|
+
throw new Error('no widget at source group');
|
|
106
|
+
}
|
|
107
|
+
this._borrowableEditors.get(sourceID)?.delete(input.resource);
|
|
108
|
+
let targetMap = this._borrowableEditors.get(targetID);
|
|
109
|
+
if (!targetMap) {
|
|
110
|
+
targetMap = ( new ResourceMap());
|
|
111
|
+
this._borrowableEditors.set(targetID, targetMap);
|
|
112
|
+
}
|
|
113
|
+
targetMap.set(input.resource, widget);
|
|
114
|
+
}
|
|
115
|
+
retrieveExistingWidgetFromURI(resource) {
|
|
116
|
+
for (const widgetInfo of ( this._borrowableEditors.values())) {
|
|
117
|
+
const widget = widgetInfo.get(resource);
|
|
118
|
+
if (widget) {
|
|
119
|
+
return this._createBorrowValue(widget.token, widget);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
retrieveAllExistingWidgets() {
|
|
125
|
+
const ret = [];
|
|
126
|
+
for (const widgetInfo of ( this._borrowableEditors.values())) {
|
|
127
|
+
for (const widget of ( widgetInfo.values())) {
|
|
128
|
+
ret.push(this._createBorrowValue(widget.token, widget));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return ret;
|
|
132
|
+
}
|
|
133
|
+
retrieveWidget(accessor, group, input, creationOptions, initialDimension) {
|
|
134
|
+
let value = this._borrowableEditors.get(group.id)?.get(input.resource);
|
|
135
|
+
if (!value) {
|
|
136
|
+
const instantiationService = accessor.get(IInstantiationService);
|
|
137
|
+
const widget = instantiationService.createInstance(NotebookEditorWidget, creationOptions ?? getDefaultNotebookCreationOptions(), initialDimension);
|
|
138
|
+
const token = this._tokenPool++;
|
|
139
|
+
value = { widget, token };
|
|
140
|
+
let map = this._borrowableEditors.get(group.id);
|
|
141
|
+
if (!map) {
|
|
142
|
+
map = ( new ResourceMap());
|
|
143
|
+
this._borrowableEditors.set(group.id, map);
|
|
144
|
+
}
|
|
145
|
+
map.set(input.resource, value);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
value.token = this._tokenPool++;
|
|
149
|
+
}
|
|
150
|
+
return this._createBorrowValue(value.token, value);
|
|
151
|
+
}
|
|
152
|
+
_createBorrowValue(myToken, widget) {
|
|
153
|
+
return {
|
|
154
|
+
get value() {
|
|
155
|
+
return widget.token === myToken ? widget.widget : undefined;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
addNotebookEditor(editor) {
|
|
160
|
+
this._notebookEditors.set(editor.getId(), editor);
|
|
161
|
+
this._onNotebookEditorAdd.fire(editor);
|
|
162
|
+
}
|
|
163
|
+
removeNotebookEditor(editor) {
|
|
164
|
+
if (( this._notebookEditors.has(editor.getId()))) {
|
|
165
|
+
this._notebookEditors.delete(editor.getId());
|
|
166
|
+
this._onNotebookEditorsRemove.fire(editor);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
getNotebookEditor(editorId) {
|
|
170
|
+
return this._notebookEditors.get(editorId);
|
|
171
|
+
}
|
|
172
|
+
listNotebookEditors() {
|
|
173
|
+
return ( [...this._notebookEditors].map(e => e[1]));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
NotebookEditorWidgetService = ( __decorate([
|
|
177
|
+
( __param(0, IEditorGroupsService)),
|
|
178
|
+
( __param(1, IEditorService)),
|
|
179
|
+
( __param(2, IContextKeyService))
|
|
180
|
+
], NotebookEditorWidgetService));
|
|
181
|
+
|
|
182
|
+
export { NotebookEditorWidgetService };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
5
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
6
|
+
import { IWorkspaceTrustRequestService } from 'monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js';
|
|
7
|
+
import { KernelPickerMRUStrategy } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy';
|
|
8
|
+
import { CellKind, NotebookCellExecutionState } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
|
+
import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
10
|
+
import { INotebookKernelService, INotebookKernelHistoryService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
|
|
11
|
+
|
|
12
|
+
let NotebookExecutionService = class NotebookExecutionService {
|
|
13
|
+
constructor(_commandService, _notebookKernelService, _notebookKernelHistoryService, _workspaceTrustRequestService, _logService, _notebookExecutionStateService) {
|
|
14
|
+
this._commandService = _commandService;
|
|
15
|
+
this._notebookKernelService = _notebookKernelService;
|
|
16
|
+
this._notebookKernelHistoryService = _notebookKernelHistoryService;
|
|
17
|
+
this._workspaceTrustRequestService = _workspaceTrustRequestService;
|
|
18
|
+
this._logService = _logService;
|
|
19
|
+
this._notebookExecutionStateService = _notebookExecutionStateService;
|
|
20
|
+
this.cellExecutionParticipants = ( new Set());
|
|
21
|
+
}
|
|
22
|
+
async executeNotebookCells(notebook, cells, contextKeyService) {
|
|
23
|
+
const cellsArr = Array.from(cells)
|
|
24
|
+
.filter(c => c.cellKind === CellKind.Code);
|
|
25
|
+
if (!cellsArr.length) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this._logService.debug(`NotebookExecutionService#executeNotebookCells ${JSON.stringify(( cellsArr.map(c => c.handle)))}`);
|
|
29
|
+
const message = ( nls.localizeWithPath(
|
|
30
|
+
'vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl',
|
|
31
|
+
'notebookRunTrust',
|
|
32
|
+
"Executing a notebook cell will run code from this workspace."
|
|
33
|
+
));
|
|
34
|
+
const trust = await this._workspaceTrustRequestService.requestWorkspaceTrust({ message });
|
|
35
|
+
if (!trust) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const cellExecutions = [];
|
|
39
|
+
for (const cell of cellsArr) {
|
|
40
|
+
const cellExe = this._notebookExecutionStateService.getCellExecution(cell.uri);
|
|
41
|
+
if (!!cellExe) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
cellExecutions.push([cell, this._notebookExecutionStateService.createCellExecution(notebook.uri, cell.handle)]);
|
|
45
|
+
}
|
|
46
|
+
const kernel = await KernelPickerMRUStrategy.resolveKernel(notebook, this._notebookKernelService, this._notebookKernelHistoryService, this._commandService);
|
|
47
|
+
if (!kernel) {
|
|
48
|
+
cellExecutions.forEach(cellExe => cellExe[1].complete({}));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this._notebookKernelHistoryService.addMostRecentKernel(kernel);
|
|
52
|
+
const validCellExecutions = [];
|
|
53
|
+
for (const [cell, cellExecution] of cellExecutions) {
|
|
54
|
+
if (!kernel.supportedLanguages.includes(cell.language)) {
|
|
55
|
+
cellExecution.complete({});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
validCellExecutions.push(cellExecution);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (validCellExecutions.length > 0) {
|
|
62
|
+
await this.runExecutionParticipants(validCellExecutions);
|
|
63
|
+
this._notebookKernelService.selectKernelForNotebook(kernel, notebook);
|
|
64
|
+
await kernel.executeNotebookCellsRequest(notebook.uri, ( validCellExecutions.map(c => c.cellHandle)));
|
|
65
|
+
const unconfirmed = validCellExecutions.filter(exe => exe.state === NotebookCellExecutionState.Unconfirmed);
|
|
66
|
+
if (unconfirmed.length) {
|
|
67
|
+
this._logService.debug(`NotebookExecutionService#executeNotebookCells completing unconfirmed executions ${JSON.stringify(( unconfirmed.map(exe => exe.cellHandle)))}`);
|
|
68
|
+
unconfirmed.forEach(exe => exe.complete({}));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async cancelNotebookCellHandles(notebook, cells) {
|
|
73
|
+
const cellsArr = Array.from(cells);
|
|
74
|
+
this._logService.debug(`NotebookExecutionService#cancelNotebookCellHandles ${JSON.stringify(cellsArr)}`);
|
|
75
|
+
const kernel = this._notebookKernelService.getSelectedOrSuggestedKernel(notebook);
|
|
76
|
+
if (kernel) {
|
|
77
|
+
await kernel.cancelNotebookCellExecution(notebook.uri, cellsArr);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async cancelNotebookCells(notebook, cells) {
|
|
81
|
+
this.cancelNotebookCellHandles(notebook, Array.from(cells, cell => cell.handle));
|
|
82
|
+
}
|
|
83
|
+
registerExecutionParticipant(participant) {
|
|
84
|
+
this.cellExecutionParticipants.add(participant);
|
|
85
|
+
return toDisposable(() => this.cellExecutionParticipants.delete(participant));
|
|
86
|
+
}
|
|
87
|
+
async runExecutionParticipants(executions) {
|
|
88
|
+
for (const participant of this.cellExecutionParticipants) {
|
|
89
|
+
await participant.onWillExecuteCell(executions);
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
dispose() {
|
|
94
|
+
this._activeProxyKernelExecutionToken?.dispose(true);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
NotebookExecutionService = ( __decorate([
|
|
98
|
+
( __param(0, ICommandService)),
|
|
99
|
+
( __param(1, INotebookKernelService)),
|
|
100
|
+
( __param(2, INotebookKernelHistoryService)),
|
|
101
|
+
( __param(3, IWorkspaceTrustRequestService)),
|
|
102
|
+
( __param(4, ILogService)),
|
|
103
|
+
( __param(5, INotebookExecutionStateService))
|
|
104
|
+
], NotebookExecutionService));
|
|
105
|
+
|
|
106
|
+
export { NotebookExecutionService };
|