@difizen/libro-lsp 0.1.2
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/LICENSE +21 -0
- package/README.md +0 -0
- package/es/adapters/adapter.d.ts +255 -0
- package/es/adapters/adapter.d.ts.map +1 -0
- package/es/adapters/adapter.js +647 -0
- package/es/adapters/notebook-adapter.d.ts +150 -0
- package/es/adapters/notebook-adapter.d.ts.map +1 -0
- package/es/adapters/notebook-adapter.js +588 -0
- package/es/adapters/status-message.d.ts +48 -0
- package/es/adapters/status-message.d.ts.map +1 -0
- package/es/adapters/status-message.js +110 -0
- package/es/connection-manager.d.ts +199 -0
- package/es/connection-manager.d.ts.map +1 -0
- package/es/connection-manager.js +685 -0
- package/es/connection.d.ts +149 -0
- package/es/connection.d.ts.map +1 -0
- package/es/connection.js +591 -0
- package/es/extractors/index.d.ts +4 -0
- package/es/extractors/index.d.ts.map +1 -0
- package/es/extractors/index.js +6 -0
- package/es/extractors/manager.d.ts +31 -0
- package/es/extractors/manager.d.ts.map +1 -0
- package/es/extractors/manager.js +90 -0
- package/es/extractors/text-extractor.d.ts +56 -0
- package/es/extractors/text-extractor.d.ts.map +1 -0
- package/es/extractors/text-extractor.js +72 -0
- package/es/extractors/types.d.ts +68 -0
- package/es/extractors/types.d.ts.map +1 -0
- package/es/extractors/types.js +1 -0
- package/es/feature.d.ts +29 -0
- package/es/feature.d.ts.map +1 -0
- package/es/feature.js +85 -0
- package/es/index.d.ts +19 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +21 -0
- package/es/lsp-app-contribution.d.ts +19 -0
- package/es/lsp-app-contribution.d.ts.map +1 -0
- package/es/lsp-app-contribution.js +155 -0
- package/es/lsp-protocol.d.ts +10 -0
- package/es/lsp-protocol.d.ts.map +1 -0
- package/es/lsp-protocol.js +1 -0
- package/es/lsp.d.ts +136 -0
- package/es/lsp.d.ts.map +1 -0
- package/es/lsp.js +141 -0
- package/es/manager.d.ts +142 -0
- package/es/manager.d.ts.map +1 -0
- package/es/manager.js +423 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +21 -0
- package/es/plugin.d.ts +56 -0
- package/es/plugin.d.ts.map +1 -0
- package/es/plugin.js +0 -0
- package/es/positioning.d.ts +66 -0
- package/es/positioning.d.ts.map +1 -0
- package/es/positioning.js +96 -0
- package/es/schema.d.ts +240 -0
- package/es/schema.d.ts.map +1 -0
- package/es/schema.js +0 -0
- package/es/tokens.d.ts +677 -0
- package/es/tokens.d.ts.map +1 -0
- package/es/tokens.js +183 -0
- package/es/utils.d.ts +33 -0
- package/es/utils.d.ts.map +1 -0
- package/es/utils.js +168 -0
- package/es/virtual/document.d.ts +546 -0
- package/es/virtual/document.d.ts.map +1 -0
- package/es/virtual/document.js +1263 -0
- package/es/ws-connection/server-capability-registration.d.ts +19 -0
- package/es/ws-connection/server-capability-registration.d.ts.map +1 -0
- package/es/ws-connection/server-capability-registration.js +51 -0
- package/es/ws-connection/types.d.ts +76 -0
- package/es/ws-connection/types.d.ts.map +1 -0
- package/es/ws-connection/types.js +1 -0
- package/es/ws-connection/ws-connection.d.ts +105 -0
- package/es/ws-connection/ws-connection.d.ts.map +1 -0
- package/es/ws-connection/ws-connection.js +301 -0
- package/package.json +67 -0
- package/src/adapters/adapter.ts +611 -0
- package/src/adapters/notebook-adapter.ts +463 -0
- package/src/adapters/status-message.ts +93 -0
- package/src/connection-manager.ts +626 -0
- package/src/connection.ts +570 -0
- package/src/extractors/index.ts +6 -0
- package/src/extractors/manager.ts +82 -0
- package/src/extractors/text-extractor.ts +94 -0
- package/src/extractors/types.ts +78 -0
- package/src/feature.ts +60 -0
- package/src/index.spec.ts +10 -0
- package/src/index.ts +21 -0
- package/src/lsp-app-contribution.ts +83 -0
- package/src/lsp-protocol.ts +10 -0
- package/src/lsp.ts +160 -0
- package/src/manager.ts +358 -0
- package/src/module.ts +32 -0
- package/src/plugin.ts +62 -0
- package/src/positioning.ts +121 -0
- package/src/schema.ts +249 -0
- package/src/tokens.ts +843 -0
- package/src/utils.ts +109 -0
- package/src/virtual/document.ts +1250 -0
- package/src/ws-connection/server-capability-registration.ts +77 -0
- package/src/ws-connection/types.ts +102 -0
- package/src/ws-connection/ws-connection.ts +320 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
6
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
7
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
14
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
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; } }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-parameter-properties */
|
|
23
|
+
/* eslint-disable @typescript-eslint/parameter-properties */
|
|
24
|
+
// Copyright (c) Jupyter Development Team.
|
|
25
|
+
// Distributed under the terms of the Modified BSD License.
|
|
26
|
+
|
|
27
|
+
import { EditorCellView } from '@difizen/libro-core';
|
|
28
|
+
import '@difizen/mana-app';
|
|
29
|
+
import { watch, Deferred } from '@difizen/mana-app';
|
|
30
|
+
import { untilReady } from "../utils.js";
|
|
31
|
+
import { VirtualDocument } from "../virtual/document.js";
|
|
32
|
+
import { WidgetLSPAdapter } from "./adapter.js";
|
|
33
|
+
export var NotebookAdapter = /*#__PURE__*/function (_WidgetLSPAdapter) {
|
|
34
|
+
_inherits(NotebookAdapter, _WidgetLSPAdapter);
|
|
35
|
+
var _super = _createSuper(NotebookAdapter);
|
|
36
|
+
function NotebookAdapter(editorWidget, options) {
|
|
37
|
+
var _this;
|
|
38
|
+
_classCallCheck(this, NotebookAdapter);
|
|
39
|
+
_this = _super.call(this, editorWidget, options);
|
|
40
|
+
_this.editorWidget = editorWidget;
|
|
41
|
+
_this.options = options;
|
|
42
|
+
_this.handleCellSourceChange = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
43
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44
|
+
while (1) switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
_context.next = 2;
|
|
47
|
+
return _this.updateDocuments();
|
|
48
|
+
case 2:
|
|
49
|
+
case "end":
|
|
50
|
+
return _context.stop();
|
|
51
|
+
}
|
|
52
|
+
}, _callee);
|
|
53
|
+
}));
|
|
54
|
+
/**
|
|
55
|
+
* Update the virtual document on cell changing event.
|
|
56
|
+
*
|
|
57
|
+
* @param cells - Observable list of changed cells
|
|
58
|
+
* @param change - Changed data
|
|
59
|
+
*/
|
|
60
|
+
_this.handleCellChange = /*#__PURE__*/function () {
|
|
61
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(change) {
|
|
62
|
+
var _change$insert$cells, _change$insert;
|
|
63
|
+
var _iterator, _step, cellView;
|
|
64
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
65
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
_context2.next = 2;
|
|
68
|
+
return _this.updateDocuments();
|
|
69
|
+
case 2:
|
|
70
|
+
// }
|
|
71
|
+
_iterator = _createForOfIteratorHelper((_change$insert$cells = (_change$insert = change.insert) === null || _change$insert === void 0 ? void 0 : _change$insert.cells) !== null && _change$insert$cells !== void 0 ? _change$insert$cells : []);
|
|
72
|
+
try {
|
|
73
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
74
|
+
cellView = _step.value;
|
|
75
|
+
// const cellWidget = this.widget.content.widgets.find(cell => cell.model.id === cellModel.id);
|
|
76
|
+
// if (!cellWidget) {
|
|
77
|
+
// console.warn(`Widget for added cell with ID: ${cellModel.id} not found!`);
|
|
78
|
+
// continue;
|
|
79
|
+
// }
|
|
80
|
+
|
|
81
|
+
// Add editor to the mapping if needed
|
|
82
|
+
_this.getCellEditor(cellView);
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
_iterator.e(err);
|
|
86
|
+
} finally {
|
|
87
|
+
_iterator.f();
|
|
88
|
+
}
|
|
89
|
+
case 4:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context2.stop();
|
|
92
|
+
}
|
|
93
|
+
}, _callee2);
|
|
94
|
+
}));
|
|
95
|
+
return function (_x) {
|
|
96
|
+
return _ref2.apply(this, arguments);
|
|
97
|
+
};
|
|
98
|
+
}();
|
|
99
|
+
/**
|
|
100
|
+
* Initialization function called once the editor and the LSP connection
|
|
101
|
+
* manager is ready. This function will create the virtual document and
|
|
102
|
+
* connect various signals.
|
|
103
|
+
*/
|
|
104
|
+
_this.initOnceReady = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
105
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
106
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
_context3.next = 2;
|
|
109
|
+
return untilReady(_this.isReady.bind(_assertThisInitialized(_this)), -1);
|
|
110
|
+
case 2:
|
|
111
|
+
_context3.next = 4;
|
|
112
|
+
return _this._updateLanguageInfo();
|
|
113
|
+
case 4:
|
|
114
|
+
_this.initVirtual();
|
|
115
|
+
|
|
116
|
+
// connect the document, but do not open it as the adapter will handle this
|
|
117
|
+
// after registering all features
|
|
118
|
+
_this.connectDocument(_this.virtualDocument, false).catch(function (error) {
|
|
119
|
+
console.warn(error);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// this.widget.context.sessionContext.kernelChanged.connect(this.onKernelChanged, this);
|
|
123
|
+
watch(_this.notebookModel, 'kernelConnection', _this.onKernelChanged);
|
|
124
|
+
watch(_this.notebookModel, 'active', function (_ref4) {
|
|
125
|
+
var target = _ref4.target;
|
|
126
|
+
return _this._activeCellChanged(target);
|
|
127
|
+
});
|
|
128
|
+
_this._connectModelSignals(_this.widget);
|
|
129
|
+
case 9:
|
|
130
|
+
case "end":
|
|
131
|
+
return _context3.stop();
|
|
132
|
+
}
|
|
133
|
+
}, _callee3);
|
|
134
|
+
}));
|
|
135
|
+
_this._type = 'code';
|
|
136
|
+
_this._readyDelegate = new Deferred();
|
|
137
|
+
_this._editorToCell = new Map();
|
|
138
|
+
_this.editor = editorWidget;
|
|
139
|
+
_this._cellToEditor = new WeakMap();
|
|
140
|
+
Promise.all([_this.notebookModel.kcReady, _this.connectionManager.ready]).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
141
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
142
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
143
|
+
case 0:
|
|
144
|
+
_context4.next = 2;
|
|
145
|
+
return _this.initOnceReady();
|
|
146
|
+
case 2:
|
|
147
|
+
_this._readyDelegate.resolve();
|
|
148
|
+
return _context4.abrupt("return");
|
|
149
|
+
case 4:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context4.stop();
|
|
152
|
+
}
|
|
153
|
+
}, _callee4);
|
|
154
|
+
}))).catch(console.error);
|
|
155
|
+
return _this;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The wrapped `Notebook` widget.
|
|
160
|
+
*/
|
|
161
|
+
_createClass(NotebookAdapter, [{
|
|
162
|
+
key: "notebookModel",
|
|
163
|
+
get: function get() {
|
|
164
|
+
return this.widget.model;
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
key: "fileContents",
|
|
168
|
+
get: function get() {
|
|
169
|
+
return this.notebookModel.currentFileContents;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Get current path of the document.
|
|
174
|
+
*/
|
|
175
|
+
}, {
|
|
176
|
+
key: "documentPath",
|
|
177
|
+
get: function get() {
|
|
178
|
+
return this.fileContents.path;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get the mime type of the document.
|
|
183
|
+
*/
|
|
184
|
+
}, {
|
|
185
|
+
key: "mimeType",
|
|
186
|
+
get: function get() {
|
|
187
|
+
var _mimeType$;
|
|
188
|
+
var mimeType;
|
|
189
|
+
var languageMetadata = this.language_info();
|
|
190
|
+
if (!languageMetadata || !languageMetadata.mimetype) {
|
|
191
|
+
// fallback to the code cell mime type if no kernel in use
|
|
192
|
+
mimeType = this.fileContents.mimetype;
|
|
193
|
+
} else {
|
|
194
|
+
mimeType = languageMetadata.mimetype;
|
|
195
|
+
}
|
|
196
|
+
return Array.isArray(mimeType) ? (_mimeType$ = mimeType[0]) !== null && _mimeType$ !== void 0 ? _mimeType$ : 'text/plain' : mimeType;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get the file extension of the document.
|
|
201
|
+
*/
|
|
202
|
+
}, {
|
|
203
|
+
key: "languageFileExtension",
|
|
204
|
+
get: function get() {
|
|
205
|
+
var languageMetadata = this.language_info();
|
|
206
|
+
if (!languageMetadata || !languageMetadata.file_extension) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
return languageMetadata.file_extension.replace('.', '');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get the inner HTMLElement of the document widget.
|
|
214
|
+
*/
|
|
215
|
+
}, {
|
|
216
|
+
key: "wrapperElement",
|
|
217
|
+
get: function get() {
|
|
218
|
+
var _this$widget$containe;
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
220
|
+
return (_this$widget$containe = this.widget.container) === null || _this$widget$containe === void 0 ? void 0 : _this$widget$containe.current;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Get the list of CM editor with its type in the document,
|
|
225
|
+
*/
|
|
226
|
+
}, {
|
|
227
|
+
key: "editors",
|
|
228
|
+
get: function get() {
|
|
229
|
+
var _this2 = this;
|
|
230
|
+
if (this.disposed) {
|
|
231
|
+
return [];
|
|
232
|
+
}
|
|
233
|
+
this._editorToCell.clear();
|
|
234
|
+
return this.editor.model.cells.filter(function (item) {
|
|
235
|
+
return EditorCellView.is(item) && item.model.mimeType === 'text/x-python';
|
|
236
|
+
}).map(function (cell) {
|
|
237
|
+
return {
|
|
238
|
+
ceEditor: _this2.getCellEditor(cell),
|
|
239
|
+
type: cell.model.type,
|
|
240
|
+
value: cell.model.value
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Get the activated CM editor.
|
|
247
|
+
*/
|
|
248
|
+
}, {
|
|
249
|
+
key: "activeEditor",
|
|
250
|
+
get: function get() {
|
|
251
|
+
return this.editor.activeCell ? this.getCellEditor(this.editor.activeCell) : undefined;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Promise that resolves once the adapter is initialized
|
|
256
|
+
*/
|
|
257
|
+
}, {
|
|
258
|
+
key: "ready",
|
|
259
|
+
get: function get() {
|
|
260
|
+
return this._readyDelegate.promise;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Get the index of editor from the cursor position in the virtual
|
|
265
|
+
* document.
|
|
266
|
+
*
|
|
267
|
+
* @param position - the position of cursor in the virtual document.
|
|
268
|
+
*/
|
|
269
|
+
}, {
|
|
270
|
+
key: "getEditorIndexAt",
|
|
271
|
+
value: function getEditorIndexAt(position) {
|
|
272
|
+
var cell = this._getCellAt(position);
|
|
273
|
+
return this.editor.model.cells.findIndex(function (otherCell) {
|
|
274
|
+
return cell === otherCell;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Get the index of input editor
|
|
280
|
+
*
|
|
281
|
+
* @param ceEditor - instance of the code editor
|
|
282
|
+
*/
|
|
283
|
+
}, {
|
|
284
|
+
key: "getEditorIndex",
|
|
285
|
+
value: function getEditorIndex(ceEditor) {
|
|
286
|
+
var cell = this._editorToCell.get(ceEditor);
|
|
287
|
+
return this.editor.model.cells.findIndex(function (otherCell) {
|
|
288
|
+
return cell === otherCell;
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Get the wrapper of input editor.
|
|
294
|
+
*
|
|
295
|
+
* @param ceEditor - instance of the code editor
|
|
296
|
+
*/
|
|
297
|
+
}, {
|
|
298
|
+
key: "getEditorWrapper",
|
|
299
|
+
value: function getEditorWrapper(ceEditor) {
|
|
300
|
+
var _cell$editor;
|
|
301
|
+
var cell = this._editorToCell.get(ceEditor);
|
|
302
|
+
return EditorCellView.is(cell) ? (_cell$editor = cell.editor) === null || _cell$editor === void 0 ? void 0 : _cell$editor.host : undefined;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Callback on kernel changed event, it will disconnect the
|
|
307
|
+
* document with the language server and then reconnect.
|
|
308
|
+
*
|
|
309
|
+
* @param _session - Session context of changed kernel
|
|
310
|
+
* @param change - Changed data
|
|
311
|
+
*/
|
|
312
|
+
}, {
|
|
313
|
+
key: "onKernelChanged",
|
|
314
|
+
value: function () {
|
|
315
|
+
var _onKernelChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
316
|
+
var oldLanguageInfo, newLanguageInfo;
|
|
317
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
318
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
319
|
+
case 0:
|
|
320
|
+
_context5.prev = 0;
|
|
321
|
+
// note: we need to wait until ready before updating language info
|
|
322
|
+
oldLanguageInfo = this._languageInfo;
|
|
323
|
+
_context5.next = 4;
|
|
324
|
+
return untilReady(this.isReady, -1);
|
|
325
|
+
case 4:
|
|
326
|
+
_context5.next = 6;
|
|
327
|
+
return this._updateLanguageInfo();
|
|
328
|
+
case 6:
|
|
329
|
+
newLanguageInfo = this._languageInfo;
|
|
330
|
+
if ((oldLanguageInfo === null || oldLanguageInfo === void 0 ? void 0 : oldLanguageInfo.name) !== newLanguageInfo.name || (oldLanguageInfo === null || oldLanguageInfo === void 0 ? void 0 : oldLanguageInfo.mimetype) !== (newLanguageInfo === null || newLanguageInfo === void 0 ? void 0 : newLanguageInfo.mimetype) || (oldLanguageInfo === null || oldLanguageInfo === void 0 ? void 0 : oldLanguageInfo.file_extension) !== (newLanguageInfo === null || newLanguageInfo === void 0 ? void 0 : newLanguageInfo.file_extension)) {
|
|
331
|
+
console.warn("Changed to ".concat(this._languageInfo.name, " kernel, reconnecting"));
|
|
332
|
+
this.reloadConnection();
|
|
333
|
+
} else {
|
|
334
|
+
console.warn('Keeping old LSP connection as the new kernel uses the same langauge');
|
|
335
|
+
}
|
|
336
|
+
_context5.next = 14;
|
|
337
|
+
break;
|
|
338
|
+
case 10:
|
|
339
|
+
_context5.prev = 10;
|
|
340
|
+
_context5.t0 = _context5["catch"](0);
|
|
341
|
+
console.warn(_context5.t0);
|
|
342
|
+
// try to reconnect anyway
|
|
343
|
+
this.reloadConnection();
|
|
344
|
+
case 14:
|
|
345
|
+
case "end":
|
|
346
|
+
return _context5.stop();
|
|
347
|
+
}
|
|
348
|
+
}, _callee5, this, [[0, 10]]);
|
|
349
|
+
}));
|
|
350
|
+
function onKernelChanged() {
|
|
351
|
+
return _onKernelChanged.apply(this, arguments);
|
|
352
|
+
}
|
|
353
|
+
return onKernelChanged;
|
|
354
|
+
}()
|
|
355
|
+
/**
|
|
356
|
+
* Dispose the widget.
|
|
357
|
+
*/
|
|
358
|
+
}, {
|
|
359
|
+
key: "dispose",
|
|
360
|
+
value: function dispose() {
|
|
361
|
+
if (this.disposed) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
_get(_getPrototypeOf(NotebookAdapter.prototype), "dispose", this).call(this);
|
|
365
|
+
|
|
366
|
+
// editors are needed for the parent dispose() to unbind signals, so they are the last to go
|
|
367
|
+
this._editorToCell.clear();
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Method to check if the notebook context is ready.
|
|
372
|
+
*/
|
|
373
|
+
}, {
|
|
374
|
+
key: "isReady",
|
|
375
|
+
value: function isReady() {
|
|
376
|
+
return !this.widget.isDisposed &&
|
|
377
|
+
// this.notebookModel.currentKernelStatus !== undefined &&
|
|
378
|
+
this.widget.isVisible && this.notebookModel.cells.length > 0 && this.notebookModel.kernelConnection !== null;
|
|
379
|
+
}
|
|
380
|
+
}, {
|
|
381
|
+
key: "createVirtualDocument",
|
|
382
|
+
value:
|
|
383
|
+
/**
|
|
384
|
+
* Generate the virtual document associated with the document.
|
|
385
|
+
*/
|
|
386
|
+
function createVirtualDocument() {
|
|
387
|
+
return new VirtualDocument({
|
|
388
|
+
language: this.language,
|
|
389
|
+
foreignCodeExtractors: this.options.foreignCodeExtractorsManager,
|
|
390
|
+
path: this.documentPath,
|
|
391
|
+
fileExtension: this.languageFileExtension,
|
|
392
|
+
// notebooks are continuous, each cell is dependent on the previous one
|
|
393
|
+
standalone: false,
|
|
394
|
+
// notebooks are not supported by LSP servers
|
|
395
|
+
hasLspSupportedFile: false
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Get the metadata of notebook.
|
|
401
|
+
*/
|
|
402
|
+
}, {
|
|
403
|
+
key: "language_info",
|
|
404
|
+
value: function language_info() {
|
|
405
|
+
return this._languageInfo;
|
|
406
|
+
}
|
|
407
|
+
}, {
|
|
408
|
+
key: "_connectModelSignals",
|
|
409
|
+
value:
|
|
410
|
+
/**
|
|
411
|
+
* Connect the cell changed event to its handler
|
|
412
|
+
*
|
|
413
|
+
* @param notebook - The notebook that emitted event.
|
|
414
|
+
*/
|
|
415
|
+
function _connectModelSignals(notebook) {
|
|
416
|
+
if (notebook.model === null) {
|
|
417
|
+
console.warn("Model is missing for notebook ".concat(notebook, ", cannot connect cell changed signal!"));
|
|
418
|
+
} else {
|
|
419
|
+
notebook.model.onSourceChanged(this.handleCellSourceChange);
|
|
420
|
+
notebook.model.onCellViewChanged(this.handleCellChange);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Update the stored language info with the one from the notebook.
|
|
426
|
+
*/
|
|
427
|
+
}, {
|
|
428
|
+
key: "_updateLanguageInfo",
|
|
429
|
+
value: function () {
|
|
430
|
+
var _updateLanguageInfo2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
431
|
+
var _yield$this$notebookM, _this$notebookModel$k;
|
|
432
|
+
var language_info;
|
|
433
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
434
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
435
|
+
case 0:
|
|
436
|
+
_context6.next = 2;
|
|
437
|
+
return (_this$notebookModel$k = this.notebookModel.kernelConnection) === null || _this$notebookModel$k === void 0 ? void 0 : _this$notebookModel$k.info;
|
|
438
|
+
case 2:
|
|
439
|
+
_context6.t1 = _yield$this$notebookM = _context6.sent;
|
|
440
|
+
_context6.t0 = _context6.t1 === null;
|
|
441
|
+
if (_context6.t0) {
|
|
442
|
+
_context6.next = 6;
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
_context6.t0 = _yield$this$notebookM === void 0;
|
|
446
|
+
case 6:
|
|
447
|
+
if (!_context6.t0) {
|
|
448
|
+
_context6.next = 10;
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
_context6.t2 = void 0;
|
|
452
|
+
_context6.next = 11;
|
|
453
|
+
break;
|
|
454
|
+
case 10:
|
|
455
|
+
_context6.t2 = _yield$this$notebookM.language_info;
|
|
456
|
+
case 11:
|
|
457
|
+
language_info = _context6.t2;
|
|
458
|
+
if (!language_info) {
|
|
459
|
+
_context6.next = 16;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
this._languageInfo = language_info;
|
|
463
|
+
_context6.next = 17;
|
|
464
|
+
break;
|
|
465
|
+
case 16:
|
|
466
|
+
throw new Error('Language info update failed (no session, kernel, or info available)');
|
|
467
|
+
case 17:
|
|
468
|
+
case "end":
|
|
469
|
+
return _context6.stop();
|
|
470
|
+
}
|
|
471
|
+
}, _callee6, this);
|
|
472
|
+
}));
|
|
473
|
+
function _updateLanguageInfo() {
|
|
474
|
+
return _updateLanguageInfo2.apply(this, arguments);
|
|
475
|
+
}
|
|
476
|
+
return _updateLanguageInfo;
|
|
477
|
+
}()
|
|
478
|
+
/**
|
|
479
|
+
* Handle the cell changed event
|
|
480
|
+
* @param notebook - The notebook that emitted event
|
|
481
|
+
* @param cell - Changed cell.
|
|
482
|
+
*/
|
|
483
|
+
}, {
|
|
484
|
+
key: "_activeCellChanged",
|
|
485
|
+
value: function _activeCellChanged(libroModel) {
|
|
486
|
+
var _libroModel$active;
|
|
487
|
+
if (!libroModel || ((_libroModel$active = libroModel.active) === null || _libroModel$active === void 0 ? void 0 : _libroModel$active.model.type) !== this._type) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
this._activeEditorChanged.fire({
|
|
491
|
+
editor: this.getCellEditor(libroModel.active)
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Get the cell at the cursor position of the virtual document.
|
|
497
|
+
* @param pos - Position in the virtual document.
|
|
498
|
+
*/
|
|
499
|
+
}, {
|
|
500
|
+
key: "_getCellAt",
|
|
501
|
+
value: function _getCellAt(pos) {
|
|
502
|
+
var editor = this.virtualDocument.getEditorAtVirtualLine(pos);
|
|
503
|
+
return this._editorToCell.get(editor);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Get the cell editor and add new ones to the mappings.
|
|
508
|
+
*
|
|
509
|
+
* @param cell Cell widget
|
|
510
|
+
* @returns Cell editor accessor
|
|
511
|
+
*/
|
|
512
|
+
}, {
|
|
513
|
+
key: "getCellEditor",
|
|
514
|
+
value: function getCellEditor(cell) {
|
|
515
|
+
var _this3 = this;
|
|
516
|
+
if (!EditorCellView.is(cell)) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (!this._cellToEditor.has(cell)) {
|
|
520
|
+
var editor = Object.freeze({
|
|
521
|
+
getEditor: function getEditor() {
|
|
522
|
+
return cell.editor;
|
|
523
|
+
},
|
|
524
|
+
ready: function () {
|
|
525
|
+
var _ready = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
526
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
527
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
528
|
+
case 0:
|
|
529
|
+
return _context7.abrupt("return", cell.editor);
|
|
530
|
+
case 1:
|
|
531
|
+
case "end":
|
|
532
|
+
return _context7.stop();
|
|
533
|
+
}
|
|
534
|
+
}, _callee7);
|
|
535
|
+
}));
|
|
536
|
+
function ready() {
|
|
537
|
+
return _ready.apply(this, arguments);
|
|
538
|
+
}
|
|
539
|
+
return ready;
|
|
540
|
+
}(),
|
|
541
|
+
reveal: function () {
|
|
542
|
+
var _reveal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
543
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
544
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
545
|
+
case 0:
|
|
546
|
+
return _context8.abrupt("return", cell.editor);
|
|
547
|
+
case 1:
|
|
548
|
+
case "end":
|
|
549
|
+
return _context8.stop();
|
|
550
|
+
}
|
|
551
|
+
}, _callee8);
|
|
552
|
+
}));
|
|
553
|
+
function reveal() {
|
|
554
|
+
return _reveal.apply(this, arguments);
|
|
555
|
+
}
|
|
556
|
+
return reveal;
|
|
557
|
+
}()
|
|
558
|
+
});
|
|
559
|
+
this._cellToEditor.set(cell, editor);
|
|
560
|
+
this._editorToCell.set(editor, cell);
|
|
561
|
+
cell.onDisposed(function () {
|
|
562
|
+
_this3._cellToEditor.delete(cell);
|
|
563
|
+
_this3._editorToCell.delete(editor);
|
|
564
|
+
_this3._editorRemoved.fire({
|
|
565
|
+
editor: editor
|
|
566
|
+
});
|
|
567
|
+
});
|
|
568
|
+
this._editorAdded.fire({
|
|
569
|
+
editor: editor
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
return this._cellToEditor.get(cell);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* A map between the editor accessor and the containing cell
|
|
577
|
+
*/
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Mapping of cell to editor accessor to ensure accessor uniqueness.
|
|
581
|
+
*/
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Metadata of the notebook
|
|
585
|
+
*/
|
|
586
|
+
}]);
|
|
587
|
+
return NotebookAdapter;
|
|
588
|
+
}(WidgetLSPAdapter);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Emitter } from '@difizen/mana-app';
|
|
2
|
+
import type { Disposable } from '@difizen/mana-app';
|
|
3
|
+
export declare class StatusMessage implements Disposable {
|
|
4
|
+
/**
|
|
5
|
+
* Timeout reference used to clear the previous `setTimeout` call.
|
|
6
|
+
*/
|
|
7
|
+
protected _timer: number | null;
|
|
8
|
+
/**
|
|
9
|
+
* The text message to be shown on the statusbar
|
|
10
|
+
*/
|
|
11
|
+
protected _message: string;
|
|
12
|
+
protected _changed: Emitter<void>;
|
|
13
|
+
protected _isDisposed: boolean;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Signal emitted on status changed event.
|
|
17
|
+
*/
|
|
18
|
+
get changed(): Emitter<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Test whether the object is disposed.
|
|
21
|
+
*/
|
|
22
|
+
get isDisposed(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Dispose the object.
|
|
25
|
+
*/
|
|
26
|
+
dispose(): void;
|
|
27
|
+
/**
|
|
28
|
+
* The text message to be shown on the statusbar.
|
|
29
|
+
*/
|
|
30
|
+
get message(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Set the text message and (optionally) the timeout to remove it.
|
|
33
|
+
* @param message
|
|
34
|
+
* @param timeout - number of ms to until the message is cleaned;
|
|
35
|
+
* -1 if the message should stay up indefinitely;
|
|
36
|
+
* defaults to 3000ms (3 seconds)
|
|
37
|
+
*/
|
|
38
|
+
set(message: string, timeout?: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Clear the status message.
|
|
41
|
+
*/
|
|
42
|
+
clear(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Clear the previous `setTimeout` call.
|
|
45
|
+
*/
|
|
46
|
+
protected _expireTimer(): void;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=status-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-message.d.ts","sourceRoot":"","sources":["../../src/adapters/status-message.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,aAAc,YAAW,UAAU;IAC9C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE3B,SAAS,CAAC,QAAQ,gBAAuB;IAEzC,SAAS,CAAC,WAAW,UAAS;;IAO9B;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;IACH,OAAO,IAAI,IAAI;IAUf;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;;;;OAMG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAiB,GAAG,IAAI;IAStD;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;CAM/B"}
|