@hydranium/core 1.0.0-next.10
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.
- package/LICENSE +21 -0
- package/README.md +100 -0
- package/lib/documents/ast-document-manager.d.ts +243 -0
- package/lib/documents/ast-document-manager.d.ts.map +1 -0
- package/lib/documents/ast-document-manager.js +302 -0
- package/lib/documents/ast-document-manager.js.map +1 -0
- package/lib/documents/client-ids.d.ts +30 -0
- package/lib/documents/client-ids.d.ts.map +1 -0
- package/lib/documents/client-ids.js +30 -0
- package/lib/documents/client-ids.js.map +1 -0
- package/lib/documents/hydranium-text-documents.d.ts +490 -0
- package/lib/documents/hydranium-text-documents.d.ts.map +1 -0
- package/lib/documents/hydranium-text-documents.js +893 -0
- package/lib/documents/hydranium-text-documents.js.map +1 -0
- package/lib/documents/index.d.ts +14 -0
- package/lib/documents/index.d.ts.map +1 -0
- package/lib/documents/index.js +14 -0
- package/lib/documents/index.js.map +1 -0
- package/lib/documents/language-client-text-shadow.d.ts +101 -0
- package/lib/documents/language-client-text-shadow.d.ts.map +1 -0
- package/lib/documents/language-client-text-shadow.js +156 -0
- package/lib/documents/language-client-text-shadow.js.map +1 -0
- package/lib/documents/self-save-registry.d.ts +55 -0
- package/lib/documents/self-save-registry.d.ts.map +1 -0
- package/lib/documents/self-save-registry.js +68 -0
- package/lib/documents/self-save-registry.js.map +1 -0
- package/lib/index.d.ts +38 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +39 -0
- package/lib/index.js.map +1 -0
- package/lib/langium/ast-extension/ast-extension-contribution.d.ts +33 -0
- package/lib/langium/ast-extension/ast-extension-contribution.d.ts.map +1 -0
- package/lib/langium/ast-extension/ast-extension-contribution.js +10 -0
- package/lib/langium/ast-extension/ast-extension-contribution.js.map +1 -0
- package/lib/langium/ast-extension/ast-extension-service.d.ts +212 -0
- package/lib/langium/ast-extension/ast-extension-service.d.ts.map +1 -0
- package/lib/langium/ast-extension/ast-extension-service.js +181 -0
- package/lib/langium/ast-extension/ast-extension-service.js.map +1 -0
- package/lib/langium/ast-extension/ast-node-builder.d.ts +90 -0
- package/lib/langium/ast-extension/ast-node-builder.d.ts.map +1 -0
- package/lib/langium/ast-extension/ast-node-builder.js +61 -0
- package/lib/langium/ast-extension/ast-node-builder.js.map +1 -0
- package/lib/langium/ast-extension/index.d.ts +12 -0
- package/lib/langium/ast-extension/index.d.ts.map +1 -0
- package/lib/langium/ast-extension/index.js +12 -0
- package/lib/langium/ast-extension/index.js.map +1 -0
- package/lib/langium/bootstrap.d.ts +224 -0
- package/lib/langium/bootstrap.d.ts.map +1 -0
- package/lib/langium/bootstrap.js +512 -0
- package/lib/langium/bootstrap.js.map +1 -0
- package/lib/langium/build-phase-pass/build-phase-pass-service.d.ts +77 -0
- package/lib/langium/build-phase-pass/build-phase-pass-service.d.ts.map +1 -0
- package/lib/langium/build-phase-pass/build-phase-pass-service.js +102 -0
- package/lib/langium/build-phase-pass/build-phase-pass-service.js.map +1 -0
- package/lib/langium/build-phase-pass/build-phase-pass.d.ts +106 -0
- package/lib/langium/build-phase-pass/build-phase-pass.d.ts.map +1 -0
- package/lib/langium/build-phase-pass/build-phase-pass.js +43 -0
- package/lib/langium/build-phase-pass/build-phase-pass.js.map +1 -0
- package/lib/langium/build-phase-pass/index.d.ts +11 -0
- package/lib/langium/build-phase-pass/index.d.ts.map +1 -0
- package/lib/langium/build-phase-pass/index.js +11 -0
- package/lib/langium/build-phase-pass/index.js.map +1 -0
- package/lib/langium/config/index.d.ts +10 -0
- package/lib/langium/config/index.d.ts.map +1 -0
- package/lib/langium/config/index.js +10 -0
- package/lib/langium/config/index.js.map +1 -0
- package/lib/langium/config/settings.d.ts +173 -0
- package/lib/langium/config/settings.d.ts.map +1 -0
- package/lib/langium/config/settings.js +196 -0
- package/lib/langium/config/settings.js.map +1 -0
- package/lib/langium/diagnostics/hydranium-langium-profiler.d.ts +109 -0
- package/lib/langium/diagnostics/hydranium-langium-profiler.d.ts.map +1 -0
- package/lib/langium/diagnostics/hydranium-langium-profiler.js +153 -0
- package/lib/langium/diagnostics/hydranium-langium-profiler.js.map +1 -0
- package/lib/langium/diagnostics/index.d.ts +14 -0
- package/lib/langium/diagnostics/index.d.ts.map +1 -0
- package/lib/langium/diagnostics/index.js +19 -0
- package/lib/langium/diagnostics/index.js.map +1 -0
- package/lib/langium/diagnostics/log-file-token.d.ts +16 -0
- package/lib/langium/diagnostics/log-file-token.d.ts.map +1 -0
- package/lib/langium/diagnostics/log-file-token.js +25 -0
- package/lib/langium/diagnostics/log-file-token.js.map +1 -0
- package/lib/langium/diagnostics/log-preamble.d.ts +42 -0
- package/lib/langium/diagnostics/log-preamble.d.ts.map +1 -0
- package/lib/langium/diagnostics/log-preamble.js +57 -0
- package/lib/langium/diagnostics/log-preamble.js.map +1 -0
- package/lib/langium/diagnostics/logger.d.ts +104 -0
- package/lib/langium/diagnostics/logger.d.ts.map +1 -0
- package/lib/langium/diagnostics/logger.js +178 -0
- package/lib/langium/diagnostics/logger.js.map +1 -0
- package/lib/langium/diagnostics/lsp-logger.d.ts +76 -0
- package/lib/langium/diagnostics/lsp-logger.d.ts.map +1 -0
- package/lib/langium/diagnostics/lsp-logger.js +223 -0
- package/lib/langium/diagnostics/lsp-logger.js.map +1 -0
- package/lib/langium/diagnostics/server-tracer.d.ts +27 -0
- package/lib/langium/diagnostics/server-tracer.d.ts.map +1 -0
- package/lib/langium/diagnostics/server-tracer.js +66 -0
- package/lib/langium/diagnostics/server-tracer.js.map +1 -0
- package/lib/langium/document-builder/build-pipeline-integration.d.ts +88 -0
- package/lib/langium/document-builder/build-pipeline-integration.d.ts.map +1 -0
- package/lib/langium/document-builder/build-pipeline-integration.js +151 -0
- package/lib/langium/document-builder/build-pipeline-integration.js.map +1 -0
- package/lib/langium/document-builder/document-builder.d.ts +405 -0
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -0
- package/lib/langium/document-builder/document-builder.js +729 -0
- package/lib/langium/document-builder/document-builder.js.map +1 -0
- package/lib/langium/document-builder/index.d.ts +12 -0
- package/lib/langium/document-builder/index.d.ts.map +1 -0
- package/lib/langium/document-builder/index.js +12 -0
- package/lib/langium/document-builder/index.js.map +1 -0
- package/lib/langium/document-builder/labeled-phase-listener.d.ts +21 -0
- package/lib/langium/document-builder/labeled-phase-listener.d.ts.map +1 -0
- package/lib/langium/document-builder/labeled-phase-listener.js +15 -0
- package/lib/langium/document-builder/labeled-phase-listener.js.map +1 -0
- package/lib/langium/documentation/comment-provider.d.ts +31 -0
- package/lib/langium/documentation/comment-provider.d.ts.map +1 -0
- package/lib/langium/documentation/comment-provider.js +36 -0
- package/lib/langium/documentation/comment-provider.js.map +1 -0
- package/lib/langium/documentation/index.d.ts +10 -0
- package/lib/langium/documentation/index.d.ts.map +1 -0
- package/lib/langium/documentation/index.js +10 -0
- package/lib/langium/documentation/index.js.map +1 -0
- package/lib/langium/integration-services.d.ts +200 -0
- package/lib/langium/integration-services.d.ts.map +1 -0
- package/lib/langium/integration-services.js +65 -0
- package/lib/langium/integration-services.js.map +1 -0
- package/lib/langium/integrity/index.d.ts +12 -0
- package/lib/langium/integrity/index.d.ts.map +1 -0
- package/lib/langium/integrity/index.js +12 -0
- package/lib/langium/integrity/index.js.map +1 -0
- package/lib/langium/integrity/integrity-contribution.d.ts +42 -0
- package/lib/langium/integrity/integrity-contribution.d.ts.map +1 -0
- package/lib/langium/integrity/integrity-contribution.js +10 -0
- package/lib/langium/integrity/integrity-contribution.js.map +1 -0
- package/lib/langium/integrity/integrity-rule.d.ts +82 -0
- package/lib/langium/integrity/integrity-rule.d.ts.map +1 -0
- package/lib/langium/integrity/integrity-rule.js +52 -0
- package/lib/langium/integrity/integrity-rule.js.map +1 -0
- package/lib/langium/integrity/integrity-service.d.ts +221 -0
- package/lib/langium/integrity/integrity-service.d.ts.map +1 -0
- package/lib/langium/integrity/integrity-service.js +328 -0
- package/lib/langium/integrity/integrity-service.js.map +1 -0
- package/lib/langium/keys/default-element-key-provider.d.ts +19 -0
- package/lib/langium/keys/default-element-key-provider.d.ts.map +1 -0
- package/lib/langium/keys/default-element-key-provider.js +18 -0
- package/lib/langium/keys/default-element-key-provider.js.map +1 -0
- package/lib/langium/keys/element-key-provider.d.ts +106 -0
- package/lib/langium/keys/element-key-provider.d.ts.map +1 -0
- package/lib/langium/keys/element-key-provider.js +25 -0
- package/lib/langium/keys/element-key-provider.js.map +1 -0
- package/lib/langium/keys/index.d.ts +13 -0
- package/lib/langium/keys/index.d.ts.map +1 -0
- package/lib/langium/keys/index.js +13 -0
- package/lib/langium/keys/index.js.map +1 -0
- package/lib/langium/keys/name-based-key-provider.d.ts +99 -0
- package/lib/langium/keys/name-based-key-provider.d.ts.map +1 -0
- package/lib/langium/keys/name-based-key-provider.js +134 -0
- package/lib/langium/keys/name-based-key-provider.js.map +1 -0
- package/lib/langium/keys/positional-key-provider.d.ts +41 -0
- package/lib/langium/keys/positional-key-provider.d.ts.map +1 -0
- package/lib/langium/keys/positional-key-provider.js +48 -0
- package/lib/langium/keys/positional-key-provider.js.map +1 -0
- package/lib/langium/labeling/index.d.ts +10 -0
- package/lib/langium/labeling/index.d.ts.map +1 -0
- package/lib/langium/labeling/index.js +10 -0
- package/lib/langium/labeling/index.js.map +1 -0
- package/lib/langium/labeling/label-provider.d.ts +79 -0
- package/lib/langium/labeling/label-provider.d.ts.map +1 -0
- package/lib/langium/labeling/label-provider.js +44 -0
- package/lib/langium/labeling/label-provider.js.map +1 -0
- package/lib/langium/language-module.d.ts +281 -0
- package/lib/langium/language-module.d.ts.map +1 -0
- package/lib/langium/language-module.js +103 -0
- package/lib/langium/language-module.js.map +1 -0
- package/lib/langium/language-types.d.ts +85 -0
- package/lib/langium/language-types.d.ts.map +1 -0
- package/lib/langium/language-types.js +173 -0
- package/lib/langium/language-types.js.map +1 -0
- package/lib/langium/model-service/index.d.ts +10 -0
- package/lib/langium/model-service/index.d.ts.map +1 -0
- package/lib/langium/model-service/index.js +10 -0
- package/lib/langium/model-service/index.js.map +1 -0
- package/lib/langium/model-service/model-service.d.ts +598 -0
- package/lib/langium/model-service/model-service.d.ts.map +1 -0
- package/lib/langium/model-service/model-service.js +889 -0
- package/lib/langium/model-service/model-service.js.map +1 -0
- package/lib/langium/module.d.ts +308 -0
- package/lib/langium/module.d.ts.map +1 -0
- package/lib/langium/module.js +165 -0
- package/lib/langium/module.js.map +1 -0
- package/lib/langium/naming/index.d.ts +11 -0
- package/lib/langium/naming/index.d.ts.map +1 -0
- package/lib/langium/naming/index.js +11 -0
- package/lib/langium/naming/index.js.map +1 -0
- package/lib/langium/naming/name-provider.d.ts +360 -0
- package/lib/langium/naming/name-provider.d.ts.map +1 -0
- package/lib/langium/naming/name-provider.js +240 -0
- package/lib/langium/naming/name-provider.js.map +1 -0
- package/lib/langium/naming/name-separator-validation.d.ts +47 -0
- package/lib/langium/naming/name-separator-validation.d.ts.map +1 -0
- package/lib/langium/naming/name-separator-validation.js +61 -0
- package/lib/langium/naming/name-separator-validation.js.map +1 -0
- package/lib/langium/project/abstract-project-manager.d.ts +242 -0
- package/lib/langium/project/abstract-project-manager.d.ts.map +1 -0
- package/lib/langium/project/abstract-project-manager.js +545 -0
- package/lib/langium/project/abstract-project-manager.js.map +1 -0
- package/lib/langium/project/index.d.ts +13 -0
- package/lib/langium/project/index.d.ts.map +1 -0
- package/lib/langium/project/index.js +13 -0
- package/lib/langium/project/index.js.map +1 -0
- package/lib/langium/project/project-change-event.d.ts +64 -0
- package/lib/langium/project/project-change-event.d.ts.map +1 -0
- package/lib/langium/project/project-change-event.js +10 -0
- package/lib/langium/project/project-change-event.js.map +1 -0
- package/lib/langium/project/project-manager.d.ts +196 -0
- package/lib/langium/project/project-manager.d.ts.map +1 -0
- package/lib/langium/project/project-manager.js +10 -0
- package/lib/langium/project/project-manager.js.map +1 -0
- package/lib/langium/project/single-project-manager.d.ts +69 -0
- package/lib/langium/project/single-project-manager.d.ts.map +1 -0
- package/lib/langium/project/single-project-manager.js +104 -0
- package/lib/langium/project/single-project-manager.js.map +1 -0
- package/lib/langium/residency/cst-residency-service.d.ts +214 -0
- package/lib/langium/residency/cst-residency-service.d.ts.map +1 -0
- package/lib/langium/residency/cst-residency-service.js +349 -0
- package/lib/langium/residency/cst-residency-service.js.map +1 -0
- package/lib/langium/residency/index.d.ts +10 -0
- package/lib/langium/residency/index.d.ts.map +1 -0
- package/lib/langium/residency/index.js +10 -0
- package/lib/langium/residency/index.js.map +1 -0
- package/lib/langium/scope/ast-node-description-provider.d.ts +122 -0
- package/lib/langium/scope/ast-node-description-provider.d.ts.map +1 -0
- package/lib/langium/scope/ast-node-description-provider.js +115 -0
- package/lib/langium/scope/ast-node-description-provider.js.map +1 -0
- package/lib/langium/scope/hydranium-scope-computation.d.ts +163 -0
- package/lib/langium/scope/hydranium-scope-computation.d.ts.map +1 -0
- package/lib/langium/scope/hydranium-scope-computation.js +220 -0
- package/lib/langium/scope/hydranium-scope-computation.js.map +1 -0
- package/lib/langium/scope/hydranium-scope-provider.d.ts +411 -0
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -0
- package/lib/langium/scope/hydranium-scope-provider.js +543 -0
- package/lib/langium/scope/hydranium-scope-provider.js.map +1 -0
- package/lib/langium/scope/index.d.ts +18 -0
- package/lib/langium/scope/index.d.ts.map +1 -0
- package/lib/langium/scope/index.js +18 -0
- package/lib/langium/scope/index.js.map +1 -0
- package/lib/langium/scope/reference-builder.d.ts +125 -0
- package/lib/langium/scope/reference-builder.d.ts.map +1 -0
- package/lib/langium/scope/reference-builder.js +115 -0
- package/lib/langium/scope/reference-builder.js.map +1 -0
- package/lib/langium/scope/reference-candidate-provider.d.ts +228 -0
- package/lib/langium/scope/reference-candidate-provider.d.ts.map +1 -0
- package/lib/langium/scope/reference-candidate-provider.js +185 -0
- package/lib/langium/scope/reference-candidate-provider.js.map +1 -0
- package/lib/langium/scope/scope-extension-contribution.d.ts +32 -0
- package/lib/langium/scope/scope-extension-contribution.d.ts.map +1 -0
- package/lib/langium/scope/scope-extension-contribution.js +10 -0
- package/lib/langium/scope/scope-extension-contribution.js.map +1 -0
- package/lib/langium/scope/scope-extension-service.d.ts +149 -0
- package/lib/langium/scope/scope-extension-service.d.ts.map +1 -0
- package/lib/langium/scope/scope-extension-service.js +94 -0
- package/lib/langium/scope/scope-extension-service.js.map +1 -0
- package/lib/langium/scope/scoped-ast-node-description.d.ts +160 -0
- package/lib/langium/scope/scoped-ast-node-description.d.ts.map +1 -0
- package/lib/langium/scope/scoped-ast-node-description.js +98 -0
- package/lib/langium/scope/scoped-ast-node-description.js.map +1 -0
- package/lib/langium/scope/tier-specificity.d.ts +47 -0
- package/lib/langium/scope/tier-specificity.d.ts.map +1 -0
- package/lib/langium/scope/tier-specificity.js +83 -0
- package/lib/langium/scope/tier-specificity.js.map +1 -0
- package/lib/langium/serialization/abstract-serializer.d.ts +316 -0
- package/lib/langium/serialization/abstract-serializer.d.ts.map +1 -0
- package/lib/langium/serialization/abstract-serializer.js +351 -0
- package/lib/langium/serialization/abstract-serializer.js.map +1 -0
- package/lib/langium/serialization/index.d.ts +14 -0
- package/lib/langium/serialization/index.d.ts.map +1 -0
- package/lib/langium/serialization/index.js +14 -0
- package/lib/langium/serialization/index.js.map +1 -0
- package/lib/langium/serialization/json-serializer.d.ts +106 -0
- package/lib/langium/serialization/json-serializer.d.ts.map +1 -0
- package/lib/langium/serialization/json-serializer.js +198 -0
- package/lib/langium/serialization/json-serializer.js.map +1 -0
- package/lib/langium/serialization/serialization-util.d.ts +29 -0
- package/lib/langium/serialization/serialization-util.d.ts.map +1 -0
- package/lib/langium/serialization/serialization-util.js +37 -0
- package/lib/langium/serialization/serialization-util.js.map +1 -0
- package/lib/langium/serialization/serializer.d.ts +66 -0
- package/lib/langium/serialization/serializer.d.ts.map +1 -0
- package/lib/langium/serialization/serializer.js +10 -0
- package/lib/langium/serialization/serializer.js.map +1 -0
- package/lib/langium/serialization/yaml-serializer.d.ts +166 -0
- package/lib/langium/serialization/yaml-serializer.d.ts.map +1 -0
- package/lib/langium/serialization/yaml-serializer.js +228 -0
- package/lib/langium/serialization/yaml-serializer.js.map +1 -0
- package/lib/langium/service-registry.d.ts +220 -0
- package/lib/langium/service-registry.d.ts.map +1 -0
- package/lib/langium/service-registry.js +258 -0
- package/lib/langium/service-registry.js.map +1 -0
- package/lib/langium/shared-services.d.ts +98 -0
- package/lib/langium/shared-services.d.ts.map +1 -0
- package/lib/langium/shared-services.js +30 -0
- package/lib/langium/shared-services.js.map +1 -0
- package/lib/langium/transfer/index.d.ts +10 -0
- package/lib/langium/transfer/index.d.ts.map +1 -0
- package/lib/langium/transfer/index.js +10 -0
- package/lib/langium/transfer/index.js.map +1 -0
- package/lib/langium/transfer/transfer-encoder.d.ts +294 -0
- package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -0
- package/lib/langium/transfer/transfer-encoder.js +328 -0
- package/lib/langium/transfer/transfer-encoder.js.map +1 -0
- package/lib/langium/update-rewrite/index.d.ts +14 -0
- package/lib/langium/update-rewrite/index.d.ts.map +1 -0
- package/lib/langium/update-rewrite/index.js +14 -0
- package/lib/langium/update-rewrite/index.js.map +1 -0
- package/lib/langium/update-rewrite/normalize-empty-strings.d.ts +52 -0
- package/lib/langium/update-rewrite/normalize-empty-strings.d.ts.map +1 -0
- package/lib/langium/update-rewrite/normalize-empty-strings.js +83 -0
- package/lib/langium/update-rewrite/normalize-empty-strings.js.map +1 -0
- package/lib/langium/update-rewrite/semantic-root-rewrite.d.ts +37 -0
- package/lib/langium/update-rewrite/semantic-root-rewrite.d.ts.map +1 -0
- package/lib/langium/update-rewrite/semantic-root-rewrite.js +51 -0
- package/lib/langium/update-rewrite/semantic-root-rewrite.js.map +1 -0
- package/lib/langium/update-rewrite/update-rewrite-contribution.d.ts +42 -0
- package/lib/langium/update-rewrite/update-rewrite-contribution.d.ts.map +1 -0
- package/lib/langium/update-rewrite/update-rewrite-contribution.js +10 -0
- package/lib/langium/update-rewrite/update-rewrite-contribution.js.map +1 -0
- package/lib/langium/update-rewrite/update-rewrite-service.d.ts +89 -0
- package/lib/langium/update-rewrite/update-rewrite-service.d.ts.map +1 -0
- package/lib/langium/update-rewrite/update-rewrite-service.js +75 -0
- package/lib/langium/update-rewrite/update-rewrite-service.js.map +1 -0
- package/lib/langium/update-rewrite/update-rewrite.d.ts +59 -0
- package/lib/langium/update-rewrite/update-rewrite.d.ts.map +1 -0
- package/lib/langium/update-rewrite/update-rewrite.js +10 -0
- package/lib/langium/update-rewrite/update-rewrite.js.map +1 -0
- package/lib/langium/validation/document-validator.d.ts +106 -0
- package/lib/langium/validation/document-validator.d.ts.map +1 -0
- package/lib/langium/validation/document-validator.js +118 -0
- package/lib/langium/validation/document-validator.js.map +1 -0
- package/lib/langium/validation/index.d.ts +12 -0
- package/lib/langium/validation/index.d.ts.map +1 -0
- package/lib/langium/validation/index.js +12 -0
- package/lib/langium/validation/index.js.map +1 -0
- package/lib/langium/validation/validation-contribution-collector.d.ts +34 -0
- package/lib/langium/validation/validation-contribution-collector.d.ts.map +1 -0
- package/lib/langium/validation/validation-contribution-collector.js +51 -0
- package/lib/langium/validation/validation-contribution-collector.js.map +1 -0
- package/lib/langium/validation/validation-contribution.d.ts +36 -0
- package/lib/langium/validation/validation-contribution.d.ts.map +1 -0
- package/lib/langium/validation/validation-contribution.js +10 -0
- package/lib/langium/validation/validation-contribution.js.map +1 -0
- package/lib/langium/workspace/additional-document-contribution.d.ts +68 -0
- package/lib/langium/workspace/additional-document-contribution.d.ts.map +1 -0
- package/lib/langium/workspace/additional-document-contribution.js +23 -0
- package/lib/langium/workspace/additional-document-contribution.js.map +1 -0
- package/lib/langium/workspace/document-uri-policy.d.ts +151 -0
- package/lib/langium/workspace/document-uri-policy.d.ts.map +1 -0
- package/lib/langium/workspace/document-uri-policy.js +121 -0
- package/lib/langium/workspace/document-uri-policy.js.map +1 -0
- package/lib/langium/workspace/file-system-provider.d.ts +30 -0
- package/lib/langium/workspace/file-system-provider.d.ts.map +1 -0
- package/lib/langium/workspace/file-system-provider.js +41 -0
- package/lib/langium/workspace/file-system-provider.js.map +1 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +45 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.js +64 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.js.map +1 -0
- package/lib/langium/workspace/hydranium-workspace-lock.d.ts +31 -0
- package/lib/langium/workspace/hydranium-workspace-lock.d.ts.map +1 -0
- package/lib/langium/workspace/hydranium-workspace-lock.js +33 -0
- package/lib/langium/workspace/hydranium-workspace-lock.js.map +1 -0
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts +232 -0
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -0
- package/lib/langium/workspace/hydranium-workspace-manager.js +368 -0
- package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -0
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts +127 -0
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -0
- package/lib/langium/workspace/in-memory-file-system-provider.js +195 -0
- package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -0
- package/lib/langium/workspace/index-manager.d.ts +142 -0
- package/lib/langium/workspace/index-manager.d.ts.map +1 -0
- package/lib/langium/workspace/index-manager.js +245 -0
- package/lib/langium/workspace/index-manager.js.map +1 -0
- package/lib/langium/workspace/index.d.ts +23 -0
- package/lib/langium/workspace/index.d.ts.map +1 -0
- package/lib/langium/workspace/index.js +23 -0
- package/lib/langium/workspace/index.js.map +1 -0
- package/lib/langium/workspace/initialize-workspace.d.ts +63 -0
- package/lib/langium/workspace/initialize-workspace.d.ts.map +1 -0
- package/lib/langium/workspace/initialize-workspace.js +88 -0
- package/lib/langium/workspace/initialize-workspace.js.map +1 -0
- package/lib/langium/workspace/langium-documents.d.ts +47 -0
- package/lib/langium/workspace/langium-documents.d.ts.map +1 -0
- package/lib/langium/workspace/langium-documents.js +85 -0
- package/lib/langium/workspace/langium-documents.js.map +1 -0
- package/lib/langium/workspace/persistent-file-system-provider.d.ts +207 -0
- package/lib/langium/workspace/persistent-file-system-provider.d.ts.map +1 -0
- package/lib/langium/workspace/persistent-file-system-provider.js +208 -0
- package/lib/langium/workspace/persistent-file-system-provider.js.map +1 -0
- package/lib/langium/workspace/synthetic.d.ts +38 -0
- package/lib/langium/workspace/synthetic.d.ts.map +1 -0
- package/lib/langium/workspace/synthetic.js +58 -0
- package/lib/langium/workspace/synthetic.js.map +1 -0
- package/lib/langium/workspace/virtual-document.d.ts +78 -0
- package/lib/langium/workspace/virtual-document.d.ts.map +1 -0
- package/lib/langium/workspace/virtual-document.js +89 -0
- package/lib/langium/workspace/virtual-document.js.map +1 -0
- package/lib/langium/workspace/write-lock-scope.d.ts +69 -0
- package/lib/langium/workspace/write-lock-scope.d.ts.map +1 -0
- package/lib/langium/workspace/write-lock-scope.js +54 -0
- package/lib/langium/workspace/write-lock-scope.js.map +1 -0
- package/lib/launcher/index.d.ts +10 -0
- package/lib/launcher/index.d.ts.map +1 -0
- package/lib/launcher/index.js +12 -0
- package/lib/launcher/index.js.map +1 -0
- package/lib/launcher/integrated-server.d.ts +28 -0
- package/lib/launcher/integrated-server.d.ts.map +1 -0
- package/lib/launcher/integrated-server.js +10 -0
- package/lib/launcher/integrated-server.js.map +1 -0
- package/lib/lsp/completion/hydranium-completion-provider.d.ts +89 -0
- package/lib/lsp/completion/hydranium-completion-provider.d.ts.map +1 -0
- package/lib/lsp/completion/hydranium-completion-provider.js +123 -0
- package/lib/lsp/completion/hydranium-completion-provider.js.map +1 -0
- package/lib/lsp/hydranium-document-update-handler.d.ts +204 -0
- package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -0
- package/lib/lsp/hydranium-document-update-handler.js +288 -0
- package/lib/lsp/hydranium-document-update-handler.js.map +1 -0
- package/lib/lsp/index.d.ts +23 -0
- package/lib/lsp/index.d.ts.map +1 -0
- package/lib/lsp/index.js +23 -0
- package/lib/lsp/index.js.map +1 -0
- package/lib/lsp/instrument-connection.d.ts +36 -0
- package/lib/lsp/instrument-connection.d.ts.map +1 -0
- package/lib/lsp/instrument-connection.js +62 -0
- package/lib/lsp/instrument-connection.js.map +1 -0
- package/lib/lsp/language-module.d.ts +53 -0
- package/lib/lsp/language-module.d.ts.map +1 -0
- package/lib/lsp/language-module.js +28 -0
- package/lib/lsp/language-module.js.map +1 -0
- package/lib/lsp/semantic-token-provider.d.ts +131 -0
- package/lib/lsp/semantic-token-provider.d.ts.map +1 -0
- package/lib/lsp/semantic-token-provider.js +148 -0
- package/lib/lsp/semantic-token-provider.js.map +1 -0
- package/lib/lsp/shared-module.d.ts +76 -0
- package/lib/lsp/shared-module.d.ts.map +1 -0
- package/lib/lsp/shared-module.js +33 -0
- package/lib/lsp/shared-module.js.map +1 -0
- package/lib/lsp/start-language-server.d.ts +43 -0
- package/lib/lsp/start-language-server.d.ts.map +1 -0
- package/lib/lsp/start-language-server.js +60 -0
- package/lib/lsp/start-language-server.js.map +1 -0
- package/lib/node/ast-ground-truth.d.ts +57 -0
- package/lib/node/ast-ground-truth.d.ts.map +1 -0
- package/lib/node/ast-ground-truth.js +46 -0
- package/lib/node/ast-ground-truth.js.map +1 -0
- package/lib/node/event-loop-monitor.d.ts +40 -0
- package/lib/node/event-loop-monitor.d.ts.map +1 -0
- package/lib/node/event-loop-monitor.js +62 -0
- package/lib/node/event-loop-monitor.js.map +1 -0
- package/lib/node/index.d.ts +29 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +50 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/latency-from-env.d.ts +32 -0
- package/lib/node/latency-from-env.d.ts.map +1 -0
- package/lib/node/latency-from-env.js +36 -0
- package/lib/node/latency-from-env.js.map +1 -0
- package/lib/node/lint-grammar.d.ts +87 -0
- package/lib/node/lint-grammar.d.ts.map +1 -0
- package/lib/node/lint-grammar.js +124 -0
- package/lib/node/lint-grammar.js.map +1 -0
- package/lib/node/log-file-sink.d.ts +22 -0
- package/lib/node/log-file-sink.d.ts.map +1 -0
- package/lib/node/log-file-sink.js +43 -0
- package/lib/node/log-file-sink.js.map +1 -0
- package/lib/node/log-preamble-node.d.ts +28 -0
- package/lib/node/log-preamble-node.d.ts.map +1 -0
- package/lib/node/log-preamble-node.js +55 -0
- package/lib/node/log-preamble-node.js.map +1 -0
- package/lib/node/measure-memory.d.ts +86 -0
- package/lib/node/measure-memory.d.ts.map +1 -0
- package/lib/node/measure-memory.js +128 -0
- package/lib/node/measure-memory.js.map +1 -0
- package/lib/node/memory-monitor.d.ts +42 -0
- package/lib/node/memory-monitor.d.ts.map +1 -0
- package/lib/node/memory-monitor.js +83 -0
- package/lib/node/memory-monitor.js.map +1 -0
- package/lib/node/node-file-system-provider.d.ts +112 -0
- package/lib/node/node-file-system-provider.d.ts.map +1 -0
- package/lib/node/node-file-system-provider.js +230 -0
- package/lib/node/node-file-system-provider.js.map +1 -0
- package/lib/node/process-memory.d.ts +66 -0
- package/lib/node/process-memory.d.ts.map +1 -0
- package/lib/node/process-memory.js +252 -0
- package/lib/node/process-memory.js.map +1 -0
- package/lib/node/profile-capture.d.ts +118 -0
- package/lib/node/profile-capture.d.ts.map +1 -0
- package/lib/node/profile-capture.js +315 -0
- package/lib/node/profile-capture.js.map +1 -0
- package/lib/node/profile-digest.d.ts +49 -0
- package/lib/node/profile-digest.d.ts.map +1 -0
- package/lib/node/profile-digest.js +74 -0
- package/lib/node/profile-digest.js.map +1 -0
- package/lib/node/profiling-run.d.ts +80 -0
- package/lib/node/profiling-run.d.ts.map +1 -0
- package/lib/node/profiling-run.js +183 -0
- package/lib/node/profiling-run.js.map +1 -0
- package/lib/node/reflect-grammar.d.ts +109 -0
- package/lib/node/reflect-grammar.d.ts.map +1 -0
- package/lib/node/reflect-grammar.js +96 -0
- package/lib/node/reflect-grammar.js.map +1 -0
- package/lib/node/server-diagnostics.d.ts +43 -0
- package/lib/node/server-diagnostics.d.ts.map +1 -0
- package/lib/node/server-diagnostics.js +46 -0
- package/lib/node/server-diagnostics.js.map +1 -0
- package/lib/node/server-state-snapshot.d.ts +48 -0
- package/lib/node/server-state-snapshot.d.ts.map +1 -0
- package/lib/node/server-state-snapshot.js +139 -0
- package/lib/node/server-state-snapshot.js.map +1 -0
- package/lib/node/socket-launcher.d.ts +106 -0
- package/lib/node/socket-launcher.d.ts.map +1 -0
- package/lib/node/socket-launcher.js +138 -0
- package/lib/node/socket-launcher.js.map +1 -0
- package/lib/node/stdio-launcher.d.ts +88 -0
- package/lib/node/stdio-launcher.d.ts.map +1 -0
- package/lib/node/stdio-launcher.js +83 -0
- package/lib/node/stdio-launcher.js.map +1 -0
- package/lib/node/validate-workspace.d.ts +80 -0
- package/lib/node/validate-workspace.d.ts.map +1 -0
- package/lib/node/validate-workspace.js +72 -0
- package/lib/node/validate-workspace.js.map +1 -0
- package/lib/node/write-lock-scope-node.d.ts +27 -0
- package/lib/node/write-lock-scope-node.d.ts.map +1 -0
- package/lib/node/write-lock-scope-node.js +38 -0
- package/lib/node/write-lock-scope-node.js.map +1 -0
- package/lib/testing/ast-snapshot.d.ts +38 -0
- package/lib/testing/ast-snapshot.d.ts.map +1 -0
- package/lib/testing/ast-snapshot.js +78 -0
- package/lib/testing/ast-snapshot.js.map +1 -0
- package/lib/testing/document-uri-policy-conformance.d.ts +65 -0
- package/lib/testing/document-uri-policy-conformance.d.ts.map +1 -0
- package/lib/testing/document-uri-policy-conformance.js +69 -0
- package/lib/testing/document-uri-policy-conformance.js.map +1 -0
- package/lib/testing/fake-description.d.ts +35 -0
- package/lib/testing/fake-description.d.ts.map +1 -0
- package/lib/testing/fake-description.js +38 -0
- package/lib/testing/fake-description.js.map +1 -0
- package/lib/testing/fake-document.d.ts +71 -0
- package/lib/testing/fake-document.d.ts.map +1 -0
- package/lib/testing/fake-document.js +85 -0
- package/lib/testing/fake-document.js.map +1 -0
- package/lib/testing/fake-reflection.d.ts +29 -0
- package/lib/testing/fake-reflection.d.ts.map +1 -0
- package/lib/testing/fake-reflection.js +30 -0
- package/lib/testing/fake-reflection.js.map +1 -0
- package/lib/testing/index.d.ts +44 -0
- package/lib/testing/index.d.ts.map +1 -0
- package/lib/testing/index.js +44 -0
- package/lib/testing/index.js.map +1 -0
- package/lib/testing/langium-test-helpers.d.ts +26 -0
- package/lib/testing/langium-test-helpers.d.ts.map +1 -0
- package/lib/testing/langium-test-helpers.js +26 -0
- package/lib/testing/langium-test-helpers.js.map +1 -0
- package/lib/testing/make-noop-language-services.d.ts +39 -0
- package/lib/testing/make-noop-language-services.d.ts.map +1 -0
- package/lib/testing/make-noop-language-services.js +30 -0
- package/lib/testing/make-noop-language-services.js.map +1 -0
- package/lib/testing/make-noop-shared-services.d.ts +61 -0
- package/lib/testing/make-noop-shared-services.d.ts.map +1 -0
- package/lib/testing/make-noop-shared-services.js +49 -0
- package/lib/testing/make-noop-shared-services.js.map +1 -0
- package/lib/testing/make-test-services.d.ts +217 -0
- package/lib/testing/make-test-services.d.ts.map +1 -0
- package/lib/testing/make-test-services.js +128 -0
- package/lib/testing/make-test-services.js.map +1 -0
- package/lib/testing/make-test-tracer.d.ts +67 -0
- package/lib/testing/make-test-tracer.d.ts.map +1 -0
- package/lib/testing/make-test-tracer.js +68 -0
- package/lib/testing/make-test-tracer.js.map +1 -0
- package/lib/testing/node/generated-workspace.d.ts +95 -0
- package/lib/testing/node/generated-workspace.d.ts.map +1 -0
- package/lib/testing/node/generated-workspace.js +134 -0
- package/lib/testing/node/generated-workspace.js.map +1 -0
- package/lib/testing/node/golden-corpus.d.ts +50 -0
- package/lib/testing/node/golden-corpus.d.ts.map +1 -0
- package/lib/testing/node/golden-corpus.js +80 -0
- package/lib/testing/node/golden-corpus.js.map +1 -0
- package/lib/testing/node/index.d.ts +28 -0
- package/lib/testing/node/index.d.ts.map +1 -0
- package/lib/testing/node/index.js +28 -0
- package/lib/testing/node/index.js.map +1 -0
- package/lib/testing/node/lsp-harness.d.ts +139 -0
- package/lib/testing/node/lsp-harness.d.ts.map +1 -0
- package/lib/testing/node/lsp-harness.js +119 -0
- package/lib/testing/node/lsp-harness.js.map +1 -0
- package/lib/testing/node/lsp-server-connection.d.ts +232 -0
- package/lib/testing/node/lsp-server-connection.d.ts.map +1 -0
- package/lib/testing/node/lsp-server-connection.js +304 -0
- package/lib/testing/node/lsp-server-connection.js.map +1 -0
- package/lib/testing/node/scratch-workspace.d.ts +60 -0
- package/lib/testing/node/scratch-workspace.d.ts.map +1 -0
- package/lib/testing/node/scratch-workspace.js +87 -0
- package/lib/testing/node/scratch-workspace.js.map +1 -0
- package/lib/testing/node/spawned-server.d.ts +170 -0
- package/lib/testing/node/spawned-server.d.ts.map +1 -0
- package/lib/testing/node/spawned-server.js +265 -0
- package/lib/testing/node/spawned-server.js.map +1 -0
- package/lib/testing/parse-semantic-root.d.ts +83 -0
- package/lib/testing/parse-semantic-root.d.ts.map +1 -0
- package/lib/testing/parse-semantic-root.js +119 -0
- package/lib/testing/parse-semantic-root.js.map +1 -0
- package/lib/testing/playwright/browser-capture-bridge.d.ts +80 -0
- package/lib/testing/playwright/browser-capture-bridge.d.ts.map +1 -0
- package/lib/testing/playwright/browser-capture-bridge.js +161 -0
- package/lib/testing/playwright/browser-capture-bridge.js.map +1 -0
- package/lib/testing/playwright/e2e-profiling.d.ts +132 -0
- package/lib/testing/playwright/e2e-profiling.d.ts.map +1 -0
- package/lib/testing/playwright/e2e-profiling.js +270 -0
- package/lib/testing/playwright/e2e-profiling.js.map +1 -0
- package/lib/testing/playwright/index.d.ts +13 -0
- package/lib/testing/playwright/index.d.ts.map +1 -0
- package/lib/testing/playwright/index.js +16 -0
- package/lib/testing/playwright/index.js.map +1 -0
- package/lib/testing/playwright/server-log-capture.d.ts +230 -0
- package/lib/testing/playwright/server-log-capture.d.ts.map +1 -0
- package/lib/testing/playwright/server-log-capture.js +336 -0
- package/lib/testing/playwright/server-log-capture.js.map +1 -0
- package/lib/testing/playwright/server-log-fixture.d.ts +36 -0
- package/lib/testing/playwright/server-log-fixture.d.ts.map +1 -0
- package/lib/testing/playwright/server-log-fixture.js +38 -0
- package/lib/testing/playwright/server-log-fixture.js.map +1 -0
- package/lib/testing/playwright/server-log-rename-reporter.d.ts +22 -0
- package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -0
- package/lib/testing/playwright/server-log-rename-reporter.js +26 -0
- package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -0
- package/lib/testing/run-update-pipeline.d.ts +99 -0
- package/lib/testing/run-update-pipeline.d.ts.map +1 -0
- package/lib/testing/run-update-pipeline.js +24 -0
- package/lib/testing/run-update-pipeline.js.map +1 -0
- package/lib/testing/stub-ast-document-manager.d.ts +82 -0
- package/lib/testing/stub-ast-document-manager.d.ts.map +1 -0
- package/lib/testing/stub-ast-document-manager.js +125 -0
- package/lib/testing/stub-ast-document-manager.js.map +1 -0
- package/lib/testing/stub-document-builder.d.ts +99 -0
- package/lib/testing/stub-document-builder.d.ts.map +1 -0
- package/lib/testing/stub-document-builder.js +142 -0
- package/lib/testing/stub-document-builder.js.map +1 -0
- package/lib/testing/stub-hydranium-text-documents.d.ts +125 -0
- package/lib/testing/stub-hydranium-text-documents.d.ts.map +1 -0
- package/lib/testing/stub-hydranium-text-documents.js +164 -0
- package/lib/testing/stub-hydranium-text-documents.js.map +1 -0
- package/lib/testing/stub-index-manager.d.ts +40 -0
- package/lib/testing/stub-index-manager.d.ts.map +1 -0
- package/lib/testing/stub-index-manager.js +38 -0
- package/lib/testing/stub-index-manager.js.map +1 -0
- package/lib/testing/stub-langium-documents.d.ts +53 -0
- package/lib/testing/stub-langium-documents.d.ts.map +1 -0
- package/lib/testing/stub-langium-documents.js +62 -0
- package/lib/testing/stub-langium-documents.js.map +1 -0
- package/lib/testing/stub-model-service.d.ts +31 -0
- package/lib/testing/stub-model-service.d.ts.map +1 -0
- package/lib/testing/stub-model-service.js +45 -0
- package/lib/testing/stub-model-service.js.map +1 -0
- package/lib/testing/stub-project-manager.d.ts +43 -0
- package/lib/testing/stub-project-manager.d.ts.map +1 -0
- package/lib/testing/stub-project-manager.js +125 -0
- package/lib/testing/stub-project-manager.js.map +1 -0
- package/lib/testing/stub-self-save-registry.d.ts +31 -0
- package/lib/testing/stub-self-save-registry.d.ts.map +1 -0
- package/lib/testing/stub-self-save-registry.js +23 -0
- package/lib/testing/stub-self-save-registry.js.map +1 -0
- package/lib/testing/stub-service-registry.d.ts +95 -0
- package/lib/testing/stub-service-registry.d.ts.map +1 -0
- package/lib/testing/stub-service-registry.js +108 -0
- package/lib/testing/stub-service-registry.js.map +1 -0
- package/lib/testing/stub-writable-file-system.d.ts +42 -0
- package/lib/testing/stub-writable-file-system.d.ts.map +1 -0
- package/lib/testing/stub-writable-file-system.js +26 -0
- package/lib/testing/stub-writable-file-system.js.map +1 -0
- package/lib/util/connection-liveness.d.ts +25 -0
- package/lib/util/connection-liveness.d.ts.map +1 -0
- package/lib/util/connection-liveness.js +46 -0
- package/lib/util/connection-liveness.js.map +1 -0
- package/lib/util/environment.d.ts +53 -0
- package/lib/util/environment.d.ts.map +1 -0
- package/lib/util/environment.js +78 -0
- package/lib/util/environment.js.map +1 -0
- package/lib/util/index.d.ts +13 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +18 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/registry.d.ts +88 -0
- package/lib/util/registry.d.ts.map +1 -0
- package/lib/util/registry.js +105 -0
- package/lib/util/registry.js.map +1 -0
- package/package.json +134 -0
- package/src/documents/ast-document-manager.ts +455 -0
- package/src/documents/client-ids.ts +33 -0
- package/src/documents/hydranium-text-documents.ts +1142 -0
- package/src/documents/index.ts +14 -0
- package/src/documents/language-client-text-shadow.ts +175 -0
- package/src/documents/self-save-registry.ts +81 -0
- package/src/index.ts +39 -0
- package/src/langium/ast-extension/ast-extension-contribution.ts +35 -0
- package/src/langium/ast-extension/ast-extension-service.ts +311 -0
- package/src/langium/ast-extension/ast-node-builder.ts +125 -0
- package/src/langium/ast-extension/index.ts +12 -0
- package/src/langium/bootstrap.ts +600 -0
- package/src/langium/build-phase-pass/build-phase-pass-service.ts +141 -0
- package/src/langium/build-phase-pass/build-phase-pass.ts +123 -0
- package/src/langium/build-phase-pass/index.ts +11 -0
- package/src/langium/config/index.ts +10 -0
- package/src/langium/config/settings.ts +353 -0
- package/src/langium/diagnostics/hydranium-langium-profiler.ts +187 -0
- package/src/langium/diagnostics/index.ts +19 -0
- package/src/langium/diagnostics/log-file-token.ts +26 -0
- package/src/langium/diagnostics/log-preamble.ts +87 -0
- package/src/langium/diagnostics/logger.ts +246 -0
- package/src/langium/diagnostics/lsp-logger.ts +277 -0
- package/src/langium/diagnostics/server-tracer.ts +73 -0
- package/src/langium/document-builder/build-pipeline-integration.ts +193 -0
- package/src/langium/document-builder/document-builder.ts +839 -0
- package/src/langium/document-builder/index.ts +12 -0
- package/src/langium/document-builder/labeled-phase-listener.ts +26 -0
- package/src/langium/documentation/comment-provider.ts +37 -0
- package/src/langium/documentation/index.ts +10 -0
- package/src/langium/integration-services.ts +281 -0
- package/src/langium/integrity/index.ts +12 -0
- package/src/langium/integrity/integrity-contribution.ts +44 -0
- package/src/langium/integrity/integrity-rule.ts +100 -0
- package/src/langium/integrity/integrity-service.ts +423 -0
- package/src/langium/keys/default-element-key-provider.ts +20 -0
- package/src/langium/keys/element-key-provider.ts +114 -0
- package/src/langium/keys/index.ts +13 -0
- package/src/langium/keys/name-based-key-provider.ts +146 -0
- package/src/langium/keys/positional-key-provider.ts +57 -0
- package/src/langium/labeling/index.ts +10 -0
- package/src/langium/labeling/label-provider.ts +110 -0
- package/src/langium/language-module.ts +367 -0
- package/src/langium/language-types.ts +214 -0
- package/src/langium/model-service/index.ts +10 -0
- package/src/langium/model-service/model-service.ts +1051 -0
- package/src/langium/module.ts +446 -0
- package/src/langium/naming/index.ts +11 -0
- package/src/langium/naming/name-provider.ts +533 -0
- package/src/langium/naming/name-separator-validation.ts +73 -0
- package/src/langium/project/abstract-project-manager.ts +630 -0
- package/src/langium/project/index.ts +13 -0
- package/src/langium/project/project-change-event.ts +66 -0
- package/src/langium/project/project-manager.ts +221 -0
- package/src/langium/project/single-project-manager.ts +126 -0
- package/src/langium/residency/cst-residency-service.ts +412 -0
- package/src/langium/residency/index.ts +10 -0
- package/src/langium/scope/ast-node-description-provider.ts +141 -0
- package/src/langium/scope/hydranium-scope-computation.ts +246 -0
- package/src/langium/scope/hydranium-scope-provider.ts +659 -0
- package/src/langium/scope/index.ts +18 -0
- package/src/langium/scope/reference-builder.ts +194 -0
- package/src/langium/scope/reference-candidate-provider.ts +314 -0
- package/src/langium/scope/scope-extension-contribution.ts +34 -0
- package/src/langium/scope/scope-extension-service.ts +207 -0
- package/src/langium/scope/scoped-ast-node-description.ts +174 -0
- package/src/langium/scope/tier-specificity.ts +89 -0
- package/src/langium/serialization/abstract-serializer.ts +474 -0
- package/src/langium/serialization/index.ts +14 -0
- package/src/langium/serialization/json-serializer.ts +264 -0
- package/src/langium/serialization/serialization-util.ts +40 -0
- package/src/langium/serialization/serializer.ts +68 -0
- package/src/langium/serialization/yaml-serializer.ts +348 -0
- package/src/langium/service-registry.ts +323 -0
- package/src/langium/shared-services.ts +107 -0
- package/src/langium/transfer/index.ts +10 -0
- package/src/langium/transfer/transfer-encoder.ts +434 -0
- package/src/langium/update-rewrite/index.ts +14 -0
- package/src/langium/update-rewrite/normalize-empty-strings.ts +86 -0
- package/src/langium/update-rewrite/semantic-root-rewrite.ts +57 -0
- package/src/langium/update-rewrite/update-rewrite-contribution.ts +44 -0
- package/src/langium/update-rewrite/update-rewrite-service.ts +129 -0
- package/src/langium/update-rewrite/update-rewrite.ts +60 -0
- package/src/langium/validation/document-validator.ts +188 -0
- package/src/langium/validation/index.ts +12 -0
- package/src/langium/validation/validation-contribution-collector.ts +61 -0
- package/src/langium/validation/validation-contribution.ts +38 -0
- package/src/langium/workspace/additional-document-contribution.ts +80 -0
- package/src/langium/workspace/document-uri-policy.ts +187 -0
- package/src/langium/workspace/file-system-provider.ts +52 -0
- package/src/langium/workspace/hydranium-langium-document-factory.ts +78 -0
- package/src/langium/workspace/hydranium-workspace-lock.ts +35 -0
- package/src/langium/workspace/hydranium-workspace-manager.ts +412 -0
- package/src/langium/workspace/in-memory-file-system-provider.ts +241 -0
- package/src/langium/workspace/index-manager.ts +266 -0
- package/src/langium/workspace/index.ts +23 -0
- package/src/langium/workspace/initialize-workspace.ts +102 -0
- package/src/langium/workspace/langium-documents.ts +94 -0
- package/src/langium/workspace/persistent-file-system-provider.ts +287 -0
- package/src/langium/workspace/synthetic.ts +63 -0
- package/src/langium/workspace/virtual-document.ts +94 -0
- package/src/langium/workspace/write-lock-scope.ts +88 -0
- package/src/launcher/index.ts +12 -0
- package/src/launcher/integrated-server.ts +28 -0
- package/src/lsp/completion/hydranium-completion-provider.ts +132 -0
- package/src/lsp/hydranium-document-update-handler.ts +345 -0
- package/src/lsp/index.ts +24 -0
- package/src/lsp/instrument-connection.ts +66 -0
- package/src/lsp/language-module.ts +64 -0
- package/src/lsp/semantic-token-provider.ts +215 -0
- package/src/lsp/shared-module.ts +88 -0
- package/src/lsp/start-language-server.ts +68 -0
- package/src/node/ast-ground-truth.ts +76 -0
- package/src/node/event-loop-monitor.ts +89 -0
- package/src/node/index.ts +53 -0
- package/src/node/latency-from-env.ts +39 -0
- package/src/node/lint-grammar.ts +189 -0
- package/src/node/log-file-sink.ts +43 -0
- package/src/node/log-preamble-node.ts +63 -0
- package/src/node/measure-memory.ts +196 -0
- package/src/node/memory-monitor.ts +103 -0
- package/src/node/node-file-system-provider.ts +252 -0
- package/src/node/process-memory.ts +299 -0
- package/src/node/profile-capture.ts +377 -0
- package/src/node/profile-digest.ts +112 -0
- package/src/node/profiling-run.ts +236 -0
- package/src/node/reflect-grammar.ts +182 -0
- package/src/node/server-diagnostics.ts +63 -0
- package/src/node/server-state-snapshot.ts +192 -0
- package/src/node/socket-launcher.ts +210 -0
- package/src/node/stdio-launcher.ts +150 -0
- package/src/node/validate-workspace.ts +133 -0
- package/src/node/write-lock-scope-node.ts +41 -0
- package/src/testing/ast-snapshot.ts +88 -0
- package/src/testing/document-uri-policy-conformance.ts +104 -0
- package/src/testing/fake-description.ts +52 -0
- package/src/testing/fake-document.ts +120 -0
- package/src/testing/fake-reflection.ts +39 -0
- package/src/testing/index.ts +45 -0
- package/src/testing/langium-test-helpers.ts +26 -0
- package/src/testing/make-noop-language-services.ts +47 -0
- package/src/testing/make-noop-shared-services.ts +78 -0
- package/src/testing/make-test-services.ts +356 -0
- package/src/testing/make-test-tracer.ts +92 -0
- package/src/testing/node/generated-workspace.ts +222 -0
- package/src/testing/node/golden-corpus.ts +114 -0
- package/src/testing/node/index.ts +29 -0
- package/src/testing/node/lsp-harness.ts +230 -0
- package/src/testing/node/lsp-server-connection.ts +575 -0
- package/src/testing/node/scratch-workspace.ts +137 -0
- package/src/testing/node/spawned-server.ts +447 -0
- package/src/testing/parse-semantic-root.ts +150 -0
- package/src/testing/playwright/browser-capture-bridge.ts +258 -0
- package/src/testing/playwright/e2e-profiling.ts +362 -0
- package/src/testing/playwright/index.ts +16 -0
- package/src/testing/playwright/server-log-capture.ts +433 -0
- package/src/testing/playwright/server-log-fixture.ts +57 -0
- package/src/testing/playwright/server-log-rename-reporter.ts +29 -0
- package/src/testing/run-update-pipeline.ts +113 -0
- package/src/testing/stub-ast-document-manager.ts +224 -0
- package/src/testing/stub-document-builder.ts +242 -0
- package/src/testing/stub-hydranium-text-documents.ts +270 -0
- package/src/testing/stub-index-manager.ts +79 -0
- package/src/testing/stub-langium-documents.ts +104 -0
- package/src/testing/stub-model-service.ts +72 -0
- package/src/testing/stub-project-manager.ts +161 -0
- package/src/testing/stub-self-save-registry.ts +43 -0
- package/src/testing/stub-service-registry.ts +192 -0
- package/src/testing/stub-writable-file-system.ts +58 -0
- package/src/util/connection-liveness.ts +47 -0
- package/src/util/environment.ts +88 -0
- package/src/util/index.ts +18 -0
- package/src/util/registry.ts +129 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
import type { Clock, Logger, Project, Tracer } from '@hydranium/protocol';
|
|
11
|
+
import type { LangiumSharedCoreServices } from '@hydranium/langium';
|
|
12
|
+
import type { SelfSaveRegistry } from '../documents/self-save-registry.js';
|
|
13
|
+
import type { WritableFileSystemProvider } from '../documents/ast-document-manager.js';
|
|
14
|
+
import type { BuildPhasePassService } from './build-phase-pass/build-phase-pass-service.js';
|
|
15
|
+
import type { CstResidencyService } from './residency/cst-residency-service.js';
|
|
16
|
+
import type { BuildPipelineIntegration } from './document-builder/build-pipeline-integration.js';
|
|
17
|
+
import type { ProjectManager } from './project/project-manager.js';
|
|
18
|
+
import type { ExtendedServiceRegistry } from './service-registry.js';
|
|
19
|
+
import type { DocumentUriPolicy } from './workspace/document-uri-policy.js';
|
|
20
|
+
import type { HydraniumWorkspaceManager } from './workspace/hydranium-workspace-manager.js';
|
|
21
|
+
import type { AdditionalDocumentContribution } from './workspace/additional-document-contribution.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Minimum shared-services shape every framework component reads from.
|
|
25
|
+
*
|
|
26
|
+
* Equivalent to Langium's `LangiumSharedCoreServices` enriched with the
|
|
27
|
+
* framework additions that other framework services consume: the dedicated
|
|
28
|
+
* {@link Clock}, {@link Logger} and {@link Tracer} top-level slots (injectable
|
|
29
|
+
* time source, emission-only logger, and the measure-and-emit tracer composed
|
|
30
|
+
* from the other two), the {@link AdditionalDocumentContribution} group, an
|
|
31
|
+
* {@link ExtendedServiceRegistry}, and on `workspace` a writable file-system
|
|
32
|
+
* provider plus {@link HydraniumWorkspaceManager}, {@link ProjectManager},
|
|
33
|
+
* {@link SelfSaveRegistry}, {@link BuildPipelineIntegration},
|
|
34
|
+
* {@link BuildPhasePassService}, {@link CstResidencyService} and
|
|
35
|
+
* {@link DocumentUriPolicy}.
|
|
36
|
+
*
|
|
37
|
+
* Declared structurally (interface extends + intersection on nested slots)
|
|
38
|
+
* so the full `ServerSharedServices` and any consumer-extended variant
|
|
39
|
+
* satisfy it without import cycles. Framework components
|
|
40
|
+
* that take `services` (workspace manager, index manager, document
|
|
41
|
+
* builder, ...) all take this single shape rather than a one-off type each.
|
|
42
|
+
*
|
|
43
|
+
* The fuller `ServerSharedServices` extends this for the LSP-bound surface
|
|
44
|
+
* (additional Langium services beyond core + the framework's full
|
|
45
|
+
* `ServerAddedSharedServices` declaration). Consumers writing their own
|
|
46
|
+
* framework component should prefer this minimal shape when they only need
|
|
47
|
+
* core services + framework defaults.
|
|
48
|
+
*/
|
|
49
|
+
export interface ServerSharedServicesMinimal<TProject extends Project = Project> extends LangiumSharedCoreServices {
|
|
50
|
+
Clock: Clock;
|
|
51
|
+
Logger: Logger;
|
|
52
|
+
Tracer: Tracer;
|
|
53
|
+
/**
|
|
54
|
+
* Contribution group of {@link AdditionalDocumentContribution}s the
|
|
55
|
+
* {@link HydraniumWorkspaceManager} drives from `loadAdditionalDocuments` at
|
|
56
|
+
* startup. The framework binds an empty default so the slot always resolves;
|
|
57
|
+
* adopters deep-merge contributions that seed built-in / stdlib documents.
|
|
58
|
+
*/
|
|
59
|
+
additionalDocuments: Record<string, AdditionalDocumentContribution>;
|
|
60
|
+
/**
|
|
61
|
+
* Narrows Langium's base `ServiceRegistry` slot to the framework impl the
|
|
62
|
+
* framework always binds, so the abstaining lookups — `getServicesFor`
|
|
63
|
+
* above all — are reachable from the minimal surface without a cast. The
|
|
64
|
+
* generic stays at its `LangiumCoreServices` default: this shape is what a
|
|
65
|
+
* component reads when it needs core services only, and the LSP-bound
|
|
66
|
+
* surface re-narrows the same slot to
|
|
67
|
+
* `ExtendedServiceRegistry<ServerLanguageServices>`.
|
|
68
|
+
*/
|
|
69
|
+
ServiceRegistry: ExtendedServiceRegistry;
|
|
70
|
+
workspace: LangiumSharedCoreServices['workspace'] & {
|
|
71
|
+
// Writable (`realpath`/`mtimeMs`/`writeFile`) — the framework always binds
|
|
72
|
+
// a writable provider; `RealpathDocumentUriPolicy` reads `realpath` here.
|
|
73
|
+
FileSystemProvider: WritableFileSystemProvider;
|
|
74
|
+
// Narrows Langium's base `WorkspaceManager` slot to the framework impl the
|
|
75
|
+
// framework always binds, so `wsRelativePath` and the folder-walk are
|
|
76
|
+
// reachable from the minimal surface without a cast.
|
|
77
|
+
WorkspaceManager: HydraniumWorkspaceManager;
|
|
78
|
+
ProjectManager: ProjectManager<TProject>;
|
|
79
|
+
SelfSaveRegistry: SelfSaveRegistry;
|
|
80
|
+
BuildPipelineIntegration: BuildPipelineIntegration;
|
|
81
|
+
BuildPhasePassService: BuildPhasePassService;
|
|
82
|
+
CstResidencyService: CstResidencyService;
|
|
83
|
+
DocumentUriPolicy: DocumentUriPolicy;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Adapt a factory that reads framework shared slots to a Langium
|
|
89
|
+
* module-context slot, whose parameter is statically typed at Langium's
|
|
90
|
+
* narrower `LangiumSharedCoreServices`.
|
|
91
|
+
*
|
|
92
|
+
* **Why a narrowing is needed at all.** `DefaultSharedModuleContext`'s factory
|
|
93
|
+
* slots are Langium's, so they promise only Langium's core services. The tree
|
|
94
|
+
* actually passed at runtime is always the framework-extended one — composition
|
|
95
|
+
* wires every framework slot before any factory runs — but nothing in
|
|
96
|
+
* Langium's types can say so. The gap is generic erasure at a seam the
|
|
97
|
+
* framework does not own, not a modelling mistake, so it cannot be typed away;
|
|
98
|
+
* it can only be performed in ONE place instead of at every call site.
|
|
99
|
+
*
|
|
100
|
+
* This is that place: adopters write a plain typed lambda rather than
|
|
101
|
+
* repeating `services as ServerSharedServicesMinimal` per factory. The
|
|
102
|
+
* callback's parameter is {@link ServerSharedServicesMinimal}, which the
|
|
103
|
+
* fuller `ServerSharedServices` also satisfies.
|
|
104
|
+
*/
|
|
105
|
+
export function serverSharedFactory<TResult>(create: (services: ServerSharedServicesMinimal) => TResult): (services: unknown) => TResult {
|
|
106
|
+
return services => create(services as ServerSharedServicesMinimal);
|
|
107
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
export * from './transfer-encoder.js';
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023-2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
type Tracer,
|
|
12
|
+
type TransferDiagnostic,
|
|
13
|
+
type TransferElement,
|
|
14
|
+
type TransferDocument,
|
|
15
|
+
type TransferTypeFor
|
|
16
|
+
} from '@hydranium/protocol';
|
|
17
|
+
import { AstUtils, type AstNode, DocumentCache, DocumentState, isAstNode, isReference, type LangiumDocument } from '@hydranium/langium';
|
|
18
|
+
import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-protocol';
|
|
19
|
+
import { type AstDocument } from '../../documents/ast-document-manager.js';
|
|
20
|
+
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
21
|
+
import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
22
|
+
import { type TransferLspDiagnostic } from '../validation/document-validator.js';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Which set of properties {@link TransferEncoder.toTransfer} emits.
|
|
26
|
+
*
|
|
27
|
+
* - `'full'` — every own property of the node (Langium internals aside),
|
|
28
|
+
* including AST-extension-derived computed scalars and synthetic child
|
|
29
|
+
* mirrors. This is the wire shape clients consume, and the default.
|
|
30
|
+
* - `'grammar'` — only the grammar-declared properties, per
|
|
31
|
+
* `AstReflection.getTypeMetaData($type).properties`. Excludes every
|
|
32
|
+
* computed / synthetic property by construction (no naming convention,
|
|
33
|
+
* no registration). Yields the authored state a serializer round-trips —
|
|
34
|
+
* a diffable, acyclic baseline for field-level recording / forward-write
|
|
35
|
+
* reconcile.
|
|
36
|
+
*/
|
|
37
|
+
export type TransferMode = 'full' | 'grammar';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Per-encode inputs threaded through the {@link TransferEncoder} walk and its
|
|
41
|
+
* hooks. Created once per encode entry (see
|
|
42
|
+
* {@link TransferEncoder.createEncodeContext}) and passed unchanged through
|
|
43
|
+
* the recursion, so every hook invocation of one encode observes the same
|
|
44
|
+
* inputs — unlike instance state, which two interleaving encodes would
|
|
45
|
+
* clobber.
|
|
46
|
+
*
|
|
47
|
+
* Adopters widen the context by overriding `createEncodeContext` with a
|
|
48
|
+
* covariant return type and narrowing the hook parameter types accordingly
|
|
49
|
+
* (TypeScript method bivariance admits the narrowing). An input that changes
|
|
50
|
+
* the encoded output must also be folded into {@link TransferEncoder.rootCacheKey}.
|
|
51
|
+
*/
|
|
52
|
+
export interface EncodeContext {
|
|
53
|
+
/** Property-set selection for this encode — see {@link TransferMode}. */
|
|
54
|
+
readonly mode: TransferMode;
|
|
55
|
+
/**
|
|
56
|
+
* URI of the document whose subtree is being encoded, when known. The
|
|
57
|
+
* document entry points always set it; the bare {@link TransferEncoder.toTransfer}
|
|
58
|
+
* door derives it from the node's root when the node is attached to a
|
|
59
|
+
* document, and leaves it `undefined` for detached / synthetic subtrees.
|
|
60
|
+
*/
|
|
61
|
+
readonly uri?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The non-root inputs {@link TransferEncoder.assembleTransferDocument} needs to
|
|
66
|
+
* build a wire envelope. Both of the encoder's document paths narrow to this
|
|
67
|
+
* before assembling — a built `LangiumDocument` (whose `uri` / `version` live on
|
|
68
|
+
* its `textDocument`) and a server-internal `AstDocument` snapshot, which
|
|
69
|
+
* satisfies the shape structurally — so the assembly seam has exactly one
|
|
70
|
+
* implementation to override.
|
|
71
|
+
*
|
|
72
|
+
* `diagnostics` accepts either the wire shape (an already-projected
|
|
73
|
+
* `TDiagnostic`, as a snapshot may carry) or a raw LSP {@link Diagnostic}; the
|
|
74
|
+
* assembly projects each through {@link TransferEncoder.toTransferDiagnostic}.
|
|
75
|
+
*/
|
|
76
|
+
export interface TransferEnvelopeSource<TDiagnostic> {
|
|
77
|
+
readonly uri: string;
|
|
78
|
+
readonly version: number;
|
|
79
|
+
readonly diagnostics: readonly (TDiagnostic | Diagnostic)[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* One-directional structural mapper from a Langium AST into the wire
|
|
84
|
+
* transfer-model shape ({@link TransferElement}-based JSON).
|
|
85
|
+
*
|
|
86
|
+
* **Direction.** AST → transfer only. The inverse (transfer → AST) is
|
|
87
|
+
* composite: serialise the transfer to text through the `Serializer` bound at
|
|
88
|
+
* `serializer.Serializer` (`serializeTransfer`), then re-parse via Langium's
|
|
89
|
+
* `DocumentBuilder`. No `decode` method exists; the parser is the decoder. The transfer model
|
|
90
|
+
* is intentionally lossy w.r.t. `$container` / `$cstNode` topology and
|
|
91
|
+
* `Reference<T>` resolution — those are re-derived by the parser/linker
|
|
92
|
+
* from text + workspace scope.
|
|
93
|
+
*
|
|
94
|
+
* **Generic parameters.**
|
|
95
|
+
* - `TTransferMap` — per-grammar overlay keyed by AST `$type` strings,
|
|
96
|
+
* resolving each AST type to its declared wire shape. Default is
|
|
97
|
+
* `Record<string, TransferElement>`, which collapses every encoded node
|
|
98
|
+
* to the structural base — adequate for adopters without a generated
|
|
99
|
+
* overlay; richer adopters declare typed maps for autocomplete on the
|
|
100
|
+
* encoder's return types.
|
|
101
|
+
* - `TDiagnostic` — wire-diagnostic shape produced by
|
|
102
|
+
* {@link toTransferDiagnostic}. Constrained to extend
|
|
103
|
+
* {@link TransferDiagnostic} so the framework default (which constructs a
|
|
104
|
+
* `TransferDiagnostic` literal) satisfies any tighter binding under
|
|
105
|
+
* covariance.
|
|
106
|
+
*
|
|
107
|
+
* **Adopter extension surface.** The property walk is decomposed into
|
|
108
|
+
* per-concern hooks so adopters customise a slice without copying it —
|
|
109
|
+
* every hook receives the per-encode {@link EncodeContext}:
|
|
110
|
+
* - {@link createEncodeContext} — widen the context with per-encode
|
|
111
|
+
* inputs, resolved once per entry.
|
|
112
|
+
* - {@link propertyKeys} — which property names the walk visits.
|
|
113
|
+
* - {@link shouldEmitProperty} — per-key filter on top of the default
|
|
114
|
+
* `$`-internals strip.
|
|
115
|
+
* - {@link resolvePropertyValue} — value substitution per property.
|
|
116
|
+
* - {@link finalizeTransferNode} — post-decoration per encoded node.
|
|
117
|
+
* - {@link toTransferValue} — recursion seam per property value. Override
|
|
118
|
+
* to special-case reference encoding or to drop specific value shapes.
|
|
119
|
+
* Envelope-level seams:
|
|
120
|
+
* - {@link toTransferDocument} — bundle root + diagnostics into the wire
|
|
121
|
+
* {@link TransferDocument} envelope. Override to filter / merge
|
|
122
|
+
* diagnostics from auxiliary sources or to project a synthesised root.
|
|
123
|
+
* - {@link toTransferDiagnostic} — project a {@link TransferLspDiagnostic}
|
|
124
|
+
* (the framework validator's output) to {@link TDiagnostic}.
|
|
125
|
+
*/
|
|
126
|
+
export class TransferEncoder<
|
|
127
|
+
// The map is intentionally unconstrained — adopters supply typed
|
|
128
|
+
// overlays whose specific-key shapes don't structurally satisfy a
|
|
129
|
+
// `Record<string, TransferElement>` index signature. `TransferTypeFor`
|
|
130
|
+
// applies the per-key `extends TransferElement` check at lookup time.
|
|
131
|
+
TTransferMap = Record<string, TransferElement>,
|
|
132
|
+
TDiagnostic extends TransferDiagnostic = TransferDiagnostic
|
|
133
|
+
> {
|
|
134
|
+
protected readonly tracer: Tracer;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Per-document cache of encoded transfer roots ({@link toTransferDocument}'s
|
|
138
|
+
* `'full'` root). Internal — not part of the encoder's public surface.
|
|
139
|
+
* Lets the data-server's fingerprint and emitted envelope share a single
|
|
140
|
+
* encode walk within one build (both call `toTransferDocument`).
|
|
141
|
+
*
|
|
142
|
+
* Evicts on `DocumentState.Linked`, NOT the default `onUpdate`: the `'full'`
|
|
143
|
+
* transfer root folds in the AST-extension computed properties, which resolve
|
|
144
|
+
* against other documents, so it changes on *cascade* rebuilds where the
|
|
145
|
+
* document's own text (and version) does not. `DocumentCache`'s `state` mode
|
|
146
|
+
* evicts every document affected by a build (any state `>= Linked`), which
|
|
147
|
+
* covers those cascade dependents; the default `onUpdate` mode evicts only
|
|
148
|
+
* the directly-edited documents and would serve a stale root to dependents.
|
|
149
|
+
*/
|
|
150
|
+
protected readonly rootCache: DocumentCache<string, unknown>;
|
|
151
|
+
|
|
152
|
+
// The base reads three slots: `Tracer`, the `DocumentBuilder` the root
|
|
153
|
+
// cache evicts from, and `AstReflection` for the `'grammar'` allowlist. The
|
|
154
|
+
// whole bundle is taken anyway, matching the framework's
|
|
155
|
+
// `(services, options)` constructor convention, so a subclass needing a
|
|
156
|
+
// further slot — a language `Serializer` for textual re-serialisation, say —
|
|
157
|
+
// forwards the same parameter via `super(services, options)`.
|
|
158
|
+
constructor(
|
|
159
|
+
protected readonly services: ServerSharedServicesMinimal,
|
|
160
|
+
options: LogNameOptions = {}
|
|
161
|
+
) {
|
|
162
|
+
this.tracer = services.Tracer.for(options.logName ?? 'TransferEncoder').trace('instantiated');
|
|
163
|
+
this.rootCache = new DocumentCache<string, unknown>(services, DocumentState.Linked);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Cache key for a memoised transfer root, *within* one document — the
|
|
168
|
+
* {@link rootCache} is keyed `(document uri, this key)`.
|
|
169
|
+
*
|
|
170
|
+
* Default: the encode mode alone. That is correct exactly while the encoded
|
|
171
|
+
* output is a pure function of `(document, mode)`, which holds for every
|
|
172
|
+
* framework hook.
|
|
173
|
+
*
|
|
174
|
+
* **Adopters whose `createEncodeContext` injects an input that changes the
|
|
175
|
+
* OUTPUT must fold that input in here.** Otherwise two encodes of one
|
|
176
|
+
* document under different inputs serve each other's result: the first
|
|
177
|
+
* caller's root is memoised and the second gets it back, silently, with no
|
|
178
|
+
* type error to catch it. Widening the key is cheap (the cache holds one
|
|
179
|
+
* entry per distinct key per document) and evicts on the same build
|
|
180
|
+
* boundary.
|
|
181
|
+
*/
|
|
182
|
+
protected rootCacheKey(context: EncodeContext): string {
|
|
183
|
+
return context.mode;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Encode an AST node into its transfer-model shape, resolving
|
|
188
|
+
* cross-references to their `$refText` and recursing into nested nodes.
|
|
189
|
+
* The {@link TransferMode} argument selects which properties are emitted;
|
|
190
|
+
* {@link propertyKeys} enumerates them and the per-key hooks filter and
|
|
191
|
+
* substitute.
|
|
192
|
+
*
|
|
193
|
+
* Non-destructive: returns a fresh object graph and leaves the AST
|
|
194
|
+
* untouched. Synchronous — walks the in-memory AST without serialising.
|
|
195
|
+
*/
|
|
196
|
+
toTransfer<T extends AstNode>(ast: T, mode: TransferMode = 'full'): TransferTypeFor<T, TTransferMap> {
|
|
197
|
+
// Derive the owning document's URI when the node is attached so hooks
|
|
198
|
+
// (and adopter-widened contexts) can resolve per-document inputs even
|
|
199
|
+
// through this bare-node door. `findRootNode` never throws; a detached
|
|
200
|
+
// or synthetic subtree simply yields an undefined URI.
|
|
201
|
+
const uri = AstUtils.findRootNode(ast).$document?.uri.toString();
|
|
202
|
+
return this.encodeNode(ast, this.createEncodeContext(mode, uri)) as TransferTypeFor<T, TTransferMap>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Create the {@link EncodeContext} for one encode entry. Called once per
|
|
207
|
+
* entry point ({@link toTransfer}, {@link toTransferDocument},
|
|
208
|
+
* {@link astDocumentToTransferDocument}); the result threads unchanged
|
|
209
|
+
* through the whole recursion. Adopters override with a covariant return
|
|
210
|
+
* type to carry extra per-encode inputs, resolved here once instead of
|
|
211
|
+
* once per node.
|
|
212
|
+
*/
|
|
213
|
+
protected createEncodeContext(mode: TransferMode, uri?: string): EncodeContext {
|
|
214
|
+
return { mode, uri };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Encode one node under an established context — the recursion core the
|
|
219
|
+
* entry points and {@link toTransferValue} share. Delegates each concern to
|
|
220
|
+
* an overridable hook so adopters customise a slice without copying the
|
|
221
|
+
* walk.
|
|
222
|
+
*/
|
|
223
|
+
protected encodeNode(ast: AstNode, context: EncodeContext): Record<string, unknown> {
|
|
224
|
+
const result: Record<string, unknown> = { $type: ast.$type };
|
|
225
|
+
for (const key of this.propertyKeys(ast, context)) {
|
|
226
|
+
if (!this.shouldEmitProperty(ast, key, context)) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const value = this.resolvePropertyValue(ast, key, context);
|
|
230
|
+
// `'grammar'` lists every declared property, including those absent on
|
|
231
|
+
// this node; skip the absent ones. (`'full'` enumerates only own
|
|
232
|
+
// properties, so absent properties never surface there.) Part of the
|
|
233
|
+
// mode contract, not the adopter filter — hence not in shouldEmitProperty.
|
|
234
|
+
if (context.mode === 'grammar' && value === undefined) {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
result[key] = this.toTransferValue(value, context);
|
|
238
|
+
}
|
|
239
|
+
this.finalizeTransferNode(ast, result, context);
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Which property names the walk visits for `ast`.
|
|
245
|
+
*
|
|
246
|
+
* Default: `'full'` enumerates own properties (including non-enumerable
|
|
247
|
+
* ones via `Object.getOwnPropertyNames`, which catches
|
|
248
|
+
* AST-extension-derived properties); `'grammar'` enumerates the
|
|
249
|
+
* declared-property allowlist per
|
|
250
|
+
* `AstReflection.getTypeMetaData($type).properties`.
|
|
251
|
+
*/
|
|
252
|
+
protected propertyKeys(ast: AstNode, context: EncodeContext): readonly string[] {
|
|
253
|
+
return context.mode === 'grammar'
|
|
254
|
+
? Object.keys(this.services.AstReflection.getTypeMetaData(ast.$type).properties)
|
|
255
|
+
: Object.getOwnPropertyNames(ast);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Per-key filter. Default: strip the `$`-prefixed Langium internals
|
|
260
|
+
* (`$container`, `$cstNode`, `$containerProperty`, `$containerIndex`,
|
|
261
|
+
* `$document`) that would otherwise form cycles `JSON.stringify` rejects
|
|
262
|
+
* or carry server-internal data clients cannot use. Adopter overrides
|
|
263
|
+
* refine ON TOP of the default (call `super.shouldEmitProperty` first).
|
|
264
|
+
*/
|
|
265
|
+
protected shouldEmitProperty(_ast: AstNode, key: string, _context: EncodeContext): boolean {
|
|
266
|
+
return !key.startsWith('$');
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Which value the walk emits under `key`. Default: the node's own value.
|
|
271
|
+
* Override to substitute a derived value under a grammar property name.
|
|
272
|
+
*/
|
|
273
|
+
protected resolvePropertyValue(ast: AstNode, key: string, _context: EncodeContext): unknown {
|
|
274
|
+
return (ast as unknown as Record<string, unknown>)[key];
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Post-decoration hook, invoked once per encoded node after its property
|
|
279
|
+
* walk. Default: no-op. Override to append synthesised wire-only fields —
|
|
280
|
+
* gate on `context.mode === 'full'` when the addition must stay out of the
|
|
281
|
+
* grammar (round-trippable) shape.
|
|
282
|
+
*/
|
|
283
|
+
protected finalizeTransferNode(_ast: AstNode, _result: Record<string, unknown>, _context: EncodeContext): void {
|
|
284
|
+
// Intentionally empty — adopter seam.
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Build a wire {@link TransferDocument} envelope from a built
|
|
289
|
+
* {@link LangiumDocument}. The `'full'` root is served from the internal
|
|
290
|
+
* {@link rootCache} (memoised per document until it next rebuilds), under
|
|
291
|
+
* {@link rootCacheKey} — so the data-server's fingerprint and emitted
|
|
292
|
+
* envelope share one encode walk within a build, while two encodes whose
|
|
293
|
+
* contexts differ in an output-affecting way stay separate entries.
|
|
294
|
+
* Diagnostics are projected fresh on every call (cheap, and they change
|
|
295
|
+
* independently of the root — a cross-document reference flipping unresolved
|
|
296
|
+
* bumps diagnostics while the root, encoding the ref as the same
|
|
297
|
+
* `$refText`, does not).
|
|
298
|
+
*
|
|
299
|
+
* The context is created before the cache lookup, not inside the factory,
|
|
300
|
+
* because the key is derived from it — so it costs one context construction
|
|
301
|
+
* per call, including on a hit. That is a shallow object plus whatever the
|
|
302
|
+
* adopter resolves in `createEncodeContext`, against a whole encode walk
|
|
303
|
+
* saved.
|
|
304
|
+
*
|
|
305
|
+
* The cache holds its entries as `unknown`, so the memoised root is
|
|
306
|
+
* asserted to the caller's `<TAst>` claim on the way out. Nothing checks
|
|
307
|
+
* that claim — Langium types `parseResult.value` as a bare `AstNode` — but
|
|
308
|
+
* the runtime walk doesn't depend on the typing being correct.
|
|
309
|
+
*/
|
|
310
|
+
toTransferDocument<TAst extends AstNode>(
|
|
311
|
+
langiumDocument: LangiumDocument
|
|
312
|
+
): TransferDocument<TransferTypeFor<TAst, TTransferMap>, TDiagnostic> {
|
|
313
|
+
const context = this.createEncodeContext('full', langiumDocument.uri.toString());
|
|
314
|
+
const root = this.rootCache.get(langiumDocument.uri, this.rootCacheKey(context), () =>
|
|
315
|
+
this.encodeNode(langiumDocument.parseResult.value, context)
|
|
316
|
+
) as TransferTypeFor<TAst, TTransferMap>;
|
|
317
|
+
return this.assembleTransferDocument<TAst>(
|
|
318
|
+
{
|
|
319
|
+
uri: langiumDocument.textDocument.uri,
|
|
320
|
+
version: langiumDocument.textDocument.version,
|
|
321
|
+
diagnostics: langiumDocument.diagnostics ?? []
|
|
322
|
+
},
|
|
323
|
+
root
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Wrap an already-encoded root into the wire envelope (uri / version /
|
|
329
|
+
* projected diagnostics).
|
|
330
|
+
*
|
|
331
|
+
* **The single chokepoint for every envelope the encoder emits.** Both
|
|
332
|
+
* document paths land here — {@link toTransferDocument} from a live
|
|
333
|
+
* `LangiumDocument` and {@link astDocumentToTransferDocument} from an
|
|
334
|
+
* `AstDocument` snapshot — so one override is seen by data-server emissions
|
|
335
|
+
* and adopter facade returns alike. It takes a
|
|
336
|
+
* {@link TransferEnvelopeSource} rather than a `LangiumDocument` precisely
|
|
337
|
+
* so the snapshot path can reach it without a `LangiumDocuments` lookup.
|
|
338
|
+
*/
|
|
339
|
+
protected assembleTransferDocument<TAst extends AstNode>(
|
|
340
|
+
source: TransferEnvelopeSource<TDiagnostic>,
|
|
341
|
+
root: TransferTypeFor<TAst, TTransferMap>
|
|
342
|
+
): TransferDocument<TransferTypeFor<TAst, TTransferMap>, TDiagnostic> {
|
|
343
|
+
return {
|
|
344
|
+
uri: source.uri,
|
|
345
|
+
version: source.version,
|
|
346
|
+
root,
|
|
347
|
+
diagnostics: source.diagnostics.map(diagnostic => this.toTransferDiagnostic(diagnostic as TransferLspDiagnostic))
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Build a wire {@link TransferDocument} envelope from a server-internal
|
|
353
|
+
* {@link AstDocument} snapshot (the AST-typed envelope emitted by
|
|
354
|
+
* `AstDocumentManager.onUpdate` / `onSave` and returned from
|
|
355
|
+
* `ModelService.request` / `update` / `save`). Distinct from
|
|
356
|
+
* {@link toTransferDocument}(`LangiumDocument`) which encodes against
|
|
357
|
+
* the live build artifact — adopter facade returns hold the snapshot
|
|
358
|
+
* directly, and this helper bridges that to the wire shape without a
|
|
359
|
+
* second `LangiumDocuments.getDocument` lookup.
|
|
360
|
+
*
|
|
361
|
+
* The `diagnostic` projection assumes the snapshot's diagnostics carry
|
|
362
|
+
* the `TransferLspDiagnostic` shape ({@link Diagnostic} plus the
|
|
363
|
+
* framework validator's `element` / `property` decoration). Snapshots
|
|
364
|
+
* built from raw Langium diagnostics structurally satisfy this — the
|
|
365
|
+
* extra fields are optional in the projection.
|
|
366
|
+
*
|
|
367
|
+
* Encodes the root, then delegates the envelope to
|
|
368
|
+
* {@link assembleTransferDocument} (an `AstDocument` satisfies
|
|
369
|
+
* {@link TransferEnvelopeSource} structurally), so this path shares the
|
|
370
|
+
* assembly seam rather than duplicating it.
|
|
371
|
+
*/
|
|
372
|
+
astDocumentToTransferDocument<TAst extends AstNode>(
|
|
373
|
+
document: AstDocument<TAst, TDiagnostic | TransferLspDiagnostic>
|
|
374
|
+
): TransferDocument<TransferTypeFor<TAst, TTransferMap>, TDiagnostic> {
|
|
375
|
+
const root = this.encodeNode(document.root, this.createEncodeContext('full', document.uri)) as TransferTypeFor<TAst, TTransferMap>;
|
|
376
|
+
return this.assembleTransferDocument<TAst>(document, root);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Project an LSP-shaped diagnostic (typically a
|
|
381
|
+
* {@link TransferLspDiagnostic} produced by
|
|
382
|
+
* `HydraniumDocumentValidator` — adds `element` + optional `property`
|
|
383
|
+
* to the standard {@link Diagnostic} shape) to the wire-diagnostic
|
|
384
|
+
* shape.
|
|
385
|
+
*
|
|
386
|
+
* Default projection produces the full {@link TransferDiagnostic}: maps
|
|
387
|
+
* LSP severity enum to the wire string union, discriminates the
|
|
388
|
+
* diagnostic type from Langium's `data.code` (`'lexing-error'` /
|
|
389
|
+
* `'parsing-error'` else `'validation-error'`), passes through
|
|
390
|
+
* message / element / property / code. Adopters whose validator
|
|
391
|
+
* doesn't decorate diagnostics with `element` still get a valid
|
|
392
|
+
* `TransferDiagnostic` — the field falls back to `''`.
|
|
393
|
+
*
|
|
394
|
+
* Override only if the wire-diagnostic shape needs fields beyond
|
|
395
|
+
* what {@link TransferDiagnostic} carries.
|
|
396
|
+
*/
|
|
397
|
+
toTransferDiagnostic(diagnostic: TransferLspDiagnostic): TDiagnostic {
|
|
398
|
+
const langiumCode = (diagnostic.data as { code?: string } | undefined)?.code;
|
|
399
|
+
const result: TransferDiagnostic = {
|
|
400
|
+
type: langiumCode === 'lexing-error' ? 'lexing-error' : langiumCode === 'parsing-error' ? 'parsing-error' : 'validation-error',
|
|
401
|
+
element: diagnostic.element ?? '',
|
|
402
|
+
property: diagnostic.property,
|
|
403
|
+
// LSP 3.18 allows a `MarkupContent` message; the wire shape is plain text.
|
|
404
|
+
message: Diagnostic.getMessageString(diagnostic),
|
|
405
|
+
severity:
|
|
406
|
+
diagnostic.severity === DiagnosticSeverity.Error
|
|
407
|
+
? 'error'
|
|
408
|
+
: diagnostic.severity === DiagnosticSeverity.Warning
|
|
409
|
+
? 'warning'
|
|
410
|
+
: 'info',
|
|
411
|
+
code: typeof diagnostic.code === 'number' || typeof diagnostic.code === 'string' ? diagnostic.code : langiumCode
|
|
412
|
+
};
|
|
413
|
+
return result as TDiagnostic;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Recursion seam — converts a single property value during the AST
|
|
418
|
+
* walk. Arrays recurse element-wise; cross-references collapse to
|
|
419
|
+
* their `$refText`; nested AST nodes encode via {@link encodeNode} under
|
|
420
|
+
* the same {@link EncodeContext}; primitives pass through unchanged.
|
|
421
|
+
*/
|
|
422
|
+
protected toTransferValue(value: unknown, context: EncodeContext): unknown {
|
|
423
|
+
if (Array.isArray(value)) {
|
|
424
|
+
return value.map(element => this.toTransferValue(element, context));
|
|
425
|
+
}
|
|
426
|
+
if (isReference(value)) {
|
|
427
|
+
return value.$refText;
|
|
428
|
+
}
|
|
429
|
+
if (isAstNode(value)) {
|
|
430
|
+
return this.encodeNode(value, context);
|
|
431
|
+
}
|
|
432
|
+
return value;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
export * from './normalize-empty-strings.js';
|
|
11
|
+
export * from './semantic-root-rewrite.js';
|
|
12
|
+
export * from './update-rewrite.js';
|
|
13
|
+
export * from './update-rewrite-contribution.js';
|
|
14
|
+
export * from './update-rewrite-service.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
import { type UpdateRewriteContribution, type UpdateRewriteRegistry } from './update-rewrite-contribution.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Ready-made {@link UpdateRewriteContribution} that registers one rewrite —
|
|
14
|
+
* the `'' → unset` normalisation — and exposes the transform itself as the
|
|
15
|
+
* overridable {@link normalize} hook.
|
|
16
|
+
*
|
|
17
|
+
* **Why this exists.** An HTML form control that the user clears emits `''`,
|
|
18
|
+
* never `undefined` / absent — but a structured diff treats `''` and absent as
|
|
19
|
+
* different. Without normalisation, the same "clear the field" gesture produces
|
|
20
|
+
* two different persisted outcomes depending on the field's grammar default (a
|
|
21
|
+
* literal `field: ''` local override vs re-inheriting). Collapsing `'' → unset`
|
|
22
|
+
* makes "clear" uniformly mean "remove my local value", the only intent the
|
|
23
|
+
* form can express.
|
|
24
|
+
*
|
|
25
|
+
* **Opt-in.** The framework never binds this by default: dropping `''` encodes a
|
|
26
|
+
* grammar-specific "`''` is never meaningful" assumption, so it would silently
|
|
27
|
+
* lose data for a grammar where `''` is meaningful. Bind it under a named
|
|
28
|
+
* sub-key of your module's `updateRewrite.rewrites` group when your form
|
|
29
|
+
* transport emits `''`.
|
|
30
|
+
*
|
|
31
|
+
* **Adapt** by subclassing and overriding {@link normalize} — e.g. to preserve
|
|
32
|
+
* grammar-meaningful empties for specific keys — without touching the
|
|
33
|
+
* registration glue.
|
|
34
|
+
*/
|
|
35
|
+
export class NormalizeEmptyStringsContribution implements UpdateRewriteContribution {
|
|
36
|
+
registerUpdateRewrites(registry: UpdateRewriteRegistry): void {
|
|
37
|
+
registry.register({
|
|
38
|
+
id: 'normalize-empty-strings',
|
|
39
|
+
// Low priority so it runs before any diff-based rewrite — a
|
|
40
|
+
// reconciliation pass should see cleared fields already read as unset.
|
|
41
|
+
priority: -100,
|
|
42
|
+
rewrite: model => this.normalize(model)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Collapse empty-string properties to "unset" (drop the key) throughout the
|
|
48
|
+
* transfer-model graph. Override to adapt the rule (the override applies at
|
|
49
|
+
* every depth, since the walk recurses through this method).
|
|
50
|
+
*
|
|
51
|
+
* Scope of the walk:
|
|
52
|
+
* - Recurses object properties and into object elements of arrays.
|
|
53
|
+
* - Leaves **primitive array elements** untouched — e.g. reference-id
|
|
54
|
+
* strings must not have an accidental `''` turned into a hole in the array.
|
|
55
|
+
* - Leaves `$`-prefixed (Langium internals like `$type`) and `_`-prefixed
|
|
56
|
+
* (derived metadata) keys verbatim — downstream rewrites read them.
|
|
57
|
+
* - Leaves Langium `Reference` objects (`{ $refText }`) verbatim.
|
|
58
|
+
*
|
|
59
|
+
* Pure — returns a new object graph, does not mutate its input.
|
|
60
|
+
*/
|
|
61
|
+
protected normalize<T>(value: T): T {
|
|
62
|
+
if (value === null || typeof value !== 'object') {
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
// Recurse into object elements only; primitive elements (reference strings) pass through.
|
|
67
|
+
return value.map(item => (item !== null && typeof item === 'object' ? this.normalize(item) : item)) as unknown as T;
|
|
68
|
+
}
|
|
69
|
+
const record = value as Record<string, unknown>;
|
|
70
|
+
if ('$refText' in record) {
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
const result: Record<string, unknown> = {};
|
|
74
|
+
for (const [key, entry] of Object.entries(record)) {
|
|
75
|
+
if (key.startsWith('$') || key.startsWith('_')) {
|
|
76
|
+
result[key] = entry;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (entry === '') {
|
|
80
|
+
continue; // empty-string property → treat as unset (drop the key, equivalent to absent)
|
|
81
|
+
}
|
|
82
|
+
result[key] = this.normalize(entry);
|
|
83
|
+
}
|
|
84
|
+
return result as T;
|
|
85
|
+
}
|
|
86
|
+
}
|