@difizen/libro-cofine-editor 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/es/editor-contribution.d.ts +10 -0
  4. package/es/editor-contribution.d.ts.map +1 -0
  5. package/es/editor-contribution.js +31 -0
  6. package/es/index.d.ts +7 -0
  7. package/es/index.d.ts.map +1 -0
  8. package/es/index.js +6 -0
  9. package/es/index.less +32 -0
  10. package/es/language/lsp/completion-provider.d.ts +13 -0
  11. package/es/language/lsp/completion-provider.d.ts.map +1 -0
  12. package/es/language/lsp/completion-provider.js +290 -0
  13. package/es/language/lsp/diagnostic-provider.d.ts +22 -0
  14. package/es/language/lsp/diagnostic-provider.d.ts.map +1 -0
  15. package/es/language/lsp/diagnostic-provider.js +161 -0
  16. package/es/language/lsp/format-provider.d.ts +9 -0
  17. package/es/language/lsp/format-provider.d.ts.map +1 -0
  18. package/es/language/lsp/format-provider.js +139 -0
  19. package/es/language/lsp/hover-provider.d.ts +8 -0
  20. package/es/language/lsp/hover-provider.d.ts.map +1 -0
  21. package/es/language/lsp/hover-provider.js +136 -0
  22. package/es/language/lsp/language-feature-provider.d.ts +17 -0
  23. package/es/language/lsp/language-feature-provider.d.ts.map +1 -0
  24. package/es/language/lsp/language-feature-provider.js +89 -0
  25. package/es/language/lsp/lsp-contribution.d.ts +25 -0
  26. package/es/language/lsp/lsp-contribution.d.ts.map +1 -0
  27. package/es/language/lsp/lsp-contribution.js +213 -0
  28. package/es/language/lsp/module.d.ts +2 -0
  29. package/es/language/lsp/module.d.ts.map +1 -0
  30. package/es/language/lsp/module.js +3 -0
  31. package/es/language/lsp/semantic-highlight-provider.d.ts +9 -0
  32. package/es/language/lsp/semantic-highlight-provider.d.ts.map +1 -0
  33. package/es/language/lsp/semantic-highlight-provider.js +41 -0
  34. package/es/language/lsp/signature-help-provider.d.ts +8 -0
  35. package/es/language/lsp/signature-help-provider.d.ts.map +1 -0
  36. package/es/language/lsp/signature-help-provider.js +108 -0
  37. package/es/language/lsp/type-concerters.d.ts +7 -0
  38. package/es/language/lsp/type-concerters.d.ts.map +1 -0
  39. package/es/language/lsp/type-concerters.js +37 -0
  40. package/es/language/python/data/MagicPython.tmLanguage.json +4213 -0
  41. package/es/language/python/data/MagicRegExp.tmLanguage.json +497 -0
  42. package/es/language/python/data/configurations/python.json +135 -0
  43. package/es/language/python/data/snippets/python.snippets.json +223 -0
  44. package/es/language/python/module.d.ts +2 -0
  45. package/es/language/python/module.d.ts.map +1 -0
  46. package/es/language/python/module.js +3 -0
  47. package/es/language/python/python-builtin.d.ts +86 -0
  48. package/es/language/python/python-builtin.d.ts.map +1 -0
  49. package/es/language/python/python-builtin.js +569 -0
  50. package/es/language/python/python-language-feature.d.ts +26 -0
  51. package/es/language/python/python-language-feature.d.ts.map +1 -0
  52. package/es/language/python/python-language-feature.js +174 -0
  53. package/es/language-specs.d.ts +33 -0
  54. package/es/language-specs.d.ts.map +1 -0
  55. package/es/language-specs.js +115 -0
  56. package/es/libro-e2-editor.d.ts +277 -0
  57. package/es/libro-e2-editor.d.ts.map +1 -0
  58. package/es/libro-e2-editor.js +720 -0
  59. package/es/libro-e2-preload.d.ts +5 -0
  60. package/es/libro-e2-preload.d.ts.map +1 -0
  61. package/es/libro-e2-preload.js +57 -0
  62. package/es/libro-sql-api.d.ts +8 -0
  63. package/es/libro-sql-api.d.ts.map +1 -0
  64. package/es/libro-sql-api.js +26 -0
  65. package/es/module.d.ts +3 -0
  66. package/es/module.d.ts.map +1 -0
  67. package/es/module.js +44 -0
  68. package/es/placeholder.d.ts +31 -0
  69. package/es/placeholder.d.ts.map +1 -0
  70. package/es/placeholder.js +101 -0
  71. package/es/theme/data/jupyter_dark.json +406 -0
  72. package/es/theme/data/jupyter_hc_dark.json +385 -0
  73. package/es/theme/data/jupyter_hc_light.json +386 -0
  74. package/es/theme/data/jupyter_light.json +386 -0
  75. package/es/theme/data/libro_dark.json +186 -0
  76. package/es/theme/data/libro_light.json +170 -0
  77. package/es/theme/libro-python-theme-contribution.d.ts +6 -0
  78. package/es/theme/libro-python-theme-contribution.d.ts.map +1 -0
  79. package/es/theme/libro-python-theme-contribution.js +49 -0
  80. package/es/theme/module.d.ts +2 -0
  81. package/es/theme/module.d.ts.map +1 -0
  82. package/es/theme/module.js +3 -0
  83. package/es/types.d.ts +10 -0
  84. package/es/types.d.ts.map +1 -0
  85. package/es/types.js +3 -0
  86. package/package.json +67 -0
  87. package/src/editor-contribution.ts +30 -0
  88. package/src/index.less +32 -0
  89. package/src/index.spec.ts +8 -0
  90. package/src/index.ts +6 -0
  91. package/src/language/lsp/completion-provider.ts +214 -0
  92. package/src/language/lsp/diagnostic-provider.ts +148 -0
  93. package/src/language/lsp/format-provider.ts +87 -0
  94. package/src/language/lsp/hover-provider.ts +98 -0
  95. package/src/language/lsp/language-feature-provider.ts +69 -0
  96. package/src/language/lsp/lsp-contribution.ts +159 -0
  97. package/src/language/lsp/module.ts +5 -0
  98. package/src/language/lsp/semantic-highlight-provider.ts +26 -0
  99. package/src/language/lsp/signature-help-provider.ts +65 -0
  100. package/src/language/lsp/type-concerters.ts +72 -0
  101. package/src/language/python/data/MagicPython.tmLanguage.json +4213 -0
  102. package/src/language/python/data/MagicRegExp.tmLanguage.json +497 -0
  103. package/src/language/python/data/configurations/python.json +135 -0
  104. package/src/language/python/data/snippets/python.snippets.json +223 -0
  105. package/src/language/python/module.ts +5 -0
  106. package/src/language/python/python-builtin.ts +891 -0
  107. package/src/language/python/python-language-feature.ts +163 -0
  108. package/src/language-specs.ts +99 -0
  109. package/src/libro-e2-editor.ts +922 -0
  110. package/src/libro-e2-preload.ts +23 -0
  111. package/src/libro-sql-api.ts +20 -0
  112. package/src/module.ts +44 -0
  113. package/src/placeholder.ts +100 -0
  114. package/src/theme/data/jupyter_dark.json +406 -0
  115. package/src/theme/data/jupyter_hc_dark.json +385 -0
  116. package/src/theme/data/jupyter_hc_light.json +386 -0
  117. package/src/theme/data/jupyter_light.json +386 -0
  118. package/src/theme/data/libro_dark.json +186 -0
  119. package/src/theme/data/libro_light.json +170 -0
  120. package/src/theme/libro-python-theme-contribution.ts +36 -0
  121. package/src/theme/module.ts +5 -0
  122. package/src/types.ts +11 -0
@@ -0,0 +1,89 @@
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ 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); }
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, lspConnection, virtualDocument) {
14
+ _classCallCheck(this, LangaugeFeatureProvider);
15
+ this.libroService = libroService;
16
+ this.lspConnection = lspConnection;
17
+ this.virtualDocument = virtualDocument;
18
+ }
19
+ _createClass(LangaugeFeatureProvider, [{
20
+ key: "getEditorByModel",
21
+ value: function getEditorByModel(model) {
22
+ var _this$libroService$ac;
23
+ var cells = (_this$libroService$ac = this.libroService.active) === null || _this$libroService$ac === void 0 ? void 0 : _this$libroService$ac.model.cells;
24
+ if (!cells) {
25
+ return;
26
+ }
27
+ var cell = cells.find(function (item) {
28
+ var editorUuid = model.uri.path.split('.')[0];
29
+ if (!EditorCellView.is(item)) {
30
+ return false;
31
+ }
32
+ var e2editor = item.editor;
33
+ if (!(e2editor instanceof LibroE2Editor)) {
34
+ return false;
35
+ }
36
+ return editorUuid === e2editor.uuid;
37
+ });
38
+ return cell.editor;
39
+ }
40
+ }, {
41
+ key: "getEditorFromLSPPosition",
42
+ value: function getEditorFromLSPPosition(range) {
43
+ var currentEditor = this.virtualDocument.getEditorAtVirtualLine({
44
+ line: range.start.line,
45
+ ch: range.start.character,
46
+ isVirtual: true
47
+ });
48
+ var editor = currentEditor.getEditor();
49
+ if (editor instanceof LibroE2Editor) {
50
+ return editor;
51
+ }
52
+ return;
53
+ }
54
+ }, {
55
+ key: "getProvider",
56
+ value: function () {
57
+ var _getProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(model) {
58
+ var _editor$lspProvider;
59
+ var editor, provider;
60
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
61
+ while (1) switch (_context.prev = _context.next) {
62
+ case 0:
63
+ editor = this.getEditorByModel(model);
64
+ if (editor) {
65
+ _context.next = 3;
66
+ break;
67
+ }
68
+ return _context.abrupt("return");
69
+ case 3:
70
+ _context.next = 5;
71
+ return (_editor$lspProvider = editor.lspProvider) === null || _editor$lspProvider === void 0 ? void 0 : _editor$lspProvider.call(editor);
72
+ case 5:
73
+ provider = _context.sent;
74
+ this.lspProvider = provider;
75
+ return _context.abrupt("return", provider);
76
+ case 8:
77
+ case "end":
78
+ return _context.stop();
79
+ }
80
+ }, _callee, this);
81
+ }));
82
+ function getProvider(_x) {
83
+ return _getProvider.apply(this, arguments);
84
+ }
85
+ return getProvider;
86
+ }()
87
+ }]);
88
+ return LangaugeFeatureProvider;
89
+ }();
@@ -0,0 +1,25 @@
1
+ import { EditorHandlerContribution, LanguageOptionsRegistry } from '@difizen/libro-cofine-editor-core';
2
+ import { LibroService } from '@difizen/libro-core';
3
+ import type { LSPConnection } from '@difizen/libro-lsp';
4
+ import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
5
+ import { DisposableCollection } from '@difizen/mana-app';
6
+ import * as monaco from '@difizen/monaco-editor-core';
7
+ export declare class LSPContribution implements EditorHandlerContribution {
8
+ protected readonly optionsResgistry: LanguageOptionsRegistry;
9
+ protected readonly libroService: LibroService;
10
+ protected readonly lspDocumentConnectionManager: ILSPDocumentConnectionManager;
11
+ protected toDispose: DisposableCollection;
12
+ protected lspLangs: string[];
13
+ beforeCreate(): void;
14
+ afterCreate(editor: any): void;
15
+ canHandle(language: string): boolean;
16
+ getLanguageSelector(model: monaco.editor.ITextModel): monaco.languages.LanguageFilter;
17
+ getVirtualDocument(): Promise<import("@difizen/libro-lsp").VirtualDocument | null | undefined>;
18
+ getLSPConnection(): Promise<LSPConnection>;
19
+ registerLSPFeature(editor: monaco.editor.IStandaloneCodeEditor): void;
20
+ protected isDisposed: boolean;
21
+ get disposed(): boolean;
22
+ beforeDestory(): void;
23
+ dispose(): void;
24
+ }
25
+ //# sourceMappingURL=lsp-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lsp-contribution.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/lsp-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAqB,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAStD,qBAGa,eAAgB,YAAW,yBAAyB;IAE/D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;IAEvC,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;IAGvB,SAAS,CAAC,QAAQ,EAAE,MAAM;IAI1B,mBAAmB,CACjB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,GAC9B,MAAM,CAAC,SAAS,CAAC,cAAc;IAO5B,kBAAkB;IAkBlB,gBAAgB;IActB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB;IA6D9D,SAAS,CAAC,UAAU,UAAS;IAC7B,IAAI,QAAQ,YAEX;IAED,aAAa;IAIb,OAAO;CAIR"}
@@ -0,0 +1,213 @@
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, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3;
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ 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); }
6
+ 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; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ 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; }
10
+ 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); } }
11
+ 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); }); }; }
12
+ 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 }); }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ 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); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ 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); }
18
+ 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; }
19
+ 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.'); }
20
+ import { EditorHandlerContribution, LanguageOptionsRegistry } from '@difizen/libro-cofine-editor-core';
21
+ import { LibroService } from '@difizen/libro-core';
22
+ import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
23
+ import { DisposableCollection, inject, singleton } from '@difizen/mana-app';
24
+ import * as monaco from '@difizen/monaco-editor-core';
25
+ import { LibroE2URIScheme } from "../../libro-e2-editor.js";
26
+ import { CompletionProvider } from "./completion-provider.js";
27
+ import { DiagnosticProvider } from "./diagnostic-provider.js";
28
+ import { HoverProvider } from "./hover-provider.js";
29
+ import { SignatureHelpProvider } from "./signature-help-provider.js";
30
+ export var LSPContribution = (_dec = singleton({
31
+ contrib: [EditorHandlerContribution]
32
+ }), _dec2 = inject(LanguageOptionsRegistry), _dec3 = inject(LibroService), _dec4 = inject(ILSPDocumentConnectionManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
33
+ function LSPContribution() {
34
+ _classCallCheck(this, LSPContribution);
35
+ _initializerDefineProperty(this, "optionsResgistry", _descriptor, this);
36
+ _initializerDefineProperty(this, "libroService", _descriptor2, this);
37
+ _initializerDefineProperty(this, "lspDocumentConnectionManager", _descriptor3, this);
38
+ this.toDispose = new DisposableCollection();
39
+ this.lspLangs = ['python'];
40
+ this.isDisposed = false;
41
+ }
42
+ _createClass(LSPContribution, [{
43
+ key: "beforeCreate",
44
+ value: function beforeCreate() {
45
+ //
46
+ }
47
+ }, {
48
+ key: "afterCreate",
49
+ value: function afterCreate(editor) {
50
+ this.registerLSPFeature(editor);
51
+ }
52
+ }, {
53
+ key: "canHandle",
54
+ value: function canHandle(language) {
55
+ return this.lspLangs.includes(language);
56
+ }
57
+ }, {
58
+ key: "getLanguageSelector",
59
+ value: function getLanguageSelector(model) {
60
+ return {
61
+ scheme: LibroE2URIScheme,
62
+ pattern: model.uri.path
63
+ };
64
+ }
65
+ }, {
66
+ key: "getVirtualDocument",
67
+ value: function () {
68
+ var _getVirtualDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
69
+ var libroView, adapter, virtualDocument;
70
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
71
+ while (1) switch (_context.prev = _context.next) {
72
+ case 0:
73
+ libroView = this.libroService.active;
74
+ if (libroView) {
75
+ _context.next = 3;
76
+ break;
77
+ }
78
+ return _context.abrupt("return");
79
+ case 3:
80
+ _context.next = 5;
81
+ return this.lspDocumentConnectionManager.ready;
82
+ case 5:
83
+ adapter = this.lspDocumentConnectionManager.adapters.get(libroView.model.id);
84
+ if (adapter) {
85
+ _context.next = 8;
86
+ break;
87
+ }
88
+ throw new Error('no adapter');
89
+ case 8:
90
+ _context.next = 10;
91
+ return adapter.ready;
92
+ case 10:
93
+ // Get the associated virtual document of the opened document
94
+ virtualDocument = adapter.virtualDocument;
95
+ return _context.abrupt("return", virtualDocument);
96
+ case 12:
97
+ case "end":
98
+ return _context.stop();
99
+ }
100
+ }, _callee, this);
101
+ }));
102
+ function getVirtualDocument() {
103
+ return _getVirtualDocument.apply(this, arguments);
104
+ }
105
+ return getVirtualDocument;
106
+ }()
107
+ }, {
108
+ key: "getLSPConnection",
109
+ value: function () {
110
+ var _getLSPConnection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
111
+ var virtualDocument, lspConnection;
112
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
113
+ while (1) switch (_context2.prev = _context2.next) {
114
+ case 0:
115
+ _context2.next = 2;
116
+ return this.getVirtualDocument();
117
+ case 2:
118
+ virtualDocument = _context2.sent;
119
+ if (virtualDocument) {
120
+ _context2.next = 5;
121
+ break;
122
+ }
123
+ throw new Error('no virtualDocument');
124
+ case 5:
125
+ // Get the LSP connection of the virtual document.
126
+ lspConnection = this.lspDocumentConnectionManager.connections.get(virtualDocument.uri);
127
+ return _context2.abrupt("return", lspConnection);
128
+ case 7:
129
+ case "end":
130
+ return _context2.stop();
131
+ }
132
+ }, _callee2, this);
133
+ }));
134
+ function getLSPConnection() {
135
+ return _getLSPConnection.apply(this, arguments);
136
+ }
137
+ return getLSPConnection;
138
+ }()
139
+ }, {
140
+ key: "registerLSPFeature",
141
+ value: function registerLSPFeature(editor) {
142
+ var _this = this;
143
+ var model = editor.getModel();
144
+ if (!model) {
145
+ return;
146
+ }
147
+ Promise.all([this.getVirtualDocument(), this.getLSPConnection()]).then(function (_ref) {
148
+ var _ref2 = _slicedToArray(_ref, 2),
149
+ virtualDocument = _ref2[0],
150
+ lspConnection = _ref2[1];
151
+ if (!lspConnection || !virtualDocument) {
152
+ return;
153
+ }
154
+ _this.toDispose.push(monaco.languages.registerCompletionItemProvider(_this.getLanguageSelector(model), new CompletionProvider(_this.libroService, lspConnection, virtualDocument)));
155
+ _this.toDispose.push(monaco.languages.registerHoverProvider(_this.getLanguageSelector(model), new HoverProvider(_this.libroService, lspConnection, virtualDocument)));
156
+ new DiagnosticProvider(_this.libroService, lspConnection, virtualDocument);
157
+ _this.toDispose.push(monaco.languages.registerSignatureHelpProvider(_this.getLanguageSelector(model), new SignatureHelpProvider(_this.libroService, lspConnection, virtualDocument)));
158
+ // const formatProvider = new FormatProvider(
159
+ // this.libroService,
160
+ // lspConnection,
161
+ // virtualDocument,
162
+ // );
163
+ // monaco.languages.registerDocumentFormattingEditProvider(
164
+ // this.getLanguageSelector(model),
165
+ // formatProvider,
166
+ // );
167
+ // monaco.languages.registerDocumentRangeFormattingEditProvider(
168
+ // this.getLanguageSelector(model),
169
+ // formatProvider,
170
+ // );
171
+ return;
172
+ }).catch(console.error);
173
+
174
+ // // SignatureHelp
175
+ // monaco.languages.registerSignatureHelpProvider(id, new SignatureHelpProvider(this._worker));
176
+
177
+ // // 定义跳转;
178
+ // monaco.languages.registerDefinitionProvider(id, new DefinitionAdapter(this._worker));
179
+ }
180
+ }, {
181
+ key: "disposed",
182
+ get: function get() {
183
+ return this.isDisposed;
184
+ }
185
+ }, {
186
+ key: "beforeDestory",
187
+ value: function beforeDestory() {
188
+ this.toDispose.dispose();
189
+ }
190
+ }, {
191
+ key: "dispose",
192
+ value: function dispose() {
193
+ this.toDispose.dispose();
194
+ this.isDisposed = false;
195
+ }
196
+ }]);
197
+ return LSPContribution;
198
+ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "optionsResgistry", [_dec2], {
199
+ configurable: true,
200
+ enumerable: true,
201
+ writable: true,
202
+ initializer: null
203
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "libroService", [_dec3], {
204
+ configurable: true,
205
+ enumerable: true,
206
+ writable: true,
207
+ initializer: null
208
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "lspDocumentConnectionManager", [_dec4], {
209
+ configurable: true,
210
+ enumerable: true,
211
+ writable: true,
212
+ initializer: null
213
+ })), _class2)) || _class);
@@ -0,0 +1,2 @@
1
+ export declare const LSPFeatureModule: import("@difizen/mana-app").SyringeModule<import("@difizen/mana-app").Syringe.Module>;
2
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/module.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,uFAAqC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Module } from '@difizen/mana-app';
2
+ import { LSPContribution } from "./lsp-contribution.js";
3
+ export var LSPFeatureModule = Module().register(LSPContribution);
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,41 @@
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ 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); }
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);
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,108 @@
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ 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); }
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);
@@ -0,0 +1,7 @@
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
@@ -0,0 +1 @@
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"}