@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,771 @@
|
|
|
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 _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; } } }; }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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); } }
|
|
7
|
+
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); }); }; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
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); }
|
|
13
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
14
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
15
|
+
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); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
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); }; }
|
|
18
|
+
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); }
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
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; } }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
/* --------------------------------------------------------------------------------------------
|
|
23
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
24
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
25
|
+
* ------------------------------------------------------------------------------------------ */
|
|
26
|
+
|
|
27
|
+
import { DidChangeTextDocumentNotification, DidCloseTextDocumentNotification, DidOpenTextDocumentNotification, DidSaveTextDocumentNotification, TextDocumentSyncKind, WillSaveTextDocumentNotification, WillSaveTextDocumentWaitUntilRequest } from '@difizen/vscode-languageserver-protocol';
|
|
28
|
+
import { TextDocumentEventFeature, ensure, DynamicDocumentFeature } from "./features.js";
|
|
29
|
+
import * as UUID from "./utils/uuid.js";
|
|
30
|
+
import { workspace as Workspace, languages as Languages, EventEmitter } from "./vscodeAdaptor/vscodeAdaptor.js";
|
|
31
|
+
export var DidOpenTextDocumentFeature = /*#__PURE__*/function (_ref) {
|
|
32
|
+
_inherits(DidOpenTextDocumentFeature, _ref);
|
|
33
|
+
var _super = _createSuper(DidOpenTextDocumentFeature);
|
|
34
|
+
function DidOpenTextDocumentFeature(client, syncedDocuments) {
|
|
35
|
+
var _this;
|
|
36
|
+
_classCallCheck(this, DidOpenTextDocumentFeature);
|
|
37
|
+
_this = _super.call(this, client, Workspace.onDidOpenTextDocument, DidOpenTextDocumentNotification.type, function () {
|
|
38
|
+
return client.middleware.didOpen;
|
|
39
|
+
}, function (textDocument) {
|
|
40
|
+
return client.code2ProtocolConverter.asOpenTextDocumentParams(textDocument);
|
|
41
|
+
}, function (data) {
|
|
42
|
+
return data;
|
|
43
|
+
}, TextDocumentEventFeature.textDocumentFilter);
|
|
44
|
+
_this._syncedDocuments = syncedDocuments;
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
_createClass(DidOpenTextDocumentFeature, [{
|
|
48
|
+
key: "openDocuments",
|
|
49
|
+
get: function get() {
|
|
50
|
+
return this._syncedDocuments.values();
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "fillClientCapabilities",
|
|
54
|
+
value: function fillClientCapabilities(capabilities) {
|
|
55
|
+
ensure(ensure(capabilities, 'textDocument'), 'synchronization').dynamicRegistration = true;
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "initialize",
|
|
59
|
+
value: function initialize(capabilities, documentSelector) {
|
|
60
|
+
var textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
|
|
61
|
+
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.openClose) {
|
|
62
|
+
this.register({
|
|
63
|
+
id: UUID.generateUuid(),
|
|
64
|
+
registerOptions: {
|
|
65
|
+
documentSelector: documentSelector
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "registrationType",
|
|
72
|
+
get: function get() {
|
|
73
|
+
return DidOpenTextDocumentNotification.type;
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "register",
|
|
77
|
+
value: function register(data) {
|
|
78
|
+
var _this2 = this;
|
|
79
|
+
_get(_getPrototypeOf(DidOpenTextDocumentFeature.prototype), "register", this).call(this, data);
|
|
80
|
+
if (!data.registerOptions.documentSelector) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
var documentSelector = this._client.protocol2CodeConverter.asDocumentSelector(data.registerOptions.documentSelector);
|
|
84
|
+
Workspace.textDocuments.forEach(function (textDocument) {
|
|
85
|
+
var uri = textDocument.uri.toString();
|
|
86
|
+
if (_this2._syncedDocuments.has(uri)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (Languages.match(documentSelector, textDocument) > 0 && !_this2._client.hasDedicatedTextSynchronizationFeature(textDocument)) {
|
|
90
|
+
var middleware = _this2._client.middleware;
|
|
91
|
+
var didOpen = function didOpen(textDocument) {
|
|
92
|
+
return _this2._client.sendNotification(_this2._type, _this2._createParams(textDocument));
|
|
93
|
+
};
|
|
94
|
+
(middleware.didOpen ? middleware.didOpen(textDocument, didOpen) : didOpen(textDocument)).catch(function (error) {
|
|
95
|
+
_this2._client.error("Sending document notification ".concat(_this2._type.method, " failed"), error);
|
|
96
|
+
});
|
|
97
|
+
_this2._syncedDocuments.set(uri, textDocument);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "getTextDocument",
|
|
103
|
+
value: function getTextDocument(data) {
|
|
104
|
+
return data;
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "notificationSent",
|
|
108
|
+
value: function notificationSent(textDocument, type, params) {
|
|
109
|
+
this._syncedDocuments.set(textDocument.uri.toString(), textDocument);
|
|
110
|
+
_get(_getPrototypeOf(DidOpenTextDocumentFeature.prototype), "notificationSent", this).call(this, textDocument, type, params);
|
|
111
|
+
}
|
|
112
|
+
}]);
|
|
113
|
+
return DidOpenTextDocumentFeature;
|
|
114
|
+
}(TextDocumentEventFeature);
|
|
115
|
+
export var DidCloseTextDocumentFeature = /*#__PURE__*/function (_ref2) {
|
|
116
|
+
_inherits(DidCloseTextDocumentFeature, _ref2);
|
|
117
|
+
var _super2 = _createSuper(DidCloseTextDocumentFeature);
|
|
118
|
+
function DidCloseTextDocumentFeature(client, syncedDocuments, pendingTextDocumentChanges) {
|
|
119
|
+
var _this3;
|
|
120
|
+
_classCallCheck(this, DidCloseTextDocumentFeature);
|
|
121
|
+
_this3 = _super2.call(this, client, Workspace.onDidCloseTextDocument, DidCloseTextDocumentNotification.type, function () {
|
|
122
|
+
return client.middleware.didClose;
|
|
123
|
+
}, function (textDocument) {
|
|
124
|
+
return client.code2ProtocolConverter.asCloseTextDocumentParams(textDocument);
|
|
125
|
+
}, function (data) {
|
|
126
|
+
return data;
|
|
127
|
+
}, TextDocumentEventFeature.textDocumentFilter);
|
|
128
|
+
_this3._syncedDocuments = syncedDocuments;
|
|
129
|
+
_this3._pendingTextDocumentChanges = pendingTextDocumentChanges;
|
|
130
|
+
return _this3;
|
|
131
|
+
}
|
|
132
|
+
_createClass(DidCloseTextDocumentFeature, [{
|
|
133
|
+
key: "registrationType",
|
|
134
|
+
get: function get() {
|
|
135
|
+
return DidCloseTextDocumentNotification.type;
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
key: "fillClientCapabilities",
|
|
139
|
+
value: function fillClientCapabilities(capabilities) {
|
|
140
|
+
ensure(ensure(capabilities, 'textDocument'), 'synchronization').dynamicRegistration = true;
|
|
141
|
+
}
|
|
142
|
+
}, {
|
|
143
|
+
key: "initialize",
|
|
144
|
+
value: function initialize(capabilities, documentSelector) {
|
|
145
|
+
var textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
|
|
146
|
+
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.openClose) {
|
|
147
|
+
this.register({
|
|
148
|
+
id: UUID.generateUuid(),
|
|
149
|
+
registerOptions: {
|
|
150
|
+
documentSelector: documentSelector
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "callback",
|
|
157
|
+
value: function () {
|
|
158
|
+
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
159
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
160
|
+
while (1) switch (_context.prev = _context.next) {
|
|
161
|
+
case 0:
|
|
162
|
+
_context.next = 2;
|
|
163
|
+
return _get(_getPrototypeOf(DidCloseTextDocumentFeature.prototype), "callback", this).call(this, data);
|
|
164
|
+
case 2:
|
|
165
|
+
this._pendingTextDocumentChanges.delete(data.uri.toString());
|
|
166
|
+
case 3:
|
|
167
|
+
case "end":
|
|
168
|
+
return _context.stop();
|
|
169
|
+
}
|
|
170
|
+
}, _callee, this);
|
|
171
|
+
}));
|
|
172
|
+
function callback(_x) {
|
|
173
|
+
return _callback.apply(this, arguments);
|
|
174
|
+
}
|
|
175
|
+
return callback;
|
|
176
|
+
}()
|
|
177
|
+
}, {
|
|
178
|
+
key: "getTextDocument",
|
|
179
|
+
value: function getTextDocument(data) {
|
|
180
|
+
return data;
|
|
181
|
+
}
|
|
182
|
+
}, {
|
|
183
|
+
key: "notificationSent",
|
|
184
|
+
value: function notificationSent(textDocument, type, params) {
|
|
185
|
+
this._syncedDocuments.delete(textDocument.uri.toString());
|
|
186
|
+
_get(_getPrototypeOf(DidCloseTextDocumentFeature.prototype), "notificationSent", this).call(this, textDocument, type, params);
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "unregister",
|
|
190
|
+
value: function unregister(id) {
|
|
191
|
+
var _this4 = this;
|
|
192
|
+
var selector = this._selectors.get(id);
|
|
193
|
+
// The super call removed the selector from the map
|
|
194
|
+
// of selectors.
|
|
195
|
+
_get(_getPrototypeOf(DidCloseTextDocumentFeature.prototype), "unregister", this).call(this, id);
|
|
196
|
+
var selectors = this._selectors.values();
|
|
197
|
+
this._syncedDocuments.forEach(function (textDocument) {
|
|
198
|
+
if (Languages.match(selector, textDocument) > 0 && !_this4._selectorFilter(selectors, textDocument) && !_this4._client.hasDedicatedTextSynchronizationFeature(textDocument)) {
|
|
199
|
+
var middleware = _this4._client.middleware;
|
|
200
|
+
var didClose = function didClose(textDocument) {
|
|
201
|
+
return _this4._client.sendNotification(_this4._type, _this4._createParams(textDocument));
|
|
202
|
+
};
|
|
203
|
+
_this4._syncedDocuments.delete(textDocument.uri.toString());
|
|
204
|
+
(middleware.didClose ? middleware.didClose(textDocument, didClose) : didClose(textDocument)).catch(function (error) {
|
|
205
|
+
_this4._client.error("Sending document notification ".concat(_this4._type.method, " failed"), error);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}]);
|
|
211
|
+
return DidCloseTextDocumentFeature;
|
|
212
|
+
}(TextDocumentEventFeature);
|
|
213
|
+
export var DidChangeTextDocumentFeature = /*#__PURE__*/function (_ref3) {
|
|
214
|
+
_inherits(DidChangeTextDocumentFeature, _ref3);
|
|
215
|
+
var _super3 = _createSuper(DidChangeTextDocumentFeature);
|
|
216
|
+
function DidChangeTextDocumentFeature(client, pendingTextDocumentChanges) {
|
|
217
|
+
var _this5;
|
|
218
|
+
_classCallCheck(this, DidChangeTextDocumentFeature);
|
|
219
|
+
_this5 = _super3.call(this, client);
|
|
220
|
+
_this5.clear = function () {
|
|
221
|
+
_this5._pendingTextDocumentChanges.clear();
|
|
222
|
+
_this5._changeData.clear();
|
|
223
|
+
_this5._syncKind = TextDocumentSyncKind.None;
|
|
224
|
+
if (_this5._listener) {
|
|
225
|
+
_this5._listener.dispose();
|
|
226
|
+
_this5._listener = undefined;
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
_this5._changeData = new Map();
|
|
230
|
+
_this5._onNotificationSent = new EventEmitter();
|
|
231
|
+
_this5._onPendingChangeAdded = new EventEmitter();
|
|
232
|
+
_this5._pendingTextDocumentChanges = pendingTextDocumentChanges;
|
|
233
|
+
_this5._syncKind = TextDocumentSyncKind.None;
|
|
234
|
+
return _this5;
|
|
235
|
+
}
|
|
236
|
+
_createClass(DidChangeTextDocumentFeature, [{
|
|
237
|
+
key: "onNotificationSent",
|
|
238
|
+
get: function get() {
|
|
239
|
+
return this._onNotificationSent.event;
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
key: "onPendingChangeAdded",
|
|
243
|
+
get: function get() {
|
|
244
|
+
return this._onPendingChangeAdded.event;
|
|
245
|
+
}
|
|
246
|
+
}, {
|
|
247
|
+
key: "syncKind",
|
|
248
|
+
get: function get() {
|
|
249
|
+
return this._syncKind;
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
key: "registrationType",
|
|
253
|
+
get: function get() {
|
|
254
|
+
return DidChangeTextDocumentNotification.type;
|
|
255
|
+
}
|
|
256
|
+
}, {
|
|
257
|
+
key: "fillClientCapabilities",
|
|
258
|
+
value: function fillClientCapabilities(capabilities) {
|
|
259
|
+
ensure(ensure(capabilities, 'textDocument'), 'synchronization').dynamicRegistration = true;
|
|
260
|
+
}
|
|
261
|
+
}, {
|
|
262
|
+
key: "initialize",
|
|
263
|
+
value: function initialize(capabilities, documentSelector) {
|
|
264
|
+
var textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
|
|
265
|
+
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.change !== undefined && textDocumentSyncOptions.change !== TextDocumentSyncKind.None) {
|
|
266
|
+
this.register({
|
|
267
|
+
id: UUID.generateUuid(),
|
|
268
|
+
registerOptions: Object.assign({}, {
|
|
269
|
+
documentSelector: documentSelector
|
|
270
|
+
}, {
|
|
271
|
+
syncKind: textDocumentSyncOptions.change
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
key: "register",
|
|
278
|
+
value: function register(data) {
|
|
279
|
+
if (!data.registerOptions.documentSelector) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!this._listener) {
|
|
283
|
+
this._listener = Workspace.onDidChangeTextDocument(this.callback, this);
|
|
284
|
+
}
|
|
285
|
+
this._changeData.set(data.id, {
|
|
286
|
+
syncKind: data.registerOptions.syncKind,
|
|
287
|
+
documentSelector: this._client.protocol2CodeConverter.asDocumentSelector(data.registerOptions.documentSelector)
|
|
288
|
+
});
|
|
289
|
+
this.updateSyncKind(data.registerOptions.syncKind);
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
key: "getDocumentSelectors",
|
|
293
|
+
value: /*#__PURE__*/_regeneratorRuntime().mark(function getDocumentSelectors() {
|
|
294
|
+
var _iterator, _step, data;
|
|
295
|
+
return _regeneratorRuntime().wrap(function getDocumentSelectors$(_context2) {
|
|
296
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
297
|
+
case 0:
|
|
298
|
+
_iterator = _createForOfIteratorHelper(this._changeData.values());
|
|
299
|
+
_context2.prev = 1;
|
|
300
|
+
_iterator.s();
|
|
301
|
+
case 3:
|
|
302
|
+
if ((_step = _iterator.n()).done) {
|
|
303
|
+
_context2.next = 9;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
data = _step.value;
|
|
307
|
+
_context2.next = 7;
|
|
308
|
+
return data.documentSelector;
|
|
309
|
+
case 7:
|
|
310
|
+
_context2.next = 3;
|
|
311
|
+
break;
|
|
312
|
+
case 9:
|
|
313
|
+
_context2.next = 14;
|
|
314
|
+
break;
|
|
315
|
+
case 11:
|
|
316
|
+
_context2.prev = 11;
|
|
317
|
+
_context2.t0 = _context2["catch"](1);
|
|
318
|
+
_iterator.e(_context2.t0);
|
|
319
|
+
case 14:
|
|
320
|
+
_context2.prev = 14;
|
|
321
|
+
_iterator.f();
|
|
322
|
+
return _context2.finish(14);
|
|
323
|
+
case 17:
|
|
324
|
+
case "end":
|
|
325
|
+
return _context2.stop();
|
|
326
|
+
}
|
|
327
|
+
}, getDocumentSelectors, this, [[1, 11, 14, 17]]);
|
|
328
|
+
})
|
|
329
|
+
}, {
|
|
330
|
+
key: "callback",
|
|
331
|
+
value: function () {
|
|
332
|
+
var _callback2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {
|
|
333
|
+
var _this6 = this;
|
|
334
|
+
var uri, version, promises, _iterator2, _step2, _loop;
|
|
335
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context6) {
|
|
336
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
337
|
+
case 0:
|
|
338
|
+
if (!(event.contentChanges.length === 0)) {
|
|
339
|
+
_context6.next = 2;
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
return _context6.abrupt("return");
|
|
343
|
+
case 2:
|
|
344
|
+
// We need to capture the URI and version here since they might change on the text document
|
|
345
|
+
// until we reach did `didChange` call since the middleware support async execution.
|
|
346
|
+
uri = event.document.uri;
|
|
347
|
+
version = event.document.version;
|
|
348
|
+
promises = [];
|
|
349
|
+
_iterator2 = _createForOfIteratorHelper(this._changeData.values());
|
|
350
|
+
_context6.prev = 6;
|
|
351
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
352
|
+
var changeData, middleware, didChange, _didChange;
|
|
353
|
+
return _regeneratorRuntime().wrap(function _loop$(_context5) {
|
|
354
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
355
|
+
case 0:
|
|
356
|
+
changeData = _step2.value;
|
|
357
|
+
if (Languages.match(changeData.documentSelector, event.document) > 0 && !_this6._client.hasDedicatedTextSynchronizationFeature(event.document)) {
|
|
358
|
+
middleware = _this6._client.middleware;
|
|
359
|
+
if (changeData.syncKind === TextDocumentSyncKind.Incremental) {
|
|
360
|
+
didChange = /*#__PURE__*/function () {
|
|
361
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
|
|
362
|
+
var params;
|
|
363
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
364
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
365
|
+
case 0:
|
|
366
|
+
params = _this6._client.code2ProtocolConverter.asChangeTextDocumentParams(event, uri, version);
|
|
367
|
+
_context3.next = 3;
|
|
368
|
+
return _this6._client.sendNotification(DidChangeTextDocumentNotification.type, params);
|
|
369
|
+
case 3:
|
|
370
|
+
_this6.notificationSent(event.document, DidChangeTextDocumentNotification.type, params);
|
|
371
|
+
case 4:
|
|
372
|
+
case "end":
|
|
373
|
+
return _context3.stop();
|
|
374
|
+
}
|
|
375
|
+
}, _callee2);
|
|
376
|
+
}));
|
|
377
|
+
return function didChange(_x3) {
|
|
378
|
+
return _ref4.apply(this, arguments);
|
|
379
|
+
};
|
|
380
|
+
}();
|
|
381
|
+
promises.push(middleware.didChange ? middleware.didChange(event, function (event) {
|
|
382
|
+
return didChange(event);
|
|
383
|
+
}) : didChange(event));
|
|
384
|
+
} else if (changeData.syncKind === TextDocumentSyncKind.Full) {
|
|
385
|
+
_didChange = /*#__PURE__*/function () {
|
|
386
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(event) {
|
|
387
|
+
var eventUri;
|
|
388
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
389
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
390
|
+
case 0:
|
|
391
|
+
eventUri = event.document.uri.toString();
|
|
392
|
+
_this6._pendingTextDocumentChanges.set(eventUri, event.document);
|
|
393
|
+
_this6._onPendingChangeAdded.fire();
|
|
394
|
+
case 3:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context4.stop();
|
|
397
|
+
}
|
|
398
|
+
}, _callee3);
|
|
399
|
+
}));
|
|
400
|
+
return function _didChange(_x4) {
|
|
401
|
+
return _ref5.apply(this, arguments);
|
|
402
|
+
};
|
|
403
|
+
}();
|
|
404
|
+
promises.push(middleware.didChange ? middleware.didChange(event, function (event) {
|
|
405
|
+
return _didChange(event);
|
|
406
|
+
}) : _didChange(event));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
case 2:
|
|
410
|
+
case "end":
|
|
411
|
+
return _context5.stop();
|
|
412
|
+
}
|
|
413
|
+
}, _loop);
|
|
414
|
+
});
|
|
415
|
+
_iterator2.s();
|
|
416
|
+
case 9:
|
|
417
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
418
|
+
_context6.next = 13;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
return _context6.delegateYield(_loop(), "t0", 11);
|
|
422
|
+
case 11:
|
|
423
|
+
_context6.next = 9;
|
|
424
|
+
break;
|
|
425
|
+
case 13:
|
|
426
|
+
_context6.next = 18;
|
|
427
|
+
break;
|
|
428
|
+
case 15:
|
|
429
|
+
_context6.prev = 15;
|
|
430
|
+
_context6.t1 = _context6["catch"](6);
|
|
431
|
+
_iterator2.e(_context6.t1);
|
|
432
|
+
case 18:
|
|
433
|
+
_context6.prev = 18;
|
|
434
|
+
_iterator2.f();
|
|
435
|
+
return _context6.finish(18);
|
|
436
|
+
case 21:
|
|
437
|
+
return _context6.abrupt("return", Promise.all(promises).then(undefined, function (error) {
|
|
438
|
+
_this6._client.error("Sending document notification ".concat(DidChangeTextDocumentNotification.type.method, " failed"), error);
|
|
439
|
+
throw error;
|
|
440
|
+
}));
|
|
441
|
+
case 22:
|
|
442
|
+
case "end":
|
|
443
|
+
return _context6.stop();
|
|
444
|
+
}
|
|
445
|
+
}, _callee4, this, [[6, 15, 18, 21]]);
|
|
446
|
+
}));
|
|
447
|
+
function callback(_x2) {
|
|
448
|
+
return _callback2.apply(this, arguments);
|
|
449
|
+
}
|
|
450
|
+
return callback;
|
|
451
|
+
}()
|
|
452
|
+
}, {
|
|
453
|
+
key: "notificationSent",
|
|
454
|
+
value: function notificationSent(textDocument, type, params) {
|
|
455
|
+
this._onNotificationSent.fire({
|
|
456
|
+
textDocument: textDocument,
|
|
457
|
+
type: type,
|
|
458
|
+
params: params
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}, {
|
|
462
|
+
key: "unregister",
|
|
463
|
+
value: function unregister(id) {
|
|
464
|
+
this._changeData.delete(id);
|
|
465
|
+
if (this._changeData.size === 0) {
|
|
466
|
+
if (this._listener) {
|
|
467
|
+
this._listener.dispose();
|
|
468
|
+
this._listener = undefined;
|
|
469
|
+
}
|
|
470
|
+
this._syncKind = TextDocumentSyncKind.None;
|
|
471
|
+
} else {
|
|
472
|
+
this._syncKind = TextDocumentSyncKind.None;
|
|
473
|
+
var _iterator3 = _createForOfIteratorHelper(this._changeData.values()),
|
|
474
|
+
_step3;
|
|
475
|
+
try {
|
|
476
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
477
|
+
var changeData = _step3.value;
|
|
478
|
+
this.updateSyncKind(changeData.syncKind);
|
|
479
|
+
if (this._syncKind === TextDocumentSyncKind.Full) {
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
} catch (err) {
|
|
484
|
+
_iterator3.e(err);
|
|
485
|
+
} finally {
|
|
486
|
+
_iterator3.f();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}, {
|
|
491
|
+
key: "getPendingDocumentChanges",
|
|
492
|
+
value: function getPendingDocumentChanges(excludes) {
|
|
493
|
+
if (this._pendingTextDocumentChanges.size === 0) {
|
|
494
|
+
return [];
|
|
495
|
+
}
|
|
496
|
+
var result;
|
|
497
|
+
if (excludes.size === 0) {
|
|
498
|
+
result = Array.from(this._pendingTextDocumentChanges.values());
|
|
499
|
+
this._pendingTextDocumentChanges.clear();
|
|
500
|
+
} else {
|
|
501
|
+
result = [];
|
|
502
|
+
var _iterator4 = _createForOfIteratorHelper(this._pendingTextDocumentChanges),
|
|
503
|
+
_step4;
|
|
504
|
+
try {
|
|
505
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
506
|
+
var entry = _step4.value;
|
|
507
|
+
if (!excludes.has(entry[0])) {
|
|
508
|
+
result.push(entry[1]);
|
|
509
|
+
this._pendingTextDocumentChanges.delete(entry[0]);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
} catch (err) {
|
|
513
|
+
_iterator4.e(err);
|
|
514
|
+
} finally {
|
|
515
|
+
_iterator4.f();
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return result;
|
|
519
|
+
}
|
|
520
|
+
}, {
|
|
521
|
+
key: "getProvider",
|
|
522
|
+
value: function getProvider(document) {
|
|
523
|
+
var _this7 = this;
|
|
524
|
+
var _iterator5 = _createForOfIteratorHelper(this._changeData.values()),
|
|
525
|
+
_step5;
|
|
526
|
+
try {
|
|
527
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
528
|
+
var changeData = _step5.value;
|
|
529
|
+
if (Languages.match(changeData.documentSelector, document) > 0) {
|
|
530
|
+
return {
|
|
531
|
+
send: function send(event) {
|
|
532
|
+
return _this7.callback(event);
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
} catch (err) {
|
|
538
|
+
_iterator5.e(err);
|
|
539
|
+
} finally {
|
|
540
|
+
_iterator5.f();
|
|
541
|
+
}
|
|
542
|
+
return undefined;
|
|
543
|
+
}
|
|
544
|
+
}, {
|
|
545
|
+
key: "updateSyncKind",
|
|
546
|
+
value: function updateSyncKind(syncKind) {
|
|
547
|
+
if (this._syncKind === TextDocumentSyncKind.Full) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
switch (syncKind) {
|
|
551
|
+
case TextDocumentSyncKind.Full:
|
|
552
|
+
this._syncKind = syncKind;
|
|
553
|
+
break;
|
|
554
|
+
case TextDocumentSyncKind.Incremental:
|
|
555
|
+
if (this._syncKind === TextDocumentSyncKind.None) {
|
|
556
|
+
this._syncKind = TextDocumentSyncKind.Incremental;
|
|
557
|
+
}
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}]);
|
|
562
|
+
return DidChangeTextDocumentFeature;
|
|
563
|
+
}(DynamicDocumentFeature);
|
|
564
|
+
export var WillSaveFeature = /*#__PURE__*/function (_TextDocumentEventFea) {
|
|
565
|
+
_inherits(WillSaveFeature, _TextDocumentEventFea);
|
|
566
|
+
var _super4 = _createSuper(WillSaveFeature);
|
|
567
|
+
function WillSaveFeature(client) {
|
|
568
|
+
_classCallCheck(this, WillSaveFeature);
|
|
569
|
+
return _super4.call(this, client, Workspace.onWillSaveTextDocument, WillSaveTextDocumentNotification.type, function () {
|
|
570
|
+
return client.middleware.willSave;
|
|
571
|
+
}, function (willSaveEvent) {
|
|
572
|
+
return client.code2ProtocolConverter.asWillSaveTextDocumentParams(willSaveEvent);
|
|
573
|
+
}, function (event) {
|
|
574
|
+
return event.document;
|
|
575
|
+
}, function (selectors, willSaveEvent) {
|
|
576
|
+
return TextDocumentEventFeature.textDocumentFilter(selectors, willSaveEvent.document);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
_createClass(WillSaveFeature, [{
|
|
580
|
+
key: "registrationType",
|
|
581
|
+
get: function get() {
|
|
582
|
+
return WillSaveTextDocumentNotification.type;
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
key: "fillClientCapabilities",
|
|
586
|
+
value: function fillClientCapabilities(capabilities) {
|
|
587
|
+
var value = ensure(ensure(capabilities, 'textDocument'), 'synchronization');
|
|
588
|
+
value.willSave = true;
|
|
589
|
+
}
|
|
590
|
+
}, {
|
|
591
|
+
key: "initialize",
|
|
592
|
+
value: function initialize(capabilities, documentSelector) {
|
|
593
|
+
var textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
|
|
594
|
+
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.willSave) {
|
|
595
|
+
this.register({
|
|
596
|
+
id: UUID.generateUuid(),
|
|
597
|
+
registerOptions: {
|
|
598
|
+
documentSelector: documentSelector
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}, {
|
|
604
|
+
key: "getTextDocument",
|
|
605
|
+
value: function getTextDocument(data) {
|
|
606
|
+
return data.document;
|
|
607
|
+
}
|
|
608
|
+
}]);
|
|
609
|
+
return WillSaveFeature;
|
|
610
|
+
}(TextDocumentEventFeature);
|
|
611
|
+
export var WillSaveWaitUntilFeature = /*#__PURE__*/function (_DynamicDocumentFeatu) {
|
|
612
|
+
_inherits(WillSaveWaitUntilFeature, _DynamicDocumentFeatu);
|
|
613
|
+
var _super5 = _createSuper(WillSaveWaitUntilFeature);
|
|
614
|
+
function WillSaveWaitUntilFeature(client) {
|
|
615
|
+
var _this8;
|
|
616
|
+
_classCallCheck(this, WillSaveWaitUntilFeature);
|
|
617
|
+
_this8 = _super5.call(this, client);
|
|
618
|
+
_this8._selectors = new Map();
|
|
619
|
+
return _this8;
|
|
620
|
+
}
|
|
621
|
+
_createClass(WillSaveWaitUntilFeature, [{
|
|
622
|
+
key: "getDocumentSelectors",
|
|
623
|
+
value: function getDocumentSelectors() {
|
|
624
|
+
return this._selectors.values();
|
|
625
|
+
}
|
|
626
|
+
}, {
|
|
627
|
+
key: "registrationType",
|
|
628
|
+
get: function get() {
|
|
629
|
+
return WillSaveTextDocumentWaitUntilRequest.type;
|
|
630
|
+
}
|
|
631
|
+
}, {
|
|
632
|
+
key: "fillClientCapabilities",
|
|
633
|
+
value: function fillClientCapabilities(capabilities) {
|
|
634
|
+
var value = ensure(ensure(capabilities, 'textDocument'), 'synchronization');
|
|
635
|
+
value.willSaveWaitUntil = true;
|
|
636
|
+
}
|
|
637
|
+
}, {
|
|
638
|
+
key: "initialize",
|
|
639
|
+
value: function initialize(capabilities, documentSelector) {
|
|
640
|
+
var textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
|
|
641
|
+
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.willSaveWaitUntil) {
|
|
642
|
+
this.register({
|
|
643
|
+
id: UUID.generateUuid(),
|
|
644
|
+
registerOptions: {
|
|
645
|
+
documentSelector: documentSelector
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}, {
|
|
651
|
+
key: "register",
|
|
652
|
+
value: function register(data) {
|
|
653
|
+
if (!data.registerOptions.documentSelector) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
if (!this._listener) {
|
|
657
|
+
this._listener = Workspace.onWillSaveTextDocument(this.callback, this);
|
|
658
|
+
}
|
|
659
|
+
this._selectors.set(data.id, this._client.protocol2CodeConverter.asDocumentSelector(data.registerOptions.documentSelector));
|
|
660
|
+
}
|
|
661
|
+
}, {
|
|
662
|
+
key: "callback",
|
|
663
|
+
value: function callback(event) {
|
|
664
|
+
var _this9 = this;
|
|
665
|
+
if (TextDocumentEventFeature.textDocumentFilter(this._selectors.values(), event.document) && !this._client.hasDedicatedTextSynchronizationFeature(event.document)) {
|
|
666
|
+
var middleware = this._client.middleware;
|
|
667
|
+
var willSaveWaitUntil = function willSaveWaitUntil(event) {
|
|
668
|
+
return _this9._client.sendRequest(WillSaveTextDocumentWaitUntilRequest.type, _this9._client.code2ProtocolConverter.asWillSaveTextDocumentParams(event)).then( /*#__PURE__*/function () {
|
|
669
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(edits) {
|
|
670
|
+
var vEdits;
|
|
671
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context7) {
|
|
672
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
673
|
+
case 0:
|
|
674
|
+
_context7.next = 2;
|
|
675
|
+
return _this9._client.protocol2CodeConverter.asTextEdits(edits);
|
|
676
|
+
case 2:
|
|
677
|
+
vEdits = _context7.sent;
|
|
678
|
+
return _context7.abrupt("return", vEdits === undefined ? [] : vEdits);
|
|
679
|
+
case 4:
|
|
680
|
+
case "end":
|
|
681
|
+
return _context7.stop();
|
|
682
|
+
}
|
|
683
|
+
}, _callee5);
|
|
684
|
+
}));
|
|
685
|
+
return function (_x5) {
|
|
686
|
+
return _ref6.apply(this, arguments);
|
|
687
|
+
};
|
|
688
|
+
}());
|
|
689
|
+
};
|
|
690
|
+
event.waitUntil(middleware.willSaveWaitUntil ? middleware.willSaveWaitUntil(event, willSaveWaitUntil) : willSaveWaitUntil(event));
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}, {
|
|
694
|
+
key: "unregister",
|
|
695
|
+
value: function unregister(id) {
|
|
696
|
+
this._selectors.delete(id);
|
|
697
|
+
if (this._selectors.size === 0 && this._listener) {
|
|
698
|
+
this._listener.dispose();
|
|
699
|
+
this._listener = undefined;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}, {
|
|
703
|
+
key: "clear",
|
|
704
|
+
value: function clear() {
|
|
705
|
+
this._selectors.clear();
|
|
706
|
+
if (this._listener) {
|
|
707
|
+
this._listener.dispose();
|
|
708
|
+
this._listener = undefined;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}]);
|
|
712
|
+
return WillSaveWaitUntilFeature;
|
|
713
|
+
}(DynamicDocumentFeature);
|
|
714
|
+
export var DidSaveTextDocumentFeature = /*#__PURE__*/function (_ref7) {
|
|
715
|
+
_inherits(DidSaveTextDocumentFeature, _ref7);
|
|
716
|
+
var _super6 = _createSuper(DidSaveTextDocumentFeature);
|
|
717
|
+
function DidSaveTextDocumentFeature(client) {
|
|
718
|
+
var _this10;
|
|
719
|
+
_classCallCheck(this, DidSaveTextDocumentFeature);
|
|
720
|
+
_this10 = _super6.call(this, client, Workspace.onDidSaveTextDocument, DidSaveTextDocumentNotification.type, function () {
|
|
721
|
+
return client.middleware.didSave;
|
|
722
|
+
}, function (textDocument) {
|
|
723
|
+
return client.code2ProtocolConverter.asSaveTextDocumentParams(textDocument, _this10._includeText);
|
|
724
|
+
}, function (data) {
|
|
725
|
+
return data;
|
|
726
|
+
}, TextDocumentEventFeature.textDocumentFilter);
|
|
727
|
+
_this10._includeText = false;
|
|
728
|
+
return _this10;
|
|
729
|
+
}
|
|
730
|
+
_createClass(DidSaveTextDocumentFeature, [{
|
|
731
|
+
key: "registrationType",
|
|
732
|
+
get: function get() {
|
|
733
|
+
return DidSaveTextDocumentNotification.type;
|
|
734
|
+
}
|
|
735
|
+
}, {
|
|
736
|
+
key: "fillClientCapabilities",
|
|
737
|
+
value: function fillClientCapabilities(capabilities) {
|
|
738
|
+
ensure(ensure(capabilities, 'textDocument'), 'synchronization').didSave = true;
|
|
739
|
+
}
|
|
740
|
+
}, {
|
|
741
|
+
key: "initialize",
|
|
742
|
+
value: function initialize(capabilities, documentSelector) {
|
|
743
|
+
var textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
|
|
744
|
+
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.save) {
|
|
745
|
+
var saveOptions = typeof textDocumentSyncOptions.save === 'boolean' ? {
|
|
746
|
+
includeText: false
|
|
747
|
+
} : {
|
|
748
|
+
includeText: !!textDocumentSyncOptions.save.includeText
|
|
749
|
+
};
|
|
750
|
+
this.register({
|
|
751
|
+
id: UUID.generateUuid(),
|
|
752
|
+
registerOptions: Object.assign({}, {
|
|
753
|
+
documentSelector: documentSelector
|
|
754
|
+
}, saveOptions)
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}, {
|
|
759
|
+
key: "register",
|
|
760
|
+
value: function register(data) {
|
|
761
|
+
this._includeText = !!data.registerOptions.includeText;
|
|
762
|
+
_get(_getPrototypeOf(DidSaveTextDocumentFeature.prototype), "register", this).call(this, data);
|
|
763
|
+
}
|
|
764
|
+
}, {
|
|
765
|
+
key: "getTextDocument",
|
|
766
|
+
value: function getTextDocument(data) {
|
|
767
|
+
return data;
|
|
768
|
+
}
|
|
769
|
+
}]);
|
|
770
|
+
return DidSaveTextDocumentFeature;
|
|
771
|
+
}(TextDocumentEventFeature);
|