@difizen/libro-jupyter 0.1.18 → 0.1.20
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/es/cell/jupyter-code-cell-view.d.ts +2 -9
- package/es/cell/jupyter-code-cell-view.d.ts.map +1 -1
- package/es/cell/jupyter-code-cell-view.js +62 -108
- package/es/components/cell-execution-tip.js +2 -2
- package/es/file/navigatable-view.js +1 -1
- package/es/libro-jupyter-model.d.ts +2 -2
- package/es/libro-jupyter-model.d.ts.map +1 -1
- package/es/libro-jupyter-model.js +2 -8
- package/es/libro-jupyter-view.d.ts +3 -1
- package/es/libro-jupyter-view.d.ts.map +1 -1
- package/es/module.js +3 -3
- package/package.json +17 -16
- package/src/cell/jupyter-code-cell-view.tsx +12 -60
- package/src/components/cell-execution-tip.tsx +2 -2
- package/src/file/navigatable-view.tsx +1 -1
- package/src/libro-jupyter-model.ts +3 -8
- package/src/libro-jupyter-view.tsx +3 -0
- package/src/module.ts +2 -2
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
2
|
import { LibroCodeCellView } from '@difizen/libro-code-cell';
|
|
3
|
-
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
4
3
|
import type { CodeEditorViewOptions, CompletionProvider, TooltipProvider } from '@difizen/libro-code-editor';
|
|
5
|
-
import type {
|
|
6
|
-
import { CellService } from '@difizen/libro-core';
|
|
7
|
-
import type { LSPProvider } from '@difizen/libro-lsp';
|
|
8
|
-
import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
|
|
9
|
-
import { ViewManager } from '@difizen/mana-app';
|
|
4
|
+
import type { LibroJupyterView } from '../libro-jupyter-view.js';
|
|
10
5
|
import type { JupyterCodeCellModel } from './jupyter-code-cell-model.js';
|
|
11
6
|
export declare class JupyterCodeCellView extends LibroCodeCellView {
|
|
7
|
+
parent: LibroJupyterView;
|
|
12
8
|
view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
13
9
|
model: JupyterCodeCellModel;
|
|
14
|
-
protected readonly lspDocumentConnectionManager: ILSPDocumentConnectionManager;
|
|
15
|
-
constructor(options: CellViewOptions, cellService: CellService, viewManager: ViewManager, lspDocumentConnectionManager: ILSPDocumentConnectionManager, codeEditorManager: CodeEditorManager);
|
|
16
10
|
clearExecution: () => void;
|
|
17
11
|
protected getEditorOption(): CodeEditorViewOptions;
|
|
18
|
-
lspProvider: LSPProvider;
|
|
19
12
|
tooltipProvider: TooltipProvider;
|
|
20
13
|
completionProvider: CompletionProvider;
|
|
21
14
|
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,
|
|
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;AAWpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAkBzE,qBAEa,mBAAoB,SAAQ,iBAAiB;IAChD,MAAM,EAAE,gBAAgB,CAAC;IACxB,IAAI,2FAA4B;IACjC,KAAK,EAAE,oBAAoB,CAAC;IAE3B,cAAc,aAQrB;cAEiB,eAAe,IAAI,qBAAqB;IAgB3D,eAAe,EAAE,eAAe,CAqB9B;IAEF,kBAAkB,EAAE,kBAAkB,CA8BpC;IAEa,GAAG;CA8EnB"}
|
|
@@ -21,12 +21,10 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
21
21
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
22
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
23
|
import { CellEditorMemo, LibroCodeCellView } from '@difizen/libro-code-cell';
|
|
24
|
-
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
25
|
-
import { CellService } from '@difizen/libro-core';
|
|
26
24
|
import { KernelError } from '@difizen/libro-kernel';
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { view, ViewInstance
|
|
25
|
+
import { LibroCellURIScheme } from '@difizen/libro-language-client';
|
|
26
|
+
import { transient, URI } from '@difizen/mana-app';
|
|
27
|
+
import { view, ViewInstance } from '@difizen/mana-app';
|
|
30
28
|
import { getOrigin, useInject } from '@difizen/mana-app';
|
|
31
29
|
import { l10n } from '@difizen/mana-l10n';
|
|
32
30
|
import { forwardRef } from 'react';
|
|
@@ -45,12 +43,14 @@ var JupyterCodeCellComponent = /*#__PURE__*/forwardRef(function JupyterCodeCellC
|
|
|
45
43
|
export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code-cell-view'), _dec(_class = _dec2(_class = /*#__PURE__*/function (_LibroCodeCellView) {
|
|
46
44
|
_inherits(JupyterCodeCellView, _LibroCodeCellView);
|
|
47
45
|
var _super = _createSuper(JupyterCodeCellView);
|
|
48
|
-
function JupyterCodeCellView(
|
|
46
|
+
function JupyterCodeCellView() {
|
|
49
47
|
var _this;
|
|
50
48
|
_classCallCheck(this, JupyterCodeCellView);
|
|
51
|
-
|
|
49
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
|
+
args[_key] = arguments[_key];
|
|
51
|
+
}
|
|
52
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
52
53
|
_this.view = JupyterCodeCellComponent;
|
|
53
|
-
_this.lspDocumentConnectionManager = void 0;
|
|
54
54
|
_this.clearExecution = function () {
|
|
55
55
|
_this.model.clearExecution();
|
|
56
56
|
Promise.resolve().then(function () {
|
|
@@ -58,129 +58,83 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
58
58
|
return;
|
|
59
59
|
}).catch(console.error);
|
|
60
60
|
};
|
|
61
|
-
_this.lspProvider = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
62
|
-
var adapter, virtualEditor, virtualDocument, lspConnection;
|
|
63
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
64
|
-
while (1) switch (_context.prev = _context.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
_context.next = 2;
|
|
67
|
-
return _this.lspDocumentConnectionManager.ready;
|
|
68
|
-
case 2:
|
|
69
|
-
adapter = _this.lspDocumentConnectionManager.adapters.get(_this.parent.model.id);
|
|
70
|
-
if (adapter) {
|
|
71
|
-
_context.next = 5;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
throw new Error('no adapter');
|
|
75
|
-
case 5:
|
|
76
|
-
_context.next = 7;
|
|
77
|
-
return adapter.ready;
|
|
78
|
-
case 7:
|
|
79
|
-
virtualEditor = adapter.getCellEditor(_assertThisInitialized(_this));
|
|
80
|
-
if (virtualEditor) {
|
|
81
|
-
_context.next = 10;
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
throw new Error('no virtual editor');
|
|
85
|
-
case 10:
|
|
86
|
-
// Get the associated virtual document of the opened document
|
|
87
|
-
virtualDocument = adapter.virtualDocument;
|
|
88
|
-
if (virtualDocument) {
|
|
89
|
-
_context.next = 13;
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
throw new Error('no virtualDocument');
|
|
93
|
-
case 13:
|
|
94
|
-
// Get the LSP connection of the virtual document.
|
|
95
|
-
lspConnection = _this.lspDocumentConnectionManager.connections.get(virtualDocument.uri);
|
|
96
|
-
return _context.abrupt("return", {
|
|
97
|
-
virtualDocument: virtualDocument,
|
|
98
|
-
lspConnection: lspConnection,
|
|
99
|
-
editor: virtualEditor
|
|
100
|
-
});
|
|
101
|
-
case 15:
|
|
102
|
-
case "end":
|
|
103
|
-
return _context.stop();
|
|
104
|
-
}
|
|
105
|
-
}, _callee);
|
|
106
|
-
}));
|
|
107
61
|
_this.tooltipProvider = /*#__PURE__*/function () {
|
|
108
|
-
var
|
|
62
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(option) {
|
|
109
63
|
var cellContent, kernelConnection, reply, value;
|
|
110
|
-
return _regeneratorRuntime().wrap(function
|
|
111
|
-
while (1) switch (
|
|
64
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
65
|
+
while (1) switch (_context.prev = _context.next) {
|
|
112
66
|
case 0:
|
|
113
67
|
cellContent = _this.model.value;
|
|
114
68
|
kernelConnection = getOrigin(_this.parent.model.kernelConnection);
|
|
115
69
|
if (kernelConnection) {
|
|
116
|
-
|
|
70
|
+
_context.next = 5;
|
|
117
71
|
break;
|
|
118
72
|
}
|
|
119
73
|
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
120
|
-
return
|
|
74
|
+
return _context.abrupt("return", null);
|
|
121
75
|
case 5:
|
|
122
|
-
|
|
76
|
+
_context.next = 7;
|
|
123
77
|
return kernelConnection.requestInspect({
|
|
124
78
|
code: cellContent,
|
|
125
79
|
cursor_pos: option.cursorPosition,
|
|
126
80
|
detail_level: 1
|
|
127
81
|
});
|
|
128
82
|
case 7:
|
|
129
|
-
reply =
|
|
83
|
+
reply = _context.sent;
|
|
130
84
|
value = reply.content;
|
|
131
85
|
if (!(value.status !== 'ok' || !value.found)) {
|
|
132
|
-
|
|
86
|
+
_context.next = 11;
|
|
133
87
|
break;
|
|
134
88
|
}
|
|
135
|
-
return
|
|
89
|
+
return _context.abrupt("return", null);
|
|
136
90
|
case 11:
|
|
137
|
-
return
|
|
91
|
+
return _context.abrupt("return", value.data['text/plain']);
|
|
138
92
|
case 12:
|
|
139
93
|
case "end":
|
|
140
|
-
return
|
|
94
|
+
return _context.stop();
|
|
141
95
|
}
|
|
142
|
-
},
|
|
96
|
+
}, _callee);
|
|
143
97
|
}));
|
|
144
98
|
return function (_x) {
|
|
145
|
-
return
|
|
99
|
+
return _ref.apply(this, arguments);
|
|
146
100
|
};
|
|
147
101
|
}();
|
|
148
102
|
_this.completionProvider = /*#__PURE__*/function () {
|
|
149
|
-
var
|
|
103
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(option) {
|
|
150
104
|
var cellContent, kernelConnection, reply, value;
|
|
151
|
-
return _regeneratorRuntime().wrap(function
|
|
152
|
-
while (1) switch (
|
|
105
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
106
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
153
107
|
case 0:
|
|
154
108
|
cellContent = _this.model.source;
|
|
155
109
|
kernelConnection = getOrigin(_this.parent.model.kernelConnection);
|
|
156
110
|
if (kernelConnection) {
|
|
157
|
-
|
|
111
|
+
_context2.next = 5;
|
|
158
112
|
break;
|
|
159
113
|
}
|
|
160
114
|
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
161
115
|
throw new Error(l10n.t('Kernel Connection 还没有建立'));
|
|
162
116
|
case 5:
|
|
163
|
-
|
|
117
|
+
_context2.next = 7;
|
|
164
118
|
return kernelConnection.requestComplete({
|
|
165
119
|
code: cellContent,
|
|
166
120
|
cursor_pos: option.cursorPosition
|
|
167
121
|
});
|
|
168
122
|
case 7:
|
|
169
|
-
reply =
|
|
123
|
+
reply = _context2.sent;
|
|
170
124
|
value = reply.content;
|
|
171
125
|
if (!(value.status === 'abort')) {
|
|
172
|
-
|
|
126
|
+
_context2.next = 11;
|
|
173
127
|
break;
|
|
174
128
|
}
|
|
175
129
|
throw new Error('abort');
|
|
176
130
|
case 11:
|
|
177
131
|
if (!(value.status === 'error')) {
|
|
178
|
-
|
|
132
|
+
_context2.next = 13;
|
|
179
133
|
break;
|
|
180
134
|
}
|
|
181
135
|
throw new Error(value.ename);
|
|
182
136
|
case 13:
|
|
183
|
-
return
|
|
137
|
+
return _context2.abrupt("return", {
|
|
184
138
|
matches: value.matches,
|
|
185
139
|
cursor_start: value.cursor_start,
|
|
186
140
|
cursor_end: value.cursor_end,
|
|
@@ -188,51 +142,51 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
188
142
|
});
|
|
189
143
|
case 14:
|
|
190
144
|
case "end":
|
|
191
|
-
return
|
|
145
|
+
return _context2.stop();
|
|
192
146
|
}
|
|
193
|
-
},
|
|
147
|
+
}, _callee2);
|
|
194
148
|
}));
|
|
195
149
|
return function (_x2) {
|
|
196
|
-
return
|
|
150
|
+
return _ref2.apply(this, arguments);
|
|
197
151
|
};
|
|
198
152
|
}();
|
|
199
|
-
_this.lspDocumentConnectionManager = lspDocumentConnectionManager;
|
|
200
153
|
return _this;
|
|
201
154
|
}
|
|
202
|
-
JupyterCodeCellView = inject(CodeEditorManager)(JupyterCodeCellView, undefined, 4) || JupyterCodeCellView;
|
|
203
|
-
JupyterCodeCellView = inject(ILSPDocumentConnectionManager)(JupyterCodeCellView, undefined, 3) || JupyterCodeCellView;
|
|
204
|
-
JupyterCodeCellView = inject(ViewManager)(JupyterCodeCellView, undefined, 2) || JupyterCodeCellView;
|
|
205
|
-
JupyterCodeCellView = inject(CellService)(JupyterCodeCellView, undefined, 1) || JupyterCodeCellView;
|
|
206
|
-
JupyterCodeCellView = inject(ViewOption)(JupyterCodeCellView, undefined, 0) || JupyterCodeCellView;
|
|
207
155
|
_createClass(JupyterCodeCellView, [{
|
|
208
156
|
key: "getEditorOption",
|
|
209
157
|
value: function getEditorOption() {
|
|
210
158
|
var options = _get(_getPrototypeOf(JupyterCodeCellView.prototype), "getEditorOption", this).call(this);
|
|
159
|
+
var uri = new URI(this.parent.model.filePath);
|
|
160
|
+
uri = URI.withScheme(uri, LibroCellURIScheme);
|
|
161
|
+
uri = URI.withQuery(uri, "cellid=".concat(this.model.id));
|
|
211
162
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
163
|
+
uuid: uri.toString(),
|
|
212
164
|
tooltipProvider: this.tooltipProvider,
|
|
213
|
-
completionProvider: this.completionProvider
|
|
214
|
-
lspProvider: this.parent.model
|
|
165
|
+
completionProvider: this.completionProvider
|
|
166
|
+
// lspProvider: (this.parent.model as LibroJupyterModel).lspEnabled
|
|
167
|
+
// ? this.lspProvider
|
|
168
|
+
// : undefined,
|
|
215
169
|
});
|
|
216
170
|
}
|
|
217
171
|
}, {
|
|
218
172
|
key: "run",
|
|
219
173
|
value: function () {
|
|
220
|
-
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
174
|
+
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
221
175
|
var libroModel, kernelConnection, cellContent, cellModel, future, startTimeStr, msgPromise, endTimeStr;
|
|
222
|
-
return _regeneratorRuntime().wrap(function
|
|
223
|
-
while (1) switch (
|
|
176
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
177
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
224
178
|
case 0:
|
|
225
179
|
libroModel = this.parent.model;
|
|
226
180
|
if (!(!libroModel || !(libroModel instanceof LibroJupyterModel) || !libroModel.kernelConnection || libroModel.kernelConnection.isDisposed)) {
|
|
227
|
-
|
|
181
|
+
_context3.next = 3;
|
|
228
182
|
break;
|
|
229
183
|
}
|
|
230
|
-
return
|
|
184
|
+
return _context3.abrupt("return", false);
|
|
231
185
|
case 3:
|
|
232
186
|
kernelConnection = getOrigin(libroModel.kernelConnection);
|
|
233
187
|
cellContent = this.model.source;
|
|
234
188
|
cellModel = this.model;
|
|
235
|
-
|
|
189
|
+
_context3.prev = 6;
|
|
236
190
|
// if (this.outputArea instanceof LibroOutputArea)
|
|
237
191
|
// this.outputArea.lastOutputContainerHeight =
|
|
238
192
|
// this.outputArea.container?.current?.clientHeight;
|
|
@@ -264,10 +218,10 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
264
218
|
future.onReply = function (msg) {
|
|
265
219
|
cellModel.msgChangeEmitter.fire(msg);
|
|
266
220
|
};
|
|
267
|
-
|
|
221
|
+
_context3.next = 15;
|
|
268
222
|
return future.done;
|
|
269
223
|
case 15:
|
|
270
|
-
msgPromise =
|
|
224
|
+
msgPromise = _context3.sent;
|
|
271
225
|
cellModel.executing = false;
|
|
272
226
|
cellModel.kernelExecuting = false;
|
|
273
227
|
startTimeStr = msgPromise.metadata['started'];
|
|
@@ -275,36 +229,36 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
275
229
|
cellModel.metadata.execution['shell.execute_reply.started'] = startTimeStr;
|
|
276
230
|
cellModel.metadata.execution['shell.execute_reply.end'] = endTimeStr;
|
|
277
231
|
if (msgPromise) {
|
|
278
|
-
|
|
232
|
+
_context3.next = 24;
|
|
279
233
|
break;
|
|
280
234
|
}
|
|
281
|
-
return
|
|
235
|
+
return _context3.abrupt("return", true);
|
|
282
236
|
case 24:
|
|
283
237
|
if (!(msgPromise.content.status === 'ok')) {
|
|
284
|
-
|
|
238
|
+
_context3.next = 28;
|
|
285
239
|
break;
|
|
286
240
|
}
|
|
287
|
-
return
|
|
241
|
+
return _context3.abrupt("return", true);
|
|
288
242
|
case 28:
|
|
289
243
|
throw new KernelError(msgPromise.content);
|
|
290
244
|
case 29:
|
|
291
|
-
|
|
245
|
+
_context3.next = 36;
|
|
292
246
|
break;
|
|
293
247
|
case 31:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (!
|
|
297
|
-
|
|
248
|
+
_context3.prev = 31;
|
|
249
|
+
_context3.t0 = _context3["catch"](6);
|
|
250
|
+
if (!_context3.t0.message.startsWith('Canceled')) {
|
|
251
|
+
_context3.next = 35;
|
|
298
252
|
break;
|
|
299
253
|
}
|
|
300
|
-
return
|
|
254
|
+
return _context3.abrupt("return", false);
|
|
301
255
|
case 35:
|
|
302
|
-
throw
|
|
256
|
+
throw _context3.t0;
|
|
303
257
|
case 36:
|
|
304
258
|
case "end":
|
|
305
|
-
return
|
|
259
|
+
return _context3.stop();
|
|
306
260
|
}
|
|
307
|
-
},
|
|
261
|
+
}, _callee3, this, [[6, 31]]);
|
|
308
262
|
}));
|
|
309
263
|
function run() {
|
|
310
264
|
return _run.apply(this, arguments);
|
|
@@ -21,7 +21,7 @@ export function CellExecutionTip(_ref) {
|
|
|
21
21
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22
22
|
setCurrentTime = _useState2[1];
|
|
23
23
|
var observableCell = useObserve(cell);
|
|
24
|
-
if (!ExecutableCellView.is(
|
|
24
|
+
if (!ExecutableCellView.is(observableCell)) {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
27
|
if (!ExecutableCellModel.is(observableCell.model)) {
|
|
@@ -30,7 +30,7 @@ export function CellExecutionTip(_ref) {
|
|
|
30
30
|
var isHidden = observableCell.model.hasOutputHidden;
|
|
31
31
|
var kernelExecuting = cell.model.kernelExecuting;
|
|
32
32
|
var executionInfo = parseExecutionInfoFromModel(cell.model);
|
|
33
|
-
var output =
|
|
33
|
+
var output = observableCell.outputArea.outputs;
|
|
34
34
|
var existOutput = output && output.length !== 0;
|
|
35
35
|
var waitingExecute = isWaitingExecute(observableCell.model);
|
|
36
36
|
if (!executionInfo) {
|
|
@@ -152,7 +152,7 @@ export var LibroNavigatableView = (_dec = transient(), _dec2 = view(LibroNavigat
|
|
|
152
152
|
return _context2.abrupt("return");
|
|
153
153
|
case 5:
|
|
154
154
|
this.libroView = libroView;
|
|
155
|
-
this.libroView.model.
|
|
155
|
+
this.libroView.model.onChanged(function () {
|
|
156
156
|
_this3.dirty = true;
|
|
157
157
|
_this3.dirtyEmitter.fire();
|
|
158
158
|
if (_this3.autoSave === 'on') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LibroModel, VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
2
1
|
import type { VirtualizedManager } from '@difizen/libro-core';
|
|
2
|
+
import { LibroModel, VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
3
3
|
import { ContentsManager, ExecutableNotebookModel, LibroKernelConnectionManager, ServerConnection, ServerManager } from '@difizen/libro-kernel';
|
|
4
4
|
import type { IKernelConnection } from '@difizen/libro-kernel';
|
|
5
5
|
import type { IContentsCheckpointModel, IContentsModel } from '@difizen/libro-kernel';
|
|
@@ -10,6 +10,7 @@ type IModel = IContentsModel;
|
|
|
10
10
|
export declare class LibroJupyterModel extends LibroModel implements ExecutableNotebookModel {
|
|
11
11
|
static is: (arg: Record<any, any> | undefined) => arg is LibroJupyterModel;
|
|
12
12
|
protected libroFileService: LibroFileService;
|
|
13
|
+
protected virtualizedManager: VirtualizedManager;
|
|
13
14
|
get fileService(): LibroFileService;
|
|
14
15
|
currentFileContents: IModel;
|
|
15
16
|
protected kernelSelect: string;
|
|
@@ -21,7 +22,6 @@ export declare class LibroJupyterModel extends LibroModel implements ExecutableN
|
|
|
21
22
|
protected serverConnection: ServerConnection;
|
|
22
23
|
protected readonly contentsManager: ContentsManager;
|
|
23
24
|
protected readonly modalService: ModalService;
|
|
24
|
-
protected virtualizedManager: VirtualizedManager;
|
|
25
25
|
constructor(libroFileService: LibroFileService, kernelConnectionManager: LibroKernelConnectionManager, serverManager: ServerManager, serverConnection: ServerConnection, contentsManager: ContentsManager, modalService: ModalService, virtualizedManagerHelper: VirtualizedManagerHelper);
|
|
26
26
|
get isKernelIdle(): boolean | undefined;
|
|
27
27
|
get kernelSelection(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-jupyter-model.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-model.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"libro-jupyter-model.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACL,eAAe,EACf,uBAAuB,EAEvB,4BAA4B,EAC5B,gBAAgB,EAChB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAa,YAAY,EAAQ,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,OAAO,EAGL,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAIrC,KAAK,MAAM,GAAG,cAAc,CAAC;AAC7B,qBACa,iBAAkB,SAAQ,UAAW,YAAW,uBAAuB;IAClF,MAAM,CAAC,EAAE,QAAS,OAAO,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,8BAS5C;IAEF,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC7C,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAEjD,IAAI,WAAW,qBAEd;IAGD,mBAAmB,EAAE,MAAM,CAAC;IAE5B,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAE/B,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAE/B,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IAGrC,UAAU,UAAQ;IAElB,SAAS,CAAC,uBAAuB,EAAE,4BAA4B,CAAC;IAChE,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC7C,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IACpD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;gBAGlB,gBAAgB,EAAE,gBAAgB,EAE5D,uBAAuB,EAAE,4BAA4B,EAC9B,aAAa,EAAE,aAAa,EACzB,gBAAgB,EAAE,gBAAgB,EACnC,eAAe,EAAE,eAAe,EACnC,YAAY,EAAE,YAAY,EAEhD,wBAAwB,EAAE,wBAAwB;IA6BpD,IAAI,YAAY,wBAEf;IAED,IAAI,eAAe,IAIQ,MAAM,CAFhC;IAED,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAEhC;IAED,IAAI,mBAAmB,IAIQ,MAAM,CAFpC;IAED,IAAI,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAEpC;IACD,SAAS,CAAC,UAAU,8BAAqC;IACzD,IAAI,OAAO,+BAEV;IAGD,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAC;IAGtC,QAAQ,SAAM;IAEd,SAAS,CAAC,aAAa,SAAM;IAE7B,IAAI,YAAY,IAIQ,MAAM,CAF7B;IAED,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAE7B;IAED,qBAAqB,EAAE,wBAAwB,CAAC;IAE1C,gBAAgB;IAMhB,eAAe;IAIf,iBAAiB,CAAC,YAAY,EAAE,MAAM;IAItC,gBAAgB,CAAC,YAAY,EAAE,MAAM;IAI3C,qBAAqB;IA2BN,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAuD1C,MAAM;IAcT,SAAS;IAQT,QAAQ;IAUR,OAAO;IAkBP,SAAS;IAQf,eAAe;CAYhB"}
|
|
@@ -38,6 +38,7 @@ export var LibroJupyterModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop
|
|
|
38
38
|
_classCallCheck(this, LibroJupyterModel);
|
|
39
39
|
_this = _super.call(this);
|
|
40
40
|
_this.libroFileService = void 0;
|
|
41
|
+
_this.virtualizedManager = void 0;
|
|
41
42
|
_initializerDefineProperty(_this, "currentFileContents", _descriptor, _assertThisInitialized(_this));
|
|
42
43
|
_initializerDefineProperty(_this, "kernelSelect", _descriptor2, _assertThisInitialized(_this));
|
|
43
44
|
_initializerDefineProperty(_this, "kernelStatus", _descriptor3, _assertThisInitialized(_this));
|
|
@@ -48,7 +49,6 @@ export var LibroJupyterModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop
|
|
|
48
49
|
_this.serverConnection = void 0;
|
|
49
50
|
_this.contentsManager = void 0;
|
|
50
51
|
_this.modalService = void 0;
|
|
51
|
-
_this.virtualizedManager = void 0;
|
|
52
52
|
_this.kcDeferred = new Deferred();
|
|
53
53
|
_initializerDefineProperty(_this, "kernelConnecting", _descriptor6, _assertThisInitialized(_this));
|
|
54
54
|
_initializerDefineProperty(_this, "filePath", _descriptor7, _assertThisInitialized(_this));
|
|
@@ -473,13 +473,7 @@ export var LibroJupyterModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop
|
|
|
473
473
|
});
|
|
474
474
|
if (runningCellIndex > -1) {
|
|
475
475
|
this.selectCell(this.cells[runningCellIndex]);
|
|
476
|
-
|
|
477
|
-
this.scrollToCellView({
|
|
478
|
-
cellIndex: runningCellIndex
|
|
479
|
-
});
|
|
480
|
-
} else {
|
|
481
|
-
this.scrollToView(this.cells[runningCellIndex]);
|
|
482
|
-
}
|
|
476
|
+
this.scrollToView(this.cells[runningCellIndex]);
|
|
483
477
|
}
|
|
484
478
|
}
|
|
485
479
|
}]);
|
|
@@ -3,9 +3,11 @@ import { VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
|
3
3
|
import { CollapseServiceFactory, NotebookService } from '@difizen/libro-core';
|
|
4
4
|
import { LibroView } from '@difizen/libro-core';
|
|
5
5
|
import { URI } from '@difizen/mana-app';
|
|
6
|
+
import type { LibroJupyterModel } from './libro-jupyter-model.js';
|
|
6
7
|
export declare class LibroJupyterView extends LibroView {
|
|
7
8
|
uri: URI;
|
|
9
|
+
model: LibroJupyterModel;
|
|
8
10
|
constructor(options: NotebookOption, collapseServiceFactory: CollapseServiceFactory, notebookService: NotebookService, virtualizedManagerHelper: VirtualizedManagerHelper);
|
|
9
|
-
get options():
|
|
11
|
+
get options(): NotebookOption;
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=libro-jupyter-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-jupyter-view.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,GAAG,EAAoB,MAAM,mBAAmB,CAAC;AAG1D,qBAEa,gBAAiB,SAAQ,SAAS;IAC7C,GAAG,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-jupyter-view.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,GAAG,EAAoB,MAAM,mBAAmB,CAAC;AAG1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,qBAEa,gBAAiB,SAAQ,SAAS;IAC7C,GAAG,EAAE,GAAG,CAAC;IACD,KAAK,EAAE,iBAAiB,CAAC;gBAEX,OAAO,EAAE,cAAc,EACX,sBAAsB,EAAE,sBAAsB,EACrD,eAAe,EAAE,eAAe,EAEzD,wBAAwB,EAAE,wBAAwB;IAOpD,IAAI,OAAO,mBAEV;CACF"}
|
package/es/module.js
CHANGED
|
@@ -3,7 +3,7 @@ import { CodeMirrorEditorModule } from '@difizen/libro-codemirror';
|
|
|
3
3
|
import { LibroE2EditorModule } from '@difizen/libro-cofine-editor';
|
|
4
4
|
import { CellExecutionTimeProvider, CellInputBottonBlankProvider, LibroAddCellModule, LibroKeybindRegistry, LibroModel, LibroModule, LibroToolbarModule } from '@difizen/libro-core';
|
|
5
5
|
import { LibroKernelManageModule } from '@difizen/libro-kernel';
|
|
6
|
-
import {
|
|
6
|
+
import { LibroLanguageClientModule } from '@difizen/libro-language-client';
|
|
7
7
|
import { MarkdownCellModule } from '@difizen/libro-markdown-cell';
|
|
8
8
|
import { DisplayDataOutputModule, ErrorOutputModule, StreamOutputModule } from '@difizen/libro-output';
|
|
9
9
|
import { RawCellModule } from '@difizen/libro-raw-cell';
|
|
@@ -45,6 +45,6 @@ export var LibroJupyterModule = ManaModule.create().register(LibroJupyterFileSer
|
|
|
45
45
|
}, {
|
|
46
46
|
token: LibroCodeCellView,
|
|
47
47
|
useClass: JupyterCodeCellView
|
|
48
|
-
}).dependOn(LibroModule, CodeCellModule, MarkdownCellModule, RawCellModule, StreamOutputModule, ErrorOutputModule, DisplayDataOutputModule, LibroToolbarModule, LibroKernelManageModule, LibroSearchModule, SearchCodeCellModule, LibroAddCellModule,
|
|
48
|
+
}).dependOn(LibroModule, CodeCellModule, MarkdownCellModule, RawCellModule, StreamOutputModule, ErrorOutputModule, DisplayDataOutputModule, LibroToolbarModule, LibroKernelManageModule, LibroSearchModule, SearchCodeCellModule, LibroAddCellModule, LibroE2EditorModule, CodeMirrorEditorModule,
|
|
49
49
|
// custom module
|
|
50
|
-
LibroBetweenCellModule, KeybindInstructionsModule, PlotlyModule, LibroJupyterFileModule);
|
|
50
|
+
LibroBetweenCellModule, KeybindInstructionsModule, PlotlyModule, LibroJupyterFileModule, LibroLanguageClientModule);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-jupyter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro"
|
|
@@ -31,21 +31,22 @@
|
|
|
31
31
|
"src"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@difizen/libro-cofine-editor": "^0.1.
|
|
35
|
-
"@difizen/libro-code-editor": "^0.1.
|
|
36
|
-
"@difizen/libro-code-cell": "^0.1.
|
|
37
|
-
"@difizen/libro-codemirror": "^0.1.
|
|
38
|
-
"@difizen/libro-rendermime": "^0.1.
|
|
39
|
-
"@difizen/libro-common": "^0.1.
|
|
40
|
-
"@difizen/libro-core": "^0.1.
|
|
41
|
-
"@difizen/libro-kernel": "^0.1.
|
|
42
|
-
"@difizen/libro-l10n": "^0.1.
|
|
43
|
-
"@difizen/libro-output": "^0.1.
|
|
44
|
-
"@difizen/libro-search": "^0.1.
|
|
45
|
-
"@difizen/libro-search-code-cell": "^0.1.
|
|
46
|
-
"@difizen/libro-lsp": "^0.1.
|
|
47
|
-
"@difizen/libro-markdown-cell": "^0.1.
|
|
48
|
-
"@difizen/libro-raw-cell": "^0.1.
|
|
34
|
+
"@difizen/libro-cofine-editor": "^0.1.20",
|
|
35
|
+
"@difizen/libro-code-editor": "^0.1.20",
|
|
36
|
+
"@difizen/libro-code-cell": "^0.1.20",
|
|
37
|
+
"@difizen/libro-codemirror": "^0.1.20",
|
|
38
|
+
"@difizen/libro-rendermime": "^0.1.20",
|
|
39
|
+
"@difizen/libro-common": "^0.1.20",
|
|
40
|
+
"@difizen/libro-core": "^0.1.20",
|
|
41
|
+
"@difizen/libro-kernel": "^0.1.20",
|
|
42
|
+
"@difizen/libro-l10n": "^0.1.20",
|
|
43
|
+
"@difizen/libro-output": "^0.1.20",
|
|
44
|
+
"@difizen/libro-search": "^0.1.20",
|
|
45
|
+
"@difizen/libro-search-code-cell": "^0.1.20",
|
|
46
|
+
"@difizen/libro-lsp": "^0.1.20",
|
|
47
|
+
"@difizen/libro-markdown-cell": "^0.1.20",
|
|
48
|
+
"@difizen/libro-raw-cell": "^0.1.20",
|
|
49
|
+
"@difizen/libro-language-client": "^0.1.20",
|
|
49
50
|
"@difizen/mana-app": "latest",
|
|
50
51
|
"@difizen/mana-l10n": "latest",
|
|
51
52
|
"@ant-design/colors": "^7.0.0",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CellEditorMemo, LibroCodeCellView } from '@difizen/libro-code-cell';
|
|
2
|
-
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
3
2
|
import type {
|
|
4
3
|
CodeEditorViewOptions,
|
|
5
4
|
CompletionProvider,
|
|
@@ -7,19 +6,17 @@ import type {
|
|
|
7
6
|
TooltipProvider,
|
|
8
7
|
TooltipProviderOption,
|
|
9
8
|
} from '@difizen/libro-code-editor';
|
|
10
|
-
import type { CellViewOptions } from '@difizen/libro-core';
|
|
11
|
-
import { CellService } from '@difizen/libro-core';
|
|
12
9
|
import { KernelError } from '@difizen/libro-kernel';
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { view, ViewInstance, ViewManager, ViewOption } from '@difizen/mana-app';
|
|
10
|
+
import { LibroCellURIScheme } from '@difizen/libro-language-client';
|
|
11
|
+
import { transient, URI } from '@difizen/mana-app';
|
|
12
|
+
import { view, ViewInstance } from '@difizen/mana-app';
|
|
17
13
|
import { getOrigin, useInject } from '@difizen/mana-app';
|
|
18
14
|
import { l10n } from '@difizen/mana-l10n';
|
|
19
15
|
import { forwardRef } from 'react';
|
|
20
16
|
|
|
21
17
|
import { LibroJupyterModel } from '../libro-jupyter-model.js';
|
|
22
18
|
import type { ExecutionMeta } from '../libro-jupyter-protocol.js';
|
|
19
|
+
import type { LibroJupyterView } from '../libro-jupyter-view.js';
|
|
23
20
|
|
|
24
21
|
import type { JupyterCodeCellModel } from './jupyter-code-cell-model.js';
|
|
25
22
|
|
|
@@ -42,23 +39,10 @@ const JupyterCodeCellComponent = forwardRef<HTMLDivElement>(
|
|
|
42
39
|
@transient()
|
|
43
40
|
@view('jupyter-code-cell-view')
|
|
44
41
|
export class JupyterCodeCellView extends LibroCodeCellView {
|
|
42
|
+
declare parent: LibroJupyterView;
|
|
45
43
|
override view = JupyterCodeCellComponent;
|
|
46
44
|
declare model: JupyterCodeCellModel;
|
|
47
45
|
|
|
48
|
-
protected readonly lspDocumentConnectionManager: ILSPDocumentConnectionManager;
|
|
49
|
-
|
|
50
|
-
constructor(
|
|
51
|
-
@inject(ViewOption) options: CellViewOptions,
|
|
52
|
-
@inject(CellService) cellService: CellService,
|
|
53
|
-
@inject(ViewManager) viewManager: ViewManager,
|
|
54
|
-
@inject(ILSPDocumentConnectionManager)
|
|
55
|
-
lspDocumentConnectionManager: ILSPDocumentConnectionManager,
|
|
56
|
-
@inject(CodeEditorManager) codeEditorManager: CodeEditorManager,
|
|
57
|
-
) {
|
|
58
|
-
super(options, cellService, viewManager, codeEditorManager);
|
|
59
|
-
this.lspDocumentConnectionManager = lspDocumentConnectionManager;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
46
|
override clearExecution = () => {
|
|
63
47
|
this.model.clearExecution();
|
|
64
48
|
Promise.resolve()
|
|
@@ -71,52 +55,20 @@ export class JupyterCodeCellView extends LibroCodeCellView {
|
|
|
71
55
|
|
|
72
56
|
protected override getEditorOption(): CodeEditorViewOptions {
|
|
73
57
|
const options = super.getEditorOption();
|
|
58
|
+
let uri = new URI(this.parent.model.filePath);
|
|
59
|
+
uri = URI.withScheme(uri, LibroCellURIScheme);
|
|
60
|
+
uri = URI.withQuery(uri, `cellid=${this.model.id}`);
|
|
74
61
|
return {
|
|
75
62
|
...options,
|
|
63
|
+
uuid: uri.toString(),
|
|
76
64
|
tooltipProvider: this.tooltipProvider,
|
|
77
65
|
completionProvider: this.completionProvider,
|
|
78
|
-
lspProvider: (this.parent.model as LibroJupyterModel).lspEnabled
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
// lspProvider: (this.parent.model as LibroJupyterModel).lspEnabled
|
|
67
|
+
// ? this.lspProvider
|
|
68
|
+
// : undefined,
|
|
81
69
|
};
|
|
82
70
|
}
|
|
83
71
|
|
|
84
|
-
lspProvider: LSPProvider = async () => {
|
|
85
|
-
await this.lspDocumentConnectionManager.ready;
|
|
86
|
-
const adapter = this.lspDocumentConnectionManager.adapters.get(
|
|
87
|
-
this.parent.model.id,
|
|
88
|
-
);
|
|
89
|
-
if (!adapter) {
|
|
90
|
-
throw new Error('no adapter');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
await adapter.ready;
|
|
94
|
-
|
|
95
|
-
const virtualEditor = adapter.getCellEditor(this);
|
|
96
|
-
|
|
97
|
-
if (!virtualEditor) {
|
|
98
|
-
throw new Error('no virtual editor');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Get the associated virtual document of the opened document
|
|
102
|
-
const virtualDocument = adapter.virtualDocument;
|
|
103
|
-
|
|
104
|
-
if (!virtualDocument) {
|
|
105
|
-
throw new Error('no virtualDocument');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Get the LSP connection of the virtual document.
|
|
109
|
-
const lspConnection = this.lspDocumentConnectionManager.connections.get(
|
|
110
|
-
virtualDocument.uri,
|
|
111
|
-
) as LSPConnection;
|
|
112
|
-
|
|
113
|
-
return {
|
|
114
|
-
virtualDocument,
|
|
115
|
-
lspConnection,
|
|
116
|
-
editor: virtualEditor,
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
72
|
tooltipProvider: TooltipProvider = async (option: TooltipProviderOption) => {
|
|
121
73
|
const cellContent = this.model.value;
|
|
122
74
|
const kernelConnection = getOrigin(
|
|
@@ -25,7 +25,7 @@ export function CellExecutionTip({ cell }: { cell: CellView }) {
|
|
|
25
25
|
const [, setCurrentTime] = useState<number>();
|
|
26
26
|
const observableCell = useObserve(cell);
|
|
27
27
|
|
|
28
|
-
if (!ExecutableCellView.is(
|
|
28
|
+
if (!ExecutableCellView.is(observableCell)) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -38,7 +38,7 @@ export function CellExecutionTip({ cell }: { cell: CellView }) {
|
|
|
38
38
|
.kernelExecuting;
|
|
39
39
|
const executionInfo = parseExecutionInfoFromModel(cell.model);
|
|
40
40
|
|
|
41
|
-
const output =
|
|
41
|
+
const output = observableCell.outputArea.outputs;
|
|
42
42
|
const existOutput = output && output.length !== 0;
|
|
43
43
|
|
|
44
44
|
const waitingExecute = isWaitingExecute(observableCell.model);
|
|
@@ -141,7 +141,7 @@ export class LibroNavigatableView
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
this.libroView = libroView;
|
|
144
|
-
this.libroView.model.
|
|
144
|
+
this.libroView.model.onChanged(() => {
|
|
145
145
|
this.dirty = true;
|
|
146
146
|
this.dirtyEmitter.fire();
|
|
147
147
|
if (this.autoSave === 'on') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LibroModel, VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
2
1
|
import type { VirtualizedManager } from '@difizen/libro-core';
|
|
2
|
+
import { LibroModel, VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
3
3
|
import {
|
|
4
4
|
ContentsManager,
|
|
5
5
|
ExecutableNotebookModel,
|
|
@@ -38,6 +38,7 @@ export class LibroJupyterModel extends LibroModel implements ExecutableNotebookM
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
protected libroFileService: LibroFileService;
|
|
41
|
+
protected virtualizedManager: VirtualizedManager;
|
|
41
42
|
|
|
42
43
|
get fileService() {
|
|
43
44
|
return this.libroFileService;
|
|
@@ -60,7 +61,6 @@ export class LibroJupyterModel extends LibroModel implements ExecutableNotebookM
|
|
|
60
61
|
protected serverConnection: ServerConnection;
|
|
61
62
|
protected readonly contentsManager: ContentsManager;
|
|
62
63
|
protected readonly modalService: ModalService;
|
|
63
|
-
protected virtualizedManager: VirtualizedManager;
|
|
64
64
|
|
|
65
65
|
constructor(
|
|
66
66
|
@inject(LibroFileService) libroFileService: LibroFileService,
|
|
@@ -309,12 +309,7 @@ export class LibroJupyterModel extends LibroModel implements ExecutableNotebookM
|
|
|
309
309
|
});
|
|
310
310
|
if (runningCellIndex > -1) {
|
|
311
311
|
this.selectCell(this.cells[runningCellIndex]);
|
|
312
|
-
|
|
313
|
-
if (this.virtualizedManager.isVirtualized) {
|
|
314
|
-
this.scrollToCellView({ cellIndex: runningCellIndex });
|
|
315
|
-
} else {
|
|
316
|
-
this.scrollToView(this.cells[runningCellIndex]);
|
|
317
|
-
}
|
|
312
|
+
this.scrollToView(this.cells[runningCellIndex]);
|
|
318
313
|
}
|
|
319
314
|
}
|
|
320
315
|
}
|
|
@@ -5,10 +5,13 @@ import { LibroView, notebookViewFactoryId } from '@difizen/libro-core';
|
|
|
5
5
|
import { URI, view, ViewOption } from '@difizen/mana-app';
|
|
6
6
|
import { inject, transient } from '@difizen/mana-app';
|
|
7
7
|
|
|
8
|
+
import type { LibroJupyterModel } from './libro-jupyter-model.js';
|
|
9
|
+
|
|
8
10
|
@transient()
|
|
9
11
|
@view(notebookViewFactoryId)
|
|
10
12
|
export class LibroJupyterView extends LibroView {
|
|
11
13
|
uri: URI;
|
|
14
|
+
declare model: LibroJupyterModel;
|
|
12
15
|
constructor(
|
|
13
16
|
@inject(ViewOption) options: NotebookOption,
|
|
14
17
|
@inject(CollapseServiceFactory) collapseServiceFactory: CollapseServiceFactory,
|
package/src/module.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
LibroToolbarModule,
|
|
16
16
|
} from '@difizen/libro-core';
|
|
17
17
|
import { LibroKernelManageModule } from '@difizen/libro-kernel';
|
|
18
|
-
import {
|
|
18
|
+
import { LibroLanguageClientModule } from '@difizen/libro-language-client';
|
|
19
19
|
import { MarkdownCellModule } from '@difizen/libro-markdown-cell';
|
|
20
20
|
import {
|
|
21
21
|
DisplayDataOutputModule,
|
|
@@ -102,7 +102,6 @@ export const LibroJupyterModule = ManaModule.create()
|
|
|
102
102
|
LibroSearchModule,
|
|
103
103
|
SearchCodeCellModule,
|
|
104
104
|
LibroAddCellModule,
|
|
105
|
-
LibroLSPModule,
|
|
106
105
|
LibroE2EditorModule,
|
|
107
106
|
CodeMirrorEditorModule,
|
|
108
107
|
// custom module
|
|
@@ -110,4 +109,5 @@ export const LibroJupyterModule = ManaModule.create()
|
|
|
110
109
|
KeybindInstructionsModule,
|
|
111
110
|
PlotlyModule,
|
|
112
111
|
LibroJupyterFileModule,
|
|
112
|
+
LibroLanguageClientModule,
|
|
113
113
|
);
|