@hydranium/core 1.0.0-next.36 → 1.0.0-next.361

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 (794) hide show
  1. package/README.md +78 -82
  2. package/lib/browser/host-heads-in-worker.d.ts +77 -0
  3. package/lib/browser/host-heads-in-worker.d.ts.map +1 -0
  4. package/lib/browser/host-heads-in-worker.js +169 -0
  5. package/lib/browser/host-heads-in-worker.js.map +1 -0
  6. package/lib/browser/index.d.ts +12 -0
  7. package/lib/browser/index.d.ts.map +1 -0
  8. package/lib/browser/index.js +17 -0
  9. package/lib/browser/index.js.map +1 -0
  10. package/lib/browser/indexeddb-file-system-store.d.ts +82 -0
  11. package/lib/browser/indexeddb-file-system-store.d.ts.map +1 -0
  12. package/lib/browser/indexeddb-file-system-store.js +181 -0
  13. package/lib/browser/indexeddb-file-system-store.js.map +1 -0
  14. package/lib/browser/start-language-server-in-worker.d.ts +32 -0
  15. package/lib/browser/start-language-server-in-worker.d.ts.map +1 -0
  16. package/lib/browser/start-language-server-in-worker.js +40 -0
  17. package/lib/browser/start-language-server-in-worker.js.map +1 -0
  18. package/lib/documents/ast-document-manager.d.ts +266 -124
  19. package/lib/documents/ast-document-manager.d.ts.map +1 -1
  20. package/lib/documents/ast-document-manager.js +293 -132
  21. package/lib/documents/ast-document-manager.js.map +1 -1
  22. package/lib/documents/client-ids.d.ts +5 -19
  23. package/lib/documents/client-ids.d.ts.map +1 -1
  24. package/lib/documents/client-ids.js +5 -19
  25. package/lib/documents/client-ids.js.map +1 -1
  26. package/lib/documents/client-session-errors.d.ts +15 -0
  27. package/lib/documents/client-session-errors.d.ts.map +1 -0
  28. package/lib/documents/client-session-errors.js +15 -0
  29. package/lib/documents/client-session-errors.js.map +1 -0
  30. package/lib/documents/client-session-registry.d.ts +146 -0
  31. package/lib/documents/client-session-registry.d.ts.map +1 -0
  32. package/lib/documents/client-session-registry.js +207 -0
  33. package/lib/documents/client-session-registry.js.map +1 -0
  34. package/lib/documents/dirty-state-tracker.d.ts +101 -0
  35. package/lib/documents/dirty-state-tracker.d.ts.map +1 -0
  36. package/lib/documents/dirty-state-tracker.js +85 -0
  37. package/lib/documents/dirty-state-tracker.js.map +1 -0
  38. package/lib/documents/document-release-handler.d.ts +204 -0
  39. package/lib/documents/document-release-handler.d.ts.map +1 -0
  40. package/lib/documents/document-release-handler.js +317 -0
  41. package/lib/documents/document-release-handler.js.map +1 -0
  42. package/lib/documents/document-release-scheduler.d.ts +67 -0
  43. package/lib/documents/document-release-scheduler.d.ts.map +1 -0
  44. package/lib/documents/document-release-scheduler.js +80 -0
  45. package/lib/documents/document-release-scheduler.js.map +1 -0
  46. package/lib/documents/file-system-task-queue.d.ts +52 -0
  47. package/lib/documents/file-system-task-queue.d.ts.map +1 -0
  48. package/lib/documents/file-system-task-queue.js +37 -0
  49. package/lib/documents/file-system-task-queue.js.map +1 -0
  50. package/lib/documents/hydranium-text-documents.d.ts +445 -282
  51. package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
  52. package/lib/documents/hydranium-text-documents.js +903 -483
  53. package/lib/documents/hydranium-text-documents.js.map +1 -1
  54. package/lib/documents/index.d.ts +10 -2
  55. package/lib/documents/index.d.ts.map +1 -1
  56. package/lib/documents/index.js +10 -2
  57. package/lib/documents/index.js.map +1 -1
  58. package/lib/documents/language-client-shadow.d.ts +234 -0
  59. package/lib/documents/language-client-shadow.d.ts.map +1 -0
  60. package/lib/documents/language-client-shadow.js +306 -0
  61. package/lib/documents/language-client-shadow.js.map +1 -0
  62. package/lib/documents/model-ledger.d.ts +47 -0
  63. package/lib/documents/model-ledger.d.ts.map +1 -0
  64. package/lib/documents/model-ledger.js +30 -0
  65. package/lib/documents/model-ledger.js.map +1 -0
  66. package/lib/documents/text-ledger.d.ts +64 -0
  67. package/lib/documents/text-ledger.d.ts.map +1 -0
  68. package/lib/documents/text-ledger.js +63 -0
  69. package/lib/documents/text-ledger.js.map +1 -0
  70. package/lib/documents/version-sync-service.d.ts +138 -0
  71. package/lib/documents/version-sync-service.d.ts.map +1 -0
  72. package/lib/documents/version-sync-service.js +173 -0
  73. package/lib/documents/version-sync-service.js.map +1 -0
  74. package/lib/index.d.ts +4 -0
  75. package/lib/index.d.ts.map +1 -1
  76. package/lib/index.js +7 -0
  77. package/lib/index.js.map +1 -1
  78. package/lib/langium/ast-extension/ast-extension-service.d.ts +42 -31
  79. package/lib/langium/ast-extension/ast-extension-service.d.ts.map +1 -1
  80. package/lib/langium/ast-extension/ast-extension-service.js +45 -19
  81. package/lib/langium/ast-extension/ast-extension-service.js.map +1 -1
  82. package/lib/langium/ast-extension/ast-node-builder.d.ts +12 -7
  83. package/lib/langium/ast-extension/ast-node-builder.d.ts.map +1 -1
  84. package/lib/langium/ast-extension/ast-node-builder.js +25 -9
  85. package/lib/langium/ast-extension/ast-node-builder.js.map +1 -1
  86. package/lib/langium/bootstrap.d.ts +49 -36
  87. package/lib/langium/bootstrap.d.ts.map +1 -1
  88. package/lib/langium/bootstrap.js +83 -44
  89. package/lib/langium/bootstrap.js.map +1 -1
  90. package/lib/langium/build-phase-pass/build-phase-pass-service.d.ts +9 -9
  91. package/lib/langium/build-phase-pass/build-phase-pass-service.d.ts.map +1 -1
  92. package/lib/langium/build-phase-pass/build-phase-pass-service.js +25 -16
  93. package/lib/langium/build-phase-pass/build-phase-pass-service.js.map +1 -1
  94. package/lib/langium/build-phase-pass/build-phase-pass.d.ts +20 -8
  95. package/lib/langium/build-phase-pass/build-phase-pass.d.ts.map +1 -1
  96. package/lib/langium/build-phase-pass/build-phase-pass.js +20 -0
  97. package/lib/langium/build-phase-pass/build-phase-pass.js.map +1 -1
  98. package/lib/langium/composite-ast-reflection.d.ts +46 -0
  99. package/lib/langium/composite-ast-reflection.d.ts.map +1 -0
  100. package/lib/langium/composite-ast-reflection.js +97 -0
  101. package/lib/langium/composite-ast-reflection.js.map +1 -0
  102. package/lib/langium/config/configuration-provider.d.ts +81 -0
  103. package/lib/langium/config/configuration-provider.d.ts.map +1 -0
  104. package/lib/langium/config/configuration-provider.js +112 -0
  105. package/lib/langium/config/configuration-provider.js.map +1 -0
  106. package/lib/langium/config/index.d.ts +1 -0
  107. package/lib/langium/config/index.d.ts.map +1 -1
  108. package/lib/langium/config/index.js +1 -0
  109. package/lib/langium/config/index.js.map +1 -1
  110. package/lib/langium/config/settings.js.map +1 -1
  111. package/lib/langium/diagnostics/console-tee.d.ts +27 -0
  112. package/lib/langium/diagnostics/console-tee.d.ts.map +1 -0
  113. package/lib/langium/diagnostics/console-tee.js +141 -0
  114. package/lib/langium/diagnostics/console-tee.js.map +1 -0
  115. package/lib/langium/diagnostics/hydranium-langium-profiler.d.ts +9 -20
  116. package/lib/langium/diagnostics/hydranium-langium-profiler.d.ts.map +1 -1
  117. package/lib/langium/diagnostics/hydranium-langium-profiler.js +15 -24
  118. package/lib/langium/diagnostics/hydranium-langium-profiler.js.map +1 -1
  119. package/lib/langium/diagnostics/log-preamble.js +1 -1
  120. package/lib/langium/diagnostics/log-preamble.js.map +1 -1
  121. package/lib/langium/diagnostics/logger.d.ts +25 -6
  122. package/lib/langium/diagnostics/logger.d.ts.map +1 -1
  123. package/lib/langium/diagnostics/logger.js +49 -17
  124. package/lib/langium/diagnostics/logger.js.map +1 -1
  125. package/lib/langium/diagnostics/lsp-logger.d.ts +25 -0
  126. package/lib/langium/diagnostics/lsp-logger.d.ts.map +1 -1
  127. package/lib/langium/diagnostics/lsp-logger.js +81 -46
  128. package/lib/langium/diagnostics/lsp-logger.js.map +1 -1
  129. package/lib/langium/diagnostics/server-tracer.d.ts.map +1 -1
  130. package/lib/langium/diagnostics/server-tracer.js.map +1 -1
  131. package/lib/langium/document-builder/build-pipeline-integration.d.ts +34 -2
  132. package/lib/langium/document-builder/build-pipeline-integration.d.ts.map +1 -1
  133. package/lib/langium/document-builder/build-pipeline-integration.js +44 -31
  134. package/lib/langium/document-builder/build-pipeline-integration.js.map +1 -1
  135. package/lib/langium/document-builder/build-session.d.ts +6 -5
  136. package/lib/langium/document-builder/build-session.d.ts.map +1 -1
  137. package/lib/langium/document-builder/build-session.js +5 -5
  138. package/lib/langium/document-builder/build-session.js.map +1 -1
  139. package/lib/langium/document-builder/document-builder.d.ts +310 -41
  140. package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
  141. package/lib/langium/document-builder/document-builder.js +490 -79
  142. package/lib/langium/document-builder/document-builder.js.map +1 -1
  143. package/lib/langium/documentation/comment-provider.d.ts.map +1 -1
  144. package/lib/langium/documentation/comment-provider.js.map +1 -1
  145. package/lib/langium/integration-services.d.ts +40 -24
  146. package/lib/langium/integration-services.d.ts.map +1 -1
  147. package/lib/langium/integration-services.js +7 -4
  148. package/lib/langium/integration-services.js.map +1 -1
  149. package/lib/langium/integrity/integrity-rule.d.ts +17 -8
  150. package/lib/langium/integrity/integrity-rule.d.ts.map +1 -1
  151. package/lib/langium/integrity/integrity-rule.js.map +1 -1
  152. package/lib/langium/integrity/integrity-service.d.ts +95 -27
  153. package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
  154. package/lib/langium/integrity/integrity-service.js +303 -63
  155. package/lib/langium/integrity/integrity-service.js.map +1 -1
  156. package/lib/langium/keys/containment.d.ts +3 -2
  157. package/lib/langium/keys/containment.d.ts.map +1 -1
  158. package/lib/langium/keys/containment.js.map +1 -1
  159. package/lib/langium/keys/name-based-key-provider.d.ts +17 -10
  160. package/lib/langium/keys/name-based-key-provider.d.ts.map +1 -1
  161. package/lib/langium/keys/name-based-key-provider.js +24 -12
  162. package/lib/langium/keys/name-based-key-provider.js.map +1 -1
  163. package/lib/langium/keys/positional-key-provider.d.ts.map +1 -1
  164. package/lib/langium/keys/positional-key-provider.js.map +1 -1
  165. package/lib/langium/labeling/label-provider.d.ts.map +1 -1
  166. package/lib/langium/labeling/label-provider.js.map +1 -1
  167. package/lib/langium/language-module.d.ts +30 -5
  168. package/lib/langium/language-module.d.ts.map +1 -1
  169. package/lib/langium/language-module.js +21 -5
  170. package/lib/langium/language-module.js.map +1 -1
  171. package/lib/langium/model-service/client-session.d.ts +383 -0
  172. package/lib/langium/model-service/client-session.d.ts.map +1 -0
  173. package/lib/langium/model-service/client-session.js +455 -0
  174. package/lib/langium/model-service/client-session.js.map +1 -0
  175. package/lib/langium/model-service/index.d.ts +2 -0
  176. package/lib/langium/model-service/index.d.ts.map +1 -1
  177. package/lib/langium/model-service/index.js +2 -0
  178. package/lib/langium/model-service/index.js.map +1 -1
  179. package/lib/langium/model-service/model-events.d.ts +66 -0
  180. package/lib/langium/model-service/model-events.d.ts.map +1 -0
  181. package/lib/langium/model-service/model-events.js +10 -0
  182. package/lib/langium/model-service/model-events.js.map +1 -0
  183. package/lib/langium/model-service/model-service.d.ts +476 -300
  184. package/lib/langium/model-service/model-service.d.ts.map +1 -1
  185. package/lib/langium/model-service/model-service.js +602 -466
  186. package/lib/langium/model-service/model-service.js.map +1 -1
  187. package/lib/langium/module.d.ts +141 -40
  188. package/lib/langium/module.d.ts.map +1 -1
  189. package/lib/langium/module.js +52 -40
  190. package/lib/langium/module.js.map +1 -1
  191. package/lib/langium/naming/name-provider.d.ts +32 -7
  192. package/lib/langium/naming/name-provider.d.ts.map +1 -1
  193. package/lib/langium/naming/name-provider.js +10 -4
  194. package/lib/langium/naming/name-provider.js.map +1 -1
  195. package/lib/langium/naming/name-separator-validation.d.ts.map +1 -1
  196. package/lib/langium/project/abstract-project-manager.d.ts.map +1 -1
  197. package/lib/langium/project/abstract-project-manager.js +13 -6
  198. package/lib/langium/project/abstract-project-manager.js.map +1 -1
  199. package/lib/langium/project/project-change-event.d.ts +2 -2
  200. package/lib/langium/project/single-project-manager.d.ts.map +1 -1
  201. package/lib/langium/project/single-project-manager.js.map +1 -1
  202. package/lib/langium/residency/cst-residency-service.d.ts +40 -14
  203. package/lib/langium/residency/cst-residency-service.d.ts.map +1 -1
  204. package/lib/langium/residency/cst-residency-service.js +27 -58
  205. package/lib/langium/residency/cst-residency-service.js.map +1 -1
  206. package/lib/langium/scope/ast-node-description-provider.d.ts +46 -10
  207. package/lib/langium/scope/ast-node-description-provider.d.ts.map +1 -1
  208. package/lib/langium/scope/ast-node-description-provider.js +88 -15
  209. package/lib/langium/scope/ast-node-description-provider.js.map +1 -1
  210. package/lib/langium/scope/built-local-symbols.d.ts +12 -0
  211. package/lib/langium/scope/built-local-symbols.d.ts.map +1 -0
  212. package/lib/langium/scope/built-local-symbols.js +11 -0
  213. package/lib/langium/scope/built-local-symbols.js.map +1 -0
  214. package/lib/langium/scope/fallback-scope.d.ts +27 -0
  215. package/lib/langium/scope/fallback-scope.d.ts.map +1 -0
  216. package/lib/langium/scope/fallback-scope.js +35 -0
  217. package/lib/langium/scope/fallback-scope.js.map +1 -0
  218. package/lib/langium/scope/hydranium-scope-computation.d.ts +21 -18
  219. package/lib/langium/scope/hydranium-scope-computation.d.ts.map +1 -1
  220. package/lib/langium/scope/hydranium-scope-computation.js +38 -39
  221. package/lib/langium/scope/hydranium-scope-computation.js.map +1 -1
  222. package/lib/langium/scope/hydranium-scope-provider.d.ts +122 -32
  223. package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
  224. package/lib/langium/scope/hydranium-scope-provider.js +217 -39
  225. package/lib/langium/scope/hydranium-scope-provider.js.map +1 -1
  226. package/lib/langium/scope/index.d.ts +1 -0
  227. package/lib/langium/scope/index.d.ts.map +1 -1
  228. package/lib/langium/scope/index.js +1 -0
  229. package/lib/langium/scope/index.js.map +1 -1
  230. package/lib/langium/scope/reference-builder.d.ts.map +1 -1
  231. package/lib/langium/scope/reference-builder.js.map +1 -1
  232. package/lib/langium/scope/reference-candidate-provider.d.ts +6 -5
  233. package/lib/langium/scope/reference-candidate-provider.d.ts.map +1 -1
  234. package/lib/langium/scope/reference-candidate-provider.js +3 -2
  235. package/lib/langium/scope/reference-candidate-provider.js.map +1 -1
  236. package/lib/langium/scope/scope-extension-service.d.ts +69 -37
  237. package/lib/langium/scope/scope-extension-service.d.ts.map +1 -1
  238. package/lib/langium/scope/scope-extension-service.js +102 -29
  239. package/lib/langium/scope/scope-extension-service.js.map +1 -1
  240. package/lib/langium/scope/scoped-ast-node-description.d.ts +1 -3
  241. package/lib/langium/scope/scoped-ast-node-description.d.ts.map +1 -1
  242. package/lib/langium/scope/scoped-ast-node-description.js +1 -3
  243. package/lib/langium/scope/scoped-ast-node-description.js.map +1 -1
  244. package/lib/langium/serialization/abstract-serializer.d.ts +38 -27
  245. package/lib/langium/serialization/abstract-serializer.d.ts.map +1 -1
  246. package/lib/langium/serialization/abstract-serializer.js +54 -30
  247. package/lib/langium/serialization/abstract-serializer.js.map +1 -1
  248. package/lib/langium/serialization/json-serializer.d.ts +8 -1
  249. package/lib/langium/serialization/json-serializer.d.ts.map +1 -1
  250. package/lib/langium/serialization/json-serializer.js +13 -3
  251. package/lib/langium/serialization/json-serializer.js.map +1 -1
  252. package/lib/langium/serialization/serializer.d.ts +1 -1
  253. package/lib/langium/serialization/yaml-serializer.d.ts +12 -0
  254. package/lib/langium/serialization/yaml-serializer.d.ts.map +1 -1
  255. package/lib/langium/serialization/yaml-serializer.js +24 -4
  256. package/lib/langium/serialization/yaml-serializer.js.map +1 -1
  257. package/lib/langium/service-registry.d.ts +29 -1
  258. package/lib/langium/service-registry.d.ts.map +1 -1
  259. package/lib/langium/service-registry.js +37 -0
  260. package/lib/langium/service-registry.js.map +1 -1
  261. package/lib/langium/shared-services.d.ts +13 -7
  262. package/lib/langium/shared-services.d.ts.map +1 -1
  263. package/lib/langium/shared-services.js.map +1 -1
  264. package/lib/langium/single-langium-copy.d.ts +22 -0
  265. package/lib/langium/single-langium-copy.d.ts.map +1 -0
  266. package/lib/langium/single-langium-copy.js +36 -0
  267. package/lib/langium/single-langium-copy.js.map +1 -0
  268. package/lib/langium/transfer/transfer-encoder.d.ts +86 -37
  269. package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -1
  270. package/lib/langium/transfer/transfer-encoder.js +36 -25
  271. package/lib/langium/transfer/transfer-encoder.js.map +1 -1
  272. package/lib/langium/trivia/comment-preserver.d.ts +543 -0
  273. package/lib/langium/trivia/comment-preserver.d.ts.map +1 -0
  274. package/lib/langium/trivia/comment-preserver.js +1164 -0
  275. package/lib/langium/trivia/comment-preserver.js.map +1 -0
  276. package/lib/langium/trivia/document-ending-preserver.d.ts +51 -0
  277. package/lib/langium/trivia/document-ending-preserver.d.ts.map +1 -0
  278. package/lib/langium/trivia/document-ending-preserver.js +62 -0
  279. package/lib/langium/trivia/document-ending-preserver.js.map +1 -0
  280. package/lib/langium/trivia/index.d.ts +14 -0
  281. package/lib/langium/trivia/index.d.ts.map +1 -0
  282. package/lib/langium/trivia/index.js +14 -0
  283. package/lib/langium/trivia/index.js.map +1 -0
  284. package/lib/langium/trivia/trivia-contribution.d.ts +37 -0
  285. package/lib/langium/trivia/trivia-contribution.d.ts.map +1 -0
  286. package/lib/langium/trivia/trivia-contribution.js +10 -0
  287. package/lib/langium/trivia/trivia-contribution.js.map +1 -0
  288. package/lib/langium/trivia/trivia-preserver.d.ts +52 -0
  289. package/lib/langium/trivia/trivia-preserver.d.ts.map +1 -0
  290. package/lib/langium/trivia/trivia-preserver.js +10 -0
  291. package/lib/langium/trivia/trivia-preserver.js.map +1 -0
  292. package/lib/langium/trivia/trivia-service.d.ts +70 -0
  293. package/lib/langium/trivia/trivia-service.d.ts.map +1 -0
  294. package/lib/langium/trivia/trivia-service.js +56 -0
  295. package/lib/langium/trivia/trivia-service.js.map +1 -0
  296. package/lib/langium/update-rewrite/normalize-empty-strings.d.ts.map +1 -1
  297. package/lib/langium/update-rewrite/update-rewrite-service.d.ts +1 -1
  298. package/lib/langium/update-rewrite/update-rewrite-service.d.ts.map +1 -1
  299. package/lib/langium/update-rewrite/update-rewrite-service.js.map +1 -1
  300. package/lib/langium/update-rewrite/update-rewrite.d.ts +1 -1
  301. package/lib/langium/validation/document-validator.d.ts +168 -23
  302. package/lib/langium/validation/document-validator.d.ts.map +1 -1
  303. package/lib/langium/validation/document-validator.js +264 -26
  304. package/lib/langium/validation/document-validator.js.map +1 -1
  305. package/lib/langium/validation/validation-contribution-collector.d.ts +9 -1
  306. package/lib/langium/validation/validation-contribution-collector.d.ts.map +1 -1
  307. package/lib/langium/validation/validation-contribution-collector.js +1 -1
  308. package/lib/langium/validation/validation-contribution-collector.js.map +1 -1
  309. package/lib/langium/workspace/ast-node-locator.d.ts +24 -0
  310. package/lib/langium/workspace/ast-node-locator.d.ts.map +1 -0
  311. package/lib/langium/workspace/ast-node-locator.js +32 -0
  312. package/lib/langium/workspace/ast-node-locator.js.map +1 -0
  313. package/lib/langium/workspace/document-uri-policy.d.ts +24 -15
  314. package/lib/langium/workspace/document-uri-policy.d.ts.map +1 -1
  315. package/lib/langium/workspace/document-uri-policy.js +22 -13
  316. package/lib/langium/workspace/document-uri-policy.js.map +1 -1
  317. package/lib/langium/workspace/file-not-found.d.ts +23 -0
  318. package/lib/langium/workspace/file-not-found.d.ts.map +1 -0
  319. package/lib/langium/workspace/file-not-found.js +31 -0
  320. package/lib/langium/workspace/file-not-found.js.map +1 -0
  321. package/lib/langium/workspace/file-system-provider.d.ts +167 -8
  322. package/lib/langium/workspace/file-system-provider.d.ts.map +1 -1
  323. package/lib/langium/workspace/file-system-provider.js +115 -13
  324. package/lib/langium/workspace/file-system-provider.js.map +1 -1
  325. package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +31 -1
  326. package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
  327. package/lib/langium/workspace/hydranium-langium-document-factory.js +54 -0
  328. package/lib/langium/workspace/hydranium-langium-document-factory.js.map +1 -1
  329. package/lib/langium/workspace/hydranium-workspace-lock.d.ts +43 -1
  330. package/lib/langium/workspace/hydranium-workspace-lock.d.ts.map +1 -1
  331. package/lib/langium/workspace/hydranium-workspace-lock.js +58 -1
  332. package/lib/langium/workspace/hydranium-workspace-lock.js.map +1 -1
  333. package/lib/langium/workspace/hydranium-workspace-manager.d.ts +103 -21
  334. package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
  335. package/lib/langium/workspace/hydranium-workspace-manager.js +184 -31
  336. package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -1
  337. package/lib/langium/workspace/in-memory-file-system-provider.d.ts +26 -9
  338. package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -1
  339. package/lib/langium/workspace/in-memory-file-system-provider.js +45 -22
  340. package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -1
  341. package/lib/langium/workspace/index-manager.d.ts.map +1 -1
  342. package/lib/langium/workspace/index-manager.js.map +1 -1
  343. package/lib/langium/workspace/index.d.ts +2 -0
  344. package/lib/langium/workspace/index.d.ts.map +1 -1
  345. package/lib/langium/workspace/index.js +2 -0
  346. package/lib/langium/workspace/index.js.map +1 -1
  347. package/lib/langium/workspace/initialize-workspace.d.ts +40 -3
  348. package/lib/langium/workspace/initialize-workspace.d.ts.map +1 -1
  349. package/lib/langium/workspace/initialize-workspace.js +68 -3
  350. package/lib/langium/workspace/initialize-workspace.js.map +1 -1
  351. package/lib/langium/workspace/langium-documents.d.ts +7 -0
  352. package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
  353. package/lib/langium/workspace/langium-documents.js +18 -1
  354. package/lib/langium/workspace/langium-documents.js.map +1 -1
  355. package/lib/langium/workspace/persistent-file-system-provider.d.ts +16 -10
  356. package/lib/langium/workspace/persistent-file-system-provider.d.ts.map +1 -1
  357. package/lib/langium/workspace/persistent-file-system-provider.js +25 -13
  358. package/lib/langium/workspace/persistent-file-system-provider.js.map +1 -1
  359. package/lib/langium/workspace/self-save-registry.d.ts +84 -0
  360. package/lib/langium/workspace/self-save-registry.d.ts.map +1 -0
  361. package/lib/{documents → langium/workspace}/self-save-registry.js +33 -22
  362. package/lib/langium/workspace/self-save-registry.js.map +1 -0
  363. package/lib/langium/workspace/virtual-document.d.ts +55 -21
  364. package/lib/langium/workspace/virtual-document.d.ts.map +1 -1
  365. package/lib/langium/workspace/virtual-document.js +87 -24
  366. package/lib/langium/workspace/virtual-document.js.map +1 -1
  367. package/lib/langium/workspace/write-lock-scope.d.ts +22 -10
  368. package/lib/langium/workspace/write-lock-scope.d.ts.map +1 -1
  369. package/lib/langium/workspace/write-lock-scope.js +15 -5
  370. package/lib/langium/workspace/write-lock-scope.js.map +1 -1
  371. package/lib/launcher/integrated-server.d.ts +3 -1
  372. package/lib/launcher/integrated-server.d.ts.map +1 -1
  373. package/lib/locale/server-locale.d.ts +19 -5
  374. package/lib/locale/server-locale.d.ts.map +1 -1
  375. package/lib/locale/server-locale.js +1 -1
  376. package/lib/locale/server-locale.js.map +1 -1
  377. package/lib/lsp/completion/hydranium-completion-provider.d.ts +44 -2
  378. package/lib/lsp/completion/hydranium-completion-provider.d.ts.map +1 -1
  379. package/lib/lsp/completion/hydranium-completion-provider.js +68 -0
  380. package/lib/lsp/completion/hydranium-completion-provider.js.map +1 -1
  381. package/lib/lsp/connection-features.d.ts +23 -0
  382. package/lib/lsp/connection-features.d.ts.map +1 -0
  383. package/lib/lsp/connection-features.js +60 -0
  384. package/lib/lsp/connection-features.js.map +1 -0
  385. package/lib/lsp/diagnostics-connection.d.ts +27 -0
  386. package/lib/lsp/diagnostics-connection.d.ts.map +1 -0
  387. package/lib/lsp/diagnostics-connection.js +53 -0
  388. package/lib/lsp/diagnostics-connection.js.map +1 -0
  389. package/lib/lsp/edit-requests-guard.d.ts +31 -0
  390. package/lib/lsp/edit-requests-guard.d.ts.map +1 -0
  391. package/lib/lsp/edit-requests-guard.js +125 -0
  392. package/lib/lsp/edit-requests-guard.js.map +1 -0
  393. package/lib/lsp/hydranium-document-update-handler.d.ts +126 -82
  394. package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
  395. package/lib/lsp/hydranium-document-update-handler.js +235 -102
  396. package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
  397. package/lib/lsp/index.d.ts +6 -2
  398. package/lib/lsp/index.d.ts.map +1 -1
  399. package/lib/lsp/index.js +6 -2
  400. package/lib/lsp/index.js.map +1 -1
  401. package/lib/lsp/lsp-latency.d.ts +39 -0
  402. package/lib/lsp/lsp-latency.d.ts.map +1 -0
  403. package/lib/lsp/lsp-latency.js +58 -0
  404. package/lib/lsp/lsp-latency.js.map +1 -0
  405. package/lib/lsp/save-text-document.d.ts +31 -0
  406. package/lib/lsp/save-text-document.d.ts.map +1 -0
  407. package/lib/lsp/save-text-document.js +52 -0
  408. package/lib/lsp/save-text-document.js.map +1 -0
  409. package/lib/lsp/semantic-token-provider.d.ts +58 -2
  410. package/lib/lsp/semantic-token-provider.d.ts.map +1 -1
  411. package/lib/lsp/semantic-token-provider.js +98 -9
  412. package/lib/lsp/semantic-token-provider.js.map +1 -1
  413. package/lib/lsp/shared-module.d.ts +4 -8
  414. package/lib/lsp/shared-module.d.ts.map +1 -1
  415. package/lib/lsp/shared-module.js.map +1 -1
  416. package/lib/lsp/start-language-server.d.ts +12 -7
  417. package/lib/lsp/start-language-server.d.ts.map +1 -1
  418. package/lib/lsp/start-language-server.js +21 -7
  419. package/lib/lsp/start-language-server.js.map +1 -1
  420. package/lib/messages/carriers.d.ts +4 -6
  421. package/lib/messages/carriers.d.ts.map +1 -1
  422. package/lib/messages/carriers.js +4 -6
  423. package/lib/messages/carriers.js.map +1 -1
  424. package/lib/messages/index.d.ts +2 -2
  425. package/lib/messages/index.d.ts.map +1 -1
  426. package/lib/messages/index.js +2 -2
  427. package/lib/messages/index.js.map +1 -1
  428. package/lib/messages/renderer.d.ts +32 -7
  429. package/lib/messages/renderer.d.ts.map +1 -1
  430. package/lib/messages/renderer.js +7 -1
  431. package/lib/messages/renderer.js.map +1 -1
  432. package/lib/node/event-loop-monitor.d.ts.map +1 -1
  433. package/lib/node/event-loop-monitor.js +2 -1
  434. package/lib/node/event-loop-monitor.js.map +1 -1
  435. package/lib/node/heap-ceiling.d.ts +61 -0
  436. package/lib/node/heap-ceiling.d.ts.map +1 -0
  437. package/lib/node/heap-ceiling.js +72 -0
  438. package/lib/node/heap-ceiling.js.map +1 -0
  439. package/lib/node/index.d.ts +1 -1
  440. package/lib/node/index.d.ts.map +1 -1
  441. package/lib/node/index.js +5 -1
  442. package/lib/node/index.js.map +1 -1
  443. package/lib/node/latency-from-env.d.ts +1 -1
  444. package/lib/node/latency-from-env.js +1 -1
  445. package/lib/node/lint-grammar.js.map +1 -1
  446. package/lib/node/log-file-sink.d.ts +3 -2
  447. package/lib/node/log-file-sink.d.ts.map +1 -1
  448. package/lib/node/log-file-sink.js +6 -2
  449. package/lib/node/log-file-sink.js.map +1 -1
  450. package/lib/node/log-preamble-node.d.ts +5 -3
  451. package/lib/node/log-preamble-node.d.ts.map +1 -1
  452. package/lib/node/log-preamble-node.js +13 -10
  453. package/lib/node/log-preamble-node.js.map +1 -1
  454. package/lib/node/measure-memory.d.ts.map +1 -1
  455. package/lib/node/measure-memory.js +5 -4
  456. package/lib/node/measure-memory.js.map +1 -1
  457. package/lib/node/memory-monitor.d.ts +2 -2
  458. package/lib/node/memory-monitor.d.ts.map +1 -1
  459. package/lib/node/memory-monitor.js +9 -10
  460. package/lib/node/memory-monitor.js.map +1 -1
  461. package/lib/node/node-file-system-provider.d.ts +67 -9
  462. package/lib/node/node-file-system-provider.d.ts.map +1 -1
  463. package/lib/node/node-file-system-provider.js +198 -53
  464. package/lib/node/node-file-system-provider.js.map +1 -1
  465. package/lib/node/profile-capture.d.ts +12 -4
  466. package/lib/node/profile-capture.d.ts.map +1 -1
  467. package/lib/node/profile-capture.js +8 -6
  468. package/lib/node/profile-capture.js.map +1 -1
  469. package/lib/node/profile-digest.js.map +1 -1
  470. package/lib/node/profiling-run.d.ts +13 -3
  471. package/lib/node/profiling-run.d.ts.map +1 -1
  472. package/lib/node/profiling-run.js +17 -8
  473. package/lib/node/profiling-run.js.map +1 -1
  474. package/lib/node/rename-over-open-readers.d.ts +61 -0
  475. package/lib/node/rename-over-open-readers.d.ts.map +1 -0
  476. package/lib/node/rename-over-open-readers.js +80 -0
  477. package/lib/node/rename-over-open-readers.js.map +1 -0
  478. package/lib/node/server-diagnostics.js +1 -1
  479. package/lib/node/server-diagnostics.js.map +1 -1
  480. package/lib/node/server-state-snapshot.js +4 -4
  481. package/lib/node/server-state-snapshot.js.map +1 -1
  482. package/lib/node/socket-launcher.d.ts +43 -7
  483. package/lib/node/socket-launcher.d.ts.map +1 -1
  484. package/lib/node/socket-launcher.js +42 -7
  485. package/lib/node/socket-launcher.js.map +1 -1
  486. package/lib/node/startup-cpu-profile.d.ts +29 -0
  487. package/lib/node/startup-cpu-profile.d.ts.map +1 -0
  488. package/lib/node/startup-cpu-profile.js +91 -0
  489. package/lib/node/startup-cpu-profile.js.map +1 -0
  490. package/lib/node/stdio-launcher.d.ts +13 -13
  491. package/lib/node/stdio-launcher.d.ts.map +1 -1
  492. package/lib/node/stdio-launcher.js +21 -11
  493. package/lib/node/stdio-launcher.js.map +1 -1
  494. package/lib/node/validate-workspace.d.ts +1 -1
  495. package/lib/node/validate-workspace.d.ts.map +1 -1
  496. package/lib/node/validate-workspace.js +5 -1
  497. package/lib/node/validate-workspace.js.map +1 -1
  498. package/lib/testing/document-uri-policy-conformance.js +1 -1
  499. package/lib/testing/document-uri-policy-conformance.js.map +1 -1
  500. package/lib/testing/fake-description.js.map +1 -1
  501. package/lib/testing/fake-document.d.ts +2 -1
  502. package/lib/testing/fake-document.d.ts.map +1 -1
  503. package/lib/testing/fake-document.js.map +1 -1
  504. package/lib/testing/index.d.ts +1 -1
  505. package/lib/testing/index.d.ts.map +1 -1
  506. package/lib/testing/index.js +2 -1
  507. package/lib/testing/index.js.map +1 -1
  508. package/lib/testing/langium-test-helpers.d.ts.map +1 -1
  509. package/lib/testing/langium-test-helpers.js +1 -0
  510. package/lib/testing/langium-test-helpers.js.map +1 -1
  511. package/lib/testing/make-noop-language-services.js.map +1 -1
  512. package/lib/testing/make-noop-shared-services.d.ts +4 -4
  513. package/lib/testing/make-noop-shared-services.d.ts.map +1 -1
  514. package/lib/testing/make-noop-shared-services.js +4 -4
  515. package/lib/testing/make-noop-shared-services.js.map +1 -1
  516. package/lib/testing/make-test-services.d.ts +51 -20
  517. package/lib/testing/make-test-services.d.ts.map +1 -1
  518. package/lib/testing/make-test-services.js +29 -13
  519. package/lib/testing/make-test-services.js.map +1 -1
  520. package/lib/testing/make-test-tracer.d.ts +12 -0
  521. package/lib/testing/make-test-tracer.d.ts.map +1 -1
  522. package/lib/testing/make-test-tracer.js +13 -0
  523. package/lib/testing/make-test-tracer.js.map +1 -1
  524. package/lib/testing/node/applied-edit-capture.d.ts +29 -0
  525. package/lib/testing/node/applied-edit-capture.d.ts.map +1 -0
  526. package/lib/testing/node/applied-edit-capture.js +117 -0
  527. package/lib/testing/node/applied-edit-capture.js.map +1 -0
  528. package/lib/testing/node/golden-corpus.js.map +1 -1
  529. package/lib/testing/node/index.d.ts +1 -0
  530. package/lib/testing/node/index.d.ts.map +1 -1
  531. package/lib/testing/node/index.js +1 -0
  532. package/lib/testing/node/index.js.map +1 -1
  533. package/lib/testing/node/lsp-harness.d.ts.map +1 -1
  534. package/lib/testing/node/lsp-harness.js +2 -0
  535. package/lib/testing/node/lsp-harness.js.map +1 -1
  536. package/lib/testing/node/lsp-server-connection.d.ts +21 -6
  537. package/lib/testing/node/lsp-server-connection.d.ts.map +1 -1
  538. package/lib/testing/node/lsp-server-connection.js +49 -106
  539. package/lib/testing/node/lsp-server-connection.js.map +1 -1
  540. package/lib/testing/node/scratch-workspace.d.ts.map +1 -1
  541. package/lib/testing/node/scratch-workspace.js +10 -5
  542. package/lib/testing/node/scratch-workspace.js.map +1 -1
  543. package/lib/testing/node/spawned-server.d.ts +30 -1
  544. package/lib/testing/node/spawned-server.d.ts.map +1 -1
  545. package/lib/testing/node/spawned-server.js +39 -2
  546. package/lib/testing/node/spawned-server.js.map +1 -1
  547. package/lib/testing/node/unhandled-rejections.d.ts +20 -0
  548. package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
  549. package/lib/testing/node/unhandled-rejections.js +32 -0
  550. package/lib/testing/node/unhandled-rejections.js.map +1 -0
  551. package/lib/testing/playwright/browser-capture-bridge.js.map +1 -1
  552. package/lib/testing/playwright/e2e-profiling.js.map +1 -1
  553. package/lib/testing/playwright/flaky-network-proxy.d.ts +76 -0
  554. package/lib/testing/playwright/flaky-network-proxy.d.ts.map +1 -0
  555. package/lib/testing/playwright/flaky-network-proxy.js +164 -0
  556. package/lib/testing/playwright/flaky-network-proxy.js.map +1 -0
  557. package/lib/testing/playwright/index.d.ts +1 -0
  558. package/lib/testing/playwright/index.d.ts.map +1 -1
  559. package/lib/testing/playwright/index.js +1 -0
  560. package/lib/testing/playwright/index.js.map +1 -1
  561. package/lib/testing/playwright/server-log-capture.d.ts +46 -16
  562. package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
  563. package/lib/testing/playwright/server-log-capture.js +111 -40
  564. package/lib/testing/playwright/server-log-capture.js.map +1 -1
  565. package/lib/testing/playwright/server-log-fixture.d.ts +16 -0
  566. package/lib/testing/playwright/server-log-fixture.d.ts.map +1 -1
  567. package/lib/testing/playwright/server-log-fixture.js +25 -6
  568. package/lib/testing/playwright/server-log-fixture.js.map +1 -1
  569. package/lib/testing/playwright/server-log-region.d.ts +15 -0
  570. package/lib/testing/playwright/server-log-region.d.ts.map +1 -0
  571. package/lib/testing/playwright/server-log-region.js +30 -0
  572. package/lib/testing/playwright/server-log-region.js.map +1 -0
  573. package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -1
  574. package/lib/testing/playwright/server-log-rename-reporter.js +4 -3
  575. package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -1
  576. package/lib/testing/run-update-pipeline.d.ts +8 -5
  577. package/lib/testing/run-update-pipeline.d.ts.map +1 -1
  578. package/lib/testing/run-update-pipeline.js.map +1 -1
  579. package/lib/testing/stub-ast-document-manager.d.ts +11 -52
  580. package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
  581. package/lib/testing/stub-ast-document-manager.js +31 -62
  582. package/lib/testing/stub-ast-document-manager.js.map +1 -1
  583. package/lib/testing/stub-document-builder.d.ts +33 -11
  584. package/lib/testing/stub-document-builder.d.ts.map +1 -1
  585. package/lib/testing/stub-document-builder.js +103 -5
  586. package/lib/testing/stub-document-builder.js.map +1 -1
  587. package/lib/testing/stub-hydranium-text-documents.d.ts +33 -10
  588. package/lib/testing/stub-hydranium-text-documents.d.ts.map +1 -1
  589. package/lib/testing/stub-hydranium-text-documents.js +132 -16
  590. package/lib/testing/stub-hydranium-text-documents.js.map +1 -1
  591. package/lib/testing/stub-index-manager.js.map +1 -1
  592. package/lib/testing/stub-langium-documents.d.ts +3 -2
  593. package/lib/testing/stub-langium-documents.d.ts.map +1 -1
  594. package/lib/testing/stub-langium-documents.js.map +1 -1
  595. package/lib/testing/stub-model-service.d.ts +9 -8
  596. package/lib/testing/stub-model-service.d.ts.map +1 -1
  597. package/lib/testing/stub-model-service.js +6 -6
  598. package/lib/testing/stub-model-service.js.map +1 -1
  599. package/lib/testing/stub-project-manager.js.map +1 -1
  600. package/lib/testing/stub-self-save-registry.d.ts +1 -1
  601. package/lib/testing/stub-self-save-registry.d.ts.map +1 -1
  602. package/lib/testing/stub-service-registry.d.ts +1 -1
  603. package/lib/testing/stub-service-registry.js.map +1 -1
  604. package/lib/testing/stub-writable-file-system.d.ts +1 -1
  605. package/lib/testing/stub-writable-file-system.d.ts.map +1 -1
  606. package/lib/testing/stub-writable-file-system.js +2 -1
  607. package/lib/testing/stub-writable-file-system.js.map +1 -1
  608. package/lib/util/connection-liveness.d.ts +22 -6
  609. package/lib/util/connection-liveness.d.ts.map +1 -1
  610. package/lib/util/connection-liveness.js +74 -15
  611. package/lib/util/connection-liveness.js.map +1 -1
  612. package/lib/util/environment.d.ts +7 -0
  613. package/lib/util/environment.d.ts.map +1 -1
  614. package/lib/util/environment.js +15 -1
  615. package/lib/util/environment.js.map +1 -1
  616. package/lib/util/registry.d.ts.map +1 -1
  617. package/package.json +41 -60
  618. package/src/browser/host-heads-in-worker.ts +218 -0
  619. package/src/browser/index.ts +17 -0
  620. package/src/browser/indexeddb-file-system-store.ts +192 -0
  621. package/src/browser/start-language-server-in-worker.ts +56 -0
  622. package/src/documents/ast-document-manager.ts +479 -233
  623. package/src/documents/client-ids.ts +5 -22
  624. package/src/documents/client-session-errors.ts +24 -0
  625. package/src/documents/client-session-registry.ts +262 -0
  626. package/src/documents/dirty-state-tracker.ts +167 -0
  627. package/src/documents/document-release-handler.ts +404 -0
  628. package/src/documents/document-release-scheduler.ts +121 -0
  629. package/src/documents/file-system-task-queue.ts +74 -0
  630. package/src/documents/hydranium-text-documents.ts +1029 -595
  631. package/src/documents/index.ts +10 -2
  632. package/src/documents/language-client-shadow.ts +501 -0
  633. package/src/documents/model-ledger.ts +66 -0
  634. package/src/documents/text-ledger.ts +112 -0
  635. package/src/documents/version-sync-service.ts +275 -0
  636. package/src/index.ts +7 -0
  637. package/src/langium/ast-extension/ast-extension-service.ts +77 -41
  638. package/src/langium/ast-extension/ast-node-builder.ts +35 -13
  639. package/src/langium/bootstrap.ts +87 -51
  640. package/src/langium/build-phase-pass/build-phase-pass-service.ts +29 -19
  641. package/src/langium/build-phase-pass/build-phase-pass.ts +37 -8
  642. package/src/langium/composite-ast-reflection.ts +112 -0
  643. package/src/langium/config/configuration-provider.ts +119 -0
  644. package/src/langium/config/index.ts +1 -0
  645. package/src/langium/diagnostics/console-tee.ts +150 -0
  646. package/src/langium/diagnostics/hydranium-langium-profiler.ts +15 -39
  647. package/src/langium/diagnostics/log-preamble.ts +1 -1
  648. package/src/langium/diagnostics/logger.ts +51 -17
  649. package/src/langium/diagnostics/lsp-logger.ts +83 -45
  650. package/src/langium/document-builder/build-pipeline-integration.ts +71 -33
  651. package/src/langium/document-builder/build-session.ts +4 -3
  652. package/src/langium/document-builder/document-builder.ts +615 -79
  653. package/src/langium/integration-services.ts +59 -28
  654. package/src/langium/integrity/integrity-rule.ts +17 -8
  655. package/src/langium/integrity/integrity-service.ts +332 -69
  656. package/src/langium/keys/containment.ts +3 -2
  657. package/src/langium/keys/name-based-key-provider.ts +24 -12
  658. package/src/langium/language-module.ts +52 -9
  659. package/src/langium/model-service/client-session.ts +726 -0
  660. package/src/langium/model-service/index.ts +2 -0
  661. package/src/langium/model-service/model-events.ts +80 -0
  662. package/src/langium/model-service/model-service.ts +929 -493
  663. package/src/langium/module.ts +195 -72
  664. package/src/langium/naming/name-provider.ts +34 -8
  665. package/src/langium/project/abstract-project-manager.ts +13 -5
  666. package/src/langium/project/project-change-event.ts +2 -2
  667. package/src/langium/residency/cst-residency-service.ts +59 -19
  668. package/src/langium/scope/ast-node-description-provider.ts +111 -16
  669. package/src/langium/scope/built-local-symbols.ts +13 -0
  670. package/src/langium/scope/fallback-scope.ts +38 -0
  671. package/src/langium/scope/hydranium-scope-computation.ts +45 -44
  672. package/src/langium/scope/hydranium-scope-provider.ts +245 -41
  673. package/src/langium/scope/index.ts +1 -0
  674. package/src/langium/scope/reference-candidate-provider.ts +6 -5
  675. package/src/langium/scope/scope-extension-service.ts +148 -56
  676. package/src/langium/scope/scoped-ast-node-description.ts +1 -3
  677. package/src/langium/serialization/abstract-serializer.ts +57 -41
  678. package/src/langium/serialization/json-serializer.ts +14 -3
  679. package/src/langium/serialization/serializer.ts +1 -1
  680. package/src/langium/serialization/yaml-serializer.ts +26 -4
  681. package/src/langium/service-registry.ts +41 -2
  682. package/src/langium/shared-services.ts +16 -7
  683. package/src/langium/single-langium-copy.ts +42 -0
  684. package/src/langium/transfer/transfer-encoder.ts +104 -47
  685. package/src/langium/trivia/comment-preserver.ts +1409 -0
  686. package/src/langium/trivia/document-ending-preserver.ts +71 -0
  687. package/src/langium/trivia/index.ts +14 -0
  688. package/src/langium/trivia/trivia-contribution.ts +39 -0
  689. package/src/langium/trivia/trivia-preserver.ts +56 -0
  690. package/src/langium/trivia/trivia-service.ts +99 -0
  691. package/src/langium/update-rewrite/update-rewrite-service.ts +1 -1
  692. package/src/langium/update-rewrite/update-rewrite.ts +1 -1
  693. package/src/langium/validation/document-validator.ts +312 -31
  694. package/src/langium/validation/validation-contribution-collector.ts +10 -1
  695. package/src/langium/workspace/ast-node-locator.ts +33 -0
  696. package/src/langium/workspace/document-uri-policy.ts +32 -18
  697. package/src/langium/workspace/file-not-found.ts +35 -0
  698. package/src/langium/workspace/file-system-provider.ts +258 -16
  699. package/src/langium/workspace/hydranium-langium-document-factory.ts +83 -0
  700. package/src/langium/workspace/hydranium-workspace-lock.ts +86 -2
  701. package/src/langium/workspace/hydranium-workspace-manager.ts +212 -35
  702. package/src/langium/workspace/in-memory-file-system-provider.ts +54 -23
  703. package/src/langium/workspace/index.ts +2 -0
  704. package/src/langium/workspace/initialize-workspace.ts +96 -4
  705. package/src/langium/workspace/langium-documents.ts +19 -1
  706. package/src/langium/workspace/persistent-file-system-provider.ts +27 -15
  707. package/src/langium/workspace/self-save-registry.ts +118 -0
  708. package/src/langium/workspace/virtual-document.ts +106 -25
  709. package/src/langium/workspace/write-lock-scope.ts +27 -12
  710. package/src/launcher/integrated-server.ts +3 -1
  711. package/src/locale/server-locale.ts +20 -5
  712. package/src/lsp/completion/hydranium-completion-provider.ts +82 -2
  713. package/src/lsp/connection-features.ts +67 -0
  714. package/src/lsp/diagnostics-connection.ts +56 -0
  715. package/src/lsp/edit-requests-guard.ts +152 -0
  716. package/src/lsp/hydranium-document-update-handler.ts +285 -111
  717. package/src/lsp/index.ts +6 -2
  718. package/src/lsp/lsp-latency.ts +62 -0
  719. package/src/lsp/save-text-document.ts +63 -0
  720. package/src/lsp/semantic-token-provider.ts +146 -8
  721. package/src/lsp/shared-module.ts +4 -8
  722. package/src/lsp/start-language-server.ts +21 -7
  723. package/src/messages/carriers.ts +4 -6
  724. package/src/messages/index.ts +11 -2
  725. package/src/messages/renderer.ts +34 -6
  726. package/src/node/event-loop-monitor.ts +2 -1
  727. package/src/node/heap-ceiling.ts +108 -0
  728. package/src/node/index.ts +5 -1
  729. package/src/node/latency-from-env.ts +1 -1
  730. package/src/node/log-file-sink.ts +6 -2
  731. package/src/node/log-preamble-node.ts +20 -10
  732. package/src/node/measure-memory.ts +5 -4
  733. package/src/node/memory-monitor.ts +10 -10
  734. package/src/node/node-file-system-provider.ts +214 -57
  735. package/src/node/profile-capture.ts +16 -15
  736. package/src/node/profiling-run.ts +30 -8
  737. package/src/node/rename-over-open-readers.ts +94 -0
  738. package/src/node/server-diagnostics.ts +1 -1
  739. package/src/node/server-state-snapshot.ts +5 -5
  740. package/src/node/socket-launcher.ts +78 -14
  741. package/src/node/startup-cpu-profile.ts +94 -0
  742. package/src/node/stdio-launcher.ts +29 -19
  743. package/src/node/validate-workspace.ts +8 -2
  744. package/src/testing/document-uri-policy-conformance.ts +1 -1
  745. package/src/testing/fake-document.ts +2 -1
  746. package/src/testing/index.ts +2 -1
  747. package/src/testing/langium-test-helpers.ts +1 -0
  748. package/src/testing/make-noop-shared-services.ts +6 -6
  749. package/src/testing/make-test-services.ts +93 -41
  750. package/src/testing/make-test-tracer.ts +26 -0
  751. package/src/testing/node/applied-edit-capture.ts +141 -0
  752. package/src/testing/node/index.ts +1 -0
  753. package/src/testing/node/lsp-harness.ts +2 -0
  754. package/src/testing/node/lsp-server-connection.ts +83 -119
  755. package/src/testing/node/scratch-workspace.ts +10 -5
  756. package/src/testing/node/spawned-server.ts +57 -3
  757. package/src/testing/node/unhandled-rejections.ts +31 -0
  758. package/src/testing/parse-semantic-root.ts +1 -1
  759. package/src/testing/playwright/flaky-network-proxy.ts +240 -0
  760. package/src/testing/playwright/index.ts +1 -0
  761. package/src/testing/playwright/server-log-capture.ts +137 -47
  762. package/src/testing/playwright/server-log-fixture.ts +46 -6
  763. package/src/testing/playwright/server-log-region.ts +32 -0
  764. package/src/testing/playwright/server-log-rename-reporter.ts +4 -3
  765. package/src/testing/run-update-pipeline.ts +8 -5
  766. package/src/testing/stub-ast-document-manager.ts +47 -128
  767. package/src/testing/stub-document-builder.ts +138 -18
  768. package/src/testing/stub-hydranium-text-documents.ts +184 -27
  769. package/src/testing/stub-langium-documents.ts +3 -2
  770. package/src/testing/stub-model-service.ts +11 -10
  771. package/src/testing/stub-self-save-registry.ts +1 -1
  772. package/src/testing/stub-service-registry.ts +1 -1
  773. package/src/testing/stub-writable-file-system.ts +3 -2
  774. package/src/util/connection-liveness.ts +80 -15
  775. package/src/util/environment.ts +24 -2
  776. package/lib/documents/language-client-text-shadow.d.ts +0 -101
  777. package/lib/documents/language-client-text-shadow.d.ts.map +0 -1
  778. package/lib/documents/language-client-text-shadow.js +0 -156
  779. package/lib/documents/language-client-text-shadow.js.map +0 -1
  780. package/lib/documents/self-save-registry.d.ts +0 -55
  781. package/lib/documents/self-save-registry.d.ts.map +0 -1
  782. package/lib/documents/self-save-registry.js.map +0 -1
  783. package/lib/lsp/instrument-connection.d.ts +0 -36
  784. package/lib/lsp/instrument-connection.d.ts.map +0 -1
  785. package/lib/lsp/instrument-connection.js +0 -62
  786. package/lib/lsp/instrument-connection.js.map +0 -1
  787. package/lib/node/process-memory.d.ts +0 -66
  788. package/lib/node/process-memory.d.ts.map +0 -1
  789. package/lib/node/process-memory.js +0 -252
  790. package/lib/node/process-memory.js.map +0 -1
  791. package/src/documents/language-client-text-shadow.ts +0 -175
  792. package/src/documents/self-save-registry.ts +0 -81
  793. package/src/lsp/instrument-connection.ts +0 -66
  794. package/src/node/process-memory.ts +0 -299
@@ -8,6 +8,7 @@
8
8
  ********************************************************************************/
9
9
 
10
10
  import type { AstNode, AstReflection } from '@hydranium/langium';
11
+ import type { ConcreteTypeName, SingleTypeName } from '@hydranium/protocol';
11
12
 
12
13
  /**
13
14
  * Shape of the per-type constants Langium emits alongside each
@@ -55,14 +56,18 @@ export type AstNodeInit<T extends AstNode> = Omit<T, keyof AstNode | ArrayKeys<T
55
56
  * the AST interface from a constant's `$type` literal alone, so call sites do
56
57
  * not have to write the type name twice.
57
58
  *
59
+ * The constant must name one type its own `$type` lists: a union's or an
60
+ * abstract type's constant, or one typed by a union of type names, would let
61
+ * an incomplete node through.
62
+ *
58
63
  * @param typeConstant the per-type constant Langium emits (drives `$type`).
59
64
  * @param init typed fields — TS enforces mandatory non-array fields here.
60
65
  * @param extras explicitly-unchecked escape hatch for properties not declared
61
66
  * on the AST interface. Use sparingly; lives in a separate
62
67
  * argument so typos can't silently pass into the typed slot.
63
68
  */
64
- export type AstNodeBuilder<TMap> = <TType extends string & keyof TMap>(
65
- typeConstant: AstTypeConstant<TType>,
69
+ export type AstNodeBuilder<TMap> = <TType extends ConcreteTypeName<TMap>>(
70
+ typeConstant: AstTypeConstant<TType> & SingleTypeName<TType>,
66
71
  init: AstNodeInit<Extract<TMap[TType], AstNode>>,
67
72
  extras?: Record<string, unknown>
68
73
  ) => Extract<TMap[TType], AstNode>;
@@ -94,18 +99,21 @@ export type AstNodeBuilder<TMap> = <TType extends string & keyof TMap>(
94
99
  * rather than a way to drop fields from the typed call site.
95
100
  */
96
101
  export function makeAstNodeBuilder<TMap>(reflection: AstReflection): AstNodeBuilder<TMap> {
97
- return function astNode<TType extends string & keyof TMap>(
98
- typeConstant: AstTypeConstant<TType>,
102
+ return function astNode<TType extends ConcreteTypeName<TMap>>(
103
+ typeConstant: AstTypeConstant<TType> & SingleTypeName<TType>,
99
104
  init: AstNodeInit<Extract<TMap[TType], AstNode>>,
100
105
  extras?: Record<string, unknown>
101
106
  ): Extract<TMap[TType], AstNode> {
102
107
  const result = withTypeDefaults(reflection, typeConstant.$type);
103
- Object.assign(result, init);
108
+ assignOverDefaults(result, init);
104
109
  if (extras) {
105
110
  // Extras win over init: this is the explicit escape hatch, so when a
106
111
  // call site uses it, treat that as deliberate override intent.
107
- Object.assign(result, extras);
112
+ assignOverDefaults(result, extras);
108
113
  }
114
+ // Last, so neither can rebind it: `AstNodeInit` keeps out only a `$type`
115
+ // written in the call, and a spread of another node carries its own.
116
+ result.$type = typeConstant.$type;
109
117
  return result as unknown as Extract<TMap[TType], AstNode>;
110
118
  };
111
119
  }
@@ -127,12 +135,12 @@ export function makeAstNodeBuilder<TMap>(reflection: AstReflection): AstNodeBuil
127
135
  * permissive lookup into a throw at a call site that can only guess.
128
136
  *
129
137
  * **The `type` argument is authoritative: `init` cannot rebind `$type`.** The
130
- * typed builder gets this for free — `AstNodeInit` omits `$type`, so a call site
131
- * cannot reach it — but here `init` is loosely typed, and the case that needs
132
- * the guarantee is RETYPING: a caller spreading an existing node to produce one
133
- * of a different type (`{ ...source }`) carries the SOURCE's `$type` in, which
134
- * would silently win over the type actually requested and hand back a node of
135
- * the wrong type with no error anywhere.
138
+ * typed builder holds the same rule, since its init type keeps out only a
139
+ * `$type` written in the call. The case that needs the guarantee is RETYPING:
140
+ * a caller spreading an existing node to produce one of a different type
141
+ * (`{ ...source }`) carries the SOURCE's `$type` in, which would silently win
142
+ * over the type actually requested and hand back a node of the wrong type with
143
+ * no error anywhere.
136
144
  */
137
145
  export function buildAstNode<TAst extends AstNode = AstNode>(
138
146
  reflection: AstReflection,
@@ -141,7 +149,7 @@ export function buildAstNode<TAst extends AstNode = AstNode>(
141
149
  ): TAst {
142
150
  const result = withTypeDefaults(reflection, type);
143
151
  if (init) {
144
- Object.assign(result, init);
152
+ assignOverDefaults(result, init);
145
153
  result.$type = type;
146
154
  }
147
155
  return result as unknown as TAst;
@@ -167,3 +175,17 @@ function withTypeDefaults(reflection: AstReflection, type: string): Record<strin
167
175
  }
168
176
  return result;
169
177
  }
178
+
179
+ /**
180
+ * `Object.assign`, except that an `undefined` does not replace a value already
181
+ * there: an optional field the caller names as `undefined` keeps its grammar
182
+ * default, where a plain assign would leave a node typed complete without it.
183
+ * Any other `undefined` is written, so the key stays present.
184
+ */
185
+ function assignOverDefaults(target: Record<string, unknown>, source: object): void {
186
+ for (const [key, value] of Object.entries(source)) {
187
+ if (value !== undefined || !Object.hasOwn(target, key)) {
188
+ target[key] = value;
189
+ }
190
+ }
191
+ }
@@ -10,17 +10,20 @@
10
10
  import { type Logger } from '@hydranium/protocol';
11
11
  import { type LangiumSharedCoreServices } from '@hydranium/langium';
12
12
  import { type LangiumServices, type LangiumSharedServices } from '@hydranium/langium/lsp';
13
- import type { ServerSharedServicesMinimal } from './shared-services.js';
13
+ import type { ServerSharedServices } from './module.js';
14
14
  import { collectProducibleTypes } from './language-types.js';
15
- import { AstDocumentManager } from '../documents/ast-document-manager.js';
15
+ import { assertSingleLangiumCopy } from './single-langium-copy.js';
16
+ import { DefaultAstDocumentManager } from '../documents/ast-document-manager.js';
16
17
  import { HydraniumTextDocuments } from '../documents/hydranium-text-documents.js';
17
- import { BuildPipelineIntegration } from './document-builder/build-pipeline-integration.js';
18
+ import { DefaultBuildPipelineIntegration } from './document-builder/build-pipeline-integration.js';
18
19
  import { HydraniumDocumentBuilder } from './document-builder/document-builder.js';
19
- import { ModelService } from './model-service/model-service.js';
20
+ import { DefaultModelService } from './model-service/model-service.js';
20
21
  import { HydraniumScopeComputation } from './scope/hydranium-scope-computation.js';
21
22
  import { HydraniumScopeProvider } from './scope/hydranium-scope-provider.js';
22
23
  import { processEnv } from '../util/environment.js';
23
- import { TransferEncoder } from './transfer/transfer-encoder.js';
24
+ import { DefaultTransferEncoder } from './transfer/transfer-encoder.js';
25
+ import { HydraniumLangiumDocumentFactory } from './workspace/hydranium-langium-document-factory.js';
26
+ import { HydraniumLangiumDocuments } from './workspace/langium-documents.js';
24
27
  import { HydraniumWorkspaceManager } from './workspace/hydranium-workspace-manager.js';
25
28
 
26
29
  /**
@@ -191,6 +194,20 @@ interface StrictSlot {
191
194
 
192
195
  const STRICT_SHARED_SLOTS: readonly StrictSlot[] = [
193
196
  { side: 'shared', path: 'workspace.TextDocuments', base: HydraniumTextDocuments, get: s => nested(s, 'workspace', 'TextDocuments') },
197
+ // Every root it builds records no version, so every write gated on one conflicts.
198
+ {
199
+ side: 'shared',
200
+ path: 'workspace.LangiumDocumentFactory',
201
+ base: HydraniumLangiumDocumentFactory,
202
+ get: s => nested(s, 'workspace', 'LangiumDocumentFactory')
203
+ },
204
+ // It reports no registered root, so none is reconciled with the text store or announced.
205
+ {
206
+ side: 'shared',
207
+ path: 'workspace.LangiumDocuments',
208
+ base: HydraniumLangiumDocuments,
209
+ get: s => nested(s, 'workspace', 'LangiumDocuments')
210
+ },
194
211
  {
195
212
  side: 'shared',
196
213
  path: 'workspace.WorkspaceManager',
@@ -206,17 +223,17 @@ const STRICT_SHARED_SLOTS: readonly StrictSlot[] = [
206
223
  {
207
224
  side: 'shared',
208
225
  path: 'workspace.AstDocumentManager',
209
- base: AstDocumentManager,
226
+ base: DefaultAstDocumentManager,
210
227
  get: s => nested(s, 'workspace', 'AstDocumentManager')
211
228
  },
212
229
  {
213
230
  side: 'shared',
214
231
  path: 'workspace.BuildPipelineIntegration',
215
- base: BuildPipelineIntegration,
232
+ base: DefaultBuildPipelineIntegration,
216
233
  get: s => nested(s, 'workspace', 'BuildPipelineIntegration')
217
234
  },
218
- { side: 'shared', path: 'model.TransferEncoder', base: TransferEncoder, get: s => nested(s, 'model', 'TransferEncoder') },
219
- { side: 'shared', path: 'model.ModelService', base: ModelService, get: s => nested(s, 'model', 'ModelService') }
235
+ { side: 'shared', path: 'model.TransferEncoder', base: DefaultTransferEncoder, get: s => nested(s, 'model', 'TransferEncoder') },
236
+ { side: 'shared', path: 'model.ModelService', base: DefaultModelService, get: s => nested(s, 'model', 'ModelService') }
220
237
  ];
221
238
 
222
239
  const STRICT_LANGUAGE_SLOTS: readonly StrictSlot[] = [
@@ -294,31 +311,40 @@ export function warnOnUnexpectedBindings(shared: LangiumSharedServices, language
294
311
  * dispatch every build-phase pass and drive AST enrichment, and
295
312
  * registers the framework integrity passes itself. The per-language
296
313
  * feature services it routes to (`ast.AstExtensionService` +
297
- * `integrity.IntegrityService`, plus `references.ScopeExtensionService`
298
- * read by the scope provider) hold the registries and the logic but own
314
+ * `integrity.IntegrityService`) hold the registries and the logic but own
299
315
  * no listeners, so they need not be eager: each language's services
300
- * construct lazily when the orchestrator (or scope provider) first
301
- * reaches them, and their constructors register that language's rules /
302
- * extensions just-in-time.
303
- * - **`profilers.LangiumProfiler`** — self-registers a `Validated`
304
- * BuildPhasePass that flushes the aggregated parse/link/validate profile
305
- * once per build. No production cost (the profiler is trace-gated), but
306
- * the pass must be registered up front.
316
+ * construct lazily when the orchestrator first reaches them, and their
317
+ * constructors register that language's rules / extensions just-in-time.
318
+ * `references.ScopeExtensionService`, read by the scope provider, does
319
+ * subscribe to the builder, but only to report its own calls, so
320
+ * constructing it at its first call misses none.
321
+ * - **`profilers.LangiumProfiler`** — subscribes to
322
+ * `documentBuilder.onBuildEnded` to flush the aggregated
323
+ * parse/link/validate profile once per build. No production cost (the
324
+ * profiler is trace-gated), but the listener must be attached before the
325
+ * first build ends.
307
326
  * - **`workspace.CstResidencyService`** — self-registers a `Validated`
308
327
  * BuildPhasePass that sheds the CST of closed documents. The framework
309
328
  * default strategy is `always-keep`, so the pass runs but sheds nothing
310
329
  * until an adopter configures a shedding strategy.
330
+ * - **`workspace.AstDocumentManager`** — subscribes to the build pipeline
331
+ * and the text store to track opens, deletions and each build's causes.
332
+ * - **`model.ModelService`** — subscribes to the settled document phase to
333
+ * bring the language client up to date. A tree without an LSP `initialize`,
334
+ * such as a headless init, may not resolve it before the first build.
311
335
  *
312
336
  * Consumers with no additional eager targets can omit the third argument
313
337
  * to {@link bootstrapLangium} — the parameter default is this exact set.
314
338
  * Adopters needing extra eager targets spread this constant into their own
315
339
  * array and append their accessors.
316
340
  */
317
- export const DEFAULT_EAGER_SERVICES: ReadonlyArray<(services: ServerSharedServicesMinimal) => unknown> = [
341
+ export const DEFAULT_EAGER_SERVICES: ReadonlyArray<(services: ServerSharedServices) => unknown> = [
318
342
  services => services.workspace.ProjectManager,
319
343
  services => services.workspace.BuildPipelineIntegration,
320
344
  services => services.profilers.LangiumProfiler,
321
- services => services.workspace.CstResidencyService
345
+ services => services.workspace.CstResidencyService,
346
+ services => services.workspace.AstDocumentManager,
347
+ services => services.model.ModelService
322
348
  ];
323
349
 
324
350
  /**
@@ -336,36 +362,39 @@ export const DEFAULT_EAGER_SERVICES: ReadonlyArray<(services: ServerSharedServic
336
362
  * discarded.
337
363
  *
338
364
  * Bootstrap responsibilities, in order:
339
- * 1. Hand the shared services to `shared.ServiceRegistry` if it accepts
365
+ * 1. {@link assertSingleLangiumCopy} — fail fast when the shared
366
+ * `AstReflection` is built on a second copy of `langium`, before any
367
+ * later check can fail first and name the wrong cause.
368
+ * 2. Hand the shared services to `shared.ServiceRegistry` if it accepts
340
369
  * them after construction, so Langium's declared-languageId lookup
341
370
  * rung works however the adopter's registry binding was built.
342
- * 2. {@link assertDistinctFileRouting} — before registration, because
371
+ * 3. {@link assertDistinctFileRouting} — before registration, because
343
372
  * `register` resolves a routing collision by last-wins and afterwards
344
373
  * the evidence is gone.
345
- * 3. Register `language` against `shared.ServiceRegistry`, the
374
+ * 4. Register `language` against `shared.ServiceRegistry`, the
346
375
  * required final step of any Langium DI bootstrap. Done before slot
347
376
  * validation so subclassed registries (typed-accessor extensions)
348
377
  * populate any side state before validation walks construct services
349
378
  * that read from the registry.
350
- * 4. {@link assertCoreSlotsBound} — fail fast if the consumer's
379
+ * 5. {@link assertCoreSlotsBound} — fail fast if the consumer's
351
380
  * `inject(...)` composition is missing a `@hydranium/core` module. May
352
381
  * trigger lazy service construction as side effect of walking the
353
382
  * slots; that construction expects a populated `ServiceRegistry`,
354
383
  * hence the order.
355
- * 5. {@link warnOnUnexpectedBindings} — opt-in (gated by
384
+ * 6. {@link warnOnUnexpectedBindings} — opt-in (gated by
356
385
  * {@link STRICT_BINDINGS_ENV}); warns when a framework slot is bound
357
386
  * to a non-subclass of its framework base. No-op unless the env is set.
358
- * 6. {@link assertReflectionCoversLanguages} — catch a clobbered shared
387
+ * 7. {@link assertReflectionCoversLanguages} — catch a clobbered shared
359
388
  * `AstReflection` before it starts silently answering `isSubtype`
360
389
  * false for a registered language's types. Skipped here, since a lone
361
390
  * language has no sibling that could clobber it.
362
- * 7. Invoke eager-construction accessors in array order.
391
+ * 8. Invoke eager-construction accessors in array order.
363
392
  *
364
393
  * Multi-grammar adopters use {@link bootstrapLangiumLanguages}, which
365
394
  * registers every language before validating slots or constructing the
366
395
  * eager set.
367
396
  */
368
- export function bootstrapLangium<TShared extends LangiumSharedServices & ServerSharedServicesMinimal, TLang extends LangiumServices>(
397
+ export function bootstrapLangium<TShared extends LangiumSharedServices & ServerSharedServices, TLang extends LangiumServices>(
369
398
  shared: TShared,
370
399
  language: TLang,
371
400
  eagerlyConstructedServices: ReadonlyArray<(services: TShared) => unknown> = DEFAULT_EAGER_SERVICES
@@ -384,32 +413,32 @@ export function bootstrapLangium<TShared extends LangiumSharedServices & ServerS
384
413
  * ORDER across languages is what makes this a distinct function rather
385
414
  * than a loop the caller could write:
386
415
  *
387
- * 1. **Every** language is registered against `shared.ServiceRegistry`
388
- * first. Slot validation and eager construction both build services
416
+ * 1. {@link assertSingleLangiumCopy} runs **once**, before anything else,
417
+ * since every language shares the one `AstReflection`.
418
+ * 2. **Every** language is registered against `shared.ServiceRegistry`
419
+ * next. Slot validation and eager construction both build services
389
420
  * that read the registry — a per-language
390
421
  * register-then-validate-then-eager loop would run them while later
391
422
  * languages were still missing, so a shared service that walks
392
423
  * `ServiceRegistry.all` (or resolves by extension) would see a
393
424
  * half-populated registry and cache the wrong answer.
394
- * 2. `assertCoreSlotsBound` / `warnOnUnexpectedBindings` per language —
425
+ * 3. `assertCoreSlotsBound` / `warnOnUnexpectedBindings` per language —
395
426
  * each language composes its own module chain, so each is checked.
396
- * 3. Eager accessors run **once**, after all registrations. They take
397
- * the shared tier, and the framework's eager set is shared-tier only
398
- * (`ProjectManager`, `BuildPipelineIntegration`, `LangiumProfiler`,
399
- * `CstResidencyService`) — `BuildPipelineIntegration` in particular
400
- * routes per document URI to each language's `IntegrityService` /
401
- * `AstExtensionService`, so it must be constructed knowing all of
402
- * them. Running the set per language would attach its
403
- * `documentBuilder` listeners N times and enforce each phase N times.
427
+ * 4. {@link assertReflectionCoversLanguages} runs **once**, on the one
428
+ * shared `AstReflection`.
429
+ * 5. Eager accessors run **once**, after all registrations. They take
430
+ * the shared tier, and the framework's eager set is shared-tier only —
431
+ * `BuildPipelineIntegration` in particular routes per document URI to
432
+ * each language's `IntegrityService` / `AstExtensionService`, so it
433
+ * must be constructed knowing all of them. Running the set per language
434
+ * would attach its `documentBuilder` listeners N times and enforce each
435
+ * phase N times.
404
436
  *
405
437
  * Throws when `languages` is empty: a shared tier with no registered
406
438
  * language never validates its slots, which silently defers a
407
439
  * composition error to the first build.
408
440
  */
409
- export function bootstrapLangiumLanguages<
410
- TShared extends LangiumSharedServices & ServerSharedServicesMinimal,
411
- TLang extends LangiumServices
412
- >(
441
+ export function bootstrapLangiumLanguages<TShared extends LangiumSharedServices & ServerSharedServices, TLang extends LangiumServices>(
413
442
  shared: TShared,
414
443
  languages: ReadonlyArray<TLang>,
415
444
  eagerlyConstructedServices: ReadonlyArray<(services: TShared) => unknown> = DEFAULT_EAGER_SERVICES
@@ -421,6 +450,11 @@ export function bootstrapLangiumLanguages<
421
450
  '`inject(...)` composition.'
422
451
  );
423
452
  }
453
+ // First, because a second copy of `langium` can make a later check fail
454
+ // first and name the wrong cause.
455
+ if (shared.AstReflection) {
456
+ assertSingleLangiumCopy(shared.AstReflection);
457
+ }
424
458
  // Back-fill the shared services onto a registry that was constructed
425
459
  // without them, so Langium's declared-languageId lookup rung works no
426
460
  // matter how the adopter's `ServiceRegistry` binding built it. An adopter
@@ -528,11 +562,11 @@ export function assertDistinctFileRouting(languages: ReadonlyArray<LangiumServic
528
562
  *
529
563
  * The check is per language, on the types its grammar can produce, and costs
530
564
  * one grammar walk per language at boot; a single-language composition, which
531
- * nothing can clobber, is skipped entirely. It cannot repair the situation — a
532
- * reflection that spans independently generated grammars is a real design piece
533
- * (a composite reflection dispatching per owning language) and is not attempted
534
- * here; the point is to turn a silent runtime misbehaviour into a boot failure
535
- * that names the language and the mistake.
565
+ * nothing can clobber, is skipped entirely. It cannot repair the situation, since
566
+ * the losing reflection is already gone; the point is to turn a silent runtime
567
+ * misbehaviour into a boot failure that names the language and the mistake. The
568
+ * repair is the adopter's: bind a `CompositeAstReflection` over every package's
569
+ * generated reflection, or generate all grammars in one `langium-cli` run.
536
570
  *
537
571
  * **Two severities, because a clobber is not always total.** Throwing only when
538
572
  * NONE of a language's types are known misses the realistic case: two grammars
@@ -574,8 +608,9 @@ export function assertReflectionCoversLanguages(shared: LangiumSharedServices, l
574
608
  `[hydranium] the shared AstReflection knows NONE of the ${produced.size} types the language ` +
575
609
  `'${languageId}' can produce (e.g. ${missing.slice(0, 3).join(', ')}). ` +
576
610
  'AstReflection is a single shared slot, so composing two independently generated language ' +
577
- 'packages leaves only the last one bound. Generate all grammars in ONE langium-cli run (one ' +
578
- 'langium-config with several entry grammars) so a single combined reflection covers them all.'
611
+ "packages leaves only the last one bound. Bind a CompositeAstReflection over every package's " +
612
+ 'generated reflection, or generate all grammars in ONE langium-cli run (one langium-config with ' +
613
+ 'several entry grammars) so a single combined reflection covers them all.'
579
614
  );
580
615
  }
581
616
  }
@@ -597,7 +632,8 @@ function warnPartialReflectionCoverage(
597
632
  'For those types `isSubtype` answers false and `getTypeMetaData` is empty, so `IndexManager.allElements` ' +
598
633
  'finds nothing, reference routing misses, and the encoder emits nothing. Most likely two independently ' +
599
634
  'generated language packages each bound the single shared AstReflection slot and the last one won — ' +
600
- 'generate all grammars in ONE langium-cli run so a single combined reflection covers them. If instead ' +
635
+ "bind a CompositeAstReflection over every package's generated reflection, or generate all grammars in " +
636
+ 'ONE langium-cli run so a single combined reflection covers them. If instead ' +
601
637
  'these are rules your generator legitimately folded away, this warning is expected.';
602
638
  if (logger) {
603
639
  logger.warn(message);
@@ -13,7 +13,7 @@ import { type CancellationToken, type Disposable } from 'vscode-languageserver';
13
13
  import { type LogNameOptions } from '../diagnostics/logger.js';
14
14
  import { type ServerSharedServices } from '../module.js';
15
15
  import { Registry } from '../../util/registry.js';
16
- import { type BuildPhasePass, type BuildPhasePassRegistry } from './build-phase-pass.js';
16
+ import { type BuildPhasePass, type BuildPhasePassRegistry, BuildPassPhase } from './build-phase-pass.js';
17
17
 
18
18
  /**
19
19
  * Public contract for the shared build-phase-pass runner. Extends the
@@ -27,11 +27,11 @@ import { type BuildPhasePass, type BuildPhasePassRegistry } from './build-phase-
27
27
  * per-language work (integrity) fans out by language *inside* its pass. This
28
28
  * also keeps one priority space per phase across framework and adopter passes,
29
29
  * which is the point — `runPasses` orders the framework's integrity and
30
- * profiler-flush passes against adopter passes deterministically.
30
+ * CST-residency passes against adopter passes deterministically.
31
31
  */
32
32
  export interface BuildPhasePassService extends BuildPhasePassRegistry {
33
33
  /**
34
- * Run every pass declaring `phase` as its state, in priority order,
34
+ * Run every pass declaring `phase`, in priority order,
35
35
  * sequentially — each pass is awaited before the next begins. The cancel
36
36
  * token is checked before each pass so a preempted build stops cleanly.
37
37
  * No-ops when no pass targets the phase. Called by
@@ -52,8 +52,8 @@ export type BuildPhasePassServiceOptions = LogNameOptions;
52
52
  * `BuildPipelineIntegration`,
53
53
  * which calls {@link runPasses} from its `onBuildPhase` listeners.
54
54
  *
55
- * **Performance:** {@link runPasses} shares the bucket-by-state cache pattern
56
- * with the AST-extension service — the per-state pass list is rebuilt lazily
55
+ * **Performance:** {@link runPasses} shares the bucket-by-phase cache pattern
56
+ * with the AST-extension service — the per-phase pass list is rebuilt lazily
57
57
  * only after a register / unregister, so steady-state dispatch allocates
58
58
  * nothing and early-outs when no pass targets the phase.
59
59
  *
@@ -64,9 +64,9 @@ export type BuildPhasePassServiceOptions = LogNameOptions;
64
64
  */
65
65
  export class DefaultBuildPhasePassService implements BuildPhasePassService {
66
66
  protected readonly passes = new Registry<BuildPhasePass>();
67
- /** Per-state bucket of passes targeting each state, rebuilt lazily on the first run after a registry mutation. */
68
- protected stateBuckets = new Map<DocumentState, readonly BuildPhasePass[]>();
69
- protected stateBucketsFor: readonly BuildPhasePass[] | undefined;
67
+ /** Per-phase bucket of passes targeting each phase, rebuilt lazily on the first run after a registry mutation. */
68
+ protected phaseBuckets = new Map<DocumentState, readonly BuildPhasePass[]>();
69
+ protected phaseBucketsFor: readonly BuildPhasePass[] | undefined;
70
70
 
71
71
  protected readonly tracer: Tracer;
72
72
 
@@ -84,11 +84,21 @@ export class DefaultBuildPhasePassService implements BuildPhasePassService {
84
84
  }
85
85
 
86
86
  register(pass: BuildPhasePass): Disposable {
87
+ // A phase outside the wired set type-checks only past a cast, and a pass
88
+ // there is accepted and never fires.
89
+ if (!BuildPassPhase.all().includes(pass.phase)) {
90
+ throw new Error(
91
+ `Build-phase pass '${pass.id}' registered at phase ${DocumentState[pass.phase]} would never fire. ` +
92
+ `Allowed phases are ${BuildPassPhase.all()
93
+ .map(phase => DocumentState[phase])
94
+ .join(', ')}.`
95
+ );
96
+ }
87
97
  return this.passes.register(pass);
88
98
  }
89
99
 
90
100
  async runPasses(documents: readonly LangiumDocument[], phase: DocumentState, cancelToken: CancellationToken): Promise<void> {
91
- const bucket = this.getStateBucket(phase);
101
+ const bucket = this.getPhaseBucket(phase);
92
102
  if (bucket.length === 0) {
93
103
  return;
94
104
  }
@@ -114,28 +124,28 @@ export class DefaultBuildPhasePassService implements BuildPhasePassService {
114
124
  }
115
125
 
116
126
  /**
117
- * Bucket-by-state view of {@link passes}, rebuilt lazily when the registry's
127
+ * Bucket-by-phase view of {@link passes}, rebuilt lazily when the registry's
118
128
  * cached `all()` reference changes. Each bucket preserves the registry's
119
129
  * priority order (`Registry.all()` is already priority-sorted).
120
130
  */
121
- protected getStateBucket(phase: DocumentState): readonly BuildPhasePass[] {
131
+ protected getPhaseBucket(phase: DocumentState): readonly BuildPhasePass[] {
122
132
  const current = this.passes.all();
123
- if (this.stateBucketsFor !== current) {
133
+ if (this.phaseBucketsFor !== current) {
124
134
  const next = new Map<DocumentState, BuildPhasePass[]>();
125
135
  for (const pass of current) {
126
- let bucket = next.get(pass.state);
136
+ let bucket = next.get(pass.phase);
127
137
  if (!bucket) {
128
138
  bucket = [];
129
- next.set(pass.state, bucket);
139
+ next.set(pass.phase, bucket);
130
140
  }
131
141
  bucket.push(pass);
132
142
  }
133
- this.stateBuckets = next;
134
- this.stateBucketsFor = current;
143
+ this.phaseBuckets = next;
144
+ this.phaseBucketsFor = current;
135
145
  }
136
- return this.stateBuckets.get(phase) ?? EMPTY_STATE_BUCKET;
146
+ return this.phaseBuckets.get(phase) ?? EMPTY_PHASE_BUCKET;
137
147
  }
138
148
  }
139
149
 
140
- /** Shared empty result so `getStateBucket` doesn't allocate per call on the cold path. */
141
- const EMPTY_STATE_BUCKET: readonly BuildPhasePass[] = Object.freeze([]);
150
+ /** Shared empty result so `getPhaseBucket` doesn't allocate per call on the cold path. */
151
+ const EMPTY_PHASE_BUCKET: readonly BuildPhasePass[] = Object.freeze([]);
@@ -7,10 +7,43 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
 
10
- import { type DocumentState, type LangiumCoreServices, type LangiumDocument, type URI } from '@hydranium/langium';
10
+ import { DocumentState, type LangiumCoreServices, type LangiumDocument, type URI } from '@hydranium/langium';
11
11
  import { type CancellationToken, type Disposable } from 'vscode-languageserver';
12
12
  import { type RegistryItem } from '../../util/registry.js';
13
13
 
14
+ /**
15
+ * The build phases a {@link BuildPhasePass} may fire at: every phase after
16
+ * `Changed`, which has no AST yet. `IndexedContent` is one, unlike for an
17
+ * `AstExtension`: per document it carries nothing `Parsed` does, but per
18
+ * batch it is the only phase meaning the global index is whole again, which
19
+ * batch work keyed on a complete index has nowhere else to run.
20
+ */
21
+ export type BuildPassPhase =
22
+ | DocumentState.Parsed
23
+ | DocumentState.IndexedContent
24
+ | DocumentState.ComputedScopes
25
+ | DocumentState.Linked
26
+ | DocumentState.IndexedReferences
27
+ | DocumentState.Validated;
28
+
29
+ export namespace BuildPassPhase {
30
+ /**
31
+ * Every {@link BuildPassPhase}, in build order. `BuildPipelineIntegration`
32
+ * wires one `onBuildPhase` listener per entry and `register` refuses a phase
33
+ * outside it, so the two cannot drift apart. A fresh array each call.
34
+ */
35
+ export function all(): readonly BuildPassPhase[] {
36
+ return [
37
+ DocumentState.Parsed,
38
+ DocumentState.IndexedContent,
39
+ DocumentState.ComputedScopes,
40
+ DocumentState.Linked,
41
+ DocumentState.IndexedReferences,
42
+ DocumentState.Validated
43
+ ];
44
+ }
45
+ }
46
+
14
47
  /**
15
48
  * A unit of whole-batch work run once per build when the batch reaches a
16
49
  * declared build phase, ordered by {@link RegistryItem.priority}.
@@ -46,12 +79,8 @@ import { type RegistryItem } from '../../util/registry.js';
46
79
  * rather than running the remaining passes against a doomed build.
47
80
  */
48
81
  export interface BuildPhasePass extends RegistryItem {
49
- /**
50
- * The single build phase whose `onBuildPhase` fires this pass. The framework
51
- * wires a listener for the same phase set as AST extension; a pass declaring
52
- * any other state type-checks but never fires.
53
- */
54
- state: DocumentState;
82
+ /** The single build phase whose `onBuildPhase` fires this pass. */
83
+ phase: BuildPassPhase;
55
84
  /**
56
85
  * Run this pass against the whole built batch. May mutate and reparse
57
86
  * documents — the framework's integrity pass does — or derive cross-document
@@ -102,7 +131,7 @@ export function groupDocumentsByLanguage<TLanguage extends LangiumCoreServices>(
102
131
  * Registry handed to a {@link BuildPhasePassContribution}. Implemented by the
103
132
  * `BuildPhasePassService`; doubles
104
133
  * as the low-level imperative API the framework uses to self-register its own
105
- * passes (integrity, the Langium profiler flush).
134
+ * passes (integrity, CST residency).
106
135
  */
107
136
  export interface BuildPhasePassRegistry {
108
137
  register(pass: BuildPhasePass): Disposable;