@hydranium/core 1.0.0-next.19 → 1.0.0-next.192

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 (588) hide show
  1. package/README.md +6 -2
  2. package/lib/documents/ast-document-manager.d.ts +204 -62
  3. package/lib/documents/ast-document-manager.d.ts.map +1 -1
  4. package/lib/documents/ast-document-manager.js +249 -83
  5. package/lib/documents/ast-document-manager.js.map +1 -1
  6. package/lib/documents/client-ids.d.ts +5 -19
  7. package/lib/documents/client-ids.d.ts.map +1 -1
  8. package/lib/documents/client-ids.js +5 -19
  9. package/lib/documents/client-ids.js.map +1 -1
  10. package/lib/documents/client-session-errors.d.ts +15 -0
  11. package/lib/documents/client-session-errors.d.ts.map +1 -0
  12. package/lib/documents/client-session-errors.js +15 -0
  13. package/lib/documents/client-session-errors.js.map +1 -0
  14. package/lib/documents/client-session-registry.d.ts +138 -0
  15. package/lib/documents/client-session-registry.d.ts.map +1 -0
  16. package/lib/documents/client-session-registry.js +187 -0
  17. package/lib/documents/client-session-registry.js.map +1 -0
  18. package/lib/documents/file-system-task-queue.d.ts +49 -0
  19. package/lib/documents/file-system-task-queue.d.ts.map +1 -0
  20. package/lib/documents/file-system-task-queue.js +34 -0
  21. package/lib/documents/file-system-task-queue.js.map +1 -0
  22. package/lib/documents/hydranium-text-documents.d.ts +523 -101
  23. package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
  24. package/lib/documents/hydranium-text-documents.js +961 -177
  25. package/lib/documents/hydranium-text-documents.js.map +1 -1
  26. package/lib/documents/index.d.ts +5 -0
  27. package/lib/documents/index.d.ts.map +1 -1
  28. package/lib/documents/index.js +5 -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/model-ledger.d.ts +47 -0
  35. package/lib/documents/model-ledger.d.ts.map +1 -0
  36. package/lib/documents/model-ledger.js +30 -0
  37. package/lib/documents/model-ledger.js.map +1 -0
  38. package/lib/documents/self-save-registry.d.ts +37 -6
  39. package/lib/documents/self-save-registry.d.ts.map +1 -1
  40. package/lib/documents/self-save-registry.js +28 -15
  41. package/lib/documents/self-save-registry.js.map +1 -1
  42. package/lib/documents/version-sync-service.d.ts +134 -0
  43. package/lib/documents/version-sync-service.d.ts.map +1 -0
  44. package/lib/documents/version-sync-service.js +171 -0
  45. package/lib/documents/version-sync-service.js.map +1 -0
  46. package/lib/index.d.ts +3 -0
  47. package/lib/index.d.ts.map +1 -1
  48. package/lib/index.js +6 -0
  49. package/lib/index.js.map +1 -1
  50. package/lib/langium/ast-extension/ast-extension-service.d.ts.map +1 -1
  51. package/lib/langium/ast-extension/ast-extension-service.js.map +1 -1
  52. package/lib/langium/ast-extension/ast-node-builder.d.ts +32 -9
  53. package/lib/langium/ast-extension/ast-node-builder.d.ts.map +1 -1
  54. package/lib/langium/ast-extension/ast-node-builder.js +60 -22
  55. package/lib/langium/ast-extension/ast-node-builder.js.map +1 -1
  56. package/lib/langium/bootstrap.d.ts.map +1 -1
  57. package/lib/langium/bootstrap.js +32 -9
  58. package/lib/langium/bootstrap.js.map +1 -1
  59. package/lib/langium/build-phase-pass/build-phase-pass-service.d.ts.map +1 -1
  60. package/lib/langium/build-phase-pass/build-phase-pass-service.js.map +1 -1
  61. package/lib/langium/config/configuration-provider.d.ts +81 -0
  62. package/lib/langium/config/configuration-provider.d.ts.map +1 -0
  63. package/lib/langium/config/configuration-provider.js +112 -0
  64. package/lib/langium/config/configuration-provider.js.map +1 -0
  65. package/lib/langium/config/index.d.ts +1 -0
  66. package/lib/langium/config/index.d.ts.map +1 -1
  67. package/lib/langium/config/index.js +1 -0
  68. package/lib/langium/config/index.js.map +1 -1
  69. package/lib/langium/config/settings.js.map +1 -1
  70. package/lib/langium/diagnostics/hydranium-langium-profiler.d.ts.map +1 -1
  71. package/lib/langium/diagnostics/hydranium-langium-profiler.js.map +1 -1
  72. package/lib/langium/diagnostics/logger.d.ts +10 -3
  73. package/lib/langium/diagnostics/logger.d.ts.map +1 -1
  74. package/lib/langium/diagnostics/logger.js +12 -5
  75. package/lib/langium/diagnostics/logger.js.map +1 -1
  76. package/lib/langium/diagnostics/lsp-logger.d.ts +17 -0
  77. package/lib/langium/diagnostics/lsp-logger.d.ts.map +1 -1
  78. package/lib/langium/diagnostics/lsp-logger.js +56 -13
  79. package/lib/langium/diagnostics/lsp-logger.js.map +1 -1
  80. package/lib/langium/diagnostics/server-tracer.d.ts.map +1 -1
  81. package/lib/langium/diagnostics/server-tracer.js.map +1 -1
  82. package/lib/langium/document-builder/build-pipeline-integration.d.ts +21 -1
  83. package/lib/langium/document-builder/build-pipeline-integration.d.ts.map +1 -1
  84. package/lib/langium/document-builder/build-pipeline-integration.js +32 -5
  85. package/lib/langium/document-builder/build-pipeline-integration.js.map +1 -1
  86. package/lib/langium/document-builder/build-session.d.ts +93 -0
  87. package/lib/langium/document-builder/build-session.d.ts.map +1 -0
  88. package/lib/langium/document-builder/build-session.js +72 -0
  89. package/lib/langium/document-builder/build-session.js.map +1 -0
  90. package/lib/langium/document-builder/document-builder.d.ts +382 -29
  91. package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
  92. package/lib/langium/document-builder/document-builder.js +659 -61
  93. package/lib/langium/document-builder/document-builder.js.map +1 -1
  94. package/lib/langium/document-builder/index.d.ts +1 -0
  95. package/lib/langium/document-builder/index.d.ts.map +1 -1
  96. package/lib/langium/document-builder/index.js +1 -0
  97. package/lib/langium/document-builder/index.js.map +1 -1
  98. package/lib/langium/documentation/comment-provider.d.ts.map +1 -1
  99. package/lib/langium/documentation/comment-provider.js.map +1 -1
  100. package/lib/langium/integration-services.d.ts +45 -1
  101. package/lib/langium/integration-services.d.ts.map +1 -1
  102. package/lib/langium/integration-services.js +10 -5
  103. package/lib/langium/integration-services.js.map +1 -1
  104. package/lib/langium/integrity/integrity-rule.d.ts +13 -5
  105. package/lib/langium/integrity/integrity-rule.d.ts.map +1 -1
  106. package/lib/langium/integrity/integrity-rule.js.map +1 -1
  107. package/lib/langium/integrity/integrity-service.d.ts +58 -13
  108. package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
  109. package/lib/langium/integrity/integrity-service.js +204 -29
  110. package/lib/langium/integrity/integrity-service.js.map +1 -1
  111. package/lib/langium/keys/containment.d.ts +64 -0
  112. package/lib/langium/keys/containment.d.ts.map +1 -0
  113. package/lib/langium/keys/containment.js +53 -0
  114. package/lib/langium/keys/containment.js.map +1 -0
  115. package/lib/langium/keys/index.d.ts +1 -0
  116. package/lib/langium/keys/index.d.ts.map +1 -1
  117. package/lib/langium/keys/index.js +1 -0
  118. package/lib/langium/keys/index.js.map +1 -1
  119. package/lib/langium/keys/name-based-key-provider.d.ts +4 -0
  120. package/lib/langium/keys/name-based-key-provider.d.ts.map +1 -1
  121. package/lib/langium/keys/name-based-key-provider.js +4 -0
  122. package/lib/langium/keys/name-based-key-provider.js.map +1 -1
  123. package/lib/langium/keys/positional-key-provider.d.ts.map +1 -1
  124. package/lib/langium/keys/positional-key-provider.js.map +1 -1
  125. package/lib/langium/labeling/label-provider.d.ts.map +1 -1
  126. package/lib/langium/labeling/label-provider.js.map +1 -1
  127. package/lib/langium/language-module.d.ts +27 -2
  128. package/lib/langium/language-module.d.ts.map +1 -1
  129. package/lib/langium/language-module.js +16 -2
  130. package/lib/langium/language-module.js.map +1 -1
  131. package/lib/langium/model-service/client-session.d.ts +311 -0
  132. package/lib/langium/model-service/client-session.d.ts.map +1 -0
  133. package/lib/langium/model-service/client-session.js +398 -0
  134. package/lib/langium/model-service/client-session.js.map +1 -0
  135. package/lib/langium/model-service/index.d.ts +1 -0
  136. package/lib/langium/model-service/index.d.ts.map +1 -1
  137. package/lib/langium/model-service/index.js +1 -0
  138. package/lib/langium/model-service/index.js.map +1 -1
  139. package/lib/langium/model-service/model-service.d.ts +353 -253
  140. package/lib/langium/model-service/model-service.d.ts.map +1 -1
  141. package/lib/langium/model-service/model-service.js +361 -408
  142. package/lib/langium/model-service/model-service.js.map +1 -1
  143. package/lib/langium/module.d.ts +150 -35
  144. package/lib/langium/module.d.ts.map +1 -1
  145. package/lib/langium/module.js +50 -35
  146. package/lib/langium/module.js.map +1 -1
  147. package/lib/langium/naming/name-provider.d.ts +25 -4
  148. package/lib/langium/naming/name-provider.d.ts.map +1 -1
  149. package/lib/langium/naming/name-provider.js +2 -1
  150. package/lib/langium/naming/name-provider.js.map +1 -1
  151. package/lib/langium/naming/name-separator-validation.d.ts +23 -0
  152. package/lib/langium/naming/name-separator-validation.d.ts.map +1 -1
  153. package/lib/langium/naming/name-separator-validation.js +30 -1
  154. package/lib/langium/naming/name-separator-validation.js.map +1 -1
  155. package/lib/langium/project/abstract-project-manager.d.ts.map +1 -1
  156. package/lib/langium/project/abstract-project-manager.js +9 -2
  157. package/lib/langium/project/abstract-project-manager.js.map +1 -1
  158. package/lib/langium/project/project-change-event.d.ts +2 -2
  159. package/lib/langium/project/single-project-manager.d.ts.map +1 -1
  160. package/lib/langium/project/single-project-manager.js.map +1 -1
  161. package/lib/langium/residency/cst-residency-service.d.ts +31 -11
  162. package/lib/langium/residency/cst-residency-service.d.ts.map +1 -1
  163. package/lib/langium/residency/cst-residency-service.js +23 -57
  164. package/lib/langium/residency/cst-residency-service.js.map +1 -1
  165. package/lib/langium/scope/ast-node-description-provider.d.ts.map +1 -1
  166. package/lib/langium/scope/ast-node-description-provider.js.map +1 -1
  167. package/lib/langium/scope/hydranium-scope-computation.d.ts.map +1 -1
  168. package/lib/langium/scope/hydranium-scope-computation.js.map +1 -1
  169. package/lib/langium/scope/hydranium-scope-provider.d.ts +48 -13
  170. package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
  171. package/lib/langium/scope/hydranium-scope-provider.js +56 -20
  172. package/lib/langium/scope/hydranium-scope-provider.js.map +1 -1
  173. package/lib/langium/scope/reference-builder.d.ts.map +1 -1
  174. package/lib/langium/scope/reference-builder.js.map +1 -1
  175. package/lib/langium/scope/reference-candidate-provider.d.ts.map +1 -1
  176. package/lib/langium/scope/reference-candidate-provider.js.map +1 -1
  177. package/lib/langium/scope/scope-extension-service.d.ts.map +1 -1
  178. package/lib/langium/scope/scope-extension-service.js.map +1 -1
  179. package/lib/langium/serialization/abstract-serializer.d.ts +11 -20
  180. package/lib/langium/serialization/abstract-serializer.d.ts.map +1 -1
  181. package/lib/langium/serialization/abstract-serializer.js +12 -21
  182. package/lib/langium/serialization/abstract-serializer.js.map +1 -1
  183. package/lib/langium/serialization/json-serializer.d.ts +1 -1
  184. package/lib/langium/serialization/json-serializer.d.ts.map +1 -1
  185. package/lib/langium/serialization/json-serializer.js.map +1 -1
  186. package/lib/langium/serialization/yaml-serializer.d.ts.map +1 -1
  187. package/lib/langium/serialization/yaml-serializer.js.map +1 -1
  188. package/lib/langium/service-registry.d.ts +15 -1
  189. package/lib/langium/service-registry.d.ts.map +1 -1
  190. package/lib/langium/service-registry.js +16 -0
  191. package/lib/langium/service-registry.js.map +1 -1
  192. package/lib/langium/shared-services.d.ts +21 -4
  193. package/lib/langium/shared-services.d.ts.map +1 -1
  194. package/lib/langium/shared-services.js.map +1 -1
  195. package/lib/langium/transfer/transfer-encoder.d.ts +75 -23
  196. package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -1
  197. package/lib/langium/transfer/transfer-encoder.js +44 -21
  198. package/lib/langium/transfer/transfer-encoder.js.map +1 -1
  199. package/lib/langium/trivia/comment-preserver.d.ts +423 -0
  200. package/lib/langium/trivia/comment-preserver.d.ts.map +1 -0
  201. package/lib/langium/trivia/comment-preserver.js +906 -0
  202. package/lib/langium/trivia/comment-preserver.js.map +1 -0
  203. package/lib/langium/trivia/document-ending-preserver.d.ts +43 -0
  204. package/lib/langium/trivia/document-ending-preserver.d.ts.map +1 -0
  205. package/lib/langium/trivia/document-ending-preserver.js +48 -0
  206. package/lib/langium/trivia/document-ending-preserver.js.map +1 -0
  207. package/lib/langium/trivia/index.d.ts +14 -0
  208. package/lib/langium/trivia/index.d.ts.map +1 -0
  209. package/lib/langium/trivia/index.js +14 -0
  210. package/lib/langium/trivia/index.js.map +1 -0
  211. package/lib/langium/trivia/trivia-contribution.d.ts +37 -0
  212. package/lib/langium/trivia/trivia-contribution.d.ts.map +1 -0
  213. package/lib/langium/trivia/trivia-contribution.js +10 -0
  214. package/lib/langium/trivia/trivia-contribution.js.map +1 -0
  215. package/lib/langium/trivia/trivia-preserver.d.ts +50 -0
  216. package/lib/langium/trivia/trivia-preserver.d.ts.map +1 -0
  217. package/lib/langium/trivia/trivia-preserver.js +10 -0
  218. package/lib/langium/trivia/trivia-preserver.js.map +1 -0
  219. package/lib/langium/trivia/trivia-service.d.ts +70 -0
  220. package/lib/langium/trivia/trivia-service.d.ts.map +1 -0
  221. package/lib/langium/trivia/trivia-service.js +56 -0
  222. package/lib/langium/trivia/trivia-service.js.map +1 -0
  223. package/lib/langium/update-rewrite/normalize-empty-strings.d.ts.map +1 -1
  224. package/lib/langium/update-rewrite/update-rewrite-service.d.ts.map +1 -1
  225. package/lib/langium/update-rewrite/update-rewrite-service.js.map +1 -1
  226. package/lib/langium/update-rewrite/update-rewrite.d.ts +1 -1
  227. package/lib/langium/validation/document-validator.d.ts +294 -10
  228. package/lib/langium/validation/document-validator.d.ts.map +1 -1
  229. package/lib/langium/validation/document-validator.js +448 -5
  230. package/lib/langium/validation/document-validator.js.map +1 -1
  231. package/lib/langium/validation/validation-contribution-collector.d.ts.map +1 -1
  232. package/lib/langium/validation/validation-contribution-collector.js.map +1 -1
  233. package/lib/langium/workspace/document-uri-policy.d.ts +17 -12
  234. package/lib/langium/workspace/document-uri-policy.d.ts.map +1 -1
  235. package/lib/langium/workspace/document-uri-policy.js +10 -9
  236. package/lib/langium/workspace/document-uri-policy.js.map +1 -1
  237. package/lib/langium/workspace/file-not-found.d.ts +17 -0
  238. package/lib/langium/workspace/file-not-found.d.ts.map +1 -0
  239. package/lib/langium/workspace/file-not-found.js +20 -0
  240. package/lib/langium/workspace/file-not-found.js.map +1 -0
  241. package/lib/langium/workspace/file-system-provider.d.ts +84 -8
  242. package/lib/langium/workspace/file-system-provider.d.ts.map +1 -1
  243. package/lib/langium/workspace/file-system-provider.js +93 -14
  244. package/lib/langium/workspace/file-system-provider.js.map +1 -1
  245. package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +56 -1
  246. package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
  247. package/lib/langium/workspace/hydranium-langium-document-factory.js +79 -0
  248. package/lib/langium/workspace/hydranium-langium-document-factory.js.map +1 -1
  249. package/lib/langium/workspace/hydranium-workspace-lock.d.ts +43 -1
  250. package/lib/langium/workspace/hydranium-workspace-lock.d.ts.map +1 -1
  251. package/lib/langium/workspace/hydranium-workspace-lock.js +58 -1
  252. package/lib/langium/workspace/hydranium-workspace-lock.js.map +1 -1
  253. package/lib/langium/workspace/hydranium-workspace-manager.d.ts +81 -8
  254. package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
  255. package/lib/langium/workspace/hydranium-workspace-manager.js +128 -10
  256. package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -1
  257. package/lib/langium/workspace/in-memory-file-system-provider.d.ts +25 -2
  258. package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -1
  259. package/lib/langium/workspace/in-memory-file-system-provider.js +41 -15
  260. package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -1
  261. package/lib/langium/workspace/index-manager.d.ts.map +1 -1
  262. package/lib/langium/workspace/index-manager.js.map +1 -1
  263. package/lib/langium/workspace/initialize-workspace.d.ts +31 -2
  264. package/lib/langium/workspace/initialize-workspace.d.ts.map +1 -1
  265. package/lib/langium/workspace/initialize-workspace.js +13 -5
  266. package/lib/langium/workspace/initialize-workspace.js.map +1 -1
  267. package/lib/langium/workspace/langium-documents.d.ts +86 -17
  268. package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
  269. package/lib/langium/workspace/langium-documents.js +101 -29
  270. package/lib/langium/workspace/langium-documents.js.map +1 -1
  271. package/lib/langium/workspace/persistent-file-system-provider.d.ts +0 -7
  272. package/lib/langium/workspace/persistent-file-system-provider.d.ts.map +1 -1
  273. package/lib/langium/workspace/persistent-file-system-provider.js +0 -7
  274. package/lib/langium/workspace/persistent-file-system-provider.js.map +1 -1
  275. package/lib/langium/workspace/virtual-document.d.ts +48 -15
  276. package/lib/langium/workspace/virtual-document.d.ts.map +1 -1
  277. package/lib/langium/workspace/virtual-document.js +78 -18
  278. package/lib/langium/workspace/virtual-document.js.map +1 -1
  279. package/lib/langium/workspace/write-lock-scope.d.ts +20 -10
  280. package/lib/langium/workspace/write-lock-scope.d.ts.map +1 -1
  281. package/lib/langium/workspace/write-lock-scope.js +12 -4
  282. package/lib/langium/workspace/write-lock-scope.js.map +1 -1
  283. package/lib/locale/index.d.ts +10 -0
  284. package/lib/locale/index.d.ts.map +1 -0
  285. package/lib/locale/index.js +10 -0
  286. package/lib/locale/index.js.map +1 -0
  287. package/lib/locale/server-locale.d.ts +73 -0
  288. package/lib/locale/server-locale.d.ts.map +1 -0
  289. package/lib/locale/server-locale.js +61 -0
  290. package/lib/locale/server-locale.js.map +1 -0
  291. package/lib/lsp/completion/hydranium-completion-provider.d.ts +44 -2
  292. package/lib/lsp/completion/hydranium-completion-provider.d.ts.map +1 -1
  293. package/lib/lsp/completion/hydranium-completion-provider.js +68 -0
  294. package/lib/lsp/completion/hydranium-completion-provider.js.map +1 -1
  295. package/lib/lsp/connection-features.d.ts +23 -0
  296. package/lib/lsp/connection-features.d.ts.map +1 -0
  297. package/lib/lsp/connection-features.js +60 -0
  298. package/lib/lsp/connection-features.js.map +1 -0
  299. package/lib/lsp/diagnostics-connection.d.ts +27 -0
  300. package/lib/lsp/diagnostics-connection.d.ts.map +1 -0
  301. package/lib/lsp/diagnostics-connection.js +53 -0
  302. package/lib/lsp/diagnostics-connection.js.map +1 -0
  303. package/lib/lsp/hydranium-document-update-handler.d.ts +90 -79
  304. package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
  305. package/lib/lsp/hydranium-document-update-handler.js +153 -99
  306. package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
  307. package/lib/lsp/index.d.ts +3 -1
  308. package/lib/lsp/index.d.ts.map +1 -1
  309. package/lib/lsp/index.js +3 -1
  310. package/lib/lsp/index.js.map +1 -1
  311. package/lib/lsp/lsp-latency.d.ts +39 -0
  312. package/lib/lsp/lsp-latency.d.ts.map +1 -0
  313. package/lib/lsp/lsp-latency.js +58 -0
  314. package/lib/lsp/lsp-latency.js.map +1 -0
  315. package/lib/lsp/semantic-token-provider.d.ts +34 -1
  316. package/lib/lsp/semantic-token-provider.d.ts.map +1 -1
  317. package/lib/lsp/semantic-token-provider.js +55 -8
  318. package/lib/lsp/semantic-token-provider.js.map +1 -1
  319. package/lib/lsp/shared-module.d.ts +4 -8
  320. package/lib/lsp/shared-module.d.ts.map +1 -1
  321. package/lib/lsp/shared-module.js.map +1 -1
  322. package/lib/lsp/start-language-server.d.ts +8 -7
  323. package/lib/lsp/start-language-server.d.ts.map +1 -1
  324. package/lib/lsp/start-language-server.js +13 -7
  325. package/lib/lsp/start-language-server.js.map +1 -1
  326. package/lib/messages/carriers.d.ts +54 -0
  327. package/lib/messages/carriers.d.ts.map +1 -0
  328. package/lib/messages/carriers.js +62 -0
  329. package/lib/messages/carriers.js.map +1 -0
  330. package/lib/messages/index.d.ts +25 -0
  331. package/lib/messages/index.d.ts.map +1 -0
  332. package/lib/messages/index.js +25 -0
  333. package/lib/messages/index.js.map +1 -0
  334. package/lib/messages/renderer.d.ts +142 -0
  335. package/lib/messages/renderer.d.ts.map +1 -0
  336. package/lib/messages/renderer.js +165 -0
  337. package/lib/messages/renderer.js.map +1 -0
  338. package/lib/node/event-loop-monitor.js.map +1 -1
  339. package/lib/node/heap-ceiling.d.ts +61 -0
  340. package/lib/node/heap-ceiling.d.ts.map +1 -0
  341. package/lib/node/heap-ceiling.js +72 -0
  342. package/lib/node/heap-ceiling.js.map +1 -0
  343. package/lib/node/index.d.ts +1 -0
  344. package/lib/node/index.d.ts.map +1 -1
  345. package/lib/node/index.js +1 -0
  346. package/lib/node/index.js.map +1 -1
  347. package/lib/node/latency-from-env.d.ts +1 -1
  348. package/lib/node/latency-from-env.js +1 -1
  349. package/lib/node/lint-grammar.js.map +1 -1
  350. package/lib/node/measure-memory.d.ts.map +1 -1
  351. package/lib/node/measure-memory.js +1 -0
  352. package/lib/node/measure-memory.js.map +1 -1
  353. package/lib/node/memory-monitor.js.map +1 -1
  354. package/lib/node/node-file-system-provider.d.ts +39 -4
  355. package/lib/node/node-file-system-provider.d.ts.map +1 -1
  356. package/lib/node/node-file-system-provider.js +109 -49
  357. package/lib/node/node-file-system-provider.js.map +1 -1
  358. package/lib/node/process-memory.js.map +1 -1
  359. package/lib/node/profile-capture.d.ts +8 -2
  360. package/lib/node/profile-capture.d.ts.map +1 -1
  361. package/lib/node/profile-capture.js.map +1 -1
  362. package/lib/node/profile-digest.js.map +1 -1
  363. package/lib/node/profiling-run.d.ts +13 -3
  364. package/lib/node/profiling-run.d.ts.map +1 -1
  365. package/lib/node/profiling-run.js +17 -8
  366. package/lib/node/profiling-run.js.map +1 -1
  367. package/lib/node/rename-over-open-readers.d.ts +52 -0
  368. package/lib/node/rename-over-open-readers.d.ts.map +1 -0
  369. package/lib/node/rename-over-open-readers.js +66 -0
  370. package/lib/node/rename-over-open-readers.js.map +1 -0
  371. package/lib/node/socket-launcher.d.ts +16 -1
  372. package/lib/node/socket-launcher.d.ts.map +1 -1
  373. package/lib/node/socket-launcher.js +4 -3
  374. package/lib/node/socket-launcher.js.map +1 -1
  375. package/lib/node/stdio-launcher.d.ts +1 -1
  376. package/lib/node/stdio-launcher.d.ts.map +1 -1
  377. package/lib/node/stdio-launcher.js +1 -1
  378. package/lib/node/stdio-launcher.js.map +1 -1
  379. package/lib/testing/document-uri-policy-conformance.js.map +1 -1
  380. package/lib/testing/fake-description.js.map +1 -1
  381. package/lib/testing/fake-document.d.ts +16 -4
  382. package/lib/testing/fake-document.d.ts.map +1 -1
  383. package/lib/testing/fake-document.js +18 -3
  384. package/lib/testing/fake-document.js.map +1 -1
  385. package/lib/testing/index.d.ts +1 -1
  386. package/lib/testing/index.d.ts.map +1 -1
  387. package/lib/testing/index.js +2 -1
  388. package/lib/testing/index.js.map +1 -1
  389. package/lib/testing/langium-test-helpers.d.ts.map +1 -1
  390. package/lib/testing/langium-test-helpers.js +1 -0
  391. package/lib/testing/langium-test-helpers.js.map +1 -1
  392. package/lib/testing/make-noop-language-services.js.map +1 -1
  393. package/lib/testing/make-noop-shared-services.d.ts +14 -0
  394. package/lib/testing/make-noop-shared-services.d.ts.map +1 -1
  395. package/lib/testing/make-noop-shared-services.js +28 -2
  396. package/lib/testing/make-noop-shared-services.js.map +1 -1
  397. package/lib/testing/make-test-services.d.ts +69 -14
  398. package/lib/testing/make-test-services.d.ts.map +1 -1
  399. package/lib/testing/make-test-services.js +39 -10
  400. package/lib/testing/make-test-services.js.map +1 -1
  401. package/lib/testing/make-test-tracer.js.map +1 -1
  402. package/lib/testing/node/golden-corpus.js.map +1 -1
  403. package/lib/testing/node/index.d.ts +1 -0
  404. package/lib/testing/node/index.d.ts.map +1 -1
  405. package/lib/testing/node/index.js +1 -0
  406. package/lib/testing/node/index.js.map +1 -1
  407. package/lib/testing/node/lsp-harness.d.ts.map +1 -1
  408. package/lib/testing/node/lsp-harness.js +2 -0
  409. package/lib/testing/node/lsp-harness.js.map +1 -1
  410. package/lib/testing/node/lsp-server-connection.d.ts +11 -3
  411. package/lib/testing/node/lsp-server-connection.d.ts.map +1 -1
  412. package/lib/testing/node/lsp-server-connection.js +42 -9
  413. package/lib/testing/node/lsp-server-connection.js.map +1 -1
  414. package/lib/testing/node/scratch-workspace.d.ts.map +1 -1
  415. package/lib/testing/node/scratch-workspace.js +10 -5
  416. package/lib/testing/node/scratch-workspace.js.map +1 -1
  417. package/lib/testing/node/spawned-server.d.ts +14 -0
  418. package/lib/testing/node/spawned-server.d.ts.map +1 -1
  419. package/lib/testing/node/spawned-server.js +33 -1
  420. package/lib/testing/node/spawned-server.js.map +1 -1
  421. package/lib/testing/node/unhandled-rejections.d.ts +20 -0
  422. package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
  423. package/lib/testing/node/unhandled-rejections.js +32 -0
  424. package/lib/testing/node/unhandled-rejections.js.map +1 -0
  425. package/lib/testing/playwright/browser-capture-bridge.js.map +1 -1
  426. package/lib/testing/playwright/e2e-profiling.js.map +1 -1
  427. package/lib/testing/playwright/flaky-network-proxy.d.ts +76 -0
  428. package/lib/testing/playwright/flaky-network-proxy.d.ts.map +1 -0
  429. package/lib/testing/playwright/flaky-network-proxy.js +164 -0
  430. package/lib/testing/playwright/flaky-network-proxy.js.map +1 -0
  431. package/lib/testing/playwright/index.d.ts +1 -0
  432. package/lib/testing/playwright/index.d.ts.map +1 -1
  433. package/lib/testing/playwright/index.js +1 -0
  434. package/lib/testing/playwright/index.js.map +1 -1
  435. package/lib/testing/playwright/server-log-capture.d.ts +24 -8
  436. package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
  437. package/lib/testing/playwright/server-log-capture.js +27 -6
  438. package/lib/testing/playwright/server-log-capture.js.map +1 -1
  439. package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -1
  440. package/lib/testing/playwright/server-log-rename-reporter.js +10 -1
  441. package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -1
  442. package/lib/testing/run-update-pipeline.d.ts +4 -4
  443. package/lib/testing/run-update-pipeline.d.ts.map +1 -1
  444. package/lib/testing/stub-ast-document-manager.d.ts +11 -9
  445. package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
  446. package/lib/testing/stub-ast-document-manager.js +23 -9
  447. package/lib/testing/stub-ast-document-manager.js.map +1 -1
  448. package/lib/testing/stub-document-builder.d.ts +26 -11
  449. package/lib/testing/stub-document-builder.d.ts.map +1 -1
  450. package/lib/testing/stub-document-builder.js +57 -4
  451. package/lib/testing/stub-document-builder.js.map +1 -1
  452. package/lib/testing/stub-hydranium-text-documents.d.ts +22 -7
  453. package/lib/testing/stub-hydranium-text-documents.d.ts.map +1 -1
  454. package/lib/testing/stub-hydranium-text-documents.js +97 -15
  455. package/lib/testing/stub-hydranium-text-documents.js.map +1 -1
  456. package/lib/testing/stub-index-manager.js.map +1 -1
  457. package/lib/testing/stub-langium-documents.d.ts +3 -2
  458. package/lib/testing/stub-langium-documents.d.ts.map +1 -1
  459. package/lib/testing/stub-langium-documents.js.map +1 -1
  460. package/lib/testing/stub-model-service.d.ts +7 -6
  461. package/lib/testing/stub-model-service.d.ts.map +1 -1
  462. package/lib/testing/stub-model-service.js +4 -4
  463. package/lib/testing/stub-model-service.js.map +1 -1
  464. package/lib/testing/stub-project-manager.js.map +1 -1
  465. package/lib/testing/stub-service-registry.js.map +1 -1
  466. package/lib/util/connection-liveness.d.ts +7 -6
  467. package/lib/util/connection-liveness.d.ts.map +1 -1
  468. package/lib/util/connection-liveness.js +35 -14
  469. package/lib/util/connection-liveness.js.map +1 -1
  470. package/lib/util/environment.d.ts.map +1 -1
  471. package/lib/util/environment.js.map +1 -1
  472. package/lib/util/registry.d.ts.map +1 -1
  473. package/package.json +35 -26
  474. package/src/documents/ast-document-manager.ts +377 -125
  475. package/src/documents/client-ids.ts +5 -22
  476. package/src/documents/client-session-errors.ts +24 -0
  477. package/src/documents/client-session-registry.ts +240 -0
  478. package/src/documents/file-system-task-queue.ts +68 -0
  479. package/src/documents/hydranium-text-documents.ts +1175 -225
  480. package/src/documents/index.ts +5 -0
  481. package/src/documents/language-client-text-shadow.ts +59 -11
  482. package/src/documents/model-ledger.ts +66 -0
  483. package/src/documents/self-save-registry.ts +52 -13
  484. package/src/documents/version-sync-service.ts +267 -0
  485. package/src/index.ts +6 -0
  486. package/src/langium/ast-extension/ast-node-builder.ts +66 -22
  487. package/src/langium/bootstrap.ts +32 -9
  488. package/src/langium/config/configuration-provider.ts +119 -0
  489. package/src/langium/config/index.ts +1 -0
  490. package/src/langium/diagnostics/logger.ts +12 -5
  491. package/src/langium/diagnostics/lsp-logger.ts +58 -12
  492. package/src/langium/document-builder/build-pipeline-integration.ts +50 -5
  493. package/src/langium/document-builder/build-session.ts +87 -0
  494. package/src/langium/document-builder/document-builder.ts +776 -59
  495. package/src/langium/document-builder/index.ts +1 -0
  496. package/src/langium/integration-services.ts +67 -6
  497. package/src/langium/integrity/integrity-rule.ts +13 -5
  498. package/src/langium/integrity/integrity-service.ts +220 -30
  499. package/src/langium/keys/containment.ts +87 -0
  500. package/src/langium/keys/index.ts +1 -0
  501. package/src/langium/keys/name-based-key-provider.ts +4 -0
  502. package/src/langium/language-module.ts +42 -4
  503. package/src/langium/model-service/client-session.ts +614 -0
  504. package/src/langium/model-service/index.ts +1 -0
  505. package/src/langium/model-service/model-service.ts +570 -433
  506. package/src/langium/module.ts +201 -64
  507. package/src/langium/naming/name-provider.ts +27 -5
  508. package/src/langium/naming/name-separator-validation.ts +34 -5
  509. package/src/langium/project/abstract-project-manager.ts +9 -1
  510. package/src/langium/project/project-change-event.ts +2 -2
  511. package/src/langium/residency/cst-residency-service.ts +46 -15
  512. package/src/langium/scope/hydranium-scope-provider.ts +60 -22
  513. package/src/langium/serialization/abstract-serializer.ts +13 -32
  514. package/src/langium/service-registry.ts +19 -2
  515. package/src/langium/shared-services.ts +25 -4
  516. package/src/langium/transfer/transfer-encoder.ts +102 -34
  517. package/src/langium/trivia/comment-preserver.ts +1100 -0
  518. package/src/langium/trivia/document-ending-preserver.ts +55 -0
  519. package/src/langium/trivia/index.ts +14 -0
  520. package/src/langium/trivia/trivia-contribution.ts +39 -0
  521. package/src/langium/trivia/trivia-preserver.ts +54 -0
  522. package/src/langium/trivia/trivia-service.ts +99 -0
  523. package/src/langium/update-rewrite/update-rewrite.ts +1 -1
  524. package/src/langium/validation/document-validator.ts +537 -11
  525. package/src/langium/workspace/document-uri-policy.ts +17 -12
  526. package/src/langium/workspace/file-not-found.ts +23 -0
  527. package/src/langium/workspace/file-system-provider.ts +153 -16
  528. package/src/langium/workspace/hydranium-langium-document-factory.ts +117 -0
  529. package/src/langium/workspace/hydranium-workspace-lock.ts +86 -2
  530. package/src/langium/workspace/hydranium-workspace-manager.ts +153 -13
  531. package/src/langium/workspace/in-memory-file-system-provider.ts +47 -16
  532. package/src/langium/workspace/initialize-workspace.ts +43 -5
  533. package/src/langium/workspace/langium-documents.ts +124 -33
  534. package/src/langium/workspace/persistent-file-system-provider.ts +0 -7
  535. package/src/langium/workspace/virtual-document.ts +96 -19
  536. package/src/langium/workspace/write-lock-scope.ts +24 -11
  537. package/src/locale/index.ts +10 -0
  538. package/src/locale/server-locale.ts +86 -0
  539. package/src/lsp/completion/hydranium-completion-provider.ts +82 -2
  540. package/src/lsp/connection-features.ts +67 -0
  541. package/src/lsp/diagnostics-connection.ts +56 -0
  542. package/src/lsp/hydranium-document-update-handler.ts +185 -106
  543. package/src/lsp/index.ts +3 -1
  544. package/src/lsp/lsp-latency.ts +62 -0
  545. package/src/lsp/semantic-token-provider.ts +74 -7
  546. package/src/lsp/shared-module.ts +4 -8
  547. package/src/lsp/start-language-server.ts +13 -7
  548. package/src/messages/carriers.ts +78 -0
  549. package/src/messages/index.ts +36 -0
  550. package/src/messages/renderer.ts +212 -0
  551. package/src/node/heap-ceiling.ts +108 -0
  552. package/src/node/index.ts +1 -0
  553. package/src/node/latency-from-env.ts +1 -1
  554. package/src/node/measure-memory.ts +1 -0
  555. package/src/node/node-file-system-provider.ts +122 -51
  556. package/src/node/profile-capture.ts +8 -2
  557. package/src/node/profiling-run.ts +30 -8
  558. package/src/node/rename-over-open-readers.ts +78 -0
  559. package/src/node/socket-launcher.ts +19 -4
  560. package/src/node/stdio-launcher.ts +1 -2
  561. package/src/testing/fake-document.ts +24 -5
  562. package/src/testing/index.ts +2 -1
  563. package/src/testing/langium-test-helpers.ts +1 -0
  564. package/src/testing/make-noop-shared-services.ts +50 -2
  565. package/src/testing/make-test-services.ts +120 -31
  566. package/src/testing/node/index.ts +1 -0
  567. package/src/testing/node/lsp-harness.ts +2 -0
  568. package/src/testing/node/lsp-server-connection.ts +61 -11
  569. package/src/testing/node/scratch-workspace.ts +10 -5
  570. package/src/testing/node/spawned-server.ts +35 -1
  571. package/src/testing/node/unhandled-rejections.ts +31 -0
  572. package/src/testing/playwright/flaky-network-proxy.ts +240 -0
  573. package/src/testing/playwright/index.ts +1 -0
  574. package/src/testing/playwright/server-log-capture.ts +45 -11
  575. package/src/testing/playwright/server-log-rename-reporter.ts +12 -1
  576. package/src/testing/run-update-pipeline.ts +4 -4
  577. package/src/testing/stub-ast-document-manager.ts +37 -22
  578. package/src/testing/stub-document-builder.ts +83 -17
  579. package/src/testing/stub-hydranium-text-documents.ts +133 -23
  580. package/src/testing/stub-langium-documents.ts +3 -2
  581. package/src/testing/stub-model-service.ts +9 -8
  582. package/src/util/connection-liveness.ts +37 -14
  583. package/src/util/environment.ts +9 -1
  584. package/lib/lsp/instrument-connection.d.ts +0 -36
  585. package/lib/lsp/instrument-connection.d.ts.map +0 -1
  586. package/lib/lsp/instrument-connection.js +0 -62
  587. package/lib/lsp/instrument-connection.js.map +0 -1
  588. package/src/lsp/instrument-connection.ts +0 -66
@@ -1 +1 @@
1
- {"version":3,"file":"document-uri-policy.js","sourceRoot":"","sources":["../../../src/langium/workspace/document-uri-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAY,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAexD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAiB,EAAE,EAA6B;IACpF,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,CAAC,Q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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,OAAO,yBAA0B,SAAQ,wBAAwB;IACjD,EAAE,CAA4B;IAEjD,YAAY,QAAqC;QAC9C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC;IACnD,CAAC;IAEQ,YAAY,CAAC,GAAiB;QACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;QAClD,yEAAyE;QACzE,uEAAuE;QACvE,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACpF,CAAC;IAEQ,OAAO,CAAC,GAAiB;QAC/B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,kEAAkE;QAClE,yEAAyE;QACzE,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACrD,CAAC;CACH"}
@@ -0,0 +1,17 @@
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 URI } from '@hydranium/langium';
10
+ /**
11
+ * A missing-file error shaped as a Node file system raises it, with code
12
+ * `ENOENT` and the path: callers tell a missing file from any other failure by
13
+ * those two fields, whichever provider is bound. The last close relies on it to
14
+ * tell a document gone meanwhile from any other failed rebuild.
15
+ */
16
+ export declare function notFound(message: string, uri: URI): Error;
17
+ //# sourceMappingURL=file-not-found.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-not-found.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/file-not-found.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAK9C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,KAAK,CAEzD"}
@@ -0,0 +1,20 @@
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
+ // Not re-exported from the workspace barrel: the framework's providers share
10
+ // it, and it is no API of theirs.
11
+ /**
12
+ * A missing-file error shaped as a Node file system raises it, with code
13
+ * `ENOENT` and the path: callers tell a missing file from any other failure by
14
+ * those two fields, whichever provider is bound. The last close relies on it to
15
+ * tell a document gone meanwhile from any other failed rebuild.
16
+ */
17
+ export function notFound(message, uri) {
18
+ return Object.assign(new Error(message), { code: 'ENOENT', path: uri.fsPath });
19
+ }
20
+ //# sourceMappingURL=file-not-found.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-not-found.js","sourceRoot":"","sources":["../../../src/langium/workspace/file-not-found.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,6EAA6E;AAC7E,kCAAkC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,GAAQ;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAClF,CAAC"}
@@ -8,23 +8,99 @@
8
8
  ********************************************************************************/
9
9
  import { type Tracer } from '@hydranium/protocol';
10
10
  import { EmptyFileSystemProvider } from '@hydranium/langium';
11
- import type { URI } from '@hydranium/langium';
11
+ import type { FileSystemNode, URI } from '@hydranium/langium';
12
12
  import { type WritableFileSystemProvider } from '../../documents/ast-document-manager.js';
13
13
  import { type LogNameOptions } from '../diagnostics/logger.js';
14
14
  import { type ServerSharedServicesMinimal } from '../shared-services.js';
15
15
  /**
16
- * Empty-filesystem default {@link WritableFileSystemProvider}. For
17
- * in-memory / browser / test / CLI hosts that don't have a real filesystem.
18
- * All writes are no-ops. This is the portable `.`-entry default; the
19
- * Node-backed `DefaultFileSystemProvider`
20
- * lives in `@hydranium/core/node` (it pulls `node:fs`).
16
+ * Empty-filesystem {@link WritableFileSystemProvider}. For browser / test / CLI
17
+ * hosts that don't have a real filesystem. All writes are no-ops. On the
18
+ * portable `.` entry it is the {@link FileSystemProviderRegistry.host} when
19
+ * `context.fileSystemProvider` gives no writable provider; the Node-backed
20
+ * `DefaultFileSystemProvider` lives in `@hydranium/core/node` (it pulls
21
+ * `node:fs`).
21
22
  */
22
23
  export declare class DefaultEmptyFileSystemProvider extends EmptyFileSystemProvider implements WritableFileSystemProvider {
23
24
  protected readonly services: ServerSharedServicesMinimal;
24
25
  protected readonly tracer: Tracer;
25
26
  constructor(services: ServerSharedServicesMinimal, options?: LogNameOptions);
26
27
  writeFile(_uri: URI, _content: string): Promise<void>;
27
- readFile(uri?: URI): Promise<string>;
28
- readFileSync(uri?: URI): string;
28
+ readFile(_uri?: URI): Promise<string>;
29
+ readBinary(_uri?: URI): Promise<Uint8Array>;
30
+ stat(uri: URI): Promise<FileSystemNode>;
31
+ }
32
+ /**
33
+ * The provider bound on `workspace.FileSystemProvider`: it dispatches each call
34
+ * by the URI's scheme to the provider registered for it in the shared
35
+ * `fileSystemProviders` group, and to the {@link host} for any scheme without
36
+ * one.
37
+ *
38
+ * So one provider answers for each scheme, and a host's provider needs to know
39
+ * only its own: the framework registers `virtual:` there, and an adopter adds a
40
+ * scheme by contributing to the group. The host takes every unclaimed scheme
41
+ * rather than `file:` alone, which keeps an in-memory workspace under `memory:`
42
+ * or any other scheme on the host's provider.
43
+ *
44
+ * `THost` types the host, so an adopter whose own provider has more members
45
+ * than the base declares the slot as `FileSystemProviderRegistry<MyProvider>`,
46
+ * binds a {@link DefaultFileSystemProviderRegistry} with that host, and reads
47
+ * those members through `services.workspace.FileSystemProvider.host`.
48
+ */
49
+ export interface FileSystemProviderRegistry<THost extends WritableFileSystemProvider = WritableFileSystemProvider> extends WritableFileSystemProvider {
50
+ /** The provider for every scheme no entry of `fileSystemProviders` claims. */
51
+ readonly host: THost;
52
+ /** The provider that answers for `uri`. */
53
+ providerFor(uri: URI): WritableFileSystemProvider;
54
+ }
55
+ /** Options for {@link DefaultFileSystemProviderRegistry}. */
56
+ export interface FileSystemProviderRegistryOptions<THost extends WritableFileSystemProvider = WritableFileSystemProvider> extends LogNameOptions {
57
+ /**
58
+ * The provider for every scheme no entry of `fileSystemProviders` claims.
59
+ * The framework passes the provider `context.fileSystemProvider` returns,
60
+ * or a {@link DefaultEmptyFileSystemProvider} when that is not writable.
61
+ */
62
+ host: THost;
63
+ }
64
+ /**
65
+ * The framework's {@link FileSystemProviderRegistry}.
66
+ *
67
+ * A directory is listed by the provider of its own scheme, so a workspace
68
+ * root's tree comes from that provider alone.
69
+ *
70
+ * `realpath` and `mtimeMs` are always present and forward to the scheme's
71
+ * provider. Where that provider lacks one, `realpath` returns the URI unchanged
72
+ * and `mtimeMs` returns `undefined`: the answers `RealpathDocumentUriPolicy`
73
+ * and the self-save filter already give a provider without them.
74
+ */
75
+ export declare class DefaultFileSystemProviderRegistry<THost extends WritableFileSystemProvider = WritableFileSystemProvider> implements FileSystemProviderRegistry<THost> {
76
+ protected readonly services: ServerSharedServicesMinimal & {
77
+ fileSystemProviders: Record<string, WritableFileSystemProvider>;
78
+ };
79
+ readonly host: THost;
80
+ protected readonly tracer: Tracer;
81
+ constructor(services: ServerSharedServicesMinimal & {
82
+ fileSystemProviders: Record<string, WritableFileSystemProvider>;
83
+ }, options: FileSystemProviderRegistryOptions<THost>);
84
+ /**
85
+ * The group is read per call, not in the constructor, so a registered
86
+ * provider is built on first use and may read slots that reach back to this
87
+ * one. Only an OWN key of the group counts: the DI container resolves any
88
+ * key found on the prototype chain, so a scheme such as `constructor` would
89
+ * otherwise dispatch to a function.
90
+ */
91
+ providerFor(uri: URI): WritableFileSystemProvider;
92
+ writeFile(uri: URI, content: string): Promise<void>;
93
+ mtimeMs(uri: URI): Promise<number | undefined>;
94
+ realpath(uri: URI): URI | undefined;
95
+ stat(uri: URI): Promise<FileSystemNode>;
96
+ statSync(uri: URI): FileSystemNode;
97
+ exists(uri: URI): Promise<boolean>;
98
+ existsSync(uri: URI): boolean;
99
+ readBinary(uri: URI): Promise<Uint8Array>;
100
+ readBinarySync(uri: URI): Uint8Array;
101
+ readFile(uri: URI): Promise<string>;
102
+ readFileSync(uri: URI): string;
103
+ readDirectory(uri: URI): Promise<FileSystemNode[]>;
104
+ readDirectorySync(uri: URI): FileSystemNode[];
29
105
  }
30
106
  //# sourceMappingURL=file-system-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-system-provider.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/file-system-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,yCAAyC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AAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;KAAE,EAC9H,OAAO,EAAE,iCAAiC,CAAC,KAAK,CAAC,EAInD;IAED;;;;;;OAMG;IACH,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,0BAA0B,CAGhD;IAIK,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExD;IAEK,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEnD;IAED,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAGlC;IAEK,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAE5C;IAED,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CAEjC;IAEK,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAEvC;IAED,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAE5B;IAEK,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAE9C;IAED,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEnC;IAEK,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAExC;IAED,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAE7B;IAEK,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAEvD;IAED,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,EAAE,CAE5C;CACH"}
@@ -7,13 +7,13 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  import { EmptyFileSystemProvider } from '@hydranium/langium';
10
- import { serveVirtualDocument } from './virtual-document.js';
11
10
  /**
12
- * Empty-filesystem default {@link WritableFileSystemProvider}. For
13
- * in-memory / browser / test / CLI hosts that don't have a real filesystem.
14
- * All writes are no-ops. This is the portable `.`-entry default; the
15
- * Node-backed `DefaultFileSystemProvider`
16
- * lives in `@hydranium/core/node` (it pulls `node:fs`).
11
+ * Empty-filesystem {@link WritableFileSystemProvider}. For browser / test / CLI
12
+ * hosts that don't have a real filesystem. All writes are no-ops. On the
13
+ * portable `.` entry it is the {@link FileSystemProviderRegistry.host} when
14
+ * `context.fileSystemProvider` gives no writable provider; the Node-backed
15
+ * `DefaultFileSystemProvider` lives in `@hydranium/core/node` (it pulls
16
+ * `node:fs`).
17
17
  */
18
18
  export class DefaultEmptyFileSystemProvider extends EmptyFileSystemProvider {
19
19
  services;
@@ -26,16 +26,95 @@ export class DefaultEmptyFileSystemProvider extends EmptyFileSystemProvider {
26
26
  async writeFile(_uri, _content) {
27
27
  // no-op
28
28
  }
29
- // Serve virtual documents from the registered document (there is no disk to
30
- // read); delegate everything else to the empty base (which throws). The
31
- // base declares these param-less, so the param is optional here.
32
- readFile(uri) {
33
- const served = uri !== undefined ? serveVirtualDocument(this.services, uri) : undefined;
34
- return served !== undefined ? Promise.resolve(served) : super.readFile();
29
+ // `async` so the base's refusal becomes a rejection: it throws
30
+ // SYNCHRONOUSLY from a method declared to return a promise, and a
31
+ // synchronous throw escapes the promise chain — `.catch()` never attaches
32
+ // and `Promise.all` dies while its argument array is still being built, so
33
+ // a caller reading several URIs cannot handle the miss it asked about. The
34
+ // base declares `readFile` and `readBinary` param-less, so the param is
35
+ // optional there.
36
+ async readFile(_uri) {
37
+ return super.readFile();
38
+ }
39
+ async readBinary(_uri) {
40
+ return super.readBinary();
41
+ }
42
+ async stat(uri) {
43
+ return super.stat(uri);
44
+ }
45
+ }
46
+ /**
47
+ * The framework's {@link FileSystemProviderRegistry}.
48
+ *
49
+ * A directory is listed by the provider of its own scheme, so a workspace
50
+ * root's tree comes from that provider alone.
51
+ *
52
+ * `realpath` and `mtimeMs` are always present and forward to the scheme's
53
+ * provider. Where that provider lacks one, `realpath` returns the URI unchanged
54
+ * and `mtimeMs` returns `undefined`: the answers `RealpathDocumentUriPolicy`
55
+ * and the self-save filter already give a provider without them.
56
+ */
57
+ export class DefaultFileSystemProviderRegistry {
58
+ services;
59
+ host;
60
+ tracer;
61
+ constructor(services, options) {
62
+ this.services = services;
63
+ this.host = options.host;
64
+ this.tracer = services.Tracer.for(options.logName ?? this.constructor.name).trace('instantiated');
65
+ }
66
+ /**
67
+ * The group is read per call, not in the constructor, so a registered
68
+ * provider is built on first use and may read slots that reach back to this
69
+ * one. Only an OWN key of the group counts: the DI container resolves any
70
+ * key found on the prototype chain, so a scheme such as `constructor` would
71
+ * otherwise dispatch to a function.
72
+ */
73
+ providerFor(uri) {
74
+ const providers = this.services.fileSystemProviders;
75
+ return Object.hasOwn(providers, uri.scheme) ? providers[uri.scheme] : this.host;
76
+ }
77
+ // The async methods are `async` so a provider that throws synchronously from
78
+ // one still rejects, for the reason `DefaultEmptyFileSystemProvider` gives.
79
+ async writeFile(uri, content) {
80
+ return this.providerFor(uri).writeFile(uri, content);
81
+ }
82
+ async mtimeMs(uri) {
83
+ return this.providerFor(uri).mtimeMs?.(uri);
84
+ }
85
+ realpath(uri) {
86
+ const provider = this.providerFor(uri);
87
+ return provider.realpath ? provider.realpath(uri) : uri;
88
+ }
89
+ async stat(uri) {
90
+ return this.providerFor(uri).stat(uri);
91
+ }
92
+ statSync(uri) {
93
+ return this.providerFor(uri).statSync(uri);
94
+ }
95
+ async exists(uri) {
96
+ return this.providerFor(uri).exists(uri);
97
+ }
98
+ existsSync(uri) {
99
+ return this.providerFor(uri).existsSync(uri);
100
+ }
101
+ async readBinary(uri) {
102
+ return this.providerFor(uri).readBinary(uri);
103
+ }
104
+ readBinarySync(uri) {
105
+ return this.providerFor(uri).readBinarySync(uri);
106
+ }
107
+ async readFile(uri) {
108
+ return this.providerFor(uri).readFile(uri);
35
109
  }
36
110
  readFileSync(uri) {
37
- const served = uri !== undefined ? serveVirtualDocument(this.services, uri) : undefined;
38
- return served !== undefined ? served : super.readFileSync();
111
+ return this.providerFor(uri).readFileSync(uri);
112
+ }
113
+ async readDirectory(uri) {
114
+ return this.providerFor(uri).readDirectory(uri);
115
+ }
116
+ readDirectorySync(uri) {
117
+ return this.providerFor(uri).readDirectorySync(uri);
39
118
  }
40
119
  }
41
120
  //# sourceMappingURL=file-system-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-system-provider.js","sourceRoot":"","sources":["../../../src/langium/workspace/file-system-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAK7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,OAAO,8BAA+B,SAAQ,uBAAuB;IAIlD;IAHH,MAAM,CAAS;IAElC,YACsB,QAAqC,EACxD,UAA0B,EAAE;QAE5B,KAAK,EAAE,CAAC;QAHW,aAAQ,GAAR,QAAQ,CAA6B;QAIxD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACrG,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAS,EAAE,QAAgB;QACxC,QAAQ;IACX,CAAC;IAED,4EAA4E;IAC5E,wEAAwE;IACxE,iEAAiE;IACxD,QAAQ,CAAC,GAAS;QACxB,MAAM,MAAM,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACxF,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,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AC;IAED,iBAAiB,CAAC,GAAQ;QACvB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;CACH"}
@@ -6,7 +6,13 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
- import { type AstNode, DefaultLangiumDocumentFactory, type LangiumDocument, type URI } from '@hydranium/langium';
9
+ import { type AstNode, DefaultLangiumDocumentFactory, type LangiumDocument, type Mutable, type ParseResult, type URI } from '@hydranium/langium';
10
+ import { type CancellationToken } from 'vscode-languageserver-protocol';
11
+ import { type TextDocument } from 'vscode-languageserver-textdocument';
12
+ import { type ModelLedger } from '../../documents/model-ledger.js';
13
+ import { type VersionSyncService } from '../../documents/version-sync-service.js';
14
+ import { type ExtendedServiceRegistry } from '../service-registry.js';
15
+ import { type ServerSharedServicesMinimal } from '../shared-services.js';
10
16
  /**
11
17
  * Framework `LangiumDocumentFactory` that fills in the one thing Langium
12
18
  * leaves empty for a code-built document: its text.
@@ -34,7 +40,56 @@ import { type AstNode, DefaultLangiumDocumentFactory, type LangiumDocument, type
34
40
  * node identity is preserved.
35
41
  */
36
42
  export declare class HydraniumLangiumDocumentFactory extends DefaultLangiumDocumentFactory {
43
+ /**
44
+ * Narrows the inherited Langium `ServiceRegistry` field to the framework's
45
+ * {@link ExtendedServiceRegistry}, so the by-id lookup below needs no
46
+ * per-callsite cast. The framework's shared module binds that class.
47
+ */
48
+ protected readonly serviceRegistry: ExtendedServiceRegistry;
49
+ /** Resolved per call: the sync service reaches the registry, which is built with this factory. */
50
+ protected readonly versionSyncService: () => VersionSyncService;
51
+ protected readonly modelLedger: () => ModelLedger;
52
+ constructor(services: ServerSharedServicesMinimal);
53
+ /**
54
+ * Parse `text` for `uri` under the grammar `languageId` names, instead of
55
+ * the one `uri` routes to.
56
+ *
57
+ * For a URI that routes to no grammar at all: a directory, or any other URI
58
+ * that names no file and so carries no extension. Langium's ladder ends at
59
+ * the extension, so it reports `no services for the extension ''` from
60
+ * inside the parse — naming neither the URI nor the caller that could have
61
+ * said which grammar it meant.
62
+ *
63
+ * The caller supplies the language because nothing else can. A URI with no
64
+ * extension carries no routing signal, and choosing on its behalf would be a
65
+ * guess the moment a second grammar is registered — which is why this takes
66
+ * the id rather than falling back to a sole registered language.
67
+ *
68
+ * @throws when `languageId` names no registered grammar.
69
+ */
70
+ fromStringInLanguage<T extends AstNode = AstNode>(text: string, uri: URI, languageId: string): LangiumDocument<T>;
37
71
  fromModel<T extends AstNode = AstNode>(model: T, uri: URI): LangiumDocument<T>;
72
+ protected createLangiumDocument<T extends AstNode = AstNode>(parseResult: ParseResult<T>, uri: URI, textDocument?: TextDocument, text?: string): LangiumDocument<T>;
73
+ /**
74
+ * The version is read before the parse, for the same reason as in
75
+ * {@link update}: the text document is the store's, which an edit updates
76
+ * in place while the parse runs.
77
+ */
78
+ protected createAsync<T extends AstNode = AstNode>(uri: URI, content: string | TextDocument, cancelToken: CancellationToken): Promise<LangiumDocument<T>>;
79
+ /**
80
+ * The store's version is read before Langium's `update`, which reads the
81
+ * store's text before its first await: read after, it can belong to an
82
+ * edit that arrived while the parse ran.
83
+ *
84
+ * Reconciled with the store here rather than in a `Parsed` listener, which
85
+ * a cancel skips, leaving the root on the version of its earlier text.
86
+ */
87
+ update<T extends AstNode = AstNode>(document: Mutable<LangiumDocument<T>>, cancellationToken: CancellationToken): Promise<LangiumDocument<T>>;
88
+ /**
89
+ * `version`, or {@link STALE_VERSION} when the store holds `uri` open with
90
+ * other text than `parsed`: text read from the file while an open landed.
91
+ */
92
+ protected versionOfParsedText(uri: URI, parsed: string | undefined, version: number): number;
38
93
  /**
39
94
  * Serialize `model` via the per-language serializer, or `undefined` if none
40
95
  * is bound, it fails, or it is async — `fromModel` is synchronous, so an
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-langium-document-factory.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,OAAO,EAEZ,6BAA6B,EAC7B,KAAK,eAAe,EAEpB,KAAK,GAAG,EACV,MAAM,oBAAoB,CAAC;AAQ5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,+BAAgC,SAAQ,6BAA6B;IACtE,SAAS,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC;IAYvF;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS;CASxE"}
1
+ {"version":3,"file":"hydranium-langium-document-factory.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,OAAO,EAEZ,6BAA6B,EAC7B,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,GAAG,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAQzE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,+BAAgC,SAAQ,6BAA6B;IAC/E;;;;OAIG;IACH,mBAA2B,eAAe,EAAE,uBAAuB,CAAC;IAEpE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,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3F;IAED;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAQrE;CACH"}
@@ -7,6 +7,7 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  import { AstUtils, DefaultLangiumDocumentFactory } from '@hydranium/langium';
10
+ import { STALE_VERSION } from '@hydranium/protocol';
10
11
  /**
11
12
  * Framework `LangiumDocumentFactory` that fills in the one thing Langium
12
13
  * leaves empty for a code-built document: its text.
@@ -34,6 +35,39 @@ import { AstUtils, DefaultLangiumDocumentFactory } from '@hydranium/langium';
34
35
  * node identity is preserved.
35
36
  */
36
37
  export class HydraniumLangiumDocumentFactory extends DefaultLangiumDocumentFactory {
38
+ /** Resolved per call: the sync service reaches the registry, which is built with this factory. */
39
+ versionSyncService;
40
+ modelLedger;
41
+ constructor(services) {
42
+ super(services);
43
+ this.versionSyncService = () => services.workspace.VersionSyncService;
44
+ this.modelLedger = () => services.workspace.ModelLedger;
45
+ }
46
+ /**
47
+ * Parse `text` for `uri` under the grammar `languageId` names, instead of
48
+ * the one `uri` routes to.
49
+ *
50
+ * For a URI that routes to no grammar at all: a directory, or any other URI
51
+ * that names no file and so carries no extension. Langium's ladder ends at
52
+ * the extension, so it reports `no services for the extension ''` from
53
+ * inside the parse — naming neither the URI nor the caller that could have
54
+ * said which grammar it meant.
55
+ *
56
+ * The caller supplies the language because nothing else can. A URI with no
57
+ * extension carries no routing signal, and choosing on its behalf would be a
58
+ * guess the moment a second grammar is registered — which is why this takes
59
+ * the id rather than falling back to a sole registered language.
60
+ *
61
+ * @throws when `languageId` names no registered grammar.
62
+ */
63
+ fromStringInLanguage(text, uri, languageId) {
64
+ const services = this.serviceRegistry.getServicesById(languageId);
65
+ if (!services) {
66
+ throw new Error(`No grammar is registered for the language id '${languageId}' (parsing ${uri.toString()}).`);
67
+ }
68
+ const parseResult = services.parser.LangiumParser.parse(text);
69
+ return this.createLangiumDocument(parseResult, uri, undefined, text);
70
+ }
37
71
  fromModel(model, uri) {
38
72
  // Make the code-built AST as structurally complete as a parsed one — the
39
73
  // parser links containers, `fromModel` does not. In place (identity kept).
@@ -45,6 +79,51 @@ export class HydraniumLangiumDocumentFactory extends DefaultLangiumDocumentFacto
45
79
  const parseResult = { value: model, parserErrors: [], lexerErrors: [] };
46
80
  return this.createLangiumDocument(parseResult, uri, undefined, text);
47
81
  }
82
+ createLangiumDocument(parseResult, uri, textDocument, text) {
83
+ const document = super.createLangiumDocument(parseResult, uri, textDocument, text);
84
+ // Without `textDocument` Langium creates one at version 0 on first read,
85
+ // which needs a language for `uri` that a folder URI does not have.
86
+ const parsed = parseResult.value.$cstNode?.root.fullText ?? text ?? textDocument?.getText();
87
+ this.versionSyncService().modelProduced(document, { version: this.versionOfParsedText(uri, parsed, textDocument?.version ?? 0) });
88
+ return document;
89
+ }
90
+ /**
91
+ * The version is read before the parse, for the same reason as in
92
+ * {@link update}: the text document is the store's, which an edit updates
93
+ * in place while the parse runs.
94
+ */
95
+ async createAsync(uri, content, cancelToken) {
96
+ const version = typeof content === 'string' ? undefined : content.version;
97
+ const document = await super.createAsync(uri, content, cancelToken);
98
+ if (version !== undefined) {
99
+ this.versionSyncService().modelProduced(document, { version });
100
+ }
101
+ return document;
102
+ }
103
+ /**
104
+ * The store's version is read before Langium's `update`, which reads the
105
+ * store's text before its first await: read after, it can belong to an
106
+ * edit that arrived while the parse ran.
107
+ *
108
+ * Reconciled with the store here rather than in a `Parsed` listener, which
109
+ * a cancel skips, leaving the root on the version of its earlier text.
110
+ */
111
+ async update(document, cancellationToken) {
112
+ const stored = this.textDocuments?.get(document.uri.toString())?.version;
113
+ const updated = await super.update(document, cancellationToken);
114
+ const version = stored ??
115
+ this.versionOfParsedText(updated.uri, this.modelLedger().textOf(updated.parseResult.value) ?? updated.textDocument.getText(), updated.textDocument.version);
116
+ this.versionSyncService().modelProduced(updated, { version });
117
+ return updated;
118
+ }
119
+ /**
120
+ * `version`, or {@link STALE_VERSION} when the store holds `uri` open with
121
+ * other text than `parsed`: text read from the file while an open landed.
122
+ */
123
+ versionOfParsedText(uri, parsed, version) {
124
+ const open = this.textDocuments?.get(uri.toString());
125
+ return open !== undefined && parsed !== undefined && open.getText() !== parsed ? STALE_VERSION : version;
126
+ }
48
127
  /**
49
128
  * Serialize `model` via the per-language serializer, or `undefined` if none
50
129
  * is bound, it fails, or it is async — `fromModel` is synchronous, so an
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-langium-document-factory.js","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,QAAQ,EACR,6BAA6B,EAI/B,MAAM,oBAAoB,CAAC;AAQ5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,+BAAgC,SAAQ,6BAA6B;IACtE,SAAS,CAA8B,KAAQ,EAAE,GAAQ;QAC/D,yEAAyE;QACzE,2EAA2E;QAC3E,QAAQ,CAAC,sBAAsB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC7C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,WAAW,GAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC,qBAAqB,CAAI,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IAED;;;;OAIG;IACO,cAAc,CAAC,KAAc,EAAE,GAAQ;QAC9C,IAAI,CAAC;YACF,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,CAAmB,CAAC;YACzE,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YACxE,OAAO,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;QAClE,CAAC;QAAC,MAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACpB,CAAC;IACJ,CAAC;CACH"}
1
+ {"version":3,"file":"hydranium-langium-document-factory.js","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,QAAQ,EACR,6BAA6B,EAK/B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,+BAAgC,SAAQ,6BAA6B;IAQ/E,kGAAkG;IAC/E,kBAAkB,CAA2B;IAC7C,WAAW,CAAoB;IAElD,YAAY,QAAqC;QAC9C,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,kBAAkB,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC;QACtE,IAAI,CAAC,WAAW,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,oBAAoB,CAA8B,IAAY,EAAE,GAAQ,EAAE,UAAkB;QACzF,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACb,MAA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E,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9D,OAAO,OAAO,CAAC;IAClB,CAAC;IAED;;;OAGG;IACO,mBAAmB,CAAC,GAAQ,EAAE,MAA0B,EAAE,OAAe;QAChF,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5G,CAAC;IAED;;;;OAIG;IACO,cAAc,CAAC,KAAc,EAAE,GAAQ;QAC9C,IAAI,CAAC;YACF,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,CAAmB,CAAC;YACzE,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YACxE,OAAO,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;QAClE,CAAC;QAAC,MAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACpB,CAAC;IACJ,CAAC;CACH"}
@@ -6,8 +6,25 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
+ import { type Clock, type Tracer } from '@hydranium/protocol';
9
10
  import { DefaultWorkspaceLock, type MaybePromise } from '@hydranium/langium';
10
- import { type CancellationToken } from 'vscode-languageserver-protocol';
11
+ import { type CancellationToken, type Disposable } from 'vscode-languageserver-protocol';
12
+ import { type LogNameOptions } from '../diagnostics/logger.js';
13
+ import { type ServerSharedServicesMinimal } from '../shared-services.js';
14
+ /** Constructor options for {@link HydraniumWorkspaceLock}. */
15
+ export interface HydraniumWorkspaceLockOptions extends LogNameOptions {
16
+ /**
17
+ * How long a write may keep running after a later write cancelled it before
18
+ * the lock logs an error. Every write and read waits behind it meanwhile, so
19
+ * one that never ends stops the server. Defaults to 10 s; `0` turns the
20
+ * check off.
21
+ */
22
+ readonly stalledWriteWarnMs?: number;
23
+ }
24
+ /** The write action a {@link HydraniumWorkspaceLock} is running, with the timer its cancellation started. */
25
+ export interface RunningWrite {
26
+ stallTimer?: Disposable;
27
+ }
11
28
  /**
12
29
  * Langium's {@link DefaultWorkspaceLock} with the write action marked as a
13
30
  * write-lock scope, so anything it reaches can be asked whether the lock is
@@ -26,6 +43,31 @@ import { type CancellationToken } from 'vscode-languageserver-protocol';
26
43
  * would turn ordinary read-then-write sequences into false positives.
27
44
  */
28
45
  export declare class HydraniumWorkspaceLock extends DefaultWorkspaceLock {
46
+ /** Backs {@link writeCancellations}. */
47
+ protected cancelledWriteCount: number;
48
+ protected readonly clock: Clock;
49
+ protected readonly tracer: Tracer;
50
+ protected readonly stalledWriteWarnMs: number;
51
+ protected runningWrite?: RunningWrite;
52
+ constructor(services: Pick<ServerSharedServicesMinimal, 'Clock' | 'Tracer'>, options?: HydraniumWorkspaceLockOptions);
53
+ /**
54
+ * How many calls have cancelled the lock's latest write: every `write`,
55
+ * which cancels the write before it, and every `cancelWrite`. A caller that
56
+ * reads this right after queuing a write, and reads the same number later,
57
+ * holds a write nothing has cancelled, whether it is still queued or
58
+ * already running. Its token answers that only once the write runs, since
59
+ * a queued write has not been handed it yet.
60
+ */
61
+ get writeCancellations(): number;
29
62
  write(action: (token: CancellationToken) => MaybePromise<void>): Promise<void>;
63
+ /** Run `action` as {@link runningWrite}, so a cancellation while it runs can time it. */
64
+ protected runWrite(action: (token: CancellationToken) => MaybePromise<void>, token: CancellationToken): Promise<void>;
65
+ /**
66
+ * Counted here rather than in {@link write}, because Langium's `write` cancels
67
+ * through this method too. A write running when this is called has been
68
+ * cancelled, by this call or an earlier one, so its timer starts here.
69
+ */
70
+ cancelWrite(): void;
71
+ protected reportStalledWrite(): void;
30
72
  }
31
73
  //# sourceMappingURL=hydranium-workspace-lock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-workspace-lock.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-workspace-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,sBAAuB,SAAQ,oBAAoB;IACpD,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzF"}
1
+ {"version":3,"file":"hydranium-workspace-lock.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-workspace-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAGzE,8DAA8D;AAC9D,MAAM,WAAW,6BAA8B,SAAQ,cAAc;IAClE;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACvC;AAID,6GAA6G;AAC7G,MAAM,WAAW,YAAY;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,q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