@difizen/libro-jupyter 0.2.11 → 0.2.13
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.
|
@@ -11,7 +11,7 @@ export declare class JupyterCodeCellView extends LibroCodeCellView {
|
|
|
11
11
|
model: JupyterCodeCellModel;
|
|
12
12
|
clearExecution: () => void;
|
|
13
13
|
protected getEditorOption(): CodeEditorViewOptions;
|
|
14
|
-
onViewMount(): void
|
|
14
|
+
onViewMount(): Promise<void>;
|
|
15
15
|
tooltipProvider: TooltipProvider;
|
|
16
16
|
completionProvider: CompletionProvider;
|
|
17
17
|
run(): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jupyter-code-cell-view.d.ts","sourceRoot":"","sources":["../../src/cell/jupyter-code-cell-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAElB,eAAe,EAEhB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"jupyter-code-cell-view.d.ts","sourceRoot":"","sources":["../../src/cell/jupyter-code-cell-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAElB,eAAe,EAEhB,MAAM,4BAA4B,CAAC;AAYpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAkBzE,qBAEa,mBAAoB,SAAQ,iBAAiB;IACxD,UAAkB,OAAO,EAAE,gBAAgB,CAAC;IAE5C,IAAa,MAAM,IAGQ,gBAAgB,CAD1C;IACD,IAAa,MAAM,CAAC,KAAK,EAAE,gBAAgB,EAG1C;IAEQ,IAAI,2FAA4B;IACjC,KAAK,EAAE,oBAAoB,CAAC;IAE3B,cAAc,aAQrB;cAEiB,eAAe,IAAI,qBAAqB;IAe5C,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB3C,eAAe,EAAE,eAAe,CAqB9B;IAEF,kBAAkB,EAAE,kBAAkB,CA8BpC;IAEa,GAAG;CA8EnB"}
|
|
@@ -177,37 +177,57 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
177
177
|
}
|
|
178
178
|
}, {
|
|
179
179
|
key: "onViewMount",
|
|
180
|
-
value: function
|
|
181
|
-
var
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
180
|
+
value: function () {
|
|
181
|
+
var _onViewMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
182
|
+
var _this2 = this;
|
|
183
|
+
var kcReady, kernelConnection;
|
|
184
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
185
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
186
|
+
case 0:
|
|
187
|
+
_get(_getPrototypeOf(JupyterCodeCellView.prototype), "onViewMount", this).call(this);
|
|
188
|
+
kcReady = getOrigin(this.parent.model.kcReady);
|
|
189
|
+
_context3.next = 4;
|
|
190
|
+
return kcReady;
|
|
191
|
+
case 4:
|
|
192
|
+
kernelConnection = _context3.sent;
|
|
193
|
+
// kernel重启后,清除执行状态,输出不变
|
|
194
|
+
kernelConnection === null || kernelConnection === void 0 || kernelConnection.statusChanged(function (e) {
|
|
195
|
+
var terminateStatus = ['autorestarting', 'starting', 'restarting'];
|
|
196
|
+
if (terminateStatus.includes(e)) {
|
|
197
|
+
_this2.model.clearExecution();
|
|
198
|
+
_this2.model.executing = false;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
case 6:
|
|
202
|
+
case "end":
|
|
203
|
+
return _context3.stop();
|
|
204
|
+
}
|
|
205
|
+
}, _callee3, this);
|
|
206
|
+
}));
|
|
207
|
+
function onViewMount() {
|
|
208
|
+
return _onViewMount.apply(this, arguments);
|
|
209
|
+
}
|
|
210
|
+
return onViewMount;
|
|
211
|
+
}()
|
|
192
212
|
}, {
|
|
193
213
|
key: "run",
|
|
194
214
|
value: function () {
|
|
195
|
-
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
215
|
+
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
196
216
|
var libroModel, kernelConnection, cellContent, cellModel, future, startTimeStr, msgPromise, endTimeStr;
|
|
197
|
-
return _regeneratorRuntime().wrap(function
|
|
198
|
-
while (1) switch (
|
|
217
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
218
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
199
219
|
case 0:
|
|
200
220
|
libroModel = this.parent.model;
|
|
201
221
|
if (!(!libroModel || !(libroModel instanceof LibroJupyterModel) || !libroModel.kernelConnection || libroModel.kernelConnection.isDisposed)) {
|
|
202
|
-
|
|
222
|
+
_context4.next = 3;
|
|
203
223
|
break;
|
|
204
224
|
}
|
|
205
|
-
return
|
|
225
|
+
return _context4.abrupt("return", false);
|
|
206
226
|
case 3:
|
|
207
227
|
kernelConnection = getOrigin(libroModel.kernelConnection);
|
|
208
228
|
cellContent = this.model.source;
|
|
209
229
|
cellModel = this.model;
|
|
210
|
-
|
|
230
|
+
_context4.prev = 6;
|
|
211
231
|
// if (this.outputArea instanceof LibroOutputArea)
|
|
212
232
|
// this.outputArea.lastOutputContainerHeight =
|
|
213
233
|
// this.outputArea.container?.current?.clientHeight;
|
|
@@ -239,10 +259,10 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
239
259
|
future.onReply = function (msg) {
|
|
240
260
|
cellModel.msgChangeEmitter.fire(msg);
|
|
241
261
|
};
|
|
242
|
-
|
|
262
|
+
_context4.next = 15;
|
|
243
263
|
return future.done;
|
|
244
264
|
case 15:
|
|
245
|
-
msgPromise =
|
|
265
|
+
msgPromise = _context4.sent;
|
|
246
266
|
cellModel.executing = false;
|
|
247
267
|
cellModel.kernelExecuting = false;
|
|
248
268
|
startTimeStr = msgPromise.metadata['started'];
|
|
@@ -250,36 +270,36 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
250
270
|
cellModel.metadata.execution['shell.execute_reply.started'] = startTimeStr;
|
|
251
271
|
cellModel.metadata.execution['shell.execute_reply.end'] = endTimeStr;
|
|
252
272
|
if (msgPromise) {
|
|
253
|
-
|
|
273
|
+
_context4.next = 24;
|
|
254
274
|
break;
|
|
255
275
|
}
|
|
256
|
-
return
|
|
276
|
+
return _context4.abrupt("return", true);
|
|
257
277
|
case 24:
|
|
258
278
|
if (!(msgPromise.content.status === 'ok')) {
|
|
259
|
-
|
|
279
|
+
_context4.next = 28;
|
|
260
280
|
break;
|
|
261
281
|
}
|
|
262
|
-
return
|
|
282
|
+
return _context4.abrupt("return", true);
|
|
263
283
|
case 28:
|
|
264
284
|
throw new KernelError(msgPromise.content);
|
|
265
285
|
case 29:
|
|
266
|
-
|
|
286
|
+
_context4.next = 36;
|
|
267
287
|
break;
|
|
268
288
|
case 31:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (!
|
|
272
|
-
|
|
289
|
+
_context4.prev = 31;
|
|
290
|
+
_context4.t0 = _context4["catch"](6);
|
|
291
|
+
if (!_context4.t0.message.startsWith('Canceled')) {
|
|
292
|
+
_context4.next = 35;
|
|
273
293
|
break;
|
|
274
294
|
}
|
|
275
|
-
return
|
|
295
|
+
return _context4.abrupt("return", false);
|
|
276
296
|
case 35:
|
|
277
|
-
throw
|
|
297
|
+
throw _context4.t0;
|
|
278
298
|
case 36:
|
|
279
299
|
case "end":
|
|
280
|
-
return
|
|
300
|
+
return _context4.stop();
|
|
281
301
|
}
|
|
282
|
-
},
|
|
302
|
+
}, _callee4, this, [[6, 31]]);
|
|
283
303
|
}));
|
|
284
304
|
function run() {
|
|
285
305
|
return _run.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-jupyter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro"
|
|
@@ -31,22 +31,22 @@
|
|
|
31
31
|
"src"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@difizen/libro-cofine-editor": "^0.2.
|
|
35
|
-
"@difizen/libro-code-editor": "^0.2.
|
|
36
|
-
"@difizen/libro-code-cell": "^0.2.
|
|
37
|
-
"@difizen/libro-codemirror": "^0.2.
|
|
38
|
-
"@difizen/libro-rendermime": "^0.2.
|
|
39
|
-
"@difizen/libro-common": "^0.2.
|
|
40
|
-
"@difizen/libro-core": "^0.2.
|
|
41
|
-
"@difizen/libro-kernel": "^0.2.
|
|
42
|
-
"@difizen/libro-l10n": "^0.2.
|
|
43
|
-
"@difizen/libro-output": "^0.2.
|
|
44
|
-
"@difizen/libro-search": "^0.2.
|
|
45
|
-
"@difizen/libro-search-code-cell": "^0.2.
|
|
46
|
-
"@difizen/libro-lsp": "^0.2.
|
|
47
|
-
"@difizen/libro-markdown-cell": "^0.2.
|
|
48
|
-
"@difizen/libro-raw-cell": "^0.2.
|
|
49
|
-
"@difizen/libro-language-client": "^0.2.
|
|
34
|
+
"@difizen/libro-cofine-editor": "^0.2.13",
|
|
35
|
+
"@difizen/libro-code-editor": "^0.2.13",
|
|
36
|
+
"@difizen/libro-code-cell": "^0.2.13",
|
|
37
|
+
"@difizen/libro-codemirror": "^0.2.13",
|
|
38
|
+
"@difizen/libro-rendermime": "^0.2.13",
|
|
39
|
+
"@difizen/libro-common": "^0.2.13",
|
|
40
|
+
"@difizen/libro-core": "^0.2.13",
|
|
41
|
+
"@difizen/libro-kernel": "^0.2.13",
|
|
42
|
+
"@difizen/libro-l10n": "^0.2.13",
|
|
43
|
+
"@difizen/libro-output": "^0.2.13",
|
|
44
|
+
"@difizen/libro-search": "^0.2.13",
|
|
45
|
+
"@difizen/libro-search-code-cell": "^0.2.13",
|
|
46
|
+
"@difizen/libro-lsp": "^0.2.13",
|
|
47
|
+
"@difizen/libro-markdown-cell": "^0.2.13",
|
|
48
|
+
"@difizen/libro-raw-cell": "^0.2.13",
|
|
49
|
+
"@difizen/libro-language-client": "^0.2.13",
|
|
50
50
|
"@difizen/mana-app": "latest",
|
|
51
51
|
"@difizen/mana-l10n": "latest",
|
|
52
52
|
"@ant-design/colors": "^7.0.0",
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
TooltipProvider,
|
|
7
7
|
TooltipProviderOption,
|
|
8
8
|
} from '@difizen/libro-code-editor';
|
|
9
|
+
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
9
10
|
import { KernelError } from '@difizen/libro-kernel';
|
|
10
11
|
import { getCellURI } from '@difizen/libro-language-client';
|
|
11
12
|
import { transient } from '@difizen/mana-app';
|
|
@@ -77,16 +78,20 @@ export class JupyterCodeCellView extends LibroCodeCellView {
|
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
override onViewMount(): void {
|
|
81
|
+
override async onViewMount(): Promise<void> {
|
|
81
82
|
super.onViewMount();
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
);
|
|
85
|
-
|
|
83
|
+
const kcReady = getOrigin((this.parent.model as LibroJupyterModel).kcReady);
|
|
84
|
+
const kernelConnection = await kcReady;
|
|
86
85
|
// kernel重启后,清除执行状态,输出不变
|
|
87
86
|
kernelConnection?.statusChanged((e) => {
|
|
88
|
-
|
|
87
|
+
const terminateStatus: KernelMessage.Status[] = [
|
|
88
|
+
'autorestarting',
|
|
89
|
+
'starting',
|
|
90
|
+
'restarting',
|
|
91
|
+
];
|
|
92
|
+
if (terminateStatus.includes(e)) {
|
|
89
93
|
this.model.clearExecution();
|
|
94
|
+
this.model.executing = false;
|
|
90
95
|
}
|
|
91
96
|
});
|
|
92
97
|
}
|