@difizen/libro-cofine-editor 0.1.17 → 0.1.19
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/editor-contribution.d.ts.map +1 -1
- package/es/editor-contribution.js +2 -1
- package/es/language/python/data/snippets/python.snippets.json +0 -30
- package/es/libro-e2-editor.d.ts +6 -6
- package/es/libro-e2-editor.d.ts.map +1 -1
- package/es/libro-e2-editor.js +69 -66
- package/es/libro-e2-preload.d.ts.map +1 -1
- package/es/libro-e2-preload.js +1 -3
- package/package.json +7 -7
- package/src/editor-contribution.ts +2 -5
- package/src/language/python/data/snippets/python.snippets.json +0 -30
- package/src/libro-e2-editor.ts +56 -41
- package/src/libro-e2-preload.ts +0 -2
- package/es/language/lsp/completion-provider.d.ts +0 -13
- package/es/language/lsp/completion-provider.d.ts.map +0 -1
- package/es/language/lsp/completion-provider.js +0 -294
- package/es/language/lsp/diagnostic-provider.d.ts +0 -27
- package/es/language/lsp/diagnostic-provider.d.ts.map +0 -1
- package/es/language/lsp/diagnostic-provider.js +0 -230
- package/es/language/lsp/format-provider.d.ts +0 -9
- package/es/language/lsp/format-provider.d.ts.map +0 -1
- package/es/language/lsp/format-provider.js +0 -143
- package/es/language/lsp/hover-provider.d.ts +0 -8
- package/es/language/lsp/hover-provider.d.ts.map +0 -1
- package/es/language/lsp/hover-provider.js +0 -136
- package/es/language/lsp/language-feature-provider.d.ts +0 -22
- package/es/language/lsp/language-feature-provider.d.ts.map +0 -1
- package/es/language/lsp/language-feature-provider.js +0 -194
- package/es/language/lsp/lsp-contribution.d.ts +0 -22
- package/es/language/lsp/lsp-contribution.d.ts.map +0 -1
- package/es/language/lsp/lsp-contribution.js +0 -135
- package/es/language/lsp/module.d.ts +0 -2
- package/es/language/lsp/module.d.ts.map +0 -1
- package/es/language/lsp/module.js +0 -3
- package/es/language/lsp/semantic-highlight-provider.d.ts +0 -9
- package/es/language/lsp/semantic-highlight-provider.d.ts.map +0 -1
- package/es/language/lsp/semantic-highlight-provider.js +0 -41
- package/es/language/lsp/signature-help-provider.d.ts +0 -8
- package/es/language/lsp/signature-help-provider.d.ts.map +0 -1
- package/es/language/lsp/signature-help-provider.js +0 -108
- package/es/language/lsp/type-concerters.d.ts +0 -7
- package/es/language/lsp/type-concerters.d.ts.map +0 -1
- package/es/language/lsp/type-concerters.js +0 -35
- package/src/language/lsp/completion-provider.ts +0 -213
- package/src/language/lsp/diagnostic-provider.ts +0 -168
- package/src/language/lsp/format-provider.ts +0 -88
- package/src/language/lsp/hover-provider.ts +0 -98
- package/src/language/lsp/language-feature-provider.ts +0 -107
- package/src/language/lsp/lsp-contribution.ts +0 -129
- package/src/language/lsp/module.ts +0 -5
- package/src/language/lsp/semantic-highlight-provider.ts +0 -26
- package/src/language/lsp/signature-help-provider.ts +0 -65
- package/src/language/lsp/type-concerters.ts +0 -72
|
@@ -1,194 +0,0 @@
|
|
|
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 _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
|
-
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
|
-
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); }); }; }
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
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); } }
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
import { EditorCellView } from '@difizen/libro-core';
|
|
11
|
-
import { LibroE2Editor } from "../../libro-e2-editor.js";
|
|
12
|
-
export var LangaugeFeatureProvider = /*#__PURE__*/function () {
|
|
13
|
-
function LangaugeFeatureProvider(libroService, lspDocumentConnectionManager) {
|
|
14
|
-
_classCallCheck(this, LangaugeFeatureProvider);
|
|
15
|
-
this.libroService = libroService;
|
|
16
|
-
this.lspDocumentConnectionManager = lspDocumentConnectionManager;
|
|
17
|
-
}
|
|
18
|
-
_createClass(LangaugeFeatureProvider, [{
|
|
19
|
-
key: "getVirtualDocument",
|
|
20
|
-
value: function () {
|
|
21
|
-
var _getVirtualDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
22
|
-
var libroView, adapter, virtualDocument;
|
|
23
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
24
|
-
while (1) switch (_context.prev = _context.next) {
|
|
25
|
-
case 0:
|
|
26
|
-
libroView = this.libroService.active;
|
|
27
|
-
if (libroView) {
|
|
28
|
-
_context.next = 3;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
return _context.abrupt("return");
|
|
32
|
-
case 3:
|
|
33
|
-
_context.next = 5;
|
|
34
|
-
return this.lspDocumentConnectionManager.ready;
|
|
35
|
-
case 5:
|
|
36
|
-
adapter = this.lspDocumentConnectionManager.adapters.get(libroView.model.id);
|
|
37
|
-
if (adapter) {
|
|
38
|
-
_context.next = 8;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
throw new Error('no adapter');
|
|
42
|
-
case 8:
|
|
43
|
-
_context.next = 10;
|
|
44
|
-
return adapter.ready;
|
|
45
|
-
case 10:
|
|
46
|
-
// Get the associated virtual document of the opened document
|
|
47
|
-
virtualDocument = adapter.virtualDocument;
|
|
48
|
-
return _context.abrupt("return", virtualDocument);
|
|
49
|
-
case 12:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context.stop();
|
|
52
|
-
}
|
|
53
|
-
}, _callee, this);
|
|
54
|
-
}));
|
|
55
|
-
function getVirtualDocument() {
|
|
56
|
-
return _getVirtualDocument.apply(this, arguments);
|
|
57
|
-
}
|
|
58
|
-
return getVirtualDocument;
|
|
59
|
-
}()
|
|
60
|
-
}, {
|
|
61
|
-
key: "getLSPConnection",
|
|
62
|
-
value: function () {
|
|
63
|
-
var _getLSPConnection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
64
|
-
var virtualDocument, lspConnection;
|
|
65
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
66
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
67
|
-
case 0:
|
|
68
|
-
_context2.next = 2;
|
|
69
|
-
return this.getVirtualDocument();
|
|
70
|
-
case 2:
|
|
71
|
-
virtualDocument = _context2.sent;
|
|
72
|
-
if (virtualDocument) {
|
|
73
|
-
_context2.next = 5;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
throw new Error('no virtualDocument');
|
|
77
|
-
case 5:
|
|
78
|
-
// Get the LSP connection of the virtual document.
|
|
79
|
-
lspConnection = this.lspDocumentConnectionManager.connections.get(virtualDocument.uri);
|
|
80
|
-
return _context2.abrupt("return", lspConnection);
|
|
81
|
-
case 7:
|
|
82
|
-
case "end":
|
|
83
|
-
return _context2.stop();
|
|
84
|
-
}
|
|
85
|
-
}, _callee2, this);
|
|
86
|
-
}));
|
|
87
|
-
function getLSPConnection() {
|
|
88
|
-
return _getLSPConnection.apply(this, arguments);
|
|
89
|
-
}
|
|
90
|
-
return getLSPConnection;
|
|
91
|
-
}()
|
|
92
|
-
/**
|
|
93
|
-
* find cell editor from active notebook by model uri
|
|
94
|
-
* @param model
|
|
95
|
-
* @returns
|
|
96
|
-
*/
|
|
97
|
-
}, {
|
|
98
|
-
key: "getEditorByModel",
|
|
99
|
-
value: function getEditorByModel(model) {
|
|
100
|
-
var _this$libroService$ac;
|
|
101
|
-
var cells = (_this$libroService$ac = this.libroService.active) === null || _this$libroService$ac === void 0 ? void 0 : _this$libroService$ac.model.cells;
|
|
102
|
-
if (!cells) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
var cell = cells.find(function (item) {
|
|
106
|
-
var editorUuid = model.uri.path.split('.')[0];
|
|
107
|
-
if (!EditorCellView.is(item)) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
var e2editor = item.editor;
|
|
111
|
-
if (!(e2editor instanceof LibroE2Editor)) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
return editorUuid === e2editor.uuid;
|
|
115
|
-
});
|
|
116
|
-
return cell.editor;
|
|
117
|
-
}
|
|
118
|
-
}, {
|
|
119
|
-
key: "getEditorFromLSPPosition",
|
|
120
|
-
value: function () {
|
|
121
|
-
var _getEditorFromLSPPosition = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(range) {
|
|
122
|
-
var virtualDocument, currentEditor, _editor;
|
|
123
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
124
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
125
|
-
case 0:
|
|
126
|
-
_context3.prev = 0;
|
|
127
|
-
_context3.next = 3;
|
|
128
|
-
return this.getVirtualDocument();
|
|
129
|
-
case 3:
|
|
130
|
-
virtualDocument = _context3.sent;
|
|
131
|
-
currentEditor = virtualDocument === null || virtualDocument === void 0 ? void 0 : virtualDocument.getEditorAtVirtualLine({
|
|
132
|
-
line: range.start.line,
|
|
133
|
-
ch: range.start.character,
|
|
134
|
-
isVirtual: true
|
|
135
|
-
});
|
|
136
|
-
_editor = currentEditor === null || currentEditor === void 0 ? void 0 : currentEditor.getEditor();
|
|
137
|
-
if (!(_editor instanceof LibroE2Editor)) {
|
|
138
|
-
_context3.next = 8;
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
return _context3.abrupt("return", _editor);
|
|
142
|
-
case 8:
|
|
143
|
-
return _context3.abrupt("return");
|
|
144
|
-
case 11:
|
|
145
|
-
_context3.prev = 11;
|
|
146
|
-
_context3.t0 = _context3["catch"](0);
|
|
147
|
-
console.warn(_context3.t0);
|
|
148
|
-
return _context3.abrupt("return");
|
|
149
|
-
case 15:
|
|
150
|
-
case "end":
|
|
151
|
-
return _context3.stop();
|
|
152
|
-
}
|
|
153
|
-
}, _callee3, this, [[0, 11]]);
|
|
154
|
-
}));
|
|
155
|
-
function getEditorFromLSPPosition(_x) {
|
|
156
|
-
return _getEditorFromLSPPosition.apply(this, arguments);
|
|
157
|
-
}
|
|
158
|
-
return getEditorFromLSPPosition;
|
|
159
|
-
}()
|
|
160
|
-
}, {
|
|
161
|
-
key: "getProvider",
|
|
162
|
-
value: function () {
|
|
163
|
-
var _getProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(model) {
|
|
164
|
-
var _editor$lspProvider;
|
|
165
|
-
var editor, provider;
|
|
166
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
167
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
168
|
-
case 0:
|
|
169
|
-
editor = this.getEditorByModel(model);
|
|
170
|
-
if (editor) {
|
|
171
|
-
_context4.next = 3;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
return _context4.abrupt("return");
|
|
175
|
-
case 3:
|
|
176
|
-
_context4.next = 5;
|
|
177
|
-
return (_editor$lspProvider = editor.lspProvider) === null || _editor$lspProvider === void 0 ? void 0 : _editor$lspProvider.call(editor);
|
|
178
|
-
case 5:
|
|
179
|
-
provider = _context4.sent;
|
|
180
|
-
return _context4.abrupt("return", provider);
|
|
181
|
-
case 7:
|
|
182
|
-
case "end":
|
|
183
|
-
return _context4.stop();
|
|
184
|
-
}
|
|
185
|
-
}, _callee4, this);
|
|
186
|
-
}));
|
|
187
|
-
function getProvider(_x2) {
|
|
188
|
-
return _getProvider.apply(this, arguments);
|
|
189
|
-
}
|
|
190
|
-
return getProvider;
|
|
191
|
-
}()
|
|
192
|
-
}]);
|
|
193
|
-
return LangaugeFeatureProvider;
|
|
194
|
-
}();
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { EditorHandlerContribution } from '@difizen/libro-cofine-editor-core';
|
|
2
|
-
import { LibroService } from '@difizen/libro-core';
|
|
3
|
-
import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
|
|
4
|
-
import { DisposableCollection } from '@difizen/mana-app';
|
|
5
|
-
import type { editor } from '@difizen/monaco-editor-core';
|
|
6
|
-
import { languages } from '@difizen/monaco-editor-core';
|
|
7
|
-
export declare class LSPContribution implements EditorHandlerContribution {
|
|
8
|
-
protected readonly libroService: LibroService;
|
|
9
|
-
protected readonly lspDocumentConnectionManager: ILSPDocumentConnectionManager;
|
|
10
|
-
protected toDispose: DisposableCollection;
|
|
11
|
-
protected lspLangs: string[];
|
|
12
|
-
beforeCreate(): void;
|
|
13
|
-
afterCreate(editor: any): void;
|
|
14
|
-
canHandle(language: string): boolean;
|
|
15
|
-
getLanguageSelector(model: editor.ITextModel): languages.LanguageFilter;
|
|
16
|
-
registerLSPFeature(editor: editor.IStandaloneCodeEditor): void;
|
|
17
|
-
protected isDisposed: boolean;
|
|
18
|
-
get disposed(): boolean;
|
|
19
|
-
disposeLanguageFeature(): void;
|
|
20
|
-
dispose(): void;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=lsp-contribution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-contribution.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/lsp-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAc,oBAAoB,EAAqB,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAYxD,qBAGa,eAAgB,YAAW,yBAAyB;IACzC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAGpE,SAAS,CAAC,QAAQ,CAAC,4BAA4B,EAAE,6BAA6B,CAAC;IAE/E,SAAS,CAAC,SAAS,uBAA8B;IAEjD,SAAS,CAAC,QAAQ,WAAc;IAEhC,YAAY;IAGZ,WAAW,CAAC,MAAM,EAAE,GAAG;IAgBvB,SAAS,CAAC,QAAQ,EAAE,MAAM;IAI1B,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC,cAAc;IAOvE,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,qBAAqB;IAsDvD,SAAS,CAAC,UAAU,UAAS;IAE7B,IAAI,QAAQ,YAEX;IAED,sBAAsB;IAItB,OAAO;CAIR"}
|
|
@@ -1,135 +0,0 @@
|
|
|
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, _dec3, _class, _class2, _descriptor, _descriptor2;
|
|
3
|
-
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 }); }
|
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
-
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); } }
|
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
-
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; }
|
|
10
|
-
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.'); }
|
|
11
|
-
import { EditorHandlerContribution } from '@difizen/libro-cofine-editor-core';
|
|
12
|
-
import { LibroService } from '@difizen/libro-core';
|
|
13
|
-
import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
|
|
14
|
-
import { Disposable, DisposableCollection, inject, singleton } from '@difizen/mana-app';
|
|
15
|
-
import { languages } from '@difizen/monaco-editor-core';
|
|
16
|
-
// import { ILanguageFeaturesService } from '@difizen/monaco-editor-core/esm/vs/editor/common/services/languageFeatures.js';
|
|
17
|
-
// import { StandaloneServices } from '@difizen/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
18
|
-
// import { getSingletonServiceDescriptors } from '@difizen/monaco-editor-core/esm/vs/platform/instantiation/common/extensions.js';
|
|
19
|
-
|
|
20
|
-
import { LibroE2URIScheme } from "../../libro-e2-editor.js";
|
|
21
|
-
import { CompletionProvider } from "./completion-provider.js";
|
|
22
|
-
import { DiagnosticProvider } from "./diagnostic-provider.js";
|
|
23
|
-
import { HoverProvider } from "./hover-provider.js";
|
|
24
|
-
import { SignatureHelpProvider } from "./signature-help-provider.js";
|
|
25
|
-
export var LSPContribution = (_dec = singleton({
|
|
26
|
-
contrib: [EditorHandlerContribution]
|
|
27
|
-
}), _dec2 = inject(LibroService), _dec3 = inject(ILSPDocumentConnectionManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
28
|
-
function LSPContribution() {
|
|
29
|
-
_classCallCheck(this, LSPContribution);
|
|
30
|
-
_initializerDefineProperty(this, "libroService", _descriptor, this);
|
|
31
|
-
_initializerDefineProperty(this, "lspDocumentConnectionManager", _descriptor2, this);
|
|
32
|
-
this.toDispose = new DisposableCollection();
|
|
33
|
-
this.lspLangs = ['python'];
|
|
34
|
-
this.isDisposed = false;
|
|
35
|
-
}
|
|
36
|
-
_createClass(LSPContribution, [{
|
|
37
|
-
key: "beforeCreate",
|
|
38
|
-
value: function beforeCreate() {
|
|
39
|
-
//
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "afterCreate",
|
|
43
|
-
value: function afterCreate(editor) {
|
|
44
|
-
this.registerLSPFeature(editor);
|
|
45
|
-
// const languageFeaturesService = getOrigin(StandaloneServices).get(
|
|
46
|
-
// ILanguageFeaturesService,
|
|
47
|
-
// );
|
|
48
|
-
// for (const [id, descriptor] of getSingletonServiceDescriptors()) {
|
|
49
|
-
// if (id === ILanguageFeaturesService) {
|
|
50
|
-
// console.log('lll', descriptor);
|
|
51
|
-
// }
|
|
52
|
-
// }
|
|
53
|
-
// console.log(
|
|
54
|
-
// StandaloneServices,
|
|
55
|
-
// StandaloneServices.initialize(),
|
|
56
|
-
// getOrigin(languageFeaturesService),
|
|
57
|
-
// );
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
key: "canHandle",
|
|
61
|
-
value: function canHandle(language) {
|
|
62
|
-
return this.lspLangs.includes(language);
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
key: "getLanguageSelector",
|
|
66
|
-
value: function getLanguageSelector(model) {
|
|
67
|
-
return {
|
|
68
|
-
scheme: LibroE2URIScheme,
|
|
69
|
-
pattern: model.uri.path
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "registerLSPFeature",
|
|
74
|
-
value: function registerLSPFeature(editor) {
|
|
75
|
-
var model = editor.getModel();
|
|
76
|
-
if (!model) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
this.toDispose.push(languages.registerCompletionItemProvider(this.getLanguageSelector(model), new CompletionProvider(this.libroService, this.lspDocumentConnectionManager)));
|
|
80
|
-
this.toDispose.push(languages.registerHoverProvider(this.getLanguageSelector(model), new HoverProvider(this.libroService, this.lspDocumentConnectionManager)));
|
|
81
|
-
var provider = new DiagnosticProvider(this.libroService, this.lspDocumentConnectionManager);
|
|
82
|
-
this.toDispose.push(Disposable.create(function () {
|
|
83
|
-
return provider.dispose();
|
|
84
|
-
}));
|
|
85
|
-
this.toDispose.push(languages.registerSignatureHelpProvider(this.getLanguageSelector(model), new SignatureHelpProvider(this.libroService, this.lspDocumentConnectionManager)));
|
|
86
|
-
// const formatProvider = new FormatProvider(
|
|
87
|
-
// this.libroService,
|
|
88
|
-
// lspConnection,
|
|
89
|
-
// virtualDocument,
|
|
90
|
-
// );
|
|
91
|
-
// languages.registerDocumentFormattingEditProvider(
|
|
92
|
-
// this.getLanguageSelector(model),
|
|
93
|
-
// formatProvider,
|
|
94
|
-
// );
|
|
95
|
-
// languages.registerDocumentRangeFormattingEditProvider(
|
|
96
|
-
// this.getLanguageSelector(model),
|
|
97
|
-
// formatProvider,
|
|
98
|
-
// );
|
|
99
|
-
return;
|
|
100
|
-
|
|
101
|
-
// // SignatureHelp
|
|
102
|
-
// languages.registerSignatureHelpProvider(id, new SignatureHelpProvider(this._worker));
|
|
103
|
-
|
|
104
|
-
// // 定义跳转;
|
|
105
|
-
// languages.registerDefinitionProvider(id, new DefinitionAdapter(this._worker));
|
|
106
|
-
}
|
|
107
|
-
}, {
|
|
108
|
-
key: "disposed",
|
|
109
|
-
get: function get() {
|
|
110
|
-
return this.isDisposed;
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
key: "disposeLanguageFeature",
|
|
114
|
-
value: function disposeLanguageFeature() {
|
|
115
|
-
this.toDispose.dispose();
|
|
116
|
-
}
|
|
117
|
-
}, {
|
|
118
|
-
key: "dispose",
|
|
119
|
-
value: function dispose() {
|
|
120
|
-
this.disposeLanguageFeature();
|
|
121
|
-
this.isDisposed = false;
|
|
122
|
-
}
|
|
123
|
-
}]);
|
|
124
|
-
return LSPContribution;
|
|
125
|
-
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "libroService", [_dec2], {
|
|
126
|
-
configurable: true,
|
|
127
|
-
enumerable: true,
|
|
128
|
-
writable: true,
|
|
129
|
-
initializer: null
|
|
130
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "lspDocumentConnectionManager", [_dec3], {
|
|
131
|
-
configurable: true,
|
|
132
|
-
enumerable: true,
|
|
133
|
-
writable: true,
|
|
134
|
-
initializer: null
|
|
135
|
-
})), _class2)) || _class);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/module.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,uFAAqC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type monaco from '@difizen/monaco-editor-core';
|
|
2
|
-
import { LangaugeFeatureProvider } from './language-feature-provider.js';
|
|
3
|
-
export declare class SemanticHighlightProvider extends LangaugeFeatureProvider implements monaco.languages.DocumentSemanticTokensProvider {
|
|
4
|
-
onDidChange?: monaco.IEvent<void> | undefined;
|
|
5
|
-
getLegend(): monaco.languages.SemanticTokensLegend;
|
|
6
|
-
provideDocumentSemanticTokens(model: monaco.editor.ITextModel, lastResultId: string | null, token: monaco.CancellationToken): monaco.languages.ProviderResult<monaco.languages.SemanticTokens | monaco.languages.SemanticTokensEdits>;
|
|
7
|
-
releaseDocumentSemanticTokens(resultId: string | undefined): void;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=semantic-highlight-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-highlight-provider.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/semantic-highlight-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,qBAAa,yBACX,SAAQ,uBACR,YAAW,MAAM,CAAC,SAAS,CAAC,8BAA8B;IAE1D,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9C,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,oBAAoB;IAGlD,6BAA6B,CAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,KAAK,EAAE,MAAM,CAAC,iBAAiB,GAC9B,MAAM,CAAC,SAAS,CAAC,cAAc,CAChC,MAAM,CAAC,SAAS,CAAC,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,mBAAmB,CACvE;IAGD,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;CAGlE"}
|
|
@@ -1,41 +0,0 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
-
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
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
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); }
|
|
8
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
-
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); }; }
|
|
10
|
-
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); }
|
|
11
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
-
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; } }
|
|
13
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
15
|
-
|
|
16
|
-
import { LangaugeFeatureProvider } from "./language-feature-provider.js";
|
|
17
|
-
export var SemanticHighlightProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
18
|
-
_inherits(SemanticHighlightProvider, _LangaugeFeatureProvi);
|
|
19
|
-
var _super = _createSuper(SemanticHighlightProvider);
|
|
20
|
-
function SemanticHighlightProvider() {
|
|
21
|
-
_classCallCheck(this, SemanticHighlightProvider);
|
|
22
|
-
return _super.apply(this, arguments);
|
|
23
|
-
}
|
|
24
|
-
_createClass(SemanticHighlightProvider, [{
|
|
25
|
-
key: "getLegend",
|
|
26
|
-
value: function getLegend() {
|
|
27
|
-
throw new Error('Method not implemented.');
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
key: "provideDocumentSemanticTokens",
|
|
31
|
-
value: function provideDocumentSemanticTokens(model, lastResultId, token) {
|
|
32
|
-
throw new Error('Method not implemented.');
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
key: "releaseDocumentSemanticTokens",
|
|
36
|
-
value: function releaseDocumentSemanticTokens(resultId) {
|
|
37
|
-
throw new Error('Method not implemented.');
|
|
38
|
-
}
|
|
39
|
-
}]);
|
|
40
|
-
return SemanticHighlightProvider;
|
|
41
|
-
}(LangaugeFeatureProvider);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type monaco from '@difizen/monaco-editor-core';
|
|
2
|
-
import { LangaugeFeatureProvider } from './language-feature-provider.js';
|
|
3
|
-
export declare class SignatureHelpProvider extends LangaugeFeatureProvider implements monaco.languages.SignatureHelpProvider {
|
|
4
|
-
signatureHelpTriggerCharacters: ['(', ',', ')'];
|
|
5
|
-
signatureHelpRetriggerCharacters?: readonly string[] | undefined;
|
|
6
|
-
provideSignatureHelp: (model: monaco.editor.ITextModel, position: monaco.Position, token: monaco.CancellationToken, context: monaco.languages.SignatureHelpContext) => Promise<monaco.languages.SignatureHelpResult | undefined>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=signature-help-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signature-help-provider.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/signature-help-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,qBAAa,qBACX,SAAQ,uBACR,YAAW,MAAM,CAAC,SAAS,CAAC,qBAAqB;IAEjD,8BAA8B,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAChD,gCAAgC,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACjE,oBAAoB,UACX,OAAO,MAAM,CAAC,UAAU,YACrB,OAAO,QAAQ,SAClB,OAAO,iBAAiB,WACtB,OAAO,SAAS,CAAC,oBAAoB,KAC7C,QAAQ,OAAO,SAAS,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAgD1D;CACH"}
|
|
@@ -1,108 +0,0 @@
|
|
|
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 _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
|
-
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
|
-
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); }); }; }
|
|
5
|
-
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); } }
|
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
-
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); }
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
-
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); }; }
|
|
13
|
-
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); }
|
|
14
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
-
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; } }
|
|
16
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
17
|
-
import { LangaugeFeatureProvider } from "./language-feature-provider.js";
|
|
18
|
-
export var SignatureHelpProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
19
|
-
_inherits(SignatureHelpProvider, _LangaugeFeatureProvi);
|
|
20
|
-
var _super = _createSuper(SignatureHelpProvider);
|
|
21
|
-
function SignatureHelpProvider() {
|
|
22
|
-
var _this;
|
|
23
|
-
_classCallCheck(this, SignatureHelpProvider);
|
|
24
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
-
args[_key] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
28
|
-
_this.provideSignatureHelp = /*#__PURE__*/function () {
|
|
29
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(model, position, token, context) {
|
|
30
|
-
var _sigInfo$activeSignat, _sigInfo$activeParame;
|
|
31
|
-
var editor, provider, lspConnection, docEditor, doc, virtualPos, sigInfo;
|
|
32
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
33
|
-
while (1) switch (_context.prev = _context.next) {
|
|
34
|
-
case 0:
|
|
35
|
-
editor = _this.getEditorByModel(model);
|
|
36
|
-
if (!(!editor || editor.getOption('lspEnabled') !== true)) {
|
|
37
|
-
_context.next = 3;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
return _context.abrupt("return");
|
|
41
|
-
case 3:
|
|
42
|
-
_context.next = 5;
|
|
43
|
-
return _this.getProvider(model);
|
|
44
|
-
case 5:
|
|
45
|
-
provider = _context.sent;
|
|
46
|
-
if (provider) {
|
|
47
|
-
_context.next = 8;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
return _context.abrupt("return");
|
|
51
|
-
case 8:
|
|
52
|
-
lspConnection = provider.lspConnection, docEditor = provider.editor, doc = provider.virtualDocument;
|
|
53
|
-
virtualPos = doc.transformEditorToVirtual(docEditor, {
|
|
54
|
-
line: position.lineNumber - 1,
|
|
55
|
-
// lsp is zero based, monaco is one based
|
|
56
|
-
ch: position.column - 1,
|
|
57
|
-
isEditor: true
|
|
58
|
-
});
|
|
59
|
-
if (virtualPos) {
|
|
60
|
-
_context.next = 12;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
return _context.abrupt("return");
|
|
64
|
-
case 12:
|
|
65
|
-
_context.next = 14;
|
|
66
|
-
return lspConnection.clientRequests['textDocument/signatureHelp'].request({
|
|
67
|
-
position: {
|
|
68
|
-
line: virtualPos.line,
|
|
69
|
-
character: virtualPos.ch
|
|
70
|
-
},
|
|
71
|
-
textDocument: {
|
|
72
|
-
uri: doc.documentInfo.uri
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
case 14:
|
|
76
|
-
sigInfo = _context.sent;
|
|
77
|
-
return _context.abrupt("return", {
|
|
78
|
-
value: {
|
|
79
|
-
signatures: sigInfo.signatures.map(function (sig) {
|
|
80
|
-
var _sig$parameters;
|
|
81
|
-
return {
|
|
82
|
-
label: sig.label,
|
|
83
|
-
documentation: sig.documentation,
|
|
84
|
-
parameters: (_sig$parameters = sig.parameters) !== null && _sig$parameters !== void 0 ? _sig$parameters : [],
|
|
85
|
-
activeParameter: sig.activeParameter
|
|
86
|
-
};
|
|
87
|
-
}),
|
|
88
|
-
activeSignature: (_sigInfo$activeSignat = sigInfo.activeSignature) !== null && _sigInfo$activeSignat !== void 0 ? _sigInfo$activeSignat : 0,
|
|
89
|
-
activeParameter: (_sigInfo$activeParame = sigInfo.activeParameter) !== null && _sigInfo$activeParame !== void 0 ? _sigInfo$activeParame : 0
|
|
90
|
-
},
|
|
91
|
-
dispose: function dispose() {
|
|
92
|
-
//
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
case 16:
|
|
96
|
-
case "end":
|
|
97
|
-
return _context.stop();
|
|
98
|
-
}
|
|
99
|
-
}, _callee);
|
|
100
|
-
}));
|
|
101
|
-
return function (_x, _x2, _x3, _x4) {
|
|
102
|
-
return _ref.apply(this, arguments);
|
|
103
|
-
};
|
|
104
|
-
}();
|
|
105
|
-
return _this;
|
|
106
|
-
}
|
|
107
|
-
return _createClass(SignatureHelpProvider);
|
|
108
|
-
}(LangaugeFeatureProvider);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { languages } from '@difizen/monaco-editor-core';
|
|
2
|
-
import * as lsp from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare class CompletionItemKind {
|
|
4
|
-
static from(kind: lsp.CompletionItemKind): languages.CompletionItemKind;
|
|
5
|
-
static to(kind: languages.CompletionItemKind): lsp.CompletionItemKind;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=type-concerters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-concerters.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/type-concerters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,gCAAgC,CAAC;AA8DtD,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,kBAAkB,GAAG,SAAS,CAAC,kBAAkB;IAIvE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,kBAAkB,GAAG,GAAG,CAAC,kBAAkB;CAGtE"}
|