@hydranium/core 1.0.0-next.12 → 1.0.0-next.123

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 (477) hide show
  1. package/README.md +5 -1
  2. package/lib/documents/ast-document-manager.d.ts +92 -19
  3. package/lib/documents/ast-document-manager.d.ts.map +1 -1
  4. package/lib/documents/ast-document-manager.js +107 -26
  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 +184 -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 +324 -57
  23. package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
  24. package/lib/documents/hydranium-text-documents.js +590 -114
  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 +165 -9
  70. package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
  71. package/lib/langium/document-builder/document-builder.js +313 -13
  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 +54 -6
  85. package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
  86. package/lib/langium/integrity/integrity-service.js +192 -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 +299 -0
  105. package/lib/langium/model-service/client-session.d.ts.map +1 -0
  106. package/lib/langium/model-service/client-session.js +379 -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 +224 -160
  113. package/lib/langium/model-service/model-service.d.ts.map +1 -1
  114. package/lib/langium/model-service/model-service.js +191 -288
  115. package/lib/langium/model-service/model-service.js.map +1 -1
  116. package/lib/langium/module.d.ts +95 -16
  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 +1 -1
  213. package/lib/langium/workspace/write-lock-scope.js +1 -1
  214. package/lib/locale/index.d.ts +10 -0
  215. package/lib/locale/index.d.ts.map +1 -0
  216. package/lib/locale/index.js +10 -0
  217. package/lib/locale/index.js.map +1 -0
  218. package/lib/locale/server-locale.d.ts +73 -0
  219. package/lib/locale/server-locale.d.ts.map +1 -0
  220. package/lib/locale/server-locale.js +61 -0
  221. package/lib/locale/server-locale.js.map +1 -0
  222. package/lib/lsp/completion/hydranium-completion-provider.d.ts +44 -2
  223. package/lib/lsp/completion/hydranium-completion-provider.d.ts.map +1 -1
  224. package/lib/lsp/completion/hydranium-completion-provider.js +68 -0
  225. package/lib/lsp/completion/hydranium-completion-provider.js.map +1 -1
  226. package/lib/lsp/connection-features.d.ts +23 -0
  227. package/lib/lsp/connection-features.d.ts.map +1 -0
  228. package/lib/lsp/connection-features.js +60 -0
  229. package/lib/lsp/connection-features.js.map +1 -0
  230. package/lib/lsp/diagnostics-connection.d.ts +27 -0
  231. package/lib/lsp/diagnostics-connection.d.ts.map +1 -0
  232. package/lib/lsp/diagnostics-connection.js +53 -0
  233. package/lib/lsp/diagnostics-connection.js.map +1 -0
  234. package/lib/lsp/hydranium-document-update-handler.d.ts +70 -62
  235. package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
  236. package/lib/lsp/hydranium-document-update-handler.js +123 -75
  237. package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
  238. package/lib/lsp/index.d.ts +3 -1
  239. package/lib/lsp/index.d.ts.map +1 -1
  240. package/lib/lsp/index.js +3 -1
  241. package/lib/lsp/index.js.map +1 -1
  242. package/lib/lsp/lsp-latency.d.ts +39 -0
  243. package/lib/lsp/lsp-latency.d.ts.map +1 -0
  244. package/lib/lsp/lsp-latency.js +58 -0
  245. package/lib/lsp/lsp-latency.js.map +1 -0
  246. package/lib/lsp/semantic-token-provider.d.ts +34 -1
  247. package/lib/lsp/semantic-token-provider.d.ts.map +1 -1
  248. package/lib/lsp/semantic-token-provider.js +55 -8
  249. package/lib/lsp/semantic-token-provider.js.map +1 -1
  250. package/lib/lsp/shared-module.d.ts +4 -8
  251. package/lib/lsp/shared-module.d.ts.map +1 -1
  252. package/lib/lsp/shared-module.js.map +1 -1
  253. package/lib/lsp/start-language-server.d.ts +8 -7
  254. package/lib/lsp/start-language-server.d.ts.map +1 -1
  255. package/lib/lsp/start-language-server.js +13 -7
  256. package/lib/lsp/start-language-server.js.map +1 -1
  257. package/lib/messages/carriers.d.ts +54 -0
  258. package/lib/messages/carriers.d.ts.map +1 -0
  259. package/lib/messages/carriers.js +62 -0
  260. package/lib/messages/carriers.js.map +1 -0
  261. package/lib/messages/index.d.ts +25 -0
  262. package/lib/messages/index.d.ts.map +1 -0
  263. package/lib/messages/index.js +25 -0
  264. package/lib/messages/index.js.map +1 -0
  265. package/lib/messages/renderer.d.ts +142 -0
  266. package/lib/messages/renderer.d.ts.map +1 -0
  267. package/lib/messages/renderer.js +165 -0
  268. package/lib/messages/renderer.js.map +1 -0
  269. package/lib/node/heap-ceiling.d.ts +61 -0
  270. package/lib/node/heap-ceiling.d.ts.map +1 -0
  271. package/lib/node/heap-ceiling.js +72 -0
  272. package/lib/node/heap-ceiling.js.map +1 -0
  273. package/lib/node/index.d.ts +1 -0
  274. package/lib/node/index.d.ts.map +1 -1
  275. package/lib/node/index.js +1 -0
  276. package/lib/node/index.js.map +1 -1
  277. package/lib/node/latency-from-env.d.ts +1 -1
  278. package/lib/node/latency-from-env.js +1 -1
  279. package/lib/node/measure-memory.d.ts.map +1 -1
  280. package/lib/node/measure-memory.js +1 -0
  281. package/lib/node/measure-memory.js.map +1 -1
  282. package/lib/node/node-file-system-provider.d.ts +35 -1
  283. package/lib/node/node-file-system-provider.d.ts.map +1 -1
  284. package/lib/node/node-file-system-provider.js +140 -45
  285. package/lib/node/node-file-system-provider.js.map +1 -1
  286. package/lib/node/profile-capture.d.ts +8 -2
  287. package/lib/node/profile-capture.d.ts.map +1 -1
  288. package/lib/node/profile-capture.js.map +1 -1
  289. package/lib/node/profiling-run.d.ts +2 -2
  290. package/lib/node/profiling-run.js +1 -1
  291. package/lib/node/profiling-run.js.map +1 -1
  292. package/lib/node/rename-over-open-readers.d.ts +52 -0
  293. package/lib/node/rename-over-open-readers.d.ts.map +1 -0
  294. package/lib/node/rename-over-open-readers.js +66 -0
  295. package/lib/node/rename-over-open-readers.js.map +1 -0
  296. package/lib/node/socket-launcher.d.ts +15 -0
  297. package/lib/node/socket-launcher.d.ts.map +1 -1
  298. package/lib/node/socket-launcher.js +3 -2
  299. package/lib/node/socket-launcher.js.map +1 -1
  300. package/lib/testing/fake-document.d.ts +16 -4
  301. package/lib/testing/fake-document.d.ts.map +1 -1
  302. package/lib/testing/fake-document.js +18 -3
  303. package/lib/testing/fake-document.js.map +1 -1
  304. package/lib/testing/make-noop-shared-services.d.ts +14 -0
  305. package/lib/testing/make-noop-shared-services.d.ts.map +1 -1
  306. package/lib/testing/make-noop-shared-services.js +28 -2
  307. package/lib/testing/make-noop-shared-services.js.map +1 -1
  308. package/lib/testing/make-test-services.d.ts +61 -13
  309. package/lib/testing/make-test-services.d.ts.map +1 -1
  310. package/lib/testing/make-test-services.js +25 -5
  311. package/lib/testing/make-test-services.js.map +1 -1
  312. package/lib/testing/node/index.d.ts +1 -0
  313. package/lib/testing/node/index.d.ts.map +1 -1
  314. package/lib/testing/node/index.js +1 -0
  315. package/lib/testing/node/index.js.map +1 -1
  316. package/lib/testing/node/lsp-harness.d.ts.map +1 -1
  317. package/lib/testing/node/lsp-harness.js +2 -0
  318. package/lib/testing/node/lsp-harness.js.map +1 -1
  319. package/lib/testing/node/lsp-server-connection.d.ts +11 -3
  320. package/lib/testing/node/lsp-server-connection.d.ts.map +1 -1
  321. package/lib/testing/node/lsp-server-connection.js +42 -9
  322. package/lib/testing/node/lsp-server-connection.js.map +1 -1
  323. package/lib/testing/node/scratch-workspace.d.ts.map +1 -1
  324. package/lib/testing/node/scratch-workspace.js +10 -5
  325. package/lib/testing/node/scratch-workspace.js.map +1 -1
  326. package/lib/testing/node/spawned-server.d.ts +14 -0
  327. package/lib/testing/node/spawned-server.d.ts.map +1 -1
  328. package/lib/testing/node/spawned-server.js +33 -1
  329. package/lib/testing/node/spawned-server.js.map +1 -1
  330. package/lib/testing/node/unhandled-rejections.d.ts +20 -0
  331. package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
  332. package/lib/testing/node/unhandled-rejections.js +32 -0
  333. package/lib/testing/node/unhandled-rejections.js.map +1 -0
  334. package/lib/testing/playwright/flaky-network-proxy.d.ts +76 -0
  335. package/lib/testing/playwright/flaky-network-proxy.d.ts.map +1 -0
  336. package/lib/testing/playwright/flaky-network-proxy.js +164 -0
  337. package/lib/testing/playwright/flaky-network-proxy.js.map +1 -0
  338. package/lib/testing/playwright/index.d.ts +1 -0
  339. package/lib/testing/playwright/index.d.ts.map +1 -1
  340. package/lib/testing/playwright/index.js +1 -0
  341. package/lib/testing/playwright/index.js.map +1 -1
  342. package/lib/testing/playwright/server-log-capture.d.ts +14 -4
  343. package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
  344. package/lib/testing/playwright/server-log-capture.js +21 -4
  345. package/lib/testing/playwright/server-log-capture.js.map +1 -1
  346. package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -1
  347. package/lib/testing/playwright/server-log-rename-reporter.js +10 -1
  348. package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -1
  349. package/lib/testing/run-update-pipeline.d.ts +4 -4
  350. package/lib/testing/run-update-pipeline.d.ts.map +1 -1
  351. package/lib/testing/stub-ast-document-manager.d.ts +10 -9
  352. package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
  353. package/lib/testing/stub-ast-document-manager.js +8 -9
  354. package/lib/testing/stub-ast-document-manager.js.map +1 -1
  355. package/lib/testing/stub-document-builder.d.ts +8 -0
  356. package/lib/testing/stub-document-builder.d.ts.map +1 -1
  357. package/lib/testing/stub-document-builder.js +22 -3
  358. package/lib/testing/stub-document-builder.js.map +1 -1
  359. package/lib/testing/stub-hydranium-text-documents.d.ts +19 -6
  360. package/lib/testing/stub-hydranium-text-documents.d.ts.map +1 -1
  361. package/lib/testing/stub-hydranium-text-documents.js +53 -15
  362. package/lib/testing/stub-hydranium-text-documents.js.map +1 -1
  363. package/lib/testing/stub-langium-documents.d.ts +3 -2
  364. package/lib/testing/stub-langium-documents.d.ts.map +1 -1
  365. package/lib/testing/stub-langium-documents.js.map +1 -1
  366. package/lib/testing/stub-model-service.d.ts +7 -6
  367. package/lib/testing/stub-model-service.d.ts.map +1 -1
  368. package/lib/testing/stub-model-service.js +4 -4
  369. package/lib/testing/stub-model-service.js.map +1 -1
  370. package/lib/util/connection-liveness.d.ts +7 -6
  371. package/lib/util/connection-liveness.d.ts.map +1 -1
  372. package/lib/util/connection-liveness.js +35 -14
  373. package/lib/util/connection-liveness.js.map +1 -1
  374. package/package.json +17 -8
  375. package/src/documents/ast-document-manager.ts +188 -45
  376. package/src/documents/client-ids.ts +5 -22
  377. package/src/documents/client-session-errors.ts +22 -0
  378. package/src/documents/client-session-registry.ts +237 -0
  379. package/src/documents/file-system-task-queue.ts +68 -0
  380. package/src/documents/hydranium-text-documents.ts +724 -142
  381. package/src/documents/index.ts +3 -0
  382. package/src/documents/language-client-text-shadow.ts +59 -11
  383. package/src/documents/self-save-registry.ts +52 -13
  384. package/src/index.ts +6 -0
  385. package/src/langium/ast-extension/ast-node-builder.ts +66 -22
  386. package/src/langium/bootstrap.ts +16 -9
  387. package/src/langium/config/configuration-provider.ts +119 -0
  388. package/src/langium/config/index.ts +1 -0
  389. package/src/langium/diagnostics/lsp-logger.ts +41 -6
  390. package/src/langium/document-builder/build-pipeline-integration.ts +50 -5
  391. package/src/langium/document-builder/build-session.ts +87 -0
  392. package/src/langium/document-builder/document-builder.ts +355 -13
  393. package/src/langium/document-builder/index.ts +1 -0
  394. package/src/langium/integration-services.ts +67 -6
  395. package/src/langium/integrity/integrity-rule.ts +13 -5
  396. package/src/langium/integrity/integrity-service.ts +201 -17
  397. package/src/langium/keys/containment.ts +87 -0
  398. package/src/langium/keys/index.ts +1 -0
  399. package/src/langium/keys/name-based-key-provider.ts +4 -0
  400. package/src/langium/language-module.ts +42 -4
  401. package/src/langium/model-service/client-session.ts +581 -0
  402. package/src/langium/model-service/index.ts +1 -0
  403. package/src/langium/model-service/model-service.ts +332 -274
  404. package/src/langium/module.ts +119 -22
  405. package/src/langium/naming/name-provider.ts +27 -5
  406. package/src/langium/naming/name-separator-validation.ts +34 -5
  407. package/src/langium/residency/cst-residency-service.ts +36 -14
  408. package/src/langium/scope/hydranium-scope-provider.ts +60 -22
  409. package/src/langium/serialization/abstract-serializer.ts +13 -32
  410. package/src/langium/service-registry.ts +19 -2
  411. package/src/langium/shared-services.ts +19 -2
  412. package/src/langium/transfer/transfer-encoder.ts +85 -24
  413. package/src/langium/trivia/comment-preserver.ts +1100 -0
  414. package/src/langium/trivia/document-ending-preserver.ts +55 -0
  415. package/src/langium/trivia/index.ts +14 -0
  416. package/src/langium/trivia/trivia-contribution.ts +39 -0
  417. package/src/langium/trivia/trivia-preserver.ts +54 -0
  418. package/src/langium/trivia/trivia-service.ts +99 -0
  419. package/src/langium/update-rewrite/update-rewrite.ts +1 -1
  420. package/src/langium/validation/document-validator.ts +537 -11
  421. package/src/langium/workspace/document-uri-policy.ts +3 -4
  422. package/src/langium/workspace/file-system-provider.ts +48 -8
  423. package/src/langium/workspace/hydranium-langium-document-factory.ts +34 -0
  424. package/src/langium/workspace/hydranium-workspace-manager.ts +30 -1
  425. package/src/langium/workspace/in-memory-file-system-provider.ts +62 -10
  426. package/src/langium/workspace/initialize-workspace.ts +43 -5
  427. package/src/langium/workspace/langium-documents.ts +106 -33
  428. package/src/langium/workspace/virtual-document.ts +21 -3
  429. package/src/langium/workspace/write-lock-scope.ts +1 -1
  430. package/src/locale/index.ts +10 -0
  431. package/src/locale/server-locale.ts +86 -0
  432. package/src/lsp/completion/hydranium-completion-provider.ts +82 -2
  433. package/src/lsp/connection-features.ts +67 -0
  434. package/src/lsp/diagnostics-connection.ts +56 -0
  435. package/src/lsp/hydranium-document-update-handler.ts +152 -79
  436. package/src/lsp/index.ts +3 -1
  437. package/src/lsp/lsp-latency.ts +62 -0
  438. package/src/lsp/semantic-token-provider.ts +74 -7
  439. package/src/lsp/shared-module.ts +4 -8
  440. package/src/lsp/start-language-server.ts +13 -7
  441. package/src/messages/carriers.ts +78 -0
  442. package/src/messages/index.ts +36 -0
  443. package/src/messages/renderer.ts +212 -0
  444. package/src/node/heap-ceiling.ts +108 -0
  445. package/src/node/index.ts +1 -0
  446. package/src/node/latency-from-env.ts +1 -1
  447. package/src/node/measure-memory.ts +1 -0
  448. package/src/node/node-file-system-provider.ts +154 -47
  449. package/src/node/profile-capture.ts +8 -2
  450. package/src/node/profiling-run.ts +3 -3
  451. package/src/node/rename-over-open-readers.ts +78 -0
  452. package/src/node/socket-launcher.ts +18 -2
  453. package/src/testing/fake-document.ts +24 -5
  454. package/src/testing/make-noop-shared-services.ts +50 -2
  455. package/src/testing/make-test-services.ts +99 -24
  456. package/src/testing/node/index.ts +1 -0
  457. package/src/testing/node/lsp-harness.ts +2 -0
  458. package/src/testing/node/lsp-server-connection.ts +61 -11
  459. package/src/testing/node/scratch-workspace.ts +10 -5
  460. package/src/testing/node/spawned-server.ts +35 -1
  461. package/src/testing/node/unhandled-rejections.ts +31 -0
  462. package/src/testing/playwright/flaky-network-proxy.ts +240 -0
  463. package/src/testing/playwright/index.ts +1 -0
  464. package/src/testing/playwright/server-log-capture.ts +24 -5
  465. package/src/testing/playwright/server-log-rename-reporter.ts +12 -1
  466. package/src/testing/run-update-pipeline.ts +4 -4
  467. package/src/testing/stub-ast-document-manager.ts +18 -31
  468. package/src/testing/stub-document-builder.ts +32 -3
  469. package/src/testing/stub-hydranium-text-documents.ts +78 -21
  470. package/src/testing/stub-langium-documents.ts +3 -2
  471. package/src/testing/stub-model-service.ts +9 -8
  472. package/src/util/connection-liveness.ts +37 -14
  473. package/lib/lsp/instrument-connection.d.ts +0 -36
  474. package/lib/lsp/instrument-connection.d.ts.map +0 -1
  475. package/lib/lsp/instrument-connection.js +0 -62
  476. package/lib/lsp/instrument-connection.js.map +0 -1
  477. package/src/lsp/instrument-connection.ts +0 -66
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
+ export * from './containment.js';
9
10
  export * from './element-key-provider.js';
10
11
  export * from './name-based-key-provider.js';
11
12
  export * from './positional-key-provider.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/langium/keys/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/langium/keys/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC"}
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
+ export * from './containment.js';
9
10
  export * from './element-key-provider.js';
10
11
  export * from './name-based-key-provider.js';
11
12
  export * from './positional-key-provider.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/langium/keys/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/langium/keys/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC"}
@@ -53,6 +53,10 @@ import { type NameProvider } from '../naming/name-provider.js';
53
53
  * - After a removal, surviving siblings need their `$containerIndex`
54
54
  * renumbered, or a key derived afterwards addresses the wrong node.
55
55
  *
56
+ * {@link appendChild} and {@link removeChildren} discharge both, and ship
57
+ * beside this provider because the constraint is this provider's rather than
58
+ * any caller's.
59
+ *
56
60
  * Adopters that need insert / delete stability for unnamed types should
57
61
  * give those types a name in the grammar, or bind a key provider whose
58
62
  * fallback is content-derived rather than positional.
@@ -1 +1 @@
1
- {"version":3,"file":"name-based-key-provider.d.ts","sourceRoot":"","sources":["../../../src/langium/keys/name-based-key-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAwB,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;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AW,kBAAkB;IAKzD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB;IAJtD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAC9C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAGZ,QAAQ,EAAE,sBAAsB,EACnD,OAAO,GAAE,cAAmB;IAM/B,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAuBjD;;;;;;;OAOG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAIlE;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAUhD;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;CAMlE"}
@@ -48,6 +48,10 @@ import { resolveElementByScan } from './element-key-provider.js';
48
48
  * - After a removal, surviving siblings need their `$containerIndex`
49
49
  * renumbered, or a key derived afterwards addresses the wrong node.
50
50
  *
51
+ * {@link appendChild} and {@link removeChildren} discharge both, and ship
52
+ * beside this provider because the constraint is this provider's rather than
53
+ * any caller's.
54
+ *
51
55
  * Adopters that need insert / delete stability for unnamed types should
52
56
  * give those types a name in the grammar, or bind a key provider whose
53
57
  * fallback is content-derived rather than positional.
@@ -1 +1 @@
1
- {"version":3,"file":"name-based-key-provider.js","sourceRoot":"","sources":["../../../src/langium/keys/name-based-key-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,OAAO,EAA2B,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAG1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,OAAO,oBAAoB;IAKR;IAJH,YAAY,CAAe;IAC3B,MAAM,CAAS;IAElC,YACsB,QAAgC,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,OAAgB;QACzC,OAAO,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,cAAc,CAAC,IAAa;QACnC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,KAAK,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACO,mBAAmB,CAAC,IAAa;QACxC,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YAC/E,OAAO,SAAS,CAAC;QACpB,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/D,CAAC;CACH"}
1
+ {"version":3,"file":"name-based-key-provider.js","sourceRoot":"","sources":["../../../src/langium/keys/name-based-key-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,OAAO,EAA2B,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAG1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,OAAO,oBAAoB;IAKR;IAJH,YAAY,CAAe;IAC3B,MAAM,CAAS;IAElC,YACsB,QAAgC,EACnD,UAA0B,EAAE;QADT,aAAQ,GAAR,QAAQ,CAAwB;QAGnD,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;QACrD,IAAI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IAC/E,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,cAAc,CAAC,IAAa;QACnC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,KAAK,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACO,mBAAmB,CAAC,IAAa;QACxC,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YAC/E,OAAO,SAAS,CAAC;QACpB,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/D,CAAC;CACH"}
@@ -23,6 +23,8 @@ import { type ReferenceBuilder } from './scope/reference-builder.js';
23
23
  import { type ScopeExtensionContribution } from './scope/scope-extension-contribution.js';
24
24
  import { type ScopeExtensionService } from './scope/scope-extension-service.js';
25
25
  import { type Serializer } from './serialization/serializer.js';
26
+ import { type TriviaContribution } from './trivia/trivia-contribution.js';
27
+ import { type TriviaService } from './trivia/trivia-service.js';
26
28
  import { type UpdateRewriteContribution } from './update-rewrite/update-rewrite-contribution.js';
27
29
  import { type UpdateRewriteService } from './update-rewrite/update-rewrite-service.js';
28
30
  import { type ValidationCheckContribution } from './validation/validation-contribution.js';
@@ -147,7 +149,7 @@ export interface ServerAddedServices {
147
149
  * multi-grammar workspaces route to the right serializer per file. The
148
150
  * framework default throws a clear "no Serializer registered" error;
149
151
  * adopters bind their own per-language subclass to enable
150
- * `ModelService.update` / `ModelService.save`.
152
+ * a client session's `update` / `save`.
151
153
  */
152
154
  Serializer: Serializer;
153
155
  };
@@ -174,10 +176,33 @@ export interface ServerAddedServices {
174
176
  */
175
177
  rules: Record<string, IntegrityRuleContribution>;
176
178
  };
179
+ trivia: {
180
+ /**
181
+ * Runs the registered trivia preservers around a write, so what a
182
+ * document carries that its model does not — its comments, the whitespace
183
+ * it ended with — survives being re-serialized from that model.
184
+ *
185
+ * A separate group from {@link Serializer} because a preserver needs the
186
+ * document being overwritten, which a serializer is never given:
187
+ * `serializeAst` could reach one through its model, but
188
+ * `serializeTransfer` receives a plain wire object with no document at
189
+ * all, so folding this in would carry trivia on one write path and
190
+ * silently not on the other.
191
+ */
192
+ TriviaService: TriviaService;
193
+ /**
194
+ * Declarative {@link TriviaContribution} group. Distinct sub-keys
195
+ * accumulate across framework + adopter modules via Langium's deep-merge;
196
+ * binding one the framework already uses REPLACES it. The framework ships
197
+ * a sub-key per preserver, so an adopter replacing `comments` keeps
198
+ * `documentEnding` and whatever else ships beside it.
199
+ */
200
+ preservers: Record<string, TriviaContribution>;
201
+ };
177
202
  updateRewrite: {
178
203
  /**
179
204
  * Per-language runner for transfer-model rewrites applied on the
180
- * structured write path of `ModelService.update` / `save`, before
205
+ * structured write path of a client session's `update` / `save`, before
181
206
  * serialisation. The RPC-update-stage sibling of the
182
207
  * {@link IntegrityService} / {@link AstExtensionService} registries.
183
208
  * Framework default is a no-op (zero rewrites registered) — adopters
@@ -1 +1 @@
1
- {"version":3,"file":"language-module.d.ts","sourceRoot":"","sources":["../../src/langium/language-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,0C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eG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GACjD,mBAAmB,GAAG;IACnB,MAAM,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEL;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACvC,QAAQ,EAAE,mBAAmB,GAC7B,MAAM,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,mBAAmB,CAAC,CAsE9E"}
@@ -19,16 +19,19 @@ import { HydraniumScopeComputation } from './scope/hydranium-scope-computation.j
19
19
  import { HydraniumScopeProvider } from './scope/hydranium-scope-provider.js';
20
20
  import { DefaultReferenceBuilder } from './scope/reference-builder.js';
21
21
  import { DefaultScopeExtensionService } from './scope/scope-extension-service.js';
22
+ import { DefaultTriviaService } from './trivia/trivia-service.js';
23
+ import { CommentPreserverContribution } from './trivia/comment-preserver.js';
24
+ import { DocumentEndingPreserverContribution } from './trivia/document-ending-preserver.js';
22
25
  import { DefaultUpdateRewriteService } from './update-rewrite/update-rewrite-service.js';
23
26
  import { HydraniumDocumentValidator } from './validation/document-validator.js';
24
27
  import { ValidationContributionCollector } from './validation/validation-contribution-collector.js';
25
28
  /** Framework default — throws when either serializer entry point is invoked without an adopter binding. */
26
29
  class UnboundSerializer {
27
30
  serializeAst(_model) {
28
- throw new Error('No Serializer registered at services.serializer.Serializer — bind a Serializer<TAst, TTransfer> in your per-language module before calling ModelService.update / ModelService.save.');
31
+ throw new Error("No Serializer registered at services.serializer.Serializer — bind a Serializer<TAst, TTransfer> in your per-language module before writing through a client session's update or save.");
29
32
  }
30
33
  serializeTransfer(_model) {
31
- throw new Error('No Serializer registered at services.serializer.Serializer — bind a Serializer<TAst, TTransfer> in your per-language module before calling ModelService.update / ModelService.save.');
34
+ throw new Error("No Serializer registered at services.serializer.Serializer — bind a Serializer<TAst, TTransfer> in your per-language module before writing through a client session's update or save.");
32
35
  }
33
36
  }
34
37
  /**
@@ -69,6 +72,17 @@ export function createServerLanguageModule(_context) {
69
72
  serializer: {
70
73
  Serializer: () => new UnboundSerializer()
71
74
  },
75
+ // Bound with a sub-key per preserver so an adopter can replace one and
76
+ // keep the other. Adopters MUST avoid these two keys for their own
77
+ // contributions unless replacement is what they mean — Langium's
78
+ // deep-merge is last-wins on same-key leaves.
79
+ trivia: {
80
+ TriviaService: services => new DefaultTriviaService(services),
81
+ preservers: {
82
+ comments: services => new CommentPreserverContribution(services),
83
+ documentEnding: () => new DocumentEndingPreserverContribution()
84
+ }
85
+ },
72
86
  // The per-URI serialise / re-parse path only fires when a rule mutates,
73
87
  // so the no-op default is safe even before adopters bind a real
74
88
  // serializer / parser.
@@ -1 +1 @@
1
- {"version":3,"file":"language-module.js","sourceRoot":"","sources":["../../src/langium/language-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,OAAO,EAA4B,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAChH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAAE,uBAAuB,EAAyB,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,EAAE,oBAAoB,EAAsB,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAqB,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAmC,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC7H,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAyB,MAAM,8BAA8B,CAAC;AAE9F,OAAO,EAAE,4BAA4B,EAA8B,MAAM,oCAAoC,CAAC;AAG9G,OAAO,EAAE,2BAA2B,EAA6B,MAAM,4CAA4C,CAA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EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,oBAAoB,CAAC,QAAQ,CAAC;YAC7D,UAAU,EAAE;gBACT,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,4BAA4B,CAAC,QAAQ,CAAC;gBAChE,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,mCAAmC,EAAE;aACjE;SACH;QACD,wEAAwE;QACxE,gEAAgE;QAChE,uBAAuB;QACvB,SAAS,EAAE;YACR,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,uBAAuB,CAAC,QAAQ,CAAC;YACnE,KAAK,EAAE,EAAE;SACX;QACD,aAAa,EAAE;YACZ,oBAAoB,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,2BAA2B,CAAC,QAAQ,CAAC;YAC3E,QAAQ,EAAE,EAAE;SACd;QACD,UAAU,EAAE;YACT,oEAAoE;YACpE,uEAAuE;YACvE,iEAAiE;YACjE,mEAAmE;YACnE,mDAAmD;YACnD,gDAAgD;YAChD,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,0BAA0B,CAAC,QAAQ,CAAC;YACvE,+BAA+B,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,+BAA+B,CAAC,QAAQ,CAAC;YAC1F,MAAM,EAAE;gBACL,yDAAyD;gBACzD,kEAAkE;gBAClE,kEAAkE;gBAClE,kEAAkE;gBAClE,wDAAwD;gBACxD,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,8BAA8B,CAAC,QAAQ,CAAC;aACrE;SACH;KACH,CAAC;AACL,CAAC"}
@@ -0,0 +1,299 @@
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 BasedOn, type MaybeObservableValue, type MaybePromise, ObservableValue, type Tracer, type TransferElement } from '@hydranium/protocol';
10
+ import { type AstNode } from '@hydranium/langium';
11
+ import { type CancellationToken, type Disposable } from 'vscode-languageserver';
12
+ import { type AstDocument } from '../../documents/ast-document-manager.js';
13
+ import { type OpenOptions, type SessionEndCause } from '../../documents/client-session-registry.js';
14
+ import { type LogNameOptions } from '../diagnostics/logger.js';
15
+ import { type ServerSharedServices } from '../module.js';
16
+ import { type AstDiagnostic } from '../validation/document-validator.js';
17
+ import { type ModelService } from './model-service.js';
18
+ /** What a session's `update` and `save` write into one document; the session supplies its own client id. */
19
+ export interface ClientSessionWriteArgs<TTransfer> {
20
+ uri: string;
21
+ /** The whole structured model root, or its serialised textual form. */
22
+ model: TTransfer | string;
23
+ /**
24
+ * The version the write was authored against, or `'anything'` to write
25
+ * unconditionally. Required, so an ungated write is a decision the caller
26
+ * makes rather than a field it forgot.
27
+ */
28
+ basedOn: BasedOn;
29
+ }
30
+ /** What a session's `updateAll` writes, all or none. */
31
+ export interface ClientSessionUpdateAllArgs<TTransfer> {
32
+ updates: ClientSessionWriteArgs<TTransfer>[];
33
+ }
34
+ /**
35
+ * One participant's handle on the documents it works on, started by
36
+ * `ModelService.createSession`.
37
+ *
38
+ * The session writes only what it has open: `update` and `save` fail with
39
+ * `DocumentNotOpenError` unless this session has the URI open when the text is
40
+ * applied, and the check and the apply are one synchronous step, so a write
41
+ * either lands while the document is open or fails. A document stays open until
42
+ * this session closes it, the session ends, or the file is deleted.
43
+ *
44
+ * One open per URI, without reference counting: opening a URI the session
45
+ * already has open changes nothing, and one `close` ends it.
46
+ *
47
+ * After `dispose`, every other member throws `SessionClosedError`
48
+ * synchronously, before returning a promise.
49
+ *
50
+ * Reads need no session and live on `ModelService`.
51
+ */
52
+ export interface ClientSession<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic, TTransfer extends TransferElement = TransferElement, TOpenOptions extends OpenOptions = OpenOptions> {
53
+ /** Unique in the process while the session is live: the author label on its writes and the key of its opens. */
54
+ readonly clientId: string;
55
+ readonly label: string;
56
+ /**
57
+ * Open `uri` for this session, reading it from disk unless some client has
58
+ * it open already or it holds this client's unsaved text within its revert
59
+ * grace. `options` are kept for this open until it closes; a repeat open,
60
+ * concurrent or not, keeps the options of the first.
61
+ */
62
+ open(uri: string, options?: TOpenOptions): Promise<void>;
63
+ /** The options this session opened `uri` with, or `undefined` when it gave none or does not have `uri` open. */
64
+ openOptions(uri: string): TOpenOptions | undefined;
65
+ /**
66
+ * Create a document with `text` and open it for this session. It reaches
67
+ * disk on the first `save`. Fails when the file exists, any client has the
68
+ * URI open, or the URI waits out the revert grace, and of two creates of one
69
+ * URI at most one succeeds.
70
+ */
71
+ create(uri: string, text: string): Promise<void>;
72
+ update(args: ClientSessionWriteArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
73
+ /**
74
+ * Write several documents this session has open, all or none: a
75
+ * `ConflictError` or `DocumentNotOpenError` for any of them is thrown before
76
+ * any text applies. Resolves to the rebuilt documents, in the order given.
77
+ */
78
+ updateAll(args: ClientSessionUpdateAllArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>[]>;
79
+ /** Write `args.model` as {@link update} does, then persist the document. */
80
+ save(args: ClientSessionWriteArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
81
+ /** Close this session's open of `uri`, at once. A no-op when it does not have `uri` open. */
82
+ close(uri: string): Promise<void>;
83
+ /**
84
+ * Open `uri`, run `fn`, and close `uri` when `fn` settles, whether it
85
+ * returned or threw. A URI the session already had open, or is still
86
+ * opening through another call, stays open: the close undoes only the open
87
+ * this call made.
88
+ */
89
+ withOpen<T>(uri: string, fn: () => MaybePromise<T>): Promise<T>;
90
+ /** Whether an event's `sourceClientId` names this session, i.e. the event echoes its own write. */
91
+ isOwnEcho(sourceClientId: string): boolean;
92
+ /**
93
+ * End the session: close everything it has open and free its id.
94
+ * Idempotent. `cause` is `'lost'` when the session ends because its
95
+ * client's connection went away, which lets each document it was the last
96
+ * to have open wait out the store's revert grace; ending it for any other
97
+ * reason reverts such a document at once.
98
+ */
99
+ dispose(cause?: SessionEndCause): void;
100
+ }
101
+ /**
102
+ * The framework's {@link ClientSession}, built by
103
+ * {@link DefaultClientSessionFactory}.
104
+ *
105
+ * Override the protected method behind a member to change how every session
106
+ * writes, and return the subclass from a {@link ClientSessionFactory} bound on
107
+ * `model.ClientSessionFactory`. Serialising a model and rebuilding a document
108
+ * are the {@link ModelService}'s.
109
+ *
110
+ * An override of {@link dispose} calls `super.dispose(cause)`: that is what
111
+ * closes the session's opens and frees its id, and dropping `cause` reverts
112
+ * a lost client's documents without their grace.
113
+ */
114
+ export declare class DefaultClientSession<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic, TTransfer extends TransferElement = TransferElement, TOpenOptions extends OpenOptions = OpenOptions> implements ClientSession<TAst, TDiagnostic, TTransfer, TOpenOptions> {
115
+ protected readonly services: ServerSharedServices;
116
+ protected disposed: boolean;
117
+ /**
118
+ * This session's opens still under way, by canonical URI. Recorded before
119
+ * the first await, so a second open of the same URI joins the first rather
120
+ * than racing it, and `withOpen` can tell an open another call is making.
121
+ */
122
+ protected readonly pendingOpens: Map<string, Promise<void>>;
123
+ /**
124
+ * The options of this session's opens, by canonical URI. A first open
125
+ * records its entry before the store has the URI open, and the entry goes
126
+ * when that open closes, whoever ends it: this session, or the store for a
127
+ * deleted file. A first open that fails never opens, so nothing closes it
128
+ * and its entry stays until the next first open of the URI overwrites it;
129
+ * {@link openOptions} therefore reads an entry only while the store has the
130
+ * URI open for this session.
131
+ */
132
+ protected readonly openOptionsByUri: Map<string, TOpenOptions | undefined>;
133
+ /** Drops an open's options from {@link openOptionsByUri} when the store closes the open. */
134
+ protected readonly closeListener: Disposable;
135
+ /** Logs under `logName`, `ClientSession` when none is given, with this session's id in a bracket of its own, so a line names the session that wrote. */
136
+ protected readonly tracer: Tracer;
137
+ /** The service bound on `model.ModelService`, which serialises and rebuilds for this session. */
138
+ protected readonly modelService: ModelService<TAst, TDiagnostic, TTransfer>;
139
+ /** See {@link ClientSessionFactoryOptions.slowUpdateWarnMs}; `undefined` when not set. */
140
+ protected readonly slowUpdateWarn?: ObservableValue<number>;
141
+ readonly clientId: string;
142
+ readonly label: string;
143
+ constructor(services: ServerSharedServices, options: ClientSessionOptions);
144
+ open(uri: string, options?: TOpenOptions): Promise<void>;
145
+ openOptions(uri: string): TOpenOptions | undefined;
146
+ create(uri: string, text: string): Promise<void>;
147
+ update(args: ClientSessionWriteArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
148
+ updateAll(args: ClientSessionUpdateAllArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>[]>;
149
+ save(args: ClientSessionWriteArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
150
+ close(uri: string): Promise<void>;
151
+ withOpen<T>(uri: string, fn: () => MaybePromise<T>): Promise<T>;
152
+ isOwnEcho(sourceClientId: string): boolean;
153
+ dispose(cause?: SessionEndCause): void;
154
+ protected assertLive(): void;
155
+ /** Throw `DocumentNotOpenError` unless this session has `uri` open. */
156
+ protected assertOpen(uri: string): void;
157
+ /**
158
+ * Throw `ConflictError` when `basedOn` names a version other than
159
+ * `currentVersion`. A write calls it at the door and again in the
160
+ * synchronous step that applies the text, and has to call it synchronously
161
+ * there: a check separated from the apply by an await lets two writes based
162
+ * on one version both apply.
163
+ */
164
+ protected assertBasedOn(uri: string, basedOn: BasedOn, currentVersion: number): void;
165
+ /**
166
+ * Serialise `args.model`, apply it to the store under this session's id,
167
+ * rebuild, and resolve to the rebuilt document.
168
+ *
169
+ * The open check and the `basedOn` gate run at the door, so a write that
170
+ * cannot land is refused before any adopter serialiser runs, and again in
171
+ * the synchronous step that applies the text: made only before the
172
+ * serialiser's await, a close during it lets the write land on a document
173
+ * this session no longer has open, and two writes based on one version
174
+ * both apply.
175
+ *
176
+ * Resolves with the latest build of the document, which may already carry
177
+ * a newer write; that is logged at debug, and a slow update at warn when
178
+ * `ClientSessionFactoryOptions.slowUpdateWarnMs` is set.
179
+ */
180
+ protected updateDocument(args: ClientSessionWriteArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
181
+ /**
182
+ * Write every document of `args.updates`, all or none: every model is
183
+ * serialised first, then every open check and `basedOn` gate runs and every
184
+ * text is applied in one synchronous step. Checked at the door as well, so
185
+ * a stale set is refused before any adopter serialiser runs.
186
+ *
187
+ * The apply step relies on `AstDocumentManager.update` applying its text
188
+ * before its first await, as the default does: an override that awaits first
189
+ * lets another write land between two documents of the set.
190
+ */
191
+ protected updateDocuments(args: ClientSessionUpdateAllArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>[]>;
192
+ /**
193
+ * Write `args.model` through {@link updateDocument}, so an override of it
194
+ * applies to saves too, then persist the document.
195
+ *
196
+ * Fails with `DocumentNotOpenError` and writes nothing when this session
197
+ * closes the URI while the text is being built: the check sits in the same
198
+ * synchronous step as the manager taking the text. Checked any earlier, a
199
+ * session that closes the URI during the rebuild still has the shared
200
+ * text, other clients' edits included, written in its name. Once taken,
201
+ * the write completes whatever the session does next.
202
+ */
203
+ protected saveDocument(args: ClientSessionWriteArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
204
+ protected closeDocument(uri: string): Promise<void>;
205
+ /** Open `uri`, or join the open of it this session already has under way, whose options then stand. */
206
+ protected openDocument(uri: string, options: TOpenOptions | undefined): Promise<void>;
207
+ /**
208
+ * Open `uri` in the store for this session. The open path does not thread
209
+ * cancellation: the file read behind it takes no token, so a cancelled
210
+ * caller still completes the open.
211
+ *
212
+ * A first open records its options before the store opens the URI, so a
213
+ * listener of the store's open reads this open's options rather than an
214
+ * earlier one's.
215
+ */
216
+ protected registerOpen(uri: string, options: TOpenOptions | undefined): Promise<void>;
217
+ protected canonicalKey(uri: string): string;
218
+ protected createDocument(uri: string, text: string): Promise<void>;
219
+ protected runWithOpen<T>(uri: string, fn: () => MaybePromise<T>): Promise<T>;
220
+ /**
221
+ * Undo an open that completed after the session ended, then fail it.
222
+ *
223
+ * Ending the session closed only what it had open at that moment. An open
224
+ * still reading from disk registers afterwards, under an id that is no
225
+ * longer a session, and nothing would ever close it.
226
+ *
227
+ * Opens are keyed by id, so once a new session holds the same id this open
228
+ * is indistinguishable from one of its own, and closing it would close the
229
+ * new session's. It is left to that session, which releases it at its end.
230
+ */
231
+ protected rejectIfEnded(uri: string, wasOpen: boolean): Promise<void>;
232
+ }
233
+ /** Constructor options for {@link DefaultClientSessionFactory}. */
234
+ export interface ClientSessionFactoryOptions extends LogNameOptions {
235
+ /**
236
+ * The name the factory and every session it builds log under, so one
237
+ * option renames both. Default: `ClientSessionFactory` for the factory,
238
+ * and `ClientSession` for a session, which adds its client id in a bracket
239
+ * of its own.
240
+ */
241
+ readonly logName?: string;
242
+ /**
243
+ * When set, a session's `update` logs a `warn` line if its end-to-end wait
244
+ * (serialise, apply, rebuild) takes at least this many milliseconds. Default
245
+ * `undefined`: no warn line, and no per-update stopwatch.
246
+ *
247
+ * Observability only: the update is neither aborted nor resolved
248
+ * differently. A hard timeout that throws is an override of
249
+ * `DefaultClientSession.updateDocument` racing the parent call against a
250
+ * deadline.
251
+ *
252
+ * A recommended starting threshold is 2-5 seconds; workspaces with very
253
+ * large documents or slow validation can exceed 5 s on a cold build. A
254
+ * `Settings.number` binding retunes it live.
255
+ */
256
+ readonly slowUpdateWarnMs?: MaybeObservableValue<number>;
257
+ }
258
+ /**
259
+ * Constructor options for {@link DefaultClientSession}: the factory's options,
260
+ * which it forwards, plus the session's identity.
261
+ */
262
+ export interface ClientSessionOptions extends ClientSessionFactoryOptions {
263
+ readonly clientId: string;
264
+ /** What the session is. Pass one: the client id stands in for it otherwise. */
265
+ readonly label?: string;
266
+ }
267
+ /**
268
+ * Builds the handle for a session `ModelService.createSession` has already
269
+ * registered, so registration and the uniqueness check cannot be skipped by
270
+ * binding a factory of one's own. Bind one on `model.ClientSessionFactory` to
271
+ * use a session class of your own. A factory that does not pass
272
+ * {@link ClientSessionFactoryOptions.slowUpdateWarnMs} on to its sessions
273
+ * loses their slow-update warn; subclassing {@link DefaultClientSessionFactory}
274
+ * keeps it.
275
+ *
276
+ * Typed for every grammar, since the slot is shared: `createSession` narrows
277
+ * the result to its caller's types.
278
+ */
279
+ export interface ClientSessionFactory {
280
+ create(clientId: string, label: string): ClientSession<AstNode>;
281
+ }
282
+ /**
283
+ * The framework's {@link ClientSessionFactory}: a {@link DefaultClientSession}
284
+ * over the {@link ModelService} bound on `model.ModelService`, which the session
285
+ * serialises and rebuilds through. A model service constructed outside that
286
+ * slot therefore starts sessions that write through the bound one.
287
+ *
288
+ * A subclass that overrides {@link create} to build a session class of its
289
+ * own passes {@link options} on to that session's constructor; a session built
290
+ * without them has no slow-update warn and logs under the default name.
291
+ */
292
+ export declare class DefaultClientSessionFactory implements ClientSessionFactory {
293
+ protected readonly services: ServerSharedServices;
294
+ protected readonly options: ClientSessionFactoryOptions;
295
+ protected readonly tracer: Tracer;
296
+ constructor(services: ServerSharedServices, options?: ClientSessionFactoryOptions);
297
+ create(clientId: string, label: string): ClientSession<AstNode>;
298
+ }
299
+ //# sourceMappingURL=client-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-session.d.ts","sourceRoot":"","sources":["../../../src/langium/model-service/client-session.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,OAAO,EAIZ,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,eAAe,EACf,KAAK,MAAM,EACX,KAAK,eAAe,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,OAAO,EAAY,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,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