@codingame/monaco-vscode-notebook-service-override 37.1.0 → 37.3.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/index.js +7 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.d.ts +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +210 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.d.ts +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +140 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.d.ts +29 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +194 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.d.ts +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +149 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.d.ts +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +372 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.d.ts +10 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +26 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.d.ts +9 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +43 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +19 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +32 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +30 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +11 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +38 -38
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +30 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +21 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +68 -68
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +35 -35
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +15 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +26 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +352 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +44 -18
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +14 -14
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +5 -5
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { isNonEmptyArray } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
|
+
import { onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
6
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
7
|
+
import { DisposableMap, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
9
|
+
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
10
|
+
import { NotebookDto } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/browser/mainThreadNotebookDto';
|
|
11
|
+
import { extHostNamedCustomer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers';
|
|
12
|
+
import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
13
|
+
import { INotebookExecutionStateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
14
|
+
import { INotebookKernelService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
|
|
15
|
+
import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
|
|
16
|
+
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
17
|
+
import { AsyncIterableProducer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
18
|
+
|
|
19
|
+
class MainThreadKernel {
|
|
20
|
+
get preloadUris() {
|
|
21
|
+
return this.preloads.map(p => p.uri);
|
|
22
|
+
}
|
|
23
|
+
get preloadProvides() {
|
|
24
|
+
return this.preloads.flatMap(p => p.provides);
|
|
25
|
+
}
|
|
26
|
+
constructor(data, _languageService) {
|
|
27
|
+
this._languageService = _languageService;
|
|
28
|
+
this._onDidChange = ( new Emitter());
|
|
29
|
+
this.onDidChange = this._onDidChange.event;
|
|
30
|
+
this.id = data.id;
|
|
31
|
+
this.viewType = data.notebookType;
|
|
32
|
+
this.extension = data.extensionId;
|
|
33
|
+
this.implementsInterrupt = data.supportsInterrupt ?? false;
|
|
34
|
+
this.label = data.label;
|
|
35
|
+
this.description = data.description;
|
|
36
|
+
this.detail = data.detail;
|
|
37
|
+
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : _languageService.getRegisteredLanguageIds();
|
|
38
|
+
this.implementsExecutionOrder = data.supportsExecutionOrder ?? false;
|
|
39
|
+
this.hasVariableProvider = data.hasVariableProvider ?? false;
|
|
40
|
+
this.localResourceRoot = URI.revive(data.extensionLocation);
|
|
41
|
+
this.preloads = data.preloads?.map(u => ({
|
|
42
|
+
uri: URI.revive(u.uri),
|
|
43
|
+
provides: u.provides
|
|
44
|
+
})) ?? [];
|
|
45
|
+
}
|
|
46
|
+
update(data) {
|
|
47
|
+
const event = Object.create(null);
|
|
48
|
+
if (data.label !== undefined) {
|
|
49
|
+
this.label = data.label;
|
|
50
|
+
event.label = true;
|
|
51
|
+
}
|
|
52
|
+
if (data.description !== undefined) {
|
|
53
|
+
this.description = data.description;
|
|
54
|
+
event.description = true;
|
|
55
|
+
}
|
|
56
|
+
if (data.detail !== undefined) {
|
|
57
|
+
this.detail = data.detail;
|
|
58
|
+
event.detail = true;
|
|
59
|
+
}
|
|
60
|
+
if (data.supportedLanguages !== undefined) {
|
|
61
|
+
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : this._languageService.getRegisteredLanguageIds();
|
|
62
|
+
event.supportedLanguages = true;
|
|
63
|
+
}
|
|
64
|
+
if (data.supportsExecutionOrder !== undefined) {
|
|
65
|
+
this.implementsExecutionOrder = data.supportsExecutionOrder;
|
|
66
|
+
event.hasExecutionOrder = true;
|
|
67
|
+
}
|
|
68
|
+
if (data.supportsInterrupt !== undefined) {
|
|
69
|
+
this.implementsInterrupt = data.supportsInterrupt;
|
|
70
|
+
event.hasInterruptHandler = true;
|
|
71
|
+
}
|
|
72
|
+
if (data.hasVariableProvider !== undefined) {
|
|
73
|
+
this.hasVariableProvider = data.hasVariableProvider;
|
|
74
|
+
event.hasVariableProvider = true;
|
|
75
|
+
}
|
|
76
|
+
this._onDidChange.fire(event);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class MainThreadKernelDetectionTask {
|
|
80
|
+
constructor(notebookType) {
|
|
81
|
+
this.notebookType = notebookType;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let MainThreadNotebookKernels = class MainThreadNotebookKernels {
|
|
85
|
+
constructor(
|
|
86
|
+
extHostContext,
|
|
87
|
+
_languageService,
|
|
88
|
+
_notebookKernelService,
|
|
89
|
+
_notebookExecutionStateService,
|
|
90
|
+
_notebookService,
|
|
91
|
+
notebookEditorService
|
|
92
|
+
) {
|
|
93
|
+
this._languageService = _languageService;
|
|
94
|
+
this._notebookKernelService = _notebookKernelService;
|
|
95
|
+
this._notebookExecutionStateService = _notebookExecutionStateService;
|
|
96
|
+
this._notebookService = _notebookService;
|
|
97
|
+
this._editors = ( new DisposableMap());
|
|
98
|
+
this._disposables = ( new DisposableStore());
|
|
99
|
+
this._kernels = ( new Map());
|
|
100
|
+
this._kernelDetectionTasks = ( new Map());
|
|
101
|
+
this._kernelSourceActionProviders = ( new Map());
|
|
102
|
+
this._kernelSourceActionProvidersEventRegistrations = ( new Map());
|
|
103
|
+
this._executions = ( new Map());
|
|
104
|
+
this._notebookExecutions = ( new Map());
|
|
105
|
+
this.variableRequestIndex = 0;
|
|
106
|
+
this.variableRequestMap = ( new Map());
|
|
107
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookKernels));
|
|
108
|
+
notebookEditorService.listNotebookEditors().forEach(this._onEditorAdd, this);
|
|
109
|
+
notebookEditorService.onDidAddNotebookEditor(this._onEditorAdd, this, this._disposables);
|
|
110
|
+
notebookEditorService.onDidRemoveNotebookEditor(this._onEditorRemove, this, this._disposables);
|
|
111
|
+
this._disposables.add(toDisposable(() => {
|
|
112
|
+
this._executions.forEach(e => {
|
|
113
|
+
e.complete({});
|
|
114
|
+
});
|
|
115
|
+
this._notebookExecutions.forEach(e => e.complete());
|
|
116
|
+
}));
|
|
117
|
+
this._disposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(e => {
|
|
118
|
+
for (const [handle, [kernel]] of this._kernels) {
|
|
119
|
+
if (e.oldKernel === kernel.id) {
|
|
120
|
+
this._proxy.$acceptNotebookAssociation(handle, e.notebook, false);
|
|
121
|
+
} else if (e.newKernel === kernel.id) {
|
|
122
|
+
this._proxy.$acceptNotebookAssociation(handle, e.notebook, true);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
dispose() {
|
|
128
|
+
this._disposables.dispose();
|
|
129
|
+
for (const [, registration] of ( this._kernels.values())) {
|
|
130
|
+
registration.dispose();
|
|
131
|
+
}
|
|
132
|
+
for (const [, registration] of ( this._kernelDetectionTasks.values())) {
|
|
133
|
+
registration.dispose();
|
|
134
|
+
}
|
|
135
|
+
for (const [, registration] of ( this._kernelSourceActionProviders.values())) {
|
|
136
|
+
registration.dispose();
|
|
137
|
+
}
|
|
138
|
+
this._editors.dispose();
|
|
139
|
+
}
|
|
140
|
+
_onEditorAdd(editor) {
|
|
141
|
+
const ipcListener = editor.onDidReceiveMessage(e => {
|
|
142
|
+
if (!editor.hasModel()) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const {
|
|
146
|
+
selected
|
|
147
|
+
} = this._notebookKernelService.getMatchingKernel(editor.textModel);
|
|
148
|
+
if (!selected) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
for (const [handle, candidate] of this._kernels) {
|
|
152
|
+
if (candidate[0] === selected) {
|
|
153
|
+
this._proxy.$acceptKernelMessageFromRenderer(handle, editor.getId(), e.message);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
this._editors.set(editor, ipcListener);
|
|
159
|
+
}
|
|
160
|
+
_onEditorRemove(editor) {
|
|
161
|
+
this._editors.deleteAndDispose(editor);
|
|
162
|
+
}
|
|
163
|
+
async $postMessage(handle, editorId, message) {
|
|
164
|
+
const tuple = this._kernels.get(handle);
|
|
165
|
+
if (!tuple) {
|
|
166
|
+
throw ( new Error("kernel already disposed"));
|
|
167
|
+
}
|
|
168
|
+
const [kernel] = tuple;
|
|
169
|
+
let didSend = false;
|
|
170
|
+
for (const [editor] of this._editors) {
|
|
171
|
+
if (!editor.hasModel()) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (this._notebookKernelService.getMatchingKernel(editor.textModel).selected !== kernel) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (editorId === undefined) {
|
|
178
|
+
editor.postMessage(message);
|
|
179
|
+
didSend = true;
|
|
180
|
+
} else if (editor.getId() === editorId) {
|
|
181
|
+
editor.postMessage(message);
|
|
182
|
+
didSend = true;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return didSend;
|
|
187
|
+
}
|
|
188
|
+
$receiveVariable(requestId, variable) {
|
|
189
|
+
const emitter = this.variableRequestMap.get(requestId);
|
|
190
|
+
if (emitter) {
|
|
191
|
+
emitter.emitOne(variable);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async $addKernel(handle, data) {
|
|
195
|
+
const that = this;
|
|
196
|
+
const kernel = new (class extends MainThreadKernel {
|
|
197
|
+
async executeNotebookCellsRequest(uri, handles) {
|
|
198
|
+
await that._proxy.$executeCells(handle, uri, handles);
|
|
199
|
+
}
|
|
200
|
+
async cancelNotebookCellExecution(uri, handles) {
|
|
201
|
+
await that._proxy.$cancelCells(handle, uri, handles);
|
|
202
|
+
}
|
|
203
|
+
provideVariables(notebookUri, parentId, kind, start, token) {
|
|
204
|
+
const requestId = `${handle}variables${that.variableRequestIndex++}`;
|
|
205
|
+
return new AsyncIterableProducer(async emitter => {
|
|
206
|
+
that.variableRequestMap.set(requestId, emitter);
|
|
207
|
+
try {
|
|
208
|
+
await that._proxy.$provideVariables(handle, requestId, notebookUri, parentId, kind, start, token);
|
|
209
|
+
} finally {
|
|
210
|
+
that.variableRequestMap.delete(requestId);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
})(data, this._languageService);
|
|
215
|
+
const disposables = this._disposables.add(( new DisposableStore()));
|
|
216
|
+
this._kernels.set(handle, [kernel, disposables]);
|
|
217
|
+
disposables.add(this._notebookKernelService.registerKernel(kernel));
|
|
218
|
+
}
|
|
219
|
+
$updateKernel(handle, data) {
|
|
220
|
+
const tuple = this._kernels.get(handle);
|
|
221
|
+
if (tuple) {
|
|
222
|
+
tuple[0].update(data);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
$removeKernel(handle) {
|
|
226
|
+
const tuple = this._kernels.get(handle);
|
|
227
|
+
if (tuple) {
|
|
228
|
+
tuple[1].dispose();
|
|
229
|
+
this._kernels.delete(handle);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
$updateNotebookPriority(handle, notebook, value) {
|
|
233
|
+
const tuple = this._kernels.get(handle);
|
|
234
|
+
if (tuple) {
|
|
235
|
+
this._notebookKernelService.updateKernelNotebookAffinity(tuple[0], URI.revive(notebook), value);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
$createExecution(handle, controllerId, rawUri, cellHandle) {
|
|
239
|
+
const uri = URI.revive(rawUri);
|
|
240
|
+
const notebook = this._notebookService.getNotebookTextModel(uri);
|
|
241
|
+
if (!notebook) {
|
|
242
|
+
throw ( new Error(`Notebook not found: ${( uri.toString())}`));
|
|
243
|
+
}
|
|
244
|
+
const kernel = this._notebookKernelService.getMatchingKernel(notebook);
|
|
245
|
+
if (!kernel.selected || kernel.selected.id !== controllerId) {
|
|
246
|
+
throw ( new Error(`Kernel is not selected: ${kernel.selected?.id} !== ${controllerId}`));
|
|
247
|
+
}
|
|
248
|
+
const execution = this._notebookExecutionStateService.createCellExecution(uri, cellHandle);
|
|
249
|
+
execution.confirm();
|
|
250
|
+
this._executions.set(handle, execution);
|
|
251
|
+
}
|
|
252
|
+
$updateExecution(handle, data) {
|
|
253
|
+
const updates = data.value;
|
|
254
|
+
try {
|
|
255
|
+
const execution = this._executions.get(handle);
|
|
256
|
+
execution?.update(updates.map(NotebookDto.fromCellExecuteUpdateDto));
|
|
257
|
+
} catch (e) {
|
|
258
|
+
onUnexpectedError(e);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
$completeExecution(handle, data) {
|
|
262
|
+
try {
|
|
263
|
+
const execution = this._executions.get(handle);
|
|
264
|
+
execution?.complete(NotebookDto.fromCellExecuteCompleteDto(data.value));
|
|
265
|
+
} catch (e) {
|
|
266
|
+
onUnexpectedError(e);
|
|
267
|
+
} finally {
|
|
268
|
+
this._executions.delete(handle);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
$createNotebookExecution(handle, controllerId, rawUri) {
|
|
272
|
+
const uri = URI.revive(rawUri);
|
|
273
|
+
const notebook = this._notebookService.getNotebookTextModel(uri);
|
|
274
|
+
if (!notebook) {
|
|
275
|
+
throw ( new Error(`Notebook not found: ${( uri.toString())}`));
|
|
276
|
+
}
|
|
277
|
+
const kernel = this._notebookKernelService.getMatchingKernel(notebook);
|
|
278
|
+
if (!kernel.selected || kernel.selected.id !== controllerId) {
|
|
279
|
+
throw ( new Error(`Kernel is not selected: ${kernel.selected?.id} !== ${controllerId}`));
|
|
280
|
+
}
|
|
281
|
+
const execution = this._notebookExecutionStateService.createExecution(uri);
|
|
282
|
+
execution.confirm();
|
|
283
|
+
this._notebookExecutions.set(handle, execution);
|
|
284
|
+
}
|
|
285
|
+
$beginNotebookExecution(handle) {
|
|
286
|
+
try {
|
|
287
|
+
const execution = this._notebookExecutions.get(handle);
|
|
288
|
+
execution?.begin();
|
|
289
|
+
} catch (e) {
|
|
290
|
+
onUnexpectedError(e);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
$completeNotebookExecution(handle) {
|
|
294
|
+
try {
|
|
295
|
+
const execution = this._notebookExecutions.get(handle);
|
|
296
|
+
execution?.complete();
|
|
297
|
+
} catch (e) {
|
|
298
|
+
onUnexpectedError(e);
|
|
299
|
+
} finally {
|
|
300
|
+
this._notebookExecutions.delete(handle);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
async $addKernelDetectionTask(handle, notebookType) {
|
|
304
|
+
const kernelDetectionTask = ( new MainThreadKernelDetectionTask(notebookType));
|
|
305
|
+
const registration = this._notebookKernelService.registerNotebookKernelDetectionTask(kernelDetectionTask);
|
|
306
|
+
this._kernelDetectionTasks.set(handle, [kernelDetectionTask, registration]);
|
|
307
|
+
}
|
|
308
|
+
$removeKernelDetectionTask(handle) {
|
|
309
|
+
const tuple = this._kernelDetectionTasks.get(handle);
|
|
310
|
+
if (tuple) {
|
|
311
|
+
tuple[1].dispose();
|
|
312
|
+
this._kernelDetectionTasks.delete(handle);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
async $addKernelSourceActionProvider(handle, eventHandle, notebookType) {
|
|
316
|
+
const kernelSourceActionProvider = {
|
|
317
|
+
viewType: notebookType,
|
|
318
|
+
provideKernelSourceActions: async () => {
|
|
319
|
+
const actions = await this._proxy.$provideKernelSourceActions(handle, CancellationToken.None);
|
|
320
|
+
return actions.map(action => {
|
|
321
|
+
let documentation = action.documentation;
|
|
322
|
+
if (action.documentation && typeof action.documentation !== "string") {
|
|
323
|
+
documentation = URI.revive(action.documentation);
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
label: action.label,
|
|
327
|
+
command: action.command,
|
|
328
|
+
description: action.description,
|
|
329
|
+
detail: action.detail,
|
|
330
|
+
documentation
|
|
331
|
+
};
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
if (typeof eventHandle === "number") {
|
|
336
|
+
const emitter = ( new Emitter());
|
|
337
|
+
this._kernelSourceActionProvidersEventRegistrations.set(eventHandle, emitter);
|
|
338
|
+
kernelSourceActionProvider.onDidChangeSourceActions = emitter.event;
|
|
339
|
+
}
|
|
340
|
+
const registration = this._notebookKernelService.registerKernelSourceActionProvider(notebookType, kernelSourceActionProvider);
|
|
341
|
+
this._kernelSourceActionProviders.set(handle, [kernelSourceActionProvider, registration]);
|
|
342
|
+
}
|
|
343
|
+
$removeKernelSourceActionProvider(handle, eventHandle) {
|
|
344
|
+
const tuple = this._kernelSourceActionProviders.get(handle);
|
|
345
|
+
if (tuple) {
|
|
346
|
+
tuple[1].dispose();
|
|
347
|
+
this._kernelSourceActionProviders.delete(handle);
|
|
348
|
+
}
|
|
349
|
+
if (typeof eventHandle === "number") {
|
|
350
|
+
this._kernelSourceActionProvidersEventRegistrations.delete(eventHandle);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
$emitNotebookKernelSourceActionsChangeEvent(eventHandle) {
|
|
354
|
+
const emitter = this._kernelSourceActionProvidersEventRegistrations.get(eventHandle);
|
|
355
|
+
if (emitter instanceof Emitter) {
|
|
356
|
+
emitter.fire(undefined);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
$variablesUpdated(notebookUri) {
|
|
360
|
+
this._notebookKernelService.notifyVariablesChange(URI.revive(notebookUri));
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
MainThreadNotebookKernels = __decorate([
|
|
364
|
+
extHostNamedCustomer(MainContext.MainThreadNotebookKernels),
|
|
365
|
+
( __param(1, ILanguageService)),
|
|
366
|
+
( __param(2, INotebookKernelService)),
|
|
367
|
+
( __param(3, INotebookExecutionStateService)),
|
|
368
|
+
( __param(4, INotebookService)),
|
|
369
|
+
( __param(5, INotebookEditorService))
|
|
370
|
+
], MainThreadNotebookKernels);
|
|
371
|
+
|
|
372
|
+
export { MainThreadNotebookKernels };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { MainThreadNotebookRenderersShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
|
|
3
|
+
import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
|
|
4
|
+
import { INotebookRendererMessagingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookRendererMessagingService.service";
|
|
5
|
+
export declare class MainThreadNotebookRenderers extends Disposable implements MainThreadNotebookRenderersShape {
|
|
6
|
+
private readonly messaging;
|
|
7
|
+
private readonly proxy;
|
|
8
|
+
constructor(extHostContext: IExtHostContext, messaging: INotebookRendererMessagingService);
|
|
9
|
+
$postMessage(editorId: string | undefined, rendererId: string, message: unknown): Promise<boolean>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
|
|
5
|
+
import { extHostNamedCustomer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers';
|
|
6
|
+
import { INotebookRendererMessagingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookRendererMessagingService.service';
|
|
7
|
+
|
|
8
|
+
let MainThreadNotebookRenderers = class MainThreadNotebookRenderers extends Disposable {
|
|
9
|
+
constructor(extHostContext, messaging) {
|
|
10
|
+
super();
|
|
11
|
+
this.messaging = messaging;
|
|
12
|
+
this.proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookRenderers));
|
|
13
|
+
this._register(messaging.onShouldPostMessage(e => {
|
|
14
|
+
this.proxy.$postRendererMessage(e.editorId, e.rendererId, e.message);
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
$postMessage(editorId, rendererId, message) {
|
|
18
|
+
return this.messaging.receiveMessage(editorId, rendererId, message);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
MainThreadNotebookRenderers = __decorate([
|
|
22
|
+
extHostNamedCustomer(MainContext.MainThreadNotebookRenderers),
|
|
23
|
+
( __param(1, INotebookRendererMessagingService))
|
|
24
|
+
], MainThreadNotebookRenderers);
|
|
25
|
+
|
|
26
|
+
export { MainThreadNotebookRenderers };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
2
|
+
import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
|
|
3
|
+
import { IWorkingCopyFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service";
|
|
4
|
+
export declare class SaveParticipant {
|
|
5
|
+
private readonly workingCopyFileService;
|
|
6
|
+
private _saveParticipantDisposable;
|
|
7
|
+
constructor(extHostContext: IExtHostContext, instantiationService: IInstantiationService, workingCopyFileService: IWorkingCopyFileService);
|
|
8
|
+
dispose(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import { extHostCustomer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers';
|
|
6
|
+
import { ExtHostContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
|
|
7
|
+
import { raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
8
|
+
import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
9
|
+
import { NotebookFileWorkingCopyModel } from '../../contrib/notebook/common/notebookEditorModel.js';
|
|
10
|
+
|
|
11
|
+
class ExtHostNotebookDocumentSaveParticipant {
|
|
12
|
+
constructor(extHostContext) {
|
|
13
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookDocumentSaveParticipant));
|
|
14
|
+
}
|
|
15
|
+
async participate(workingCopy, context, _progress, token) {
|
|
16
|
+
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
let _warningTimeout;
|
|
20
|
+
const p = ( new Promise((resolve, reject) => {
|
|
21
|
+
_warningTimeout = setTimeout(() => reject(( new Error(( localize(5002, "Aborted onWillSaveNotebookDocument-event after 1750ms"))))), 1750);
|
|
22
|
+
this._proxy.$participateInSave(workingCopy.resource, context.reason, token).then(_ => {
|
|
23
|
+
clearTimeout(_warningTimeout);
|
|
24
|
+
return undefined;
|
|
25
|
+
}).then(resolve, reject);
|
|
26
|
+
}));
|
|
27
|
+
return raceCancellationError(p, token);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
let SaveParticipant = class SaveParticipant {
|
|
31
|
+
constructor(extHostContext, instantiationService, workingCopyFileService) {
|
|
32
|
+
this.workingCopyFileService = workingCopyFileService;
|
|
33
|
+
this._saveParticipantDisposable = this.workingCopyFileService.addSaveParticipant(
|
|
34
|
+
instantiationService.createInstance(ExtHostNotebookDocumentSaveParticipant, extHostContext)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
dispose() {
|
|
38
|
+
this._saveParticipantDisposable.dispose();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
SaveParticipant = __decorate([extHostCustomer, ( __param(1, IInstantiationService)), ( __param(2, IWorkingCopyFileService))], SaveParticipant);
|
|
42
|
+
|
|
43
|
+
export { SaveParticipant };
|
|
@@ -31,7 +31,7 @@ import { EmptyTextEditorHintContributionId } from '@codingame/monaco-vscode-api/
|
|
|
31
31
|
import * as emptyTextEditorHint from './emptyTextEditorHint.css';
|
|
32
32
|
|
|
33
33
|
var EmptyTextEditorHintContentWidget_1;
|
|
34
|
-
registerCss(emptyTextEditorHint);
|
|
34
|
+
registerCss(emptyTextEditorHint, 1);
|
|
35
35
|
const emptyTextEditorHintSetting = "workbench.editor.empty.hint";
|
|
36
36
|
let EmptyTextEditorHintContribution = class EmptyTextEditorHintContribution extends Disposable {
|
|
37
37
|
static {
|
|
@@ -180,8 +180,8 @@ let EmptyTextEditorHintContentWidget = class EmptyTextEditorHintContentWidget ex
|
|
|
180
180
|
getActions: () => {
|
|
181
181
|
return [{
|
|
182
182
|
id: "workench.action.disableEmptyEditorHint",
|
|
183
|
-
label: ( localize(
|
|
184
|
-
tooltip: ( localize(
|
|
183
|
+
label: ( localize(13109, "Disable Empty Editor Hint")),
|
|
184
|
+
tooltip: ( localize(13109, "Disable Empty Editor Hint")),
|
|
185
185
|
enabled: true,
|
|
186
186
|
class: undefined,
|
|
187
187
|
run: () => {
|
|
@@ -231,14 +231,14 @@ let EmptyTextEditorHintContentWidget = class EmptyTextEditorHintContentWidget ex
|
|
|
231
231
|
this.editor.focus();
|
|
232
232
|
};
|
|
233
233
|
const keybindingsLookup = [askSomethingCommandId, ChangeLanguageAction.ID];
|
|
234
|
-
const keybindingLabels =
|
|
234
|
+
const keybindingLabels = keybindingsLookup.map(id => this.keybindingService.lookupKeybinding(id)?.getLabel());
|
|
235
235
|
const hintMsg = (hasInlineChatProvider ? ( localize(
|
|
236
|
-
|
|
236
|
+
13110,
|
|
237
237
|
"[[Generate code]] ({0}), or [[select a language]] ({1}). Start typing to dismiss or [[don't show]] this again.",
|
|
238
238
|
keybindingLabels.at(0) ?? "",
|
|
239
239
|
keybindingLabels.at(1) ?? ""
|
|
240
240
|
)) : ( localize(
|
|
241
|
-
|
|
241
|
+
13111,
|
|
242
242
|
"[[Select a language]] ({0}) to get started. Start typing to dismiss or [[don't show]] this again.",
|
|
243
243
|
keybindingLabels.at(1) ?? ""
|
|
244
244
|
))).replaceAll(" ()", "");
|
|
@@ -248,11 +248,11 @@ let EmptyTextEditorHintContentWidget = class EmptyTextEditorHintContentWidget ex
|
|
|
248
248
|
});
|
|
249
249
|
hintElement.style.fontStyle = "italic";
|
|
250
250
|
const ariaLabel = hasInlineChatProvider ? ( localize(
|
|
251
|
-
|
|
251
|
+
13112,
|
|
252
252
|
"Execute {0} to ask a question, execute {1} to select a language and get started. Start typing to dismiss.",
|
|
253
253
|
...keybindingLabels
|
|
254
254
|
)) : ( localize(
|
|
255
|
-
|
|
255
|
+
13113,
|
|
256
256
|
"Execute {0} to select a language and get started. Start typing to dismiss.",
|
|
257
257
|
...keybindingLabels
|
|
258
258
|
));
|
|
@@ -275,7 +275,7 @@ let EmptyTextEditorHintContentWidget = class EmptyTextEditorHintContentWidget ex
|
|
|
275
275
|
} = this.getHint();
|
|
276
276
|
this.domNode.append(hintElement);
|
|
277
277
|
this.ariaLabel = ariaLabel.concat(( localize(
|
|
278
|
-
|
|
278
|
+
13114,
|
|
279
279
|
" Toggle {0} in settings to disable this hint.",
|
|
280
280
|
AccessibilityVerbositySettingId.EmptyEditorHint
|
|
281
281
|
)));
|