@difizen/libro-language-client 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/es/common/api.d.ts +38 -0
- package/es/common/api.d.ts.map +1 -0
- package/es/common/api.js +9 -0
- package/es/common/callHierarchy.d.ts +39 -0
- package/es/common/callHierarchy.d.ts.map +1 -0
- package/es/common/callHierarchy.js +139 -0
- package/es/common/client.d.ts +482 -0
- package/es/common/client.d.ts.map +1 -0
- package/es/common/client.js +2731 -0
- package/es/common/codeAction.d.ts +22 -0
- package/es/common/codeAction.d.ts.map +1 -0
- package/es/common/codeAction.js +149 -0
- package/es/common/codeConverter.d.ts +81 -0
- package/es/common/codeConverter.d.ts.map +1 -0
- package/es/common/codeConverter.js +1040 -0
- package/es/common/codeLens.d.ts +26 -0
- package/es/common/codeLens.d.ts.map +1 -0
- package/es/common/codeLens.js +125 -0
- package/es/common/colorProvider.d.ts +27 -0
- package/es/common/colorProvider.d.ts.map +1 -0
- package/es/common/colorProvider.js +104 -0
- package/es/common/completion.d.ts +22 -0
- package/es/common/completion.d.ts.map +1 -0
- package/es/common/completion.js +130 -0
- package/es/common/configuration.d.ts +71 -0
- package/es/common/configuration.d.ts.map +1 -0
- package/es/common/configuration.js +292 -0
- package/es/common/declaration.d.ts +18 -0
- package/es/common/declaration.d.ts.map +1 -0
- package/es/common/declaration.js +88 -0
- package/es/common/definition.d.ts +18 -0
- package/es/common/definition.d.ts.map +1 -0
- package/es/common/definition.js +80 -0
- package/es/common/diagnostic.d.ts +125 -0
- package/es/common/diagnostic.d.ts.map +1 -0
- package/es/common/diagnostic.js +1442 -0
- package/es/common/documentHighlight.d.ts +17 -0
- package/es/common/documentHighlight.d.ts.map +1 -0
- package/es/common/documentHighlight.js +73 -0
- package/es/common/documentLink.d.ts +21 -0
- package/es/common/documentLink.d.ts.map +1 -0
- package/es/common/documentLink.js +90 -0
- package/es/common/documentSymbol.d.ts +20 -0
- package/es/common/documentSymbol.d.ts.map +1 -0
- package/es/common/documentSymbol.js +134 -0
- package/es/common/executeCommand.d.ts +22 -0
- package/es/common/executeCommand.d.ts.map +1 -0
- package/es/common/executeCommand.js +117 -0
- package/es/common/features.d.ts +421 -0
- package/es/common/features.d.ts.map +1 -0
- package/es/common/features.js +576 -0
- package/es/common/fileOperations.d.ts +118 -0
- package/es/common/fileOperations.d.ts.map +1 -0
- package/es/common/fileOperations.js +705 -0
- package/es/common/fileSystemWatcher.d.ts +19 -0
- package/es/common/fileSystemWatcher.d.ts.map +1 -0
- package/es/common/fileSystemWatcher.js +173 -0
- package/es/common/foldingRange.d.ts +22 -0
- package/es/common/foldingRange.d.ts.map +1 -0
- package/es/common/foldingRange.js +127 -0
- package/es/common/formatting.d.ts +41 -0
- package/es/common/formatting.d.ts.map +1 -0
- package/es/common/formatting.js +233 -0
- package/es/common/hover.d.ts +18 -0
- package/es/common/hover.d.ts.map +1 -0
- package/es/common/hover.js +80 -0
- package/es/common/implementation.d.ts +18 -0
- package/es/common/implementation.d.ts.map +1 -0
- package/es/common/implementation.js +88 -0
- package/es/common/inlayHint.d.ts +23 -0
- package/es/common/inlayHint.d.ts.map +1 -0
- package/es/common/inlayHint.js +187 -0
- package/es/common/inlineCompletion.d.ts +20 -0
- package/es/common/inlineCompletion.d.ts.map +1 -0
- package/es/common/inlineCompletion.js +74 -0
- package/es/common/inlineValue.d.ts +21 -0
- package/es/common/inlineValue.d.ts.map +1 -0
- package/es/common/inlineValue.js +124 -0
- package/es/common/linkedEditingRange.d.ts +23 -0
- package/es/common/linkedEditingRange.d.ts.map +1 -0
- package/es/common/linkedEditingRange.js +94 -0
- package/es/common/notebook.d.ts +97 -0
- package/es/common/notebook.d.ts.map +1 -0
- package/es/common/notebook.js +1444 -0
- package/es/common/progress.d.ts +12 -0
- package/es/common/progress.d.ts.map +1 -0
- package/es/common/progress.js +75 -0
- package/es/common/progressPart.d.ts +25 -0
- package/es/common/progressPart.d.ts.map +1 -0
- package/es/common/progressPart.js +147 -0
- package/es/common/protocolCallHierarchyItem.d.ts +9 -0
- package/es/common/protocolCallHierarchyItem.d.ts.map +1 -0
- package/es/common/protocolCallHierarchyItem.js +34 -0
- package/es/common/protocolCodeAction.d.ts +7 -0
- package/es/common/protocolCodeAction.d.ts.map +1 -0
- package/es/common/protocolCodeAction.js +32 -0
- package/es/common/protocolCodeLens.d.ts +7 -0
- package/es/common/protocolCodeLens.d.ts.map +1 -0
- package/es/common/protocolCodeLens.js +29 -0
- package/es/common/protocolCompletionItem.d.ts +13 -0
- package/es/common/protocolCompletionItem.d.ts.map +1 -0
- package/es/common/protocolCompletionItem.js +29 -0
- package/es/common/protocolConverter.d.ts +174 -0
- package/es/common/protocolConverter.d.ts.map +1 -0
- package/es/common/protocolConverter.js +1982 -0
- package/es/common/protocolDiagnostic.d.ts +20 -0
- package/es/common/protocolDiagnostic.d.ts.map +1 -0
- package/es/common/protocolDiagnostic.js +46 -0
- package/es/common/protocolDocumentLink.d.ts +8 -0
- package/es/common/protocolDocumentLink.d.ts.map +1 -0
- package/es/common/protocolDocumentLink.js +29 -0
- package/es/common/protocolInlayHint.d.ts +8 -0
- package/es/common/protocolInlayHint.d.ts.map +1 -0
- package/es/common/protocolInlayHint.js +29 -0
- package/es/common/protocolTypeHierarchyItem.d.ts +9 -0
- package/es/common/protocolTypeHierarchyItem.d.ts.map +1 -0
- package/es/common/protocolTypeHierarchyItem.js +34 -0
- package/es/common/protocolWorkspaceSymbol.d.ts +9 -0
- package/es/common/protocolWorkspaceSymbol.d.ts.map +1 -0
- package/es/common/protocolWorkspaceSymbol.js +36 -0
- package/es/common/reference.d.ts +22 -0
- package/es/common/reference.d.ts.map +1 -0
- package/es/common/reference.js +78 -0
- package/es/common/rename.d.ts +29 -0
- package/es/common/rename.d.ts.map +1 -0
- package/es/common/rename.js +132 -0
- package/es/common/selectionRange.d.ts +18 -0
- package/es/common/selectionRange.d.ts.map +1 -0
- package/es/common/selectionRange.js +108 -0
- package/es/common/semanticTokens.d.ts +36 -0
- package/es/common/semanticTokens.d.ts.map +1 -0
- package/es/common/semanticTokens.js +226 -0
- package/es/common/signatureHelp.d.ts +18 -0
- package/es/common/signatureHelp.d.ts.map +1 -0
- package/es/common/signatureHelp.js +103 -0
- package/es/common/textSynchronization.d.ts +104 -0
- package/es/common/textSynchronization.d.ts.map +1 -0
- package/es/common/textSynchronization.js +771 -0
- package/es/common/typeDefinition.d.ts +18 -0
- package/es/common/typeDefinition.d.ts.map +1 -0
- package/es/common/typeDefinition.js +89 -0
- package/es/common/typeHierarchy.d.ts +33 -0
- package/es/common/typeHierarchy.d.ts.map +1 -0
- package/es/common/typeHierarchy.js +138 -0
- package/es/common/utils/async.d.ts +42 -0
- package/es/common/utils/async.d.ts.map +1 -0
- package/es/common/utils/async.js +441 -0
- package/es/common/utils/is.d.ts +13 -0
- package/es/common/utils/is.d.ts.map +1 -0
- package/es/common/utils/is.js +52 -0
- package/es/common/utils/uuid.d.ts +23 -0
- package/es/common/utils/uuid.d.ts.map +1 -0
- package/es/common/utils/uuid.js +85 -0
- package/es/common/vscodeAdaptor/convertor.d.ts +7 -0
- package/es/common/vscodeAdaptor/convertor.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/convertor.js +66 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.d.ts +33 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.js +310 -0
- package/es/common/vscodeAdaptor/extHostTypes.d.ts +1496 -0
- package/es/common/vscodeAdaptor/extHostTypes.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/extHostTypes.js +3825 -0
- package/es/common/vscodeAdaptor/fileWatcher.d.ts +19 -0
- package/es/common/vscodeAdaptor/fileWatcher.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/fileWatcher.js +45 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.d.ts +192 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.js +566 -0
- package/es/common/vscodeAdaptor/libro-fs.d.ts +21 -0
- package/es/common/vscodeAdaptor/libro-fs.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libro-fs.js +64 -0
- package/es/common/vscodeAdaptor/libroWindow.d.ts +21 -0
- package/es/common/vscodeAdaptor/libroWindow.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libroWindow.js +75 -0
- package/es/common/vscodeAdaptor/libroWorkspace.d.ts +33 -0
- package/es/common/vscodeAdaptor/libroWorkspace.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libroWorkspace.js +250 -0
- package/es/common/vscodeAdaptor/lspEnv.d.ts +8 -0
- package/es/common/vscodeAdaptor/lspEnv.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/lspEnv.js +31 -0
- package/es/common/vscodeAdaptor/monaco-converter.d.ts +229 -0
- package/es/common/vscodeAdaptor/monaco-converter.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/monaco-converter.js +1613 -0
- package/es/common/vscodeAdaptor/monacoLanguages.d.ts +48 -0
- package/es/common/vscodeAdaptor/monacoLanguages.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/monacoLanguages.js +484 -0
- package/es/common/vscodeAdaptor/services.d.ts +85 -0
- package/es/common/vscodeAdaptor/services.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/services.js +3 -0
- package/es/common/vscodeAdaptor/typings.d.ts +10 -0
- package/es/common/vscodeAdaptor/util.d.ts +3 -0
- package/es/common/vscodeAdaptor/util.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/util.js +6 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts +77 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.js +124 -0
- package/es/common/workspaceFolder.d.ts +32 -0
- package/es/common/workspaceFolder.d.ts.map +1 -0
- package/es/common/workspaceFolder.js +204 -0
- package/es/common/workspaceSymbol.d.ts +21 -0
- package/es/common/workspaceSymbol.d.ts.map +1 -0
- package/es/common/workspaceSymbol.js +101 -0
- package/es/constants.d.ts +2 -0
- package/es/constants.d.ts.map +1 -0
- package/es/constants.js +1 -0
- package/es/index.d.ts +6 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +5 -0
- package/es/libro-language-client-contribution.d.ts +10 -0
- package/es/libro-language-client-contribution.d.ts.map +1 -0
- package/es/libro-language-client-contribution.js +143 -0
- package/es/libro-language-client-manager.d.ts +34 -0
- package/es/libro-language-client-manager.d.ts.map +1 -0
- package/es/libro-language-client-manager.js +277 -0
- package/es/libro-language-client.d.ts +27 -0
- package/es/libro-language-client.d.ts.map +1 -0
- package/es/libro-language-client.js +141 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +13 -0
- package/package.json +69 -0
- package/src/common/api.ts +155 -0
- package/src/common/callHierarchy.ts +269 -0
- package/src/common/client.ts +3192 -0
- package/src/common/codeAction.ts +237 -0
- package/src/common/codeConverter.ts +1409 -0
- package/src/common/codeLens.ts +188 -0
- package/src/common/colorProvider.ts +192 -0
- package/src/common/completion.ts +281 -0
- package/src/common/configuration.ts +338 -0
- package/src/common/declaration.ts +140 -0
- package/src/common/definition.ts +138 -0
- package/src/common/diagnostic.ts +1408 -0
- package/src/common/documentHighlight.ts +140 -0
- package/src/common/documentLink.ts +180 -0
- package/src/common/documentSymbol.ts +186 -0
- package/src/common/executeCommand.ts +129 -0
- package/src/common/features.ts +1157 -0
- package/src/common/fileOperations.ts +635 -0
- package/src/common/fileSystemWatcher.ts +184 -0
- package/src/common/foldingRange.ts +160 -0
- package/src/common/formatting.ts +465 -0
- package/src/common/hover.ts +133 -0
- package/src/common/implementation.ts +142 -0
- package/src/common/inlayHint.ts +201 -0
- package/src/common/inlineCompletion.ts +160 -0
- package/src/common/inlineValue.ts +158 -0
- package/src/common/linkedEditingRange.ts +141 -0
- package/src/common/notebook.ts +1443 -0
- package/src/common/progress.ts +61 -0
- package/src/common/progressPart.ts +151 -0
- package/src/common/protocolCallHierarchyItem.ts +29 -0
- package/src/common/protocolCodeAction.ts +17 -0
- package/src/common/protocolCodeLens.ts +15 -0
- package/src/common/protocolCompletionItem.ts +22 -0
- package/src/common/protocolConverter.ts +2627 -0
- package/src/common/protocolDiagnostic.ts +47 -0
- package/src/common/protocolDocumentLink.ts +17 -0
- package/src/common/protocolInlayHint.ts +21 -0
- package/src/common/protocolTypeHierarchyItem.ts +29 -0
- package/src/common/protocolWorkspaceSymbol.ts +39 -0
- package/src/common/reference.ts +144 -0
- package/src/common/rename.ts +230 -0
- package/src/common/selectionRange.ts +136 -0
- package/src/common/semanticTokens.ts +383 -0
- package/src/common/signatureHelp.ts +170 -0
- package/src/common/textSynchronization.ts +819 -0
- package/src/common/typeDefinition.ts +146 -0
- package/src/common/typeHierarchy.ts +248 -0
- package/src/common/utils/async.ts +354 -0
- package/src/common/utils/is.ts +63 -0
- package/src/common/utils/uuid.ts +136 -0
- package/src/common/vscodeAdaptor/convertor.ts +73 -0
- package/src/common/vscodeAdaptor/diagnosticCollection.ts +238 -0
- package/src/common/vscodeAdaptor/extHostTypes.ts +4498 -0
- package/src/common/vscodeAdaptor/fileWatcher.ts +36 -0
- package/src/common/vscodeAdaptor/hostTypeUtil.ts +539 -0
- package/src/common/vscodeAdaptor/libro-fs.ts +51 -0
- package/src/common/vscodeAdaptor/libroWindow.ts +85 -0
- package/src/common/vscodeAdaptor/libroWorkspace.ts +261 -0
- package/src/common/vscodeAdaptor/lspEnv.ts +16 -0
- package/src/common/vscodeAdaptor/monaco-converter.ts +1800 -0
- package/src/common/vscodeAdaptor/monacoLanguages.ts +511 -0
- package/src/common/vscodeAdaptor/services.ts +278 -0
- package/src/common/vscodeAdaptor/typings.d.ts +10 -0
- package/src/common/vscodeAdaptor/util.ts +7 -0
- package/src/common/vscodeAdaptor/vscodeAdaptor.ts +122 -0
- package/src/common/workspaceFolder.ts +236 -0
- package/src/common/workspaceSymbol.ts +166 -0
- package/src/constants.ts +1 -0
- package/src/index.spec.ts +7 -0
- package/src/index.ts +5 -0
- package/src/libro-language-client-contribution.ts +49 -0
- package/src/libro-language-client-manager.ts +131 -0
- package/src/libro-language-client.ts +100 -0
- package/src/module.ts +19 -0
|
@@ -0,0 +1,576 @@
|
|
|
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
8
|
+
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); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
|
+
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); }
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
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); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
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); }; }
|
|
16
|
+
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); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
/* --------------------------------------------------------------------------------------------
|
|
21
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
22
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
23
|
+
* ------------------------------------------------------------------------------------------ */
|
|
24
|
+
|
|
25
|
+
import { languages as Languages, workspace as Workspace, EventEmitter, CancellationError } from "./vscodeAdaptor/vscodeAdaptor.js";
|
|
26
|
+
import { StaticRegistrationOptions, TextDocumentRegistrationOptions, WorkDoneProgressOptions } from '@difizen/vscode-languageserver-protocol';
|
|
27
|
+
export var LSPCancellationError = /*#__PURE__*/function (_CancellationError) {
|
|
28
|
+
_inherits(LSPCancellationError, _CancellationError);
|
|
29
|
+
var _super = _createSuper(LSPCancellationError);
|
|
30
|
+
function LSPCancellationError(data) {
|
|
31
|
+
var _this;
|
|
32
|
+
_classCallCheck(this, LSPCancellationError);
|
|
33
|
+
_this = _super.call(this);
|
|
34
|
+
_this.data = data;
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
return _createClass(LSPCancellationError);
|
|
38
|
+
}(CancellationError);
|
|
39
|
+
export function ensure(target, key) {
|
|
40
|
+
if (target[key] === undefined) {
|
|
41
|
+
target[key] = {};
|
|
42
|
+
}
|
|
43
|
+
return target[key];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A static feature. A static feature can't be dynamically activated via the
|
|
48
|
+
* server. It is wired during the initialize sequence.
|
|
49
|
+
*/
|
|
50
|
+
export var StaticFeature;
|
|
51
|
+
(function (_StaticFeature) {
|
|
52
|
+
function is(value) {
|
|
53
|
+
var candidate = value;
|
|
54
|
+
return candidate !== undefined && candidate !== null && Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.clear) && (candidate.fillInitializeParams === undefined || Is.func(candidate.fillInitializeParams));
|
|
55
|
+
}
|
|
56
|
+
_StaticFeature.is = is;
|
|
57
|
+
})(StaticFeature || (StaticFeature = {}));
|
|
58
|
+
/**
|
|
59
|
+
* A dynamic feature can be activated via the server.
|
|
60
|
+
*/
|
|
61
|
+
export var DynamicFeature;
|
|
62
|
+
(function (_DynamicFeature) {
|
|
63
|
+
function is(value) {
|
|
64
|
+
var candidate = value;
|
|
65
|
+
return candidate !== undefined && candidate !== null && Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.clear) && (candidate.fillInitializeParams === undefined || Is.func(candidate.fillInitializeParams)) && Is.func(candidate.register) && Is.func(candidate.unregister) && candidate.registrationType !== undefined;
|
|
66
|
+
}
|
|
67
|
+
_DynamicFeature.is = is;
|
|
68
|
+
})(DynamicFeature || (DynamicFeature = {}));
|
|
69
|
+
/**
|
|
70
|
+
* An abstract dynamic feature implementation that operates on documents (e.g. text
|
|
71
|
+
* documents or notebooks).
|
|
72
|
+
*/
|
|
73
|
+
export var DynamicDocumentFeature = /*#__PURE__*/function () {
|
|
74
|
+
function DynamicDocumentFeature(client) {
|
|
75
|
+
_classCallCheck(this, DynamicDocumentFeature);
|
|
76
|
+
this._client = client;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Repeat from interface.
|
|
80
|
+
_createClass(DynamicDocumentFeature, [{
|
|
81
|
+
key: "getState",
|
|
82
|
+
value:
|
|
83
|
+
/**
|
|
84
|
+
* Returns the state the feature is in.
|
|
85
|
+
*/
|
|
86
|
+
function getState() {
|
|
87
|
+
var selectors = this.getDocumentSelectors();
|
|
88
|
+
var count = 0;
|
|
89
|
+
var _iterator = _createForOfIteratorHelper(selectors),
|
|
90
|
+
_step;
|
|
91
|
+
try {
|
|
92
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
93
|
+
var selector = _step.value;
|
|
94
|
+
count++;
|
|
95
|
+
var _iterator2 = _createForOfIteratorHelper(Workspace.textDocuments),
|
|
96
|
+
_step2;
|
|
97
|
+
try {
|
|
98
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
99
|
+
var _document = _step2.value;
|
|
100
|
+
if (Languages.match(selector, _document) > 0) {
|
|
101
|
+
return {
|
|
102
|
+
kind: 'document',
|
|
103
|
+
id: this.registrationType.method,
|
|
104
|
+
registrations: true,
|
|
105
|
+
matches: true
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (err) {
|
|
110
|
+
_iterator2.e(err);
|
|
111
|
+
} finally {
|
|
112
|
+
_iterator2.f();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} catch (err) {
|
|
116
|
+
_iterator.e(err);
|
|
117
|
+
} finally {
|
|
118
|
+
_iterator.f();
|
|
119
|
+
}
|
|
120
|
+
var registrations = count > 0;
|
|
121
|
+
return {
|
|
122
|
+
kind: 'document',
|
|
123
|
+
id: this.registrationType.method,
|
|
124
|
+
registrations: registrations,
|
|
125
|
+
matches: false
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}]);
|
|
129
|
+
return DynamicDocumentFeature;
|
|
130
|
+
}();
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A mixin type that allows to send notification or requests using a registered
|
|
134
|
+
* provider.
|
|
135
|
+
*/
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* An abstract base class to implement features that react to events
|
|
140
|
+
* emitted from text documents.
|
|
141
|
+
*/
|
|
142
|
+
export var TextDocumentEventFeature = /*#__PURE__*/function (_ref) {
|
|
143
|
+
_inherits(TextDocumentEventFeature, _ref);
|
|
144
|
+
var _super2 = _createSuper(TextDocumentEventFeature);
|
|
145
|
+
function TextDocumentEventFeature(client, event, type, middleware, createParams, textDocument, selectorFilter) {
|
|
146
|
+
var _this2;
|
|
147
|
+
_classCallCheck(this, TextDocumentEventFeature);
|
|
148
|
+
_this2 = _super2.call(this, client);
|
|
149
|
+
_this2._event = event;
|
|
150
|
+
_this2._type = type;
|
|
151
|
+
_this2._middleware = middleware;
|
|
152
|
+
_this2._createParams = createParams;
|
|
153
|
+
_this2._textDocument = textDocument;
|
|
154
|
+
_this2._selectorFilter = selectorFilter;
|
|
155
|
+
_this2._selectors = new Map();
|
|
156
|
+
_this2._onNotificationSent = new EventEmitter();
|
|
157
|
+
return _this2;
|
|
158
|
+
}
|
|
159
|
+
_createClass(TextDocumentEventFeature, [{
|
|
160
|
+
key: "getStateInfo",
|
|
161
|
+
value: function getStateInfo() {
|
|
162
|
+
return [this._selectors.values(), false];
|
|
163
|
+
}
|
|
164
|
+
}, {
|
|
165
|
+
key: "getDocumentSelectors",
|
|
166
|
+
value: function getDocumentSelectors() {
|
|
167
|
+
return this._selectors.values();
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "register",
|
|
171
|
+
value: function register(data) {
|
|
172
|
+
var _this3 = this;
|
|
173
|
+
if (!data.registerOptions.documentSelector) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (!this._listener) {
|
|
177
|
+
this._listener = this._event(function (data) {
|
|
178
|
+
_this3.callback(data).catch(function (error) {
|
|
179
|
+
_this3._client.error("Sending document notification ".concat(_this3._type.method, " failed."), error);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
this._selectors.set(data.id, this._client.protocol2CodeConverter.asDocumentSelector(data.registerOptions.documentSelector));
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: "callback",
|
|
187
|
+
value: function () {
|
|
188
|
+
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
|
|
189
|
+
var _this4 = this;
|
|
190
|
+
var doSend, middleware;
|
|
191
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
192
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
doSend = /*#__PURE__*/function () {
|
|
195
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
196
|
+
var params;
|
|
197
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
198
|
+
while (1) switch (_context.prev = _context.next) {
|
|
199
|
+
case 0:
|
|
200
|
+
params = _this4._createParams(data);
|
|
201
|
+
_context.next = 3;
|
|
202
|
+
return _this4._client.sendNotification(_this4._type, params);
|
|
203
|
+
case 3:
|
|
204
|
+
_this4.notificationSent(_this4.getTextDocument(data), _this4._type, params);
|
|
205
|
+
case 4:
|
|
206
|
+
case "end":
|
|
207
|
+
return _context.stop();
|
|
208
|
+
}
|
|
209
|
+
}, _callee);
|
|
210
|
+
}));
|
|
211
|
+
return function doSend(_x2) {
|
|
212
|
+
return _ref2.apply(this, arguments);
|
|
213
|
+
};
|
|
214
|
+
}();
|
|
215
|
+
if (!this.matches(data)) {
|
|
216
|
+
_context2.next = 4;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
middleware = this._middleware();
|
|
220
|
+
return _context2.abrupt("return", middleware ? middleware(data, function (data) {
|
|
221
|
+
return doSend(data);
|
|
222
|
+
}) : doSend(data));
|
|
223
|
+
case 4:
|
|
224
|
+
case "end":
|
|
225
|
+
return _context2.stop();
|
|
226
|
+
}
|
|
227
|
+
}, _callee2, this);
|
|
228
|
+
}));
|
|
229
|
+
function callback(_x) {
|
|
230
|
+
return _callback.apply(this, arguments);
|
|
231
|
+
}
|
|
232
|
+
return callback;
|
|
233
|
+
}()
|
|
234
|
+
}, {
|
|
235
|
+
key: "matches",
|
|
236
|
+
value: function matches(data) {
|
|
237
|
+
if (this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(data))) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
return !this._selectorFilter || this._selectorFilter(this._selectors.values(), data);
|
|
241
|
+
}
|
|
242
|
+
}, {
|
|
243
|
+
key: "onNotificationSent",
|
|
244
|
+
get: function get() {
|
|
245
|
+
return this._onNotificationSent.event;
|
|
246
|
+
}
|
|
247
|
+
}, {
|
|
248
|
+
key: "notificationSent",
|
|
249
|
+
value: function notificationSent(textDocument, type, params) {
|
|
250
|
+
this._onNotificationSent.fire({
|
|
251
|
+
textDocument: textDocument,
|
|
252
|
+
type: type,
|
|
253
|
+
params: params
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}, {
|
|
257
|
+
key: "unregister",
|
|
258
|
+
value: function unregister(id) {
|
|
259
|
+
this._selectors.delete(id);
|
|
260
|
+
if (this._selectors.size === 0 && this._listener) {
|
|
261
|
+
this._listener.dispose();
|
|
262
|
+
this._listener = undefined;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}, {
|
|
266
|
+
key: "clear",
|
|
267
|
+
value: function clear() {
|
|
268
|
+
this._selectors.clear();
|
|
269
|
+
this._onNotificationSent.dispose();
|
|
270
|
+
if (this._listener) {
|
|
271
|
+
this._listener.dispose();
|
|
272
|
+
this._listener = undefined;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}, {
|
|
276
|
+
key: "getProvider",
|
|
277
|
+
value: function getProvider(document) {
|
|
278
|
+
var _this5 = this;
|
|
279
|
+
var _iterator3 = _createForOfIteratorHelper(this._selectors.values()),
|
|
280
|
+
_step3;
|
|
281
|
+
try {
|
|
282
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
283
|
+
var selector = _step3.value;
|
|
284
|
+
if (Languages.match(selector, document) > 0) {
|
|
285
|
+
return {
|
|
286
|
+
send: function send(data) {
|
|
287
|
+
return _this5.callback(data);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
} catch (err) {
|
|
293
|
+
_iterator3.e(err);
|
|
294
|
+
} finally {
|
|
295
|
+
_iterator3.f();
|
|
296
|
+
}
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
}], [{
|
|
300
|
+
key: "textDocumentFilter",
|
|
301
|
+
value: function textDocumentFilter(selectors, textDocument) {
|
|
302
|
+
var _iterator4 = _createForOfIteratorHelper(selectors),
|
|
303
|
+
_step4;
|
|
304
|
+
try {
|
|
305
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
306
|
+
var selector = _step4.value;
|
|
307
|
+
if (Languages.match(selector, textDocument) > 0) {
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
} catch (err) {
|
|
312
|
+
_iterator4.e(err);
|
|
313
|
+
} finally {
|
|
314
|
+
_iterator4.f();
|
|
315
|
+
}
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
}]);
|
|
319
|
+
return TextDocumentEventFeature;
|
|
320
|
+
}(DynamicDocumentFeature);
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* A mixin type to access a provider that is registered for a
|
|
324
|
+
* given text document / document selector.
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* A abstract feature implementation that registers language providers
|
|
329
|
+
* for text documents using a given document selector.
|
|
330
|
+
*/
|
|
331
|
+
export var TextDocumentLanguageFeature = /*#__PURE__*/function (_DynamicDocumentFeatu) {
|
|
332
|
+
_inherits(TextDocumentLanguageFeature, _DynamicDocumentFeatu);
|
|
333
|
+
var _super3 = _createSuper(TextDocumentLanguageFeature);
|
|
334
|
+
function TextDocumentLanguageFeature(client, registrationType) {
|
|
335
|
+
var _this6;
|
|
336
|
+
_classCallCheck(this, TextDocumentLanguageFeature);
|
|
337
|
+
_this6 = _super3.call(this, client);
|
|
338
|
+
_this6._registrationType = registrationType;
|
|
339
|
+
_this6._registrations = new Map();
|
|
340
|
+
return _this6;
|
|
341
|
+
}
|
|
342
|
+
_createClass(TextDocumentLanguageFeature, [{
|
|
343
|
+
key: "getDocumentSelectors",
|
|
344
|
+
value: /*#__PURE__*/_regeneratorRuntime().mark(function getDocumentSelectors() {
|
|
345
|
+
var _iterator5, _step5, registration, selector;
|
|
346
|
+
return _regeneratorRuntime().wrap(function getDocumentSelectors$(_context3) {
|
|
347
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
348
|
+
case 0:
|
|
349
|
+
_iterator5 = _createForOfIteratorHelper(this._registrations.values());
|
|
350
|
+
_context3.prev = 1;
|
|
351
|
+
_iterator5.s();
|
|
352
|
+
case 3:
|
|
353
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
354
|
+
_context3.next = 12;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
registration = _step5.value;
|
|
358
|
+
selector = registration.data.registerOptions.documentSelector;
|
|
359
|
+
if (!(selector === null)) {
|
|
360
|
+
_context3.next = 8;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
return _context3.abrupt("continue", 10);
|
|
364
|
+
case 8:
|
|
365
|
+
_context3.next = 10;
|
|
366
|
+
return this._client.protocol2CodeConverter.asDocumentSelector(selector);
|
|
367
|
+
case 10:
|
|
368
|
+
_context3.next = 3;
|
|
369
|
+
break;
|
|
370
|
+
case 12:
|
|
371
|
+
_context3.next = 17;
|
|
372
|
+
break;
|
|
373
|
+
case 14:
|
|
374
|
+
_context3.prev = 14;
|
|
375
|
+
_context3.t0 = _context3["catch"](1);
|
|
376
|
+
_iterator5.e(_context3.t0);
|
|
377
|
+
case 17:
|
|
378
|
+
_context3.prev = 17;
|
|
379
|
+
_iterator5.f();
|
|
380
|
+
return _context3.finish(17);
|
|
381
|
+
case 20:
|
|
382
|
+
case "end":
|
|
383
|
+
return _context3.stop();
|
|
384
|
+
}
|
|
385
|
+
}, getDocumentSelectors, this, [[1, 14, 17, 20]]);
|
|
386
|
+
})
|
|
387
|
+
}, {
|
|
388
|
+
key: "registrationType",
|
|
389
|
+
get: function get() {
|
|
390
|
+
return this._registrationType;
|
|
391
|
+
}
|
|
392
|
+
}, {
|
|
393
|
+
key: "register",
|
|
394
|
+
value: function register(data) {
|
|
395
|
+
if (!data.registerOptions.documentSelector) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
var registration = this.registerLanguageProvider(data.registerOptions, data.id);
|
|
399
|
+
this._registrations.set(data.id, {
|
|
400
|
+
disposable: registration[0],
|
|
401
|
+
data: data,
|
|
402
|
+
provider: registration[1]
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}, {
|
|
406
|
+
key: "unregister",
|
|
407
|
+
value: function unregister(id) {
|
|
408
|
+
var registration = this._registrations.get(id);
|
|
409
|
+
if (registration !== undefined) {
|
|
410
|
+
this._registrations.delete(id);
|
|
411
|
+
registration.disposable.dispose();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}, {
|
|
415
|
+
key: "clear",
|
|
416
|
+
value: function clear() {
|
|
417
|
+
this._registrations.forEach(function (value) {
|
|
418
|
+
value.disposable.dispose();
|
|
419
|
+
});
|
|
420
|
+
this._registrations.clear();
|
|
421
|
+
}
|
|
422
|
+
}, {
|
|
423
|
+
key: "getRegistration",
|
|
424
|
+
value: function getRegistration(documentSelector, capability) {
|
|
425
|
+
if (!capability) {
|
|
426
|
+
return [undefined, undefined];
|
|
427
|
+
} else if (TextDocumentRegistrationOptions.is(capability)) {
|
|
428
|
+
var _capability$documentS;
|
|
429
|
+
var _id = StaticRegistrationOptions.hasId(capability) ? capability.id : UUID.generateUuid();
|
|
430
|
+
var selector = (_capability$documentS = capability.documentSelector) !== null && _capability$documentS !== void 0 ? _capability$documentS : documentSelector;
|
|
431
|
+
if (selector) {
|
|
432
|
+
return [_id, Object.assign({}, capability, {
|
|
433
|
+
documentSelector: selector
|
|
434
|
+
})];
|
|
435
|
+
}
|
|
436
|
+
} else if (Is.boolean(capability) && capability === true || WorkDoneProgressOptions.is(capability)) {
|
|
437
|
+
if (!documentSelector) {
|
|
438
|
+
return [undefined, undefined];
|
|
439
|
+
}
|
|
440
|
+
var _options = Is.boolean(capability) && capability === true ? {
|
|
441
|
+
documentSelector: documentSelector
|
|
442
|
+
} : Object.assign({}, capability, {
|
|
443
|
+
documentSelector: documentSelector
|
|
444
|
+
});
|
|
445
|
+
return [UUID.generateUuid(), _options];
|
|
446
|
+
}
|
|
447
|
+
return [undefined, undefined];
|
|
448
|
+
}
|
|
449
|
+
}, {
|
|
450
|
+
key: "getRegistrationOptions",
|
|
451
|
+
value: function getRegistrationOptions(documentSelector, capability) {
|
|
452
|
+
if (!documentSelector || !capability) {
|
|
453
|
+
return undefined;
|
|
454
|
+
}
|
|
455
|
+
return Is.boolean(capability) && capability === true ? {
|
|
456
|
+
documentSelector: documentSelector
|
|
457
|
+
} : Object.assign({}, capability, {
|
|
458
|
+
documentSelector: documentSelector
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}, {
|
|
462
|
+
key: "getProvider",
|
|
463
|
+
value: function getProvider(textDocument) {
|
|
464
|
+
var _iterator6 = _createForOfIteratorHelper(this._registrations.values()),
|
|
465
|
+
_step6;
|
|
466
|
+
try {
|
|
467
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
468
|
+
var registration = _step6.value;
|
|
469
|
+
var selector = registration.data.registerOptions.documentSelector;
|
|
470
|
+
if (selector !== null && Languages.match(this._client.protocol2CodeConverter.asDocumentSelector(selector), textDocument) > 0) {
|
|
471
|
+
return registration.provider;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
} catch (err) {
|
|
475
|
+
_iterator6.e(err);
|
|
476
|
+
} finally {
|
|
477
|
+
_iterator6.f();
|
|
478
|
+
}
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
}, {
|
|
482
|
+
key: "getAllProviders",
|
|
483
|
+
value: function getAllProviders() {
|
|
484
|
+
var result = [];
|
|
485
|
+
var _iterator7 = _createForOfIteratorHelper(this._registrations.values()),
|
|
486
|
+
_step7;
|
|
487
|
+
try {
|
|
488
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
489
|
+
var item = _step7.value;
|
|
490
|
+
result.push(item.provider);
|
|
491
|
+
}
|
|
492
|
+
} catch (err) {
|
|
493
|
+
_iterator7.e(err);
|
|
494
|
+
} finally {
|
|
495
|
+
_iterator7.f();
|
|
496
|
+
}
|
|
497
|
+
return result;
|
|
498
|
+
}
|
|
499
|
+
}]);
|
|
500
|
+
return TextDocumentLanguageFeature;
|
|
501
|
+
}(DynamicDocumentFeature);
|
|
502
|
+
export var WorkspaceFeature = /*#__PURE__*/function () {
|
|
503
|
+
function WorkspaceFeature(client, registrationType) {
|
|
504
|
+
_classCallCheck(this, WorkspaceFeature);
|
|
505
|
+
this._client = client;
|
|
506
|
+
this._registrationType = registrationType;
|
|
507
|
+
this._registrations = new Map();
|
|
508
|
+
}
|
|
509
|
+
_createClass(WorkspaceFeature, [{
|
|
510
|
+
key: "getState",
|
|
511
|
+
value: function getState() {
|
|
512
|
+
var registrations = this._registrations.size > 0;
|
|
513
|
+
return {
|
|
514
|
+
kind: 'workspace',
|
|
515
|
+
id: this._registrationType.method,
|
|
516
|
+
registrations: registrations
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
}, {
|
|
520
|
+
key: "registrationType",
|
|
521
|
+
get: function get() {
|
|
522
|
+
return this._registrationType;
|
|
523
|
+
}
|
|
524
|
+
}, {
|
|
525
|
+
key: "register",
|
|
526
|
+
value: function register(data) {
|
|
527
|
+
var registration = this.registerLanguageProvider(data.registerOptions);
|
|
528
|
+
this._registrations.set(data.id, {
|
|
529
|
+
disposable: registration[0],
|
|
530
|
+
provider: registration[1]
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
}, {
|
|
534
|
+
key: "unregister",
|
|
535
|
+
value: function unregister(id) {
|
|
536
|
+
var registration = this._registrations.get(id);
|
|
537
|
+
if (registration !== undefined) {
|
|
538
|
+
this._registrations.delete(id);
|
|
539
|
+
registration.disposable.dispose();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}, {
|
|
543
|
+
key: "clear",
|
|
544
|
+
value: function clear() {
|
|
545
|
+
this._registrations.forEach(function (registration) {
|
|
546
|
+
registration.disposable.dispose();
|
|
547
|
+
});
|
|
548
|
+
this._registrations.clear();
|
|
549
|
+
}
|
|
550
|
+
}, {
|
|
551
|
+
key: "getProviders",
|
|
552
|
+
value: function getProviders() {
|
|
553
|
+
var result = [];
|
|
554
|
+
var _iterator8 = _createForOfIteratorHelper(this._registrations.values()),
|
|
555
|
+
_step8;
|
|
556
|
+
try {
|
|
557
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
558
|
+
var registration = _step8.value;
|
|
559
|
+
result.push(registration.provider);
|
|
560
|
+
}
|
|
561
|
+
} catch (err) {
|
|
562
|
+
_iterator8.e(err);
|
|
563
|
+
} finally {
|
|
564
|
+
_iterator8.f();
|
|
565
|
+
}
|
|
566
|
+
return result;
|
|
567
|
+
}
|
|
568
|
+
}]);
|
|
569
|
+
return WorkspaceFeature;
|
|
570
|
+
}();
|
|
571
|
+
// Features can refer to other feature when implementing themselves.
|
|
572
|
+
// Hence the feature client needs to provide access to them. To
|
|
573
|
+
// avoid cyclic dependencies these import MUST ALL be type imports.
|
|
574
|
+
|
|
575
|
+
import * as Is from "./utils/is.js";
|
|
576
|
+
import * as UUID from "./utils/uuid.js";
|