css-variable-lsp 1.0.0 → 1.0.2

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 (454) hide show
  1. package/README.md +5 -9
  2. package/package.json +5 -2
  3. package/server/out/cascadeAndInline.test.js +67 -0
  4. package/server/out/cascadeAndInline.test.js.map +1 -0
  5. package/server/out/cssVariableManager.js +390 -0
  6. package/server/out/cssVariableManager.js.map +1 -0
  7. package/server/out/domTree.js +115 -0
  8. package/server/out/domTree.js.map +1 -0
  9. package/server/out/domTree.test.js +77 -0
  10. package/server/out/domTree.test.js.map +1 -0
  11. package/server/out/fileLifecycle.test.js +163 -0
  12. package/server/out/fileLifecycle.test.js.map +1 -0
  13. package/server/out/fileTypesAndUpdates.test.js +78 -0
  14. package/server/out/fileTypesAndUpdates.test.js.map +1 -0
  15. package/server/out/htmlComments.test.js +180 -0
  16. package/server/out/htmlComments.test.js.map +1 -0
  17. package/server/out/server/src/server.js +1 -0
  18. package/server/out/server/src/server.js.map +1 -1
  19. package/server/out/server.js +458 -0
  20. package/server/out/server.js.map +1 -0
  21. package/server/out/specificity.js +138 -0
  22. package/server/out/specificity.js.map +1 -0
  23. package/server/out/specificity.test.js +66 -0
  24. package/server/out/specificity.test.js.map +1 -0
  25. package/server/out/test.js +112 -0
  26. package/server/out/test.js.map +1 -0
  27. package/server/out/tsconfig.tsbuildinfo +1 -1
  28. package/server/src/server.ts +2 -0
  29. package/server/tsconfig.tsbuildinfo +1 -0
  30. package/client/node_modules/.package-lock.json +0 -110
  31. package/client/node_modules/@types/node/LICENSE +0 -21
  32. package/client/node_modules/@types/node/README.md +0 -15
  33. package/client/node_modules/@types/node/assert/strict.d.ts +0 -8
  34. package/client/node_modules/@types/node/assert.d.ts +0 -1005
  35. package/client/node_modules/@types/node/async_hooks.d.ts +0 -586
  36. package/client/node_modules/@types/node/buffer.buffer.d.ts +0 -457
  37. package/client/node_modules/@types/node/buffer.d.ts +0 -1901
  38. package/client/node_modules/@types/node/child_process.d.ts +0 -1453
  39. package/client/node_modules/@types/node/cluster.d.ts +0 -578
  40. package/client/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  41. package/client/node_modules/@types/node/compatibility/index.d.ts +0 -9
  42. package/client/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  43. package/client/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
  44. package/client/node_modules/@types/node/console.d.ts +0 -452
  45. package/client/node_modules/@types/node/constants.d.ts +0 -21
  46. package/client/node_modules/@types/node/crypto.d.ts +0 -4504
  47. package/client/node_modules/@types/node/dgram.d.ts +0 -596
  48. package/client/node_modules/@types/node/diagnostics_channel.d.ts +0 -551
  49. package/client/node_modules/@types/node/dns/promises.d.ts +0 -477
  50. package/client/node_modules/@types/node/dns.d.ts +0 -860
  51. package/client/node_modules/@types/node/domain.d.ts +0 -170
  52. package/client/node_modules/@types/node/events.d.ts +0 -863
  53. package/client/node_modules/@types/node/fs/promises.d.ts +0 -1208
  54. package/client/node_modules/@types/node/fs.d.ts +0 -4332
  55. package/client/node_modules/@types/node/globals.d.ts +0 -170
  56. package/client/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  57. package/client/node_modules/@types/node/http.d.ts +0 -1919
  58. package/client/node_modules/@types/node/http2.d.ts +0 -2580
  59. package/client/node_modules/@types/node/https.d.ts +0 -549
  60. package/client/node_modules/@types/node/index.d.ts +0 -92
  61. package/client/node_modules/@types/node/inspector.generated.d.ts +0 -2775
  62. package/client/node_modules/@types/node/module.d.ts +0 -503
  63. package/client/node_modules/@types/node/net.d.ts +0 -924
  64. package/client/node_modules/@types/node/os.d.ts +0 -480
  65. package/client/node_modules/@types/node/package.json +0 -145
  66. package/client/node_modules/@types/node/path.d.ts +0 -191
  67. package/client/node_modules/@types/node/perf_hooks.d.ts +0 -860
  68. package/client/node_modules/@types/node/process.d.ts +0 -1632
  69. package/client/node_modules/@types/node/punycode.d.ts +0 -117
  70. package/client/node_modules/@types/node/querystring.d.ts +0 -140
  71. package/client/node_modules/@types/node/readline/promises.d.ts +0 -154
  72. package/client/node_modules/@types/node/readline.d.ts +0 -715
  73. package/client/node_modules/@types/node/repl.d.ts +0 -430
  74. package/client/node_modules/@types/node/stream/consumers.d.ts +0 -38
  75. package/client/node_modules/@types/node/stream/promises.d.ts +0 -90
  76. package/client/node_modules/@types/node/stream/web.d.ts +0 -527
  77. package/client/node_modules/@types/node/stream.d.ts +0 -1680
  78. package/client/node_modules/@types/node/string_decoder.d.ts +0 -67
  79. package/client/node_modules/@types/node/test.d.ts +0 -1208
  80. package/client/node_modules/@types/node/timers/promises.d.ts +0 -108
  81. package/client/node_modules/@types/node/timers.d.ts +0 -286
  82. package/client/node_modules/@types/node/tls.d.ts +0 -1204
  83. package/client/node_modules/@types/node/trace_events.d.ts +0 -171
  84. package/client/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -455
  85. package/client/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  86. package/client/node_modules/@types/node/ts5.6/index.d.ts +0 -92
  87. package/client/node_modules/@types/node/tty.d.ts +0 -206
  88. package/client/node_modules/@types/node/url.d.ts +0 -957
  89. package/client/node_modules/@types/node/util.d.ts +0 -2083
  90. package/client/node_modules/@types/node/v8.d.ts +0 -753
  91. package/client/node_modules/@types/node/vm.d.ts +0 -704
  92. package/client/node_modules/@types/node/wasi.d.ts +0 -160
  93. package/client/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
  94. package/client/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
  95. package/client/node_modules/@types/node/web-globals/events.d.ts +0 -81
  96. package/client/node_modules/@types/node/web-globals/fetch.d.ts +0 -38
  97. package/client/node_modules/@types/node/worker_threads.d.ts +0 -698
  98. package/client/node_modules/@types/node/zlib.d.ts +0 -517
  99. package/client/node_modules/@types/vscode/LICENSE +0 -21
  100. package/client/node_modules/@types/vscode/README.md +0 -15
  101. package/client/node_modules/@types/vscode/index.d.ts +0 -21145
  102. package/client/node_modules/@types/vscode/package.json +0 -26
  103. package/client/node_modules/balanced-match/.github/FUNDING.yml +0 -2
  104. package/client/node_modules/balanced-match/LICENSE.md +0 -21
  105. package/client/node_modules/balanced-match/README.md +0 -97
  106. package/client/node_modules/balanced-match/index.js +0 -62
  107. package/client/node_modules/balanced-match/package.json +0 -48
  108. package/client/node_modules/brace-expansion/.github/FUNDING.yml +0 -2
  109. package/client/node_modules/brace-expansion/LICENSE +0 -21
  110. package/client/node_modules/brace-expansion/README.md +0 -135
  111. package/client/node_modules/brace-expansion/index.js +0 -203
  112. package/client/node_modules/brace-expansion/package.json +0 -49
  113. package/client/node_modules/minimatch/LICENSE +0 -15
  114. package/client/node_modules/minimatch/README.md +0 -259
  115. package/client/node_modules/minimatch/lib/path.js +0 -4
  116. package/client/node_modules/minimatch/minimatch.js +0 -944
  117. package/client/node_modules/minimatch/package.json +0 -35
  118. package/client/node_modules/semver/LICENSE +0 -15
  119. package/client/node_modules/semver/README.md +0 -664
  120. package/client/node_modules/semver/bin/semver.js +0 -191
  121. package/client/node_modules/semver/classes/comparator.js +0 -143
  122. package/client/node_modules/semver/classes/index.js +0 -7
  123. package/client/node_modules/semver/classes/range.js +0 -557
  124. package/client/node_modules/semver/classes/semver.js +0 -333
  125. package/client/node_modules/semver/functions/clean.js +0 -8
  126. package/client/node_modules/semver/functions/cmp.js +0 -54
  127. package/client/node_modules/semver/functions/coerce.js +0 -62
  128. package/client/node_modules/semver/functions/compare-build.js +0 -9
  129. package/client/node_modules/semver/functions/compare-loose.js +0 -5
  130. package/client/node_modules/semver/functions/compare.js +0 -7
  131. package/client/node_modules/semver/functions/diff.js +0 -60
  132. package/client/node_modules/semver/functions/eq.js +0 -5
  133. package/client/node_modules/semver/functions/gt.js +0 -5
  134. package/client/node_modules/semver/functions/gte.js +0 -5
  135. package/client/node_modules/semver/functions/inc.js +0 -21
  136. package/client/node_modules/semver/functions/lt.js +0 -5
  137. package/client/node_modules/semver/functions/lte.js +0 -5
  138. package/client/node_modules/semver/functions/major.js +0 -5
  139. package/client/node_modules/semver/functions/minor.js +0 -5
  140. package/client/node_modules/semver/functions/neq.js +0 -5
  141. package/client/node_modules/semver/functions/parse.js +0 -18
  142. package/client/node_modules/semver/functions/patch.js +0 -5
  143. package/client/node_modules/semver/functions/prerelease.js +0 -8
  144. package/client/node_modules/semver/functions/rcompare.js +0 -5
  145. package/client/node_modules/semver/functions/rsort.js +0 -5
  146. package/client/node_modules/semver/functions/satisfies.js +0 -12
  147. package/client/node_modules/semver/functions/sort.js +0 -5
  148. package/client/node_modules/semver/functions/valid.js +0 -8
  149. package/client/node_modules/semver/index.js +0 -91
  150. package/client/node_modules/semver/internal/constants.js +0 -37
  151. package/client/node_modules/semver/internal/debug.js +0 -11
  152. package/client/node_modules/semver/internal/identifiers.js +0 -29
  153. package/client/node_modules/semver/internal/lrucache.js +0 -42
  154. package/client/node_modules/semver/internal/parse-options.js +0 -17
  155. package/client/node_modules/semver/internal/re.js +0 -223
  156. package/client/node_modules/semver/package.json +0 -78
  157. package/client/node_modules/semver/preload.js +0 -4
  158. package/client/node_modules/semver/range.bnf +0 -16
  159. package/client/node_modules/semver/ranges/gtr.js +0 -6
  160. package/client/node_modules/semver/ranges/intersects.js +0 -9
  161. package/client/node_modules/semver/ranges/ltr.js +0 -6
  162. package/client/node_modules/semver/ranges/max-satisfying.js +0 -27
  163. package/client/node_modules/semver/ranges/min-satisfying.js +0 -26
  164. package/client/node_modules/semver/ranges/min-version.js +0 -63
  165. package/client/node_modules/semver/ranges/outside.js +0 -82
  166. package/client/node_modules/semver/ranges/simplify.js +0 -49
  167. package/client/node_modules/semver/ranges/subset.js +0 -249
  168. package/client/node_modules/semver/ranges/to-comparators.js +0 -10
  169. package/client/node_modules/semver/ranges/valid.js +0 -13
  170. package/client/node_modules/undici-types/README.md +0 -6
  171. package/client/node_modules/undici-types/agent.d.ts +0 -31
  172. package/client/node_modules/undici-types/api.d.ts +0 -43
  173. package/client/node_modules/undici-types/balanced-pool.d.ts +0 -18
  174. package/client/node_modules/undici-types/cache.d.ts +0 -36
  175. package/client/node_modules/undici-types/client.d.ts +0 -97
  176. package/client/node_modules/undici-types/connector.d.ts +0 -34
  177. package/client/node_modules/undici-types/content-type.d.ts +0 -21
  178. package/client/node_modules/undici-types/cookies.d.ts +0 -28
  179. package/client/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  180. package/client/node_modules/undici-types/dispatcher.d.ts +0 -241
  181. package/client/node_modules/undici-types/errors.d.ts +0 -128
  182. package/client/node_modules/undici-types/fetch.d.ts +0 -209
  183. package/client/node_modules/undici-types/file.d.ts +0 -39
  184. package/client/node_modules/undici-types/filereader.d.ts +0 -54
  185. package/client/node_modules/undici-types/formdata.d.ts +0 -108
  186. package/client/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  187. package/client/node_modules/undici-types/global-origin.d.ts +0 -7
  188. package/client/node_modules/undici-types/handlers.d.ts +0 -9
  189. package/client/node_modules/undici-types/header.d.ts +0 -4
  190. package/client/node_modules/undici-types/index.d.ts +0 -63
  191. package/client/node_modules/undici-types/interceptors.d.ts +0 -5
  192. package/client/node_modules/undici-types/mock-agent.d.ts +0 -50
  193. package/client/node_modules/undici-types/mock-client.d.ts +0 -25
  194. package/client/node_modules/undici-types/mock-errors.d.ts +0 -12
  195. package/client/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  196. package/client/node_modules/undici-types/mock-pool.d.ts +0 -25
  197. package/client/node_modules/undici-types/package.json +0 -55
  198. package/client/node_modules/undici-types/patch.d.ts +0 -71
  199. package/client/node_modules/undici-types/pool-stats.d.ts +0 -19
  200. package/client/node_modules/undici-types/pool.d.ts +0 -28
  201. package/client/node_modules/undici-types/proxy-agent.d.ts +0 -30
  202. package/client/node_modules/undici-types/readable.d.ts +0 -61
  203. package/client/node_modules/undici-types/webidl.d.ts +0 -220
  204. package/client/node_modules/undici-types/websocket.d.ts +0 -131
  205. package/client/node_modules/vscode-jsonrpc/License.txt +0 -11
  206. package/client/node_modules/vscode-jsonrpc/README.md +0 -69
  207. package/client/node_modules/vscode-jsonrpc/browser.d.ts +0 -6
  208. package/client/node_modules/vscode-jsonrpc/browser.js +0 -7
  209. package/client/node_modules/vscode-jsonrpc/lib/browser/main.d.ts +0 -17
  210. package/client/node_modules/vscode-jsonrpc/lib/browser/main.js +0 -76
  211. package/client/node_modules/vscode-jsonrpc/lib/browser/ril.d.ts +0 -12
  212. package/client/node_modules/vscode-jsonrpc/lib/browser/ril.js +0 -156
  213. package/client/node_modules/vscode-jsonrpc/lib/common/api.d.ts +0 -14
  214. package/client/node_modules/vscode-jsonrpc/lib/common/api.js +0 -81
  215. package/client/node_modules/vscode-jsonrpc/lib/common/cancellation.d.ts +0 -32
  216. package/client/node_modules/vscode-jsonrpc/lib/common/cancellation.js +0 -96
  217. package/client/node_modules/vscode-jsonrpc/lib/common/connection.d.ts +0 -358
  218. package/client/node_modules/vscode-jsonrpc/lib/common/connection.js +0 -1212
  219. package/client/node_modules/vscode-jsonrpc/lib/common/disposable.d.ts +0 -9
  220. package/client/node_modules/vscode-jsonrpc/lib/common/disposable.js +0 -16
  221. package/client/node_modules/vscode-jsonrpc/lib/common/encoding.d.ts +0 -52
  222. package/client/node_modules/vscode-jsonrpc/lib/common/encoding.js +0 -70
  223. package/client/node_modules/vscode-jsonrpc/lib/common/events.d.ts +0 -39
  224. package/client/node_modules/vscode-jsonrpc/lib/common/events.js +0 -128
  225. package/client/node_modules/vscode-jsonrpc/lib/common/is.d.ts +0 -7
  226. package/client/node_modules/vscode-jsonrpc/lib/common/is.js +0 -35
  227. package/client/node_modules/vscode-jsonrpc/lib/common/linkedMap.d.ts +0 -53
  228. package/client/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +0 -398
  229. package/client/node_modules/vscode-jsonrpc/lib/common/messageBuffer.d.ts +0 -18
  230. package/client/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +0 -152
  231. package/client/node_modules/vscode-jsonrpc/lib/common/messageReader.d.ts +0 -77
  232. package/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js +0 -197
  233. package/client/node_modules/vscode-jsonrpc/lib/common/messageWriter.d.ts +0 -60
  234. package/client/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +0 -115
  235. package/client/node_modules/vscode-jsonrpc/lib/common/messages.d.ts +0 -369
  236. package/client/node_modules/vscode-jsonrpc/lib/common/messages.js +0 -306
  237. package/client/node_modules/vscode-jsonrpc/lib/common/ral.d.ts +0 -74
  238. package/client/node_modules/vscode-jsonrpc/lib/common/ral.js +0 -23
  239. package/client/node_modules/vscode-jsonrpc/lib/common/semaphore.d.ts +0 -10
  240. package/client/node_modules/vscode-jsonrpc/lib/common/semaphore.js +0 -68
  241. package/client/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +0 -15
  242. package/client/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +0 -76
  243. package/client/node_modules/vscode-jsonrpc/lib/node/main.d.ts +0 -63
  244. package/client/node_modules/vscode-jsonrpc/lib/node/main.js +0 -257
  245. package/client/node_modules/vscode-jsonrpc/lib/node/ril.d.ts +0 -13
  246. package/client/node_modules/vscode-jsonrpc/lib/node/ril.js +0 -161
  247. package/client/node_modules/vscode-jsonrpc/node.cmd +0 -5
  248. package/client/node_modules/vscode-jsonrpc/node.d.ts +0 -6
  249. package/client/node_modules/vscode-jsonrpc/node.js +0 -7
  250. package/client/node_modules/vscode-jsonrpc/package.json +0 -45
  251. package/client/node_modules/vscode-jsonrpc/thirdpartynotices.txt +0 -16
  252. package/client/node_modules/vscode-jsonrpc/typings/thenable.d.ts +0 -5
  253. package/client/node_modules/vscode-languageclient/License.txt +0 -11
  254. package/client/node_modules/vscode-languageclient/README.md +0 -17
  255. package/client/node_modules/vscode-languageclient/browser.d.ts +0 -6
  256. package/client/node_modules/vscode-languageclient/browser.js +0 -7
  257. package/client/node_modules/vscode-languageclient/lib/browser/main.d.ts +0 -8
  258. package/client/node_modules/vscode-languageclient/lib/browser/main.js +0 -37
  259. package/client/node_modules/vscode-languageclient/lib/common/api.d.ts +0 -36
  260. package/client/node_modules/vscode-languageclient/lib/common/api.js +0 -27
  261. package/client/node_modules/vscode-languageclient/lib/common/callHierarchy.d.ts +0 -37
  262. package/client/node_modules/vscode-languageclient/lib/common/callHierarchy.js +0 -97
  263. package/client/node_modules/vscode-languageclient/lib/common/client.d.ts +0 -476
  264. package/client/node_modules/vscode-languageclient/lib/common/client.js +0 -1600
  265. package/client/node_modules/vscode-languageclient/lib/common/codeAction.d.ts +0 -19
  266. package/client/node_modules/vscode-languageclient/lib/common/codeAction.js +0 -99
  267. package/client/node_modules/vscode-languageclient/lib/common/codeConverter.d.ts +0 -78
  268. package/client/node_modules/vscode-languageclient/lib/common/codeConverter.js +0 -876
  269. package/client/node_modules/vscode-languageclient/lib/common/codeLens.d.ts +0 -23
  270. package/client/node_modules/vscode-languageclient/lib/common/codeLens.js +0 -78
  271. package/client/node_modules/vscode-languageclient/lib/common/colorProvider.d.ts +0 -25
  272. package/client/node_modules/vscode-languageclient/lib/common/colorProvider.js +0 -74
  273. package/client/node_modules/vscode-languageclient/lib/common/completion.d.ts +0 -20
  274. package/client/node_modules/vscode-languageclient/lib/common/completion.js +0 -126
  275. package/client/node_modules/vscode-languageclient/lib/common/configuration.d.ts +0 -69
  276. package/client/node_modules/vscode-languageclient/lib/common/configuration.js +0 -209
  277. package/client/node_modules/vscode-languageclient/lib/common/declaration.d.ts +0 -16
  278. package/client/node_modules/vscode-languageclient/lib/common/declaration.js +0 -54
  279. package/client/node_modules/vscode-languageclient/lib/common/definition.d.ts +0 -16
  280. package/client/node_modules/vscode-languageclient/lib/common/definition.js +0 -55
  281. package/client/node_modules/vscode-languageclient/lib/common/diagnostic.d.ts +0 -122
  282. package/client/node_modules/vscode-languageclient/lib/common/diagnostic.js +0 -814
  283. package/client/node_modules/vscode-languageclient/lib/common/documentHighlight.d.ts +0 -15
  284. package/client/node_modules/vscode-languageclient/lib/common/documentHighlight.js +0 -50
  285. package/client/node_modules/vscode-languageclient/lib/common/documentLink.d.ts +0 -19
  286. package/client/node_modules/vscode-languageclient/lib/common/documentLink.js +0 -71
  287. package/client/node_modules/vscode-languageclient/lib/common/documentSymbol.d.ts +0 -17
  288. package/client/node_modules/vscode-languageclient/lib/common/documentSymbol.js +0 -104
  289. package/client/node_modules/vscode-languageclient/lib/common/executeCommand.d.ts +0 -21
  290. package/client/node_modules/vscode-languageclient/lib/common/executeCommand.js +0 -72
  291. package/client/node_modules/vscode-languageclient/lib/common/features.d.ts +0 -418
  292. package/client/node_modules/vscode-languageclient/lib/common/features.js +0 -291
  293. package/client/node_modules/vscode-languageclient/lib/common/fileOperations.d.ts +0 -116
  294. package/client/node_modules/vscode-languageclient/lib/common/fileOperations.js +0 -333
  295. package/client/node_modules/vscode-languageclient/lib/common/fileSystemWatcher.d.ts +0 -18
  296. package/client/node_modules/vscode-languageclient/lib/common/fileSystemWatcher.js +0 -95
  297. package/client/node_modules/vscode-languageclient/lib/common/foldingRange.d.ts +0 -19
  298. package/client/node_modules/vscode-languageclient/lib/common/foldingRange.js +0 -65
  299. package/client/node_modules/vscode-languageclient/lib/common/formatting.d.ts +0 -39
  300. package/client/node_modules/vscode-languageclient/lib/common/formatting.js +0 -182
  301. package/client/node_modules/vscode-languageclient/lib/common/hover.d.ts +0 -16
  302. package/client/node_modules/vscode-languageclient/lib/common/hover.js +0 -58
  303. package/client/node_modules/vscode-languageclient/lib/common/implementation.d.ts +0 -16
  304. package/client/node_modules/vscode-languageclient/lib/common/implementation.js +0 -54
  305. package/client/node_modules/vscode-languageclient/lib/common/inlayHint.d.ts +0 -20
  306. package/client/node_modules/vscode-languageclient/lib/common/inlayHint.js +0 -92
  307. package/client/node_modules/vscode-languageclient/lib/common/inlineCompletion.d.ts +0 -18
  308. package/client/node_modules/vscode-languageclient/lib/common/inlineCompletion.js +0 -54
  309. package/client/node_modules/vscode-languageclient/lib/common/inlineValue.d.ts +0 -18
  310. package/client/node_modules/vscode-languageclient/lib/common/inlineValue.js +0 -65
  311. package/client/node_modules/vscode-languageclient/lib/common/linkedEditingRange.d.ts +0 -21
  312. package/client/node_modules/vscode-languageclient/lib/common/linkedEditingRange.js +0 -53
  313. package/client/node_modules/vscode-languageclient/lib/common/notebook.d.ts +0 -96
  314. package/client/node_modules/vscode-languageclient/lib/common/notebook.js +0 -851
  315. package/client/node_modules/vscode-languageclient/lib/common/progress.d.ts +0 -11
  316. package/client/node_modules/vscode-languageclient/lib/common/progress.js +0 -44
  317. package/client/node_modules/vscode-languageclient/lib/common/progressPart.d.ts +0 -24
  318. package/client/node_modules/vscode-languageclient/lib/common/progressPart.js +0 -96
  319. package/client/node_modules/vscode-languageclient/lib/common/protocolCallHierarchyItem.d.ts +0 -6
  320. package/client/node_modules/vscode-languageclient/lib/common/protocolCallHierarchyItem.js +0 -16
  321. package/client/node_modules/vscode-languageclient/lib/common/protocolCodeAction.d.ts +0 -6
  322. package/client/node_modules/vscode-languageclient/lib/common/protocolCodeAction.js +0 -14
  323. package/client/node_modules/vscode-languageclient/lib/common/protocolCodeLens.d.ts +0 -5
  324. package/client/node_modules/vscode-languageclient/lib/common/protocolCodeLens.js +0 -13
  325. package/client/node_modules/vscode-languageclient/lib/common/protocolCompletionItem.d.ts +0 -11
  326. package/client/node_modules/vscode-languageclient/lib/common/protocolCompletionItem.js +0 -13
  327. package/client/node_modules/vscode-languageclient/lib/common/protocolConverter.d.ts +0 -167
  328. package/client/node_modules/vscode-languageclient/lib/common/protocolConverter.js +0 -1134
  329. package/client/node_modules/vscode-languageclient/lib/common/protocolDiagnostic.d.ts +0 -18
  330. package/client/node_modules/vscode-languageclient/lib/common/protocolDiagnostic.js +0 -25
  331. package/client/node_modules/vscode-languageclient/lib/common/protocolDocumentLink.d.ts +0 -5
  332. package/client/node_modules/vscode-languageclient/lib/common/protocolDocumentLink.js +0 -13
  333. package/client/node_modules/vscode-languageclient/lib/common/protocolInlayHint.d.ts +0 -5
  334. package/client/node_modules/vscode-languageclient/lib/common/protocolInlayHint.js +0 -13
  335. package/client/node_modules/vscode-languageclient/lib/common/protocolTypeHierarchyItem.d.ts +0 -6
  336. package/client/node_modules/vscode-languageclient/lib/common/protocolTypeHierarchyItem.js +0 -16
  337. package/client/node_modules/vscode-languageclient/lib/common/protocolWorkspaceSymbol.d.ts +0 -7
  338. package/client/node_modules/vscode-languageclient/lib/common/protocolWorkspaceSymbol.js +0 -18
  339. package/client/node_modules/vscode-languageclient/lib/common/reference.d.ts +0 -20
  340. package/client/node_modules/vscode-languageclient/lib/common/reference.js +0 -53
  341. package/client/node_modules/vscode-languageclient/lib/common/rename.d.ts +0 -27
  342. package/client/node_modules/vscode-languageclient/lib/common/rename.js +0 -113
  343. package/client/node_modules/vscode-languageclient/lib/common/selectionRange.d.ts +0 -16
  344. package/client/node_modules/vscode-languageclient/lib/common/selectionRange.js +0 -57
  345. package/client/node_modules/vscode-languageclient/lib/common/semanticTokens.d.ts +0 -33
  346. package/client/node_modules/vscode-languageclient/lib/common/semanticTokens.js +0 -179
  347. package/client/node_modules/vscode-languageclient/lib/common/signatureHelp.d.ts +0 -16
  348. package/client/node_modules/vscode-languageclient/lib/common/signatureHelp.js +0 -71
  349. package/client/node_modules/vscode-languageclient/lib/common/textSynchronization.d.ts +0 -101
  350. package/client/node_modules/vscode-languageclient/lib/common/textSynchronization.js +0 -402
  351. package/client/node_modules/vscode-languageclient/lib/common/typeDefinition.d.ts +0 -16
  352. package/client/node_modules/vscode-languageclient/lib/common/typeDefinition.js +0 -55
  353. package/client/node_modules/vscode-languageclient/lib/common/typeHierarchy.d.ts +0 -31
  354. package/client/node_modules/vscode-languageclient/lib/common/typeHierarchy.js +0 -96
  355. package/client/node_modules/vscode-languageclient/lib/common/utils/async.d.ts +0 -41
  356. package/client/node_modules/vscode-languageclient/lib/common/utils/async.js +0 -276
  357. package/client/node_modules/vscode-languageclient/lib/common/utils/is.d.ts +0 -12
  358. package/client/node_modules/vscode-languageclient/lib/common/utils/is.js +0 -57
  359. package/client/node_modules/vscode-languageclient/lib/common/utils/uuid.d.ts +0 -22
  360. package/client/node_modules/vscode-languageclient/lib/common/utils/uuid.js +0 -97
  361. package/client/node_modules/vscode-languageclient/lib/common/workspaceFolder.d.ts +0 -30
  362. package/client/node_modules/vscode-languageclient/lib/common/workspaceFolder.js +0 -148
  363. package/client/node_modules/vscode-languageclient/lib/common/workspaceSymbol.d.ts +0 -19
  364. package/client/node_modules/vscode-languageclient/lib/common/workspaceSymbol.js +0 -79
  365. package/client/node_modules/vscode-languageclient/lib/node/main.d.ts +0 -100
  366. package/client/node_modules/vscode-languageclient/lib/node/main.js +0 -570
  367. package/client/node_modules/vscode-languageclient/lib/node/processes.d.ts +0 -6
  368. package/client/node_modules/vscode-languageclient/lib/node/processes.js +0 -47
  369. package/client/node_modules/vscode-languageclient/lib/node/terminateProcess.sh +0 -16
  370. package/client/node_modules/vscode-languageclient/node.cmd +0 -5
  371. package/client/node_modules/vscode-languageclient/node.d.ts +0 -6
  372. package/client/node_modules/vscode-languageclient/node.js +0 -7
  373. package/client/node_modules/vscode-languageclient/package.json +0 -50
  374. package/client/node_modules/vscode-languageserver-protocol/License.txt +0 -11
  375. package/client/node_modules/vscode-languageserver-protocol/README.md +0 -16
  376. package/client/node_modules/vscode-languageserver-protocol/browser.d.ts +0 -6
  377. package/client/node_modules/vscode-languageserver-protocol/browser.js +0 -7
  378. package/client/node_modules/vscode-languageserver-protocol/lib/browser/main.d.ts +0 -4
  379. package/client/node_modules/vscode-languageserver-protocol/lib/browser/main.js +0 -28
  380. package/client/node_modules/vscode-languageserver-protocol/lib/common/api.d.ts +0 -58
  381. package/client/node_modules/vscode-languageserver-protocol/lib/common/api.js +0 -77
  382. package/client/node_modules/vscode-languageserver-protocol/lib/common/connection.d.ts +0 -187
  383. package/client/node_modules/vscode-languageserver-protocol/lib/common/connection.js +0 -15
  384. package/client/node_modules/vscode-languageserver-protocol/lib/common/messages.d.ts +0 -51
  385. package/client/node_modules/vscode-languageserver-protocol/lib/common/messages.js +0 -44
  386. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.$.d.ts +0 -1
  387. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.$.js +0 -43
  388. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.d.ts +0 -86
  389. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +0 -42
  390. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.d.ts +0 -66
  391. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +0 -32
  392. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.d.ts +0 -35
  393. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +0 -24
  394. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.d.ts +0 -3252
  395. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.d.ts +0 -37
  396. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +0 -22
  397. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.d.ts +0 -341
  398. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +0 -74
  399. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.d.ts +0 -306
  400. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +0 -101
  401. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.d.ts +0 -109
  402. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +0 -30
  403. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.d.ts +0 -38
  404. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +0 -21
  405. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.d.ts +0 -110
  406. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +0 -43
  407. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.d.ts +0 -57
  408. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js +0 -22
  409. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.d.ts +0 -86
  410. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +0 -30
  411. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +0 -943
  412. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.d.ts +0 -52
  413. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +0 -19
  414. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.d.ts +0 -106
  415. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +0 -68
  416. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.d.ts +0 -400
  417. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +0 -214
  418. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.d.ts +0 -107
  419. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +0 -37
  420. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.d.ts +0 -41
  421. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +0 -20
  422. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.d.ts +0 -223
  423. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +0 -57
  424. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.d.ts +0 -72
  425. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +0 -22
  426. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.d.ts +0 -38
  427. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +0 -21
  428. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.d.ts +0 -83
  429. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +0 -42
  430. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.d.ts +0 -74
  431. package/client/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +0 -27
  432. package/client/node_modules/vscode-languageserver-protocol/lib/common/utils/is.d.ts +0 -9
  433. package/client/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +0 -46
  434. package/client/node_modules/vscode-languageserver-protocol/lib/node/main.d.ts +0 -6
  435. package/client/node_modules/vscode-languageserver-protocol/lib/node/main.js +0 -28
  436. package/client/node_modules/vscode-languageserver-protocol/metaModel.schema.json +0 -783
  437. package/client/node_modules/vscode-languageserver-protocol/node.cmd +0 -5
  438. package/client/node_modules/vscode-languageserver-protocol/node.d.ts +0 -6
  439. package/client/node_modules/vscode-languageserver-protocol/node.js +0 -7
  440. package/client/node_modules/vscode-languageserver-protocol/package.json +0 -45
  441. package/client/node_modules/vscode-languageserver-protocol/thirdpartynotices.txt +0 -31
  442. package/client/node_modules/vscode-languageserver-types/License.txt +0 -11
  443. package/client/node_modules/vscode-languageserver-types/README.md +0 -17
  444. package/client/node_modules/vscode-languageserver-types/lib/esm/main.d.ts +0 -3139
  445. package/client/node_modules/vscode-languageserver-types/lib/esm/main.js +0 -2222
  446. package/client/node_modules/vscode-languageserver-types/lib/esm/package.json +0 -3
  447. package/client/node_modules/vscode-languageserver-types/lib/umd/main.d.ts +0 -3139
  448. package/client/node_modules/vscode-languageserver-types/lib/umd/main.js +0 -2272
  449. package/client/node_modules/vscode-languageserver-types/package.json +0 -38
  450. package/client/node_modules/vscode-languageserver-types/thirdpartynotices.txt +0 -16
  451. package/client/package-lock.json +0 -125
  452. package/client/package.json +0 -42
  453. package/client/src/extension.ts +0 -56
  454. package/client/tsconfig.json +0 -12
@@ -1,1600 +0,0 @@
1
- "use strict";
2
- /* --------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- * ------------------------------------------------------------------------------------------ */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ProposedFeatures = exports.BaseLanguageClient = exports.MessageTransports = exports.SuspendMode = exports.State = exports.CloseAction = exports.ErrorAction = exports.RevealOutputChannelOn = void 0;
8
- const vscode_1 = require("vscode");
9
- const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
10
- const c2p = require("./codeConverter");
11
- const p2c = require("./protocolConverter");
12
- const Is = require("./utils/is");
13
- const async_1 = require("./utils/async");
14
- const UUID = require("./utils/uuid");
15
- const progressPart_1 = require("./progressPart");
16
- const features_1 = require("./features");
17
- const diagnostic_1 = require("./diagnostic");
18
- const notebook_1 = require("./notebook");
19
- const configuration_1 = require("./configuration");
20
- const textSynchronization_1 = require("./textSynchronization");
21
- const completion_1 = require("./completion");
22
- const hover_1 = require("./hover");
23
- const definition_1 = require("./definition");
24
- const signatureHelp_1 = require("./signatureHelp");
25
- const documentHighlight_1 = require("./documentHighlight");
26
- const documentSymbol_1 = require("./documentSymbol");
27
- const workspaceSymbol_1 = require("./workspaceSymbol");
28
- const reference_1 = require("./reference");
29
- const codeAction_1 = require("./codeAction");
30
- const codeLens_1 = require("./codeLens");
31
- const formatting_1 = require("./formatting");
32
- const rename_1 = require("./rename");
33
- const documentLink_1 = require("./documentLink");
34
- const executeCommand_1 = require("./executeCommand");
35
- const fileSystemWatcher_1 = require("./fileSystemWatcher");
36
- const colorProvider_1 = require("./colorProvider");
37
- const implementation_1 = require("./implementation");
38
- const typeDefinition_1 = require("./typeDefinition");
39
- const workspaceFolder_1 = require("./workspaceFolder");
40
- const foldingRange_1 = require("./foldingRange");
41
- const declaration_1 = require("./declaration");
42
- const selectionRange_1 = require("./selectionRange");
43
- const progress_1 = require("./progress");
44
- const callHierarchy_1 = require("./callHierarchy");
45
- const semanticTokens_1 = require("./semanticTokens");
46
- const fileOperations_1 = require("./fileOperations");
47
- const linkedEditingRange_1 = require("./linkedEditingRange");
48
- const typeHierarchy_1 = require("./typeHierarchy");
49
- const inlineValue_1 = require("./inlineValue");
50
- const inlayHint_1 = require("./inlayHint");
51
- const inlineCompletion_1 = require("./inlineCompletion");
52
- /**
53
- * Controls when the output channel is revealed.
54
- */
55
- var RevealOutputChannelOn;
56
- (function (RevealOutputChannelOn) {
57
- RevealOutputChannelOn[RevealOutputChannelOn["Debug"] = 0] = "Debug";
58
- RevealOutputChannelOn[RevealOutputChannelOn["Info"] = 1] = "Info";
59
- RevealOutputChannelOn[RevealOutputChannelOn["Warn"] = 2] = "Warn";
60
- RevealOutputChannelOn[RevealOutputChannelOn["Error"] = 3] = "Error";
61
- RevealOutputChannelOn[RevealOutputChannelOn["Never"] = 4] = "Never";
62
- })(RevealOutputChannelOn || (exports.RevealOutputChannelOn = RevealOutputChannelOn = {}));
63
- /**
64
- * An action to be performed when the connection is producing errors.
65
- */
66
- var ErrorAction;
67
- (function (ErrorAction) {
68
- /**
69
- * Continue running the server.
70
- */
71
- ErrorAction[ErrorAction["Continue"] = 1] = "Continue";
72
- /**
73
- * Shutdown the server.
74
- */
75
- ErrorAction[ErrorAction["Shutdown"] = 2] = "Shutdown";
76
- })(ErrorAction || (exports.ErrorAction = ErrorAction = {}));
77
- /**
78
- * An action to be performed when the connection to a server got closed.
79
- */
80
- var CloseAction;
81
- (function (CloseAction) {
82
- /**
83
- * Don't restart the server. The connection stays closed.
84
- */
85
- CloseAction[CloseAction["DoNotRestart"] = 1] = "DoNotRestart";
86
- /**
87
- * Restart the server.
88
- */
89
- CloseAction[CloseAction["Restart"] = 2] = "Restart";
90
- })(CloseAction || (exports.CloseAction = CloseAction = {}));
91
- /**
92
- * Signals in which state the language client is in.
93
- */
94
- var State;
95
- (function (State) {
96
- /**
97
- * The client is stopped or got never started.
98
- */
99
- State[State["Stopped"] = 1] = "Stopped";
100
- /**
101
- * The client is starting but not ready yet.
102
- */
103
- State[State["Starting"] = 3] = "Starting";
104
- /**
105
- * The client is running and ready.
106
- */
107
- State[State["Running"] = 2] = "Running";
108
- })(State || (exports.State = State = {}));
109
- var SuspendMode;
110
- (function (SuspendMode) {
111
- /**
112
- * Don't allow suspend mode.
113
- */
114
- SuspendMode["off"] = "off";
115
- /**
116
- * Support suspend mode even if not all
117
- * registered providers have a corresponding
118
- * activation listener.
119
- */
120
- SuspendMode["on"] = "on";
121
- })(SuspendMode || (exports.SuspendMode = SuspendMode = {}));
122
- var ResolvedClientOptions;
123
- (function (ResolvedClientOptions) {
124
- function sanitizeIsTrusted(isTrusted) {
125
- if (isTrusted === undefined || isTrusted === null) {
126
- return false;
127
- }
128
- if ((typeof isTrusted === 'boolean') || (typeof isTrusted === 'object' && isTrusted !== null && Is.stringArray(isTrusted.enabledCommands))) {
129
- return isTrusted;
130
- }
131
- return false;
132
- }
133
- ResolvedClientOptions.sanitizeIsTrusted = sanitizeIsTrusted;
134
- })(ResolvedClientOptions || (ResolvedClientOptions = {}));
135
- class DefaultErrorHandler {
136
- constructor(client, maxRestartCount) {
137
- this.client = client;
138
- this.maxRestartCount = maxRestartCount;
139
- this.restarts = [];
140
- }
141
- error(_error, _message, count) {
142
- if (count && count <= 3) {
143
- return { action: ErrorAction.Continue };
144
- }
145
- return { action: ErrorAction.Shutdown };
146
- }
147
- closed() {
148
- this.restarts.push(Date.now());
149
- if (this.restarts.length <= this.maxRestartCount) {
150
- return { action: CloseAction.Restart };
151
- }
152
- else {
153
- let diff = this.restarts[this.restarts.length - 1] - this.restarts[0];
154
- if (diff <= 3 * 60 * 1000) {
155
- return { action: CloseAction.DoNotRestart, message: `The ${this.client.name} server crashed ${this.maxRestartCount + 1} times in the last 3 minutes. The server will not be restarted. See the output for more information.` };
156
- }
157
- else {
158
- this.restarts.shift();
159
- return { action: CloseAction.Restart };
160
- }
161
- }
162
- }
163
- }
164
- var ClientState;
165
- (function (ClientState) {
166
- ClientState["Initial"] = "initial";
167
- ClientState["Starting"] = "starting";
168
- ClientState["StartFailed"] = "startFailed";
169
- ClientState["Running"] = "running";
170
- ClientState["Stopping"] = "stopping";
171
- ClientState["Stopped"] = "stopped";
172
- })(ClientState || (ClientState = {}));
173
- var MessageTransports;
174
- (function (MessageTransports) {
175
- function is(value) {
176
- let candidate = value;
177
- return candidate && vscode_languageserver_protocol_1.MessageReader.is(value.reader) && vscode_languageserver_protocol_1.MessageWriter.is(value.writer);
178
- }
179
- MessageTransports.is = is;
180
- })(MessageTransports || (exports.MessageTransports = MessageTransports = {}));
181
- class BaseLanguageClient {
182
- constructor(id, name, clientOptions) {
183
- this._traceFormat = vscode_languageserver_protocol_1.TraceFormat.Text;
184
- this._diagnosticQueue = new Map();
185
- this._diagnosticQueueState = { state: 'idle' };
186
- this._features = [];
187
- this._dynamicFeatures = new Map();
188
- this.workspaceEditLock = new async_1.Semaphore(1);
189
- this._id = id;
190
- this._name = name;
191
- clientOptions = clientOptions || {};
192
- const markdown = { isTrusted: false, supportHtml: false };
193
- if (clientOptions.markdown !== undefined) {
194
- markdown.isTrusted = ResolvedClientOptions.sanitizeIsTrusted(clientOptions.markdown.isTrusted);
195
- markdown.supportHtml = clientOptions.markdown.supportHtml === true;
196
- }
197
- // const defaultInterval = (clientOptions as TestOptions).$testMode ? 50 : 60000;
198
- this._clientOptions = {
199
- documentSelector: clientOptions.documentSelector ?? [],
200
- synchronize: clientOptions.synchronize ?? {},
201
- diagnosticCollectionName: clientOptions.diagnosticCollectionName,
202
- outputChannelName: clientOptions.outputChannelName ?? this._name,
203
- revealOutputChannelOn: clientOptions.revealOutputChannelOn ?? RevealOutputChannelOn.Error,
204
- stdioEncoding: clientOptions.stdioEncoding ?? 'utf8',
205
- initializationOptions: clientOptions.initializationOptions,
206
- initializationFailedHandler: clientOptions.initializationFailedHandler,
207
- progressOnInitialization: !!clientOptions.progressOnInitialization,
208
- errorHandler: clientOptions.errorHandler ?? this.createDefaultErrorHandler(clientOptions.connectionOptions?.maxRestartCount),
209
- middleware: clientOptions.middleware ?? {},
210
- uriConverters: clientOptions.uriConverters,
211
- workspaceFolder: clientOptions.workspaceFolder,
212
- connectionOptions: clientOptions.connectionOptions,
213
- markdown,
214
- // suspend: {
215
- // mode: clientOptions.suspend?.mode ?? SuspendMode.off,
216
- // callback: clientOptions.suspend?.callback ?? (() => Promise.resolve(true)),
217
- // interval: clientOptions.suspend?.interval ? Math.max(clientOptions.suspend.interval, defaultInterval) : defaultInterval
218
- // },
219
- diagnosticPullOptions: clientOptions.diagnosticPullOptions ?? { onChange: true, onSave: false },
220
- notebookDocumentOptions: clientOptions.notebookDocumentOptions ?? {}
221
- };
222
- this._clientOptions.synchronize = this._clientOptions.synchronize || {};
223
- this._state = ClientState.Initial;
224
- this._ignoredRegistrations = new Set();
225
- this._listeners = [];
226
- this._notificationHandlers = new Map();
227
- this._pendingNotificationHandlers = new Map();
228
- this._notificationDisposables = new Map();
229
- this._requestHandlers = new Map();
230
- this._pendingRequestHandlers = new Map();
231
- this._requestDisposables = new Map();
232
- this._progressHandlers = new Map();
233
- this._pendingProgressHandlers = new Map();
234
- this._progressDisposables = new Map();
235
- this._connection = undefined;
236
- // this._idleStart = undefined;
237
- this._initializeResult = undefined;
238
- if (clientOptions.outputChannel) {
239
- this._outputChannel = clientOptions.outputChannel;
240
- this._disposeOutputChannel = false;
241
- }
242
- else {
243
- this._outputChannel = undefined;
244
- this._disposeOutputChannel = true;
245
- }
246
- this._traceOutputChannel = clientOptions.traceOutputChannel;
247
- this._diagnostics = undefined;
248
- this._pendingOpenNotifications = new Set();
249
- this._pendingChangeSemaphore = new async_1.Semaphore(1);
250
- this._pendingChangeDelayer = new async_1.Delayer(250);
251
- this._fileEvents = [];
252
- this._fileEventDelayer = new async_1.Delayer(250);
253
- this._onStop = undefined;
254
- this._telemetryEmitter = new vscode_languageserver_protocol_1.Emitter();
255
- this._stateChangeEmitter = new vscode_languageserver_protocol_1.Emitter();
256
- this._trace = vscode_languageserver_protocol_1.Trace.Off;
257
- this._tracer = {
258
- log: (messageOrDataObject, data) => {
259
- if (Is.string(messageOrDataObject)) {
260
- this.logTrace(messageOrDataObject, data);
261
- }
262
- else {
263
- this.logObjectTrace(messageOrDataObject);
264
- }
265
- },
266
- };
267
- this._c2p = c2p.createConverter(clientOptions.uriConverters ? clientOptions.uriConverters.code2Protocol : undefined);
268
- this._p2c = p2c.createConverter(clientOptions.uriConverters ? clientOptions.uriConverters.protocol2Code : undefined, this._clientOptions.markdown.isTrusted, this._clientOptions.markdown.supportHtml);
269
- this._syncedDocuments = new Map();
270
- this.registerBuiltinFeatures();
271
- }
272
- get name() {
273
- return this._name;
274
- }
275
- get middleware() {
276
- return this._clientOptions.middleware ?? Object.create(null);
277
- }
278
- get clientOptions() {
279
- return this._clientOptions;
280
- }
281
- get protocol2CodeConverter() {
282
- return this._p2c;
283
- }
284
- get code2ProtocolConverter() {
285
- return this._c2p;
286
- }
287
- get onTelemetry() {
288
- return this._telemetryEmitter.event;
289
- }
290
- get onDidChangeState() {
291
- return this._stateChangeEmitter.event;
292
- }
293
- get outputChannel() {
294
- if (!this._outputChannel) {
295
- this._outputChannel = vscode_1.window.createOutputChannel(this._clientOptions.outputChannelName ? this._clientOptions.outputChannelName : this._name);
296
- }
297
- return this._outputChannel;
298
- }
299
- get traceOutputChannel() {
300
- if (this._traceOutputChannel) {
301
- return this._traceOutputChannel;
302
- }
303
- return this.outputChannel;
304
- }
305
- get diagnostics() {
306
- return this._diagnostics;
307
- }
308
- get state() {
309
- return this.getPublicState();
310
- }
311
- get $state() {
312
- return this._state;
313
- }
314
- set $state(value) {
315
- let oldState = this.getPublicState();
316
- this._state = value;
317
- let newState = this.getPublicState();
318
- if (newState !== oldState) {
319
- this._stateChangeEmitter.fire({ oldState, newState });
320
- }
321
- }
322
- getPublicState() {
323
- switch (this.$state) {
324
- case ClientState.Starting:
325
- return State.Starting;
326
- case ClientState.Running:
327
- return State.Running;
328
- default:
329
- return State.Stopped;
330
- }
331
- }
332
- get initializeResult() {
333
- return this._initializeResult;
334
- }
335
- async sendRequest(type, ...params) {
336
- if (this.$state === ClientState.StartFailed || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped) {
337
- return Promise.reject(new vscode_languageserver_protocol_1.ResponseError(vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive, `Client is not running`));
338
- }
339
- // Ensure we have a connection before we force the document sync.
340
- const connection = await this.$start();
341
- // If any document is synced in full mode make sure we flush any pending
342
- // full document syncs.
343
- if (this._didChangeTextDocumentFeature.syncKind === vscode_languageserver_protocol_1.TextDocumentSyncKind.Full) {
344
- await this.sendPendingFullTextDocumentChanges(connection);
345
- }
346
- const _sendRequest = this._clientOptions.middleware?.sendRequest;
347
- if (_sendRequest !== undefined) {
348
- let param = undefined;
349
- let token = undefined;
350
- // Separate cancellation tokens from other parameters for a better client interface
351
- if (params.length === 1) {
352
- // CancellationToken is an interface, so we need to check if the first param complies to it
353
- if (vscode_languageserver_protocol_1.CancellationToken.is(params[0])) {
354
- token = params[0];
355
- }
356
- else {
357
- param = params[0];
358
- }
359
- }
360
- else if (params.length === 2) {
361
- param = params[0];
362
- token = params[1];
363
- }
364
- // Return the general middleware invocation defining `next` as a utility function that reorganizes parameters to
365
- // pass them to the original sendRequest function.
366
- return _sendRequest(type, param, token, (type, param, token) => {
367
- const params = [];
368
- // Add the parameters if there are any
369
- if (param !== undefined) {
370
- params.push(param);
371
- }
372
- // Add the cancellation token if there is one
373
- if (token !== undefined) {
374
- params.push(token);
375
- }
376
- return connection.sendRequest(type, ...params);
377
- });
378
- }
379
- else {
380
- return connection.sendRequest(type, ...params);
381
- }
382
- }
383
- onRequest(type, handler) {
384
- const method = typeof type === 'string' ? type : type.method;
385
- this._requestHandlers.set(method, handler);
386
- const connection = this.activeConnection();
387
- let disposable;
388
- if (connection !== undefined) {
389
- this._requestDisposables.set(method, connection.onRequest(type, handler));
390
- disposable = {
391
- dispose: () => {
392
- const disposable = this._requestDisposables.get(method);
393
- if (disposable !== undefined) {
394
- disposable.dispose();
395
- this._requestDisposables.delete(method);
396
- }
397
- }
398
- };
399
- }
400
- else {
401
- this._pendingRequestHandlers.set(method, handler);
402
- disposable = {
403
- dispose: () => {
404
- this._pendingRequestHandlers.delete(method);
405
- const disposable = this._requestDisposables.get(method);
406
- if (disposable !== undefined) {
407
- disposable.dispose();
408
- this._requestDisposables.delete(method);
409
- }
410
- }
411
- };
412
- }
413
- return {
414
- dispose: () => {
415
- this._requestHandlers.delete(method);
416
- disposable.dispose();
417
- }
418
- };
419
- }
420
- async sendNotification(type, params) {
421
- if (this.$state === ClientState.StartFailed || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped) {
422
- return Promise.reject(new vscode_languageserver_protocol_1.ResponseError(vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive, `Client is not running`));
423
- }
424
- const needsPendingFullTextDocumentSync = this._didChangeTextDocumentFeature.syncKind === vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;
425
- let openNotification;
426
- if (needsPendingFullTextDocumentSync && typeof type !== 'string' && type.method === vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.method) {
427
- openNotification = params?.textDocument.uri;
428
- this._pendingOpenNotifications.add(openNotification);
429
- }
430
- // Ensure we have a connection before we force the document sync.
431
- const connection = await this.$start();
432
- // If any document is synced in full mode make sure we flush any pending
433
- // full document syncs.
434
- if (needsPendingFullTextDocumentSync) {
435
- await this.sendPendingFullTextDocumentChanges(connection);
436
- }
437
- // We need to remove the pending open notification before we actually
438
- // send the notification over the connection. Otherwise there could be
439
- // a request coming in that although the open notification got already put
440
- // onto the wire will ignore pending document changes.
441
- //
442
- // Since the code path of connection.sendNotification is actually sync
443
- // until the message is handed of to the writer and the writer as a semaphore
444
- // lock with a capacity of 1 no additional async scheduling can happen until
445
- // the message is actually handed of.
446
- if (openNotification !== undefined) {
447
- this._pendingOpenNotifications.delete(openNotification);
448
- }
449
- const _sendNotification = this._clientOptions.middleware?.sendNotification;
450
- return _sendNotification
451
- ? _sendNotification(type, connection.sendNotification.bind(connection), params)
452
- : connection.sendNotification(type, params);
453
- }
454
- onNotification(type, handler) {
455
- const method = typeof type === 'string' ? type : type.method;
456
- this._notificationHandlers.set(method, handler);
457
- const connection = this.activeConnection();
458
- let disposable;
459
- if (connection !== undefined) {
460
- this._notificationDisposables.set(method, connection.onNotification(type, handler));
461
- disposable = {
462
- dispose: () => {
463
- const disposable = this._notificationDisposables.get(method);
464
- if (disposable !== undefined) {
465
- disposable.dispose();
466
- this._notificationDisposables.delete(method);
467
- }
468
- }
469
- };
470
- }
471
- else {
472
- this._pendingNotificationHandlers.set(method, handler);
473
- disposable = {
474
- dispose: () => {
475
- this._pendingNotificationHandlers.delete(method);
476
- const disposable = this._notificationDisposables.get(method);
477
- if (disposable !== undefined) {
478
- disposable.dispose();
479
- this._notificationDisposables.delete(method);
480
- }
481
- }
482
- };
483
- }
484
- return {
485
- dispose: () => {
486
- this._notificationHandlers.delete(method);
487
- disposable.dispose();
488
- }
489
- };
490
- }
491
- async sendProgress(type, token, value) {
492
- if (this.$state === ClientState.StartFailed || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped) {
493
- return Promise.reject(new vscode_languageserver_protocol_1.ResponseError(vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive, `Client is not running`));
494
- }
495
- try {
496
- // Ensure we have a connection before we force the document sync.
497
- const connection = await this.$start();
498
- return connection.sendProgress(type, token, value);
499
- }
500
- catch (error) {
501
- this.error(`Sending progress for token ${token} failed.`, error);
502
- throw error;
503
- }
504
- }
505
- onProgress(type, token, handler) {
506
- this._progressHandlers.set(token, { type, handler });
507
- const connection = this.activeConnection();
508
- let disposable;
509
- const handleWorkDoneProgress = this._clientOptions.middleware?.handleWorkDoneProgress;
510
- const realHandler = vscode_languageserver_protocol_1.WorkDoneProgress.is(type) && handleWorkDoneProgress !== undefined
511
- ? (params) => {
512
- handleWorkDoneProgress(token, params, () => handler(params));
513
- }
514
- : handler;
515
- if (connection !== undefined) {
516
- this._progressDisposables.set(token, connection.onProgress(type, token, realHandler));
517
- disposable = {
518
- dispose: () => {
519
- const disposable = this._progressDisposables.get(token);
520
- if (disposable !== undefined) {
521
- disposable.dispose();
522
- this._progressDisposables.delete(token);
523
- }
524
- }
525
- };
526
- }
527
- else {
528
- this._pendingProgressHandlers.set(token, { type, handler });
529
- disposable = {
530
- dispose: () => {
531
- this._pendingProgressHandlers.delete(token);
532
- const disposable = this._progressDisposables.get(token);
533
- if (disposable !== undefined) {
534
- disposable.dispose();
535
- this._progressDisposables.delete(token);
536
- }
537
- }
538
- };
539
- }
540
- return {
541
- dispose: () => {
542
- this._progressHandlers.delete(token);
543
- disposable.dispose();
544
- }
545
- };
546
- }
547
- createDefaultErrorHandler(maxRestartCount) {
548
- if (maxRestartCount !== undefined && maxRestartCount < 0) {
549
- throw new Error(`Invalid maxRestartCount: ${maxRestartCount}`);
550
- }
551
- return new DefaultErrorHandler(this, maxRestartCount ?? 4);
552
- }
553
- async setTrace(value) {
554
- this._trace = value;
555
- const connection = this.activeConnection();
556
- if (connection !== undefined) {
557
- await connection.trace(this._trace, this._tracer, {
558
- sendNotification: false,
559
- traceFormat: this._traceFormat
560
- });
561
- }
562
- }
563
- data2String(data) {
564
- if (data instanceof vscode_languageserver_protocol_1.ResponseError) {
565
- const responseError = data;
566
- return ` Message: ${responseError.message}\n Code: ${responseError.code} ${responseError.data ? '\n' + responseError.data.toString() : ''}`;
567
- }
568
- if (data instanceof Error) {
569
- if (Is.string(data.stack)) {
570
- return data.stack;
571
- }
572
- return data.message;
573
- }
574
- if (Is.string(data)) {
575
- return data;
576
- }
577
- return data.toString();
578
- }
579
- debug(message, data, showNotification = true) {
580
- this.logOutputMessage(vscode_languageserver_protocol_1.MessageType.Debug, RevealOutputChannelOn.Debug, 'Debug', message, data, showNotification);
581
- }
582
- info(message, data, showNotification = true) {
583
- this.logOutputMessage(vscode_languageserver_protocol_1.MessageType.Info, RevealOutputChannelOn.Info, 'Info', message, data, showNotification);
584
- }
585
- warn(message, data, showNotification = true) {
586
- this.logOutputMessage(vscode_languageserver_protocol_1.MessageType.Warning, RevealOutputChannelOn.Warn, 'Warn', message, data, showNotification);
587
- }
588
- error(message, data, showNotification = true) {
589
- this.logOutputMessage(vscode_languageserver_protocol_1.MessageType.Error, RevealOutputChannelOn.Error, 'Error', message, data, showNotification);
590
- }
591
- logOutputMessage(type, reveal, name, message, data, showNotification) {
592
- this.outputChannel.appendLine(`[${name.padEnd(5)} - ${(new Date().toLocaleTimeString())}] ${message}`);
593
- if (data !== null && data !== undefined) {
594
- this.outputChannel.appendLine(this.data2String(data));
595
- }
596
- if (showNotification === 'force' || (showNotification && this._clientOptions.revealOutputChannelOn <= reveal)) {
597
- this.showNotificationMessage(type, message);
598
- }
599
- }
600
- showNotificationMessage(type, message) {
601
- message = message ?? 'A request has failed. See the output for more information.';
602
- const messageFunc = type === vscode_languageserver_protocol_1.MessageType.Error
603
- ? vscode_1.window.showErrorMessage
604
- : type === vscode_languageserver_protocol_1.MessageType.Warning
605
- ? vscode_1.window.showWarningMessage
606
- : vscode_1.window.showInformationMessage;
607
- void messageFunc(message, 'Go to output').then((selection) => {
608
- if (selection !== undefined) {
609
- this.outputChannel.show(true);
610
- }
611
- });
612
- }
613
- logTrace(message, data) {
614
- this.traceOutputChannel.appendLine(`[Trace - ${(new Date().toLocaleTimeString())}] ${message}`);
615
- if (data) {
616
- this.traceOutputChannel.appendLine(this.data2String(data));
617
- }
618
- }
619
- logObjectTrace(data) {
620
- if (data.isLSPMessage && data.type) {
621
- this.traceOutputChannel.append(`[LSP - ${(new Date().toLocaleTimeString())}] `);
622
- }
623
- else {
624
- this.traceOutputChannel.append(`[Trace - ${(new Date().toLocaleTimeString())}] `);
625
- }
626
- if (data) {
627
- this.traceOutputChannel.appendLine(`${JSON.stringify(data)}`);
628
- }
629
- }
630
- needsStart() {
631
- return this.$state === ClientState.Initial || this.$state === ClientState.Stopping || this.$state === ClientState.Stopped;
632
- }
633
- needsStop() {
634
- return this.$state === ClientState.Starting || this.$state === ClientState.Running;
635
- }
636
- activeConnection() {
637
- return this.$state === ClientState.Running && this._connection !== undefined ? this._connection : undefined;
638
- }
639
- isRunning() {
640
- return this.$state === ClientState.Running;
641
- }
642
- async start() {
643
- if (this._disposed === 'disposing' || this._disposed === 'disposed') {
644
- throw new Error(`Client got disposed and can't be restarted.`);
645
- }
646
- if (this.$state === ClientState.Stopping) {
647
- throw new Error(`Client is currently stopping. Can only restart a full stopped client`);
648
- }
649
- // We are already running or are in the process of getting up
650
- // to speed.
651
- if (this._onStart !== undefined) {
652
- return this._onStart;
653
- }
654
- const [promise, resolve, reject] = this.createOnStartPromise();
655
- this._onStart = promise;
656
- // If we restart then the diagnostics collection is reused.
657
- if (this._diagnostics === undefined) {
658
- this._diagnostics = this._clientOptions.diagnosticCollectionName
659
- ? vscode_1.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName)
660
- : vscode_1.languages.createDiagnosticCollection();
661
- }
662
- // When we start make all buffer handlers pending so that they
663
- // get added.
664
- for (const [method, handler] of this._notificationHandlers) {
665
- if (!this._pendingNotificationHandlers.has(method)) {
666
- this._pendingNotificationHandlers.set(method, handler);
667
- }
668
- }
669
- for (const [method, handler] of this._requestHandlers) {
670
- if (!this._pendingRequestHandlers.has(method)) {
671
- this._pendingRequestHandlers.set(method, handler);
672
- }
673
- }
674
- for (const [token, data] of this._progressHandlers) {
675
- if (!this._pendingProgressHandlers.has(token)) {
676
- this._pendingProgressHandlers.set(token, data);
677
- }
678
- }
679
- this.$state = ClientState.Starting;
680
- try {
681
- const connection = await this.createConnection();
682
- connection.onNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, (message) => {
683
- switch (message.type) {
684
- case vscode_languageserver_protocol_1.MessageType.Error:
685
- this.error(message.message, undefined, false);
686
- break;
687
- case vscode_languageserver_protocol_1.MessageType.Warning:
688
- this.warn(message.message, undefined, false);
689
- break;
690
- case vscode_languageserver_protocol_1.MessageType.Info:
691
- this.info(message.message, undefined, false);
692
- break;
693
- case vscode_languageserver_protocol_1.MessageType.Debug:
694
- this.debug(message.message, undefined, false);
695
- break;
696
- default:
697
- this.outputChannel.appendLine(message.message);
698
- }
699
- });
700
- connection.onNotification(vscode_languageserver_protocol_1.ShowMessageNotification.type, (message) => {
701
- switch (message.type) {
702
- case vscode_languageserver_protocol_1.MessageType.Error:
703
- void vscode_1.window.showErrorMessage(message.message);
704
- break;
705
- case vscode_languageserver_protocol_1.MessageType.Warning:
706
- void vscode_1.window.showWarningMessage(message.message);
707
- break;
708
- case vscode_languageserver_protocol_1.MessageType.Info:
709
- void vscode_1.window.showInformationMessage(message.message);
710
- break;
711
- default:
712
- void vscode_1.window.showInformationMessage(message.message);
713
- }
714
- });
715
- connection.onRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, (params) => {
716
- let messageFunc;
717
- switch (params.type) {
718
- case vscode_languageserver_protocol_1.MessageType.Error:
719
- messageFunc = vscode_1.window.showErrorMessage;
720
- break;
721
- case vscode_languageserver_protocol_1.MessageType.Warning:
722
- messageFunc = vscode_1.window.showWarningMessage;
723
- break;
724
- case vscode_languageserver_protocol_1.MessageType.Info:
725
- messageFunc = vscode_1.window.showInformationMessage;
726
- break;
727
- default:
728
- messageFunc = vscode_1.window.showInformationMessage;
729
- }
730
- let actions = params.actions || [];
731
- return messageFunc(params.message, ...actions);
732
- });
733
- connection.onNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, (data) => {
734
- this._telemetryEmitter.fire(data);
735
- });
736
- connection.onRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, async (params) => {
737
- const showDocument = async (params) => {
738
- const uri = this.protocol2CodeConverter.asUri(params.uri);
739
- try {
740
- if (params.external === true) {
741
- const success = await vscode_1.env.openExternal(uri);
742
- return { success };
743
- }
744
- else {
745
- const options = {};
746
- if (params.selection !== undefined) {
747
- options.selection = this.protocol2CodeConverter.asRange(params.selection);
748
- }
749
- if (params.takeFocus === undefined || params.takeFocus === false) {
750
- options.preserveFocus = true;
751
- }
752
- else if (params.takeFocus === true) {
753
- options.preserveFocus = false;
754
- }
755
- await vscode_1.window.showTextDocument(uri, options);
756
- return { success: true };
757
- }
758
- }
759
- catch (error) {
760
- return { success: false };
761
- }
762
- };
763
- const middleware = this._clientOptions.middleware.window?.showDocument;
764
- if (middleware !== undefined) {
765
- return middleware(params, showDocument);
766
- }
767
- else {
768
- return showDocument(params);
769
- }
770
- });
771
- connection.listen();
772
- await this.initialize(connection);
773
- resolve();
774
- }
775
- catch (error) {
776
- this.$state = ClientState.StartFailed;
777
- this.error(`${this._name} client: couldn't create connection to server.`, error, 'force');
778
- reject(error);
779
- }
780
- return this._onStart;
781
- }
782
- createOnStartPromise() {
783
- let resolve;
784
- let reject;
785
- const promise = new Promise((_resolve, _reject) => {
786
- resolve = _resolve;
787
- reject = _reject;
788
- });
789
- return [promise, resolve, reject];
790
- }
791
- async initialize(connection) {
792
- this.refreshTrace(connection, false);
793
- const initOption = this._clientOptions.initializationOptions;
794
- // If the client is locked to a workspace folder use it. In this case the workspace folder
795
- // feature is not registered and we need to initialize the value here.
796
- const [rootPath, workspaceFolders] = this._clientOptions.workspaceFolder !== undefined
797
- ? [this._clientOptions.workspaceFolder.uri.fsPath, [{ uri: this._c2p.asUri(this._clientOptions.workspaceFolder.uri), name: this._clientOptions.workspaceFolder.name }]]
798
- : [this._clientGetRootPath(), null];
799
- const initParams = {
800
- processId: null,
801
- clientInfo: {
802
- name: vscode_1.env.appName,
803
- version: vscode_1.version
804
- },
805
- locale: this.getLocale(),
806
- rootPath: rootPath ? rootPath : null,
807
- rootUri: rootPath ? this._c2p.asUri(vscode_1.Uri.file(rootPath)) : null,
808
- capabilities: this.computeClientCapabilities(),
809
- initializationOptions: Is.func(initOption) ? initOption() : initOption,
810
- trace: vscode_languageserver_protocol_1.Trace.toString(this._trace),
811
- workspaceFolders: workspaceFolders
812
- };
813
- this.fillInitializeParams(initParams);
814
- if (this._clientOptions.progressOnInitialization) {
815
- const token = UUID.generateUuid();
816
- const part = new progressPart_1.ProgressPart(connection, token);
817
- initParams.workDoneToken = token;
818
- try {
819
- const result = await this.doInitialize(connection, initParams);
820
- part.done();
821
- return result;
822
- }
823
- catch (error) {
824
- part.cancel();
825
- throw error;
826
- }
827
- }
828
- else {
829
- return this.doInitialize(connection, initParams);
830
- }
831
- }
832
- async doInitialize(connection, initParams) {
833
- try {
834
- const result = await connection.initialize(initParams);
835
- if (result.capabilities.positionEncoding !== undefined && result.capabilities.positionEncoding !== vscode_languageserver_protocol_1.PositionEncodingKind.UTF16) {
836
- throw new Error(`Unsupported position encoding (${result.capabilities.positionEncoding}) received from server ${this.name}`);
837
- }
838
- this._initializeResult = result;
839
- this.$state = ClientState.Running;
840
- let textDocumentSyncOptions = undefined;
841
- if (Is.number(result.capabilities.textDocumentSync)) {
842
- if (result.capabilities.textDocumentSync === vscode_languageserver_protocol_1.TextDocumentSyncKind.None) {
843
- textDocumentSyncOptions = {
844
- openClose: false,
845
- change: vscode_languageserver_protocol_1.TextDocumentSyncKind.None,
846
- save: undefined
847
- };
848
- }
849
- else {
850
- textDocumentSyncOptions = {
851
- openClose: true,
852
- change: result.capabilities.textDocumentSync,
853
- save: {
854
- includeText: false
855
- }
856
- };
857
- }
858
- }
859
- else if (result.capabilities.textDocumentSync !== undefined && result.capabilities.textDocumentSync !== null) {
860
- textDocumentSyncOptions = result.capabilities.textDocumentSync;
861
- }
862
- this._capabilities = Object.assign({}, result.capabilities, { resolvedTextDocumentSync: textDocumentSyncOptions });
863
- connection.onNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params => this.handleDiagnostics(params));
864
- connection.onRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params => this.handleRegistrationRequest(params));
865
- // See https://github.com/Microsoft/vscode-languageserver-node/issues/199
866
- connection.onRequest('client/registerFeature', params => this.handleRegistrationRequest(params));
867
- connection.onRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params => this.handleUnregistrationRequest(params));
868
- // See https://github.com/Microsoft/vscode-languageserver-node/issues/199
869
- connection.onRequest('client/unregisterFeature', params => this.handleUnregistrationRequest(params));
870
- connection.onRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params => this.handleApplyWorkspaceEdit(params));
871
- // Add pending notification, request and progress handlers.
872
- for (const [method, handler] of this._pendingNotificationHandlers) {
873
- this._notificationDisposables.set(method, connection.onNotification(method, handler));
874
- }
875
- this._pendingNotificationHandlers.clear();
876
- for (const [method, handler] of this._pendingRequestHandlers) {
877
- this._requestDisposables.set(method, connection.onRequest(method, handler));
878
- }
879
- this._pendingRequestHandlers.clear();
880
- for (const [token, data] of this._pendingProgressHandlers) {
881
- this._progressDisposables.set(token, connection.onProgress(data.type, token, data.handler));
882
- }
883
- this._pendingProgressHandlers.clear();
884
- // if (this._clientOptions.suspend.mode !== SuspendMode.off) {
885
- // this._idleInterval = RAL().timer.setInterval(() => this.checkSuspend(), this._clientOptions.suspend.interval);
886
- // }
887
- await connection.sendNotification(vscode_languageserver_protocol_1.InitializedNotification.type, {});
888
- this.hookFileEvents(connection);
889
- this.hookConfigurationChanged(connection);
890
- this.initializeFeatures(connection);
891
- return result;
892
- }
893
- catch (error) {
894
- if (this._clientOptions.initializationFailedHandler) {
895
- if (this._clientOptions.initializationFailedHandler(error)) {
896
- void this.initialize(connection);
897
- }
898
- else {
899
- void this.stop();
900
- }
901
- }
902
- else if (error instanceof vscode_languageserver_protocol_1.ResponseError && error.data && error.data.retry) {
903
- void vscode_1.window.showErrorMessage(error.message, { title: 'Retry', id: 'retry' }).then(item => {
904
- if (item && item.id === 'retry') {
905
- void this.initialize(connection);
906
- }
907
- else {
908
- void this.stop();
909
- }
910
- });
911
- }
912
- else {
913
- if (error && error.message) {
914
- void vscode_1.window.showErrorMessage(error.message);
915
- }
916
- this.error('Server initialization failed.', error);
917
- void this.stop();
918
- }
919
- throw error;
920
- }
921
- }
922
- _clientGetRootPath() {
923
- let folders = vscode_1.workspace.workspaceFolders;
924
- if (!folders || folders.length === 0) {
925
- return undefined;
926
- }
927
- let folder = folders[0];
928
- if (folder.uri.scheme === 'file') {
929
- return folder.uri.fsPath;
930
- }
931
- return undefined;
932
- }
933
- stop(timeout = 2000) {
934
- // Wait 2 seconds on stop
935
- return this.shutdown('stop', timeout);
936
- }
937
- dispose(timeout = 2000) {
938
- try {
939
- this._disposed = 'disposing';
940
- return this.stop(timeout);
941
- }
942
- finally {
943
- this._disposed = 'disposed';
944
- }
945
- }
946
- async shutdown(mode, timeout) {
947
- // If the client is stopped or in its initial state return.
948
- if (this.$state === ClientState.Stopped || this.$state === ClientState.Initial) {
949
- return;
950
- }
951
- // If we are stopping the client and have a stop promise return it.
952
- if (this.$state === ClientState.Stopping) {
953
- if (this._onStop !== undefined) {
954
- return this._onStop;
955
- }
956
- else {
957
- throw new Error(`Client is stopping but no stop promise available.`);
958
- }
959
- }
960
- const connection = this.activeConnection();
961
- // We can't stop a client that is not running (e.g. has no connection). Especially not
962
- // on that us starting since it can't be correctly synchronized.
963
- if (connection === undefined || this.$state !== ClientState.Running) {
964
- throw new Error(`Client is not running and can't be stopped. It's current state is: ${this.$state}`);
965
- }
966
- this._initializeResult = undefined;
967
- this.$state = ClientState.Stopping;
968
- this.cleanUp(mode);
969
- const tp = new Promise(c => { (0, vscode_languageserver_protocol_1.RAL)().timer.setTimeout(c, timeout); });
970
- const shutdown = (async (connection) => {
971
- await connection.shutdown();
972
- await connection.exit();
973
- return connection;
974
- })(connection);
975
- return this._onStop = Promise.race([tp, shutdown]).then((connection) => {
976
- // The connection won the race with the timeout.
977
- if (connection !== undefined) {
978
- connection.end();
979
- connection.dispose();
980
- }
981
- else {
982
- this.error(`Stopping server timed out`, undefined, false);
983
- throw new Error(`Stopping the server timed out`);
984
- }
985
- }, (error) => {
986
- this.error(`Stopping server failed`, error, false);
987
- throw error;
988
- }).finally(() => {
989
- this.$state = ClientState.Stopped;
990
- mode === 'stop' && this.cleanUpChannel();
991
- this._onStart = undefined;
992
- this._onStop = undefined;
993
- this._connection = undefined;
994
- this._ignoredRegistrations.clear();
995
- });
996
- }
997
- cleanUp(mode) {
998
- // purge outstanding file events.
999
- this._fileEvents = [];
1000
- this._fileEventDelayer.cancel();
1001
- const disposables = this._listeners.splice(0, this._listeners.length);
1002
- for (const disposable of disposables) {
1003
- disposable.dispose();
1004
- }
1005
- if (this._syncedDocuments) {
1006
- this._syncedDocuments.clear();
1007
- }
1008
- // Clear features in reverse order;
1009
- for (const feature of Array.from(this._features.entries()).map(entry => entry[1]).reverse()) {
1010
- feature.clear();
1011
- }
1012
- if (mode === 'stop' && this._diagnostics !== undefined) {
1013
- this._diagnostics.dispose();
1014
- this._diagnostics = undefined;
1015
- }
1016
- if (this._idleInterval !== undefined) {
1017
- this._idleInterval.dispose();
1018
- this._idleInterval = undefined;
1019
- }
1020
- // this._idleStart = undefined;
1021
- }
1022
- cleanUpChannel() {
1023
- if (this._outputChannel !== undefined && this._disposeOutputChannel) {
1024
- this._outputChannel.dispose();
1025
- this._outputChannel = undefined;
1026
- }
1027
- }
1028
- notifyFileEvent(event) {
1029
- const client = this;
1030
- async function didChangeWatchedFile(event) {
1031
- client._fileEvents.push(event);
1032
- return client._fileEventDelayer.trigger(async () => {
1033
- await client.sendNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, { changes: client._fileEvents });
1034
- client._fileEvents = [];
1035
- });
1036
- }
1037
- const workSpaceMiddleware = this.clientOptions.middleware?.workspace;
1038
- (workSpaceMiddleware?.didChangeWatchedFile ? workSpaceMiddleware.didChangeWatchedFile(event, didChangeWatchedFile) : didChangeWatchedFile(event)).catch((error) => {
1039
- client.error(`Notify file events failed.`, error);
1040
- });
1041
- }
1042
- async sendPendingFullTextDocumentChanges(connection) {
1043
- return this._pendingChangeSemaphore.lock(async () => {
1044
- try {
1045
- const changes = this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._pendingOpenNotifications);
1046
- if (changes.length === 0) {
1047
- return;
1048
- }
1049
- for (const document of changes) {
1050
- const params = this.code2ProtocolConverter.asChangeTextDocumentParams(document);
1051
- // We await the send and not the delivery since it is more or less the same for
1052
- // notifications.
1053
- await connection.sendNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, params);
1054
- this._didChangeTextDocumentFeature.notificationSent(document, vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, params);
1055
- }
1056
- }
1057
- catch (error) {
1058
- this.error(`Sending pending changes failed`, error, false);
1059
- throw error;
1060
- }
1061
- });
1062
- }
1063
- triggerPendingChangeDelivery() {
1064
- this._pendingChangeDelayer.trigger(async () => {
1065
- const connection = this.activeConnection();
1066
- if (connection === undefined) {
1067
- this.triggerPendingChangeDelivery();
1068
- return;
1069
- }
1070
- await this.sendPendingFullTextDocumentChanges(connection);
1071
- }).catch((error) => this.error(`Delivering pending changes failed`, error, false));
1072
- }
1073
- handleDiagnostics(params) {
1074
- if (!this._diagnostics) {
1075
- return;
1076
- }
1077
- const key = params.uri;
1078
- if (this._diagnosticQueueState.state === 'busy' && this._diagnosticQueueState.document === key) {
1079
- // Cancel the active run;
1080
- this._diagnosticQueueState.tokenSource.cancel();
1081
- }
1082
- this._diagnosticQueue.set(params.uri, params.diagnostics);
1083
- this.triggerDiagnosticQueue();
1084
- }
1085
- triggerDiagnosticQueue() {
1086
- (0, vscode_languageserver_protocol_1.RAL)().timer.setImmediate(() => { this.workDiagnosticQueue(); });
1087
- }
1088
- workDiagnosticQueue() {
1089
- if (this._diagnosticQueueState.state === 'busy') {
1090
- return;
1091
- }
1092
- const next = this._diagnosticQueue.entries().next();
1093
- if (next.done === true) {
1094
- // Nothing in the queue
1095
- return;
1096
- }
1097
- const [document, diagnostics] = next.value;
1098
- this._diagnosticQueue.delete(document);
1099
- const tokenSource = new vscode_1.CancellationTokenSource();
1100
- this._diagnosticQueueState = { state: 'busy', document: document, tokenSource };
1101
- this._p2c.asDiagnostics(diagnostics, tokenSource.token).then((converted) => {
1102
- if (!tokenSource.token.isCancellationRequested) {
1103
- const uri = this._p2c.asUri(document);
1104
- const middleware = this.clientOptions.middleware;
1105
- if (middleware.handleDiagnostics) {
1106
- middleware.handleDiagnostics(uri, converted, (uri, diagnostics) => this.setDiagnostics(uri, diagnostics));
1107
- }
1108
- else {
1109
- this.setDiagnostics(uri, converted);
1110
- }
1111
- }
1112
- }).finally(() => {
1113
- this._diagnosticQueueState = { state: 'idle' };
1114
- this.triggerDiagnosticQueue();
1115
- });
1116
- }
1117
- setDiagnostics(uri, diagnostics) {
1118
- if (!this._diagnostics) {
1119
- return;
1120
- }
1121
- this._diagnostics.set(uri, diagnostics);
1122
- }
1123
- getLocale() {
1124
- return vscode_1.env.language;
1125
- }
1126
- async $start() {
1127
- if (this.$state === ClientState.StartFailed) {
1128
- throw new Error(`Previous start failed. Can't restart server.`);
1129
- }
1130
- await this.start();
1131
- const connection = this.activeConnection();
1132
- if (connection === undefined) {
1133
- throw new Error(`Starting server failed`);
1134
- }
1135
- return connection;
1136
- }
1137
- async createConnection() {
1138
- let errorHandler = (error, message, count) => {
1139
- this.handleConnectionError(error, message, count).catch((error) => this.error(`Handling connection error failed`, error));
1140
- };
1141
- let closeHandler = () => {
1142
- this.handleConnectionClosed().catch((error) => this.error(`Handling connection close failed`, error));
1143
- };
1144
- const transports = await this.createMessageTransports(this._clientOptions.stdioEncoding || 'utf8');
1145
- this._connection = createConnection(transports.reader, transports.writer, errorHandler, closeHandler, this._clientOptions.connectionOptions);
1146
- return this._connection;
1147
- }
1148
- async handleConnectionClosed() {
1149
- // Check whether this is a normal shutdown in progress or the client stopped normally.
1150
- if (this.$state === ClientState.Stopped) {
1151
- return;
1152
- }
1153
- try {
1154
- if (this._connection !== undefined) {
1155
- this._connection.dispose();
1156
- }
1157
- }
1158
- catch (error) {
1159
- // Disposing a connection could fail if error cases.
1160
- }
1161
- let handlerResult = { action: CloseAction.DoNotRestart };
1162
- if (this.$state !== ClientState.Stopping) {
1163
- try {
1164
- handlerResult = await this._clientOptions.errorHandler.closed();
1165
- }
1166
- catch (error) {
1167
- // Ignore errors coming from the error handler.
1168
- }
1169
- }
1170
- this._connection = undefined;
1171
- if (handlerResult.action === CloseAction.DoNotRestart) {
1172
- this.error(handlerResult.message ?? 'Connection to server got closed. Server will not be restarted.', undefined, handlerResult.handled === true ? false : 'force');
1173
- this.cleanUp('stop');
1174
- if (this.$state === ClientState.Starting) {
1175
- this.$state = ClientState.StartFailed;
1176
- }
1177
- else {
1178
- this.$state = ClientState.Stopped;
1179
- }
1180
- this._onStop = Promise.resolve();
1181
- this._onStart = undefined;
1182
- }
1183
- else if (handlerResult.action === CloseAction.Restart) {
1184
- this.info(handlerResult.message ?? 'Connection to server got closed. Server will restart.', !handlerResult.handled);
1185
- this.cleanUp('restart');
1186
- this.$state = ClientState.Initial;
1187
- this._onStop = Promise.resolve();
1188
- this._onStart = undefined;
1189
- this.start().catch((error) => this.error(`Restarting server failed`, error, 'force'));
1190
- }
1191
- }
1192
- async handleConnectionError(error, message, count) {
1193
- const handlerResult = await this._clientOptions.errorHandler.error(error, message, count);
1194
- if (handlerResult.action === ErrorAction.Shutdown) {
1195
- this.error(handlerResult.message ?? `Client ${this._name}: connection to server is erroring.\n${error.message}\nShutting down server.`, undefined, handlerResult.handled === true ? false : 'force');
1196
- this.stop().catch((error) => {
1197
- this.error(`Stopping server failed`, error, false);
1198
- });
1199
- }
1200
- else {
1201
- this.error(handlerResult.message ??
1202
- `Client ${this._name}: connection to server is erroring.\n${error.message}`, undefined, handlerResult.handled === true ? false : 'force');
1203
- }
1204
- }
1205
- hookConfigurationChanged(connection) {
1206
- this._listeners.push(vscode_1.workspace.onDidChangeConfiguration(() => {
1207
- this.refreshTrace(connection, true);
1208
- }));
1209
- }
1210
- refreshTrace(connection, sendNotification = false) {
1211
- const config = vscode_1.workspace.getConfiguration(this._id);
1212
- let trace = vscode_languageserver_protocol_1.Trace.Off;
1213
- let traceFormat = vscode_languageserver_protocol_1.TraceFormat.Text;
1214
- if (config) {
1215
- const traceConfig = config.get('trace.server', 'off');
1216
- if (typeof traceConfig === 'string') {
1217
- trace = vscode_languageserver_protocol_1.Trace.fromString(traceConfig);
1218
- }
1219
- else {
1220
- trace = vscode_languageserver_protocol_1.Trace.fromString(config.get('trace.server.verbosity', 'off'));
1221
- traceFormat = vscode_languageserver_protocol_1.TraceFormat.fromString(config.get('trace.server.format', 'text'));
1222
- }
1223
- }
1224
- this._trace = trace;
1225
- this._traceFormat = traceFormat;
1226
- connection.trace(this._trace, this._tracer, {
1227
- sendNotification,
1228
- traceFormat: this._traceFormat
1229
- }).catch((error) => { this.error(`Updating trace failed with error`, error, false); });
1230
- }
1231
- hookFileEvents(_connection) {
1232
- let fileEvents = this._clientOptions.synchronize.fileEvents;
1233
- if (!fileEvents) {
1234
- return;
1235
- }
1236
- let watchers;
1237
- if (Is.array(fileEvents)) {
1238
- watchers = fileEvents;
1239
- }
1240
- else {
1241
- watchers = [fileEvents];
1242
- }
1243
- if (!watchers) {
1244
- return;
1245
- }
1246
- this._dynamicFeatures.get(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type.method).registerRaw(UUID.generateUuid(), watchers);
1247
- }
1248
- registerFeatures(features) {
1249
- for (let feature of features) {
1250
- this.registerFeature(feature);
1251
- }
1252
- }
1253
- registerFeature(feature) {
1254
- this._features.push(feature);
1255
- if (features_1.DynamicFeature.is(feature)) {
1256
- const registrationType = feature.registrationType;
1257
- this._dynamicFeatures.set(registrationType.method, feature);
1258
- }
1259
- }
1260
- getFeature(request) {
1261
- return this._dynamicFeatures.get(request);
1262
- }
1263
- hasDedicatedTextSynchronizationFeature(textDocument) {
1264
- const feature = this.getFeature(vscode_languageserver_protocol_1.NotebookDocumentSyncRegistrationType.method);
1265
- if (feature === undefined || !(feature instanceof notebook_1.NotebookDocumentSyncFeature)) {
1266
- return false;
1267
- }
1268
- return feature.handles(textDocument);
1269
- }
1270
- registerBuiltinFeatures() {
1271
- const pendingFullTextDocumentChanges = new Map();
1272
- this.registerFeature(new configuration_1.ConfigurationFeature(this));
1273
- this.registerFeature(new textSynchronization_1.DidOpenTextDocumentFeature(this, this._syncedDocuments));
1274
- this._didChangeTextDocumentFeature = new textSynchronization_1.DidChangeTextDocumentFeature(this, pendingFullTextDocumentChanges);
1275
- this._didChangeTextDocumentFeature.onPendingChangeAdded(() => {
1276
- this.triggerPendingChangeDelivery();
1277
- });
1278
- this.registerFeature(this._didChangeTextDocumentFeature);
1279
- this.registerFeature(new textSynchronization_1.WillSaveFeature(this));
1280
- this.registerFeature(new textSynchronization_1.WillSaveWaitUntilFeature(this));
1281
- this.registerFeature(new textSynchronization_1.DidSaveTextDocumentFeature(this));
1282
- this.registerFeature(new textSynchronization_1.DidCloseTextDocumentFeature(this, this._syncedDocuments, pendingFullTextDocumentChanges));
1283
- this.registerFeature(new fileSystemWatcher_1.FileSystemWatcherFeature(this, (event) => this.notifyFileEvent(event)));
1284
- this.registerFeature(new completion_1.CompletionItemFeature(this));
1285
- this.registerFeature(new hover_1.HoverFeature(this));
1286
- this.registerFeature(new signatureHelp_1.SignatureHelpFeature(this));
1287
- this.registerFeature(new definition_1.DefinitionFeature(this));
1288
- this.registerFeature(new reference_1.ReferencesFeature(this));
1289
- this.registerFeature(new documentHighlight_1.DocumentHighlightFeature(this));
1290
- this.registerFeature(new documentSymbol_1.DocumentSymbolFeature(this));
1291
- this.registerFeature(new workspaceSymbol_1.WorkspaceSymbolFeature(this));
1292
- this.registerFeature(new codeAction_1.CodeActionFeature(this));
1293
- this.registerFeature(new codeLens_1.CodeLensFeature(this));
1294
- this.registerFeature(new formatting_1.DocumentFormattingFeature(this));
1295
- this.registerFeature(new formatting_1.DocumentRangeFormattingFeature(this));
1296
- this.registerFeature(new formatting_1.DocumentOnTypeFormattingFeature(this));
1297
- this.registerFeature(new rename_1.RenameFeature(this));
1298
- this.registerFeature(new documentLink_1.DocumentLinkFeature(this));
1299
- this.registerFeature(new executeCommand_1.ExecuteCommandFeature(this));
1300
- this.registerFeature(new configuration_1.SyncConfigurationFeature(this));
1301
- this.registerFeature(new typeDefinition_1.TypeDefinitionFeature(this));
1302
- this.registerFeature(new implementation_1.ImplementationFeature(this));
1303
- this.registerFeature(new colorProvider_1.ColorProviderFeature(this));
1304
- // We only register the workspace folder feature if the client is not locked
1305
- // to a specific workspace folder.
1306
- if (this.clientOptions.workspaceFolder === undefined) {
1307
- this.registerFeature(new workspaceFolder_1.WorkspaceFoldersFeature(this));
1308
- }
1309
- this.registerFeature(new foldingRange_1.FoldingRangeFeature(this));
1310
- this.registerFeature(new declaration_1.DeclarationFeature(this));
1311
- this.registerFeature(new selectionRange_1.SelectionRangeFeature(this));
1312
- this.registerFeature(new progress_1.ProgressFeature(this));
1313
- this.registerFeature(new callHierarchy_1.CallHierarchyFeature(this));
1314
- this.registerFeature(new semanticTokens_1.SemanticTokensFeature(this));
1315
- this.registerFeature(new linkedEditingRange_1.LinkedEditingFeature(this));
1316
- this.registerFeature(new fileOperations_1.DidCreateFilesFeature(this));
1317
- this.registerFeature(new fileOperations_1.DidRenameFilesFeature(this));
1318
- this.registerFeature(new fileOperations_1.DidDeleteFilesFeature(this));
1319
- this.registerFeature(new fileOperations_1.WillCreateFilesFeature(this));
1320
- this.registerFeature(new fileOperations_1.WillRenameFilesFeature(this));
1321
- this.registerFeature(new fileOperations_1.WillDeleteFilesFeature(this));
1322
- this.registerFeature(new typeHierarchy_1.TypeHierarchyFeature(this));
1323
- this.registerFeature(new inlineValue_1.InlineValueFeature(this));
1324
- this.registerFeature(new inlayHint_1.InlayHintsFeature(this));
1325
- this.registerFeature(new diagnostic_1.DiagnosticFeature(this));
1326
- this.registerFeature(new notebook_1.NotebookDocumentSyncFeature(this));
1327
- }
1328
- registerProposedFeatures() {
1329
- this.registerFeatures(ProposedFeatures.createAll(this));
1330
- }
1331
- fillInitializeParams(params) {
1332
- for (let feature of this._features) {
1333
- if (Is.func(feature.fillInitializeParams)) {
1334
- feature.fillInitializeParams(params);
1335
- }
1336
- }
1337
- }
1338
- computeClientCapabilities() {
1339
- const result = {};
1340
- (0, features_1.ensure)(result, 'workspace').applyEdit = true;
1341
- const workspaceEdit = (0, features_1.ensure)((0, features_1.ensure)(result, 'workspace'), 'workspaceEdit');
1342
- workspaceEdit.documentChanges = true;
1343
- workspaceEdit.resourceOperations = [vscode_languageserver_protocol_1.ResourceOperationKind.Create, vscode_languageserver_protocol_1.ResourceOperationKind.Rename, vscode_languageserver_protocol_1.ResourceOperationKind.Delete];
1344
- workspaceEdit.failureHandling = vscode_languageserver_protocol_1.FailureHandlingKind.TextOnlyTransactional;
1345
- workspaceEdit.normalizesLineEndings = true;
1346
- workspaceEdit.changeAnnotationSupport = {
1347
- groupsOnLabel: true
1348
- };
1349
- const diagnostics = (0, features_1.ensure)((0, features_1.ensure)(result, 'textDocument'), 'publishDiagnostics');
1350
- diagnostics.relatedInformation = true;
1351
- diagnostics.versionSupport = false;
1352
- diagnostics.tagSupport = { valueSet: [vscode_languageserver_protocol_1.DiagnosticTag.Unnecessary, vscode_languageserver_protocol_1.DiagnosticTag.Deprecated] };
1353
- diagnostics.codeDescriptionSupport = true;
1354
- diagnostics.dataSupport = true;
1355
- const windowCapabilities = (0, features_1.ensure)(result, 'window');
1356
- const showMessage = (0, features_1.ensure)(windowCapabilities, 'showMessage');
1357
- showMessage.messageActionItem = { additionalPropertiesSupport: true };
1358
- const showDocument = (0, features_1.ensure)(windowCapabilities, 'showDocument');
1359
- showDocument.support = true;
1360
- const generalCapabilities = (0, features_1.ensure)(result, 'general');
1361
- generalCapabilities.staleRequestSupport = {
1362
- cancel: true,
1363
- retryOnContentModified: Array.from(BaseLanguageClient.RequestsToCancelOnContentModified)
1364
- };
1365
- generalCapabilities.regularExpressions = { engine: 'ECMAScript', version: 'ES2020' };
1366
- generalCapabilities.markdown = {
1367
- parser: 'marked',
1368
- version: '1.1.0',
1369
- };
1370
- generalCapabilities.positionEncodings = ['utf-16'];
1371
- if (this._clientOptions.markdown.supportHtml) {
1372
- generalCapabilities.markdown.allowedTags = ['ul', 'li', 'p', 'code', 'blockquote', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'em', 'pre', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'div', 'del', 'a', 'strong', 'br', 'img', 'span'];
1373
- }
1374
- for (let feature of this._features) {
1375
- feature.fillClientCapabilities(result);
1376
- }
1377
- return result;
1378
- }
1379
- initializeFeatures(_connection) {
1380
- const documentSelector = this._clientOptions.documentSelector;
1381
- for (const feature of this._features) {
1382
- if (Is.func(feature.preInitialize)) {
1383
- feature.preInitialize(this._capabilities, documentSelector);
1384
- }
1385
- }
1386
- for (const feature of this._features) {
1387
- feature.initialize(this._capabilities, documentSelector);
1388
- }
1389
- }
1390
- async handleRegistrationRequest(params) {
1391
- const middleware = this.clientOptions.middleware?.handleRegisterCapability;
1392
- if (middleware) {
1393
- return middleware(params, nextParams => this.doRegisterCapability(nextParams));
1394
- }
1395
- else {
1396
- return this.doRegisterCapability(params);
1397
- }
1398
- }
1399
- async doRegisterCapability(params) {
1400
- // We will not receive a registration call before a client is running
1401
- // from a server. However if we stop or shutdown we might which might
1402
- // try to restart the server. So ignore registrations if we are not running
1403
- if (!this.isRunning()) {
1404
- for (const registration of params.registrations) {
1405
- this._ignoredRegistrations.add(registration.id);
1406
- }
1407
- return;
1408
- }
1409
- for (const registration of params.registrations) {
1410
- const feature = this._dynamicFeatures.get(registration.method);
1411
- if (feature === undefined) {
1412
- return Promise.reject(new Error(`No feature implementation for ${registration.method} found. Registration failed.`));
1413
- }
1414
- const options = registration.registerOptions ?? {};
1415
- options.documentSelector = options.documentSelector ?? this._clientOptions.documentSelector;
1416
- const data = {
1417
- id: registration.id,
1418
- registerOptions: options
1419
- };
1420
- try {
1421
- feature.register(data);
1422
- }
1423
- catch (err) {
1424
- return Promise.reject(err);
1425
- }
1426
- }
1427
- }
1428
- async handleUnregistrationRequest(params) {
1429
- const middleware = this.clientOptions.middleware?.handleUnregisterCapability;
1430
- if (middleware) {
1431
- return middleware(params, nextParams => this.doUnregisterCapability(nextParams));
1432
- }
1433
- else {
1434
- return this.doUnregisterCapability(params);
1435
- }
1436
- }
1437
- async doUnregisterCapability(params) {
1438
- for (const unregistration of params.unregisterations) {
1439
- if (this._ignoredRegistrations.has(unregistration.id)) {
1440
- continue;
1441
- }
1442
- const feature = this._dynamicFeatures.get(unregistration.method);
1443
- if (!feature) {
1444
- return Promise.reject(new Error(`No feature implementation for ${unregistration.method} found. Unregistration failed.`));
1445
- }
1446
- feature.unregister(unregistration.id);
1447
- }
1448
- }
1449
- async handleApplyWorkspaceEdit(params) {
1450
- const workspaceEdit = params.edit;
1451
- // Make sure we convert workspace edits one after the other. Otherwise
1452
- // we might execute a workspace edit received first after we received another
1453
- // one since the conversion might race.
1454
- const converted = await this.workspaceEditLock.lock(() => {
1455
- return this._p2c.asWorkspaceEdit(workspaceEdit);
1456
- });
1457
- // This is some sort of workaround since the version check should be done by VS Code in the Workspace.applyEdit.
1458
- // However doing it here adds some safety since the server can lag more behind then an extension.
1459
- const openTextDocuments = new Map();
1460
- vscode_1.workspace.textDocuments.forEach((document) => openTextDocuments.set(document.uri.toString(), document));
1461
- let versionMismatch = false;
1462
- if (workspaceEdit.documentChanges) {
1463
- for (const change of workspaceEdit.documentChanges) {
1464
- if (vscode_languageserver_protocol_1.TextDocumentEdit.is(change) && change.textDocument.version && change.textDocument.version >= 0) {
1465
- const changeUri = this._p2c.asUri(change.textDocument.uri).toString();
1466
- const textDocument = openTextDocuments.get(changeUri);
1467
- if (textDocument && textDocument.version !== change.textDocument.version) {
1468
- versionMismatch = true;
1469
- break;
1470
- }
1471
- }
1472
- }
1473
- }
1474
- if (versionMismatch) {
1475
- return Promise.resolve({ applied: false });
1476
- }
1477
- return Is.asPromise(vscode_1.workspace.applyEdit(converted).then((value) => { return { applied: value }; }));
1478
- }
1479
- handleFailedRequest(type, token, error, defaultValue, showNotification = true) {
1480
- // If we get a request cancel or a content modified don't log anything.
1481
- if (error instanceof vscode_languageserver_protocol_1.ResponseError) {
1482
- // The connection got disposed while we were waiting for a response.
1483
- // Simply return the default value. Is the best we can do.
1484
- if (error.code === vscode_languageserver_protocol_1.ErrorCodes.PendingResponseRejected || error.code === vscode_languageserver_protocol_1.ErrorCodes.ConnectionInactive) {
1485
- return defaultValue;
1486
- }
1487
- if (error.code === vscode_languageserver_protocol_1.LSPErrorCodes.RequestCancelled || error.code === vscode_languageserver_protocol_1.LSPErrorCodes.ServerCancelled) {
1488
- if (token !== undefined && token.isCancellationRequested) {
1489
- return defaultValue;
1490
- }
1491
- else {
1492
- if (error.data !== undefined) {
1493
- throw new features_1.LSPCancellationError(error.data);
1494
- }
1495
- else {
1496
- throw new vscode_1.CancellationError();
1497
- }
1498
- }
1499
- }
1500
- else if (error.code === vscode_languageserver_protocol_1.LSPErrorCodes.ContentModified) {
1501
- if (BaseLanguageClient.RequestsToCancelOnContentModified.has(type.method) || BaseLanguageClient.CancellableResolveCalls.has(type.method)) {
1502
- throw new vscode_1.CancellationError();
1503
- }
1504
- else {
1505
- return defaultValue;
1506
- }
1507
- }
1508
- }
1509
- this.error(`Request ${type.method} failed.`, error, showNotification);
1510
- throw error;
1511
- }
1512
- }
1513
- exports.BaseLanguageClient = BaseLanguageClient;
1514
- BaseLanguageClient.RequestsToCancelOnContentModified = new Set([
1515
- vscode_languageserver_protocol_1.SemanticTokensRequest.method,
1516
- vscode_languageserver_protocol_1.SemanticTokensRangeRequest.method,
1517
- vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.method
1518
- ]);
1519
- BaseLanguageClient.CancellableResolveCalls = new Set([
1520
- vscode_languageserver_protocol_1.CompletionResolveRequest.method,
1521
- vscode_languageserver_protocol_1.CodeLensResolveRequest.method,
1522
- vscode_languageserver_protocol_1.CodeActionResolveRequest.method,
1523
- vscode_languageserver_protocol_1.InlayHintResolveRequest.method,
1524
- vscode_languageserver_protocol_1.DocumentLinkResolveRequest.method,
1525
- vscode_languageserver_protocol_1.WorkspaceSymbolResolveRequest.method
1526
- ]);
1527
- class ConsoleLogger {
1528
- error(message) {
1529
- (0, vscode_languageserver_protocol_1.RAL)().console.error(message);
1530
- }
1531
- warn(message) {
1532
- (0, vscode_languageserver_protocol_1.RAL)().console.warn(message);
1533
- }
1534
- info(message) {
1535
- (0, vscode_languageserver_protocol_1.RAL)().console.info(message);
1536
- }
1537
- log(message) {
1538
- (0, vscode_languageserver_protocol_1.RAL)().console.log(message);
1539
- }
1540
- }
1541
- function createConnection(input, output, errorHandler, closeHandler, options) {
1542
- const logger = new ConsoleLogger();
1543
- const connection = (0, vscode_languageserver_protocol_1.createProtocolConnection)(input, output, logger, options);
1544
- connection.onError((data) => { errorHandler(data[0], data[1], data[2]); });
1545
- connection.onClose(closeHandler);
1546
- const result = {
1547
- listen: () => connection.listen(),
1548
- sendRequest: connection.sendRequest,
1549
- onRequest: connection.onRequest,
1550
- hasPendingResponse: connection.hasPendingResponse,
1551
- sendNotification: connection.sendNotification,
1552
- onNotification: connection.onNotification,
1553
- onProgress: connection.onProgress,
1554
- sendProgress: connection.sendProgress,
1555
- trace: (value, tracer, sendNotificationOrTraceOptions) => {
1556
- const defaultTraceOptions = {
1557
- sendNotification: false,
1558
- traceFormat: vscode_languageserver_protocol_1.TraceFormat.Text
1559
- };
1560
- if (sendNotificationOrTraceOptions === undefined) {
1561
- return connection.trace(value, tracer, defaultTraceOptions);
1562
- }
1563
- else if (Is.boolean(sendNotificationOrTraceOptions)) {
1564
- return connection.trace(value, tracer, sendNotificationOrTraceOptions);
1565
- }
1566
- else {
1567
- return connection.trace(value, tracer, sendNotificationOrTraceOptions);
1568
- }
1569
- },
1570
- initialize: (params) => {
1571
- // This needs to return and MUST not be await to avoid any async
1572
- // scheduling. Otherwise messages might overtake each other.
1573
- return connection.sendRequest(vscode_languageserver_protocol_1.InitializeRequest.type, params);
1574
- },
1575
- shutdown: () => {
1576
- // This needs to return and MUST not be await to avoid any async
1577
- // scheduling. Otherwise messages might overtake each other.
1578
- return connection.sendRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, undefined);
1579
- },
1580
- exit: () => {
1581
- // This needs to return and MUST not be await to avoid any async
1582
- // scheduling. Otherwise messages might overtake each other.
1583
- return connection.sendNotification(vscode_languageserver_protocol_1.ExitNotification.type);
1584
- },
1585
- end: () => connection.end(),
1586
- dispose: () => connection.dispose()
1587
- };
1588
- return result;
1589
- }
1590
- // Exporting proposed protocol.
1591
- var ProposedFeatures;
1592
- (function (ProposedFeatures) {
1593
- function createAll(_client) {
1594
- let result = [
1595
- new inlineCompletion_1.InlineCompletionItemFeature(_client)
1596
- ];
1597
- return result;
1598
- }
1599
- ProposedFeatures.createAll = createAll;
1600
- })(ProposedFeatures || (exports.ProposedFeatures = ProposedFeatures = {}));