@hydranium/core 1.0.0-next.14 → 1.0.0-next.140

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 (484) hide show
  1. package/README.md +5 -1
  2. package/lib/documents/ast-document-manager.d.ts +187 -27
  3. package/lib/documents/ast-document-manager.d.ts.map +1 -1
  4. package/lib/documents/ast-document-manager.js +235 -38
  5. package/lib/documents/ast-document-manager.js.map +1 -1
  6. package/lib/documents/client-ids.d.ts +5 -19
  7. package/lib/documents/client-ids.d.ts.map +1 -1
  8. package/lib/documents/client-ids.js +5 -19
  9. package/lib/documents/client-ids.js.map +1 -1
  10. package/lib/documents/client-session-errors.d.ts +15 -0
  11. package/lib/documents/client-session-errors.d.ts.map +1 -0
  12. package/lib/documents/client-session-errors.js +15 -0
  13. package/lib/documents/client-session-errors.js.map +1 -0
  14. package/lib/documents/client-session-registry.d.ts +138 -0
  15. package/lib/documents/client-session-registry.d.ts.map +1 -0
  16. package/lib/documents/client-session-registry.js +187 -0
  17. package/lib/documents/client-session-registry.js.map +1 -0
  18. package/lib/documents/file-system-task-queue.d.ts +49 -0
  19. package/lib/documents/file-system-task-queue.d.ts.map +1 -0
  20. package/lib/documents/file-system-task-queue.js +34 -0
  21. package/lib/documents/file-system-task-queue.js.map +1 -0
  22. package/lib/documents/hydranium-text-documents.d.ts +386 -57
  23. package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
  24. package/lib/documents/hydranium-text-documents.js +697 -113
  25. package/lib/documents/hydranium-text-documents.js.map +1 -1
  26. package/lib/documents/index.d.ts +3 -0
  27. package/lib/documents/index.d.ts.map +1 -1
  28. package/lib/documents/index.js +3 -0
  29. package/lib/documents/index.js.map +1 -1
  30. package/lib/documents/language-client-text-shadow.d.ts +41 -9
  31. package/lib/documents/language-client-text-shadow.d.ts.map +1 -1
  32. package/lib/documents/language-client-text-shadow.js +56 -11
  33. package/lib/documents/language-client-text-shadow.js.map +1 -1
  34. package/lib/documents/self-save-registry.d.ts +37 -6
  35. package/lib/documents/self-save-registry.d.ts.map +1 -1
  36. package/lib/documents/self-save-registry.js +28 -15
  37. package/lib/documents/self-save-registry.js.map +1 -1
  38. package/lib/index.d.ts +3 -0
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js +6 -0
  41. package/lib/index.js.map +1 -1
  42. package/lib/langium/ast-extension/ast-node-builder.d.ts +32 -9
  43. package/lib/langium/ast-extension/ast-node-builder.d.ts.map +1 -1
  44. package/lib/langium/ast-extension/ast-node-builder.js +60 -22
  45. package/lib/langium/ast-extension/ast-node-builder.js.map +1 -1
  46. package/lib/langium/bootstrap.d.ts.map +1 -1
  47. package/lib/langium/bootstrap.js +16 -9
  48. package/lib/langium/bootstrap.js.map +1 -1
  49. package/lib/langium/config/configuration-provider.d.ts +81 -0
  50. package/lib/langium/config/configuration-provider.d.ts.map +1 -0
  51. package/lib/langium/config/configuration-provider.js +112 -0
  52. package/lib/langium/config/configuration-provider.js.map +1 -0
  53. package/lib/langium/config/index.d.ts +1 -0
  54. package/lib/langium/config/index.d.ts.map +1 -1
  55. package/lib/langium/config/index.js +1 -0
  56. package/lib/langium/config/index.js.map +1 -1
  57. package/lib/langium/diagnostics/lsp-logger.d.ts +17 -0
  58. package/lib/langium/diagnostics/lsp-logger.d.ts.map +1 -1
  59. package/lib/langium/diagnostics/lsp-logger.js +40 -6
  60. package/lib/langium/diagnostics/lsp-logger.js.map +1 -1
  61. package/lib/langium/document-builder/build-pipeline-integration.d.ts +21 -1
  62. package/lib/langium/document-builder/build-pipeline-integration.d.ts.map +1 -1
  63. package/lib/langium/document-builder/build-pipeline-integration.js +32 -5
  64. package/lib/langium/document-builder/build-pipeline-integration.js.map +1 -1
  65. package/lib/langium/document-builder/build-session.d.ts +93 -0
  66. package/lib/langium/document-builder/build-session.d.ts.map +1 -0
  67. package/lib/langium/document-builder/build-session.js +72 -0
  68. package/lib/langium/document-builder/build-session.js.map +1 -0
  69. package/lib/langium/document-builder/document-builder.d.ts +220 -11
  70. package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
  71. package/lib/langium/document-builder/document-builder.js +409 -27
  72. package/lib/langium/document-builder/document-builder.js.map +1 -1
  73. package/lib/langium/document-builder/index.d.ts +1 -0
  74. package/lib/langium/document-builder/index.d.ts.map +1 -1
  75. package/lib/langium/document-builder/index.js +1 -0
  76. package/lib/langium/document-builder/index.js.map +1 -1
  77. package/lib/langium/integration-services.d.ts +45 -1
  78. package/lib/langium/integration-services.d.ts.map +1 -1
  79. package/lib/langium/integration-services.js +10 -5
  80. package/lib/langium/integration-services.js.map +1 -1
  81. package/lib/langium/integrity/integrity-rule.d.ts +13 -5
  82. package/lib/langium/integrity/integrity-rule.d.ts.map +1 -1
  83. package/lib/langium/integrity/integrity-rule.js.map +1 -1
  84. package/lib/langium/integrity/integrity-service.d.ts +50 -6
  85. package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
  86. package/lib/langium/integrity/integrity-service.js +193 -17
  87. package/lib/langium/integrity/integrity-service.js.map +1 -1
  88. package/lib/langium/keys/containment.d.ts +64 -0
  89. package/lib/langium/keys/containment.d.ts.map +1 -0
  90. package/lib/langium/keys/containment.js +53 -0
  91. package/lib/langium/keys/containment.js.map +1 -0
  92. package/lib/langium/keys/index.d.ts +1 -0
  93. package/lib/langium/keys/index.d.ts.map +1 -1
  94. package/lib/langium/keys/index.js +1 -0
  95. package/lib/langium/keys/index.js.map +1 -1
  96. package/lib/langium/keys/name-based-key-provider.d.ts +4 -0
  97. package/lib/langium/keys/name-based-key-provider.d.ts.map +1 -1
  98. package/lib/langium/keys/name-based-key-provider.js +4 -0
  99. package/lib/langium/keys/name-based-key-provider.js.map +1 -1
  100. package/lib/langium/language-module.d.ts +27 -2
  101. package/lib/langium/language-module.d.ts.map +1 -1
  102. package/lib/langium/language-module.js +16 -2
  103. package/lib/langium/language-module.js.map +1 -1
  104. package/lib/langium/model-service/client-session.d.ts +307 -0
  105. package/lib/langium/model-service/client-session.d.ts.map +1 -0
  106. package/lib/langium/model-service/client-session.js +395 -0
  107. package/lib/langium/model-service/client-session.js.map +1 -0
  108. package/lib/langium/model-service/index.d.ts +1 -0
  109. package/lib/langium/model-service/index.d.ts.map +1 -1
  110. package/lib/langium/model-service/index.js +1 -0
  111. package/lib/langium/model-service/index.js.map +1 -1
  112. package/lib/langium/model-service/model-service.d.ts +240 -174
  113. package/lib/langium/model-service/model-service.d.ts.map +1 -1
  114. package/lib/langium/model-service/model-service.js +207 -314
  115. package/lib/langium/model-service/model-service.js.map +1 -1
  116. package/lib/langium/module.d.ts +102 -18
  117. package/lib/langium/module.d.ts.map +1 -1
  118. package/lib/langium/module.js +30 -12
  119. package/lib/langium/module.js.map +1 -1
  120. package/lib/langium/naming/name-provider.d.ts +25 -4
  121. package/lib/langium/naming/name-provider.d.ts.map +1 -1
  122. package/lib/langium/naming/name-provider.js +2 -1
  123. package/lib/langium/naming/name-provider.js.map +1 -1
  124. package/lib/langium/naming/name-separator-validation.d.ts +23 -0
  125. package/lib/langium/naming/name-separator-validation.d.ts.map +1 -1
  126. package/lib/langium/naming/name-separator-validation.js +30 -1
  127. package/lib/langium/naming/name-separator-validation.js.map +1 -1
  128. package/lib/langium/residency/cst-residency-service.d.ts +31 -11
  129. package/lib/langium/residency/cst-residency-service.d.ts.map +1 -1
  130. package/lib/langium/residency/cst-residency-service.js +13 -56
  131. package/lib/langium/residency/cst-residency-service.js.map +1 -1
  132. package/lib/langium/scope/hydranium-scope-provider.d.ts +48 -13
  133. package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
  134. package/lib/langium/scope/hydranium-scope-provider.js +56 -20
  135. package/lib/langium/scope/hydranium-scope-provider.js.map +1 -1
  136. package/lib/langium/serialization/abstract-serializer.d.ts +11 -20
  137. package/lib/langium/serialization/abstract-serializer.d.ts.map +1 -1
  138. package/lib/langium/serialization/abstract-serializer.js +12 -21
  139. package/lib/langium/serialization/abstract-serializer.js.map +1 -1
  140. package/lib/langium/service-registry.d.ts +15 -1
  141. package/lib/langium/service-registry.d.ts.map +1 -1
  142. package/lib/langium/service-registry.js +16 -0
  143. package/lib/langium/service-registry.js.map +1 -1
  144. package/lib/langium/shared-services.d.ts +15 -2
  145. package/lib/langium/shared-services.d.ts.map +1 -1
  146. package/lib/langium/shared-services.js.map +1 -1
  147. package/lib/langium/transfer/transfer-encoder.d.ts +60 -17
  148. package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -1
  149. package/lib/langium/transfer/transfer-encoder.js +38 -16
  150. package/lib/langium/transfer/transfer-encoder.js.map +1 -1
  151. package/lib/langium/trivia/comment-preserver.d.ts +423 -0
  152. package/lib/langium/trivia/comment-preserver.d.ts.map +1 -0
  153. package/lib/langium/trivia/comment-preserver.js +906 -0
  154. package/lib/langium/trivia/comment-preserver.js.map +1 -0
  155. package/lib/langium/trivia/document-ending-preserver.d.ts +43 -0
  156. package/lib/langium/trivia/document-ending-preserver.d.ts.map +1 -0
  157. package/lib/langium/trivia/document-ending-preserver.js +48 -0
  158. package/lib/langium/trivia/document-ending-preserver.js.map +1 -0
  159. package/lib/langium/trivia/index.d.ts +14 -0
  160. package/lib/langium/trivia/index.d.ts.map +1 -0
  161. package/lib/langium/trivia/index.js +14 -0
  162. package/lib/langium/trivia/index.js.map +1 -0
  163. package/lib/langium/trivia/trivia-contribution.d.ts +37 -0
  164. package/lib/langium/trivia/trivia-contribution.d.ts.map +1 -0
  165. package/lib/langium/trivia/trivia-contribution.js +10 -0
  166. package/lib/langium/trivia/trivia-contribution.js.map +1 -0
  167. package/lib/langium/trivia/trivia-preserver.d.ts +50 -0
  168. package/lib/langium/trivia/trivia-preserver.d.ts.map +1 -0
  169. package/lib/langium/trivia/trivia-preserver.js +10 -0
  170. package/lib/langium/trivia/trivia-preserver.js.map +1 -0
  171. package/lib/langium/trivia/trivia-service.d.ts +70 -0
  172. package/lib/langium/trivia/trivia-service.d.ts.map +1 -0
  173. package/lib/langium/trivia/trivia-service.js +56 -0
  174. package/lib/langium/trivia/trivia-service.js.map +1 -0
  175. package/lib/langium/update-rewrite/update-rewrite.d.ts +1 -1
  176. package/lib/langium/validation/document-validator.d.ts +294 -10
  177. package/lib/langium/validation/document-validator.d.ts.map +1 -1
  178. package/lib/langium/validation/document-validator.js +448 -5
  179. package/lib/langium/validation/document-validator.js.map +1 -1
  180. package/lib/langium/workspace/document-uri-policy.d.ts +3 -4
  181. package/lib/langium/workspace/document-uri-policy.d.ts.map +1 -1
  182. package/lib/langium/workspace/document-uri-policy.js +3 -4
  183. package/lib/langium/workspace/document-uri-policy.js.map +1 -1
  184. package/lib/langium/workspace/file-system-provider.d.ts +9 -1
  185. package/lib/langium/workspace/file-system-provider.d.ts.map +1 -1
  186. package/lib/langium/workspace/file-system-provider.js +40 -7
  187. package/lib/langium/workspace/file-system-provider.js.map +1 -1
  188. package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +25 -0
  189. package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
  190. package/lib/langium/workspace/hydranium-langium-document-factory.js +25 -0
  191. package/lib/langium/workspace/hydranium-langium-document-factory.js.map +1 -1
  192. package/lib/langium/workspace/hydranium-workspace-manager.d.ts +21 -1
  193. package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
  194. package/lib/langium/workspace/hydranium-workspace-manager.js +28 -0
  195. package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -1
  196. package/lib/langium/workspace/in-memory-file-system-provider.d.ts +23 -0
  197. package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -1
  198. package/lib/langium/workspace/in-memory-file-system-provider.js +55 -9
  199. package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -1
  200. package/lib/langium/workspace/initialize-workspace.d.ts +31 -2
  201. package/lib/langium/workspace/initialize-workspace.d.ts.map +1 -1
  202. package/lib/langium/workspace/initialize-workspace.js +13 -5
  203. package/lib/langium/workspace/initialize-workspace.js.map +1 -1
  204. package/lib/langium/workspace/langium-documents.d.ts +79 -17
  205. package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
  206. package/lib/langium/workspace/langium-documents.js +83 -28
  207. package/lib/langium/workspace/langium-documents.js.map +1 -1
  208. package/lib/langium/workspace/virtual-document.d.ts +18 -3
  209. package/lib/langium/workspace/virtual-document.d.ts.map +1 -1
  210. package/lib/langium/workspace/virtual-document.js +19 -2
  211. package/lib/langium/workspace/virtual-document.js.map +1 -1
  212. package/lib/langium/workspace/write-lock-scope.d.ts +4 -3
  213. package/lib/langium/workspace/write-lock-scope.d.ts.map +1 -1
  214. package/lib/langium/workspace/write-lock-scope.js +4 -3
  215. package/lib/langium/workspace/write-lock-scope.js.map +1 -1
  216. package/lib/locale/index.d.ts +10 -0
  217. package/lib/locale/index.d.ts.map +1 -0
  218. package/lib/locale/index.js +10 -0
  219. package/lib/locale/index.js.map +1 -0
  220. package/lib/locale/server-locale.d.ts +73 -0
  221. package/lib/locale/server-locale.d.ts.map +1 -0
  222. package/lib/locale/server-locale.js +61 -0
  223. package/lib/locale/server-locale.js.map +1 -0
  224. package/lib/lsp/completion/hydranium-completion-provider.d.ts +44 -2
  225. package/lib/lsp/completion/hydranium-completion-provider.d.ts.map +1 -1
  226. package/lib/lsp/completion/hydranium-completion-provider.js +68 -0
  227. package/lib/lsp/completion/hydranium-completion-provider.js.map +1 -1
  228. package/lib/lsp/connection-features.d.ts +23 -0
  229. package/lib/lsp/connection-features.d.ts.map +1 -0
  230. package/lib/lsp/connection-features.js +60 -0
  231. package/lib/lsp/connection-features.js.map +1 -0
  232. package/lib/lsp/diagnostics-connection.d.ts +27 -0
  233. package/lib/lsp/diagnostics-connection.d.ts.map +1 -0
  234. package/lib/lsp/diagnostics-connection.js +53 -0
  235. package/lib/lsp/diagnostics-connection.js.map +1 -0
  236. package/lib/lsp/hydranium-document-update-handler.d.ts +70 -62
  237. package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
  238. package/lib/lsp/hydranium-document-update-handler.js +129 -75
  239. package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
  240. package/lib/lsp/index.d.ts +3 -1
  241. package/lib/lsp/index.d.ts.map +1 -1
  242. package/lib/lsp/index.js +3 -1
  243. package/lib/lsp/index.js.map +1 -1
  244. package/lib/lsp/lsp-latency.d.ts +39 -0
  245. package/lib/lsp/lsp-latency.d.ts.map +1 -0
  246. package/lib/lsp/lsp-latency.js +58 -0
  247. package/lib/lsp/lsp-latency.js.map +1 -0
  248. package/lib/lsp/semantic-token-provider.d.ts +34 -1
  249. package/lib/lsp/semantic-token-provider.d.ts.map +1 -1
  250. package/lib/lsp/semantic-token-provider.js +55 -8
  251. package/lib/lsp/semantic-token-provider.js.map +1 -1
  252. package/lib/lsp/shared-module.d.ts +4 -8
  253. package/lib/lsp/shared-module.d.ts.map +1 -1
  254. package/lib/lsp/shared-module.js.map +1 -1
  255. package/lib/lsp/start-language-server.d.ts +8 -7
  256. package/lib/lsp/start-language-server.d.ts.map +1 -1
  257. package/lib/lsp/start-language-server.js +13 -7
  258. package/lib/lsp/start-language-server.js.map +1 -1
  259. package/lib/messages/carriers.d.ts +54 -0
  260. package/lib/messages/carriers.d.ts.map +1 -0
  261. package/lib/messages/carriers.js +62 -0
  262. package/lib/messages/carriers.js.map +1 -0
  263. package/lib/messages/index.d.ts +25 -0
  264. package/lib/messages/index.d.ts.map +1 -0
  265. package/lib/messages/index.js +25 -0
  266. package/lib/messages/index.js.map +1 -0
  267. package/lib/messages/renderer.d.ts +142 -0
  268. package/lib/messages/renderer.d.ts.map +1 -0
  269. package/lib/messages/renderer.js +165 -0
  270. package/lib/messages/renderer.js.map +1 -0
  271. package/lib/node/heap-ceiling.d.ts +61 -0
  272. package/lib/node/heap-ceiling.d.ts.map +1 -0
  273. package/lib/node/heap-ceiling.js +72 -0
  274. package/lib/node/heap-ceiling.js.map +1 -0
  275. package/lib/node/index.d.ts +1 -0
  276. package/lib/node/index.d.ts.map +1 -1
  277. package/lib/node/index.js +1 -0
  278. package/lib/node/index.js.map +1 -1
  279. package/lib/node/latency-from-env.d.ts +1 -1
  280. package/lib/node/latency-from-env.js +1 -1
  281. package/lib/node/measure-memory.d.ts.map +1 -1
  282. package/lib/node/measure-memory.js +1 -0
  283. package/lib/node/measure-memory.js.map +1 -1
  284. package/lib/node/node-file-system-provider.d.ts +35 -1
  285. package/lib/node/node-file-system-provider.d.ts.map +1 -1
  286. package/lib/node/node-file-system-provider.js +140 -45
  287. package/lib/node/node-file-system-provider.js.map +1 -1
  288. package/lib/node/profile-capture.d.ts +8 -2
  289. package/lib/node/profile-capture.d.ts.map +1 -1
  290. package/lib/node/profile-capture.js.map +1 -1
  291. package/lib/node/profiling-run.d.ts +2 -2
  292. package/lib/node/profiling-run.js +1 -1
  293. package/lib/node/profiling-run.js.map +1 -1
  294. package/lib/node/rename-over-open-readers.d.ts +52 -0
  295. package/lib/node/rename-over-open-readers.d.ts.map +1 -0
  296. package/lib/node/rename-over-open-readers.js +66 -0
  297. package/lib/node/rename-over-open-readers.js.map +1 -0
  298. package/lib/node/socket-launcher.d.ts +16 -1
  299. package/lib/node/socket-launcher.d.ts.map +1 -1
  300. package/lib/node/socket-launcher.js +4 -3
  301. package/lib/node/socket-launcher.js.map +1 -1
  302. package/lib/node/stdio-launcher.d.ts +1 -1
  303. package/lib/node/stdio-launcher.d.ts.map +1 -1
  304. package/lib/node/stdio-launcher.js +1 -1
  305. package/lib/node/stdio-launcher.js.map +1 -1
  306. package/lib/testing/fake-document.d.ts +16 -4
  307. package/lib/testing/fake-document.d.ts.map +1 -1
  308. package/lib/testing/fake-document.js +18 -3
  309. package/lib/testing/fake-document.js.map +1 -1
  310. package/lib/testing/make-noop-shared-services.d.ts +14 -0
  311. package/lib/testing/make-noop-shared-services.d.ts.map +1 -1
  312. package/lib/testing/make-noop-shared-services.js +28 -2
  313. package/lib/testing/make-noop-shared-services.js.map +1 -1
  314. package/lib/testing/make-test-services.d.ts +62 -14
  315. package/lib/testing/make-test-services.d.ts.map +1 -1
  316. package/lib/testing/make-test-services.js +25 -5
  317. package/lib/testing/make-test-services.js.map +1 -1
  318. package/lib/testing/node/index.d.ts +1 -0
  319. package/lib/testing/node/index.d.ts.map +1 -1
  320. package/lib/testing/node/index.js +1 -0
  321. package/lib/testing/node/index.js.map +1 -1
  322. package/lib/testing/node/lsp-harness.d.ts.map +1 -1
  323. package/lib/testing/node/lsp-harness.js +2 -0
  324. package/lib/testing/node/lsp-harness.js.map +1 -1
  325. package/lib/testing/node/lsp-server-connection.d.ts +11 -3
  326. package/lib/testing/node/lsp-server-connection.d.ts.map +1 -1
  327. package/lib/testing/node/lsp-server-connection.js +42 -9
  328. package/lib/testing/node/lsp-server-connection.js.map +1 -1
  329. package/lib/testing/node/scratch-workspace.d.ts.map +1 -1
  330. package/lib/testing/node/scratch-workspace.js +10 -5
  331. package/lib/testing/node/scratch-workspace.js.map +1 -1
  332. package/lib/testing/node/spawned-server.d.ts +14 -0
  333. package/lib/testing/node/spawned-server.d.ts.map +1 -1
  334. package/lib/testing/node/spawned-server.js +33 -1
  335. package/lib/testing/node/spawned-server.js.map +1 -1
  336. package/lib/testing/node/unhandled-rejections.d.ts +20 -0
  337. package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
  338. package/lib/testing/node/unhandled-rejections.js +32 -0
  339. package/lib/testing/node/unhandled-rejections.js.map +1 -0
  340. package/lib/testing/playwright/flaky-network-proxy.d.ts +76 -0
  341. package/lib/testing/playwright/flaky-network-proxy.d.ts.map +1 -0
  342. package/lib/testing/playwright/flaky-network-proxy.js +164 -0
  343. package/lib/testing/playwright/flaky-network-proxy.js.map +1 -0
  344. package/lib/testing/playwright/index.d.ts +1 -0
  345. package/lib/testing/playwright/index.d.ts.map +1 -1
  346. package/lib/testing/playwright/index.js +1 -0
  347. package/lib/testing/playwright/index.js.map +1 -1
  348. package/lib/testing/playwright/server-log-capture.d.ts +14 -4
  349. package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
  350. package/lib/testing/playwright/server-log-capture.js +21 -4
  351. package/lib/testing/playwright/server-log-capture.js.map +1 -1
  352. package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -1
  353. package/lib/testing/playwright/server-log-rename-reporter.js +10 -1
  354. package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -1
  355. package/lib/testing/run-update-pipeline.d.ts +4 -4
  356. package/lib/testing/run-update-pipeline.d.ts.map +1 -1
  357. package/lib/testing/stub-ast-document-manager.d.ts +10 -9
  358. package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
  359. package/lib/testing/stub-ast-document-manager.js +17 -9
  360. package/lib/testing/stub-ast-document-manager.js.map +1 -1
  361. package/lib/testing/stub-document-builder.d.ts +15 -6
  362. package/lib/testing/stub-document-builder.d.ts.map +1 -1
  363. package/lib/testing/stub-document-builder.js +48 -3
  364. package/lib/testing/stub-document-builder.js.map +1 -1
  365. package/lib/testing/stub-hydranium-text-documents.d.ts +22 -7
  366. package/lib/testing/stub-hydranium-text-documents.d.ts.map +1 -1
  367. package/lib/testing/stub-hydranium-text-documents.js +92 -15
  368. package/lib/testing/stub-hydranium-text-documents.js.map +1 -1
  369. package/lib/testing/stub-langium-documents.d.ts +3 -2
  370. package/lib/testing/stub-langium-documents.d.ts.map +1 -1
  371. package/lib/testing/stub-langium-documents.js.map +1 -1
  372. package/lib/testing/stub-model-service.d.ts +7 -6
  373. package/lib/testing/stub-model-service.d.ts.map +1 -1
  374. package/lib/testing/stub-model-service.js +4 -4
  375. package/lib/testing/stub-model-service.js.map +1 -1
  376. package/lib/util/connection-liveness.d.ts +7 -6
  377. package/lib/util/connection-liveness.d.ts.map +1 -1
  378. package/lib/util/connection-liveness.js +35 -14
  379. package/lib/util/connection-liveness.js.map +1 -1
  380. package/package.json +17 -8
  381. package/src/documents/ast-document-manager.ts +345 -62
  382. package/src/documents/client-ids.ts +5 -22
  383. package/src/documents/client-session-errors.ts +24 -0
  384. package/src/documents/client-session-registry.ts +240 -0
  385. package/src/documents/file-system-task-queue.ts +68 -0
  386. package/src/documents/hydranium-text-documents.ts +853 -142
  387. package/src/documents/index.ts +3 -0
  388. package/src/documents/language-client-text-shadow.ts +59 -11
  389. package/src/documents/self-save-registry.ts +52 -13
  390. package/src/index.ts +6 -0
  391. package/src/langium/ast-extension/ast-node-builder.ts +66 -22
  392. package/src/langium/bootstrap.ts +16 -9
  393. package/src/langium/config/configuration-provider.ts +119 -0
  394. package/src/langium/config/index.ts +1 -0
  395. package/src/langium/diagnostics/lsp-logger.ts +41 -6
  396. package/src/langium/document-builder/build-pipeline-integration.ts +50 -5
  397. package/src/langium/document-builder/build-session.ts +87 -0
  398. package/src/langium/document-builder/document-builder.ts +460 -26
  399. package/src/langium/document-builder/index.ts +1 -0
  400. package/src/langium/integration-services.ts +67 -6
  401. package/src/langium/integrity/integrity-rule.ts +13 -5
  402. package/src/langium/integrity/integrity-service.ts +202 -17
  403. package/src/langium/keys/containment.ts +87 -0
  404. package/src/langium/keys/index.ts +1 -0
  405. package/src/langium/keys/name-based-key-provider.ts +4 -0
  406. package/src/langium/language-module.ts +42 -4
  407. package/src/langium/model-service/client-session.ts +606 -0
  408. package/src/langium/model-service/index.ts +1 -0
  409. package/src/langium/model-service/model-service.ts +363 -312
  410. package/src/langium/module.ts +132 -24
  411. package/src/langium/naming/name-provider.ts +27 -5
  412. package/src/langium/naming/name-separator-validation.ts +34 -5
  413. package/src/langium/residency/cst-residency-service.ts +36 -14
  414. package/src/langium/scope/hydranium-scope-provider.ts +60 -22
  415. package/src/langium/serialization/abstract-serializer.ts +13 -32
  416. package/src/langium/service-registry.ts +19 -2
  417. package/src/langium/shared-services.ts +19 -2
  418. package/src/langium/transfer/transfer-encoder.ts +85 -24
  419. package/src/langium/trivia/comment-preserver.ts +1100 -0
  420. package/src/langium/trivia/document-ending-preserver.ts +55 -0
  421. package/src/langium/trivia/index.ts +14 -0
  422. package/src/langium/trivia/trivia-contribution.ts +39 -0
  423. package/src/langium/trivia/trivia-preserver.ts +54 -0
  424. package/src/langium/trivia/trivia-service.ts +99 -0
  425. package/src/langium/update-rewrite/update-rewrite.ts +1 -1
  426. package/src/langium/validation/document-validator.ts +537 -11
  427. package/src/langium/workspace/document-uri-policy.ts +3 -4
  428. package/src/langium/workspace/file-system-provider.ts +48 -8
  429. package/src/langium/workspace/hydranium-langium-document-factory.ts +34 -0
  430. package/src/langium/workspace/hydranium-workspace-manager.ts +30 -1
  431. package/src/langium/workspace/in-memory-file-system-provider.ts +62 -10
  432. package/src/langium/workspace/initialize-workspace.ts +43 -5
  433. package/src/langium/workspace/langium-documents.ts +106 -33
  434. package/src/langium/workspace/virtual-document.ts +21 -3
  435. package/src/langium/workspace/write-lock-scope.ts +4 -3
  436. package/src/locale/index.ts +10 -0
  437. package/src/locale/server-locale.ts +86 -0
  438. package/src/lsp/completion/hydranium-completion-provider.ts +82 -2
  439. package/src/lsp/connection-features.ts +67 -0
  440. package/src/lsp/diagnostics-connection.ts +56 -0
  441. package/src/lsp/hydranium-document-update-handler.ts +158 -79
  442. package/src/lsp/index.ts +3 -1
  443. package/src/lsp/lsp-latency.ts +62 -0
  444. package/src/lsp/semantic-token-provider.ts +74 -7
  445. package/src/lsp/shared-module.ts +4 -8
  446. package/src/lsp/start-language-server.ts +13 -7
  447. package/src/messages/carriers.ts +78 -0
  448. package/src/messages/index.ts +36 -0
  449. package/src/messages/renderer.ts +212 -0
  450. package/src/node/heap-ceiling.ts +108 -0
  451. package/src/node/index.ts +1 -0
  452. package/src/node/latency-from-env.ts +1 -1
  453. package/src/node/measure-memory.ts +1 -0
  454. package/src/node/node-file-system-provider.ts +154 -47
  455. package/src/node/profile-capture.ts +8 -2
  456. package/src/node/profiling-run.ts +3 -3
  457. package/src/node/rename-over-open-readers.ts +78 -0
  458. package/src/node/socket-launcher.ts +19 -4
  459. package/src/node/stdio-launcher.ts +1 -2
  460. package/src/testing/fake-document.ts +24 -5
  461. package/src/testing/make-noop-shared-services.ts +50 -2
  462. package/src/testing/make-test-services.ts +101 -26
  463. package/src/testing/node/index.ts +1 -0
  464. package/src/testing/node/lsp-harness.ts +2 -0
  465. package/src/testing/node/lsp-server-connection.ts +61 -11
  466. package/src/testing/node/scratch-workspace.ts +10 -5
  467. package/src/testing/node/spawned-server.ts +35 -1
  468. package/src/testing/node/unhandled-rejections.ts +31 -0
  469. package/src/testing/playwright/flaky-network-proxy.ts +240 -0
  470. package/src/testing/playwright/index.ts +1 -0
  471. package/src/testing/playwright/server-log-capture.ts +24 -5
  472. package/src/testing/playwright/server-log-rename-reporter.ts +12 -1
  473. package/src/testing/run-update-pipeline.ts +4 -4
  474. package/src/testing/stub-ast-document-manager.ts +28 -21
  475. package/src/testing/stub-document-builder.ts +68 -12
  476. package/src/testing/stub-hydranium-text-documents.ts +127 -22
  477. package/src/testing/stub-langium-documents.ts +3 -2
  478. package/src/testing/stub-model-service.ts +9 -8
  479. package/src/util/connection-liveness.ts +37 -14
  480. package/lib/lsp/instrument-connection.d.ts +0 -36
  481. package/lib/lsp/instrument-connection.d.ts.map +0 -1
  482. package/lib/lsp/instrument-connection.js +0 -62
  483. package/lib/lsp/instrument-connection.js.map +0 -1
  484. package/src/lsp/instrument-connection.ts +0 -66
@@ -26,14 +26,10 @@ import { HydraniumDocumentUpdateHandler } from './hydranium-document-update-hand
26
26
  * (an output channel, a structured logger) override the slot after this
27
27
  * module.
28
28
  *
29
- * - {@link HydraniumDocumentUpdateHandler} wraps `didChangeWatchedFiles` to
30
- * suppress echo events for the server's own writes via the shared
31
- * `SelfSaveRegistry` slot, debounces `didChangeContent`, stamps build
32
- * reasons through `markNextReason`, and dispatches a rebuild when the last
33
- * client closes a document.
34
- * Adopters with their own update-handler subclass should extend
35
- * `HydraniumDocumentUpdateHandler` (not Langium's
36
- * `DefaultDocumentUpdateHandler`) to preserve those behaviours.
29
+ * - {@link HydraniumDocumentUpdateHandler} carries the framework's handling of
30
+ * the LSP document events. Adopters with their own update-handler subclass
31
+ * should extend it (not Langium's `DefaultDocumentUpdateHandler`) to keep
32
+ * that handling.
37
33
  *
38
34
  * **Why this is a shared slot and not a per-language one.** Langium declares
39
35
  * `DocumentUpdateHandler` in `LangiumSharedLSPServices` — there is exactly one
@@ -1 +1 @@
1
- {"version":3,"file":"shared-module.d.ts","sourceRoot":"","sources":["../../src/lsp/shared-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,4BAA4B;IAC3B,MAAM,EAAE,SAAS,CAAC;IACjC,GAAG,EAAE;QACa,qBAAqB,EAAE,8BAA8B,CAAC;KACvE,CAAC;CACJ;AAED;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG,4BAA4B,CAAC;AAE1F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACxC,QAAQ,EAAE,mBAAmB,GAC7B,MAAM,CAAC,uBAAuB,EAAE,4BAA4B,GAAG,4BAA4B,CAAC,CAO9F"}
1
+ {"version":3,"file":"shared-module.d.ts","sourceRoot":"","sources":["../../src/lsp/shared-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,4BAA4B;IAC3B,MAAM,EAAE,SAAS,CAAC;IACjC,GAAG,EAAE;QACa,qBAAqB,EAAE,8BAA8B,CAAC;KACvE,CAAC;CACJ;AAED;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG,4BAA4B,CAAC;AAE1F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACxC,QAAQ,EAAE,mBAAmB,GAC7B,MAAM,CAAC,uBAAuB,EAAE,4BAA4B,GAAG,4BAA4B,CAAC,CAO9F"}
@@ -1 +1 @@
1
- {"version":3,"file":"shared-module.js","sourceRoot":"","sources":["../../src/lsp/shared-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAmDxF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,2BAA2B,CACxC,QAA6B;IAE7B,OAAO;QACJ,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC;QAC3C,GAAG,EAAE;YACF,qBAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,8BAA8B,CAAC,QAAQ,CAAC;SACjF;KACH,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"shared-module.js","sourceRoot":"","sources":["../../src/lsp/shared-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AA+CxF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,2BAA2B,CACxC,QAA6B;IAE7B,OAAO;QACJ,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC;QAC3C,GAAG,EAAE;YACF,qBAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,8BAA8B,CAAC,QAAQ,CAAC;SACjF;KACH,CAAC;AACL,CAAC"}
@@ -14,10 +14,9 @@ import { type LangiumSharedServices, type ServiceRequirements } from '@hydranium
14
14
  * SHARED slot, so the head binds it in `createLspServerSharedModule` — a
15
15
  * separate module from `createLspServerLanguageModule`. An adopter who adds
16
16
  * only the language module gets a server that boots, links and serves
17
- * completion, and quietly runs Langium's `DefaultDocumentUpdateHandler`: echo
18
- * suppression for the server's own writes, the `didChangeContent` debounce,
19
- * `markNextReason` stamping and the last-client-close rebuild are all absent,
20
- * with nothing in the log to say so.
17
+ * completion, and quietly runs Langium's `DefaultDocumentUpdateHandler`: every
18
+ * behaviour `HydraniumDocumentUpdateHandler` adds, the editor save gate
19
+ * included, is absent, with nothing in the log to say so.
21
20
  *
22
21
  * The type system does not catch it. `createIntegrationServices` returns
23
22
  * `inject(...) as unknown as TShared`, so widening `TShared` with
@@ -35,9 +34,11 @@ import { type LangiumSharedServices, type ServiceRequirements } from '@hydranium
35
34
  export declare function assertLspHeadComposed(services: LangiumSharedServices): void;
36
35
  /**
37
36
  * The framework's LSP server entry point: {@link assertLspHeadComposed}, then
38
- * Langium's `startLanguageServer` unchanged. Signature-compatible with
39
- * Langium's, so it is a drop-in for adopters importing from
40
- * `@hydranium/core/lsp`.
37
+ * {@link guardDiagnosticsConnection} on the tree's connection, then Langium's
38
+ * `startLanguageServer`. Signature-compatible with Langium's, so it is a
39
+ * drop-in for adopters importing from `@hydranium/core/lsp`. Calling Langium's
40
+ * directly skips both: the composition check, and the guard without which a
41
+ * publish racing teardown fails the build that validated the document.
41
42
  */
42
43
  export declare function startLanguageServer(services: LangiumSharedServices, serviceRequirements?: Partial<ServiceRequirements>): void;
43
44
  //# sourceMappingURL=start-language-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-language-server.d.ts","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAC1B,MAAM,wBAAwB,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAe3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,mBAAmB,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,IAAI,CAGjI"}
1
+ {"version":3,"file":"start-language-server.d.ts","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAC1B,MAAM,wBAAwB,CAAC;AAIhC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAe3E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,mBAAmB,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,IAAI,CAOjI"}
@@ -8,6 +8,7 @@
8
8
  ********************************************************************************/
9
9
  import { startLanguageServer as startLangiumLanguageServer } from '@hydranium/langium/lsp';
10
10
  import { HydraniumDocumentUpdateHandler } from './hydranium-document-update-handler.js';
11
+ import { guardDiagnosticsConnection } from './diagnostics-connection.js';
11
12
  /**
12
13
  * Fail the LSP head's start when its shared module was never composed.
13
14
  *
@@ -15,10 +16,9 @@ import { HydraniumDocumentUpdateHandler } from './hydranium-document-update-hand
15
16
  * SHARED slot, so the head binds it in `createLspServerSharedModule` — a
16
17
  * separate module from `createLspServerLanguageModule`. An adopter who adds
17
18
  * only the language module gets a server that boots, links and serves
18
- * completion, and quietly runs Langium's `DefaultDocumentUpdateHandler`: echo
19
- * suppression for the server's own writes, the `didChangeContent` debounce,
20
- * `markNextReason` stamping and the last-client-close rebuild are all absent,
21
- * with nothing in the log to say so.
19
+ * completion, and quietly runs Langium's `DefaultDocumentUpdateHandler`: every
20
+ * behaviour `HydraniumDocumentUpdateHandler` adds, the editor save gate
21
+ * included, is absent, with nothing in the log to say so.
22
22
  *
23
23
  * The type system does not catch it. `createIntegrationServices` returns
24
24
  * `inject(...) as unknown as TShared`, so widening `TShared` with
@@ -49,12 +49,18 @@ export function assertLspHeadComposed(services) {
49
49
  }
50
50
  /**
51
51
  * The framework's LSP server entry point: {@link assertLspHeadComposed}, then
52
- * Langium's `startLanguageServer` unchanged. Signature-compatible with
53
- * Langium's, so it is a drop-in for adopters importing from
54
- * `@hydranium/core/lsp`.
52
+ * {@link guardDiagnosticsConnection} on the tree's connection, then Langium's
53
+ * `startLanguageServer`. Signature-compatible with Langium's, so it is a
54
+ * drop-in for adopters importing from `@hydranium/core/lsp`. Calling Langium's
55
+ * directly skips both: the composition check, and the guard without which a
56
+ * publish racing teardown fails the build that validated the document.
55
57
  */
56
58
  export function startLanguageServer(services, serviceRequirements = {}) {
57
59
  assertLspHeadComposed(services);
60
+ const connection = services.lsp.Connection;
61
+ if (connection) {
62
+ guardDiagnosticsConnection(connection);
63
+ }
58
64
  startLangiumLanguageServer(services, serviceRequirements);
59
65
  }
60
66
  //# sourceMappingURL=start-language-server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-language-server.js","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,mBAAmB,IAAI,0BAA0B,EAGnD,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAA+B;IAClE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;QAC7B,OAAO;IACV,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACnD,IAAI,CAAC,CAAC,OAAO,YAAY,8BAA8B,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACZ,oGAAoG;YACjG,IAAI,OAAO,EAAE,WAAW,EAAE,IAAI,IAAI,SAAS,uEAAuE;YAClH,kHAAkH;YAClH,kGAAkG;YAClG,4GAA4G;YAC5G,4CAA4C,CACjD,CAAC;IACL,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA+B,EAAE,sBAAoD,EAAE;IACxH,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAChC,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC7D,CAAC"}
1
+ {"version":3,"file":"start-language-server.js","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,mBAAmB,IAAI,0BAA0B,EAGnD,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAA+B;IAClE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;QAC7B,OAAO;IACV,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACnD,IAAI,CAAC,CAAC,OAAO,YAAY,8BAA8B,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACZ,oGAAoG;YACjG,IAAI,OAAO,EAAE,WAAW,EAAE,IAAI,IAAI,SAAS,uEAAuE;YAClH,kHAAkH;YAClH,kGAAkG;YAClG,4GAA4G;YAC5G,4CAA4C,CACjD,CAAC;IACL,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA+B,EAAE,sBAAoD,EAAE;IACxH,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC;IAC3C,IAAI,UAAU,EAAE,CAAC;QACd,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IACD,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,54 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type MessageDefinition, type ParamsArg, type ResolvedMessage } from '@hydranium/protocol';
10
+ import type { AstNode, DiagnosticData, DiagnosticInfo, Properties, ValidationAcceptor } from '@hydranium/langium';
11
+ import { Diagnostic } from 'vscode-languageserver-protocol';
12
+ /**
13
+ * Raise a validation diagnostic from a declaration, so the call site never
14
+ * restates the code or the sentence.
15
+ *
16
+ * `code` is omitted from `info` because this owns it — the framework claims LSP
17
+ * `Diagnostic.code` for framework codes, which collides with no adopter today
18
+ * and is a stated rule rather than an accident. `data` is deliberately NOT
19
+ * omitted: Langium owns `data.code` for code-action dispatch, so a caller has to
20
+ * be able to request a quick fix. The identity is merged OVER whatever they
21
+ * pass, which makes the two conventions co-exist rather than compete.
22
+ *
23
+ * `data` admits adopter-owned keys beside Langium's, which is why the index
24
+ * signature is there rather than a bare `Partial<DiagnosticData>`. Langium's
25
+ * shape is closed, and a diagnostic that carries a COMPANION payload for its own
26
+ * surface to read — the field a form must highlight, say — has nowhere else to
27
+ * put it: an encoder projecting that payload reads `diagnostic.data`, so the
28
+ * narrower type made the identity and the companion mutually exclusive.
29
+ *
30
+ * The identity lands in both `code` and `data.hydranium` on purpose. `code` is
31
+ * what survives to the editor surface; Theia's converter drops `data` before the
32
+ * squiggle, so a parameterised diagnostic falls back to the server's English
33
+ * there while any adopter-owned surface can still render the parameterised form
34
+ * from the marker store.
35
+ *
36
+ * `DiagnosticInfo` must be Langium's own type: a `Parameters<ValidationAcceptor>[2]`
37
+ * shortcut compiles but loses the `property?: Properties<N>` relation. The `data`
38
+ * re-type has to be an intersection rather than an `Omit` alone, because Langium
39
+ * declares `data?: unknown` and an `unknown` cannot be spread.
40
+ */
41
+ export declare function acceptMessage<S extends string, N extends AstNode, P extends Properties<N> = Properties<N>>(accept: ValidationAcceptor, severity: 'error' | 'warning' | 'info' | 'hint', message: MessageDefinition<S>, info: Omit<DiagnosticInfo<N, P>, 'code' | 'data'> & {
42
+ data?: Partial<DiagnosticData> & Record<string, unknown>;
43
+ }, ...params: ParamsArg<S>): void;
44
+ /**
45
+ * Recover the identity from a published diagnostic, for a surface that
46
+ * identifies or renders diagnostics itself.
47
+ *
48
+ * `Diagnostic.message` is `string | MarkupContent` in LSP 3.17+, so the text
49
+ * comes from upstream's own `Diagnostic.getMessageString` rather than a
50
+ * hand-rolled narrowing — consuming the library in its style, and one fewer
51
+ * place restating the union.
52
+ */
53
+ export declare function resolvedFromDiagnostic(diagnostic: Diagnostic): ResolvedMessage | undefined;
54
+ //# sourceMappingURL=carriers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carriers.d.ts","sourceRoot":"","sources":["../../src/messages/carriers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAIJ,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,eAAe,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAClH,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EACvG,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,EAC/C,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC7B,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EAChH,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACvB,IAAI,CAMN;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,GAAG,SAAS,CAK1F"}
@@ -0,0 +1,62 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { hasMessageIdentity, messageData } from '@hydranium/protocol';
10
+ import { Diagnostic } from 'vscode-languageserver-protocol';
11
+ /**
12
+ * Raise a validation diagnostic from a declaration, so the call site never
13
+ * restates the code or the sentence.
14
+ *
15
+ * `code` is omitted from `info` because this owns it — the framework claims LSP
16
+ * `Diagnostic.code` for framework codes, which collides with no adopter today
17
+ * and is a stated rule rather than an accident. `data` is deliberately NOT
18
+ * omitted: Langium owns `data.code` for code-action dispatch, so a caller has to
19
+ * be able to request a quick fix. The identity is merged OVER whatever they
20
+ * pass, which makes the two conventions co-exist rather than compete.
21
+ *
22
+ * `data` admits adopter-owned keys beside Langium's, which is why the index
23
+ * signature is there rather than a bare `Partial<DiagnosticData>`. Langium's
24
+ * shape is closed, and a diagnostic that carries a COMPANION payload for its own
25
+ * surface to read — the field a form must highlight, say — has nowhere else to
26
+ * put it: an encoder projecting that payload reads `diagnostic.data`, so the
27
+ * narrower type made the identity and the companion mutually exclusive.
28
+ *
29
+ * The identity lands in both `code` and `data.hydranium` on purpose. `code` is
30
+ * what survives to the editor surface; Theia's converter drops `data` before the
31
+ * squiggle, so a parameterised diagnostic falls back to the server's English
32
+ * there while any adopter-owned surface can still render the parameterised form
33
+ * from the marker store.
34
+ *
35
+ * `DiagnosticInfo` must be Langium's own type: a `Parameters<ValidationAcceptor>[2]`
36
+ * shortcut compiles but loses the `property?: Properties<N>` relation. The `data`
37
+ * re-type has to be an intersection rather than an `Omit` alone, because Langium
38
+ * declares `data?: unknown` and an `unknown` cannot be spread.
39
+ */
40
+ export function acceptMessage(accept, severity, message, info, ...params) {
41
+ const data = {
42
+ ...info.data,
43
+ ...messageData(message, ...params)
44
+ };
45
+ accept(severity, message.format(...params), { ...info, code: message.code, data });
46
+ }
47
+ /**
48
+ * Recover the identity from a published diagnostic, for a surface that
49
+ * identifies or renders diagnostics itself.
50
+ *
51
+ * `Diagnostic.message` is `string | MarkupContent` in LSP 3.17+, so the text
52
+ * comes from upstream's own `Diagnostic.getMessageString` rather than a
53
+ * hand-rolled narrowing — consuming the library in its style, and one fewer
54
+ * place restating the union.
55
+ */
56
+ export function resolvedFromDiagnostic(diagnostic) {
57
+ if (!hasMessageIdentity(diagnostic.data)) {
58
+ return undefined;
59
+ }
60
+ return { ...diagnostic.data.hydranium, text: Diagnostic.getMessageString(diagnostic) };
61
+ }
62
+ //# sourceMappingURL=carriers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carriers.js","sourceRoot":"","sources":["../../src/messages/carriers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,kBAAkB,EAClB,WAAW,EAKb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,aAAa,CAC1B,MAA0B,EAC1B,QAA+C,EAC/C,OAA6B,EAC7B,IAAgH,EAChH,GAAG,MAAoB;IAEvB,MAAM,IAAI,GAA6E;QACpF,GAAG,IAAI,CAAC,IAAI;QACZ,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC;KACpC,CAAC;IACF,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAsB;IAC1D,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACpB,CAAC;IACD,OAAO,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,25 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /**
10
+ * Every user-facing message `@hydranium/core` raises, plus the carrier helpers
11
+ * that attach an identity to one.
12
+ *
13
+ * Declarations stay beside their call sites and are re-exported here, so this is
14
+ * enumeration rather than centralization: a code's package segment has to name
15
+ * the package that raises it. The English is a fallback, not a contract; the
16
+ * code is the contract, and renaming one is a breaking change.
17
+ */
18
+ export * from './carriers.js';
19
+ export * from './renderer.js';
20
+ export { MODEL_UPDATE_EDIT } from '../langium/model-service/model-service.js';
21
+ export { SEPARATOR_IN_NAME } from '../langium/naming/name-separator-validation.js';
22
+ export { INVALID_DEDENT, UNEXPECTED_CHARACTER, MISSING_ITERATION, NO_VIABLE_ALTERNATIVE, TRAILING_INPUT, UNEXPECTED_TOKEN, UNPOPPABLE_LEXER_MODE, UNRESOLVED_REFERENCE } from '../langium/validation/document-validator.js';
23
+ export { NO_LOADABLE_CONTENT } from '../langium/workspace/langium-documents.js';
24
+ export { NO_SUCH_FILE, NO_SUCH_PATH, UNSUPPORTED_WRITE } from '../langium/workspace/in-memory-file-system-provider.js';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EACJ,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACtB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC"}
@@ -0,0 +1,25 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /**
10
+ * Every user-facing message `@hydranium/core` raises, plus the carrier helpers
11
+ * that attach an identity to one.
12
+ *
13
+ * Declarations stay beside their call sites and are re-exported here, so this is
14
+ * enumeration rather than centralization: a code's package segment has to name
15
+ * the package that raises it. The English is a fallback, not a contract; the
16
+ * code is the contract, and renaming one is a breaking change.
17
+ */
18
+ export * from './carriers.js';
19
+ export * from './renderer.js';
20
+ export { MODEL_UPDATE_EDIT } from '../langium/model-service/model-service.js';
21
+ export { SEPARATOR_IN_NAME } from '../langium/naming/name-separator-validation.js';
22
+ export { INVALID_DEDENT, UNEXPECTED_CHARACTER, MISSING_ITERATION, NO_VIABLE_ALTERNATIVE, TRAILING_INPUT, UNEXPECTED_TOKEN, UNPOPPABLE_LEXER_MODE, UNRESOLVED_REFERENCE } from '../langium/validation/document-validator.js';
23
+ export { NO_LOADABLE_CONTENT } from '../langium/workspace/langium-documents.js';
24
+ export { NO_SUCH_FILE, NO_SUCH_PATH, UNSUPPORTED_WRITE } from '../langium/workspace/in-memory-file-system-provider.js';
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EACJ,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACtB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC"}
@@ -0,0 +1,142 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type Locale, type MessageCatalogue, type MessageDefinition, type ParamsArg, type ResolvedMessage, type Tracer } from '@hydranium/protocol';
10
+ import { SimpleCache } from '@hydranium/langium';
11
+ import type { ResponseError } from 'vscode-jsonrpc';
12
+ import { Diagnostic } from 'vscode-languageserver-protocol';
13
+ import { type LogNameOptions } from '../langium/diagnostics/logger.js';
14
+ import type { ServerSharedServicesMinimal } from '../langium/shared-services.js';
15
+ import type { ServerLocale } from '../locale/server-locale.js';
16
+ /** Construction options for {@link DefaultMessageRenderer}. */
17
+ export type MessageRendererOptions = LogNameOptions;
18
+ /**
19
+ * The render contract the `MessageRenderer` slot holds, implemented by
20
+ * {@link DefaultMessageRenderer}.
21
+ *
22
+ * An interface rather than the class, so the slot is compared STRUCTURALLY. A
23
+ * class-typed slot carries its `protected` members into every assignability
24
+ * check and TypeScript compares those nominally — which makes the slot
25
+ * unsatisfiable by a subclass declared against a second physical copy of this
26
+ * package, which any duplicated install produces. It also
27
+ * lets an adopter REPLACE this declaration rather than intersect with it, so
28
+ * slot resolution does not depend on the order a services type is written in.
29
+ *
30
+ * Every method carries a no-throw contract; see the implementation.
31
+ */
32
+ export interface MessageRenderer {
33
+ renderDiagnostic(diagnostic: Diagnostic): string;
34
+ renderError(error: ResponseError<unknown>): string;
35
+ renderMessage<S extends string>(message: MessageDefinition<S>, ...params: ParamsArg<S>): string;
36
+ }
37
+ /**
38
+ * Renders every user-facing message the server sends, in the locale the server
39
+ * was handed at init. The framework ships no catalogue, so its own behaviour is
40
+ * a pass-through.
41
+ *
42
+ * Adopters override {@link translationsFor}: the public render methods carry
43
+ * the no-throw contract, and the catalogue lookup they wrap is what can fail.
44
+ *
45
+ * Two render methods rather than one, because what is useful to an adopter is
46
+ * the carrier's structured fields and the two carriers have different ones. A
47
+ * single `render(text)` would force an adopter to match English prose, which
48
+ * breaks on the first Langium reword.
49
+ */
50
+ export declare class DefaultMessageRenderer implements MessageRenderer {
51
+ protected readonly tracer: Tracer;
52
+ protected readonly serverLocale: ServerLocale;
53
+ /**
54
+ * {@link translationsFor}'s answer per locale, `undefined` answers included —
55
+ * a `SimpleCache` distinguishes "absent" from "cached as none", which matters
56
+ * because shipping no catalogue is the framework's own hot path.
57
+ *
58
+ * `SimpleCache` rather than Langium's `WorkspaceCache`: the eviction axis
59
+ * there is document change, and a catalogue does not depend on documents, so
60
+ * it would evict on every build AND put a `DocumentBuilder` dependency on a
61
+ * service the shared tier declares free of one. Nothing evicts this: the
62
+ * locale arrives once per process. A subclass whose catalogue can change
63
+ * clears it.
64
+ */
65
+ protected readonly catalogues: SimpleCache<string | undefined, Readonly<Record<string, string>> | undefined>;
66
+ constructor(services: ServerSharedServicesMinimal, options?: MessageRendererOptions);
67
+ /**
68
+ * The sentence to publish for `diagnostic`, replacing its current `message`.
69
+ * Sees lexer and parser errors too, which Langium pushes onto the document
70
+ * without routing them through `toDiagnostic`.
71
+ *
72
+ * **Must not throw**, which is why the guard is here and not at the call
73
+ * site: this runs inside the `Validated` phase, and Langium's
74
+ * `notifyDocumentPhase` rethrows anything that is not a cancellation — so an
75
+ * escaping error leaves the document AT `Validated` with the phase's
76
+ * listeners never run, and the client receives no diagnostics for that file.
77
+ * A subclass overriding this method takes that contract on itself.
78
+ */
79
+ renderDiagnostic(diagnostic: Diagnostic): string;
80
+ /**
81
+ * The sentence to send for `error`, replacing its current `message`. Same
82
+ * no-throw contract as {@link renderDiagnostic}: an escaping error replaces a
83
+ * typed rejection the caller can handle with one it cannot.
84
+ */
85
+ renderError(error: ResponseError<unknown>): string;
86
+ /**
87
+ * The sentence for a declaration the caller holds directly, for a carrier
88
+ * with no slot to put an identity in.
89
+ *
90
+ * GLSP's action protocol is the case: every member of its message, status
91
+ * and reject actions is prose or an enum, so a code cannot travel and the
92
+ * raise site is the last place that still knows which message this is.
93
+ * Prefer {@link renderDiagnostic} / {@link renderError} wherever a carrier
94
+ * does hold the identity — they keep the render off the raise site, so an
95
+ * adopter's own messages ride the same one binding.
96
+ *
97
+ * Same no-throw contract as the carrier methods.
98
+ */
99
+ renderMessage<S extends string>(message: MessageDefinition<S>, ...params: ParamsArg<S>): string;
100
+ /**
101
+ * The catalogue for the current locale, or `undefined` for none — the
102
+ * framework's answer, shipping none. Overriding this leaves every identity
103
+ * decision, every pass-through and the no-throw guard in place.
104
+ *
105
+ * **Called once per locale, not once per message**, so an override may load
106
+ * a file or build a map without that cost landing per diagnostic. The
107
+ * corollary is that a catalogue mutated in place afterwards is not seen;
108
+ * clear {@link catalogues} to invalidate.
109
+ *
110
+ * **An override merges its entries over the inherited answer rather than
111
+ * replacing it.** Returning only its own map shadows every entry a base
112
+ * class supplies, and a shadowed entry renders the English — byte-identical
113
+ * to a code deliberately left untranslated, so neither the render path nor a
114
+ * catalogue audit can report it.
115
+ *
116
+ * An adopter wanting Langium's own uncoded sentences instead matches
117
+ * `Diagnostic.data.code` from an overridden {@link renderDiagnostic}, never
118
+ * the sentence.
119
+ */
120
+ protected translationsFor(_locale: Locale | undefined): MessageCatalogue | undefined;
121
+ /**
122
+ * Resolve one identity against the current locale's catalogue.
123
+ *
124
+ * Reads the locale per call. Copying it into a field at construction pins
125
+ * whatever was there before init ran, which is always `undefined` — services
126
+ * compose first.
127
+ *
128
+ * The catalogue behind it is memoized, because a workspace-wide validation
129
+ * renders once per diagnostic and the naive override — parse a JSON file,
130
+ * build a map — then pays that per diagnostic rather than per locale.
131
+ */
132
+ protected render(message: ResolvedMessage): string;
133
+ /**
134
+ * Emit a failed render. Logged rather than swallowed: the fallback output is
135
+ * byte-identical to a correctly-configured default, so a throwing catalogue
136
+ * is otherwise invisible.
137
+ */
138
+ protected reportFailure(err: unknown, carrier: string): void;
139
+ /** Format the failed-render line. Override to name the adopter's catalogue entry. */
140
+ protected formatRenderFailure(err: unknown, carrier: string): string;
141
+ }
142
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/messages/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAKJ,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,MAAM,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D,+DAA+D;AAC/D,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC7B,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;IACjD,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;IACnD,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;CAClG;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC3D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAC9C;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,gFAAuE;gBAExF,QAAQ,EAAE,2BAA2B,EAAE,OAAO,GAAE,sBAA2B;IAKvF;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;IAUhD;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,MAAM;IAUlD;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM;IAkB/F;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS;IAIpF;;;;;;;;;;OAUG;IACH,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM;IAQlD;;;;OAIG;IACH,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5D,qFAAqF;IACrF,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CAGtE"}
@@ -0,0 +1,165 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { describeError, renderFrameworkMessage, resolve, resolvedFromResponseError } from '@hydranium/protocol';
10
+ import { SimpleCache } from '@hydranium/langium';
11
+ import { Diagnostic } from 'vscode-languageserver-protocol';
12
+ import { resolvedFromDiagnostic } from './carriers.js';
13
+ /**
14
+ * Renders every user-facing message the server sends, in the locale the server
15
+ * was handed at init. The framework ships no catalogue, so its own behaviour is
16
+ * a pass-through.
17
+ *
18
+ * Adopters override {@link translationsFor}: the public render methods carry
19
+ * the no-throw contract, and the catalogue lookup they wrap is what can fail.
20
+ *
21
+ * Two render methods rather than one, because what is useful to an adopter is
22
+ * the carrier's structured fields and the two carriers have different ones. A
23
+ * single `render(text)` would force an adopter to match English prose, which
24
+ * breaks on the first Langium reword.
25
+ */
26
+ export class DefaultMessageRenderer {
27
+ tracer;
28
+ serverLocale;
29
+ /**
30
+ * {@link translationsFor}'s answer per locale, `undefined` answers included —
31
+ * a `SimpleCache` distinguishes "absent" from "cached as none", which matters
32
+ * because shipping no catalogue is the framework's own hot path.
33
+ *
34
+ * `SimpleCache` rather than Langium's `WorkspaceCache`: the eviction axis
35
+ * there is document change, and a catalogue does not depend on documents, so
36
+ * it would evict on every build AND put a `DocumentBuilder` dependency on a
37
+ * service the shared tier declares free of one. Nothing evicts this: the
38
+ * locale arrives once per process. A subclass whose catalogue can change
39
+ * clears it.
40
+ */
41
+ catalogues = new SimpleCache();
42
+ constructor(services, options = {}) {
43
+ this.serverLocale = services.ServerLocale;
44
+ this.tracer = services.Tracer.for(options.logName ?? 'MessageRenderer').trace('instantiated');
45
+ }
46
+ /**
47
+ * The sentence to publish for `diagnostic`, replacing its current `message`.
48
+ * Sees lexer and parser errors too, which Langium pushes onto the document
49
+ * without routing them through `toDiagnostic`.
50
+ *
51
+ * **Must not throw**, which is why the guard is here and not at the call
52
+ * site: this runs inside the `Validated` phase, and Langium's
53
+ * `notifyDocumentPhase` rethrows anything that is not a cancellation — so an
54
+ * escaping error leaves the document AT `Validated` with the phase's
55
+ * listeners never run, and the client receives no diagnostics for that file.
56
+ * A subclass overriding this method takes that contract on itself.
57
+ */
58
+ renderDiagnostic(diagnostic) {
59
+ try {
60
+ const resolved = resolvedFromDiagnostic(diagnostic);
61
+ return resolved ? this.render(resolved) : Diagnostic.getMessageString(diagnostic);
62
+ }
63
+ catch (err) {
64
+ this.reportFailure(err, 'a diagnostic');
65
+ return Diagnostic.getMessageString(diagnostic);
66
+ }
67
+ }
68
+ /**
69
+ * The sentence to send for `error`, replacing its current `message`. Same
70
+ * no-throw contract as {@link renderDiagnostic}: an escaping error replaces a
71
+ * typed rejection the caller can handle with one it cannot.
72
+ */
73
+ renderError(error) {
74
+ try {
75
+ const resolved = resolvedFromResponseError(error);
76
+ return resolved ? this.render(resolved) : error.message;
77
+ }
78
+ catch (err) {
79
+ this.reportFailure(err, 'an RPC error');
80
+ return error.message;
81
+ }
82
+ }
83
+ /**
84
+ * The sentence for a declaration the caller holds directly, for a carrier
85
+ * with no slot to put an identity in.
86
+ *
87
+ * GLSP's action protocol is the case: every member of its message, status
88
+ * and reject actions is prose or an enum, so a code cannot travel and the
89
+ * raise site is the last place that still knows which message this is.
90
+ * Prefer {@link renderDiagnostic} / {@link renderError} wherever a carrier
91
+ * does hold the identity — they keep the render off the raise site, so an
92
+ * adopter's own messages ride the same one binding.
93
+ *
94
+ * Same no-throw contract as the carrier methods.
95
+ */
96
+ renderMessage(message, ...params) {
97
+ // `resolve` is inside the guard with the render, not before it: it calls
98
+ // the declaration's own `format`, which for an adopter declaration is
99
+ // arbitrary code, and a throw there would escape a method whose contract
100
+ // says it cannot.
101
+ let resolved;
102
+ try {
103
+ resolved = resolve(message, ...params);
104
+ return this.render(resolved);
105
+ }
106
+ catch (err) {
107
+ this.reportFailure(err, `the message '${message.code}'`);
108
+ // Unset only when `format` ITSELF threw, which leaves the
109
+ // uninterpolated template as the only text there is. A failed render
110
+ // still has the resolved English.
111
+ return resolved?.text ?? message.text;
112
+ }
113
+ }
114
+ /**
115
+ * The catalogue for the current locale, or `undefined` for none — the
116
+ * framework's answer, shipping none. Overriding this leaves every identity
117
+ * decision, every pass-through and the no-throw guard in place.
118
+ *
119
+ * **Called once per locale, not once per message**, so an override may load
120
+ * a file or build a map without that cost landing per diagnostic. The
121
+ * corollary is that a catalogue mutated in place afterwards is not seen;
122
+ * clear {@link catalogues} to invalidate.
123
+ *
124
+ * **An override merges its entries over the inherited answer rather than
125
+ * replacing it.** Returning only its own map shadows every entry a base
126
+ * class supplies, and a shadowed entry renders the English — byte-identical
127
+ * to a code deliberately left untranslated, so neither the render path nor a
128
+ * catalogue audit can report it.
129
+ *
130
+ * An adopter wanting Langium's own uncoded sentences instead matches
131
+ * `Diagnostic.data.code` from an overridden {@link renderDiagnostic}, never
132
+ * the sentence.
133
+ */
134
+ translationsFor(_locale) {
135
+ return undefined;
136
+ }
137
+ /**
138
+ * Resolve one identity against the current locale's catalogue.
139
+ *
140
+ * Reads the locale per call. Copying it into a field at construction pins
141
+ * whatever was there before init ran, which is always `undefined` — services
142
+ * compose first.
143
+ *
144
+ * The catalogue behind it is memoized, because a workspace-wide validation
145
+ * renders once per diagnostic and the naive override — parse a JSON file,
146
+ * build a map — then pays that per diagnostic rather than per locale.
147
+ */
148
+ render(message) {
149
+ const locale = this.serverLocale.value;
150
+ return renderFrameworkMessage(message, this.catalogues.get(locale, () => this.translationsFor(locale)));
151
+ }
152
+ /**
153
+ * Emit a failed render. Logged rather than swallowed: the fallback output is
154
+ * byte-identical to a correctly-configured default, so a throwing catalogue
155
+ * is otherwise invisible.
156
+ */
157
+ reportFailure(err, carrier) {
158
+ this.tracer.error(this.formatRenderFailure(err, carrier));
159
+ }
160
+ /** Format the failed-render line. Override to name the adopter's catalogue entry. */
161
+ formatRenderFailure(err, carrier) {
162
+ return `rendering ${carrier} failed; falling back to the server's own text. ${describeError(err)}`;
163
+ }
164
+ }
165
+ //# sourceMappingURL=renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../src/messages/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,aAAa,EACb,sBAAsB,EACtB,OAAO,EACP,yBAAyB,EAO3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAI5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAyBvD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,sBAAsB;IACb,MAAM,CAAS;IACf,YAAY,CAAe;IAC9C;;;;;;;;;;;OAWG;IACgB,UAAU,GAAG,IAAI,WAAW,EAAoD,CAAC;IAEpG,YAAY,QAAqC,EAAE,UAAkC,EAAE;QACpF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,iBAAiB,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACjG,CAAC;IAED;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,UAAsB;QACpC,IAAI,CAAC;YACF,MAAM,QAAQ,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;YACpD,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACrF,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACxC,OAAO,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAClD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,KAA6B;QACtC,IAAI,CAAC;YACF,MAAM,QAAQ,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QAC3D,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACxC,OAAO,KAAK,CAAC,OAAO,CAAC;QACxB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,aAAa,CAAmB,OAA6B,EAAE,GAAG,MAAoB;QACnF,yEAAyE;QACzE,sEAAsE;QACtE,yEAAyE;QACzE,kBAAkB;QAClB,IAAI,QAAqC,CAAC;QAC1C,IAAI,CAAC;YACF,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,gBAAgB,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;YACzD,0DAA0D;YAC1D,qEAAqE;YACrE,kCAAkC;YAClC,OAAO,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;QACzC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACO,eAAe,CAAC,OAA2B;QAClD,OAAO,SAAS,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACO,MAAM,CAAC,OAAwB;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QACvC,OAAO,sBAAsB,CAC1B,OAAO,EACP,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CACjE,CAAC;IACL,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,GAAY,EAAE,OAAe;QAClD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,qFAAqF;IAC3E,mBAAmB,CAAC,GAAY,EAAE,OAAe;QACxD,OAAO,aAAa,OAAO,mDAAmD,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;IACtG,CAAC;CACH"}