@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,1613 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
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); }
|
|
12
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
+
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; }
|
|
15
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
+
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); } }
|
|
17
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
21
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
22
|
+
/* --------------------------------------------------------------------------------------------
|
|
23
|
+
* Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
24
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
25
|
+
* ------------------------------------------------------------------------------------------ */
|
|
26
|
+
|
|
27
|
+
import * as ls from '@difizen/vscode-languageserver-protocol';
|
|
28
|
+
import { CompletionTriggerKind, InsertTextFormat, Diagnostic, CompletionItemKind, LocationLink, DocumentHighlightKind, CodeActionContext, DiagnosticSeverity, Command, CodeLens, DocumentLink, MarkupContent, FoldingRangeKind, MarkupKind, SymbolKind, DocumentSymbol, SignatureHelpTriggerKind, AnnotatedTextEdit, InlayHint } from '@difizen/vscode-languageserver-protocol';
|
|
29
|
+
import * as Is from "./hostTypeUtil.js";
|
|
30
|
+
export var ProtocolDocumentLink;
|
|
31
|
+
(function (_ProtocolDocumentLink) {
|
|
32
|
+
function is(item) {
|
|
33
|
+
return !!item && 'data' in item;
|
|
34
|
+
}
|
|
35
|
+
_ProtocolDocumentLink.is = is;
|
|
36
|
+
})(ProtocolDocumentLink || (ProtocolDocumentLink = {}));
|
|
37
|
+
export var ProtocolCodeLens;
|
|
38
|
+
(function (_ProtocolCodeLens) {
|
|
39
|
+
function is(item) {
|
|
40
|
+
return !!item && 'data' in item;
|
|
41
|
+
}
|
|
42
|
+
_ProtocolCodeLens.is = is;
|
|
43
|
+
})(ProtocolCodeLens || (ProtocolCodeLens = {}));
|
|
44
|
+
export var ProtocolCompletionItem;
|
|
45
|
+
(function (_ProtocolCompletionItem) {
|
|
46
|
+
function is(item) {
|
|
47
|
+
return !!item && 'data' in item;
|
|
48
|
+
}
|
|
49
|
+
_ProtocolCompletionItem.is = is;
|
|
50
|
+
})(ProtocolCompletionItem || (ProtocolCompletionItem = {}));
|
|
51
|
+
export var ProtocolCodeAction;
|
|
52
|
+
(function (_ProtocolCodeAction) {
|
|
53
|
+
function is(item) {
|
|
54
|
+
return !!item && 'data' in item;
|
|
55
|
+
}
|
|
56
|
+
_ProtocolCodeAction.is = is;
|
|
57
|
+
})(ProtocolCodeAction || (ProtocolCodeAction = {}));
|
|
58
|
+
export var ProtocolInlayHint;
|
|
59
|
+
(function (_ProtocolInlayHint) {
|
|
60
|
+
function is(item) {
|
|
61
|
+
return !!item && 'data' in item;
|
|
62
|
+
}
|
|
63
|
+
_ProtocolInlayHint.is = is;
|
|
64
|
+
})(ProtocolInlayHint || (ProtocolInlayHint = {}));
|
|
65
|
+
function isRangeReplace(v) {
|
|
66
|
+
return v.insert !== undefined;
|
|
67
|
+
}
|
|
68
|
+
export var MonacoToProtocolConverter = /*#__PURE__*/function () {
|
|
69
|
+
function MonacoToProtocolConverter(_monaco) {
|
|
70
|
+
_classCallCheck(this, MonacoToProtocolConverter);
|
|
71
|
+
this._monaco = _monaco;
|
|
72
|
+
}
|
|
73
|
+
_createClass(MonacoToProtocolConverter, [{
|
|
74
|
+
key: "asPosition",
|
|
75
|
+
value: function asPosition(lineNumber, column) {
|
|
76
|
+
var line = lineNumber === undefined || lineNumber === null ? undefined : lineNumber - 1;
|
|
77
|
+
var character = column === undefined || column === null ? undefined : column - 1;
|
|
78
|
+
return {
|
|
79
|
+
line: line,
|
|
80
|
+
character: character
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "asRange",
|
|
85
|
+
value: function asRange(range) {
|
|
86
|
+
if (range === undefined) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
if (range === null) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
if (isRangeReplace(range)) {
|
|
93
|
+
return this.asRange(range.insert);
|
|
94
|
+
} else {
|
|
95
|
+
var start = this.asPosition(range.startLineNumber, range.startColumn);
|
|
96
|
+
var end = this.asPosition(range.endLineNumber, range.endColumn);
|
|
97
|
+
return {
|
|
98
|
+
start: start,
|
|
99
|
+
end: end
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "asLocation",
|
|
105
|
+
value: function asLocation(item) {
|
|
106
|
+
if (!item) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
var uri = item.uri.toString();
|
|
110
|
+
var range = this.asRange(item.range);
|
|
111
|
+
return {
|
|
112
|
+
uri: uri,
|
|
113
|
+
range: range
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "asTextDocumentIdentifier",
|
|
118
|
+
value: function asTextDocumentIdentifier(model) {
|
|
119
|
+
return {
|
|
120
|
+
uri: model.uri.toString()
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "asTextDocumentPositionParams",
|
|
125
|
+
value: function asTextDocumentPositionParams(model, position) {
|
|
126
|
+
return {
|
|
127
|
+
textDocument: this.asTextDocumentIdentifier(model),
|
|
128
|
+
position: this.asPosition(position.lineNumber, position.column)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "asCompletionParams",
|
|
133
|
+
value: function asCompletionParams(model, position, context) {
|
|
134
|
+
return Object.assign(this.asTextDocumentPositionParams(model, position), {
|
|
135
|
+
context: this.asCompletionContext(context)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
key: "asCompletionContext",
|
|
140
|
+
value: function asCompletionContext(context) {
|
|
141
|
+
return {
|
|
142
|
+
triggerKind: this.asCompletionTriggerKind(context.triggerKind),
|
|
143
|
+
triggerCharacter: context.triggerCharacter
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "asSignatureHelpContext",
|
|
148
|
+
value: function asSignatureHelpContext(context) {
|
|
149
|
+
return {
|
|
150
|
+
triggerKind: this.asSignatureHelpTriggerKind(context.triggerKind),
|
|
151
|
+
triggerCharacter: context.triggerCharacter,
|
|
152
|
+
isRetrigger: context.isRetrigger,
|
|
153
|
+
activeSignatureHelp: this.asSignatureHelp(context.activeSignatureHelp)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "asSignatureHelp",
|
|
158
|
+
value: function asSignatureHelp(signatureHelp) {
|
|
159
|
+
var _this = this;
|
|
160
|
+
if (signatureHelp === undefined) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
signatures: signatureHelp.signatures.map(function (signatureInfo) {
|
|
165
|
+
return _this.asSignatureInformation(signatureInfo);
|
|
166
|
+
}),
|
|
167
|
+
activeParameter: signatureHelp.activeParameter,
|
|
168
|
+
activeSignature: signatureHelp.activeSignature
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: "asSignatureInformation",
|
|
173
|
+
value: function asSignatureInformation(signatureInformation) {
|
|
174
|
+
var _this2 = this;
|
|
175
|
+
return {
|
|
176
|
+
documentation: this.asMarkupContent(signatureInformation.documentation),
|
|
177
|
+
label: signatureInformation.label,
|
|
178
|
+
parameters: signatureInformation.parameters.map(function (paramInfo) {
|
|
179
|
+
return _this2.asParameterInformation(paramInfo);
|
|
180
|
+
}),
|
|
181
|
+
activeParameter: signatureInformation.activeParameter
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "asParameterInformation",
|
|
186
|
+
value: function asParameterInformation(parameterInformation) {
|
|
187
|
+
return {
|
|
188
|
+
documentation: this.asMarkupContent(parameterInformation.documentation),
|
|
189
|
+
label: parameterInformation.label
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
key: "asMarkupContent",
|
|
194
|
+
value: function asMarkupContent(markupContent) {
|
|
195
|
+
if (markupContent === undefined) {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
if (typeof markupContent === 'string') {
|
|
199
|
+
return markupContent;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
kind: MarkupKind.Markdown,
|
|
203
|
+
value: markupContent.value
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
key: "asSignatureHelpTriggerKind",
|
|
208
|
+
value: function asSignatureHelpTriggerKind(triggerKind) {
|
|
209
|
+
switch (triggerKind) {
|
|
210
|
+
case this._monaco.languages.SignatureHelpTriggerKind.ContentChange:
|
|
211
|
+
return SignatureHelpTriggerKind.ContentChange;
|
|
212
|
+
case this._monaco.languages.SignatureHelpTriggerKind.TriggerCharacter:
|
|
213
|
+
return SignatureHelpTriggerKind.TriggerCharacter;
|
|
214
|
+
default:
|
|
215
|
+
return SignatureHelpTriggerKind.Invoked;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "asCompletionTriggerKind",
|
|
220
|
+
value: function asCompletionTriggerKind(triggerKind) {
|
|
221
|
+
switch (triggerKind) {
|
|
222
|
+
case this._monaco.languages.CompletionTriggerKind.TriggerCharacter:
|
|
223
|
+
return CompletionTriggerKind.TriggerCharacter;
|
|
224
|
+
case this._monaco.languages.CompletionTriggerKind.TriggerForIncompleteCompletions:
|
|
225
|
+
return CompletionTriggerKind.TriggerForIncompleteCompletions;
|
|
226
|
+
default:
|
|
227
|
+
return CompletionTriggerKind.Invoked;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}, {
|
|
231
|
+
key: "asCompletionItem",
|
|
232
|
+
value: function asCompletionItem(item) {
|
|
233
|
+
var result = {
|
|
234
|
+
label: item.label
|
|
235
|
+
};
|
|
236
|
+
var protocolItem = ProtocolCompletionItem.is(item) ? item : undefined;
|
|
237
|
+
if (item.detail) {
|
|
238
|
+
result.detail = item.detail;
|
|
239
|
+
}
|
|
240
|
+
if (item.documentation) {
|
|
241
|
+
if (typeof item.documentation === 'string') {
|
|
242
|
+
result.documentation = item.documentation;
|
|
243
|
+
} else {
|
|
244
|
+
var _protocolItem$documen;
|
|
245
|
+
result.documentation = this.asDocumentation((_protocolItem$documen = protocolItem === null || protocolItem === void 0 ? void 0 : protocolItem.documentationFormat) !== null && _protocolItem$documen !== void 0 ? _protocolItem$documen : MarkupKind.Markdown, item.documentation);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (item.filterText) {
|
|
249
|
+
result.filterText = item.filterText;
|
|
250
|
+
}
|
|
251
|
+
this.fillPrimaryInsertText(result, item);
|
|
252
|
+
if (Is.isNumber(item.kind)) {
|
|
253
|
+
result.kind = this.asCompletionItemKind(item.kind, protocolItem && protocolItem.originalItemKind);
|
|
254
|
+
}
|
|
255
|
+
if (item.sortText) {
|
|
256
|
+
result.sortText = item.sortText;
|
|
257
|
+
}
|
|
258
|
+
if (item.additionalTextEdits) {
|
|
259
|
+
result.additionalTextEdits = this.asTextEdits(item.additionalTextEdits);
|
|
260
|
+
}
|
|
261
|
+
if (item.command) {
|
|
262
|
+
result.command = this.asCommand(item.command);
|
|
263
|
+
}
|
|
264
|
+
if (item.commitCharacters) {
|
|
265
|
+
result.commitCharacters = item.commitCharacters.slice();
|
|
266
|
+
}
|
|
267
|
+
if (item.command) {
|
|
268
|
+
result.command = this.asCommand(item.command);
|
|
269
|
+
}
|
|
270
|
+
if (item.preselect === true || item.preselect === false) {
|
|
271
|
+
result.preselect = item.preselect;
|
|
272
|
+
}
|
|
273
|
+
if (protocolItem) {
|
|
274
|
+
if (protocolItem.data !== undefined) {
|
|
275
|
+
result.data = protocolItem.data;
|
|
276
|
+
}
|
|
277
|
+
if (protocolItem.deprecated === true || protocolItem.deprecated === false) {
|
|
278
|
+
result.deprecated = protocolItem.deprecated;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (item.tags) {
|
|
282
|
+
var _item$tags;
|
|
283
|
+
result.tags = (_item$tags = item.tags) === null || _item$tags === void 0 ? void 0 : _item$tags.slice();
|
|
284
|
+
}
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
}, {
|
|
288
|
+
key: "asCompletionItemKind",
|
|
289
|
+
value: function asCompletionItemKind(value, original) {
|
|
290
|
+
if (original !== undefined) {
|
|
291
|
+
return original;
|
|
292
|
+
}
|
|
293
|
+
switch (value) {
|
|
294
|
+
case this._monaco.languages.CompletionItemKind.Method:
|
|
295
|
+
return CompletionItemKind.Method;
|
|
296
|
+
case this._monaco.languages.CompletionItemKind.Function:
|
|
297
|
+
return CompletionItemKind.Function;
|
|
298
|
+
case this._monaco.languages.CompletionItemKind.Constructor:
|
|
299
|
+
return CompletionItemKind.Constructor;
|
|
300
|
+
case this._monaco.languages.CompletionItemKind.Field:
|
|
301
|
+
return CompletionItemKind.Field;
|
|
302
|
+
case this._monaco.languages.CompletionItemKind.Variable:
|
|
303
|
+
return CompletionItemKind.Variable;
|
|
304
|
+
case this._monaco.languages.CompletionItemKind.Class:
|
|
305
|
+
return CompletionItemKind.Class;
|
|
306
|
+
case this._monaco.languages.CompletionItemKind.Struct:
|
|
307
|
+
return CompletionItemKind.Struct;
|
|
308
|
+
case this._monaco.languages.CompletionItemKind.Interface:
|
|
309
|
+
return CompletionItemKind.Interface;
|
|
310
|
+
case this._monaco.languages.CompletionItemKind.Module:
|
|
311
|
+
return CompletionItemKind.Module;
|
|
312
|
+
case this._monaco.languages.CompletionItemKind.Property:
|
|
313
|
+
return CompletionItemKind.Property;
|
|
314
|
+
case this._monaco.languages.CompletionItemKind.Event:
|
|
315
|
+
return CompletionItemKind.Event;
|
|
316
|
+
case this._monaco.languages.CompletionItemKind.Operator:
|
|
317
|
+
return CompletionItemKind.Operator;
|
|
318
|
+
case this._monaco.languages.CompletionItemKind.Unit:
|
|
319
|
+
return CompletionItemKind.Unit;
|
|
320
|
+
case this._monaco.languages.CompletionItemKind.Value:
|
|
321
|
+
return CompletionItemKind.Value;
|
|
322
|
+
case this._monaco.languages.CompletionItemKind.Constant:
|
|
323
|
+
return CompletionItemKind.Constant;
|
|
324
|
+
case this._monaco.languages.CompletionItemKind.Enum:
|
|
325
|
+
return CompletionItemKind.Enum;
|
|
326
|
+
case this._monaco.languages.CompletionItemKind.EnumMember:
|
|
327
|
+
return CompletionItemKind.EnumMember;
|
|
328
|
+
case this._monaco.languages.CompletionItemKind.Keyword:
|
|
329
|
+
return CompletionItemKind.Keyword;
|
|
330
|
+
case this._monaco.languages.CompletionItemKind.Text:
|
|
331
|
+
return CompletionItemKind.Text;
|
|
332
|
+
case this._monaco.languages.CompletionItemKind.Color:
|
|
333
|
+
return CompletionItemKind.Color;
|
|
334
|
+
case this._monaco.languages.CompletionItemKind.File:
|
|
335
|
+
return CompletionItemKind.File;
|
|
336
|
+
case this._monaco.languages.CompletionItemKind.Reference:
|
|
337
|
+
return CompletionItemKind.Reference;
|
|
338
|
+
case this._monaco.languages.CompletionItemKind.Customcolor:
|
|
339
|
+
return CompletionItemKind.Color;
|
|
340
|
+
case this._monaco.languages.CompletionItemKind.Folder:
|
|
341
|
+
return CompletionItemKind.Folder;
|
|
342
|
+
case this._monaco.languages.CompletionItemKind.TypeParameter:
|
|
343
|
+
return CompletionItemKind.TypeParameter;
|
|
344
|
+
case this._monaco.languages.CompletionItemKind.Snippet:
|
|
345
|
+
return CompletionItemKind.Snippet;
|
|
346
|
+
default:
|
|
347
|
+
return value + 1;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
351
|
+
key: "asDocumentation",
|
|
352
|
+
value: function asDocumentation(format, documentation) {
|
|
353
|
+
switch (format) {
|
|
354
|
+
case MarkupKind.PlainText:
|
|
355
|
+
return {
|
|
356
|
+
kind: format,
|
|
357
|
+
value: documentation
|
|
358
|
+
};
|
|
359
|
+
case MarkupKind.Markdown:
|
|
360
|
+
return {
|
|
361
|
+
kind: format,
|
|
362
|
+
value: documentation.value
|
|
363
|
+
};
|
|
364
|
+
default:
|
|
365
|
+
return "Unsupported Markup content received. Kind is: ".concat(format);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}, {
|
|
369
|
+
key: "fillPrimaryInsertText",
|
|
370
|
+
value: function fillPrimaryInsertText(target, source) {
|
|
371
|
+
var format = InsertTextFormat.PlainText;
|
|
372
|
+
var text;
|
|
373
|
+
var range;
|
|
374
|
+
if (source.insertTextRules !== undefined && (source.insertTextRules & this._monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet) === 0) {
|
|
375
|
+
format = InsertTextFormat.Snippet;
|
|
376
|
+
text = source.insertText;
|
|
377
|
+
}
|
|
378
|
+
target.insertTextFormat = format;
|
|
379
|
+
text = source.insertText;
|
|
380
|
+
if (source.range) {
|
|
381
|
+
range = this.asRange(source.range);
|
|
382
|
+
}
|
|
383
|
+
target.insertTextFormat = format;
|
|
384
|
+
if (source.fromEdit && text && range) {
|
|
385
|
+
target.textEdit = {
|
|
386
|
+
newText: text,
|
|
387
|
+
range: range
|
|
388
|
+
};
|
|
389
|
+
} else {
|
|
390
|
+
target.insertText = text;
|
|
391
|
+
}
|
|
392
|
+
target.insertTextMode = source.insertTextMode;
|
|
393
|
+
}
|
|
394
|
+
}, {
|
|
395
|
+
key: "asTextEdit",
|
|
396
|
+
value: function asTextEdit(edit) {
|
|
397
|
+
var range = this.asRange(edit.range);
|
|
398
|
+
return {
|
|
399
|
+
range: range,
|
|
400
|
+
newText: edit.text || ''
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}, {
|
|
404
|
+
key: "asTextEdits",
|
|
405
|
+
value: function asTextEdits(items) {
|
|
406
|
+
var _this3 = this;
|
|
407
|
+
if (!items) {
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
return items.map(function (item) {
|
|
411
|
+
return _this3.asTextEdit(item);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}, {
|
|
415
|
+
key: "asReferenceParams",
|
|
416
|
+
value: function asReferenceParams(model, position, options) {
|
|
417
|
+
return {
|
|
418
|
+
textDocument: this.asTextDocumentIdentifier(model),
|
|
419
|
+
position: this.asPosition(position.lineNumber, position.column),
|
|
420
|
+
context: {
|
|
421
|
+
includeDeclaration: options.includeDeclaration
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}, {
|
|
426
|
+
key: "asDocumentSymbolParams",
|
|
427
|
+
value: function asDocumentSymbolParams(model) {
|
|
428
|
+
return {
|
|
429
|
+
textDocument: this.asTextDocumentIdentifier(model)
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
key: "asCodeLensParams",
|
|
434
|
+
value: function asCodeLensParams(model) {
|
|
435
|
+
return {
|
|
436
|
+
textDocument: this.asTextDocumentIdentifier(model)
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
}, {
|
|
440
|
+
key: "asDiagnosticSeverity",
|
|
441
|
+
value: function asDiagnosticSeverity(value) {
|
|
442
|
+
switch (value) {
|
|
443
|
+
case this._monaco.MarkerSeverity.Error:
|
|
444
|
+
return DiagnosticSeverity.Error;
|
|
445
|
+
case this._monaco.MarkerSeverity.Warning:
|
|
446
|
+
return DiagnosticSeverity.Warning;
|
|
447
|
+
case this._monaco.MarkerSeverity.Info:
|
|
448
|
+
return DiagnosticSeverity.Information;
|
|
449
|
+
case this._monaco.MarkerSeverity.Hint:
|
|
450
|
+
return DiagnosticSeverity.Hint;
|
|
451
|
+
}
|
|
452
|
+
return undefined;
|
|
453
|
+
}
|
|
454
|
+
}, {
|
|
455
|
+
key: "asDiagnostic",
|
|
456
|
+
value: function asDiagnostic(marker) {
|
|
457
|
+
var range = this.asRange(new this._monaco.Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn));
|
|
458
|
+
var severity = this.asDiagnosticSeverity(marker.severity);
|
|
459
|
+
var diag = Diagnostic.create(range, marker.message, severity, marker.code, marker.source);
|
|
460
|
+
return diag;
|
|
461
|
+
}
|
|
462
|
+
}, {
|
|
463
|
+
key: "asDiagnostics",
|
|
464
|
+
value: function asDiagnostics(markers) {
|
|
465
|
+
var _this4 = this;
|
|
466
|
+
if (markers === void 0 || markers === null) {
|
|
467
|
+
return markers;
|
|
468
|
+
}
|
|
469
|
+
return markers.map(function (marker) {
|
|
470
|
+
return _this4.asDiagnostic(marker);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}, {
|
|
474
|
+
key: "asCodeActionContext",
|
|
475
|
+
value: function asCodeActionContext(context, diagnostics) {
|
|
476
|
+
if (context === void 0 || context === null) {
|
|
477
|
+
return context;
|
|
478
|
+
}
|
|
479
|
+
return CodeActionContext.create(diagnostics, Is.isString(context.only) ? [context.only] : undefined, context.trigger);
|
|
480
|
+
}
|
|
481
|
+
}, {
|
|
482
|
+
key: "asCodeActionParams",
|
|
483
|
+
value: function asCodeActionParams(model, range, context, diagnostics) {
|
|
484
|
+
return {
|
|
485
|
+
textDocument: this.asTextDocumentIdentifier(model),
|
|
486
|
+
range: this.asRange(range),
|
|
487
|
+
context: this.asCodeActionContext(context, diagnostics)
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
}, {
|
|
491
|
+
key: "asCommand",
|
|
492
|
+
value: function asCommand(item) {
|
|
493
|
+
if (item) {
|
|
494
|
+
var args = item.arguments || [];
|
|
495
|
+
return Command.create.apply(Command, [item.title, item.id].concat(_toConsumableArray(args)));
|
|
496
|
+
}
|
|
497
|
+
return undefined;
|
|
498
|
+
}
|
|
499
|
+
}, {
|
|
500
|
+
key: "asCodeLens",
|
|
501
|
+
value: function asCodeLens(item) {
|
|
502
|
+
var result = CodeLens.create(this.asRange(item.range));
|
|
503
|
+
if (item.command) {
|
|
504
|
+
result.command = this.asCommand(item.command);
|
|
505
|
+
}
|
|
506
|
+
if (ProtocolCodeLens.is(item)) {
|
|
507
|
+
if (item.data) {
|
|
508
|
+
result.data = item.data;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return result;
|
|
512
|
+
}
|
|
513
|
+
}, {
|
|
514
|
+
key: "asFormattingOptions",
|
|
515
|
+
value: function asFormattingOptions(options) {
|
|
516
|
+
return {
|
|
517
|
+
tabSize: options.tabSize,
|
|
518
|
+
insertSpaces: options.insertSpaces
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
}, {
|
|
522
|
+
key: "asDocumentFormattingParams",
|
|
523
|
+
value: function asDocumentFormattingParams(model, options) {
|
|
524
|
+
return {
|
|
525
|
+
textDocument: this.asTextDocumentIdentifier(model),
|
|
526
|
+
options: this.asFormattingOptions(options)
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
}, {
|
|
530
|
+
key: "asDocumentRangeFormattingParams",
|
|
531
|
+
value: function asDocumentRangeFormattingParams(model, range, options) {
|
|
532
|
+
return {
|
|
533
|
+
textDocument: this.asTextDocumentIdentifier(model),
|
|
534
|
+
range: this.asRange(range),
|
|
535
|
+
options: this.asFormattingOptions(options)
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
}, {
|
|
539
|
+
key: "asDocumentOnTypeFormattingParams",
|
|
540
|
+
value: function asDocumentOnTypeFormattingParams(model, position, ch, options) {
|
|
541
|
+
return {
|
|
542
|
+
textDocument: this.asTextDocumentIdentifier(model),
|
|
543
|
+
position: this.asPosition(position.lineNumber, position.column),
|
|
544
|
+
ch: ch,
|
|
545
|
+
options: this.asFormattingOptions(options)
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
}, {
|
|
549
|
+
key: "asRenameParams",
|
|
550
|
+
value: function asRenameParams(model, position, newName) {
|
|
551
|
+
return {
|
|
552
|
+
textDocument: this.asTextDocumentIdentifier(model),
|
|
553
|
+
position: this.asPosition(position.lineNumber, position.column),
|
|
554
|
+
newName: newName
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
}, {
|
|
558
|
+
key: "asDocumentLinkParams",
|
|
559
|
+
value: function asDocumentLinkParams(model) {
|
|
560
|
+
return {
|
|
561
|
+
textDocument: this.asTextDocumentIdentifier(model)
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
}, {
|
|
565
|
+
key: "asDocumentLink",
|
|
566
|
+
value: function asDocumentLink(item) {
|
|
567
|
+
var result = DocumentLink.create(this.asRange(item.range));
|
|
568
|
+
if (item.url) {
|
|
569
|
+
result.target = typeof item.url === 'string' ? item.url : item.url.toString();
|
|
570
|
+
}
|
|
571
|
+
if (ProtocolDocumentLink.is(item) && item.data) {
|
|
572
|
+
result.data = item.data;
|
|
573
|
+
}
|
|
574
|
+
if (item.tooltip) {
|
|
575
|
+
result.tooltip = item.tooltip;
|
|
576
|
+
}
|
|
577
|
+
return result;
|
|
578
|
+
}
|
|
579
|
+
}, {
|
|
580
|
+
key: "asCodeAction",
|
|
581
|
+
value: function asCodeAction(item) {
|
|
582
|
+
var result = {
|
|
583
|
+
title: item.title
|
|
584
|
+
};
|
|
585
|
+
var protocolCodeAction = ProtocolCodeAction.is(item) ? item : undefined;
|
|
586
|
+
if (Is.isNumber(item.kind)) {
|
|
587
|
+
result.kind = item.kind;
|
|
588
|
+
}
|
|
589
|
+
if (item.diagnostics) {
|
|
590
|
+
result.diagnostics = this.asDiagnostics(item.diagnostics);
|
|
591
|
+
}
|
|
592
|
+
if (item.edit) {
|
|
593
|
+
throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");
|
|
594
|
+
}
|
|
595
|
+
if (item.command) {
|
|
596
|
+
result.command = this.asCommand(item.command);
|
|
597
|
+
}
|
|
598
|
+
if (item.isPreferred !== undefined) {
|
|
599
|
+
result.isPreferred = item.isPreferred;
|
|
600
|
+
}
|
|
601
|
+
if (item.disabled) {
|
|
602
|
+
result.disabled = {
|
|
603
|
+
reason: item.disabled
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
if (protocolCodeAction) {
|
|
607
|
+
if (protocolCodeAction.data !== undefined) {
|
|
608
|
+
result.data = protocolCodeAction.data;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return result;
|
|
612
|
+
}
|
|
613
|
+
}, {
|
|
614
|
+
key: "asInlayHintLabelPart",
|
|
615
|
+
value: function asInlayHintLabelPart(part) {
|
|
616
|
+
return {
|
|
617
|
+
value: part.label,
|
|
618
|
+
command: this.asCommand(part.command),
|
|
619
|
+
location: this.asLocation(part.location),
|
|
620
|
+
tooltip: this.asMarkupContent(part.tooltip)
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
}, {
|
|
624
|
+
key: "asInlayHintLabel",
|
|
625
|
+
value: function asInlayHintLabel(label) {
|
|
626
|
+
var _this5 = this;
|
|
627
|
+
if (Array.isArray(label)) {
|
|
628
|
+
return label.map(function (part) {
|
|
629
|
+
return _this5.asInlayHintLabelPart(part);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
return label;
|
|
633
|
+
}
|
|
634
|
+
}, {
|
|
635
|
+
key: "asInlayHint",
|
|
636
|
+
value: function asInlayHint(item) {
|
|
637
|
+
var result = InlayHint.create(this.asPosition(item.position.lineNumber, item.position.column), this.asInlayHintLabel(item.label), item.kind);
|
|
638
|
+
if (ProtocolInlayHint.is(item)) {
|
|
639
|
+
if (item.data) {
|
|
640
|
+
result.data = item.data;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return result;
|
|
644
|
+
}
|
|
645
|
+
}]);
|
|
646
|
+
return MonacoToProtocolConverter;
|
|
647
|
+
}();
|
|
648
|
+
export var ProtocolToMonacoConverter = /*#__PURE__*/function () {
|
|
649
|
+
function ProtocolToMonacoConverter(_monaco) {
|
|
650
|
+
_classCallCheck(this, ProtocolToMonacoConverter);
|
|
651
|
+
this._monaco = _monaco;
|
|
652
|
+
}
|
|
653
|
+
_createClass(ProtocolToMonacoConverter, [{
|
|
654
|
+
key: "asResourceEdits",
|
|
655
|
+
value: function asResourceEdits(resource, edits, asMetadata, modelVersionId) {
|
|
656
|
+
var _this6 = this;
|
|
657
|
+
return edits.map(function (edit) {
|
|
658
|
+
return {
|
|
659
|
+
resource: resource,
|
|
660
|
+
textEdit: _this6.asTextEdit(edit),
|
|
661
|
+
versionId: modelVersionId,
|
|
662
|
+
metadata: AnnotatedTextEdit.is(edit) ? asMetadata(edit.annotationId) : undefined
|
|
663
|
+
};
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}, {
|
|
667
|
+
key: "asWorkspaceEditMetadata",
|
|
668
|
+
value: function asWorkspaceEditMetadata(changeAnnotation) {
|
|
669
|
+
return {
|
|
670
|
+
needsConfirmation: changeAnnotation.needsConfirmation === true,
|
|
671
|
+
label: changeAnnotation.label,
|
|
672
|
+
description: changeAnnotation.description
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
}, {
|
|
676
|
+
key: "asWorkspaceEdit",
|
|
677
|
+
value: function asWorkspaceEdit(item) {
|
|
678
|
+
var _this7 = this;
|
|
679
|
+
if (!item) {
|
|
680
|
+
return undefined;
|
|
681
|
+
}
|
|
682
|
+
var sharedMetadata = new Map();
|
|
683
|
+
if (item.changeAnnotations !== undefined) {
|
|
684
|
+
for (var _i = 0, _Object$keys = Object.keys(item.changeAnnotations); _i < _Object$keys.length; _i++) {
|
|
685
|
+
var key = _Object$keys[_i];
|
|
686
|
+
var metaData = this.asWorkspaceEditMetadata(item.changeAnnotations[key]);
|
|
687
|
+
sharedMetadata.set(key, metaData);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
var asMetadata = function asMetadata(annotation) {
|
|
691
|
+
if (annotation === undefined) {
|
|
692
|
+
return undefined;
|
|
693
|
+
} else {
|
|
694
|
+
return sharedMetadata.get(annotation);
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
var edits = [];
|
|
698
|
+
if (item.documentChanges) {
|
|
699
|
+
item.documentChanges.forEach(function (change) {
|
|
700
|
+
if (ls.CreateFile.is(change)) {
|
|
701
|
+
edits.push({
|
|
702
|
+
newUri: _this7._monaco.Uri.parse(change.uri),
|
|
703
|
+
options: change.options,
|
|
704
|
+
metadata: asMetadata(change.annotationId)
|
|
705
|
+
});
|
|
706
|
+
} else if (ls.RenameFile.is(change)) {
|
|
707
|
+
edits.push({
|
|
708
|
+
oldUri: _this7._monaco.Uri.parse(change.oldUri),
|
|
709
|
+
newUri: _this7._monaco.Uri.parse(change.newUri),
|
|
710
|
+
options: change.options,
|
|
711
|
+
metadata: asMetadata(change.annotationId)
|
|
712
|
+
});
|
|
713
|
+
} else if (ls.DeleteFile.is(change)) {
|
|
714
|
+
edits.push({
|
|
715
|
+
oldUri: _this7._monaco.Uri.parse(change.uri),
|
|
716
|
+
options: change.options,
|
|
717
|
+
metadata: asMetadata(change.annotationId)
|
|
718
|
+
});
|
|
719
|
+
} else if (ls.TextDocumentEdit.is(change)) {
|
|
720
|
+
var resource = _this7._monaco.Uri.parse(change.textDocument.uri);
|
|
721
|
+
var version = typeof change.textDocument.version === 'number' ? change.textDocument.version : undefined;
|
|
722
|
+
edits.push.apply(edits, _toConsumableArray(_this7.asResourceEdits(resource, change.edits, asMetadata, version)));
|
|
723
|
+
} else {
|
|
724
|
+
console.error("Unknown workspace edit change received:\n".concat(JSON.stringify(change, undefined, 4)));
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
} else if (item.changes) {
|
|
728
|
+
for (var _i2 = 0, _Object$keys2 = Object.keys(item.changes); _i2 < _Object$keys2.length; _i2++) {
|
|
729
|
+
var _key = _Object$keys2[_i2];
|
|
730
|
+
var resource = this._monaco.Uri.parse(_key);
|
|
731
|
+
edits.push.apply(edits, _toConsumableArray(this.asResourceEdits(resource, item.changes[_key], asMetadata)));
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return {
|
|
735
|
+
edits: edits
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
}, {
|
|
739
|
+
key: "asTextEdit",
|
|
740
|
+
value: function asTextEdit(edit) {
|
|
741
|
+
if (!edit) {
|
|
742
|
+
return undefined;
|
|
743
|
+
}
|
|
744
|
+
var range = this.asRange(edit.range);
|
|
745
|
+
return {
|
|
746
|
+
range: range,
|
|
747
|
+
text: edit.newText
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
}, {
|
|
751
|
+
key: "asTextEdits",
|
|
752
|
+
value: function asTextEdits(items) {
|
|
753
|
+
var _this8 = this;
|
|
754
|
+
if (!items) {
|
|
755
|
+
return undefined;
|
|
756
|
+
}
|
|
757
|
+
return items.map(function (item) {
|
|
758
|
+
return _this8.asTextEdit(item);
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
}, {
|
|
762
|
+
key: "asCodeLens",
|
|
763
|
+
value: function asCodeLens(item) {
|
|
764
|
+
if (!item) {
|
|
765
|
+
return undefined;
|
|
766
|
+
}
|
|
767
|
+
var range = this.asRange(item.range);
|
|
768
|
+
var result = {
|
|
769
|
+
range: range
|
|
770
|
+
};
|
|
771
|
+
if (item.command) {
|
|
772
|
+
result.command = this.asCommand(item.command);
|
|
773
|
+
}
|
|
774
|
+
if (item.data !== void 0 && item.data !== null) {
|
|
775
|
+
result.data = item.data;
|
|
776
|
+
}
|
|
777
|
+
return result;
|
|
778
|
+
}
|
|
779
|
+
}, {
|
|
780
|
+
key: "asCodeLensList",
|
|
781
|
+
value: function asCodeLensList(items) {
|
|
782
|
+
var _this9 = this;
|
|
783
|
+
if (!items) {
|
|
784
|
+
return undefined;
|
|
785
|
+
}
|
|
786
|
+
return {
|
|
787
|
+
lenses: items.map(function (codeLens) {
|
|
788
|
+
return _this9.asCodeLens(codeLens);
|
|
789
|
+
}),
|
|
790
|
+
dispose: function dispose() {}
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
}, {
|
|
794
|
+
key: "asCodeActionList",
|
|
795
|
+
value: function asCodeActionList(actions) {
|
|
796
|
+
var _this10 = this;
|
|
797
|
+
return {
|
|
798
|
+
actions: actions.map(function (action) {
|
|
799
|
+
return _this10.asCodeAction(action);
|
|
800
|
+
}),
|
|
801
|
+
dispose: function dispose() {}
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
}, {
|
|
805
|
+
key: "asCodeAction",
|
|
806
|
+
value: function asCodeAction(item) {
|
|
807
|
+
if (Command.is(item)) {
|
|
808
|
+
return {
|
|
809
|
+
command: {
|
|
810
|
+
id: item.command,
|
|
811
|
+
title: item.title,
|
|
812
|
+
arguments: item.arguments
|
|
813
|
+
},
|
|
814
|
+
title: item.title
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
return {
|
|
818
|
+
title: item.title,
|
|
819
|
+
command: this.asCommand(item.command),
|
|
820
|
+
edit: this.asWorkspaceEdit(item.edit),
|
|
821
|
+
diagnostics: this.asDiagnostics(item.diagnostics),
|
|
822
|
+
kind: item.kind,
|
|
823
|
+
disabled: item.disabled ? item.disabled.reason : undefined,
|
|
824
|
+
isPreferred: item.isPreferred,
|
|
825
|
+
data: item.data
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
}, {
|
|
829
|
+
key: "asCommand",
|
|
830
|
+
value: function asCommand(command) {
|
|
831
|
+
if (!command) {
|
|
832
|
+
return undefined;
|
|
833
|
+
}
|
|
834
|
+
return {
|
|
835
|
+
id: command.command,
|
|
836
|
+
title: command.title,
|
|
837
|
+
arguments: command.arguments
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
}, {
|
|
841
|
+
key: "asDocumentSymbol",
|
|
842
|
+
value: function asDocumentSymbol(value) {
|
|
843
|
+
var _this11 = this;
|
|
844
|
+
var children = value.children && value.children.map(function (c) {
|
|
845
|
+
return _this11.asDocumentSymbol(c);
|
|
846
|
+
});
|
|
847
|
+
return {
|
|
848
|
+
name: value.name,
|
|
849
|
+
detail: value.detail || '',
|
|
850
|
+
kind: this.asSymbolKind(value.kind),
|
|
851
|
+
tags: value.tags || [],
|
|
852
|
+
range: this.asRange(value.range),
|
|
853
|
+
selectionRange: this.asRange(value.selectionRange),
|
|
854
|
+
children: children
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
}, {
|
|
858
|
+
key: "asDocumentSymbols",
|
|
859
|
+
value: function asDocumentSymbols(values) {
|
|
860
|
+
var _this12 = this;
|
|
861
|
+
if (DocumentSymbol.is(values[0])) {
|
|
862
|
+
return values.map(function (s) {
|
|
863
|
+
return _this12.asDocumentSymbol(s);
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
return this.asSymbolInformations(values);
|
|
867
|
+
}
|
|
868
|
+
}, {
|
|
869
|
+
key: "asSymbolInformations",
|
|
870
|
+
value: function asSymbolInformations(values, uri) {
|
|
871
|
+
var _this13 = this;
|
|
872
|
+
if (!values) {
|
|
873
|
+
return undefined;
|
|
874
|
+
}
|
|
875
|
+
return values.map(function (information) {
|
|
876
|
+
return _this13.asSymbolInformation(information, uri);
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
}, {
|
|
880
|
+
key: "asSymbolInformation",
|
|
881
|
+
value: function asSymbolInformation(item, uri) {
|
|
882
|
+
var location = this.asLocation(uri ? _objectSpread(_objectSpread({}, item.location), {}, {
|
|
883
|
+
uri: uri.toString()
|
|
884
|
+
}) : item.location);
|
|
885
|
+
return {
|
|
886
|
+
name: item.name,
|
|
887
|
+
detail: '',
|
|
888
|
+
containerName: item.containerName,
|
|
889
|
+
kind: this.asSymbolKind(item.kind),
|
|
890
|
+
tags: item.tags || [],
|
|
891
|
+
range: location.range,
|
|
892
|
+
selectionRange: location.range
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
}, {
|
|
896
|
+
key: "asSymbolKind",
|
|
897
|
+
value: function asSymbolKind(item) {
|
|
898
|
+
if (item <= SymbolKind.TypeParameter) {
|
|
899
|
+
// Symbol kind is one based in the protocol and zero based in code.
|
|
900
|
+
return item - 1;
|
|
901
|
+
}
|
|
902
|
+
return this._monaco.languages.SymbolKind.Property;
|
|
903
|
+
}
|
|
904
|
+
}, {
|
|
905
|
+
key: "asDocumentHighlights",
|
|
906
|
+
value: function asDocumentHighlights(values) {
|
|
907
|
+
var _this14 = this;
|
|
908
|
+
if (!values) {
|
|
909
|
+
return undefined;
|
|
910
|
+
}
|
|
911
|
+
return values.map(function (item) {
|
|
912
|
+
return _this14.asDocumentHighlight(item);
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}, {
|
|
916
|
+
key: "asDocumentHighlight",
|
|
917
|
+
value: function asDocumentHighlight(item) {
|
|
918
|
+
var range = this.asRange(item.range);
|
|
919
|
+
var kind = Is.isNumber(item.kind) ? this.asDocumentHighlightKind(item.kind) : undefined;
|
|
920
|
+
return {
|
|
921
|
+
range: range,
|
|
922
|
+
kind: kind
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
}, {
|
|
926
|
+
key: "asDocumentHighlightKind",
|
|
927
|
+
value: function asDocumentHighlightKind(item) {
|
|
928
|
+
switch (item) {
|
|
929
|
+
case DocumentHighlightKind.Text:
|
|
930
|
+
return this._monaco.languages.DocumentHighlightKind.Text;
|
|
931
|
+
case DocumentHighlightKind.Read:
|
|
932
|
+
return this._monaco.languages.DocumentHighlightKind.Read;
|
|
933
|
+
case DocumentHighlightKind.Write:
|
|
934
|
+
return this._monaco.languages.DocumentHighlightKind.Write;
|
|
935
|
+
}
|
|
936
|
+
return this._monaco.languages.DocumentHighlightKind.Text;
|
|
937
|
+
}
|
|
938
|
+
}, {
|
|
939
|
+
key: "asReferences",
|
|
940
|
+
value: function asReferences(values) {
|
|
941
|
+
var _this15 = this;
|
|
942
|
+
if (!values) {
|
|
943
|
+
return undefined;
|
|
944
|
+
}
|
|
945
|
+
return values.map(function (location) {
|
|
946
|
+
return _this15.asLocation(location);
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
}, {
|
|
950
|
+
key: "asDefinitionResult",
|
|
951
|
+
value: function asDefinitionResult(item) {
|
|
952
|
+
var _this16 = this;
|
|
953
|
+
if (!item) {
|
|
954
|
+
return undefined;
|
|
955
|
+
}
|
|
956
|
+
if (Array.isArray(item)) {
|
|
957
|
+
if (item.length === 0) {
|
|
958
|
+
return undefined;
|
|
959
|
+
} else if (LocationLink.is(item[0])) {
|
|
960
|
+
var links = item;
|
|
961
|
+
return links.map(function (location) {
|
|
962
|
+
return _this16.asLocationLink(location);
|
|
963
|
+
});
|
|
964
|
+
} else {
|
|
965
|
+
var locations = item;
|
|
966
|
+
return locations.map(function (location) {
|
|
967
|
+
return _this16.asLocation(location);
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
} else {
|
|
971
|
+
return this.asLocation(item);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}, {
|
|
975
|
+
key: "asLocation",
|
|
976
|
+
value: function asLocation(item) {
|
|
977
|
+
if (!item) {
|
|
978
|
+
return undefined;
|
|
979
|
+
}
|
|
980
|
+
var uri = this._monaco.Uri.parse(item.uri);
|
|
981
|
+
var range = this.asRange(item.range);
|
|
982
|
+
return {
|
|
983
|
+
uri: uri,
|
|
984
|
+
range: range
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
}, {
|
|
988
|
+
key: "asLocationLink",
|
|
989
|
+
value: function asLocationLink(item) {
|
|
990
|
+
if (!item) {
|
|
991
|
+
return undefined;
|
|
992
|
+
}
|
|
993
|
+
var result = {
|
|
994
|
+
uri: this._monaco.Uri.parse(item.targetUri),
|
|
995
|
+
range: this.asRange(item.targetSelectionRange),
|
|
996
|
+
// See issue: https://github.com/Microsoft/vscode/issues/58649
|
|
997
|
+
originSelectionRange: this.asRange(item.originSelectionRange),
|
|
998
|
+
targetSelectionRange: this.asRange(item.targetSelectionRange)
|
|
999
|
+
};
|
|
1000
|
+
if (!result.targetSelectionRange) {
|
|
1001
|
+
throw new Error("targetSelectionRange must not be undefined or null");
|
|
1002
|
+
}
|
|
1003
|
+
return result;
|
|
1004
|
+
}
|
|
1005
|
+
}, {
|
|
1006
|
+
key: "asSignatureHelpResult",
|
|
1007
|
+
value: function asSignatureHelpResult(item) {
|
|
1008
|
+
if (!item) {
|
|
1009
|
+
return undefined;
|
|
1010
|
+
}
|
|
1011
|
+
var result = {};
|
|
1012
|
+
if (Is.isNumber(item.activeSignature)) {
|
|
1013
|
+
result.activeSignature = item.activeSignature;
|
|
1014
|
+
} else {
|
|
1015
|
+
// activeSignature was optional in the past
|
|
1016
|
+
result.activeSignature = 0;
|
|
1017
|
+
}
|
|
1018
|
+
if (Is.isNumber(item.activeParameter)) {
|
|
1019
|
+
result.activeParameter = item.activeParameter;
|
|
1020
|
+
} else {
|
|
1021
|
+
// activeParameter was optional in the past
|
|
1022
|
+
result.activeParameter = 0;
|
|
1023
|
+
}
|
|
1024
|
+
if (item.signatures) {
|
|
1025
|
+
result.signatures = this.asSignatureInformations(item.signatures);
|
|
1026
|
+
} else {
|
|
1027
|
+
result.signatures = [];
|
|
1028
|
+
}
|
|
1029
|
+
return {
|
|
1030
|
+
value: result,
|
|
1031
|
+
dispose: function dispose() {}
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
}, {
|
|
1035
|
+
key: "asSignatureInformations",
|
|
1036
|
+
value: function asSignatureInformations(items) {
|
|
1037
|
+
var _this17 = this;
|
|
1038
|
+
return items.map(function (item) {
|
|
1039
|
+
return _this17.asSignatureInformation(item);
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
}, {
|
|
1043
|
+
key: "asSignatureInformation",
|
|
1044
|
+
value: function asSignatureInformation(item) {
|
|
1045
|
+
var result = {
|
|
1046
|
+
label: item.label
|
|
1047
|
+
};
|
|
1048
|
+
if (item.documentation) {
|
|
1049
|
+
result.documentation = this.asDocumentation(item.documentation);
|
|
1050
|
+
}
|
|
1051
|
+
if (item.parameters) {
|
|
1052
|
+
result.parameters = this.asParameterInformations(item.parameters);
|
|
1053
|
+
} else {
|
|
1054
|
+
result.parameters = [];
|
|
1055
|
+
}
|
|
1056
|
+
if (item.activeParameter) {
|
|
1057
|
+
result.activeParameter = item.activeParameter;
|
|
1058
|
+
}
|
|
1059
|
+
return result;
|
|
1060
|
+
}
|
|
1061
|
+
}, {
|
|
1062
|
+
key: "asParameterInformations",
|
|
1063
|
+
value: function asParameterInformations(item) {
|
|
1064
|
+
var _this18 = this;
|
|
1065
|
+
return item.map(function (item) {
|
|
1066
|
+
return _this18.asParameterInformation(item);
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
}, {
|
|
1070
|
+
key: "asParameterInformation",
|
|
1071
|
+
value: function asParameterInformation(item) {
|
|
1072
|
+
var result = {
|
|
1073
|
+
label: item.label
|
|
1074
|
+
};
|
|
1075
|
+
if (item.documentation) {
|
|
1076
|
+
result.documentation = this.asDocumentation(item.documentation);
|
|
1077
|
+
}
|
|
1078
|
+
return result;
|
|
1079
|
+
}
|
|
1080
|
+
}, {
|
|
1081
|
+
key: "asHover",
|
|
1082
|
+
value: function asHover(hover) {
|
|
1083
|
+
if (!hover) {
|
|
1084
|
+
return undefined;
|
|
1085
|
+
}
|
|
1086
|
+
return {
|
|
1087
|
+
contents: this.asHoverContent(hover.contents),
|
|
1088
|
+
range: this.asRange(hover.range)
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
}, {
|
|
1092
|
+
key: "asHoverContent",
|
|
1093
|
+
value: function asHoverContent(contents) {
|
|
1094
|
+
var _this19 = this;
|
|
1095
|
+
if (Array.isArray(contents)) {
|
|
1096
|
+
return contents.map(function (content) {
|
|
1097
|
+
return _this19.asMarkdownString(content);
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
return [this.asMarkdownString(contents)];
|
|
1101
|
+
}
|
|
1102
|
+
}, {
|
|
1103
|
+
key: "asDocumentation",
|
|
1104
|
+
value: function asDocumentation(value) {
|
|
1105
|
+
if (Is.isString(value)) {
|
|
1106
|
+
return value;
|
|
1107
|
+
}
|
|
1108
|
+
if (value.kind === MarkupKind.PlainText) {
|
|
1109
|
+
return value.value;
|
|
1110
|
+
}
|
|
1111
|
+
return this.asMarkdownString(value);
|
|
1112
|
+
}
|
|
1113
|
+
}, {
|
|
1114
|
+
key: "asMarkdownString",
|
|
1115
|
+
value: function asMarkdownString(content) {
|
|
1116
|
+
if (MarkupContent.is(content)) {
|
|
1117
|
+
return {
|
|
1118
|
+
value: content.value
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
if (Is.isString(content)) {
|
|
1122
|
+
return {
|
|
1123
|
+
value: content
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
var language = content.language,
|
|
1127
|
+
value = content.value;
|
|
1128
|
+
return {
|
|
1129
|
+
value: '```' + language + '\n' + value + '\n```'
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
}, {
|
|
1133
|
+
key: "asSeverity",
|
|
1134
|
+
value: function asSeverity(severity) {
|
|
1135
|
+
if (severity === 1) {
|
|
1136
|
+
return this._monaco.MarkerSeverity.Error;
|
|
1137
|
+
}
|
|
1138
|
+
if (severity === 2) {
|
|
1139
|
+
return this._monaco.MarkerSeverity.Warning;
|
|
1140
|
+
}
|
|
1141
|
+
if (severity === 3) {
|
|
1142
|
+
return this._monaco.MarkerSeverity.Info;
|
|
1143
|
+
}
|
|
1144
|
+
return this._monaco.MarkerSeverity.Hint;
|
|
1145
|
+
}
|
|
1146
|
+
}, {
|
|
1147
|
+
key: "asDiagnostics",
|
|
1148
|
+
value: function asDiagnostics(diagnostics) {
|
|
1149
|
+
var _this20 = this;
|
|
1150
|
+
if (!diagnostics) {
|
|
1151
|
+
return undefined;
|
|
1152
|
+
}
|
|
1153
|
+
return diagnostics.map(function (diagnostic) {
|
|
1154
|
+
return _this20.asDiagnostic(diagnostic);
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
}, {
|
|
1158
|
+
key: "asDiagnostic",
|
|
1159
|
+
value: function asDiagnostic(diagnostic) {
|
|
1160
|
+
return {
|
|
1161
|
+
code: typeof diagnostic.code === 'number' ? diagnostic.code.toString() : diagnostic.code,
|
|
1162
|
+
severity: this.asSeverity(diagnostic.severity),
|
|
1163
|
+
message: diagnostic.message,
|
|
1164
|
+
source: diagnostic.source,
|
|
1165
|
+
startLineNumber: diagnostic.range.start.line + 1,
|
|
1166
|
+
startColumn: diagnostic.range.start.character + 1,
|
|
1167
|
+
endLineNumber: diagnostic.range.end.line + 1,
|
|
1168
|
+
endColumn: diagnostic.range.end.character + 1,
|
|
1169
|
+
relatedInformation: this.asRelatedInformations(diagnostic.relatedInformation),
|
|
1170
|
+
tags: diagnostic.tags
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
}, {
|
|
1174
|
+
key: "asRelatedInformations",
|
|
1175
|
+
value: function asRelatedInformations(relatedInformation) {
|
|
1176
|
+
var _this21 = this;
|
|
1177
|
+
if (!relatedInformation) {
|
|
1178
|
+
return undefined;
|
|
1179
|
+
}
|
|
1180
|
+
return relatedInformation.map(function (item) {
|
|
1181
|
+
return _this21.asRelatedInformation(item);
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
}, {
|
|
1185
|
+
key: "asRelatedInformation",
|
|
1186
|
+
value: function asRelatedInformation(relatedInformation) {
|
|
1187
|
+
return {
|
|
1188
|
+
resource: this._monaco.Uri.parse(relatedInformation.location.uri),
|
|
1189
|
+
startLineNumber: relatedInformation.location.range.start.line + 1,
|
|
1190
|
+
startColumn: relatedInformation.location.range.start.character + 1,
|
|
1191
|
+
endLineNumber: relatedInformation.location.range.end.line + 1,
|
|
1192
|
+
endColumn: relatedInformation.location.range.end.character + 1,
|
|
1193
|
+
message: relatedInformation.message
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
}, {
|
|
1197
|
+
key: "asCompletionResult",
|
|
1198
|
+
value: function asCompletionResult(result, defaultMonacoRange) {
|
|
1199
|
+
var _this22 = this;
|
|
1200
|
+
if (!result) {
|
|
1201
|
+
return {
|
|
1202
|
+
incomplete: false,
|
|
1203
|
+
suggestions: []
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
if (Array.isArray(result)) {
|
|
1207
|
+
var suggestions = result.map(function (item) {
|
|
1208
|
+
return _this22.asCompletionItem(item, defaultMonacoRange, defaultRange);
|
|
1209
|
+
});
|
|
1210
|
+
return {
|
|
1211
|
+
incomplete: false,
|
|
1212
|
+
suggestions: suggestions
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
var defaultRange = this.getCompletionItemDefaultRange(result);
|
|
1216
|
+
return {
|
|
1217
|
+
incomplete: result.isIncomplete,
|
|
1218
|
+
suggestions: result.items.map(function (item) {
|
|
1219
|
+
return _this22.asCompletionItem(item, defaultMonacoRange, defaultRange, result.itemDefaults);
|
|
1220
|
+
})
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
}, {
|
|
1224
|
+
key: "asCompletionItem",
|
|
1225
|
+
value: function asCompletionItem(item, defaultMonacoRange, defaultRange, itemDefaults) {
|
|
1226
|
+
var _insertText$range, _item$data, _item$insertTextMode;
|
|
1227
|
+
var result = {
|
|
1228
|
+
label: this.asCompletionItemLabel(item)
|
|
1229
|
+
};
|
|
1230
|
+
if (item.detail) {
|
|
1231
|
+
result.detail = item.detail;
|
|
1232
|
+
}
|
|
1233
|
+
if (item.documentation) {
|
|
1234
|
+
result.documentation = this.asDocumentation(item.documentation);
|
|
1235
|
+
result.documentationFormat = Is.isString(item.documentation) ? undefined : item.documentation.kind;
|
|
1236
|
+
}
|
|
1237
|
+
if (item.filterText) {
|
|
1238
|
+
result.filterText = item.filterText;
|
|
1239
|
+
}
|
|
1240
|
+
var insertText = this.asCompletionInsertText(item, defaultRange, itemDefaults === null || itemDefaults === void 0 ? void 0 : itemDefaults.insertTextFormat);
|
|
1241
|
+
result.insertText = insertText.insertText;
|
|
1242
|
+
result.range = (_insertText$range = insertText.range) !== null && _insertText$range !== void 0 ? _insertText$range : defaultMonacoRange;
|
|
1243
|
+
result.fromEdit = insertText.fromEdit;
|
|
1244
|
+
if (insertText.isSnippet) {
|
|
1245
|
+
result.insertTextRules = this._monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
|
1246
|
+
}
|
|
1247
|
+
if (Is.isNumber(item.kind)) {
|
|
1248
|
+
var _this$asCompletionIte = this.asCompletionItemKind(item.kind),
|
|
1249
|
+
_this$asCompletionIte2 = _slicedToArray(_this$asCompletionIte, 2),
|
|
1250
|
+
itemKind = _this$asCompletionIte2[0],
|
|
1251
|
+
original = _this$asCompletionIte2[1];
|
|
1252
|
+
result.kind = itemKind;
|
|
1253
|
+
if (original) {
|
|
1254
|
+
result.originalItemKind = original;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
if (item.sortText) {
|
|
1258
|
+
result.sortText = item.sortText;
|
|
1259
|
+
}
|
|
1260
|
+
if (item.additionalTextEdits) {
|
|
1261
|
+
result.additionalTextEdits = this.asTextEdits(item.additionalTextEdits);
|
|
1262
|
+
}
|
|
1263
|
+
if (Is.isStringArray(item.commitCharacters)) {
|
|
1264
|
+
result.commitCharacters = item.commitCharacters.slice();
|
|
1265
|
+
}
|
|
1266
|
+
if (item.command) {
|
|
1267
|
+
result.command = this.asCommand(item.command);
|
|
1268
|
+
}
|
|
1269
|
+
if (item.deprecated === true || item.deprecated === false) {
|
|
1270
|
+
result.deprecated = item.deprecated;
|
|
1271
|
+
}
|
|
1272
|
+
if (item.preselect === true || item.preselect === false) {
|
|
1273
|
+
result.preselect = item.preselect;
|
|
1274
|
+
}
|
|
1275
|
+
var data = (_item$data = item.data) !== null && _item$data !== void 0 ? _item$data : itemDefaults === null || itemDefaults === void 0 ? void 0 : itemDefaults.data;
|
|
1276
|
+
if (data !== undefined) {
|
|
1277
|
+
result.data = data;
|
|
1278
|
+
}
|
|
1279
|
+
if (item.deprecated === true || item.deprecated === false) {
|
|
1280
|
+
result.deprecated = item.deprecated;
|
|
1281
|
+
}
|
|
1282
|
+
var insertTextMode = (_item$insertTextMode = item.insertTextMode) !== null && _item$insertTextMode !== void 0 ? _item$insertTextMode : itemDefaults === null || itemDefaults === void 0 ? void 0 : itemDefaults.insertTextMode;
|
|
1283
|
+
if (insertTextMode) {
|
|
1284
|
+
result.insertTextMode = insertTextMode;
|
|
1285
|
+
}
|
|
1286
|
+
if (item.tags) {
|
|
1287
|
+
result.tags = item.tags;
|
|
1288
|
+
}
|
|
1289
|
+
return result;
|
|
1290
|
+
}
|
|
1291
|
+
}, {
|
|
1292
|
+
key: "getCompletionItemDefaultRange",
|
|
1293
|
+
value: function getCompletionItemDefaultRange(list) {
|
|
1294
|
+
var _list$itemDefaults;
|
|
1295
|
+
var rangeDefaults = (_list$itemDefaults = list.itemDefaults) === null || _list$itemDefaults === void 0 ? void 0 : _list$itemDefaults.editRange;
|
|
1296
|
+
return ls.Range.is(rangeDefaults) ? this.asRange(rangeDefaults) : rangeDefaults !== undefined ? {
|
|
1297
|
+
insert: this.asRange(rangeDefaults.insert),
|
|
1298
|
+
replace: this.asRange(rangeDefaults.replace)
|
|
1299
|
+
} : undefined;
|
|
1300
|
+
}
|
|
1301
|
+
}, {
|
|
1302
|
+
key: "asCompletionItemLabel",
|
|
1303
|
+
value: function asCompletionItemLabel(item) {
|
|
1304
|
+
if (ls.CompletionItemLabelDetails.is(item.labelDetails)) {
|
|
1305
|
+
return {
|
|
1306
|
+
label: item.label,
|
|
1307
|
+
detail: item.labelDetails.detail,
|
|
1308
|
+
description: item.labelDetails.description
|
|
1309
|
+
};
|
|
1310
|
+
} else {
|
|
1311
|
+
return item.label;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
}, {
|
|
1315
|
+
key: "asCompletionItemKind",
|
|
1316
|
+
value: function asCompletionItemKind(value) {
|
|
1317
|
+
if (CompletionItemKind.Text <= value && value <= CompletionItemKind.TypeParameter) {
|
|
1318
|
+
switch (value) {
|
|
1319
|
+
case CompletionItemKind.Text:
|
|
1320
|
+
return [this._monaco.languages.CompletionItemKind.Text, undefined];
|
|
1321
|
+
case CompletionItemKind.Method:
|
|
1322
|
+
return [this._monaco.languages.CompletionItemKind.Method, undefined];
|
|
1323
|
+
case CompletionItemKind.Function:
|
|
1324
|
+
return [this._monaco.languages.CompletionItemKind.Function, undefined];
|
|
1325
|
+
case CompletionItemKind.Constructor:
|
|
1326
|
+
return [this._monaco.languages.CompletionItemKind.Constructor, undefined];
|
|
1327
|
+
case CompletionItemKind.Field:
|
|
1328
|
+
return [this._monaco.languages.CompletionItemKind.Field, undefined];
|
|
1329
|
+
case CompletionItemKind.Variable:
|
|
1330
|
+
return [this._monaco.languages.CompletionItemKind.Variable, undefined];
|
|
1331
|
+
case CompletionItemKind.Class:
|
|
1332
|
+
return [this._monaco.languages.CompletionItemKind.Class, undefined];
|
|
1333
|
+
case CompletionItemKind.Interface:
|
|
1334
|
+
return [this._monaco.languages.CompletionItemKind.Interface, undefined];
|
|
1335
|
+
case CompletionItemKind.Module:
|
|
1336
|
+
return [this._monaco.languages.CompletionItemKind.Module, undefined];
|
|
1337
|
+
case CompletionItemKind.Property:
|
|
1338
|
+
return [this._monaco.languages.CompletionItemKind.Property, undefined];
|
|
1339
|
+
case CompletionItemKind.Unit:
|
|
1340
|
+
return [this._monaco.languages.CompletionItemKind.Unit, undefined];
|
|
1341
|
+
case CompletionItemKind.Value:
|
|
1342
|
+
return [this._monaco.languages.CompletionItemKind.Value, undefined];
|
|
1343
|
+
case CompletionItemKind.Enum:
|
|
1344
|
+
return [this._monaco.languages.CompletionItemKind.Enum, undefined];
|
|
1345
|
+
case CompletionItemKind.Keyword:
|
|
1346
|
+
return [this._monaco.languages.CompletionItemKind.Keyword, undefined];
|
|
1347
|
+
case CompletionItemKind.Snippet:
|
|
1348
|
+
return [this._monaco.languages.CompletionItemKind.Snippet, undefined];
|
|
1349
|
+
case CompletionItemKind.Color:
|
|
1350
|
+
return [this._monaco.languages.CompletionItemKind.Color, undefined];
|
|
1351
|
+
case CompletionItemKind.File:
|
|
1352
|
+
return [this._monaco.languages.CompletionItemKind.File, undefined];
|
|
1353
|
+
case CompletionItemKind.Reference:
|
|
1354
|
+
return [this._monaco.languages.CompletionItemKind.Reference, undefined];
|
|
1355
|
+
case CompletionItemKind.Folder:
|
|
1356
|
+
return [this._monaco.languages.CompletionItemKind.Folder, undefined];
|
|
1357
|
+
case CompletionItemKind.EnumMember:
|
|
1358
|
+
return [this._monaco.languages.CompletionItemKind.EnumMember, undefined];
|
|
1359
|
+
case CompletionItemKind.Constant:
|
|
1360
|
+
return [this._monaco.languages.CompletionItemKind.Constant, undefined];
|
|
1361
|
+
case CompletionItemKind.Struct:
|
|
1362
|
+
return [this._monaco.languages.CompletionItemKind.Struct, undefined];
|
|
1363
|
+
case CompletionItemKind.Event:
|
|
1364
|
+
return [this._monaco.languages.CompletionItemKind.Event, undefined];
|
|
1365
|
+
case CompletionItemKind.Operator:
|
|
1366
|
+
return [this._monaco.languages.CompletionItemKind.Operator, undefined];
|
|
1367
|
+
case CompletionItemKind.TypeParameter:
|
|
1368
|
+
return [this._monaco.languages.CompletionItemKind.TypeParameter, undefined];
|
|
1369
|
+
default:
|
|
1370
|
+
return [value - 1, undefined];
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return [CompletionItemKind.Text, value];
|
|
1374
|
+
}
|
|
1375
|
+
}, {
|
|
1376
|
+
key: "asCompletionInsertText",
|
|
1377
|
+
value: function asCompletionInsertText(item, defaultRange, defaultInsertTextFormat) {
|
|
1378
|
+
var _item$insertTextForma;
|
|
1379
|
+
var insertTextFormat = (_item$insertTextForma = item.insertTextFormat) !== null && _item$insertTextForma !== void 0 ? _item$insertTextForma : defaultInsertTextFormat;
|
|
1380
|
+
var isSnippet = insertTextFormat === InsertTextFormat.Snippet;
|
|
1381
|
+
if (item.textEdit !== undefined || defaultRange !== undefined) {
|
|
1382
|
+
var _item$textEditText;
|
|
1383
|
+
var _ref = item.textEdit !== undefined ? this.getCompletionRangeAndText(item.textEdit) : [defaultRange, (_item$textEditText = item.textEditText) !== null && _item$textEditText !== void 0 ? _item$textEditText : item.label],
|
|
1384
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
1385
|
+
_range = _ref2[0],
|
|
1386
|
+
newText = _ref2[1];
|
|
1387
|
+
return {
|
|
1388
|
+
insertText: newText,
|
|
1389
|
+
range: _range,
|
|
1390
|
+
fromEdit: true,
|
|
1391
|
+
isSnippet: isSnippet
|
|
1392
|
+
};
|
|
1393
|
+
} else if (item.insertText) {
|
|
1394
|
+
return {
|
|
1395
|
+
isSnippet: isSnippet,
|
|
1396
|
+
insertText: item.insertText,
|
|
1397
|
+
fromEdit: false,
|
|
1398
|
+
range: defaultRange
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
return {
|
|
1402
|
+
insertText: item.label,
|
|
1403
|
+
range: defaultRange,
|
|
1404
|
+
fromEdit: false,
|
|
1405
|
+
isSnippet: false
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
}, {
|
|
1409
|
+
key: "getCompletionRangeAndText",
|
|
1410
|
+
value: function getCompletionRangeAndText(value) {
|
|
1411
|
+
if (ls.InsertReplaceEdit.is(value)) {
|
|
1412
|
+
return [{
|
|
1413
|
+
insert: this.asRange(value.insert),
|
|
1414
|
+
replace: this.asRange(value.replace)
|
|
1415
|
+
}, value.newText];
|
|
1416
|
+
} else {
|
|
1417
|
+
return [this.asRange(value.range), value.newText];
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}, {
|
|
1421
|
+
key: "asDocumentLinks",
|
|
1422
|
+
value: function asDocumentLinks(documentLinks) {
|
|
1423
|
+
var _this23 = this;
|
|
1424
|
+
var links = documentLinks.map(function (link) {
|
|
1425
|
+
return _this23.asDocumentLink(link);
|
|
1426
|
+
});
|
|
1427
|
+
return {
|
|
1428
|
+
links: links
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
}, {
|
|
1432
|
+
key: "asDocumentLink",
|
|
1433
|
+
value: function asDocumentLink(documentLink) {
|
|
1434
|
+
return {
|
|
1435
|
+
range: this.asRange(documentLink.range),
|
|
1436
|
+
url: documentLink.target,
|
|
1437
|
+
data: documentLink.data,
|
|
1438
|
+
tooltip: documentLink.tooltip
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
}, {
|
|
1442
|
+
key: "asRange",
|
|
1443
|
+
value: function asRange(range) {
|
|
1444
|
+
if (range === undefined) {
|
|
1445
|
+
return undefined;
|
|
1446
|
+
}
|
|
1447
|
+
if (range === null) {
|
|
1448
|
+
return null;
|
|
1449
|
+
}
|
|
1450
|
+
var start = this.asPosition(range.start);
|
|
1451
|
+
var end = this.asPosition(range.end);
|
|
1452
|
+
if (start instanceof this._monaco.Position && end instanceof this._monaco.Position) {
|
|
1453
|
+
return new this._monaco.Range(start.lineNumber, start.column, end.lineNumber, end.column);
|
|
1454
|
+
}
|
|
1455
|
+
var startLineNumber = !start || start.lineNumber === undefined ? undefined : start.lineNumber;
|
|
1456
|
+
var startColumn = !start || start.column === undefined ? undefined : start.column;
|
|
1457
|
+
var endLineNumber = !end || end.lineNumber === undefined ? undefined : end.lineNumber;
|
|
1458
|
+
var endColumn = !end || end.column === undefined ? undefined : end.column;
|
|
1459
|
+
return {
|
|
1460
|
+
startLineNumber: startLineNumber,
|
|
1461
|
+
startColumn: startColumn,
|
|
1462
|
+
endLineNumber: endLineNumber,
|
|
1463
|
+
endColumn: endColumn
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
}, {
|
|
1467
|
+
key: "asPosition",
|
|
1468
|
+
value: function asPosition(position) {
|
|
1469
|
+
if (position === undefined) {
|
|
1470
|
+
return undefined;
|
|
1471
|
+
}
|
|
1472
|
+
if (position === null) {
|
|
1473
|
+
return null;
|
|
1474
|
+
}
|
|
1475
|
+
var line = position.line,
|
|
1476
|
+
character = position.character;
|
|
1477
|
+
var lineNumber = line === undefined ? undefined : line + 1;
|
|
1478
|
+
var column = character === undefined ? undefined : character + 1;
|
|
1479
|
+
if (lineNumber !== undefined && column !== undefined) {
|
|
1480
|
+
return new this._monaco.Position(lineNumber, column);
|
|
1481
|
+
}
|
|
1482
|
+
return {
|
|
1483
|
+
lineNumber: lineNumber,
|
|
1484
|
+
column: column
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
}, {
|
|
1488
|
+
key: "asColorInformations",
|
|
1489
|
+
value: function asColorInformations(items) {
|
|
1490
|
+
var _this24 = this;
|
|
1491
|
+
return items.map(function (item) {
|
|
1492
|
+
return _this24.asColorInformation(item);
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
}, {
|
|
1496
|
+
key: "asColorInformation",
|
|
1497
|
+
value: function asColorInformation(item) {
|
|
1498
|
+
return {
|
|
1499
|
+
range: this.asRange(item.range),
|
|
1500
|
+
color: item.color
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
}, {
|
|
1504
|
+
key: "asColorPresentations",
|
|
1505
|
+
value: function asColorPresentations(items) {
|
|
1506
|
+
var _this25 = this;
|
|
1507
|
+
return items.map(function (item) {
|
|
1508
|
+
return _this25.asColorPresentation(item);
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
}, {
|
|
1512
|
+
key: "asColorPresentation",
|
|
1513
|
+
value: function asColorPresentation(item) {
|
|
1514
|
+
return {
|
|
1515
|
+
label: item.label,
|
|
1516
|
+
textEdit: this.asTextEdit(item.textEdit),
|
|
1517
|
+
additionalTextEdits: this.asTextEdits(item.additionalTextEdits)
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
}, {
|
|
1521
|
+
key: "asFoldingRanges",
|
|
1522
|
+
value: function asFoldingRanges(items) {
|
|
1523
|
+
var _this26 = this;
|
|
1524
|
+
if (!items) {
|
|
1525
|
+
return items;
|
|
1526
|
+
}
|
|
1527
|
+
return items.map(function (item) {
|
|
1528
|
+
return _this26.asFoldingRange(item);
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
}, {
|
|
1532
|
+
key: "asFoldingRange",
|
|
1533
|
+
value: function asFoldingRange(item) {
|
|
1534
|
+
return {
|
|
1535
|
+
start: item.startLine + 1,
|
|
1536
|
+
end: item.endLine + 1,
|
|
1537
|
+
kind: this.asFoldingRangeKind(item.kind)
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
}, {
|
|
1541
|
+
key: "asFoldingRangeKind",
|
|
1542
|
+
value: function asFoldingRangeKind(kind) {
|
|
1543
|
+
if (kind) {
|
|
1544
|
+
switch (kind) {
|
|
1545
|
+
case FoldingRangeKind.Comment:
|
|
1546
|
+
return this._monaco.languages.FoldingRangeKind.Comment;
|
|
1547
|
+
case FoldingRangeKind.Imports:
|
|
1548
|
+
return this._monaco.languages.FoldingRangeKind.Imports;
|
|
1549
|
+
case FoldingRangeKind.Region:
|
|
1550
|
+
return this._monaco.languages.FoldingRangeKind.Region;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
return undefined;
|
|
1554
|
+
}
|
|
1555
|
+
}, {
|
|
1556
|
+
key: "asSemanticTokens",
|
|
1557
|
+
value: function asSemanticTokens(semanticTokens) {
|
|
1558
|
+
return {
|
|
1559
|
+
resultId: semanticTokens.resultId,
|
|
1560
|
+
data: Uint32Array.from(semanticTokens.data)
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
}, {
|
|
1564
|
+
key: "asInlayHintLabelPart",
|
|
1565
|
+
value: function asInlayHintLabelPart(part) {
|
|
1566
|
+
return {
|
|
1567
|
+
label: part.value,
|
|
1568
|
+
command: this.asCommand(part.command),
|
|
1569
|
+
location: this.asLocation(part.location),
|
|
1570
|
+
tooltip: part.tooltip && this.asMarkdownString(part.tooltip)
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
}, {
|
|
1574
|
+
key: "asInlayHintLabel",
|
|
1575
|
+
value: function asInlayHintLabel(label) {
|
|
1576
|
+
var _this27 = this;
|
|
1577
|
+
if (Array.isArray(label)) {
|
|
1578
|
+
return label.map(function (part) {
|
|
1579
|
+
return _this27.asInlayHintLabelPart(part);
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
return label;
|
|
1583
|
+
}
|
|
1584
|
+
}, {
|
|
1585
|
+
key: "asInlayHint",
|
|
1586
|
+
value: function asInlayHint(inlayHint) {
|
|
1587
|
+
return {
|
|
1588
|
+
data: inlayHint.data,
|
|
1589
|
+
label: this.asInlayHintLabel(inlayHint.label),
|
|
1590
|
+
position: this.asPosition(inlayHint.position),
|
|
1591
|
+
kind: inlayHint.kind,
|
|
1592
|
+
paddingLeft: inlayHint.paddingLeft,
|
|
1593
|
+
paddingRight: inlayHint.paddingRight,
|
|
1594
|
+
tooltip: inlayHint.tooltip && this.asMarkdownString(inlayHint.tooltip)
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
}, {
|
|
1598
|
+
key: "asInlayHintList",
|
|
1599
|
+
value: function asInlayHintList(items) {
|
|
1600
|
+
var _this28 = this;
|
|
1601
|
+
if (!items) {
|
|
1602
|
+
return undefined;
|
|
1603
|
+
}
|
|
1604
|
+
return {
|
|
1605
|
+
hints: items.map(function (hint) {
|
|
1606
|
+
return _this28.asInlayHint(hint);
|
|
1607
|
+
}),
|
|
1608
|
+
dispose: function dispose() {}
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
}]);
|
|
1612
|
+
return ProtocolToMonacoConverter;
|
|
1613
|
+
}();
|