@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,230 +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
|
-
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 { EditorCellView } from '@difizen/libro-core';
|
|
18
|
-
import { DisposableCollection } from '@difizen/mana-app';
|
|
19
|
-
import * as monaco from '@difizen/monaco-editor-core';
|
|
20
|
-
import { LibroE2Editor } from "../../libro-e2-editor.js";
|
|
21
|
-
import { MonacoRange, MonacoUri } from "../../types.js";
|
|
22
|
-
import { LangaugeFeatureProvider } from "./language-feature-provider.js";
|
|
23
|
-
export var MarkerSeverity = /*#__PURE__*/function (MarkerSeverity) {
|
|
24
|
-
MarkerSeverity[MarkerSeverity["Hint"] = 1] = "Hint";
|
|
25
|
-
MarkerSeverity[MarkerSeverity["Info"] = 2] = "Info";
|
|
26
|
-
MarkerSeverity[MarkerSeverity["Warning"] = 4] = "Warning";
|
|
27
|
-
MarkerSeverity[MarkerSeverity["Error"] = 8] = "Error";
|
|
28
|
-
return MarkerSeverity;
|
|
29
|
-
}({});
|
|
30
|
-
var vererityMap = {
|
|
31
|
-
1: MarkerSeverity.Error,
|
|
32
|
-
2: MarkerSeverity.Warning,
|
|
33
|
-
3: MarkerSeverity.Info,
|
|
34
|
-
4: MarkerSeverity.Hint
|
|
35
|
-
};
|
|
36
|
-
export var DiagnosticProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
37
|
-
_inherits(DiagnosticProvider, _LangaugeFeatureProvi);
|
|
38
|
-
var _super = _createSuper(DiagnosticProvider);
|
|
39
|
-
function DiagnosticProvider(libroService, lspDocumentConnectionManager) {
|
|
40
|
-
var _this;
|
|
41
|
-
_classCallCheck(this, DiagnosticProvider);
|
|
42
|
-
_this = _super.call(this, libroService, lspDocumentConnectionManager);
|
|
43
|
-
_this.toDispose = new DisposableCollection();
|
|
44
|
-
_this.diagnosticList = [];
|
|
45
|
-
_this.disposed = false;
|
|
46
|
-
_this.processDiagnostic();
|
|
47
|
-
return _this;
|
|
48
|
-
}
|
|
49
|
-
_createClass(DiagnosticProvider, [{
|
|
50
|
-
key: "addDiagnostic",
|
|
51
|
-
value: function addDiagnostic(model, marker) {
|
|
52
|
-
if (!this.diagnosticList.some(function (d) {
|
|
53
|
-
return d.model.uri.toString() === model.uri.toString();
|
|
54
|
-
})) {
|
|
55
|
-
this.diagnosticList.push({
|
|
56
|
-
model: model,
|
|
57
|
-
markers: [marker]
|
|
58
|
-
});
|
|
59
|
-
} else {
|
|
60
|
-
var _this$diagnosticList$;
|
|
61
|
-
(_this$diagnosticList$ = this.diagnosticList.find(function (d) {
|
|
62
|
-
return d.model.uri.toString() === model.uri.toString();
|
|
63
|
-
})) === null || _this$diagnosticList$ === void 0 || _this$diagnosticList$.markers.push(marker);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "clearDiagnostic",
|
|
68
|
-
value: function clearDiagnostic() {
|
|
69
|
-
var _this$libroService$ac;
|
|
70
|
-
(_this$libroService$ac = this.libroService.active) === null || _this$libroService$ac === void 0 || _this$libroService$ac.model.cells.forEach(function (item) {
|
|
71
|
-
if (EditorCellView.is(item)) {
|
|
72
|
-
if (item.editor instanceof LibroE2Editor) {
|
|
73
|
-
var _item$editor$monacoEd;
|
|
74
|
-
var model = (_item$editor$monacoEd = item.editor.monacoEditor) === null || _item$editor$monacoEd === void 0 ? void 0 : _item$editor$monacoEd.getModel();
|
|
75
|
-
if (model) {
|
|
76
|
-
monaco.editor.setModelMarkers(model, 'libro-e2', []);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: "displayDiagnostic",
|
|
84
|
-
value: function displayDiagnostic() {
|
|
85
|
-
this.clearDiagnostic();
|
|
86
|
-
this.diagnosticList.forEach(function (d) {
|
|
87
|
-
monaco.editor.setModelMarkers(d.model, 'libro-e2', d.markers);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "processDiagnostic",
|
|
92
|
-
value: function () {
|
|
93
|
-
var _processDiagnostic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
94
|
-
var _this2 = this;
|
|
95
|
-
var lspConnection, toDispose;
|
|
96
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
97
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
98
|
-
case 0:
|
|
99
|
-
_context3.next = 2;
|
|
100
|
-
return this.getLSPConnection();
|
|
101
|
-
case 2:
|
|
102
|
-
lspConnection = _context3.sent;
|
|
103
|
-
toDispose = lspConnection.serverNotifications['textDocument/publishDiagnostics'].event( /*#__PURE__*/function () {
|
|
104
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
|
|
105
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
106
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
-
case 0:
|
|
108
|
-
_this2.diagnosticList = [];
|
|
109
|
-
_context2.next = 3;
|
|
110
|
-
return Promise.all(e.diagnostics.map( /*#__PURE__*/function () {
|
|
111
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(diagnostic) {
|
|
112
|
-
var _editor$monacoEditor, _diagnostic$relatedIn;
|
|
113
|
-
var range, editor, model, virtualDocument, editorStart, editorEnd, markerRange, marker;
|
|
114
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
115
|
-
while (1) switch (_context.prev = _context.next) {
|
|
116
|
-
case 0:
|
|
117
|
-
range = diagnostic.range; // the diagnostic range must be in current editor
|
|
118
|
-
_context.next = 3;
|
|
119
|
-
return _this2.getEditorFromLSPPosition(range);
|
|
120
|
-
case 3:
|
|
121
|
-
editor = _context.sent;
|
|
122
|
-
if (!(!editor || editor.getOption('lspEnabled') !== true)) {
|
|
123
|
-
_context.next = 6;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
return _context.abrupt("return");
|
|
127
|
-
case 6:
|
|
128
|
-
model = editor === null || editor === void 0 || (_editor$monacoEditor = editor.monacoEditor) === null || _editor$monacoEditor === void 0 ? void 0 : _editor$monacoEditor.getModel();
|
|
129
|
-
if (model) {
|
|
130
|
-
_context.next = 9;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
return _context.abrupt("return");
|
|
134
|
-
case 9:
|
|
135
|
-
_context.next = 11;
|
|
136
|
-
return _this2.getVirtualDocument();
|
|
137
|
-
case 11:
|
|
138
|
-
virtualDocument = _context.sent;
|
|
139
|
-
if (virtualDocument) {
|
|
140
|
-
_context.next = 14;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
return _context.abrupt("return");
|
|
144
|
-
case 14:
|
|
145
|
-
editorStart = virtualDocument.transformVirtualToEditor({
|
|
146
|
-
line: range.start.line,
|
|
147
|
-
ch: range.start.character,
|
|
148
|
-
isVirtual: true
|
|
149
|
-
});
|
|
150
|
-
editorEnd = virtualDocument.transformVirtualToEditor({
|
|
151
|
-
line: range.end.line,
|
|
152
|
-
ch: range.end.character,
|
|
153
|
-
isVirtual: true
|
|
154
|
-
});
|
|
155
|
-
if (!(!editorStart || !editorEnd)) {
|
|
156
|
-
_context.next = 18;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
return _context.abrupt("return");
|
|
160
|
-
case 18:
|
|
161
|
-
markerRange = new MonacoRange(editorStart.line + 1, editorStart.ch, editorEnd.line + 1, editorEnd.ch);
|
|
162
|
-
marker = {
|
|
163
|
-
source: diagnostic.source,
|
|
164
|
-
tags: diagnostic.tags,
|
|
165
|
-
message: diagnostic.message,
|
|
166
|
-
code: String(diagnostic.code),
|
|
167
|
-
severity: diagnostic.severity ? vererityMap[diagnostic.severity] : monaco.MarkerSeverity.Info,
|
|
168
|
-
relatedInformation: (_diagnostic$relatedIn = diagnostic.relatedInformation) === null || _diagnostic$relatedIn === void 0 ? void 0 : _diagnostic$relatedIn.map(function (item) {
|
|
169
|
-
return {
|
|
170
|
-
message: item.message,
|
|
171
|
-
resource: MonacoUri.parse(item.location.uri),
|
|
172
|
-
startLineNumber: markerRange.startLineNumber,
|
|
173
|
-
startColumn: markerRange.startColumn,
|
|
174
|
-
endLineNumber: markerRange.endLineNumber,
|
|
175
|
-
endColumn: markerRange.endColumn
|
|
176
|
-
};
|
|
177
|
-
}),
|
|
178
|
-
startLineNumber: editorStart.line + 1,
|
|
179
|
-
startColumn: editorStart.ch + 1,
|
|
180
|
-
endLineNumber: editorEnd.line + 1,
|
|
181
|
-
endColumn: editorEnd.ch + 1
|
|
182
|
-
};
|
|
183
|
-
_this2.addDiagnostic(model, marker);
|
|
184
|
-
case 21:
|
|
185
|
-
case "end":
|
|
186
|
-
return _context.stop();
|
|
187
|
-
}
|
|
188
|
-
}, _callee);
|
|
189
|
-
}));
|
|
190
|
-
return function (_x2) {
|
|
191
|
-
return _ref2.apply(this, arguments);
|
|
192
|
-
};
|
|
193
|
-
}()));
|
|
194
|
-
case 3:
|
|
195
|
-
_this2.displayDiagnostic();
|
|
196
|
-
case 4:
|
|
197
|
-
case "end":
|
|
198
|
-
return _context2.stop();
|
|
199
|
-
}
|
|
200
|
-
}, _callee2);
|
|
201
|
-
}));
|
|
202
|
-
return function (_x) {
|
|
203
|
-
return _ref.apply(this, arguments);
|
|
204
|
-
};
|
|
205
|
-
}());
|
|
206
|
-
this.toDispose.push(toDispose);
|
|
207
|
-
case 5:
|
|
208
|
-
case "end":
|
|
209
|
-
return _context3.stop();
|
|
210
|
-
}
|
|
211
|
-
}, _callee3, this);
|
|
212
|
-
}));
|
|
213
|
-
function processDiagnostic() {
|
|
214
|
-
return _processDiagnostic.apply(this, arguments);
|
|
215
|
-
}
|
|
216
|
-
return processDiagnostic;
|
|
217
|
-
}()
|
|
218
|
-
}, {
|
|
219
|
-
key: "dispose",
|
|
220
|
-
value: function dispose() {
|
|
221
|
-
if (this.disposed) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
this.toDispose.dispose();
|
|
225
|
-
this.clearDiagnostic();
|
|
226
|
-
this.disposed = true;
|
|
227
|
-
}
|
|
228
|
-
}]);
|
|
229
|
-
return DiagnosticProvider;
|
|
230
|
-
}(LangaugeFeatureProvider);
|
|
@@ -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 FormatProvider extends LangaugeFeatureProvider implements monaco.languages.DocumentFormattingEditProvider, monaco.languages.DocumentRangeFormattingEditProvider {
|
|
4
|
-
displayName: string;
|
|
5
|
-
provideDocumentRangeFormattingEdits: (model: monaco.editor.ITextModel, range: monaco.Range, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken) => Promise<monaco.languages.TextEdit[]>;
|
|
6
|
-
provideDocumentFormattingEdits: (model: monaco.editor.ITextModel, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken) => Promise<monaco.languages.TextEdit[]>;
|
|
7
|
-
formatDocumentByRange: (model: monaco.editor.ITextModel, range: monaco.Range, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken) => Promise<monaco.languages.TextEdit[]>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=format-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-provider.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/format-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,qBAAa,cACX,SAAQ,uBACR,YACE,MAAM,CAAC,SAAS,CAAC,8BAA8B,EAC/C,MAAM,CAAC,SAAS,CAAC,mCAAmC;IAEtD,WAAW,SAAqB;IAEhC,mCAAmC,UAC1B,OAAO,MAAM,CAAC,UAAU,SACxB,YAAY,WACV,OAAO,SAAS,CAAC,iBAAiB,SACpC,OAAO,iBAAiB,KAC9B,QAAQ,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC,CAErC;IACF,8BAA8B,UACrB,OAAO,MAAM,CAAC,UAAU,WACtB,OAAO,SAAS,CAAC,iBAAiB,SACpC,OAAO,iBAAiB,KAC9B,QAAQ,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC,CAErC;IAEF,qBAAqB,UACZ,OAAO,MAAM,CAAC,UAAU,SACxB,YAAY,WACV,OAAO,SAAS,CAAC,iBAAiB,SACpC,OAAO,iBAAiB,KAC9B,QAAQ,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC,CAqDrC;CACH"}
|
|
@@ -1,143 +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 FormatProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
19
|
-
_inherits(FormatProvider, _LangaugeFeatureProvi);
|
|
20
|
-
var _super = _createSuper(FormatProvider);
|
|
21
|
-
function FormatProvider() {
|
|
22
|
-
var _this;
|
|
23
|
-
_classCallCheck(this, FormatProvider);
|
|
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.displayName = 'libro-e2-format';
|
|
29
|
-
_this.provideDocumentRangeFormattingEdits = /*#__PURE__*/function () {
|
|
30
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(model, range, options, token) {
|
|
31
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
32
|
-
while (1) switch (_context.prev = _context.next) {
|
|
33
|
-
case 0:
|
|
34
|
-
return _context.abrupt("return", _this.formatDocumentByRange(model, range, options, token));
|
|
35
|
-
case 1:
|
|
36
|
-
case "end":
|
|
37
|
-
return _context.stop();
|
|
38
|
-
}
|
|
39
|
-
}, _callee);
|
|
40
|
-
}));
|
|
41
|
-
return function (_x, _x2, _x3, _x4) {
|
|
42
|
-
return _ref.apply(this, arguments);
|
|
43
|
-
};
|
|
44
|
-
}();
|
|
45
|
-
_this.provideDocumentFormattingEdits = /*#__PURE__*/function () {
|
|
46
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(model, options, token) {
|
|
47
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
48
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
49
|
-
case 0:
|
|
50
|
-
return _context2.abrupt("return", _this.formatDocumentByRange(model, model.getFullModelRange(), options, token));
|
|
51
|
-
case 1:
|
|
52
|
-
case "end":
|
|
53
|
-
return _context2.stop();
|
|
54
|
-
}
|
|
55
|
-
}, _callee2);
|
|
56
|
-
}));
|
|
57
|
-
return function (_x5, _x6, _x7) {
|
|
58
|
-
return _ref2.apply(this, arguments);
|
|
59
|
-
};
|
|
60
|
-
}();
|
|
61
|
-
_this.formatDocumentByRange = /*#__PURE__*/function () {
|
|
62
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(model, range, options, token) {
|
|
63
|
-
var provider, doc, lspConnection, result, edits;
|
|
64
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
65
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
66
|
-
case 0:
|
|
67
|
-
_context3.next = 2;
|
|
68
|
-
return _this.getProvider(model);
|
|
69
|
-
case 2:
|
|
70
|
-
provider = _context3.sent;
|
|
71
|
-
if (provider) {
|
|
72
|
-
_context3.next = 5;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
return _context3.abrupt("return", []);
|
|
76
|
-
case 5:
|
|
77
|
-
doc = provider.virtualDocument;
|
|
78
|
-
_context3.next = 8;
|
|
79
|
-
return _this.getLSPConnection();
|
|
80
|
-
case 8:
|
|
81
|
-
lspConnection = _context3.sent;
|
|
82
|
-
_context3.next = 11;
|
|
83
|
-
return lspConnection.clientRequests['textDocument/rangeFormatting'].request({
|
|
84
|
-
// TODO: range transform
|
|
85
|
-
// TODO: pyright-extend supoport range format
|
|
86
|
-
range: {
|
|
87
|
-
start: {
|
|
88
|
-
line: range.startLineNumber - 1,
|
|
89
|
-
character: range.startColumn - 1
|
|
90
|
-
},
|
|
91
|
-
end: {
|
|
92
|
-
line: range.endLineNumber - 1,
|
|
93
|
-
character: range.endColumn - 1
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
textDocument: {
|
|
97
|
-
uri: doc.documentInfo.uri
|
|
98
|
-
},
|
|
99
|
-
options: {
|
|
100
|
-
insertSpaces: options.insertSpaces,
|
|
101
|
-
tabSize: options.tabSize
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
case 11:
|
|
105
|
-
result = _context3.sent;
|
|
106
|
-
if (!token.isCancellationRequested) {
|
|
107
|
-
_context3.next = 14;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
return _context3.abrupt("return", []);
|
|
111
|
-
case 14:
|
|
112
|
-
if (result) {
|
|
113
|
-
_context3.next = 16;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
return _context3.abrupt("return", []);
|
|
117
|
-
case 16:
|
|
118
|
-
edits = result.map(function (item) {
|
|
119
|
-
return {
|
|
120
|
-
range: {
|
|
121
|
-
startColumn: item.range.start.character + 1,
|
|
122
|
-
startLineNumber: item.range.start.line + 1,
|
|
123
|
-
endColumn: item.range.end.character + 1,
|
|
124
|
-
endLineNumber: item.range.end.line + 1
|
|
125
|
-
},
|
|
126
|
-
text: item.newText
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
return _context3.abrupt("return", edits);
|
|
130
|
-
case 18:
|
|
131
|
-
case "end":
|
|
132
|
-
return _context3.stop();
|
|
133
|
-
}
|
|
134
|
-
}, _callee3);
|
|
135
|
-
}));
|
|
136
|
-
return function (_x8, _x9, _x10, _x11) {
|
|
137
|
-
return _ref3.apply(this, arguments);
|
|
138
|
-
};
|
|
139
|
-
}();
|
|
140
|
-
return _this;
|
|
141
|
-
}
|
|
142
|
-
return _createClass(FormatProvider);
|
|
143
|
-
}(LangaugeFeatureProvider);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type monaco from '@difizen/monaco-editor-core';
|
|
2
|
-
import type * as lsp from 'vscode-languageserver-protocol';
|
|
3
|
-
import { LangaugeFeatureProvider } from './language-feature-provider.js';
|
|
4
|
-
export declare class HoverProvider extends LangaugeFeatureProvider implements monaco.languages.HoverProvider {
|
|
5
|
-
provideHover: (model: monaco.editor.ITextModel, position: monaco.Position, token: monaco.CancellationToken) => Promise<monaco.languages.Hover | undefined>;
|
|
6
|
-
}
|
|
7
|
-
export declare function formatContents(contents: lsp.MarkupContent | lsp.MarkedString | lsp.MarkedString[]): string;
|
|
8
|
-
//# sourceMappingURL=hover-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hover-provider.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/hover-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,KAAK,GAAG,MAAM,gCAAgC,CAAC;AAI3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,qBAAa,aACX,SAAQ,uBACR,YAAW,MAAM,CAAC,SAAS,CAAC,aAAa;IAEzC,YAAY,UACH,OAAO,MAAM,CAAC,UAAU,YACrB,OAAO,QAAQ,SAClB,OAAO,iBAAiB,KAC9B,QAAQ,OAAO,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,CAqE5C;CACH;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,GAAG,CAAC,aAAa,GAAG,GAAG,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,EAAE,GAClE,MAAM,CAQR"}
|
|
@@ -1,136 +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 { MonacoRange } from "../../types.js";
|
|
18
|
-
import { LangaugeFeatureProvider } from "./language-feature-provider.js";
|
|
19
|
-
export var HoverProvider = /*#__PURE__*/function (_LangaugeFeatureProvi) {
|
|
20
|
-
_inherits(HoverProvider, _LangaugeFeatureProvi);
|
|
21
|
-
var _super = _createSuper(HoverProvider);
|
|
22
|
-
function HoverProvider() {
|
|
23
|
-
var _this;
|
|
24
|
-
_classCallCheck(this, HoverProvider);
|
|
25
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
-
args[_key] = arguments[_key];
|
|
27
|
-
}
|
|
28
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
29
|
-
_this.provideHover = /*#__PURE__*/function () {
|
|
30
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(model, position, token) {
|
|
31
|
-
var editor, provider, lspConnection, docEditor, doc, virtualPos, result, contents, range, resultContents, resultRange, editorStart, editorEnd;
|
|
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,
|
|
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/hover'].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
|
-
result = _context.sent;
|
|
77
|
-
if (result) {
|
|
78
|
-
_context.next = 17;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
return _context.abrupt("return");
|
|
82
|
-
case 17:
|
|
83
|
-
contents = result.contents, range = result.range;
|
|
84
|
-
resultContents = [{
|
|
85
|
-
value: formatContents(contents)
|
|
86
|
-
}];
|
|
87
|
-
if (range) {
|
|
88
|
-
editorStart = doc.transformVirtualToEditor({
|
|
89
|
-
line: range.start.line,
|
|
90
|
-
ch: range.start.character,
|
|
91
|
-
isVirtual: true
|
|
92
|
-
});
|
|
93
|
-
editorEnd = doc.transformVirtualToEditor({
|
|
94
|
-
line: range.end.line,
|
|
95
|
-
ch: range.end.character,
|
|
96
|
-
isVirtual: true
|
|
97
|
-
});
|
|
98
|
-
if (editorStart && editorEnd) {
|
|
99
|
-
resultRange = new MonacoRange(editorStart.line + 1, editorStart.ch + 1, editorEnd.line + 1, editorEnd.ch + 1);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (!token.isCancellationRequested) {
|
|
103
|
-
_context.next = 22;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
return _context.abrupt("return");
|
|
107
|
-
case 22:
|
|
108
|
-
return _context.abrupt("return", {
|
|
109
|
-
contents: resultContents,
|
|
110
|
-
range: resultRange
|
|
111
|
-
});
|
|
112
|
-
case 23:
|
|
113
|
-
case "end":
|
|
114
|
-
return _context.stop();
|
|
115
|
-
}
|
|
116
|
-
}, _callee);
|
|
117
|
-
}));
|
|
118
|
-
return function (_x, _x2, _x3) {
|
|
119
|
-
return _ref.apply(this, arguments);
|
|
120
|
-
};
|
|
121
|
-
}();
|
|
122
|
-
return _this;
|
|
123
|
-
}
|
|
124
|
-
return _createClass(HoverProvider);
|
|
125
|
-
}(LangaugeFeatureProvider);
|
|
126
|
-
export function formatContents(contents) {
|
|
127
|
-
if (Array.isArray(contents)) {
|
|
128
|
-
return contents.map(function (c) {
|
|
129
|
-
return formatContents(c) + '\n\n';
|
|
130
|
-
}).join('');
|
|
131
|
-
} else if (typeof contents === 'string') {
|
|
132
|
-
return contents;
|
|
133
|
-
} else {
|
|
134
|
-
return contents.value;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { LibroService } from '@difizen/libro-core';
|
|
2
|
-
import type { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
|
|
3
|
-
import type { LSPConnection } from '@difizen/libro-lsp';
|
|
4
|
-
import type monaco from '@difizen/monaco-editor-core';
|
|
5
|
-
import type * as lsp from 'vscode-languageserver-protocol';
|
|
6
|
-
import { LibroE2Editor } from '../../libro-e2-editor.js';
|
|
7
|
-
export declare class LangaugeFeatureProvider {
|
|
8
|
-
protected libroService: LibroService;
|
|
9
|
-
lspDocumentConnectionManager: ILSPDocumentConnectionManager;
|
|
10
|
-
constructor(libroService: LibroService, lspDocumentConnectionManager: ILSPDocumentConnectionManager);
|
|
11
|
-
getVirtualDocument(): Promise<import("@difizen/libro-lsp").VirtualDocument | null | undefined>;
|
|
12
|
-
getLSPConnection(): Promise<LSPConnection>;
|
|
13
|
-
/**
|
|
14
|
-
* find cell editor from active notebook by model uri
|
|
15
|
-
* @param model
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
protected getEditorByModel(model: monaco.editor.ITextModel): LibroE2Editor | undefined;
|
|
19
|
-
protected getEditorFromLSPPosition(range: lsp.Range): Promise<LibroE2Editor | undefined>;
|
|
20
|
-
protected getProvider(model: monaco.editor.ITextModel): Promise<import("@difizen/libro-lsp").LSPProviderResult | undefined>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=language-feature-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"language-feature-provider.d.ts","sourceRoot":"","sources":["../../../src/language/lsp/language-feature-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,KAAK,GAAG,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qBAAa,uBAAuB;IAClC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACrC,4BAA4B,EAAE,6BAA6B,CAAC;gBAE1D,YAAY,EAAE,YAAY,EAC1B,4BAA4B,EAAE,6BAA6B;IAMvD,kBAAkB;IAkBlB,gBAAgB;IActB;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;cAoB1C,wBAAwB,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK;cAmBzC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;CAU5D"}
|