@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.
Files changed (298) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/es/common/api.d.ts +38 -0
  4. package/es/common/api.d.ts.map +1 -0
  5. package/es/common/api.js +9 -0
  6. package/es/common/callHierarchy.d.ts +39 -0
  7. package/es/common/callHierarchy.d.ts.map +1 -0
  8. package/es/common/callHierarchy.js +139 -0
  9. package/es/common/client.d.ts +482 -0
  10. package/es/common/client.d.ts.map +1 -0
  11. package/es/common/client.js +2731 -0
  12. package/es/common/codeAction.d.ts +22 -0
  13. package/es/common/codeAction.d.ts.map +1 -0
  14. package/es/common/codeAction.js +149 -0
  15. package/es/common/codeConverter.d.ts +81 -0
  16. package/es/common/codeConverter.d.ts.map +1 -0
  17. package/es/common/codeConverter.js +1040 -0
  18. package/es/common/codeLens.d.ts +26 -0
  19. package/es/common/codeLens.d.ts.map +1 -0
  20. package/es/common/codeLens.js +125 -0
  21. package/es/common/colorProvider.d.ts +27 -0
  22. package/es/common/colorProvider.d.ts.map +1 -0
  23. package/es/common/colorProvider.js +104 -0
  24. package/es/common/completion.d.ts +22 -0
  25. package/es/common/completion.d.ts.map +1 -0
  26. package/es/common/completion.js +130 -0
  27. package/es/common/configuration.d.ts +71 -0
  28. package/es/common/configuration.d.ts.map +1 -0
  29. package/es/common/configuration.js +292 -0
  30. package/es/common/declaration.d.ts +18 -0
  31. package/es/common/declaration.d.ts.map +1 -0
  32. package/es/common/declaration.js +88 -0
  33. package/es/common/definition.d.ts +18 -0
  34. package/es/common/definition.d.ts.map +1 -0
  35. package/es/common/definition.js +80 -0
  36. package/es/common/diagnostic.d.ts +125 -0
  37. package/es/common/diagnostic.d.ts.map +1 -0
  38. package/es/common/diagnostic.js +1442 -0
  39. package/es/common/documentHighlight.d.ts +17 -0
  40. package/es/common/documentHighlight.d.ts.map +1 -0
  41. package/es/common/documentHighlight.js +73 -0
  42. package/es/common/documentLink.d.ts +21 -0
  43. package/es/common/documentLink.d.ts.map +1 -0
  44. package/es/common/documentLink.js +90 -0
  45. package/es/common/documentSymbol.d.ts +20 -0
  46. package/es/common/documentSymbol.d.ts.map +1 -0
  47. package/es/common/documentSymbol.js +134 -0
  48. package/es/common/executeCommand.d.ts +22 -0
  49. package/es/common/executeCommand.d.ts.map +1 -0
  50. package/es/common/executeCommand.js +117 -0
  51. package/es/common/features.d.ts +421 -0
  52. package/es/common/features.d.ts.map +1 -0
  53. package/es/common/features.js +576 -0
  54. package/es/common/fileOperations.d.ts +118 -0
  55. package/es/common/fileOperations.d.ts.map +1 -0
  56. package/es/common/fileOperations.js +705 -0
  57. package/es/common/fileSystemWatcher.d.ts +19 -0
  58. package/es/common/fileSystemWatcher.d.ts.map +1 -0
  59. package/es/common/fileSystemWatcher.js +173 -0
  60. package/es/common/foldingRange.d.ts +22 -0
  61. package/es/common/foldingRange.d.ts.map +1 -0
  62. package/es/common/foldingRange.js +127 -0
  63. package/es/common/formatting.d.ts +41 -0
  64. package/es/common/formatting.d.ts.map +1 -0
  65. package/es/common/formatting.js +233 -0
  66. package/es/common/hover.d.ts +18 -0
  67. package/es/common/hover.d.ts.map +1 -0
  68. package/es/common/hover.js +80 -0
  69. package/es/common/implementation.d.ts +18 -0
  70. package/es/common/implementation.d.ts.map +1 -0
  71. package/es/common/implementation.js +88 -0
  72. package/es/common/inlayHint.d.ts +23 -0
  73. package/es/common/inlayHint.d.ts.map +1 -0
  74. package/es/common/inlayHint.js +187 -0
  75. package/es/common/inlineCompletion.d.ts +20 -0
  76. package/es/common/inlineCompletion.d.ts.map +1 -0
  77. package/es/common/inlineCompletion.js +74 -0
  78. package/es/common/inlineValue.d.ts +21 -0
  79. package/es/common/inlineValue.d.ts.map +1 -0
  80. package/es/common/inlineValue.js +124 -0
  81. package/es/common/linkedEditingRange.d.ts +23 -0
  82. package/es/common/linkedEditingRange.d.ts.map +1 -0
  83. package/es/common/linkedEditingRange.js +94 -0
  84. package/es/common/notebook.d.ts +97 -0
  85. package/es/common/notebook.d.ts.map +1 -0
  86. package/es/common/notebook.js +1444 -0
  87. package/es/common/progress.d.ts +12 -0
  88. package/es/common/progress.d.ts.map +1 -0
  89. package/es/common/progress.js +75 -0
  90. package/es/common/progressPart.d.ts +25 -0
  91. package/es/common/progressPart.d.ts.map +1 -0
  92. package/es/common/progressPart.js +147 -0
  93. package/es/common/protocolCallHierarchyItem.d.ts +9 -0
  94. package/es/common/protocolCallHierarchyItem.d.ts.map +1 -0
  95. package/es/common/protocolCallHierarchyItem.js +34 -0
  96. package/es/common/protocolCodeAction.d.ts +7 -0
  97. package/es/common/protocolCodeAction.d.ts.map +1 -0
  98. package/es/common/protocolCodeAction.js +32 -0
  99. package/es/common/protocolCodeLens.d.ts +7 -0
  100. package/es/common/protocolCodeLens.d.ts.map +1 -0
  101. package/es/common/protocolCodeLens.js +29 -0
  102. package/es/common/protocolCompletionItem.d.ts +13 -0
  103. package/es/common/protocolCompletionItem.d.ts.map +1 -0
  104. package/es/common/protocolCompletionItem.js +29 -0
  105. package/es/common/protocolConverter.d.ts +174 -0
  106. package/es/common/protocolConverter.d.ts.map +1 -0
  107. package/es/common/protocolConverter.js +1982 -0
  108. package/es/common/protocolDiagnostic.d.ts +20 -0
  109. package/es/common/protocolDiagnostic.d.ts.map +1 -0
  110. package/es/common/protocolDiagnostic.js +46 -0
  111. package/es/common/protocolDocumentLink.d.ts +8 -0
  112. package/es/common/protocolDocumentLink.d.ts.map +1 -0
  113. package/es/common/protocolDocumentLink.js +29 -0
  114. package/es/common/protocolInlayHint.d.ts +8 -0
  115. package/es/common/protocolInlayHint.d.ts.map +1 -0
  116. package/es/common/protocolInlayHint.js +29 -0
  117. package/es/common/protocolTypeHierarchyItem.d.ts +9 -0
  118. package/es/common/protocolTypeHierarchyItem.d.ts.map +1 -0
  119. package/es/common/protocolTypeHierarchyItem.js +34 -0
  120. package/es/common/protocolWorkspaceSymbol.d.ts +9 -0
  121. package/es/common/protocolWorkspaceSymbol.d.ts.map +1 -0
  122. package/es/common/protocolWorkspaceSymbol.js +36 -0
  123. package/es/common/reference.d.ts +22 -0
  124. package/es/common/reference.d.ts.map +1 -0
  125. package/es/common/reference.js +78 -0
  126. package/es/common/rename.d.ts +29 -0
  127. package/es/common/rename.d.ts.map +1 -0
  128. package/es/common/rename.js +132 -0
  129. package/es/common/selectionRange.d.ts +18 -0
  130. package/es/common/selectionRange.d.ts.map +1 -0
  131. package/es/common/selectionRange.js +108 -0
  132. package/es/common/semanticTokens.d.ts +36 -0
  133. package/es/common/semanticTokens.d.ts.map +1 -0
  134. package/es/common/semanticTokens.js +226 -0
  135. package/es/common/signatureHelp.d.ts +18 -0
  136. package/es/common/signatureHelp.d.ts.map +1 -0
  137. package/es/common/signatureHelp.js +103 -0
  138. package/es/common/textSynchronization.d.ts +104 -0
  139. package/es/common/textSynchronization.d.ts.map +1 -0
  140. package/es/common/textSynchronization.js +771 -0
  141. package/es/common/typeDefinition.d.ts +18 -0
  142. package/es/common/typeDefinition.d.ts.map +1 -0
  143. package/es/common/typeDefinition.js +89 -0
  144. package/es/common/typeHierarchy.d.ts +33 -0
  145. package/es/common/typeHierarchy.d.ts.map +1 -0
  146. package/es/common/typeHierarchy.js +138 -0
  147. package/es/common/utils/async.d.ts +42 -0
  148. package/es/common/utils/async.d.ts.map +1 -0
  149. package/es/common/utils/async.js +441 -0
  150. package/es/common/utils/is.d.ts +13 -0
  151. package/es/common/utils/is.d.ts.map +1 -0
  152. package/es/common/utils/is.js +52 -0
  153. package/es/common/utils/uuid.d.ts +23 -0
  154. package/es/common/utils/uuid.d.ts.map +1 -0
  155. package/es/common/utils/uuid.js +85 -0
  156. package/es/common/vscodeAdaptor/convertor.d.ts +7 -0
  157. package/es/common/vscodeAdaptor/convertor.d.ts.map +1 -0
  158. package/es/common/vscodeAdaptor/convertor.js +66 -0
  159. package/es/common/vscodeAdaptor/diagnosticCollection.d.ts +33 -0
  160. package/es/common/vscodeAdaptor/diagnosticCollection.d.ts.map +1 -0
  161. package/es/common/vscodeAdaptor/diagnosticCollection.js +310 -0
  162. package/es/common/vscodeAdaptor/extHostTypes.d.ts +1496 -0
  163. package/es/common/vscodeAdaptor/extHostTypes.d.ts.map +1 -0
  164. package/es/common/vscodeAdaptor/extHostTypes.js +3825 -0
  165. package/es/common/vscodeAdaptor/fileWatcher.d.ts +19 -0
  166. package/es/common/vscodeAdaptor/fileWatcher.d.ts.map +1 -0
  167. package/es/common/vscodeAdaptor/fileWatcher.js +45 -0
  168. package/es/common/vscodeAdaptor/hostTypeUtil.d.ts +192 -0
  169. package/es/common/vscodeAdaptor/hostTypeUtil.d.ts.map +1 -0
  170. package/es/common/vscodeAdaptor/hostTypeUtil.js +566 -0
  171. package/es/common/vscodeAdaptor/libro-fs.d.ts +21 -0
  172. package/es/common/vscodeAdaptor/libro-fs.d.ts.map +1 -0
  173. package/es/common/vscodeAdaptor/libro-fs.js +64 -0
  174. package/es/common/vscodeAdaptor/libroWindow.d.ts +21 -0
  175. package/es/common/vscodeAdaptor/libroWindow.d.ts.map +1 -0
  176. package/es/common/vscodeAdaptor/libroWindow.js +75 -0
  177. package/es/common/vscodeAdaptor/libroWorkspace.d.ts +33 -0
  178. package/es/common/vscodeAdaptor/libroWorkspace.d.ts.map +1 -0
  179. package/es/common/vscodeAdaptor/libroWorkspace.js +250 -0
  180. package/es/common/vscodeAdaptor/lspEnv.d.ts +8 -0
  181. package/es/common/vscodeAdaptor/lspEnv.d.ts.map +1 -0
  182. package/es/common/vscodeAdaptor/lspEnv.js +31 -0
  183. package/es/common/vscodeAdaptor/monaco-converter.d.ts +229 -0
  184. package/es/common/vscodeAdaptor/monaco-converter.d.ts.map +1 -0
  185. package/es/common/vscodeAdaptor/monaco-converter.js +1613 -0
  186. package/es/common/vscodeAdaptor/monacoLanguages.d.ts +48 -0
  187. package/es/common/vscodeAdaptor/monacoLanguages.d.ts.map +1 -0
  188. package/es/common/vscodeAdaptor/monacoLanguages.js +484 -0
  189. package/es/common/vscodeAdaptor/services.d.ts +85 -0
  190. package/es/common/vscodeAdaptor/services.d.ts.map +1 -0
  191. package/es/common/vscodeAdaptor/services.js +3 -0
  192. package/es/common/vscodeAdaptor/typings.d.ts +10 -0
  193. package/es/common/vscodeAdaptor/util.d.ts +3 -0
  194. package/es/common/vscodeAdaptor/util.d.ts.map +1 -0
  195. package/es/common/vscodeAdaptor/util.js +6 -0
  196. package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts +77 -0
  197. package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts.map +1 -0
  198. package/es/common/vscodeAdaptor/vscodeAdaptor.js +124 -0
  199. package/es/common/workspaceFolder.d.ts +32 -0
  200. package/es/common/workspaceFolder.d.ts.map +1 -0
  201. package/es/common/workspaceFolder.js +204 -0
  202. package/es/common/workspaceSymbol.d.ts +21 -0
  203. package/es/common/workspaceSymbol.d.ts.map +1 -0
  204. package/es/common/workspaceSymbol.js +101 -0
  205. package/es/constants.d.ts +2 -0
  206. package/es/constants.d.ts.map +1 -0
  207. package/es/constants.js +1 -0
  208. package/es/index.d.ts +6 -0
  209. package/es/index.d.ts.map +1 -0
  210. package/es/index.js +5 -0
  211. package/es/libro-language-client-contribution.d.ts +10 -0
  212. package/es/libro-language-client-contribution.d.ts.map +1 -0
  213. package/es/libro-language-client-contribution.js +143 -0
  214. package/es/libro-language-client-manager.d.ts +34 -0
  215. package/es/libro-language-client-manager.d.ts.map +1 -0
  216. package/es/libro-language-client-manager.js +277 -0
  217. package/es/libro-language-client.d.ts +27 -0
  218. package/es/libro-language-client.d.ts.map +1 -0
  219. package/es/libro-language-client.js +141 -0
  220. package/es/module.d.ts +3 -0
  221. package/es/module.d.ts.map +1 -0
  222. package/es/module.js +13 -0
  223. package/package.json +69 -0
  224. package/src/common/api.ts +155 -0
  225. package/src/common/callHierarchy.ts +269 -0
  226. package/src/common/client.ts +3192 -0
  227. package/src/common/codeAction.ts +237 -0
  228. package/src/common/codeConverter.ts +1409 -0
  229. package/src/common/codeLens.ts +188 -0
  230. package/src/common/colorProvider.ts +192 -0
  231. package/src/common/completion.ts +281 -0
  232. package/src/common/configuration.ts +338 -0
  233. package/src/common/declaration.ts +140 -0
  234. package/src/common/definition.ts +138 -0
  235. package/src/common/diagnostic.ts +1408 -0
  236. package/src/common/documentHighlight.ts +140 -0
  237. package/src/common/documentLink.ts +180 -0
  238. package/src/common/documentSymbol.ts +186 -0
  239. package/src/common/executeCommand.ts +129 -0
  240. package/src/common/features.ts +1157 -0
  241. package/src/common/fileOperations.ts +635 -0
  242. package/src/common/fileSystemWatcher.ts +184 -0
  243. package/src/common/foldingRange.ts +160 -0
  244. package/src/common/formatting.ts +465 -0
  245. package/src/common/hover.ts +133 -0
  246. package/src/common/implementation.ts +142 -0
  247. package/src/common/inlayHint.ts +201 -0
  248. package/src/common/inlineCompletion.ts +160 -0
  249. package/src/common/inlineValue.ts +158 -0
  250. package/src/common/linkedEditingRange.ts +141 -0
  251. package/src/common/notebook.ts +1443 -0
  252. package/src/common/progress.ts +61 -0
  253. package/src/common/progressPart.ts +151 -0
  254. package/src/common/protocolCallHierarchyItem.ts +29 -0
  255. package/src/common/protocolCodeAction.ts +17 -0
  256. package/src/common/protocolCodeLens.ts +15 -0
  257. package/src/common/protocolCompletionItem.ts +22 -0
  258. package/src/common/protocolConverter.ts +2627 -0
  259. package/src/common/protocolDiagnostic.ts +47 -0
  260. package/src/common/protocolDocumentLink.ts +17 -0
  261. package/src/common/protocolInlayHint.ts +21 -0
  262. package/src/common/protocolTypeHierarchyItem.ts +29 -0
  263. package/src/common/protocolWorkspaceSymbol.ts +39 -0
  264. package/src/common/reference.ts +144 -0
  265. package/src/common/rename.ts +230 -0
  266. package/src/common/selectionRange.ts +136 -0
  267. package/src/common/semanticTokens.ts +383 -0
  268. package/src/common/signatureHelp.ts +170 -0
  269. package/src/common/textSynchronization.ts +819 -0
  270. package/src/common/typeDefinition.ts +146 -0
  271. package/src/common/typeHierarchy.ts +248 -0
  272. package/src/common/utils/async.ts +354 -0
  273. package/src/common/utils/is.ts +63 -0
  274. package/src/common/utils/uuid.ts +136 -0
  275. package/src/common/vscodeAdaptor/convertor.ts +73 -0
  276. package/src/common/vscodeAdaptor/diagnosticCollection.ts +238 -0
  277. package/src/common/vscodeAdaptor/extHostTypes.ts +4498 -0
  278. package/src/common/vscodeAdaptor/fileWatcher.ts +36 -0
  279. package/src/common/vscodeAdaptor/hostTypeUtil.ts +539 -0
  280. package/src/common/vscodeAdaptor/libro-fs.ts +51 -0
  281. package/src/common/vscodeAdaptor/libroWindow.ts +85 -0
  282. package/src/common/vscodeAdaptor/libroWorkspace.ts +261 -0
  283. package/src/common/vscodeAdaptor/lspEnv.ts +16 -0
  284. package/src/common/vscodeAdaptor/monaco-converter.ts +1800 -0
  285. package/src/common/vscodeAdaptor/monacoLanguages.ts +511 -0
  286. package/src/common/vscodeAdaptor/services.ts +278 -0
  287. package/src/common/vscodeAdaptor/typings.d.ts +10 -0
  288. package/src/common/vscodeAdaptor/util.ts +7 -0
  289. package/src/common/vscodeAdaptor/vscodeAdaptor.ts +122 -0
  290. package/src/common/workspaceFolder.ts +236 -0
  291. package/src/common/workspaceSymbol.ts +166 -0
  292. package/src/constants.ts +1 -0
  293. package/src/index.spec.ts +7 -0
  294. package/src/index.ts +5 -0
  295. package/src/libro-language-client-contribution.ts +49 -0
  296. package/src/libro-language-client-manager.ts +131 -0
  297. package/src/libro-language-client.ts +100 -0
  298. package/src/module.ts +19 -0
@@ -0,0 +1,1982 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ 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); } }
8
+ 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); }); }; }
9
+ 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; } } }; }
10
+ 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); }
11
+ 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; }
12
+ /* --------------------------------------------------------------------------------------------
13
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14
+ * Licensed under the MIT License. See License.txt in the project root for license information.
15
+ * ------------------------------------------------------------------------------------------ */
16
+
17
+ import * as ls from '@difizen/vscode-languageserver-protocol';
18
+ import { NotebookCellTextDocumentFilter, TextDocumentFilter } from '@difizen/vscode-languageserver-protocol';
19
+ import { URI } from 'vscode-uri';
20
+ import ProtocolCallHierarchyItem from "./protocolCallHierarchyItem.js";
21
+ import ProtocolCodeAction from "./protocolCodeAction.js";
22
+ import ProtocolCodeLens from "./protocolCodeLens.js";
23
+ import ProtocolCompletionItem from "./protocolCompletionItem.js";
24
+ import { ProtocolDiagnostic, DiagnosticCode } from "./protocolDiagnostic.js";
25
+ import ProtocolDocumentLink from "./protocolDocumentLink.js";
26
+ import ProtocolInlayHint from "./protocolInlayHint.js";
27
+ import ProtocolTypeHierarchyItem from "./protocolTypeHierarchyItem.js";
28
+ import WorkspaceSymbol from "./protocolWorkspaceSymbol.js";
29
+ import * as async from "./utils/async.js";
30
+ import * as Is from "./utils/is.js";
31
+ import { Position, Uri, CompletionList, DiagnosticSeverity, DiagnosticTag, Hover, DocumentHighlight, DocumentHighlightKind, DocumentSymbol, ParameterInformation, SignatureHelp, SignatureInformation, SymbolInformation, SymbolKind, SymbolTag, TextEdit, CodeActionKind, WorkspaceEdit, CallHierarchyIncomingCall, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, SemanticTokensEdit, SemanticTokensEdits, CallHierarchyOutgoingCall, InlineSuggestion as InlineCompletionItem, InlineSuggestionList as InlineCompletionList, MarkdownString, SemanticTokens, LinkedEditingRanges } from "./vscodeAdaptor/vscodeAdaptor.js";
32
+ import { DiagnosticRelatedInformation, Range, Location, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, RelativePattern, InlayHintLabelPart } from "./vscodeAdaptor/vscodeAdaptor.js";
33
+ import { CompletionItemKind, CompletionItemTag, workspace } from "./vscodeAdaptor/vscodeAdaptor.js";
34
+ import { SnippetString } from "./vscodeAdaptor/vscodeAdaptor.js";
35
+ var CodeBlock;
36
+ (function (_CodeBlock) {
37
+ function is(value) {
38
+ var candidate = value;
39
+ return candidate && Is.string(candidate.language) && Is.string(candidate.value);
40
+ }
41
+ _CodeBlock.is = is;
42
+ })(CodeBlock || (CodeBlock = {}));
43
+ export function createConverter(uriConverter, trustMarkdown, supportHtml) {
44
+ var nullConverter = function nullConverter(value) {
45
+ return Uri.parse(value);
46
+ };
47
+ var _uriConverter = uriConverter || nullConverter;
48
+ function asUri(value) {
49
+ return _uriConverter(value);
50
+ }
51
+ function asDocumentSelector(selector) {
52
+ var result = [];
53
+ var _iterator = _createForOfIteratorHelper(selector),
54
+ _step;
55
+ try {
56
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
57
+ var filter = _step.value;
58
+ if (typeof filter === 'string') {
59
+ result.push(filter);
60
+ } else if (NotebookCellTextDocumentFilter.is(filter)) {
61
+ // We first need to check for the notebook cell filter since a TextDocumentFilter would
62
+ // match both (e.g. the notebook is optional).
63
+ if (typeof filter.notebook === 'string') {
64
+ result.push({
65
+ notebookType: filter.notebook,
66
+ language: filter.language
67
+ });
68
+ } else {
69
+ var _filter$notebook$note;
70
+ var notebookType = (_filter$notebook$note = filter.notebook.notebookType) !== null && _filter$notebook$note !== void 0 ? _filter$notebook$note : '*';
71
+ result.push({
72
+ notebookType: notebookType,
73
+ scheme: filter.notebook.scheme,
74
+ pattern: filter.notebook.pattern,
75
+ language: filter.language
76
+ });
77
+ }
78
+ } else if (TextDocumentFilter.is(filter)) {
79
+ result.push({
80
+ language: filter.language,
81
+ scheme: filter.scheme,
82
+ pattern: filter.pattern
83
+ });
84
+ }
85
+ }
86
+ } catch (err) {
87
+ _iterator.e(err);
88
+ } finally {
89
+ _iterator.f();
90
+ }
91
+ return result;
92
+ }
93
+ function asDiagnostics(_x, _x2) {
94
+ return _asDiagnostics.apply(this, arguments);
95
+ }
96
+ function _asDiagnostics() {
97
+ _asDiagnostics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(diagnostics, token) {
98
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
99
+ while (1) switch (_context2.prev = _context2.next) {
100
+ case 0:
101
+ return _context2.abrupt("return", async.map(diagnostics, asDiagnostic, token));
102
+ case 1:
103
+ case "end":
104
+ return _context2.stop();
105
+ }
106
+ }, _callee2);
107
+ }));
108
+ return _asDiagnostics.apply(this, arguments);
109
+ }
110
+ function asDiagnosticsSync(diagnostics) {
111
+ var result = new Array(diagnostics.length);
112
+ for (var i = 0; i < diagnostics.length; i++) {
113
+ result[i] = asDiagnostic(diagnostics[i]);
114
+ }
115
+ return result;
116
+ }
117
+ function asDiagnostic(diagnostic) {
118
+ var result = new ProtocolDiagnostic(asRange(diagnostic.range), diagnostic.message, asDiagnosticSeverity(diagnostic.severity), diagnostic.data);
119
+ if (diagnostic.code !== undefined) {
120
+ if (typeof diagnostic.code === 'string' || typeof diagnostic.code === 'number') {
121
+ if (ls.CodeDescription.is(diagnostic.codeDescription)) {
122
+ result.code = {
123
+ value: diagnostic.code,
124
+ target: asUri(diagnostic.codeDescription.href)
125
+ };
126
+ } else {
127
+ result.code = diagnostic.code;
128
+ }
129
+ } else if (DiagnosticCode.is(diagnostic.code)) {
130
+ // This is for backwards compatibility of a proposed API.
131
+ // We should remove this at some point.
132
+ result.hasDiagnosticCode = true;
133
+ var diagnosticCode = diagnostic.code;
134
+ result.code = {
135
+ value: diagnosticCode.value,
136
+ target: asUri(diagnosticCode.target)
137
+ };
138
+ }
139
+ }
140
+ if (diagnostic.source) {
141
+ result.source = diagnostic.source;
142
+ }
143
+ if (diagnostic.relatedInformation) {
144
+ result.relatedInformation = asRelatedInformation(diagnostic.relatedInformation);
145
+ }
146
+ if (Array.isArray(diagnostic.tags)) {
147
+ result.tags = asDiagnosticTags(diagnostic.tags);
148
+ }
149
+ return result;
150
+ }
151
+ function asRelatedInformation(relatedInformation) {
152
+ var result = new Array(relatedInformation.length);
153
+ for (var i = 0; i < relatedInformation.length; i++) {
154
+ var info = relatedInformation[i];
155
+ result[i] = new DiagnosticRelatedInformation(asLocation(info.location), info.message);
156
+ }
157
+ return result;
158
+ }
159
+ function asDiagnosticTags(tags) {
160
+ if (!tags) {
161
+ return undefined;
162
+ }
163
+ var result = [];
164
+ var _iterator2 = _createForOfIteratorHelper(tags),
165
+ _step2;
166
+ try {
167
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
168
+ var _tag = _step2.value;
169
+ var converted = asDiagnosticTag(_tag);
170
+ if (converted !== undefined) {
171
+ result.push(converted);
172
+ }
173
+ }
174
+ } catch (err) {
175
+ _iterator2.e(err);
176
+ } finally {
177
+ _iterator2.f();
178
+ }
179
+ return result.length > 0 ? result : undefined;
180
+ }
181
+ function asDiagnosticTag(tag) {
182
+ switch (tag) {
183
+ case ls.DiagnosticTag.Unnecessary:
184
+ return DiagnosticTag.Unnecessary;
185
+ case ls.DiagnosticTag.Deprecated:
186
+ return DiagnosticTag.Deprecated;
187
+ default:
188
+ return undefined;
189
+ }
190
+ }
191
+ function asPosition(value) {
192
+ return value ? new Position(value.line, value.character) : undefined;
193
+ }
194
+ function asRange(value) {
195
+ return value ? new Range(value.start.line, value.start.character, value.end.line, value.end.character) : undefined;
196
+ }
197
+ function asRanges(_x3, _x4) {
198
+ return _asRanges.apply(this, arguments);
199
+ }
200
+ function _asRanges() {
201
+ _asRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(items, token) {
202
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
203
+ while (1) switch (_context3.prev = _context3.next) {
204
+ case 0:
205
+ return _context3.abrupt("return", async.map(items, function (range) {
206
+ return new Range(range.start.line, range.start.character, range.end.line, range.end.character);
207
+ }, token));
208
+ case 1:
209
+ case "end":
210
+ return _context3.stop();
211
+ }
212
+ }, _callee3);
213
+ }));
214
+ return _asRanges.apply(this, arguments);
215
+ }
216
+ function asDiagnosticSeverity(value) {
217
+ if (value === undefined || value === null) {
218
+ return DiagnosticSeverity.Error;
219
+ }
220
+ switch (value) {
221
+ case ls.DiagnosticSeverity.Error:
222
+ return DiagnosticSeverity.Error;
223
+ case ls.DiagnosticSeverity.Warning:
224
+ return DiagnosticSeverity.Warning;
225
+ case ls.DiagnosticSeverity.Information:
226
+ return DiagnosticSeverity.Information;
227
+ case ls.DiagnosticSeverity.Hint:
228
+ return DiagnosticSeverity.Hint;
229
+ }
230
+ return DiagnosticSeverity.Error;
231
+ }
232
+ function asHoverContent(value) {
233
+ if (Is.string(value)) {
234
+ return asMarkdownString(value);
235
+ } else if (CodeBlock.is(value)) {
236
+ var result = asMarkdownString();
237
+ return result.appendCodeblock(value.value, value.language);
238
+ } else if (Array.isArray(value)) {
239
+ var _result = [];
240
+ var _iterator3 = _createForOfIteratorHelper(value),
241
+ _step3;
242
+ try {
243
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
244
+ var element = _step3.value;
245
+ var _item = asMarkdownString();
246
+ if (CodeBlock.is(element)) {
247
+ _item.appendCodeblock(element.value, element.language);
248
+ } else {
249
+ _item.appendMarkdown(element);
250
+ }
251
+ _result.push(_item);
252
+ }
253
+ } catch (err) {
254
+ _iterator3.e(err);
255
+ } finally {
256
+ _iterator3.f();
257
+ }
258
+ return _result;
259
+ } else {
260
+ return asMarkdownString(value);
261
+ }
262
+ }
263
+ function asDocumentation(value) {
264
+ if (Is.string(value)) {
265
+ return value;
266
+ } else {
267
+ switch (value.kind) {
268
+ case ls.MarkupKind.Markdown:
269
+ return asMarkdownString(value.value);
270
+ case ls.MarkupKind.PlainText:
271
+ return value.value;
272
+ default:
273
+ return "Unsupported Markup content received. Kind is: ".concat(value.kind);
274
+ }
275
+ }
276
+ }
277
+ function asMarkdownString(value) {
278
+ var result;
279
+ if (value === undefined || typeof value === 'string') {
280
+ result = new MarkdownString(value);
281
+ } else {
282
+ switch (value.kind) {
283
+ case ls.MarkupKind.Markdown:
284
+ result = new MarkdownString(value.value);
285
+ break;
286
+ case ls.MarkupKind.PlainText:
287
+ result = new MarkdownString();
288
+ result.appendText(value.value);
289
+ break;
290
+ default:
291
+ result = new MarkdownString();
292
+ result.appendText("Unsupported Markup content received. Kind is: ".concat(value.kind));
293
+ break;
294
+ }
295
+ }
296
+ result.isTrusted = trustMarkdown;
297
+ result.supportHtml = supportHtml;
298
+ return result;
299
+ }
300
+ function asHover(hover) {
301
+ if (!hover) {
302
+ return undefined;
303
+ }
304
+ return new Hover(asHoverContent(hover.contents), asRange(hover.range));
305
+ }
306
+ function asCompletionResult(_x5, _x6, _x7) {
307
+ return _asCompletionResult.apply(this, arguments);
308
+ }
309
+ function _asCompletionResult() {
310
+ _asCompletionResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(value, allCommitCharacters, token) {
311
+ var list, _getCompletionItemDef, defaultRange, commitCharacters, converted;
312
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
313
+ while (1) switch (_context4.prev = _context4.next) {
314
+ case 0:
315
+ if (value) {
316
+ _context4.next = 2;
317
+ break;
318
+ }
319
+ return _context4.abrupt("return", undefined);
320
+ case 2:
321
+ if (!Array.isArray(value)) {
322
+ _context4.next = 4;
323
+ break;
324
+ }
325
+ return _context4.abrupt("return", async.map(value, function (item) {
326
+ return asCompletionItem(item, allCommitCharacters);
327
+ }, token));
328
+ case 4:
329
+ list = value;
330
+ _getCompletionItemDef = getCompletionItemDefaults(list, allCommitCharacters), defaultRange = _getCompletionItemDef.defaultRange, commitCharacters = _getCompletionItemDef.commitCharacters;
331
+ _context4.next = 8;
332
+ return async.map(list.items, function (item) {
333
+ var _list$itemDefaults3, _list$itemDefaults4, _list$itemDefaults5;
334
+ return asCompletionItem(item, commitCharacters, defaultRange, (_list$itemDefaults3 = list.itemDefaults) === null || _list$itemDefaults3 === void 0 ? void 0 : _list$itemDefaults3.insertTextMode, (_list$itemDefaults4 = list.itemDefaults) === null || _list$itemDefaults4 === void 0 ? void 0 : _list$itemDefaults4.insertTextFormat, (_list$itemDefaults5 = list.itemDefaults) === null || _list$itemDefaults5 === void 0 ? void 0 : _list$itemDefaults5.data);
335
+ }, token);
336
+ case 8:
337
+ converted = _context4.sent;
338
+ return _context4.abrupt("return", new CompletionList(converted, list.isIncomplete));
339
+ case 10:
340
+ case "end":
341
+ return _context4.stop();
342
+ }
343
+ }, _callee4);
344
+ }));
345
+ return _asCompletionResult.apply(this, arguments);
346
+ }
347
+ function getCompletionItemDefaults(list, allCommitCharacters) {
348
+ var _list$itemDefaults, _list$itemDefaults$co, _list$itemDefaults2;
349
+ var rangeDefaults = (_list$itemDefaults = list.itemDefaults) === null || _list$itemDefaults === void 0 ? void 0 : _list$itemDefaults.editRange;
350
+ var commitCharacters = (_list$itemDefaults$co = (_list$itemDefaults2 = list.itemDefaults) === null || _list$itemDefaults2 === void 0 ? void 0 : _list$itemDefaults2.commitCharacters) !== null && _list$itemDefaults$co !== void 0 ? _list$itemDefaults$co : allCommitCharacters;
351
+ return ls.Range.is(rangeDefaults) ? {
352
+ defaultRange: asRange(rangeDefaults),
353
+ commitCharacters: commitCharacters
354
+ } : rangeDefaults !== undefined ? {
355
+ defaultRange: {
356
+ inserting: asRange(rangeDefaults.insert),
357
+ replacing: asRange(rangeDefaults.replace)
358
+ },
359
+ commitCharacters: commitCharacters
360
+ } : {
361
+ defaultRange: undefined,
362
+ commitCharacters: commitCharacters
363
+ };
364
+ }
365
+ function asCompletionItemKind(value) {
366
+ // Protocol item kind is 1 based, codes item kind is zero based.
367
+ if (ls.CompletionItemKind.Text <= value && value <= ls.CompletionItemKind.TypeParameter) {
368
+ return [value - 1, undefined];
369
+ }
370
+ return [CompletionItemKind.Text, value];
371
+ }
372
+ function asCompletionItemTag(tag) {
373
+ switch (tag) {
374
+ case ls.CompletionItemTag.Deprecated:
375
+ return CompletionItemTag.Deprecated;
376
+ }
377
+ return undefined;
378
+ }
379
+ function asCompletionItemTags(tags) {
380
+ if (tags === undefined || tags === null) {
381
+ return [];
382
+ }
383
+ var result = [];
384
+ var _iterator4 = _createForOfIteratorHelper(tags),
385
+ _step4;
386
+ try {
387
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
388
+ var _tag2 = _step4.value;
389
+ var converted = asCompletionItemTag(_tag2);
390
+ if (converted !== undefined) {
391
+ result.push(converted);
392
+ }
393
+ }
394
+ } catch (err) {
395
+ _iterator4.e(err);
396
+ } finally {
397
+ _iterator4.f();
398
+ }
399
+ return result;
400
+ }
401
+ function asCompletionItem(item, defaultCommitCharacters, defaultRange, defaultInsertTextMode, defaultInsertTextFormat, defaultData) {
402
+ var _item$data, _item$insertTextMode;
403
+ var tags = asCompletionItemTags(item.tags);
404
+ var label = asCompletionItemLabel(item);
405
+ var result = new ProtocolCompletionItem(label);
406
+ if (item.detail) {
407
+ result.detail = item.detail;
408
+ }
409
+ if (item.documentation) {
410
+ result.documentation = asDocumentation(item.documentation);
411
+ result.documentationFormat = Is.string(item.documentation) ? '$string' : item.documentation.kind;
412
+ }
413
+ if (item.filterText) {
414
+ result.filterText = item.filterText;
415
+ }
416
+ var insertText = asCompletionInsertText(item, defaultRange, defaultInsertTextFormat);
417
+ if (insertText) {
418
+ result.insertText = insertText.text;
419
+ result.range = insertText.range;
420
+ result.fromEdit = insertText.fromEdit;
421
+ }
422
+ if (Is.number(item.kind)) {
423
+ var _asCompletionItemKind = asCompletionItemKind(item.kind),
424
+ _asCompletionItemKind2 = _slicedToArray(_asCompletionItemKind, 2),
425
+ itemKind = _asCompletionItemKind2[0],
426
+ original = _asCompletionItemKind2[1];
427
+ result.kind = itemKind;
428
+ if (original) {
429
+ result.originalItemKind = original;
430
+ }
431
+ }
432
+ if (item.sortText) {
433
+ result.sortText = item.sortText;
434
+ }
435
+ if (item.additionalTextEdits) {
436
+ result.additionalTextEdits = asTextEditsSync(item.additionalTextEdits);
437
+ }
438
+ var commitCharacters = item.commitCharacters !== undefined ? Is.stringArray(item.commitCharacters) ? item.commitCharacters : undefined : defaultCommitCharacters;
439
+ if (commitCharacters) {
440
+ result.commitCharacters = commitCharacters.slice();
441
+ }
442
+ if (item.command) {
443
+ result.command = asCommand(item.command);
444
+ }
445
+ if (item.deprecated === true || item.deprecated === false) {
446
+ result.deprecated = item.deprecated;
447
+ if (item.deprecated === true) {
448
+ tags.push(CompletionItemTag.Deprecated);
449
+ }
450
+ }
451
+ if (item.preselect === true || item.preselect === false) {
452
+ result.preselect = item.preselect;
453
+ }
454
+ var data = (_item$data = item.data) !== null && _item$data !== void 0 ? _item$data : defaultData;
455
+ if (data !== undefined) {
456
+ result.data = data;
457
+ }
458
+ if (tags.length > 0) {
459
+ result.tags = tags;
460
+ }
461
+ var insertTextMode = (_item$insertTextMode = item.insertTextMode) !== null && _item$insertTextMode !== void 0 ? _item$insertTextMode : defaultInsertTextMode;
462
+ if (insertTextMode !== undefined) {
463
+ result.insertTextMode = insertTextMode;
464
+ if (insertTextMode === ls.InsertTextMode.asIs) {
465
+ result.keepWhitespace = true;
466
+ }
467
+ }
468
+ return result;
469
+ }
470
+ function asCompletionItemLabel(item) {
471
+ if (ls.CompletionItemLabelDetails.is(item.labelDetails)) {
472
+ return {
473
+ label: item.label,
474
+ detail: item.labelDetails.detail,
475
+ description: item.labelDetails.description
476
+ };
477
+ } else {
478
+ return item.label;
479
+ }
480
+ }
481
+ function asCompletionInsertText(item, defaultRange, defaultInsertTextFormat) {
482
+ var _item$insertTextForma;
483
+ var insertTextFormat = (_item$insertTextForma = item.insertTextFormat) !== null && _item$insertTextForma !== void 0 ? _item$insertTextForma : defaultInsertTextFormat;
484
+ if (item.textEdit !== undefined || defaultRange !== undefined) {
485
+ var _item$textEditText;
486
+ var _ref = item.textEdit !== undefined ? getCompletionRangeAndText(item.textEdit) : [defaultRange, (_item$textEditText = item.textEditText) !== null && _item$textEditText !== void 0 ? _item$textEditText : item.label],
487
+ _ref2 = _slicedToArray(_ref, 2),
488
+ range = _ref2[0],
489
+ newText = _ref2[1];
490
+ if (insertTextFormat === ls.InsertTextFormat.Snippet) {
491
+ return {
492
+ text: new SnippetString(newText),
493
+ range: range,
494
+ fromEdit: true
495
+ };
496
+ } else {
497
+ return {
498
+ text: newText,
499
+ range: range,
500
+ fromEdit: true
501
+ };
502
+ }
503
+ } else if (item.insertText) {
504
+ if (insertTextFormat === ls.InsertTextFormat.Snippet) {
505
+ return {
506
+ text: new SnippetString(item.insertText),
507
+ fromEdit: false
508
+ };
509
+ } else {
510
+ return {
511
+ text: item.insertText,
512
+ fromEdit: false
513
+ };
514
+ }
515
+ } else {
516
+ return undefined;
517
+ }
518
+ }
519
+ function getCompletionRangeAndText(value) {
520
+ if (ls.InsertReplaceEdit.is(value)) {
521
+ return [{
522
+ inserting: asRange(value.insert),
523
+ replacing: asRange(value.replace)
524
+ }, value.newText];
525
+ } else {
526
+ return [asRange(value.range), value.newText];
527
+ }
528
+ }
529
+ function asTextEdit(edit) {
530
+ if (!edit) {
531
+ return undefined;
532
+ }
533
+ return new TextEdit(asRange(edit.range), edit.newText);
534
+ }
535
+ function asTextEdits(_x8, _x9) {
536
+ return _asTextEdits.apply(this, arguments);
537
+ }
538
+ function _asTextEdits() {
539
+ _asTextEdits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(items, token) {
540
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
541
+ while (1) switch (_context5.prev = _context5.next) {
542
+ case 0:
543
+ if (items) {
544
+ _context5.next = 2;
545
+ break;
546
+ }
547
+ return _context5.abrupt("return", undefined);
548
+ case 2:
549
+ return _context5.abrupt("return", async.map(items, asTextEdit, token));
550
+ case 3:
551
+ case "end":
552
+ return _context5.stop();
553
+ }
554
+ }, _callee5);
555
+ }));
556
+ return _asTextEdits.apply(this, arguments);
557
+ }
558
+ function asTextEditsSync(items) {
559
+ if (!items) {
560
+ return undefined;
561
+ }
562
+ var result = new Array(items.length);
563
+ for (var i = 0; i < items.length; i++) {
564
+ result[i] = asTextEdit(items[i]);
565
+ }
566
+ return result;
567
+ }
568
+ function asSignatureHelp(_x10, _x11) {
569
+ return _asSignatureHelp.apply(this, arguments);
570
+ }
571
+ function _asSignatureHelp() {
572
+ _asSignatureHelp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(item, token) {
573
+ var result;
574
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
575
+ while (1) switch (_context6.prev = _context6.next) {
576
+ case 0:
577
+ if (item) {
578
+ _context6.next = 2;
579
+ break;
580
+ }
581
+ return _context6.abrupt("return", undefined);
582
+ case 2:
583
+ result = new SignatureHelp();
584
+ if (Is.number(item.activeSignature)) {
585
+ result.activeSignature = item.activeSignature;
586
+ } else {
587
+ // activeSignature was optional in the past
588
+ result.activeSignature = 0;
589
+ }
590
+ if (Is.number(item.activeParameter)) {
591
+ result.activeParameter = item.activeParameter;
592
+ } else if (item.activeParameter === null) {
593
+ result.activeParameter = -1;
594
+ } else {
595
+ // activeParameter was optional in the past
596
+ result.activeParameter = 0;
597
+ }
598
+ if (!item.signatures) {
599
+ _context6.next = 9;
600
+ break;
601
+ }
602
+ _context6.next = 8;
603
+ return asSignatureInformations(item.signatures, token);
604
+ case 8:
605
+ result.signatures = _context6.sent;
606
+ case 9:
607
+ return _context6.abrupt("return", result);
608
+ case 10:
609
+ case "end":
610
+ return _context6.stop();
611
+ }
612
+ }, _callee6);
613
+ }));
614
+ return _asSignatureHelp.apply(this, arguments);
615
+ }
616
+ function asSignatureInformations(_x12, _x13) {
617
+ return _asSignatureInformations.apply(this, arguments);
618
+ }
619
+ function _asSignatureInformations() {
620
+ _asSignatureInformations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(items, token) {
621
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
622
+ while (1) switch (_context7.prev = _context7.next) {
623
+ case 0:
624
+ return _context7.abrupt("return", async.mapAsync(items, asSignatureInformation, token));
625
+ case 1:
626
+ case "end":
627
+ return _context7.stop();
628
+ }
629
+ }, _callee7);
630
+ }));
631
+ return _asSignatureInformations.apply(this, arguments);
632
+ }
633
+ function asSignatureInformation(_x14, _x15) {
634
+ return _asSignatureInformation.apply(this, arguments);
635
+ }
636
+ function _asSignatureInformation() {
637
+ _asSignatureInformation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(item, token) {
638
+ var result, _item$activeParameter;
639
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
640
+ while (1) switch (_context8.prev = _context8.next) {
641
+ case 0:
642
+ result = new SignatureInformation(item.label);
643
+ if (item.documentation !== undefined) {
644
+ result.documentation = asDocumentation(item.documentation);
645
+ }
646
+ if (!(item.parameters !== undefined)) {
647
+ _context8.next = 6;
648
+ break;
649
+ }
650
+ _context8.next = 5;
651
+ return asParameterInformations(item.parameters, token);
652
+ case 5:
653
+ result.parameters = _context8.sent;
654
+ case 6:
655
+ if (item.activeParameter !== undefined) {
656
+ result.activeParameter = (_item$activeParameter = item.activeParameter) !== null && _item$activeParameter !== void 0 ? _item$activeParameter : -1;
657
+ }
658
+ return _context8.abrupt("return", result);
659
+ case 8:
660
+ case "end":
661
+ return _context8.stop();
662
+ }
663
+ }, _callee8);
664
+ }));
665
+ return _asSignatureInformation.apply(this, arguments);
666
+ }
667
+ function asParameterInformations(items, token) {
668
+ return async.map(items, asParameterInformation, token);
669
+ }
670
+ function asParameterInformation(item) {
671
+ var result = new ParameterInformation(item.label);
672
+ if (item.documentation) {
673
+ result.documentation = asDocumentation(item.documentation);
674
+ }
675
+ return result;
676
+ }
677
+ function asLocation(item) {
678
+ return item ? new Location(_uriConverter(item.uri), asRange(item.range)) : undefined;
679
+ }
680
+ function asDeclarationResult(_x16, _x17) {
681
+ return _asDeclarationResult.apply(this, arguments);
682
+ }
683
+ function _asDeclarationResult() {
684
+ _asDeclarationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(item, token) {
685
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
686
+ while (1) switch (_context9.prev = _context9.next) {
687
+ case 0:
688
+ if (item) {
689
+ _context9.next = 2;
690
+ break;
691
+ }
692
+ return _context9.abrupt("return", undefined);
693
+ case 2:
694
+ return _context9.abrupt("return", asLocationResult(item, token));
695
+ case 3:
696
+ case "end":
697
+ return _context9.stop();
698
+ }
699
+ }, _callee9);
700
+ }));
701
+ return _asDeclarationResult.apply(this, arguments);
702
+ }
703
+ function asDefinitionResult(_x18, _x19) {
704
+ return _asDefinitionResult.apply(this, arguments);
705
+ }
706
+ function _asDefinitionResult() {
707
+ _asDefinitionResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(item, token) {
708
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
709
+ while (1) switch (_context10.prev = _context10.next) {
710
+ case 0:
711
+ if (item) {
712
+ _context10.next = 2;
713
+ break;
714
+ }
715
+ return _context10.abrupt("return", undefined);
716
+ case 2:
717
+ return _context10.abrupt("return", asLocationResult(item, token));
718
+ case 3:
719
+ case "end":
720
+ return _context10.stop();
721
+ }
722
+ }, _callee10);
723
+ }));
724
+ return _asDefinitionResult.apply(this, arguments);
725
+ }
726
+ function asLocationLink(item) {
727
+ if (!item) {
728
+ return undefined;
729
+ }
730
+ var result = {
731
+ targetUri: _uriConverter(item.targetUri),
732
+ targetRange: asRange(item.targetRange),
733
+ // See issue: https://github.com/Microsoft/vscode/issues/58649
734
+ originSelectionRange: asRange(item.originSelectionRange),
735
+ targetSelectionRange: asRange(item.targetSelectionRange)
736
+ };
737
+ if (!result.targetSelectionRange) {
738
+ throw new Error("targetSelectionRange must not be undefined or null");
739
+ }
740
+ return result;
741
+ }
742
+ function asLocationResult(_x20, _x21) {
743
+ return _asLocationResult.apply(this, arguments);
744
+ }
745
+ function _asLocationResult() {
746
+ _asLocationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(item, token) {
747
+ var links, locations;
748
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
749
+ while (1) switch (_context11.prev = _context11.next) {
750
+ case 0:
751
+ if (item) {
752
+ _context11.next = 2;
753
+ break;
754
+ }
755
+ return _context11.abrupt("return", undefined);
756
+ case 2:
757
+ if (!Is.array(item)) {
758
+ _context11.next = 16;
759
+ break;
760
+ }
761
+ if (!(item.length === 0)) {
762
+ _context11.next = 7;
763
+ break;
764
+ }
765
+ return _context11.abrupt("return", []);
766
+ case 7:
767
+ if (!ls.LocationLink.is(item[0])) {
768
+ _context11.next = 12;
769
+ break;
770
+ }
771
+ links = item;
772
+ return _context11.abrupt("return", async.map(links, asLocationLink, token));
773
+ case 12:
774
+ locations = item;
775
+ return _context11.abrupt("return", async.map(locations, asLocation, token));
776
+ case 14:
777
+ _context11.next = 21;
778
+ break;
779
+ case 16:
780
+ if (!ls.LocationLink.is(item)) {
781
+ _context11.next = 20;
782
+ break;
783
+ }
784
+ return _context11.abrupt("return", [asLocationLink(item)]);
785
+ case 20:
786
+ return _context11.abrupt("return", asLocation(item));
787
+ case 21:
788
+ case "end":
789
+ return _context11.stop();
790
+ }
791
+ }, _callee11);
792
+ }));
793
+ return _asLocationResult.apply(this, arguments);
794
+ }
795
+ function asReferences(_x22, _x23) {
796
+ return _asReferences.apply(this, arguments);
797
+ }
798
+ function _asReferences() {
799
+ _asReferences = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(values, token) {
800
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
801
+ while (1) switch (_context12.prev = _context12.next) {
802
+ case 0:
803
+ if (values) {
804
+ _context12.next = 2;
805
+ break;
806
+ }
807
+ return _context12.abrupt("return", undefined);
808
+ case 2:
809
+ return _context12.abrupt("return", async.map(values, asLocation, token));
810
+ case 3:
811
+ case "end":
812
+ return _context12.stop();
813
+ }
814
+ }, _callee12);
815
+ }));
816
+ return _asReferences.apply(this, arguments);
817
+ }
818
+ function asDocumentHighlights(_x24, _x25) {
819
+ return _asDocumentHighlights.apply(this, arguments);
820
+ }
821
+ function _asDocumentHighlights() {
822
+ _asDocumentHighlights = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(values, token) {
823
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
824
+ while (1) switch (_context13.prev = _context13.next) {
825
+ case 0:
826
+ if (values) {
827
+ _context13.next = 2;
828
+ break;
829
+ }
830
+ return _context13.abrupt("return", undefined);
831
+ case 2:
832
+ return _context13.abrupt("return", async.map(values, asDocumentHighlight, token));
833
+ case 3:
834
+ case "end":
835
+ return _context13.stop();
836
+ }
837
+ }, _callee13);
838
+ }));
839
+ return _asDocumentHighlights.apply(this, arguments);
840
+ }
841
+ function asDocumentHighlight(item) {
842
+ var result = new DocumentHighlight(asRange(item.range));
843
+ if (Is.number(item.kind)) {
844
+ result.kind = asDocumentHighlightKind(item.kind);
845
+ }
846
+ return result;
847
+ }
848
+ function asDocumentHighlightKind(item) {
849
+ switch (item) {
850
+ case ls.DocumentHighlightKind.Text:
851
+ return DocumentHighlightKind.Text;
852
+ case ls.DocumentHighlightKind.Read:
853
+ return DocumentHighlightKind.Read;
854
+ case ls.DocumentHighlightKind.Write:
855
+ return DocumentHighlightKind.Write;
856
+ }
857
+ return DocumentHighlightKind.Text;
858
+ }
859
+ function asSymbolInformations(_x26, _x27) {
860
+ return _asSymbolInformations.apply(this, arguments);
861
+ }
862
+ function _asSymbolInformations() {
863
+ _asSymbolInformations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(values, token) {
864
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
865
+ while (1) switch (_context14.prev = _context14.next) {
866
+ case 0:
867
+ if (values) {
868
+ _context14.next = 2;
869
+ break;
870
+ }
871
+ return _context14.abrupt("return", undefined);
872
+ case 2:
873
+ return _context14.abrupt("return", async.map(values, asSymbolInformation, token));
874
+ case 3:
875
+ case "end":
876
+ return _context14.stop();
877
+ }
878
+ }, _callee14);
879
+ }));
880
+ return _asSymbolInformations.apply(this, arguments);
881
+ }
882
+ function asSymbolKind(item) {
883
+ if (item <= ls.SymbolKind.TypeParameter) {
884
+ // Symbol kind is one based in the protocol and zero based in
885
+ return item - 1;
886
+ }
887
+ return SymbolKind.Property;
888
+ }
889
+ function asSymbolTag(value) {
890
+ switch (value) {
891
+ case ls.SymbolTag.Deprecated:
892
+ return SymbolTag.Deprecated;
893
+ default:
894
+ return undefined;
895
+ }
896
+ }
897
+ function asSymbolTags(items) {
898
+ if (items === undefined || items === null) {
899
+ return undefined;
900
+ }
901
+ var result = [];
902
+ var _iterator5 = _createForOfIteratorHelper(items),
903
+ _step5;
904
+ try {
905
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
906
+ var _item2 = _step5.value;
907
+ var converted = asSymbolTag(_item2);
908
+ if (converted !== undefined) {
909
+ result.push(converted);
910
+ }
911
+ }
912
+ } catch (err) {
913
+ _iterator5.e(err);
914
+ } finally {
915
+ _iterator5.f();
916
+ }
917
+ return result.length === 0 ? undefined : result;
918
+ }
919
+ function asSymbolInformation(item) {
920
+ var _item$containerName, _item$containerName2;
921
+ var data = item.data;
922
+ var location = item.location;
923
+ var result = location.range === undefined || data !== undefined ? new WorkspaceSymbol(item.name, asSymbolKind(item.kind), (_item$containerName = item.containerName) !== null && _item$containerName !== void 0 ? _item$containerName : '', location.range === undefined ? _uriConverter(location.uri) : new Location(_uriConverter(item.location.uri), asRange(location.range)), data) : new SymbolInformation(item.name, asSymbolKind(item.kind), (_item$containerName2 = item.containerName) !== null && _item$containerName2 !== void 0 ? _item$containerName2 : '', new Location(_uriConverter(item.location.uri), asRange(location.range)));
924
+ fillTags(result, item);
925
+ return result;
926
+ }
927
+ function asDocumentSymbols(_x28, _x29) {
928
+ return _asDocumentSymbols.apply(this, arguments);
929
+ }
930
+ function _asDocumentSymbols() {
931
+ _asDocumentSymbols = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(values, token) {
932
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
933
+ while (1) switch (_context15.prev = _context15.next) {
934
+ case 0:
935
+ if (!(values === undefined || values === null)) {
936
+ _context15.next = 2;
937
+ break;
938
+ }
939
+ return _context15.abrupt("return", undefined);
940
+ case 2:
941
+ return _context15.abrupt("return", async.map(values, asDocumentSymbol, token));
942
+ case 3:
943
+ case "end":
944
+ return _context15.stop();
945
+ }
946
+ }, _callee15);
947
+ }));
948
+ return _asDocumentSymbols.apply(this, arguments);
949
+ }
950
+ function asDocumentSymbol(value) {
951
+ var result = new DocumentSymbol(value.name, value.detail || '', asSymbolKind(value.kind), asRange(value.range), asRange(value.selectionRange));
952
+ fillTags(result, value);
953
+ if (value.children !== undefined && value.children.length > 0) {
954
+ var children = [];
955
+ var _iterator6 = _createForOfIteratorHelper(value.children),
956
+ _step6;
957
+ try {
958
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
959
+ var child = _step6.value;
960
+ children.push(asDocumentSymbol(child));
961
+ }
962
+ } catch (err) {
963
+ _iterator6.e(err);
964
+ } finally {
965
+ _iterator6.f();
966
+ }
967
+ result.children = children;
968
+ }
969
+ return result;
970
+ }
971
+ function fillTags(result, value) {
972
+ result.tags = asSymbolTags(value.tags);
973
+ if (value.deprecated) {
974
+ if (!result.tags) {
975
+ result.tags = [SymbolTag.Deprecated];
976
+ } else {
977
+ if (!result.tags.includes(SymbolTag.Deprecated)) {
978
+ result.tags = result.tags.concat(SymbolTag.Deprecated);
979
+ }
980
+ }
981
+ }
982
+ }
983
+ function asCommand(item) {
984
+ var result = {
985
+ title: item.title,
986
+ command: item.command
987
+ };
988
+ if (item.tooltip) {
989
+ result.tooltip = item.tooltip;
990
+ }
991
+ if (item.arguments) {
992
+ result.arguments = item.arguments;
993
+ }
994
+ return result;
995
+ }
996
+ function asCommands(_x30, _x31) {
997
+ return _asCommands.apply(this, arguments);
998
+ }
999
+ function _asCommands() {
1000
+ _asCommands = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(items, token) {
1001
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1002
+ while (1) switch (_context16.prev = _context16.next) {
1003
+ case 0:
1004
+ if (items) {
1005
+ _context16.next = 2;
1006
+ break;
1007
+ }
1008
+ return _context16.abrupt("return", undefined);
1009
+ case 2:
1010
+ return _context16.abrupt("return", async.map(items, asCommand, token));
1011
+ case 3:
1012
+ case "end":
1013
+ return _context16.stop();
1014
+ }
1015
+ }, _callee16);
1016
+ }));
1017
+ return _asCommands.apply(this, arguments);
1018
+ }
1019
+ var kindMapping = new Map();
1020
+ kindMapping.set(ls.CodeActionKind.Empty, CodeActionKind.Empty);
1021
+ kindMapping.set(ls.CodeActionKind.QuickFix, CodeActionKind.QuickFix);
1022
+ kindMapping.set(ls.CodeActionKind.Refactor, CodeActionKind.Refactor);
1023
+ kindMapping.set(ls.CodeActionKind.RefactorExtract, CodeActionKind.RefactorExtract);
1024
+ kindMapping.set(ls.CodeActionKind.RefactorInline, CodeActionKind.RefactorInline);
1025
+ kindMapping.set(ls.CodeActionKind.RefactorRewrite, CodeActionKind.RefactorRewrite);
1026
+ kindMapping.set(ls.CodeActionKind.Source, CodeActionKind.Source);
1027
+ kindMapping.set(ls.CodeActionKind.SourceOrganizeImports, CodeActionKind.SourceOrganizeImports);
1028
+ function asCodeActionKind(item) {
1029
+ if (item === undefined || item === null) {
1030
+ return undefined;
1031
+ }
1032
+ var result = kindMapping.get(item);
1033
+ if (result) {
1034
+ return result;
1035
+ }
1036
+ var parts = item.split('.');
1037
+ result = CodeActionKind.Empty;
1038
+ var _iterator7 = _createForOfIteratorHelper(parts),
1039
+ _step7;
1040
+ try {
1041
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1042
+ var part = _step7.value;
1043
+ result = result.append(part);
1044
+ }
1045
+ } catch (err) {
1046
+ _iterator7.e(err);
1047
+ } finally {
1048
+ _iterator7.f();
1049
+ }
1050
+ return result;
1051
+ }
1052
+ function asCodeActionKinds(items) {
1053
+ if (items === undefined || items === null) {
1054
+ return undefined;
1055
+ }
1056
+ return items.map(function (kind) {
1057
+ return asCodeActionKind(kind);
1058
+ });
1059
+ }
1060
+ function asCodeActionDocumentations(items) {
1061
+ if (items === undefined || items === null) {
1062
+ return undefined;
1063
+ }
1064
+ return items.map(function (doc) {
1065
+ return {
1066
+ kind: asCodeActionKind(doc.kind),
1067
+ command: asCommand(doc.command)
1068
+ };
1069
+ });
1070
+ }
1071
+ function asCodeAction(_x32, _x33) {
1072
+ return _asCodeAction.apply(this, arguments);
1073
+ }
1074
+ function _asCodeAction() {
1075
+ _asCodeAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(item, token) {
1076
+ var result;
1077
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1078
+ while (1) switch (_context17.prev = _context17.next) {
1079
+ case 0:
1080
+ if (!(item === undefined || item === null)) {
1081
+ _context17.next = 2;
1082
+ break;
1083
+ }
1084
+ return _context17.abrupt("return", undefined);
1085
+ case 2:
1086
+ result = new ProtocolCodeAction(item.title, item.data);
1087
+ if (item.kind !== undefined) {
1088
+ result.kind = asCodeActionKind(item.kind);
1089
+ }
1090
+ if (item.diagnostics !== undefined) {
1091
+ result.diagnostics = asDiagnosticsSync(item.diagnostics);
1092
+ }
1093
+ if (!(item.edit !== undefined)) {
1094
+ _context17.next = 9;
1095
+ break;
1096
+ }
1097
+ _context17.next = 8;
1098
+ return asWorkspaceEdit(item.edit, token);
1099
+ case 8:
1100
+ result.edit = _context17.sent;
1101
+ case 9:
1102
+ if (item.command !== undefined) {
1103
+ result.command = asCommand(item.command);
1104
+ }
1105
+ if (item.isPreferred !== undefined) {
1106
+ result.isPreferred = item.isPreferred;
1107
+ }
1108
+ if (item.disabled !== undefined) {
1109
+ result.disabled = {
1110
+ reason: item.disabled.reason
1111
+ };
1112
+ }
1113
+ return _context17.abrupt("return", result);
1114
+ case 13:
1115
+ case "end":
1116
+ return _context17.stop();
1117
+ }
1118
+ }, _callee17);
1119
+ }));
1120
+ return _asCodeAction.apply(this, arguments);
1121
+ }
1122
+ function asCodeActionResult(items, token) {
1123
+ return async.mapAsync(items, /*#__PURE__*/function () {
1124
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item) {
1125
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1126
+ while (1) switch (_context.prev = _context.next) {
1127
+ case 0:
1128
+ if (!ls.Command.is(item)) {
1129
+ _context.next = 4;
1130
+ break;
1131
+ }
1132
+ return _context.abrupt("return", asCommand(item));
1133
+ case 4:
1134
+ return _context.abrupt("return", asCodeAction(item, token));
1135
+ case 5:
1136
+ case "end":
1137
+ return _context.stop();
1138
+ }
1139
+ }, _callee);
1140
+ }));
1141
+ return function (_x34) {
1142
+ return _ref3.apply(this, arguments);
1143
+ };
1144
+ }(), token);
1145
+ }
1146
+ function asCodeLens(item) {
1147
+ if (!item) {
1148
+ return undefined;
1149
+ }
1150
+ var result = new ProtocolCodeLens(asRange(item.range));
1151
+ if (item.command) {
1152
+ result.command = asCommand(item.command);
1153
+ }
1154
+ if (item.data !== undefined && item.data !== null) {
1155
+ result.data = item.data;
1156
+ }
1157
+ return result;
1158
+ }
1159
+ function asCodeLenses(_x35, _x36) {
1160
+ return _asCodeLenses.apply(this, arguments);
1161
+ }
1162
+ function _asCodeLenses() {
1163
+ _asCodeLenses = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(items, token) {
1164
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1165
+ while (1) switch (_context18.prev = _context18.next) {
1166
+ case 0:
1167
+ if (items) {
1168
+ _context18.next = 2;
1169
+ break;
1170
+ }
1171
+ return _context18.abrupt("return", undefined);
1172
+ case 2:
1173
+ return _context18.abrupt("return", async.map(items, asCodeLens, token));
1174
+ case 3:
1175
+ case "end":
1176
+ return _context18.stop();
1177
+ }
1178
+ }, _callee18);
1179
+ }));
1180
+ return _asCodeLenses.apply(this, arguments);
1181
+ }
1182
+ function asWorkspaceEdit(_x37, _x38) {
1183
+ return _asWorkspaceEdit.apply(this, arguments);
1184
+ }
1185
+ function _asWorkspaceEdit() {
1186
+ _asWorkspaceEdit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(item, token) {
1187
+ var sharedMetadata, changeAnnotations, asMetadata, result, documentChanges, changes;
1188
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1189
+ while (1) switch (_context19.prev = _context19.next) {
1190
+ case 0:
1191
+ if (item) {
1192
+ _context19.next = 2;
1193
+ break;
1194
+ }
1195
+ return _context19.abrupt("return", undefined);
1196
+ case 2:
1197
+ sharedMetadata = new Map();
1198
+ if (!(item.changeAnnotations !== undefined)) {
1199
+ _context19.next = 7;
1200
+ break;
1201
+ }
1202
+ changeAnnotations = item.changeAnnotations;
1203
+ _context19.next = 7;
1204
+ return async.forEach(Object.keys(changeAnnotations), function (key) {
1205
+ var metaData = asWorkspaceEditEntryMetadata(changeAnnotations[key]);
1206
+ sharedMetadata.set(key, metaData);
1207
+ }, token);
1208
+ case 7:
1209
+ asMetadata = function asMetadata(annotation) {
1210
+ if (annotation === undefined) {
1211
+ return undefined;
1212
+ } else {
1213
+ return sharedMetadata.get(annotation);
1214
+ }
1215
+ };
1216
+ result = new WorkspaceEdit();
1217
+ if (!item.documentChanges) {
1218
+ _context19.next = 15;
1219
+ break;
1220
+ }
1221
+ documentChanges = item.documentChanges;
1222
+ _context19.next = 13;
1223
+ return async.forEach(documentChanges, function (change) {
1224
+ if (ls.CreateFile.is(change)) {
1225
+ result.createFile(_uriConverter(change.uri), change.options, asMetadata(change.annotationId));
1226
+ } else if (ls.RenameFile.is(change)) {
1227
+ result.renameFile(_uriConverter(change.oldUri), _uriConverter(change.newUri), change.options, asMetadata(change.annotationId));
1228
+ } else if (ls.DeleteFile.is(change)) {
1229
+ result.deleteFile(_uriConverter(change.uri), change.options, asMetadata(change.annotationId));
1230
+ } else if (ls.TextDocumentEdit.is(change)) {
1231
+ var uri = _uriConverter(change.textDocument.uri);
1232
+ var _iterator8 = _createForOfIteratorHelper(change.edits),
1233
+ _step8;
1234
+ try {
1235
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1236
+ var _edit = _step8.value;
1237
+ if (ls.AnnotatedTextEdit.is(_edit)) {
1238
+ result.replace(uri, asRange(_edit.range), _edit.newText, asMetadata(_edit.annotationId));
1239
+ } else {
1240
+ result.replace(uri, asRange(_edit.range), _edit.newText);
1241
+ }
1242
+ }
1243
+ } catch (err) {
1244
+ _iterator8.e(err);
1245
+ } finally {
1246
+ _iterator8.f();
1247
+ }
1248
+ } else {
1249
+ throw new Error("Unknown workspace edit change received:\n".concat(JSON.stringify(change, undefined, 4)));
1250
+ }
1251
+ }, token);
1252
+ case 13:
1253
+ _context19.next = 19;
1254
+ break;
1255
+ case 15:
1256
+ if (!item.changes) {
1257
+ _context19.next = 19;
1258
+ break;
1259
+ }
1260
+ changes = item.changes;
1261
+ _context19.next = 19;
1262
+ return async.forEach(Object.keys(changes), function (key) {
1263
+ result.set(_uriConverter(key), asTextEditsSync(changes[key]));
1264
+ }, token);
1265
+ case 19:
1266
+ return _context19.abrupt("return", result);
1267
+ case 20:
1268
+ case "end":
1269
+ return _context19.stop();
1270
+ }
1271
+ }, _callee19);
1272
+ }));
1273
+ return _asWorkspaceEdit.apply(this, arguments);
1274
+ }
1275
+ function asWorkspaceEditEntryMetadata(annotation) {
1276
+ if (annotation === undefined) {
1277
+ return undefined;
1278
+ }
1279
+ return {
1280
+ label: annotation.label,
1281
+ needsConfirmation: !!annotation.needsConfirmation,
1282
+ description: annotation.description
1283
+ };
1284
+ }
1285
+ function asDocumentLink(item) {
1286
+ var range = asRange(item.range);
1287
+ var target = item.target ? asUri(item.target) : undefined;
1288
+ // target must be optional in DocumentLink
1289
+ var link = new ProtocolDocumentLink(range, target);
1290
+ if (item.tooltip !== undefined) {
1291
+ link.tooltip = item.tooltip;
1292
+ }
1293
+ if (item.data !== undefined && item.data !== null) {
1294
+ link.data = item.data;
1295
+ }
1296
+ return link;
1297
+ }
1298
+ function asDocumentLinks(_x39, _x40) {
1299
+ return _asDocumentLinks.apply(this, arguments);
1300
+ }
1301
+ function _asDocumentLinks() {
1302
+ _asDocumentLinks = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(items, token) {
1303
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1304
+ while (1) switch (_context20.prev = _context20.next) {
1305
+ case 0:
1306
+ if (items) {
1307
+ _context20.next = 2;
1308
+ break;
1309
+ }
1310
+ return _context20.abrupt("return", undefined);
1311
+ case 2:
1312
+ return _context20.abrupt("return", async.map(items, asDocumentLink, token));
1313
+ case 3:
1314
+ case "end":
1315
+ return _context20.stop();
1316
+ }
1317
+ }, _callee20);
1318
+ }));
1319
+ return _asDocumentLinks.apply(this, arguments);
1320
+ }
1321
+ function asColor(color) {
1322
+ return new Color(color.red, color.green, color.blue, color.alpha);
1323
+ }
1324
+ function asColorInformation(ci) {
1325
+ return new ColorInformation(asRange(ci.range), asColor(ci.color));
1326
+ }
1327
+ function asColorInformations(_x41, _x42) {
1328
+ return _asColorInformations.apply(this, arguments);
1329
+ }
1330
+ function _asColorInformations() {
1331
+ _asColorInformations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(colorInformation, token) {
1332
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1333
+ while (1) switch (_context21.prev = _context21.next) {
1334
+ case 0:
1335
+ if (colorInformation) {
1336
+ _context21.next = 2;
1337
+ break;
1338
+ }
1339
+ return _context21.abrupt("return", undefined);
1340
+ case 2:
1341
+ return _context21.abrupt("return", async.map(colorInformation, asColorInformation, token));
1342
+ case 3:
1343
+ case "end":
1344
+ return _context21.stop();
1345
+ }
1346
+ }, _callee21);
1347
+ }));
1348
+ return _asColorInformations.apply(this, arguments);
1349
+ }
1350
+ function asColorPresentation(cp) {
1351
+ var presentation = new ColorPresentation(cp.label);
1352
+ presentation.additionalTextEdits = asTextEditsSync(cp.additionalTextEdits);
1353
+ if (cp.textEdit) {
1354
+ presentation.textEdit = asTextEdit(cp.textEdit);
1355
+ }
1356
+ return presentation;
1357
+ }
1358
+ function asColorPresentations(_x43, _x44) {
1359
+ return _asColorPresentations.apply(this, arguments);
1360
+ }
1361
+ function _asColorPresentations() {
1362
+ _asColorPresentations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(colorPresentations, token) {
1363
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1364
+ while (1) switch (_context22.prev = _context22.next) {
1365
+ case 0:
1366
+ if (colorPresentations) {
1367
+ _context22.next = 2;
1368
+ break;
1369
+ }
1370
+ return _context22.abrupt("return", undefined);
1371
+ case 2:
1372
+ return _context22.abrupt("return", async.map(colorPresentations, asColorPresentation, token));
1373
+ case 3:
1374
+ case "end":
1375
+ return _context22.stop();
1376
+ }
1377
+ }, _callee22);
1378
+ }));
1379
+ return _asColorPresentations.apply(this, arguments);
1380
+ }
1381
+ function asFoldingRangeKind(kind) {
1382
+ if (kind) {
1383
+ switch (kind) {
1384
+ case ls.FoldingRangeKind.Comment:
1385
+ return FoldingRangeKind.Comment;
1386
+ case ls.FoldingRangeKind.Imports:
1387
+ return FoldingRangeKind.Imports;
1388
+ case ls.FoldingRangeKind.Region:
1389
+ return FoldingRangeKind.Region;
1390
+ }
1391
+ }
1392
+ return undefined;
1393
+ }
1394
+ function asFoldingRange(r) {
1395
+ return new FoldingRange(r.startLine, r.endLine, asFoldingRangeKind(r.kind));
1396
+ }
1397
+ function asFoldingRanges(_x45, _x46) {
1398
+ return _asFoldingRanges.apply(this, arguments);
1399
+ }
1400
+ function _asFoldingRanges() {
1401
+ _asFoldingRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(foldingRanges, token) {
1402
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1403
+ while (1) switch (_context23.prev = _context23.next) {
1404
+ case 0:
1405
+ if (foldingRanges) {
1406
+ _context23.next = 2;
1407
+ break;
1408
+ }
1409
+ return _context23.abrupt("return", undefined);
1410
+ case 2:
1411
+ return _context23.abrupt("return", async.map(foldingRanges, asFoldingRange, token));
1412
+ case 3:
1413
+ case "end":
1414
+ return _context23.stop();
1415
+ }
1416
+ }, _callee23);
1417
+ }));
1418
+ return _asFoldingRanges.apply(this, arguments);
1419
+ }
1420
+ function asSelectionRange(selectionRange) {
1421
+ return new SelectionRange(asRange(selectionRange.range), selectionRange.parent ? asSelectionRange(selectionRange.parent) : undefined);
1422
+ }
1423
+ function asSelectionRanges(_x47, _x48) {
1424
+ return _asSelectionRanges.apply(this, arguments);
1425
+ }
1426
+ function _asSelectionRanges() {
1427
+ _asSelectionRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(selectionRanges, token) {
1428
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1429
+ while (1) switch (_context24.prev = _context24.next) {
1430
+ case 0:
1431
+ if (Array.isArray(selectionRanges)) {
1432
+ _context24.next = 2;
1433
+ break;
1434
+ }
1435
+ return _context24.abrupt("return", []);
1436
+ case 2:
1437
+ return _context24.abrupt("return", async.map(selectionRanges, asSelectionRange, token));
1438
+ case 3:
1439
+ case "end":
1440
+ return _context24.stop();
1441
+ }
1442
+ }, _callee24);
1443
+ }));
1444
+ return _asSelectionRanges.apply(this, arguments);
1445
+ }
1446
+ function asInlineValue(inlineValue) {
1447
+ if (ls.InlineValueText.is(inlineValue)) {
1448
+ return new InlineValueText(asRange(inlineValue.range), inlineValue.text);
1449
+ } else if (ls.InlineValueVariableLookup.is(inlineValue)) {
1450
+ return new InlineValueVariableLookup(asRange(inlineValue.range), inlineValue.variableName, inlineValue.caseSensitiveLookup);
1451
+ } else {
1452
+ return new InlineValueEvaluatableExpression(asRange(inlineValue.range), inlineValue.expression);
1453
+ }
1454
+ }
1455
+ function asInlineValues(_x49, _x50) {
1456
+ return _asInlineValues.apply(this, arguments);
1457
+ }
1458
+ function _asInlineValues() {
1459
+ _asInlineValues = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(inlineValues, token) {
1460
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1461
+ while (1) switch (_context25.prev = _context25.next) {
1462
+ case 0:
1463
+ if (Array.isArray(inlineValues)) {
1464
+ _context25.next = 2;
1465
+ break;
1466
+ }
1467
+ return _context25.abrupt("return", []);
1468
+ case 2:
1469
+ return _context25.abrupt("return", async.map(inlineValues, asInlineValue, token));
1470
+ case 3:
1471
+ case "end":
1472
+ return _context25.stop();
1473
+ }
1474
+ }, _callee25);
1475
+ }));
1476
+ return _asInlineValues.apply(this, arguments);
1477
+ }
1478
+ function asInlayHint(_x51, _x52) {
1479
+ return _asInlayHint.apply(this, arguments);
1480
+ }
1481
+ function _asInlayHint() {
1482
+ _asInlayHint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(value, token) {
1483
+ var label, result;
1484
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1485
+ while (1) switch (_context26.prev = _context26.next) {
1486
+ case 0:
1487
+ if (!(typeof value.label === 'string')) {
1488
+ _context26.next = 4;
1489
+ break;
1490
+ }
1491
+ _context26.t0 = value.label;
1492
+ _context26.next = 7;
1493
+ break;
1494
+ case 4:
1495
+ _context26.next = 6;
1496
+ return async.map(value.label, asInlayHintLabelPart, token);
1497
+ case 6:
1498
+ _context26.t0 = _context26.sent;
1499
+ case 7:
1500
+ label = _context26.t0;
1501
+ result = new ProtocolInlayHint(asPosition(value.position), label);
1502
+ if (value.kind !== undefined) {
1503
+ result.kind = value.kind;
1504
+ }
1505
+ if (!(value.textEdits !== undefined)) {
1506
+ _context26.next = 14;
1507
+ break;
1508
+ }
1509
+ _context26.next = 13;
1510
+ return asTextEdits(value.textEdits, token);
1511
+ case 13:
1512
+ result.textEdits = _context26.sent;
1513
+ case 14:
1514
+ if (value.tooltip !== undefined) {
1515
+ result.tooltip = asTooltip(value.tooltip);
1516
+ }
1517
+ if (value.paddingLeft !== undefined) {
1518
+ result.paddingLeft = value.paddingLeft;
1519
+ }
1520
+ if (value.paddingRight !== undefined) {
1521
+ result.paddingRight = value.paddingRight;
1522
+ }
1523
+ if (value.data !== undefined) {
1524
+ result.data = value.data;
1525
+ }
1526
+ return _context26.abrupt("return", result);
1527
+ case 19:
1528
+ case "end":
1529
+ return _context26.stop();
1530
+ }
1531
+ }, _callee26);
1532
+ }));
1533
+ return _asInlayHint.apply(this, arguments);
1534
+ }
1535
+ function asInlayHintLabelPart(part) {
1536
+ var result = new InlayHintLabelPart(part.value);
1537
+ if (part.location !== undefined) {
1538
+ result.location = asLocation(part.location);
1539
+ }
1540
+ if (part.tooltip !== undefined) {
1541
+ result.tooltip = asTooltip(part.tooltip);
1542
+ }
1543
+ if (part.command !== undefined) {
1544
+ result.command = asCommand(part.command);
1545
+ }
1546
+ return result;
1547
+ }
1548
+ function asTooltip(value) {
1549
+ if (typeof value === 'string') {
1550
+ return value;
1551
+ }
1552
+ return asMarkdownString(value);
1553
+ }
1554
+ function asInlayHints(_x53, _x54) {
1555
+ return _asInlayHints.apply(this, arguments);
1556
+ } //----- call hierarchy
1557
+ function _asInlayHints() {
1558
+ _asInlayHints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(values, token) {
1559
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1560
+ while (1) switch (_context27.prev = _context27.next) {
1561
+ case 0:
1562
+ if (Array.isArray(values)) {
1563
+ _context27.next = 2;
1564
+ break;
1565
+ }
1566
+ return _context27.abrupt("return", undefined);
1567
+ case 2:
1568
+ return _context27.abrupt("return", async.mapAsync(values, asInlayHint, token));
1569
+ case 3:
1570
+ case "end":
1571
+ return _context27.stop();
1572
+ }
1573
+ }, _callee27);
1574
+ }));
1575
+ return _asInlayHints.apply(this, arguments);
1576
+ }
1577
+ function asCallHierarchyItem(item) {
1578
+ if (item === null) {
1579
+ return undefined;
1580
+ }
1581
+ var result = new ProtocolCallHierarchyItem(asSymbolKind(item.kind), item.name, item.detail || '', asUri(item.uri), asRange(item.range), asRange(item.selectionRange), item.data);
1582
+ if (item.tags !== undefined) {
1583
+ result.tags = asSymbolTags(item.tags);
1584
+ }
1585
+ return result;
1586
+ }
1587
+ function asCallHierarchyItems(_x55, _x56) {
1588
+ return _asCallHierarchyItems.apply(this, arguments);
1589
+ }
1590
+ function _asCallHierarchyItems() {
1591
+ _asCallHierarchyItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(items, token) {
1592
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1593
+ while (1) switch (_context28.prev = _context28.next) {
1594
+ case 0:
1595
+ if (!(items === null)) {
1596
+ _context28.next = 2;
1597
+ break;
1598
+ }
1599
+ return _context28.abrupt("return", undefined);
1600
+ case 2:
1601
+ return _context28.abrupt("return", async.map(items, asCallHierarchyItem, token));
1602
+ case 3:
1603
+ case "end":
1604
+ return _context28.stop();
1605
+ }
1606
+ }, _callee28);
1607
+ }));
1608
+ return _asCallHierarchyItems.apply(this, arguments);
1609
+ }
1610
+ function asCallHierarchyIncomingCall(_x57, _x58) {
1611
+ return _asCallHierarchyIncomingCall.apply(this, arguments);
1612
+ }
1613
+ function _asCallHierarchyIncomingCall() {
1614
+ _asCallHierarchyIncomingCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(item, token) {
1615
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1616
+ while (1) switch (_context29.prev = _context29.next) {
1617
+ case 0:
1618
+ _context29.t0 = CallHierarchyIncomingCall;
1619
+ _context29.t1 = asCallHierarchyItem(item.from);
1620
+ _context29.next = 4;
1621
+ return asRanges(item.fromRanges, token);
1622
+ case 4:
1623
+ _context29.t2 = _context29.sent;
1624
+ return _context29.abrupt("return", new _context29.t0(_context29.t1, _context29.t2));
1625
+ case 6:
1626
+ case "end":
1627
+ return _context29.stop();
1628
+ }
1629
+ }, _callee29);
1630
+ }));
1631
+ return _asCallHierarchyIncomingCall.apply(this, arguments);
1632
+ }
1633
+ function asCallHierarchyIncomingCalls(_x59, _x60) {
1634
+ return _asCallHierarchyIncomingCalls.apply(this, arguments);
1635
+ }
1636
+ function _asCallHierarchyIncomingCalls() {
1637
+ _asCallHierarchyIncomingCalls = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(items, token) {
1638
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
1639
+ while (1) switch (_context30.prev = _context30.next) {
1640
+ case 0:
1641
+ if (!(items === null)) {
1642
+ _context30.next = 2;
1643
+ break;
1644
+ }
1645
+ return _context30.abrupt("return", undefined);
1646
+ case 2:
1647
+ return _context30.abrupt("return", async.mapAsync(items, asCallHierarchyIncomingCall, token));
1648
+ case 3:
1649
+ case "end":
1650
+ return _context30.stop();
1651
+ }
1652
+ }, _callee30);
1653
+ }));
1654
+ return _asCallHierarchyIncomingCalls.apply(this, arguments);
1655
+ }
1656
+ function asCallHierarchyOutgoingCall(_x61, _x62) {
1657
+ return _asCallHierarchyOutgoingCall.apply(this, arguments);
1658
+ }
1659
+ function _asCallHierarchyOutgoingCall() {
1660
+ _asCallHierarchyOutgoingCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(item, token) {
1661
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
1662
+ while (1) switch (_context31.prev = _context31.next) {
1663
+ case 0:
1664
+ _context31.t0 = CallHierarchyOutgoingCall;
1665
+ _context31.t1 = asCallHierarchyItem(item.to);
1666
+ _context31.next = 4;
1667
+ return asRanges(item.fromRanges, token);
1668
+ case 4:
1669
+ _context31.t2 = _context31.sent;
1670
+ return _context31.abrupt("return", new _context31.t0(_context31.t1, _context31.t2));
1671
+ case 6:
1672
+ case "end":
1673
+ return _context31.stop();
1674
+ }
1675
+ }, _callee31);
1676
+ }));
1677
+ return _asCallHierarchyOutgoingCall.apply(this, arguments);
1678
+ }
1679
+ function asCallHierarchyOutgoingCalls(_x63, _x64) {
1680
+ return _asCallHierarchyOutgoingCalls.apply(this, arguments);
1681
+ } //----- semantic tokens
1682
+ function _asCallHierarchyOutgoingCalls() {
1683
+ _asCallHierarchyOutgoingCalls = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(items, token) {
1684
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
1685
+ while (1) switch (_context32.prev = _context32.next) {
1686
+ case 0:
1687
+ if (!(items === null)) {
1688
+ _context32.next = 2;
1689
+ break;
1690
+ }
1691
+ return _context32.abrupt("return", undefined);
1692
+ case 2:
1693
+ return _context32.abrupt("return", async.mapAsync(items, asCallHierarchyOutgoingCall, token));
1694
+ case 3:
1695
+ case "end":
1696
+ return _context32.stop();
1697
+ }
1698
+ }, _callee32);
1699
+ }));
1700
+ return _asCallHierarchyOutgoingCalls.apply(this, arguments);
1701
+ }
1702
+ function asSemanticTokens(_x65, _x66) {
1703
+ return _asSemanticTokens.apply(this, arguments);
1704
+ }
1705
+ function _asSemanticTokens() {
1706
+ _asSemanticTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(value, _token) {
1707
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
1708
+ while (1) switch (_context33.prev = _context33.next) {
1709
+ case 0:
1710
+ if (!(value === undefined || value === null)) {
1711
+ _context33.next = 2;
1712
+ break;
1713
+ }
1714
+ return _context33.abrupt("return", undefined);
1715
+ case 2:
1716
+ return _context33.abrupt("return", new SemanticTokens(new Uint32Array(value.data), value.resultId));
1717
+ case 3:
1718
+ case "end":
1719
+ return _context33.stop();
1720
+ }
1721
+ }, _callee33);
1722
+ }));
1723
+ return _asSemanticTokens.apply(this, arguments);
1724
+ }
1725
+ function asSemanticTokensEdit(value) {
1726
+ return new SemanticTokensEdit(value.start, value.deleteCount, value.data !== undefined ? new Uint32Array(value.data) : undefined);
1727
+ }
1728
+ function asSemanticTokensEdits(_x67, _x68) {
1729
+ return _asSemanticTokensEdits.apply(this, arguments);
1730
+ }
1731
+ function _asSemanticTokensEdits() {
1732
+ _asSemanticTokensEdits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(value, _token) {
1733
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
1734
+ while (1) switch (_context34.prev = _context34.next) {
1735
+ case 0:
1736
+ if (!(value === undefined || value === null)) {
1737
+ _context34.next = 2;
1738
+ break;
1739
+ }
1740
+ return _context34.abrupt("return", undefined);
1741
+ case 2:
1742
+ return _context34.abrupt("return", new SemanticTokensEdits(value.edits.map(asSemanticTokensEdit), value.resultId));
1743
+ case 3:
1744
+ case "end":
1745
+ return _context34.stop();
1746
+ }
1747
+ }, _callee34);
1748
+ }));
1749
+ return _asSemanticTokensEdits.apply(this, arguments);
1750
+ }
1751
+ function asSemanticTokensLegend(value) {
1752
+ return value;
1753
+ }
1754
+ function asLinkedEditingRanges(_x69, _x70) {
1755
+ return _asLinkedEditingRanges.apply(this, arguments);
1756
+ }
1757
+ function _asLinkedEditingRanges() {
1758
+ _asLinkedEditingRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(value, token) {
1759
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
1760
+ while (1) switch (_context35.prev = _context35.next) {
1761
+ case 0:
1762
+ if (!(value === null || value === undefined)) {
1763
+ _context35.next = 2;
1764
+ break;
1765
+ }
1766
+ return _context35.abrupt("return", undefined);
1767
+ case 2:
1768
+ _context35.t0 = LinkedEditingRanges;
1769
+ _context35.next = 5;
1770
+ return asRanges(value.ranges, token);
1771
+ case 5:
1772
+ _context35.t1 = _context35.sent;
1773
+ _context35.t2 = asRegularExpression(value.wordPattern);
1774
+ return _context35.abrupt("return", new _context35.t0(_context35.t1, _context35.t2));
1775
+ case 8:
1776
+ case "end":
1777
+ return _context35.stop();
1778
+ }
1779
+ }, _callee35);
1780
+ }));
1781
+ return _asLinkedEditingRanges.apply(this, arguments);
1782
+ }
1783
+ function asRegularExpression(value) {
1784
+ if (value === null || value === undefined) {
1785
+ return undefined;
1786
+ }
1787
+ return new RegExp(value);
1788
+ }
1789
+
1790
+ //------ Type Hierarchy
1791
+
1792
+ function asTypeHierarchyItem(item) {
1793
+ if (item === null) {
1794
+ return undefined;
1795
+ }
1796
+ var result = new ProtocolTypeHierarchyItem(asSymbolKind(item.kind), item.name, item.detail || '', asUri(item.uri), asRange(item.range), asRange(item.selectionRange), item.data);
1797
+ if (item.tags !== undefined) {
1798
+ result.tags = asSymbolTags(item.tags);
1799
+ }
1800
+ return result;
1801
+ }
1802
+ function asTypeHierarchyItems(_x71, _x72) {
1803
+ return _asTypeHierarchyItems.apply(this, arguments);
1804
+ }
1805
+ function _asTypeHierarchyItems() {
1806
+ _asTypeHierarchyItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(items, token) {
1807
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
1808
+ while (1) switch (_context36.prev = _context36.next) {
1809
+ case 0:
1810
+ if (!(items === null)) {
1811
+ _context36.next = 2;
1812
+ break;
1813
+ }
1814
+ return _context36.abrupt("return", undefined);
1815
+ case 2:
1816
+ return _context36.abrupt("return", async.map(items, asTypeHierarchyItem, token));
1817
+ case 3:
1818
+ case "end":
1819
+ return _context36.stop();
1820
+ }
1821
+ }, _callee36);
1822
+ }));
1823
+ return _asTypeHierarchyItems.apply(this, arguments);
1824
+ }
1825
+ function asGlobPattern(pattern) {
1826
+ if (Is.string(pattern)) {
1827
+ return pattern;
1828
+ }
1829
+ if (ls.RelativePattern.is(pattern)) {
1830
+ if (ls.URI.is(pattern.baseUri)) {
1831
+ return new RelativePattern(asUri(pattern.baseUri), pattern.pattern);
1832
+ } else if (ls.WorkspaceFolder.is(pattern.baseUri)) {
1833
+ var workspaceFolder = workspace.getWorkspaceFolder(asUri(pattern.baseUri.uri));
1834
+ return workspaceFolder !== undefined ? new RelativePattern(workspaceFolder, pattern.pattern) : undefined;
1835
+ }
1836
+ }
1837
+ return undefined;
1838
+ }
1839
+ function asInlineCompletionResult(_x73, _x74) {
1840
+ return _asInlineCompletionResult.apply(this, arguments);
1841
+ }
1842
+ function _asInlineCompletionResult() {
1843
+ _asInlineCompletionResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(value, token) {
1844
+ var list, converted;
1845
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
1846
+ while (1) switch (_context37.prev = _context37.next) {
1847
+ case 0:
1848
+ if (value) {
1849
+ _context37.next = 2;
1850
+ break;
1851
+ }
1852
+ return _context37.abrupt("return", undefined);
1853
+ case 2:
1854
+ if (!Array.isArray(value)) {
1855
+ _context37.next = 4;
1856
+ break;
1857
+ }
1858
+ return _context37.abrupt("return", async.map(value, function (item) {
1859
+ return asInlineCompletionItem(item);
1860
+ }, token));
1861
+ case 4:
1862
+ list = value;
1863
+ _context37.next = 7;
1864
+ return async.map(list.items, function (item) {
1865
+ return asInlineCompletionItem(item);
1866
+ }, token);
1867
+ case 7:
1868
+ converted = _context37.sent;
1869
+ return _context37.abrupt("return", new InlineCompletionList(converted));
1870
+ case 9:
1871
+ case "end":
1872
+ return _context37.stop();
1873
+ }
1874
+ }, _callee37);
1875
+ }));
1876
+ return _asInlineCompletionResult.apply(this, arguments);
1877
+ }
1878
+ function asInlineCompletionItem(item) {
1879
+ var insertText;
1880
+ if (typeof item.insertText === 'string') {
1881
+ insertText = item.insertText;
1882
+ } else {
1883
+ insertText = new SnippetString(item.insertText.value).value;
1884
+ }
1885
+ var command = undefined;
1886
+ if (item.command) {
1887
+ command = asCommand(item.command);
1888
+ }
1889
+ var inlineCompletionItem = new InlineCompletionItem(insertText, asRange(item.range), command);
1890
+ if (item.filterText) {
1891
+ inlineCompletionItem.filterText = item.filterText;
1892
+ }
1893
+ return inlineCompletionItem;
1894
+ }
1895
+
1896
+ // new
1897
+
1898
+ function asTextDcouemnt(value) {
1899
+ return {
1900
+ uri: URI.parse(value.uri)
1901
+ };
1902
+ }
1903
+ return {
1904
+ asUri: asUri,
1905
+ asDocumentSelector: asDocumentSelector,
1906
+ asDiagnostics: asDiagnostics,
1907
+ asDiagnostic: asDiagnostic,
1908
+ asRange: asRange,
1909
+ asRanges: asRanges,
1910
+ asPosition: asPosition,
1911
+ asDiagnosticSeverity: asDiagnosticSeverity,
1912
+ asDiagnosticTag: asDiagnosticTag,
1913
+ asHover: asHover,
1914
+ asCompletionResult: asCompletionResult,
1915
+ asCompletionItem: asCompletionItem,
1916
+ asTextEdit: asTextEdit,
1917
+ asTextEdits: asTextEdits,
1918
+ asSignatureHelp: asSignatureHelp,
1919
+ asSignatureInformations: asSignatureInformations,
1920
+ asSignatureInformation: asSignatureInformation,
1921
+ asParameterInformations: asParameterInformations,
1922
+ asParameterInformation: asParameterInformation,
1923
+ asDeclarationResult: asDeclarationResult,
1924
+ asDefinitionResult: asDefinitionResult,
1925
+ asLocation: asLocation,
1926
+ asReferences: asReferences,
1927
+ asDocumentHighlights: asDocumentHighlights,
1928
+ asDocumentHighlight: asDocumentHighlight,
1929
+ asDocumentHighlightKind: asDocumentHighlightKind,
1930
+ asSymbolKind: asSymbolKind,
1931
+ asSymbolTag: asSymbolTag,
1932
+ asSymbolTags: asSymbolTags,
1933
+ asSymbolInformations: asSymbolInformations,
1934
+ asSymbolInformation: asSymbolInformation,
1935
+ asDocumentSymbols: asDocumentSymbols,
1936
+ asDocumentSymbol: asDocumentSymbol,
1937
+ asCommand: asCommand,
1938
+ asCommands: asCommands,
1939
+ asCodeAction: asCodeAction,
1940
+ asCodeActionKind: asCodeActionKind,
1941
+ asCodeActionKinds: asCodeActionKinds,
1942
+ asCodeActionDocumentations: asCodeActionDocumentations,
1943
+ asCodeActionResult: asCodeActionResult,
1944
+ asCodeLens: asCodeLens,
1945
+ asCodeLenses: asCodeLenses,
1946
+ asWorkspaceEdit: asWorkspaceEdit,
1947
+ asDocumentLink: asDocumentLink,
1948
+ asDocumentLinks: asDocumentLinks,
1949
+ asFoldingRangeKind: asFoldingRangeKind,
1950
+ asFoldingRange: asFoldingRange,
1951
+ asFoldingRanges: asFoldingRanges,
1952
+ asColor: asColor,
1953
+ asColorInformation: asColorInformation,
1954
+ asColorInformations: asColorInformations,
1955
+ asColorPresentation: asColorPresentation,
1956
+ asColorPresentations: asColorPresentations,
1957
+ asSelectionRange: asSelectionRange,
1958
+ asSelectionRanges: asSelectionRanges,
1959
+ asInlineValue: asInlineValue,
1960
+ asInlineValues: asInlineValues,
1961
+ asInlayHint: asInlayHint,
1962
+ asInlayHints: asInlayHints,
1963
+ asSemanticTokensLegend: asSemanticTokensLegend,
1964
+ asSemanticTokens: asSemanticTokens,
1965
+ asSemanticTokensEdit: asSemanticTokensEdit,
1966
+ asSemanticTokensEdits: asSemanticTokensEdits,
1967
+ asCallHierarchyItem: asCallHierarchyItem,
1968
+ asCallHierarchyItems: asCallHierarchyItems,
1969
+ asCallHierarchyIncomingCall: asCallHierarchyIncomingCall,
1970
+ asCallHierarchyIncomingCalls: asCallHierarchyIncomingCalls,
1971
+ asCallHierarchyOutgoingCall: asCallHierarchyOutgoingCall,
1972
+ asCallHierarchyOutgoingCalls: asCallHierarchyOutgoingCalls,
1973
+ asLinkedEditingRanges: asLinkedEditingRanges,
1974
+ asTypeHierarchyItem: asTypeHierarchyItem,
1975
+ asTypeHierarchyItems: asTypeHierarchyItems,
1976
+ asGlobPattern: asGlobPattern,
1977
+ asInlineCompletionResult: asInlineCompletionResult,
1978
+ asInlineCompletionItem: asInlineCompletionItem,
1979
+ // new
1980
+ asTextDcouemnt: asTextDcouemnt
1981
+ };
1982
+ }