@difizen/libro-lsp 0.1.2 → 0.1.4
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/adapters/adapter.d.ts.map +1 -1
- package/es/adapters/adapter.js +4 -3
- package/es/adapters/notebook-adapter.d.ts +10 -4
- package/es/adapters/notebook-adapter.d.ts.map +1 -1
- package/es/adapters/notebook-adapter.js +20 -8
- package/es/connection-manager.d.ts +37 -34
- package/es/connection-manager.d.ts.map +1 -1
- package/es/connection-manager.js +186 -186
- package/es/connection.d.ts +8 -16
- package/es/connection.d.ts.map +1 -1
- package/es/connection.js +26 -12
- package/es/index.d.ts +1 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +1 -0
- package/es/lsp-app-contribution.d.ts +2 -0
- package/es/lsp-app-contribution.d.ts.map +1 -1
- package/es/lsp-app-contribution.js +11 -4
- package/es/lsp-protocol.d.ts +15 -0
- package/es/lsp-protocol.d.ts.map +1 -1
- package/es/lsp-protocol.js +9 -1
- package/es/module.d.ts.map +1 -1
- package/es/module.js +54 -2
- package/es/monitor.d.ts +20 -0
- package/es/monitor.d.ts.map +1 -0
- package/es/monitor.js +25 -0
- package/es/tokens.d.ts +4 -1
- package/es/tokens.d.ts.map +1 -1
- package/es/tokens.js +2 -1
- package/es/virtual/document.d.ts +14 -4
- package/es/virtual/document.d.ts.map +1 -1
- package/es/virtual/document.js +48 -24
- package/es/ws-connection/ws-connection.d.ts +2 -1
- package/es/ws-connection/ws-connection.d.ts.map +1 -1
- package/es/ws-connection/ws-connection.js +4 -3
- package/package.json +5 -5
- package/src/adapters/adapter.ts +2 -1
- package/src/adapters/notebook-adapter.ts +17 -7
- package/src/connection-manager.ts +120 -146
- package/src/connection.ts +16 -27
- package/src/index.ts +1 -0
- package/src/lsp-app-contribution.ts +4 -2
- package/src/lsp-protocol.ts +26 -0
- package/src/module.ts +61 -0
- package/src/monitor.ts +28 -0
- package/src/tokens.ts +5 -1
- package/src/virtual/document.ts +32 -8
- package/src/ws-connection/ws-connection.ts +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/virtual/document.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/virtual/document.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,IAAI,kBAAkB,EAC/B,MAAM,EACP,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,UAAU,YAAY;IACpB;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC;IAEtC;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAE9E,UAAU,WA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AC,IAAI,CAAC;IAcnD;;;;OAIG;IACG,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,iBAAiB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA6C1E,SAAS,CAAC,WAAW,UAAS;IAE9B;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAEjC;IAEH;;OAEG;IACH,SAAS,CAAC,mBAAmB,UAAS;IAEtC;;OAEG;IACH,SAAS,CAAC,WAAW,UAAS;IAE9B,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAChD,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACrD,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC9D,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAEjE;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,YAAY,EAAE,eAAe;IAQlD;;OAEG;IACH,SAAS,CAAC,UAAU;CAGrB"}
|
package/es/virtual/document.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
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
|
+
var _dec, _dec2, _class, _class2, _descriptor, _dec3, _dec4, _class4, _class5, _descriptor2, _class6;
|
|
2
3
|
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; }
|
|
3
4
|
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); } }
|
|
4
5
|
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); }); }; }
|
|
@@ -16,17 +17,21 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
16
17
|
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; } } }; }
|
|
17
18
|
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); }
|
|
18
19
|
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; }
|
|
20
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
19
21
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
22
|
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); } }
|
|
21
23
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
22
24
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
25
|
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); }
|
|
26
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
27
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
24
28
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
25
29
|
// Copyright (c) Jupyter Development Team.
|
|
26
30
|
// Distributed under the terms of the Modified BSD License.
|
|
27
31
|
|
|
28
32
|
import { Emitter } from '@difizen/mana-app';
|
|
29
|
-
import {
|
|
33
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
34
|
+
import { ILSPDocumentConnectionManager } from "../tokens.js";
|
|
30
35
|
import { DefaultMap, untilReady } from "../utils.js";
|
|
31
36
|
/**
|
|
32
37
|
* Check if given position is within range.
|
|
@@ -40,11 +45,12 @@ export function isWithinRange(position, range) {
|
|
|
40
45
|
}
|
|
41
46
|
return position.line === range.start.line && position.column >= range.start.column && position.line < range.end.line || position.line > range.start.line && position.column <= range.end.column && position.line === range.end.line || position.line > range.start.line && position.line < range.end.line;
|
|
42
47
|
}
|
|
43
|
-
|
|
48
|
+
export var VirtualDocumentInfoFactory = Symbol('VirtualDocumentInfoFactory');
|
|
49
|
+
export var VirtualDocumentInfoOptions = Symbol('VirtualDocumentInfoOptions');
|
|
44
50
|
/**
|
|
45
51
|
* A virtual implementation of IDocumentInfo
|
|
46
52
|
*/
|
|
47
|
-
export var VirtualDocumentInfo = /*#__PURE__*/function () {
|
|
53
|
+
export var VirtualDocumentInfo = (_dec = transient(), _dec2 = inject(ILSPDocumentConnectionManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
48
54
|
/**
|
|
49
55
|
* Creates an instance of VirtualDocumentInfo.
|
|
50
56
|
* @param document - the virtual document need to
|
|
@@ -52,12 +58,14 @@ export var VirtualDocumentInfo = /*#__PURE__*/function () {
|
|
|
52
58
|
*/
|
|
53
59
|
function VirtualDocumentInfo(document) {
|
|
54
60
|
_classCallCheck(this, VirtualDocumentInfo);
|
|
61
|
+
_initializerDefineProperty(this, "connectionManager", _descriptor, this);
|
|
55
62
|
/**
|
|
56
63
|
* Current version of the virtual document.
|
|
57
64
|
*/
|
|
58
65
|
this.version = 0;
|
|
59
66
|
this._document = document;
|
|
60
67
|
}
|
|
68
|
+
VirtualDocumentInfo = inject(VirtualDocumentInfoOptions)(VirtualDocumentInfo, undefined, 0) || VirtualDocumentInfo;
|
|
61
69
|
_createClass(VirtualDocumentInfo, [{
|
|
62
70
|
key: "text",
|
|
63
71
|
get:
|
|
@@ -76,7 +84,7 @@ export var VirtualDocumentInfo = /*#__PURE__*/function () {
|
|
|
76
84
|
}, {
|
|
77
85
|
key: "uri",
|
|
78
86
|
get: function get() {
|
|
79
|
-
var uris =
|
|
87
|
+
var uris = this.connectionManager.solveUris(this._document, this.languageId);
|
|
80
88
|
if (!uris) {
|
|
81
89
|
return '';
|
|
82
90
|
}
|
|
@@ -97,7 +105,15 @@ export var VirtualDocumentInfo = /*#__PURE__*/function () {
|
|
|
97
105
|
*/
|
|
98
106
|
}]);
|
|
99
107
|
return VirtualDocumentInfo;
|
|
100
|
-
}()
|
|
108
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "connectionManager", [_dec2], {
|
|
109
|
+
configurable: true,
|
|
110
|
+
enumerable: true,
|
|
111
|
+
writable: true,
|
|
112
|
+
initializer: null
|
|
113
|
+
})), _class2)) || _class);
|
|
114
|
+
export var VirtualDocumentFactory = Symbol('VirtualDocumentFactory');
|
|
115
|
+
export var IVirtualDocumentOptions = Symbol('IVirtualDocumentOptions');
|
|
116
|
+
|
|
101
117
|
/**
|
|
102
118
|
*
|
|
103
119
|
* A notebook can hold one or more virtual documents; there is always one,
|
|
@@ -119,9 +135,10 @@ export var VirtualDocumentInfo = /*#__PURE__*/function () {
|
|
|
119
135
|
* No dependency on editor implementation (such as CodeMirrorEditor)
|
|
120
136
|
* is allowed for VirtualEditor.
|
|
121
137
|
*/
|
|
122
|
-
export var VirtualDocument = /*#__PURE__*/function () {
|
|
123
|
-
function VirtualDocument(options) {
|
|
138
|
+
export var VirtualDocument = (_dec3 = transient(), _dec4 = inject(VirtualDocumentFactory), _dec3(_class4 = (_class5 = (_class6 = /*#__PURE__*/function () {
|
|
139
|
+
function VirtualDocument(options, docInfofactory) {
|
|
124
140
|
_classCallCheck(this, VirtualDocument);
|
|
141
|
+
_initializerDefineProperty(this, "factory", _descriptor2, this);
|
|
125
142
|
/**
|
|
126
143
|
* Number of blank lines appended to the virtual document between
|
|
127
144
|
* each cell.
|
|
@@ -150,6 +167,7 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
150
167
|
});
|
|
151
168
|
this._remainingLifetime = 6;
|
|
152
169
|
this.unusedDocuments = new Set();
|
|
170
|
+
this.documentInfo = docInfofactory(this);
|
|
153
171
|
this.documentInfo = new VirtualDocumentInfo(this);
|
|
154
172
|
this.updateManager = new UpdateManager(this);
|
|
155
173
|
this.updateManager.updateBegan(this._updateBeganSlot, this);
|
|
@@ -161,6 +179,8 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
161
179
|
/**
|
|
162
180
|
* Convert from code editor position into code mirror position.
|
|
163
181
|
*/
|
|
182
|
+
VirtualDocument = inject(VirtualDocumentInfoFactory)(VirtualDocument, undefined, 1) || VirtualDocument;
|
|
183
|
+
VirtualDocument = inject(IVirtualDocumentOptions)(VirtualDocument, undefined, 0) || VirtualDocument;
|
|
164
184
|
_createClass(VirtualDocument, [{
|
|
165
185
|
key: "isDisposed",
|
|
166
186
|
get:
|
|
@@ -366,8 +386,8 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
366
386
|
_step;
|
|
367
387
|
try {
|
|
368
388
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
369
|
-
var
|
|
370
|
-
|
|
389
|
+
var _document = _step.value;
|
|
390
|
+
_document.clear();
|
|
371
391
|
}
|
|
372
392
|
|
|
373
393
|
// TODO - deep clear (assure that there is no memory leak)
|
|
@@ -407,13 +427,13 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
407
427
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
408
428
|
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
409
429
|
range = _step2$value[0],
|
|
410
|
-
|
|
430
|
+
_document2 = _step2$value[1].virtualDocument;
|
|
411
431
|
if (isWithinRange(sourcePositionCe, range)) {
|
|
412
432
|
var sourcePositionCm = {
|
|
413
433
|
line: sourcePositionCe.line - range.start.line,
|
|
414
434
|
ch: sourcePositionCe.column - range.start.column
|
|
415
435
|
};
|
|
416
|
-
return
|
|
436
|
+
return _document2.documentAtSourcePosition(sourcePositionCm);
|
|
417
437
|
}
|
|
418
438
|
}
|
|
419
439
|
} catch (err) {
|
|
@@ -522,14 +542,14 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
522
542
|
content = _step4$value[1];
|
|
523
543
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
524
544
|
var _virtualLine = content.virtualLine,
|
|
525
|
-
|
|
545
|
+
_document3 = content.virtualDocument;
|
|
526
546
|
if (isWithinRange(sourcePositionCe, range)) {
|
|
527
547
|
// position inside the foreign document block
|
|
528
548
|
var sourcePositionCm = {
|
|
529
549
|
line: sourcePositionCe.line - range.start.line,
|
|
530
550
|
ch: sourcePositionCe.column - range.start.column
|
|
531
551
|
};
|
|
532
|
-
if (
|
|
552
|
+
if (_document3.isWithinForeign(sourcePositionCm)) {
|
|
533
553
|
return this.virtualPositionAtDocument(sourcePositionCm);
|
|
534
554
|
} else {
|
|
535
555
|
// where in this block in the entire foreign document?
|
|
@@ -736,8 +756,8 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
736
756
|
_step6;
|
|
737
757
|
try {
|
|
738
758
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
739
|
-
var
|
|
740
|
-
this.closeForeign(
|
|
759
|
+
var _document4 = _step6.value;
|
|
760
|
+
this.closeForeign(_document4);
|
|
741
761
|
}
|
|
742
762
|
} catch (err) {
|
|
743
763
|
_iterator6.e(err);
|
|
@@ -756,10 +776,10 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
756
776
|
_step7;
|
|
757
777
|
try {
|
|
758
778
|
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
759
|
-
var
|
|
760
|
-
|
|
761
|
-
if (
|
|
762
|
-
|
|
779
|
+
var _document5 = _step7.value;
|
|
780
|
+
_document5.remainingLifetime -= 1;
|
|
781
|
+
if (_document5.remainingLifetime <= 0) {
|
|
782
|
+
_document5.dispose();
|
|
763
783
|
}
|
|
764
784
|
}
|
|
765
785
|
} catch (err) {
|
|
@@ -863,8 +883,8 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
863
883
|
_step8;
|
|
864
884
|
try {
|
|
865
885
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
866
|
-
var
|
|
867
|
-
|
|
886
|
+
var _document6 = _step8.value;
|
|
887
|
+
_document6.maybeEmitChanged();
|
|
868
888
|
}
|
|
869
889
|
} catch (err) {
|
|
870
890
|
_iterator8.e(err);
|
|
@@ -929,7 +949,7 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
929
949
|
key: "openForeign",
|
|
930
950
|
value: function openForeign(language, standalone, fileExtension) {
|
|
931
951
|
var _this = this;
|
|
932
|
-
var document =
|
|
952
|
+
var document = this.factory(_objectSpread(_objectSpread({}, this.options), {}, {
|
|
933
953
|
parent: this,
|
|
934
954
|
standalone: standalone,
|
|
935
955
|
fileExtension: fileExtension,
|
|
@@ -1007,8 +1027,12 @@ export var VirtualDocument = /*#__PURE__*/function () {
|
|
|
1007
1027
|
}
|
|
1008
1028
|
}]);
|
|
1009
1029
|
return VirtualDocument;
|
|
1010
|
-
}()
|
|
1011
|
-
|
|
1030
|
+
}(), _class6.instancesCount = 0, _class6), (_descriptor2 = _applyDecoratedDescriptor(_class5.prototype, "factory", [_dec4], {
|
|
1031
|
+
configurable: true,
|
|
1032
|
+
enumerable: true,
|
|
1033
|
+
writable: true,
|
|
1034
|
+
initializer: null
|
|
1035
|
+
})), _class5)) || _class4);
|
|
1012
1036
|
/**
|
|
1013
1037
|
* Create foreign documents if available from input virtual documents.
|
|
1014
1038
|
* @param virtualDocument - the virtual document to be collected
|
|
@@ -2,7 +2,8 @@ import type { Disposable, Event } from '@difizen/mana-app';
|
|
|
2
2
|
import { Emitter } from '@difizen/mana-app';
|
|
3
3
|
import type * as protocol from 'vscode-languageserver-protocol';
|
|
4
4
|
import type { MessageConnection } from 'vscode-ws-jsonrpc';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ILspOptions } from './types.js';
|
|
6
|
+
import type { IDocumentInfo, ILspConnection } from './types.js';
|
|
6
7
|
export declare class LspWsConnection implements ILspConnection, Disposable {
|
|
7
8
|
constructor(options: ILspOptions);
|
|
8
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-connection.d.ts","sourceRoot":"","sources":["../../src/ws-connection/ws-connection.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"ws-connection.d.ts","sourceRoot":"","sources":["../../src/ws-connection/ws-connection.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAa,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAEhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAO3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,qBACa,eAAgB,YAAW,cAAc,EAAE,UAAU;gBACpD,OAAO,EAAE,WAAW;IAIhC;;OAEG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,IAAI,OAAO,YAEV;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,KAAK,CAAC,IAAI,CAAC,CAE5B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAsDhC;;OAEG;IACH,KAAK;IAQL;;OAEG;IACH,cAAc;IAuBd;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa;IAgBpC;;OAEG;IACH,UAAU,CAAC,YAAY,EAAE,aAAa;IAqBtC;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,aAAa;IAiBrC;;OAEG;IACH,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,4BAA4B;IAUvE;;OAEG;IACH,OAAO,IAAI,IAAI;IAWf;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,iBAAiB,CAAC;IAExC;;OAEG;IACH,SAAS,CAAC,UAAU,uBAA8B;IAElD;;OAEG;IACH,SAAS,CAAC,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAE1D;;OAEG;IACH,SAAS,CAAC,YAAY,UAAS;IAE/B;;OAEG;IACH,SAAS,CAAC,cAAc,UAAS;IAEjC;;;OAGG;IACH,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAM;IAEnD;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,GAAG,IAAI;IAWtE;;;OAGG;IACH,SAAS,CAAC,gBAAgB,IAAI,QAAQ,CAAC,gBAAgB;IASvD;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE3B,SAAS,CAAC,SAAS,gBAAuB;IAE1C,SAAS,CAAC,WAAW,UAAS;CAC/B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
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
|
+
var _dec, _class;
|
|
2
3
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
4
|
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); } }
|
|
4
5
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -15,13 +16,13 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
15
16
|
// but without language deemed unnecessary following the Berne Convention." (Wikipedia).
|
|
16
17
|
// Introduced modifications are BSD licenced, copyright JupyterLab development team.
|
|
17
18
|
|
|
18
|
-
import { Emitter } from '@difizen/mana-app';
|
|
19
|
+
import { Emitter, transient } from '@difizen/mana-app';
|
|
19
20
|
|
|
20
21
|
//TODO: vscode-ws-jsonrpc has new version
|
|
21
22
|
|
|
22
23
|
import { ConsoleLogger, listen } from 'vscode-ws-jsonrpc';
|
|
23
24
|
import { registerServerCapability, unregisterServerCapability } from "./server-capability-registration.js";
|
|
24
|
-
export var LspWsConnection = /*#__PURE__*/function () {
|
|
25
|
+
export var LspWsConnection = (_dec = transient(), _dec(_class = /*#__PURE__*/function () {
|
|
25
26
|
function LspWsConnection(options) {
|
|
26
27
|
_classCallCheck(this, LspWsConnection);
|
|
27
28
|
/**
|
|
@@ -298,4 +299,4 @@ export var LspWsConnection = /*#__PURE__*/function () {
|
|
|
298
299
|
*/
|
|
299
300
|
}]);
|
|
300
301
|
return LspWsConnection;
|
|
301
|
-
}();
|
|
302
|
+
}()) || _class);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-lsp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-core": "^0.1.
|
|
36
|
-
"@difizen/libro-kernel": "^0.1.
|
|
37
|
-
"@difizen/libro-common": "^0.1.
|
|
38
|
-
"@difizen/libro-code-editor": "^0.1.
|
|
35
|
+
"@difizen/libro-core": "^0.1.4",
|
|
36
|
+
"@difizen/libro-kernel": "^0.1.4",
|
|
37
|
+
"@difizen/libro-common": "^0.1.4",
|
|
38
|
+
"@difizen/libro-code-editor": "^0.1.4",
|
|
39
39
|
"@difizen/mana-app": "latest",
|
|
40
40
|
"lodash.mergewith": "^4.6.2",
|
|
41
41
|
"uuid": "^9.0.0",
|
package/src/adapters/adapter.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
4
|
import type { NotebookView } from '@difizen/libro-core';
|
|
5
|
-
import { Emitter } from '@difizen/mana-app';
|
|
5
|
+
import { Emitter, injectable } from '@difizen/mana-app';
|
|
6
6
|
import type { Disposable, Event, View } from '@difizen/mana-app';
|
|
7
7
|
import type {} from '@difizen/mana-app';
|
|
8
8
|
import mergeWith from 'lodash.mergewith';
|
|
@@ -59,6 +59,7 @@ export interface IAdapterOptions {
|
|
|
59
59
|
* as this would make the logic of inspections caching impossible to maintain, thus the WidgetAdapter
|
|
60
60
|
* has to handle that, keeping multiple connections and multiple virtual documents.
|
|
61
61
|
*/
|
|
62
|
+
@injectable()
|
|
62
63
|
export abstract class WidgetLSPAdapter<T extends NotebookView> implements Disposable {
|
|
63
64
|
// note: it could be using namespace/IOptions pattern,
|
|
64
65
|
// but I do not know how to make it work with the generic type T
|
|
@@ -13,23 +13,33 @@ import type {
|
|
|
13
13
|
import { EditorCellView } from '@difizen/libro-core';
|
|
14
14
|
import type { ExecutableNotebookModel } from '@difizen/libro-kernel';
|
|
15
15
|
import {} from '@difizen/mana-app';
|
|
16
|
-
import { watch, Deferred } from '@difizen/mana-app';
|
|
16
|
+
import { inject, transient, watch, Deferred } from '@difizen/mana-app';
|
|
17
17
|
|
|
18
18
|
import type { IVirtualPosition } from '../positioning.js';
|
|
19
19
|
import type { Document } from '../tokens.js';
|
|
20
20
|
import { untilReady } from '../utils.js';
|
|
21
|
-
import { VirtualDocument } from '../virtual/document.js';
|
|
21
|
+
import type { VirtualDocument } from '../virtual/document.js';
|
|
22
|
+
import { VirtualDocumentFactory } from '../virtual/document.js';
|
|
22
23
|
|
|
23
24
|
import type { IAdapterOptions } from './adapter.js';
|
|
24
25
|
import { WidgetLSPAdapter } from './adapter.js';
|
|
25
26
|
|
|
26
27
|
type ILanguageInfoMetadata = nbformat.ILanguageInfoMetadata;
|
|
27
28
|
|
|
29
|
+
export const NotebookAdapterFactory = Symbol('NotebookAdapterFactory');
|
|
30
|
+
export type NotebookAdapterFactory = (
|
|
31
|
+
options: NotebookAdapterOptions,
|
|
32
|
+
) => NotebookAdapter;
|
|
33
|
+
export const NotebookAdapterOptions = Symbol('NotebookAdapterOptions');
|
|
34
|
+
export interface NotebookAdapterOptions extends IAdapterOptions {
|
|
35
|
+
editorWidget: LibroView;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@transient()
|
|
28
39
|
export class NotebookAdapter extends WidgetLSPAdapter<LibroView> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
) {
|
|
40
|
+
@inject(VirtualDocumentFactory) protected readonly docFactory: VirtualDocumentFactory;
|
|
41
|
+
constructor(@inject(NotebookAdapterOptions) options: NotebookAdapterOptions) {
|
|
42
|
+
const editorWidget = options.editorWidget;
|
|
33
43
|
super(editorWidget, options);
|
|
34
44
|
this._editorToCell = new Map();
|
|
35
45
|
this.editor = editorWidget;
|
|
@@ -300,7 +310,7 @@ export class NotebookAdapter extends WidgetLSPAdapter<LibroView> {
|
|
|
300
310
|
* Generate the virtual document associated with the document.
|
|
301
311
|
*/
|
|
302
312
|
createVirtualDocument(): VirtualDocument {
|
|
303
|
-
return
|
|
313
|
+
return this.docFactory({
|
|
304
314
|
language: this.language,
|
|
305
315
|
foreignCodeExtractors: this.options.foreignCodeExtractorsManager,
|
|
306
316
|
path: this.documentPath,
|