@hydranium/core 1.0.0-next.38 → 1.0.0-next.381
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/README.md +78 -82
- package/lib/browser/host-heads-in-worker.d.ts +77 -0
- package/lib/browser/host-heads-in-worker.d.ts.map +1 -0
- package/lib/browser/host-heads-in-worker.js +169 -0
- package/lib/browser/host-heads-in-worker.js.map +1 -0
- package/lib/browser/index.d.ts +12 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +17 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/indexeddb-file-system-store.d.ts +82 -0
- package/lib/browser/indexeddb-file-system-store.d.ts.map +1 -0
- package/lib/browser/indexeddb-file-system-store.js +181 -0
- package/lib/browser/indexeddb-file-system-store.js.map +1 -0
- package/lib/browser/start-language-server-in-worker.d.ts +32 -0
- package/lib/browser/start-language-server-in-worker.d.ts.map +1 -0
- package/lib/browser/start-language-server-in-worker.js +40 -0
- package/lib/browser/start-language-server-in-worker.js.map +1 -0
- package/lib/documents/ast-document-manager.d.ts +254 -140
- package/lib/documents/ast-document-manager.d.ts.map +1 -1
- package/lib/documents/ast-document-manager.js +311 -127
- package/lib/documents/ast-document-manager.js.map +1 -1
- package/lib/documents/client-ids.d.ts +5 -19
- package/lib/documents/client-ids.d.ts.map +1 -1
- package/lib/documents/client-ids.js +5 -19
- package/lib/documents/client-ids.js.map +1 -1
- package/lib/documents/client-session-errors.d.ts +15 -0
- package/lib/documents/client-session-errors.d.ts.map +1 -0
- package/lib/documents/client-session-errors.js +15 -0
- package/lib/documents/client-session-errors.js.map +1 -0
- package/lib/documents/client-session-registry.d.ts +146 -0
- package/lib/documents/client-session-registry.d.ts.map +1 -0
- package/lib/documents/client-session-registry.js +207 -0
- package/lib/documents/client-session-registry.js.map +1 -0
- package/lib/documents/dirty-state-tracker.d.ts +101 -0
- package/lib/documents/dirty-state-tracker.d.ts.map +1 -0
- package/lib/documents/dirty-state-tracker.js +85 -0
- package/lib/documents/dirty-state-tracker.js.map +1 -0
- package/lib/documents/document-release-handler.d.ts +204 -0
- package/lib/documents/document-release-handler.d.ts.map +1 -0
- package/lib/documents/document-release-handler.js +317 -0
- package/lib/documents/document-release-handler.js.map +1 -0
- package/lib/documents/document-release-scheduler.d.ts +67 -0
- package/lib/documents/document-release-scheduler.d.ts.map +1 -0
- package/lib/documents/document-release-scheduler.js +80 -0
- package/lib/documents/document-release-scheduler.js.map +1 -0
- package/lib/documents/file-system-task-queue.d.ts +52 -0
- package/lib/documents/file-system-task-queue.d.ts.map +1 -0
- package/lib/documents/file-system-task-queue.js +37 -0
- package/lib/documents/file-system-task-queue.js.map +1 -0
- package/lib/documents/hydranium-text-documents.d.ts +445 -282
- package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
- package/lib/documents/hydranium-text-documents.js +903 -504
- package/lib/documents/hydranium-text-documents.js.map +1 -1
- package/lib/documents/index.d.ts +10 -2
- package/lib/documents/index.d.ts.map +1 -1
- package/lib/documents/index.js +10 -2
- package/lib/documents/index.js.map +1 -1
- package/lib/documents/language-client-shadow.d.ts +234 -0
- package/lib/documents/language-client-shadow.d.ts.map +1 -0
- package/lib/documents/language-client-shadow.js +306 -0
- package/lib/documents/language-client-shadow.js.map +1 -0
- package/lib/documents/model-ledger.d.ts +47 -0
- package/lib/documents/model-ledger.d.ts.map +1 -0
- package/lib/documents/model-ledger.js +30 -0
- package/lib/documents/model-ledger.js.map +1 -0
- package/lib/documents/text-ledger.d.ts +64 -0
- package/lib/documents/text-ledger.d.ts.map +1 -0
- package/lib/documents/text-ledger.js +63 -0
- package/lib/documents/text-ledger.js.map +1 -0
- package/lib/documents/version-sync-service.d.ts +145 -0
- package/lib/documents/version-sync-service.d.ts.map +1 -0
- package/lib/documents/version-sync-service.js +177 -0
- package/lib/documents/version-sync-service.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/langium/ast-extension/ast-extension-service.d.ts +42 -31
- package/lib/langium/ast-extension/ast-extension-service.d.ts.map +1 -1
- package/lib/langium/ast-extension/ast-extension-service.js +45 -19
- package/lib/langium/ast-extension/ast-extension-service.js.map +1 -1
- package/lib/langium/ast-extension/ast-node-builder.d.ts +12 -7
- package/lib/langium/ast-extension/ast-node-builder.d.ts.map +1 -1
- package/lib/langium/ast-extension/ast-node-builder.js +25 -9
- package/lib/langium/ast-extension/ast-node-builder.js.map +1 -1
- package/lib/langium/bootstrap.d.ts +49 -36
- package/lib/langium/bootstrap.d.ts.map +1 -1
- package/lib/langium/bootstrap.js +75 -36
- package/lib/langium/bootstrap.js.map +1 -1
- package/lib/langium/build-phase-pass/build-phase-pass-service.d.ts +9 -9
- package/lib/langium/build-phase-pass/build-phase-pass-service.d.ts.map +1 -1
- package/lib/langium/build-phase-pass/build-phase-pass-service.js +25 -16
- package/lib/langium/build-phase-pass/build-phase-pass-service.js.map +1 -1
- package/lib/langium/build-phase-pass/build-phase-pass.d.ts +20 -8
- package/lib/langium/build-phase-pass/build-phase-pass.d.ts.map +1 -1
- package/lib/langium/build-phase-pass/build-phase-pass.js +20 -0
- package/lib/langium/build-phase-pass/build-phase-pass.js.map +1 -1
- package/lib/langium/composite-ast-reflection.d.ts +46 -0
- package/lib/langium/composite-ast-reflection.d.ts.map +1 -0
- package/lib/langium/composite-ast-reflection.js +97 -0
- package/lib/langium/composite-ast-reflection.js.map +1 -0
- package/lib/langium/config/configuration-provider.d.ts +81 -0
- package/lib/langium/config/configuration-provider.d.ts.map +1 -0
- package/lib/langium/config/configuration-provider.js +112 -0
- package/lib/langium/config/configuration-provider.js.map +1 -0
- package/lib/langium/config/index.d.ts +1 -0
- package/lib/langium/config/index.d.ts.map +1 -1
- package/lib/langium/config/index.js +1 -0
- package/lib/langium/config/index.js.map +1 -1
- package/lib/langium/config/settings.js.map +1 -1
- package/lib/langium/diagnostics/console-tee.d.ts +27 -0
- package/lib/langium/diagnostics/console-tee.d.ts.map +1 -0
- package/lib/langium/diagnostics/console-tee.js +141 -0
- package/lib/langium/diagnostics/console-tee.js.map +1 -0
- package/lib/langium/diagnostics/hydranium-langium-profiler.d.ts +9 -20
- package/lib/langium/diagnostics/hydranium-langium-profiler.d.ts.map +1 -1
- package/lib/langium/diagnostics/hydranium-langium-profiler.js +15 -24
- package/lib/langium/diagnostics/hydranium-langium-profiler.js.map +1 -1
- package/lib/langium/diagnostics/log-preamble.js +1 -1
- package/lib/langium/diagnostics/log-preamble.js.map +1 -1
- package/lib/langium/diagnostics/logger.d.ts +25 -6
- package/lib/langium/diagnostics/logger.d.ts.map +1 -1
- package/lib/langium/diagnostics/logger.js +49 -17
- package/lib/langium/diagnostics/logger.js.map +1 -1
- package/lib/langium/diagnostics/lsp-logger.d.ts +25 -0
- package/lib/langium/diagnostics/lsp-logger.d.ts.map +1 -1
- package/lib/langium/diagnostics/lsp-logger.js +81 -46
- package/lib/langium/diagnostics/lsp-logger.js.map +1 -1
- package/lib/langium/diagnostics/server-tracer.d.ts.map +1 -1
- package/lib/langium/diagnostics/server-tracer.js.map +1 -1
- package/lib/langium/document-builder/build-pipeline-integration.d.ts +21 -1
- package/lib/langium/document-builder/build-pipeline-integration.d.ts.map +1 -1
- package/lib/langium/document-builder/build-pipeline-integration.js +43 -30
- package/lib/langium/document-builder/build-pipeline-integration.js.map +1 -1
- package/lib/langium/document-builder/build-session.d.ts +6 -5
- package/lib/langium/document-builder/build-session.d.ts.map +1 -1
- package/lib/langium/document-builder/build-session.js +5 -5
- package/lib/langium/document-builder/build-session.js.map +1 -1
- package/lib/langium/document-builder/document-builder.d.ts +355 -39
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
- package/lib/langium/document-builder/document-builder.js +578 -102
- package/lib/langium/document-builder/document-builder.js.map +1 -1
- package/lib/langium/documentation/comment-provider.d.ts.map +1 -1
- package/lib/langium/documentation/comment-provider.js.map +1 -1
- package/lib/langium/integration-services.d.ts +39 -23
- package/lib/langium/integration-services.d.ts.map +1 -1
- package/lib/langium/integration-services.js +7 -4
- package/lib/langium/integration-services.js.map +1 -1
- package/lib/langium/integrity/integrity-rule.d.ts +22 -8
- package/lib/langium/integrity/integrity-rule.d.ts.map +1 -1
- package/lib/langium/integrity/integrity-rule.js.map +1 -1
- package/lib/langium/integrity/integrity-service.d.ts +104 -27
- package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
- package/lib/langium/integrity/integrity-service.js +319 -65
- package/lib/langium/integrity/integrity-service.js.map +1 -1
- package/lib/langium/keys/containment.d.ts +3 -2
- package/lib/langium/keys/containment.d.ts.map +1 -1
- package/lib/langium/keys/containment.js.map +1 -1
- package/lib/langium/keys/name-based-key-provider.d.ts +17 -10
- package/lib/langium/keys/name-based-key-provider.d.ts.map +1 -1
- package/lib/langium/keys/name-based-key-provider.js +24 -12
- package/lib/langium/keys/name-based-key-provider.js.map +1 -1
- package/lib/langium/keys/positional-key-provider.d.ts.map +1 -1
- package/lib/langium/keys/positional-key-provider.js.map +1 -1
- package/lib/langium/labeling/label-provider.d.ts.map +1 -1
- package/lib/langium/labeling/label-provider.js.map +1 -1
- package/lib/langium/language-module.d.ts +30 -5
- package/lib/langium/language-module.d.ts.map +1 -1
- package/lib/langium/language-module.js +21 -5
- package/lib/langium/language-module.js.map +1 -1
- package/lib/langium/model-service/client-session.d.ts +405 -0
- package/lib/langium/model-service/client-session.d.ts.map +1 -0
- package/lib/langium/model-service/client-session.js +479 -0
- package/lib/langium/model-service/client-session.js.map +1 -0
- package/lib/langium/model-service/index.d.ts +2 -0
- package/lib/langium/model-service/index.d.ts.map +1 -1
- package/lib/langium/model-service/index.js +2 -0
- package/lib/langium/model-service/index.js.map +1 -1
- package/lib/langium/model-service/model-events.d.ts +68 -0
- package/lib/langium/model-service/model-events.d.ts.map +1 -0
- package/lib/langium/model-service/model-events.js +10 -0
- package/lib/langium/model-service/model-events.js.map +1 -0
- package/lib/langium/model-service/model-service.d.ts +441 -323
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +602 -397
- package/lib/langium/model-service/model-service.js.map +1 -1
- package/lib/langium/module.d.ts +96 -37
- package/lib/langium/module.d.ts.map +1 -1
- package/lib/langium/module.js +39 -27
- package/lib/langium/module.js.map +1 -1
- package/lib/langium/naming/name-provider.d.ts +32 -7
- package/lib/langium/naming/name-provider.d.ts.map +1 -1
- package/lib/langium/naming/name-provider.js +10 -4
- package/lib/langium/naming/name-provider.js.map +1 -1
- package/lib/langium/naming/name-separator-validation.d.ts.map +1 -1
- package/lib/langium/project/abstract-project-manager.d.ts +184 -13
- package/lib/langium/project/abstract-project-manager.d.ts.map +1 -1
- package/lib/langium/project/abstract-project-manager.js +336 -16
- package/lib/langium/project/abstract-project-manager.js.map +1 -1
- package/lib/langium/project/project-change-event.d.ts +22 -3
- package/lib/langium/project/project-change-event.d.ts.map +1 -1
- package/lib/langium/project/project-manager.d.ts +28 -2
- package/lib/langium/project/project-manager.d.ts.map +1 -1
- package/lib/langium/project/single-project-manager.d.ts +7 -1
- package/lib/langium/project/single-project-manager.d.ts.map +1 -1
- package/lib/langium/project/single-project-manager.js +12 -0
- package/lib/langium/project/single-project-manager.js.map +1 -1
- package/lib/langium/residency/cst-residency-service.d.ts +81 -44
- package/lib/langium/residency/cst-residency-service.d.ts.map +1 -1
- package/lib/langium/residency/cst-residency-service.js +142 -46
- package/lib/langium/residency/cst-residency-service.js.map +1 -1
- package/lib/langium/scope/ast-node-description-provider.d.ts +46 -10
- package/lib/langium/scope/ast-node-description-provider.d.ts.map +1 -1
- package/lib/langium/scope/ast-node-description-provider.js +88 -15
- package/lib/langium/scope/ast-node-description-provider.js.map +1 -1
- package/lib/langium/scope/built-local-symbols.d.ts +12 -0
- package/lib/langium/scope/built-local-symbols.d.ts.map +1 -0
- package/lib/langium/scope/built-local-symbols.js +11 -0
- package/lib/langium/scope/built-local-symbols.js.map +1 -0
- package/lib/langium/scope/fallback-scope.d.ts +27 -0
- package/lib/langium/scope/fallback-scope.d.ts.map +1 -0
- package/lib/langium/scope/fallback-scope.js +35 -0
- package/lib/langium/scope/fallback-scope.js.map +1 -0
- package/lib/langium/scope/hydranium-scope-computation.d.ts +21 -18
- package/lib/langium/scope/hydranium-scope-computation.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-computation.js +38 -39
- package/lib/langium/scope/hydranium-scope-computation.js.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.d.ts +122 -32
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.js +217 -39
- package/lib/langium/scope/hydranium-scope-provider.js.map +1 -1
- package/lib/langium/scope/index.d.ts +1 -0
- package/lib/langium/scope/index.d.ts.map +1 -1
- package/lib/langium/scope/index.js +1 -0
- package/lib/langium/scope/index.js.map +1 -1
- package/lib/langium/scope/reference-builder.d.ts.map +1 -1
- package/lib/langium/scope/reference-builder.js.map +1 -1
- package/lib/langium/scope/reference-candidate-provider.d.ts +6 -5
- package/lib/langium/scope/reference-candidate-provider.d.ts.map +1 -1
- package/lib/langium/scope/reference-candidate-provider.js +3 -2
- package/lib/langium/scope/reference-candidate-provider.js.map +1 -1
- package/lib/langium/scope/scope-extension-service.d.ts +69 -37
- package/lib/langium/scope/scope-extension-service.d.ts.map +1 -1
- package/lib/langium/scope/scope-extension-service.js +102 -29
- package/lib/langium/scope/scope-extension-service.js.map +1 -1
- package/lib/langium/scope/scoped-ast-node-description.d.ts +1 -3
- package/lib/langium/scope/scoped-ast-node-description.d.ts.map +1 -1
- package/lib/langium/scope/scoped-ast-node-description.js +1 -3
- package/lib/langium/scope/scoped-ast-node-description.js.map +1 -1
- package/lib/langium/serialization/abstract-serializer.d.ts +38 -27
- package/lib/langium/serialization/abstract-serializer.d.ts.map +1 -1
- package/lib/langium/serialization/abstract-serializer.js +54 -30
- package/lib/langium/serialization/abstract-serializer.js.map +1 -1
- package/lib/langium/serialization/json-serializer.d.ts +8 -1
- package/lib/langium/serialization/json-serializer.d.ts.map +1 -1
- package/lib/langium/serialization/json-serializer.js +13 -3
- package/lib/langium/serialization/json-serializer.js.map +1 -1
- package/lib/langium/serialization/serializer.d.ts +1 -1
- package/lib/langium/serialization/yaml-serializer.d.ts +12 -0
- package/lib/langium/serialization/yaml-serializer.d.ts.map +1 -1
- package/lib/langium/serialization/yaml-serializer.js +24 -4
- package/lib/langium/serialization/yaml-serializer.js.map +1 -1
- package/lib/langium/service-registry.d.ts +29 -1
- package/lib/langium/service-registry.d.ts.map +1 -1
- package/lib/langium/service-registry.js +37 -0
- package/lib/langium/service-registry.js.map +1 -1
- package/lib/langium/shared-services.d.ts +10 -4
- package/lib/langium/shared-services.d.ts.map +1 -1
- package/lib/langium/shared-services.js.map +1 -1
- package/lib/langium/single-langium-copy.d.ts +22 -0
- package/lib/langium/single-langium-copy.d.ts.map +1 -0
- package/lib/langium/single-langium-copy.js +36 -0
- package/lib/langium/single-langium-copy.js.map +1 -0
- package/lib/langium/transfer/transfer-encoder.d.ts +60 -39
- package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -1
- package/lib/langium/transfer/transfer-encoder.js +35 -24
- package/lib/langium/transfer/transfer-encoder.js.map +1 -1
- package/lib/langium/trivia/comment-preserver.d.ts +543 -0
- package/lib/langium/trivia/comment-preserver.d.ts.map +1 -0
- package/lib/langium/trivia/comment-preserver.js +1165 -0
- package/lib/langium/trivia/comment-preserver.js.map +1 -0
- package/lib/langium/trivia/document-ending-preserver.d.ts +51 -0
- package/lib/langium/trivia/document-ending-preserver.d.ts.map +1 -0
- package/lib/langium/trivia/document-ending-preserver.js +62 -0
- package/lib/langium/trivia/document-ending-preserver.js.map +1 -0
- package/lib/langium/trivia/index.d.ts +14 -0
- package/lib/langium/trivia/index.d.ts.map +1 -0
- package/lib/langium/trivia/index.js +14 -0
- package/lib/langium/trivia/index.js.map +1 -0
- package/lib/langium/trivia/trivia-contribution.d.ts +37 -0
- package/lib/langium/trivia/trivia-contribution.d.ts.map +1 -0
- package/lib/langium/trivia/trivia-contribution.js +10 -0
- package/lib/langium/trivia/trivia-contribution.js.map +1 -0
- package/lib/langium/trivia/trivia-preserver.d.ts +52 -0
- package/lib/langium/trivia/trivia-preserver.d.ts.map +1 -0
- package/lib/langium/trivia/trivia-preserver.js +10 -0
- package/lib/langium/trivia/trivia-preserver.js.map +1 -0
- package/lib/langium/trivia/trivia-service.d.ts +70 -0
- package/lib/langium/trivia/trivia-service.d.ts.map +1 -0
- package/lib/langium/trivia/trivia-service.js +56 -0
- package/lib/langium/trivia/trivia-service.js.map +1 -0
- package/lib/langium/update-rewrite/normalize-empty-strings.d.ts.map +1 -1
- package/lib/langium/update-rewrite/update-rewrite-service.d.ts +1 -1
- package/lib/langium/update-rewrite/update-rewrite-service.d.ts.map +1 -1
- package/lib/langium/update-rewrite/update-rewrite-service.js.map +1 -1
- package/lib/langium/update-rewrite/update-rewrite.d.ts +1 -1
- package/lib/langium/validation/document-validator.d.ts +168 -23
- package/lib/langium/validation/document-validator.d.ts.map +1 -1
- package/lib/langium/validation/document-validator.js +264 -26
- package/lib/langium/validation/document-validator.js.map +1 -1
- package/lib/langium/validation/validation-contribution-collector.d.ts +9 -1
- package/lib/langium/validation/validation-contribution-collector.d.ts.map +1 -1
- package/lib/langium/validation/validation-contribution-collector.js +1 -1
- package/lib/langium/validation/validation-contribution-collector.js.map +1 -1
- package/lib/langium/workspace/ast-node-locator.d.ts +24 -0
- package/lib/langium/workspace/ast-node-locator.d.ts.map +1 -0
- package/lib/langium/workspace/ast-node-locator.js +32 -0
- package/lib/langium/workspace/ast-node-locator.js.map +1 -0
- package/lib/langium/workspace/document-uri-policy.d.ts +24 -15
- package/lib/langium/workspace/document-uri-policy.d.ts.map +1 -1
- package/lib/langium/workspace/document-uri-policy.js +22 -13
- package/lib/langium/workspace/document-uri-policy.js.map +1 -1
- package/lib/langium/workspace/file-not-found.d.ts +23 -0
- package/lib/langium/workspace/file-not-found.d.ts.map +1 -0
- package/lib/langium/workspace/file-not-found.js +31 -0
- package/lib/langium/workspace/file-not-found.js.map +1 -0
- package/lib/langium/workspace/file-system-provider.d.ts +167 -8
- package/lib/langium/workspace/file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/file-system-provider.js +115 -13
- package/lib/langium/workspace/file-system-provider.js.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +35 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.js +77 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.js.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-lock.d.ts +43 -1
- package/lib/langium/workspace/hydranium-workspace-lock.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-lock.js +58 -1
- package/lib/langium/workspace/hydranium-workspace-lock.js.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts +105 -21
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.js +186 -31
- package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts +26 -9
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.js +45 -22
- package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -1
- package/lib/langium/workspace/index-manager.d.ts.map +1 -1
- package/lib/langium/workspace/index-manager.js.map +1 -1
- package/lib/langium/workspace/index.d.ts +3 -0
- package/lib/langium/workspace/index.d.ts.map +1 -1
- package/lib/langium/workspace/index.js +3 -0
- package/lib/langium/workspace/index.js.map +1 -1
- package/lib/langium/workspace/initialize-workspace.d.ts +40 -3
- package/lib/langium/workspace/initialize-workspace.d.ts.map +1 -1
- package/lib/langium/workspace/initialize-workspace.js +68 -3
- package/lib/langium/workspace/initialize-workspace.js.map +1 -1
- package/lib/langium/workspace/langium-documents.d.ts +7 -0
- package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
- package/lib/langium/workspace/langium-documents.js +18 -1
- package/lib/langium/workspace/langium-documents.js.map +1 -1
- package/lib/langium/workspace/persistent-file-system-provider.d.ts +16 -10
- package/lib/langium/workspace/persistent-file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/persistent-file-system-provider.js +25 -13
- package/lib/langium/workspace/persistent-file-system-provider.js.map +1 -1
- package/lib/{documents → langium/workspace}/self-save-registry.d.ts +7 -9
- package/lib/langium/workspace/self-save-registry.d.ts.map +1 -0
- package/lib/{documents → langium/workspace}/self-save-registry.js +9 -11
- package/lib/langium/workspace/self-save-registry.js.map +1 -0
- package/lib/langium/workspace/syntax-errors.d.ts +23 -0
- package/lib/langium/workspace/syntax-errors.d.ts.map +1 -0
- package/lib/langium/workspace/syntax-errors.js +29 -0
- package/lib/langium/workspace/syntax-errors.js.map +1 -0
- package/lib/langium/workspace/virtual-document.d.ts +55 -21
- package/lib/langium/workspace/virtual-document.d.ts.map +1 -1
- package/lib/langium/workspace/virtual-document.js +87 -24
- package/lib/langium/workspace/virtual-document.js.map +1 -1
- package/lib/langium/workspace/write-lock-scope.d.ts +22 -10
- package/lib/langium/workspace/write-lock-scope.d.ts.map +1 -1
- package/lib/langium/workspace/write-lock-scope.js +15 -5
- package/lib/langium/workspace/write-lock-scope.js.map +1 -1
- package/lib/launcher/integrated-server.d.ts +3 -1
- package/lib/launcher/integrated-server.d.ts.map +1 -1
- package/lib/locale/server-locale.d.ts +6 -6
- package/lib/locale/server-locale.d.ts.map +1 -1
- package/lib/locale/server-locale.js.map +1 -1
- package/lib/lsp/completion/hydranium-completion-provider.d.ts +44 -2
- package/lib/lsp/completion/hydranium-completion-provider.d.ts.map +1 -1
- package/lib/lsp/completion/hydranium-completion-provider.js +68 -0
- package/lib/lsp/completion/hydranium-completion-provider.js.map +1 -1
- package/lib/lsp/connection-features.d.ts +23 -0
- package/lib/lsp/connection-features.d.ts.map +1 -0
- package/lib/lsp/connection-features.js +60 -0
- package/lib/lsp/connection-features.js.map +1 -0
- package/lib/lsp/diagnostics-connection.d.ts +27 -0
- package/lib/lsp/diagnostics-connection.d.ts.map +1 -0
- package/lib/lsp/diagnostics-connection.js +53 -0
- package/lib/lsp/diagnostics-connection.js.map +1 -0
- package/lib/lsp/edit-requests-guard.d.ts +31 -0
- package/lib/lsp/edit-requests-guard.d.ts.map +1 -0
- package/lib/lsp/edit-requests-guard.js +125 -0
- package/lib/lsp/edit-requests-guard.js.map +1 -0
- package/lib/lsp/hydranium-document-update-handler.d.ts +126 -82
- package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
- package/lib/lsp/hydranium-document-update-handler.js +234 -101
- package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
- package/lib/lsp/index.d.ts +6 -2
- package/lib/lsp/index.d.ts.map +1 -1
- package/lib/lsp/index.js +6 -2
- package/lib/lsp/index.js.map +1 -1
- package/lib/lsp/lsp-latency.d.ts +39 -0
- package/lib/lsp/lsp-latency.d.ts.map +1 -0
- package/lib/lsp/lsp-latency.js +58 -0
- package/lib/lsp/lsp-latency.js.map +1 -0
- package/lib/lsp/save-text-document.d.ts +31 -0
- package/lib/lsp/save-text-document.d.ts.map +1 -0
- package/lib/lsp/save-text-document.js +52 -0
- package/lib/lsp/save-text-document.js.map +1 -0
- package/lib/lsp/semantic-token-provider.d.ts +58 -2
- package/lib/lsp/semantic-token-provider.d.ts.map +1 -1
- package/lib/lsp/semantic-token-provider.js +98 -9
- package/lib/lsp/semantic-token-provider.js.map +1 -1
- package/lib/lsp/shared-module.d.ts +4 -8
- package/lib/lsp/shared-module.d.ts.map +1 -1
- package/lib/lsp/shared-module.js.map +1 -1
- package/lib/lsp/start-language-server.d.ts +12 -7
- package/lib/lsp/start-language-server.d.ts.map +1 -1
- package/lib/lsp/start-language-server.js +21 -7
- package/lib/lsp/start-language-server.js.map +1 -1
- package/lib/messages/carriers.d.ts +4 -6
- package/lib/messages/carriers.d.ts.map +1 -1
- package/lib/messages/carriers.js +4 -6
- package/lib/messages/carriers.js.map +1 -1
- package/lib/messages/index.d.ts +2 -2
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +2 -2
- package/lib/messages/index.js.map +1 -1
- package/lib/messages/renderer.d.ts +10 -4
- package/lib/messages/renderer.d.ts.map +1 -1
- package/lib/messages/renderer.js +6 -0
- package/lib/messages/renderer.js.map +1 -1
- package/lib/node/event-loop-monitor.d.ts.map +1 -1
- package/lib/node/event-loop-monitor.js +2 -1
- package/lib/node/event-loop-monitor.js.map +1 -1
- package/lib/node/heap-ceiling.d.ts +61 -0
- package/lib/node/heap-ceiling.d.ts.map +1 -0
- package/lib/node/heap-ceiling.js +72 -0
- package/lib/node/heap-ceiling.js.map +1 -0
- package/lib/node/index.d.ts +1 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +5 -1
- package/lib/node/index.js.map +1 -1
- package/lib/node/latency-from-env.d.ts +1 -1
- package/lib/node/latency-from-env.js +1 -1
- package/lib/node/lint-grammar.js.map +1 -1
- package/lib/node/log-file-sink.d.ts +3 -2
- package/lib/node/log-file-sink.d.ts.map +1 -1
- package/lib/node/log-file-sink.js +6 -2
- package/lib/node/log-file-sink.js.map +1 -1
- package/lib/node/log-preamble-node.d.ts +5 -3
- package/lib/node/log-preamble-node.d.ts.map +1 -1
- package/lib/node/log-preamble-node.js +13 -10
- package/lib/node/log-preamble-node.js.map +1 -1
- package/lib/node/measure-memory.d.ts.map +1 -1
- package/lib/node/measure-memory.js +5 -4
- package/lib/node/measure-memory.js.map +1 -1
- package/lib/node/memory-monitor.d.ts +2 -2
- package/lib/node/memory-monitor.d.ts.map +1 -1
- package/lib/node/memory-monitor.js +9 -10
- package/lib/node/memory-monitor.js.map +1 -1
- package/lib/node/node-file-system-provider.d.ts +67 -9
- package/lib/node/node-file-system-provider.d.ts.map +1 -1
- package/lib/node/node-file-system-provider.js +198 -53
- package/lib/node/node-file-system-provider.js.map +1 -1
- package/lib/node/profile-capture.d.ts +12 -4
- package/lib/node/profile-capture.d.ts.map +1 -1
- package/lib/node/profile-capture.js +8 -6
- package/lib/node/profile-capture.js.map +1 -1
- package/lib/node/profile-digest.js.map +1 -1
- package/lib/node/profiling-run.d.ts +13 -3
- package/lib/node/profiling-run.d.ts.map +1 -1
- package/lib/node/profiling-run.js +17 -8
- package/lib/node/profiling-run.js.map +1 -1
- package/lib/node/rename-over-open-readers.d.ts +61 -0
- package/lib/node/rename-over-open-readers.d.ts.map +1 -0
- package/lib/node/rename-over-open-readers.js +80 -0
- package/lib/node/rename-over-open-readers.js.map +1 -0
- package/lib/node/server-diagnostics.js +1 -1
- package/lib/node/server-diagnostics.js.map +1 -1
- package/lib/node/server-state-snapshot.d.ts +1 -2
- package/lib/node/server-state-snapshot.d.ts.map +1 -1
- package/lib/node/server-state-snapshot.js +4 -4
- package/lib/node/server-state-snapshot.js.map +1 -1
- package/lib/node/socket-launcher.d.ts +43 -7
- package/lib/node/socket-launcher.d.ts.map +1 -1
- package/lib/node/socket-launcher.js +42 -7
- package/lib/node/socket-launcher.js.map +1 -1
- package/lib/node/startup-cpu-profile.d.ts +29 -0
- package/lib/node/startup-cpu-profile.d.ts.map +1 -0
- package/lib/node/startup-cpu-profile.js +91 -0
- package/lib/node/startup-cpu-profile.js.map +1 -0
- package/lib/node/stdio-launcher.d.ts +13 -13
- package/lib/node/stdio-launcher.d.ts.map +1 -1
- package/lib/node/stdio-launcher.js +21 -11
- package/lib/node/stdio-launcher.js.map +1 -1
- package/lib/node/validate-workspace.d.ts +1 -1
- package/lib/node/validate-workspace.d.ts.map +1 -1
- package/lib/node/validate-workspace.js +5 -1
- package/lib/node/validate-workspace.js.map +1 -1
- package/lib/testing/document-uri-policy-conformance.js +1 -1
- package/lib/testing/document-uri-policy-conformance.js.map +1 -1
- package/lib/testing/fake-description.js.map +1 -1
- package/lib/testing/fake-document.d.ts +2 -1
- package/lib/testing/fake-document.d.ts.map +1 -1
- package/lib/testing/fake-document.js.map +1 -1
- package/lib/testing/index.d.ts +1 -1
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js +2 -1
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/langium-test-helpers.d.ts.map +1 -1
- package/lib/testing/langium-test-helpers.js +1 -0
- package/lib/testing/langium-test-helpers.js.map +1 -1
- package/lib/testing/make-noop-language-services.js.map +1 -1
- package/lib/testing/make-noop-shared-services.js.map +1 -1
- package/lib/testing/make-test-services.d.ts +45 -14
- package/lib/testing/make-test-services.d.ts.map +1 -1
- package/lib/testing/make-test-services.js +23 -7
- package/lib/testing/make-test-services.js.map +1 -1
- package/lib/testing/make-test-tracer.d.ts +12 -0
- package/lib/testing/make-test-tracer.d.ts.map +1 -1
- package/lib/testing/make-test-tracer.js +13 -0
- package/lib/testing/make-test-tracer.js.map +1 -1
- package/lib/testing/node/applied-edit-capture.d.ts +29 -0
- package/lib/testing/node/applied-edit-capture.d.ts.map +1 -0
- package/lib/testing/node/applied-edit-capture.js +117 -0
- package/lib/testing/node/applied-edit-capture.js.map +1 -0
- package/lib/testing/node/golden-corpus.js.map +1 -1
- package/lib/testing/node/index.d.ts +1 -0
- package/lib/testing/node/index.d.ts.map +1 -1
- package/lib/testing/node/index.js +1 -0
- package/lib/testing/node/index.js.map +1 -1
- package/lib/testing/node/lsp-harness.d.ts.map +1 -1
- package/lib/testing/node/lsp-harness.js +2 -0
- package/lib/testing/node/lsp-harness.js.map +1 -1
- package/lib/testing/node/lsp-server-connection.d.ts +21 -6
- package/lib/testing/node/lsp-server-connection.d.ts.map +1 -1
- package/lib/testing/node/lsp-server-connection.js +49 -106
- package/lib/testing/node/lsp-server-connection.js.map +1 -1
- package/lib/testing/node/scratch-workspace.d.ts.map +1 -1
- package/lib/testing/node/scratch-workspace.js +10 -5
- package/lib/testing/node/scratch-workspace.js.map +1 -1
- package/lib/testing/node/spawned-server.d.ts +30 -1
- package/lib/testing/node/spawned-server.d.ts.map +1 -1
- package/lib/testing/node/spawned-server.js +39 -2
- package/lib/testing/node/spawned-server.js.map +1 -1
- package/lib/testing/node/unhandled-rejections.d.ts +20 -0
- package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
- package/lib/testing/node/unhandled-rejections.js +32 -0
- package/lib/testing/node/unhandled-rejections.js.map +1 -0
- package/lib/testing/playwright/browser-capture-bridge.js.map +1 -1
- package/lib/testing/playwright/e2e-profiling.js.map +1 -1
- package/lib/testing/playwright/flaky-network-proxy.d.ts +76 -0
- package/lib/testing/playwright/flaky-network-proxy.d.ts.map +1 -0
- package/lib/testing/playwright/flaky-network-proxy.js +164 -0
- package/lib/testing/playwright/flaky-network-proxy.js.map +1 -0
- package/lib/testing/playwright/index.d.ts +1 -0
- package/lib/testing/playwright/index.d.ts.map +1 -1
- package/lib/testing/playwright/index.js +1 -0
- package/lib/testing/playwright/index.js.map +1 -1
- package/lib/testing/playwright/server-log-capture.d.ts +46 -16
- package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-capture.js +111 -40
- package/lib/testing/playwright/server-log-capture.js.map +1 -1
- package/lib/testing/playwright/server-log-fixture.d.ts +16 -0
- package/lib/testing/playwright/server-log-fixture.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-fixture.js +25 -6
- package/lib/testing/playwright/server-log-fixture.js.map +1 -1
- package/lib/testing/playwright/server-log-region.d.ts +15 -0
- package/lib/testing/playwright/server-log-region.d.ts.map +1 -0
- package/lib/testing/playwright/server-log-region.js +30 -0
- package/lib/testing/playwright/server-log-region.js.map +1 -0
- package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-rename-reporter.js +4 -3
- package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -1
- package/lib/testing/run-update-pipeline.d.ts +8 -5
- package/lib/testing/run-update-pipeline.d.ts.map +1 -1
- package/lib/testing/run-update-pipeline.js.map +1 -1
- package/lib/testing/stub-ast-document-manager.d.ts +11 -51
- package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
- package/lib/testing/stub-ast-document-manager.js +31 -59
- package/lib/testing/stub-ast-document-manager.js.map +1 -1
- package/lib/testing/stub-document-builder.d.ts +33 -11
- package/lib/testing/stub-document-builder.d.ts.map +1 -1
- package/lib/testing/stub-document-builder.js +110 -5
- package/lib/testing/stub-document-builder.js.map +1 -1
- package/lib/testing/stub-hydranium-text-documents.d.ts +33 -10
- package/lib/testing/stub-hydranium-text-documents.d.ts.map +1 -1
- package/lib/testing/stub-hydranium-text-documents.js +132 -16
- package/lib/testing/stub-hydranium-text-documents.js.map +1 -1
- package/lib/testing/stub-index-manager.js.map +1 -1
- package/lib/testing/stub-langium-documents.d.ts +3 -2
- package/lib/testing/stub-langium-documents.d.ts.map +1 -1
- package/lib/testing/stub-langium-documents.js.map +1 -1
- package/lib/testing/stub-model-service.d.ts +8 -7
- package/lib/testing/stub-model-service.d.ts.map +1 -1
- package/lib/testing/stub-model-service.js +4 -4
- package/lib/testing/stub-model-service.js.map +1 -1
- package/lib/testing/stub-project-manager.d.ts.map +1 -1
- package/lib/testing/stub-project-manager.js +10 -0
- package/lib/testing/stub-project-manager.js.map +1 -1
- package/lib/testing/stub-self-save-registry.d.ts +1 -1
- package/lib/testing/stub-self-save-registry.d.ts.map +1 -1
- package/lib/testing/stub-service-registry.d.ts +1 -1
- package/lib/testing/stub-service-registry.js.map +1 -1
- package/lib/testing/stub-writable-file-system.d.ts +1 -1
- package/lib/testing/stub-writable-file-system.d.ts.map +1 -1
- package/lib/testing/stub-writable-file-system.js +2 -1
- package/lib/testing/stub-writable-file-system.js.map +1 -1
- package/lib/util/connection-liveness.d.ts +22 -6
- package/lib/util/connection-liveness.d.ts.map +1 -1
- package/lib/util/connection-liveness.js +75 -15
- package/lib/util/connection-liveness.js.map +1 -1
- package/lib/util/environment.d.ts +7 -0
- package/lib/util/environment.d.ts.map +1 -1
- package/lib/util/environment.js +15 -1
- package/lib/util/environment.js.map +1 -1
- package/lib/util/registry.d.ts.map +1 -1
- package/package.json +41 -60
- package/src/browser/host-heads-in-worker.ts +218 -0
- package/src/browser/index.ts +17 -0
- package/src/browser/indexeddb-file-system-store.ts +192 -0
- package/src/browser/start-language-server-in-worker.ts +56 -0
- package/src/documents/ast-document-manager.ts +477 -249
- package/src/documents/client-ids.ts +5 -22
- package/src/documents/client-session-errors.ts +26 -0
- package/src/documents/client-session-registry.ts +262 -0
- package/src/documents/dirty-state-tracker.ts +167 -0
- package/src/documents/document-release-handler.ts +404 -0
- package/src/documents/document-release-scheduler.ts +121 -0
- package/src/documents/file-system-task-queue.ts +74 -0
- package/src/documents/hydranium-text-documents.ts +1029 -616
- package/src/documents/index.ts +10 -2
- package/src/documents/language-client-shadow.ts +501 -0
- package/src/documents/model-ledger.ts +66 -0
- package/src/documents/text-ledger.ts +112 -0
- package/src/documents/version-sync-service.ts +289 -0
- package/src/index.ts +3 -0
- package/src/langium/ast-extension/ast-extension-service.ts +77 -41
- package/src/langium/ast-extension/ast-node-builder.ts +35 -13
- package/src/langium/bootstrap.ts +79 -43
- package/src/langium/build-phase-pass/build-phase-pass-service.ts +29 -19
- package/src/langium/build-phase-pass/build-phase-pass.ts +37 -8
- package/src/langium/composite-ast-reflection.ts +112 -0
- package/src/langium/config/configuration-provider.ts +119 -0
- package/src/langium/config/index.ts +1 -0
- package/src/langium/diagnostics/console-tee.ts +150 -0
- package/src/langium/diagnostics/hydranium-langium-profiler.ts +15 -39
- package/src/langium/diagnostics/log-preamble.ts +1 -1
- package/src/langium/diagnostics/logger.ts +51 -17
- package/src/langium/diagnostics/lsp-logger.ts +83 -45
- package/src/langium/document-builder/build-pipeline-integration.ts +57 -32
- package/src/langium/document-builder/build-session.ts +4 -3
- package/src/langium/document-builder/document-builder.ts +709 -105
- package/src/langium/integration-services.ts +58 -27
- package/src/langium/integrity/integrity-rule.ts +22 -8
- package/src/langium/integrity/integrity-service.ts +348 -71
- package/src/langium/keys/containment.ts +3 -2
- package/src/langium/keys/name-based-key-provider.ts +24 -12
- package/src/langium/language-module.ts +52 -9
- package/src/langium/model-service/client-session.ts +769 -0
- package/src/langium/model-service/index.ts +2 -0
- package/src/langium/model-service/model-events.ts +82 -0
- package/src/langium/model-service/model-service.ts +885 -522
- package/src/langium/module.ts +139 -63
- package/src/langium/naming/name-provider.ts +34 -8
- package/src/langium/project/abstract-project-manager.ts +409 -20
- package/src/langium/project/project-change-event.ts +25 -3
- package/src/langium/project/project-manager.ts +31 -2
- package/src/langium/project/single-project-manager.ts +16 -1
- package/src/langium/residency/cst-residency-service.ts +197 -73
- package/src/langium/scope/ast-node-description-provider.ts +111 -16
- package/src/langium/scope/built-local-symbols.ts +13 -0
- package/src/langium/scope/fallback-scope.ts +38 -0
- package/src/langium/scope/hydranium-scope-computation.ts +45 -44
- package/src/langium/scope/hydranium-scope-provider.ts +245 -41
- package/src/langium/scope/index.ts +1 -0
- package/src/langium/scope/reference-candidate-provider.ts +6 -5
- package/src/langium/scope/scope-extension-service.ts +148 -56
- package/src/langium/scope/scoped-ast-node-description.ts +1 -3
- package/src/langium/serialization/abstract-serializer.ts +57 -41
- package/src/langium/serialization/json-serializer.ts +14 -3
- package/src/langium/serialization/serializer.ts +1 -1
- package/src/langium/serialization/yaml-serializer.ts +26 -4
- package/src/langium/service-registry.ts +41 -2
- package/src/langium/shared-services.ts +13 -4
- package/src/langium/single-langium-copy.ts +42 -0
- package/src/langium/transfer/transfer-encoder.ts +76 -50
- package/src/langium/trivia/comment-preserver.ts +1410 -0
- package/src/langium/trivia/document-ending-preserver.ts +71 -0
- package/src/langium/trivia/index.ts +14 -0
- package/src/langium/trivia/trivia-contribution.ts +39 -0
- package/src/langium/trivia/trivia-preserver.ts +56 -0
- package/src/langium/trivia/trivia-service.ts +99 -0
- package/src/langium/update-rewrite/update-rewrite-service.ts +1 -1
- package/src/langium/update-rewrite/update-rewrite.ts +1 -1
- package/src/langium/validation/document-validator.ts +312 -31
- package/src/langium/validation/validation-contribution-collector.ts +10 -1
- package/src/langium/workspace/ast-node-locator.ts +33 -0
- package/src/langium/workspace/document-uri-policy.ts +32 -18
- package/src/langium/workspace/file-not-found.ts +35 -0
- package/src/langium/workspace/file-system-provider.ts +258 -16
- package/src/langium/workspace/hydranium-langium-document-factory.ts +107 -0
- package/src/langium/workspace/hydranium-workspace-lock.ts +86 -2
- package/src/langium/workspace/hydranium-workspace-manager.ts +214 -35
- package/src/langium/workspace/in-memory-file-system-provider.ts +54 -23
- package/src/langium/workspace/index.ts +3 -0
- package/src/langium/workspace/initialize-workspace.ts +96 -4
- package/src/langium/workspace/langium-documents.ts +19 -1
- package/src/langium/workspace/persistent-file-system-provider.ts +27 -15
- package/src/{documents → langium/workspace}/self-save-registry.ts +12 -14
- package/src/langium/workspace/syntax-errors.ts +34 -0
- package/src/langium/workspace/virtual-document.ts +106 -25
- package/src/langium/workspace/write-lock-scope.ts +27 -12
- package/src/launcher/integrated-server.ts +3 -1
- package/src/locale/server-locale.ts +6 -6
- package/src/lsp/completion/hydranium-completion-provider.ts +82 -2
- package/src/lsp/connection-features.ts +67 -0
- package/src/lsp/diagnostics-connection.ts +56 -0
- package/src/lsp/edit-requests-guard.ts +152 -0
- package/src/lsp/hydranium-document-update-handler.ts +284 -110
- package/src/lsp/index.ts +6 -2
- package/src/lsp/lsp-latency.ts +62 -0
- package/src/lsp/save-text-document.ts +63 -0
- package/src/lsp/semantic-token-provider.ts +146 -8
- package/src/lsp/shared-module.ts +4 -8
- package/src/lsp/start-language-server.ts +21 -7
- package/src/messages/carriers.ts +4 -6
- package/src/messages/index.ts +11 -2
- package/src/messages/renderer.ts +11 -3
- package/src/node/event-loop-monitor.ts +2 -1
- package/src/node/heap-ceiling.ts +108 -0
- package/src/node/index.ts +5 -1
- package/src/node/latency-from-env.ts +1 -1
- package/src/node/log-file-sink.ts +6 -2
- package/src/node/log-preamble-node.ts +20 -10
- package/src/node/measure-memory.ts +5 -4
- package/src/node/memory-monitor.ts +10 -10
- package/src/node/node-file-system-provider.ts +214 -57
- package/src/node/profile-capture.ts +16 -15
- package/src/node/profiling-run.ts +30 -8
- package/src/node/rename-over-open-readers.ts +94 -0
- package/src/node/server-diagnostics.ts +1 -1
- package/src/node/server-state-snapshot.ts +6 -7
- package/src/node/socket-launcher.ts +78 -14
- package/src/node/startup-cpu-profile.ts +94 -0
- package/src/node/stdio-launcher.ts +29 -19
- package/src/node/validate-workspace.ts +8 -2
- package/src/testing/document-uri-policy-conformance.ts +1 -1
- package/src/testing/fake-document.ts +2 -1
- package/src/testing/index.ts +2 -1
- package/src/testing/langium-test-helpers.ts +1 -0
- package/src/testing/make-test-services.ts +83 -31
- package/src/testing/make-test-tracer.ts +26 -0
- package/src/testing/node/applied-edit-capture.ts +141 -0
- package/src/testing/node/index.ts +1 -0
- package/src/testing/node/lsp-harness.ts +2 -0
- package/src/testing/node/lsp-server-connection.ts +83 -119
- package/src/testing/node/scratch-workspace.ts +10 -5
- package/src/testing/node/spawned-server.ts +57 -3
- package/src/testing/node/unhandled-rejections.ts +31 -0
- package/src/testing/parse-semantic-root.ts +1 -1
- package/src/testing/playwright/flaky-network-proxy.ts +240 -0
- package/src/testing/playwright/index.ts +1 -0
- package/src/testing/playwright/server-log-capture.ts +137 -47
- package/src/testing/playwright/server-log-fixture.ts +46 -6
- package/src/testing/playwright/server-log-region.ts +32 -0
- package/src/testing/playwright/server-log-rename-reporter.ts +4 -3
- package/src/testing/run-update-pipeline.ts +8 -5
- package/src/testing/stub-ast-document-manager.ts +47 -123
- package/src/testing/stub-document-builder.ts +155 -18
- package/src/testing/stub-hydranium-text-documents.ts +184 -27
- package/src/testing/stub-langium-documents.ts +3 -2
- package/src/testing/stub-model-service.ts +9 -8
- package/src/testing/stub-project-manager.ts +10 -0
- package/src/testing/stub-self-save-registry.ts +1 -1
- package/src/testing/stub-service-registry.ts +1 -1
- package/src/testing/stub-writable-file-system.ts +3 -2
- package/src/util/connection-liveness.ts +81 -15
- package/src/util/environment.ts +24 -2
- package/lib/documents/language-client-text-shadow.d.ts +0 -124
- package/lib/documents/language-client-text-shadow.d.ts.map +0 -1
- package/lib/documents/language-client-text-shadow.js +0 -190
- package/lib/documents/language-client-text-shadow.js.map +0 -1
- package/lib/documents/self-save-registry.d.ts.map +0 -1
- package/lib/documents/self-save-registry.js.map +0 -1
- package/lib/lsp/instrument-connection.d.ts +0 -36
- package/lib/lsp/instrument-connection.d.ts.map +0 -1
- package/lib/lsp/instrument-connection.js +0 -62
- package/lib/lsp/instrument-connection.js.map +0 -1
- package/lib/node/process-memory.d.ts +0 -66
- package/lib/node/process-memory.d.ts.map +0 -1
- package/lib/node/process-memory.js +0 -252
- package/lib/node/process-memory.js.map +0 -1
- package/src/documents/language-client-text-shadow.ts +0 -211
- package/src/lsp/instrument-connection.ts +0 -66
- package/src/node/process-memory.ts +0 -299
|
@@ -102,9 +102,9 @@ export interface ResolvedCandidate {
|
|
|
102
102
|
export interface ReferenceCandidateProvider {
|
|
103
103
|
/**
|
|
104
104
|
* UI-facing entry point: returns the candidate scope's elements as
|
|
105
|
-
* {@link ReferenceCandidate}s.
|
|
105
|
+
* {@link ReferenceCandidate}s. Accepts what {@link getCandidateScope} does.
|
|
106
106
|
*/
|
|
107
|
-
find(ctx: ReferenceContext): ReferenceCandidate[];
|
|
107
|
+
find(ctx: ReferenceContext | ReferenceInfo): ReferenceCandidate[];
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Build a ranked + deduped scope for candidate selection at the
|
|
@@ -195,14 +195,15 @@ export class DefaultReferenceCandidateProvider implements ReferenceCandidateProv
|
|
|
195
195
|
* and never matches: a self-reference filter silently stops excluding, and
|
|
196
196
|
* the element offers itself as its own target.
|
|
197
197
|
*
|
|
198
|
-
* The mirror of `
|
|
199
|
-
* reasoning: an unroutable target has no better answer than the
|
|
198
|
+
* The mirror of `DefaultReferenceBuilder.nameProviderFor`, and the same
|
|
199
|
+
* fallback reasoning: an unroutable target has no better answer than the
|
|
200
|
+
* source's.
|
|
200
201
|
*/
|
|
201
202
|
protected nameProviderFor(target: AstNode): NameProvider {
|
|
202
203
|
return this.services.shared.ServiceRegistry?.getServicesFor(target)?.references.NameProvider ?? this.nameProvider;
|
|
203
204
|
}
|
|
204
205
|
|
|
205
|
-
find(ctx: ReferenceContext): ReferenceCandidate[] {
|
|
206
|
+
find(ctx: ReferenceContext | ReferenceInfo): ReferenceCandidate[] {
|
|
206
207
|
const scope = this.getCandidateScope(ctx);
|
|
207
208
|
return scope.elementScope
|
|
208
209
|
.getAllElements()
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
|
-
import { type AstNode, AstUtils,
|
|
10
|
+
import { type AstNode, AstUtils, DocumentCache, DocumentState, type LangiumDocument } from '@hydranium/langium';
|
|
11
11
|
import { type Disposable } from 'vscode-languageserver';
|
|
12
|
-
import { type Tracer } from '@hydranium/protocol';
|
|
12
|
+
import { Format, Logger, type ProfileRecord, type ProfileSession, type Tracer } from '@hydranium/protocol';
|
|
13
13
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
14
14
|
import { type ServerLanguageServices } from '../language-module.js';
|
|
15
15
|
import { Registry, type RegistryItem } from '../../util/registry.js';
|
|
@@ -49,8 +49,7 @@ export interface ScopeDescriptionAcceptor {
|
|
|
49
49
|
* descriptions are constructed ahead of time, to avoid per-query
|
|
50
50
|
* allocation. The pushed description's `tier` must be `'local'` or
|
|
51
51
|
* `'universal'`; a description of any other tier is silently dropped,
|
|
52
|
-
* because
|
|
53
|
-
* the tier they were asked for.
|
|
52
|
+
* because {@link ScopeExtensionDescriptions} holds only those two.
|
|
54
53
|
*/
|
|
55
54
|
push(description: TieredAstNodeDescription): void;
|
|
56
55
|
}
|
|
@@ -85,40 +84,51 @@ export interface ScopeExtension extends RegistryItem {
|
|
|
85
84
|
* build the data up-front and hand a sync acceptor here.
|
|
86
85
|
*/
|
|
87
86
|
addDescriptions(context: AstNode, referenceType: string, document: LangiumDocument, accept: ScopeDescriptionAcceptor): void;
|
|
87
|
+
/**
|
|
88
|
+
* The node the descriptions for `context` belong to, so that while the
|
|
89
|
+
* referencing document is being linked, they, and the scope made of them,
|
|
90
|
+
* are built once per node rather than once per reference: a reference with
|
|
91
|
+
* the same node is answered with the first one's descriptions. Without it, for
|
|
92
|
+
* `undefined`, outside a link, such as a completion request, or for a
|
|
93
|
+
* `context` outside a built document, such as an operation's copy,
|
|
94
|
+
* {@link addDescriptions} runs for every reference.
|
|
95
|
+
*
|
|
96
|
+
* The descriptions must depend on the node and `referenceType` alone. What
|
|
97
|
+
* they read through the node may come from another document: each link
|
|
98
|
+
* builds them afresh. A change made during one link, in place, is not seen
|
|
99
|
+
* until the next.
|
|
100
|
+
*/
|
|
101
|
+
cacheKey?(context: AstNode, referenceType: string): AstNode | undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** One scope extension's descriptions for a reference, split by tier. */
|
|
105
|
+
export interface ScopeExtensionDescriptions {
|
|
106
|
+
readonly local: readonly TieredAstNodeDescription[];
|
|
107
|
+
readonly universal: readonly TieredAstNodeDescription[];
|
|
88
108
|
}
|
|
89
109
|
|
|
90
110
|
/**
|
|
91
111
|
* Public contract for the per-language scope-extension service. Extends
|
|
92
112
|
* the {@link ScopeExtensionRegistry} (the imperative `register` surface
|
|
93
|
-
* contributions use) with the
|
|
94
|
-
*
|
|
95
|
-
* `layerUniversalExtension` helpers, which layer scope-extension
|
|
96
|
-
* contributions around the cached project chain.
|
|
97
|
-
*
|
|
98
|
-
* Adopter overrides go through {@link DefaultScopeExtensionService}; the
|
|
99
|
-
* interface keeps the public API stable while internals
|
|
100
|
-
* (`collectExtensionDescriptions` walk) stay `protected` on the default
|
|
101
|
-
* class.
|
|
113
|
+
* contributions use) with the query `HydraniumScopeProvider` builds its
|
|
114
|
+
* extension tiers from.
|
|
102
115
|
*/
|
|
103
116
|
export interface ScopeExtensionService extends ScopeExtensionRegistry {
|
|
104
117
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Layer this language's `universal`-tier scope-extension descriptions
|
|
113
|
-
* BELOW `outerScope` for the given reference type. Returns `outerScope`
|
|
114
|
-
* unchanged when no extension contributes a `universal`-tier
|
|
115
|
-
* description for the type.
|
|
118
|
+
* The descriptions of each extension registered for `referenceType` that
|
|
119
|
+
* contributes to `context`, in registration order. An extension's entry is
|
|
120
|
+
* the same object for every reference of one {@link ScopeExtension.cacheKey},
|
|
121
|
+
* so a caller can key what it builds of it by identity. A caller that needs
|
|
122
|
+
* both tiers takes them from one call: a call per tier runs every extension
|
|
123
|
+
* twice.
|
|
116
124
|
*/
|
|
117
|
-
|
|
125
|
+
getDescriptions(referenceType: string, context: AstNode): readonly ScopeExtensionDescriptions[];
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
export type ScopeExtensionServiceOptions = LogNameOptions;
|
|
121
129
|
|
|
130
|
+
const NO_DESCRIPTIONS: readonly ScopeExtensionDescriptions[] = [];
|
|
131
|
+
|
|
122
132
|
/**
|
|
123
133
|
* Default {@link ScopeExtensionService} implementation. Per-language
|
|
124
134
|
* registry for dynamic scope contributions: extra resolvable descriptions
|
|
@@ -128,13 +138,26 @@ export type ScopeExtensionServiceOptions = LogNameOptions;
|
|
|
128
138
|
* separate from the query-time scope-resolution concern (which only reads).
|
|
129
139
|
*
|
|
130
140
|
* Lives in the per-language `references` group alongside `ScopeProvider`,
|
|
131
|
-
* which consumes
|
|
132
|
-
* / {@link getUniversalExtensionScope}). Designed as a base class; adopters
|
|
141
|
+
* which consumes {@link getDescriptions}. Designed as a base class; adopters
|
|
133
142
|
* extend it and call `register` in their constructor.
|
|
143
|
+
*
|
|
144
|
+
* At `debug`, each extension's calls and self-time go into one profile
|
|
145
|
+
* session, reported when a build starts and when it ends. A report thus
|
|
146
|
+
* covers one build, validation included, or the calls made between two
|
|
147
|
+
* builds, such as a reference picker's.
|
|
134
148
|
*/
|
|
135
149
|
export class DefaultScopeExtensionService implements ScopeExtensionService {
|
|
136
150
|
protected readonly scopeExtensions = new Registry<ScopeExtension>();
|
|
137
151
|
protected readonly tracer: Tracer;
|
|
152
|
+
/** Open from the first profiled call until {@link reportProfile}. */
|
|
153
|
+
protected profileSession?: ProfileSession;
|
|
154
|
+
/**
|
|
155
|
+
* Per referencing document, key node, extension and reference type, the
|
|
156
|
+
* descriptions answered during that document's link, dropped when it ends,
|
|
157
|
+
* when a build starts and right before its link. Absent without a document
|
|
158
|
+
* builder, which leaves every extension uncached.
|
|
159
|
+
*/
|
|
160
|
+
protected readonly kept?: DocumentCache<AstNode, Map<ScopeExtension, Map<string, ScopeExtensionDescriptions>>>;
|
|
138
161
|
|
|
139
162
|
constructor(
|
|
140
163
|
protected readonly services: ServerLanguageServices,
|
|
@@ -150,6 +173,16 @@ export class DefaultScopeExtensionService implements ScopeExtensionService {
|
|
|
150
173
|
for (const contribution of Object.values(contributions)) {
|
|
151
174
|
contribution.registerScopeExtensions(this);
|
|
152
175
|
}
|
|
176
|
+
// Optional for the same reason: a stub tree may carry no builder.
|
|
177
|
+
const builder = services.shared.workspace.DocumentBuilder;
|
|
178
|
+
builder?.onUpdate(() => this.reportProfile());
|
|
179
|
+
builder?.onBuildEnded(() => this.reportProfile());
|
|
180
|
+
// Dropped once the document is linked, and all of it when a build starts and
|
|
181
|
+
// again right before its link, so neither a lookup made after the build starts
|
|
182
|
+
// nor a link a cancelled build left unfinished answers this link.
|
|
183
|
+
this.kept = builder ? new DocumentCache(services.shared, DocumentState.Linked) : undefined;
|
|
184
|
+
builder?.onUpdate(() => this.kept?.clear());
|
|
185
|
+
builder?.onBuildPhase(DocumentState.ComputedScopes, () => this.kept?.clear());
|
|
153
186
|
}
|
|
154
187
|
|
|
155
188
|
/**
|
|
@@ -162,46 +195,105 @@ export class DefaultScopeExtensionService implements ScopeExtensionService {
|
|
|
162
195
|
return this.scopeExtensions.register(extension);
|
|
163
196
|
}
|
|
164
197
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Holds the profile wrap, which an override would have to copy; to change
|
|
200
|
+
* which extensions run, override {@link extensionsFor}.
|
|
201
|
+
*/
|
|
202
|
+
getDescriptions(referenceType: string, context: AstNode): readonly ScopeExtensionDescriptions[] {
|
|
203
|
+
const extensionsForType = this.extensionsFor(referenceType, context);
|
|
204
|
+
if (extensionsForType.length === 0) {
|
|
205
|
+
return NO_DESCRIPTIONS;
|
|
169
206
|
}
|
|
170
|
-
|
|
207
|
+
const document = AstUtils.getDocument(context);
|
|
208
|
+
// Only while the document is being linked: nothing tells a cache that a relink is about to start.
|
|
209
|
+
const linking = document.state < DocumentState.Linked && AstUtils.findRootNode(context) === document.parseResult.value;
|
|
210
|
+
const answered: ScopeExtensionDescriptions[] = [];
|
|
211
|
+
for (const extension of extensionsForType) {
|
|
212
|
+
const node = linking ? extension.cacheKey?.(context, referenceType) : undefined;
|
|
213
|
+
const descriptions = node
|
|
214
|
+
? this.keptDescriptions(document, node, extension, referenceType, () =>
|
|
215
|
+
this.runExtension(extension, referenceType, context, document)
|
|
216
|
+
)
|
|
217
|
+
: this.runExtension(extension, referenceType, context, document);
|
|
218
|
+
if (descriptions.local.length > 0 || descriptions.universal.length > 0) {
|
|
219
|
+
answered.push(descriptions);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return answered;
|
|
171
223
|
}
|
|
172
224
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
225
|
+
/** The descriptions kept for `node` in `document`, built through `build` when there are none. */
|
|
226
|
+
protected keptDescriptions(
|
|
227
|
+
document: LangiumDocument,
|
|
228
|
+
node: AstNode,
|
|
229
|
+
extension: ScopeExtension,
|
|
230
|
+
referenceType: string,
|
|
231
|
+
build: () => ScopeExtensionDescriptions
|
|
232
|
+
): ScopeExtensionDescriptions {
|
|
233
|
+
const byExtension = this.kept?.get(document.uri, node, () => new Map());
|
|
234
|
+
if (byExtension === undefined) {
|
|
235
|
+
return build();
|
|
177
236
|
}
|
|
178
|
-
|
|
237
|
+
let byType = byExtension.get(extension);
|
|
238
|
+
if (byType === undefined) {
|
|
239
|
+
byType = new Map();
|
|
240
|
+
byExtension.set(extension, byType);
|
|
241
|
+
}
|
|
242
|
+
let descriptions = byType.get(referenceType);
|
|
243
|
+
if (descriptions === undefined) {
|
|
244
|
+
descriptions = build();
|
|
245
|
+
byType.set(referenceType, descriptions);
|
|
246
|
+
}
|
|
247
|
+
return descriptions;
|
|
179
248
|
}
|
|
180
249
|
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
* `push`-ed descriptions of other tiers are silently dropped here —
|
|
185
|
-
* the per-tier query methods only return descriptions matching their
|
|
186
|
-
* tier. (`local` and `universal` are the only acceptor entry points;
|
|
187
|
-
* `push` is the escape hatch for pre-built descriptions and is the
|
|
188
|
-
* only path that could carry other tiers.)
|
|
189
|
-
*/
|
|
190
|
-
protected collectExtensionDescriptions(
|
|
250
|
+
/** Run `extension` against `context`, inside the profile session at `debug`. */
|
|
251
|
+
protected runExtension(
|
|
252
|
+
extension: ScopeExtension,
|
|
191
253
|
referenceType: string,
|
|
192
254
|
context: AstNode,
|
|
193
|
-
|
|
194
|
-
):
|
|
195
|
-
const extensionsForType = this.scopeExtensions.all().filter(extension => extension.referenceTypes.includes(referenceType));
|
|
196
|
-
if (extensionsForType.length === 0) {
|
|
197
|
-
return [];
|
|
198
|
-
}
|
|
199
|
-
const document = AstUtils.getDocument(context);
|
|
255
|
+
document: LangiumDocument
|
|
256
|
+
): ScopeExtensionDescriptions {
|
|
200
257
|
const collected: TieredAstNodeDescription[] = [];
|
|
201
258
|
const accept = createScopeDescriptionAcceptor(collected, this.services.workspace.AstNodeDescriptionProvider);
|
|
202
|
-
|
|
259
|
+
const session = Logger.isLevelEnabled('debug') ? (this.profileSession ??= this.tracer.profile('scope-extension')) : undefined;
|
|
260
|
+
if (session) {
|
|
261
|
+
session.scope(extension.id, () => extension.addDescriptions(context, referenceType, document, accept));
|
|
262
|
+
} else {
|
|
203
263
|
extension.addDescriptions(context, referenceType, document, accept);
|
|
204
264
|
}
|
|
205
|
-
return
|
|
265
|
+
return {
|
|
266
|
+
local: collected.filter(description => description.tier === 'local'),
|
|
267
|
+
universal: collected.filter(description => description.tier === 'universal')
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** The extensions that run for one reference: by default, those registered for `referenceType`. */
|
|
272
|
+
protected extensionsFor(referenceType: string, _context: AstNode): ScopeExtension[] {
|
|
273
|
+
return this.scopeExtensions.all().filter(extension => extension.referenceTypes.includes(referenceType));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Report the profile session, if one is open, and start the next one fresh:
|
|
278
|
+
* one line per extension, its calls and self-time. Not a share of the
|
|
279
|
+
* session's time, which runs from the first call to the report and so takes
|
|
280
|
+
* in whatever happened between the calls.
|
|
281
|
+
*/
|
|
282
|
+
protected reportProfile(): void {
|
|
283
|
+
const session = this.profileSession;
|
|
284
|
+
this.profileSession = undefined;
|
|
285
|
+
for (const record of session?.records() ?? []) {
|
|
286
|
+
this.tracer.debug(this.formatProfileRecord(record));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* The log line of one extension's {@link reportProfile} entry. It names the
|
|
292
|
+
* language: each has its own session, and an extension id is unique only
|
|
293
|
+
* within its language.
|
|
294
|
+
*/
|
|
295
|
+
protected formatProfileRecord(record: ProfileRecord): string {
|
|
296
|
+
const language = this.services.LanguageMetaData.languageId;
|
|
297
|
+
return `[profile scope-extension ${language}] ${record.id} ×${record.count} ${Format.elapsed(record.selfMs)}`;
|
|
206
298
|
}
|
|
207
299
|
}
|
|
@@ -157,9 +157,7 @@ export function isUniversalTier(description: AstNodeDescription): description is
|
|
|
157
157
|
* URI's project, the public-tier sibling belonging to that
|
|
158
158
|
* same project is redundant (the project-tier sibling under a shorter
|
|
159
159
|
* name is already in scope) and should be hidden from completion /
|
|
160
|
-
* linking.
|
|
161
|
-
* `HydraniumScopeProvider.bucketFor` uses this
|
|
162
|
-
* predicate to enforce the own-project canonical filter on the typed scope path.
|
|
160
|
+
* linking.
|
|
163
161
|
*
|
|
164
162
|
* `projectId` accepts `string | undefined` for adopter-call-site
|
|
165
163
|
* ergonomics: when the source has no resolvable project (standalone
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { type MaybePromise, type Tracer, type TransferElement } from '@hydranium/protocol';
|
|
11
11
|
import { type AstNode, type AstReflection, type GenericAstNode, isAstNode } from '@hydranium/langium';
|
|
12
12
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
13
13
|
import { type HydraniumLanguageServices } from '../language-module.js';
|
|
@@ -66,16 +66,6 @@ export interface AbstractSerializerOptions extends LogNameOptions {
|
|
|
66
66
|
* the extra property carries a value.
|
|
67
67
|
*/
|
|
68
68
|
readonly referenceWrapperTypes?: ReadonlyMap<string, string>;
|
|
69
|
-
/**
|
|
70
|
-
* Whether {@link AbstractSerializer.serializeAst} trims trailing whitespace
|
|
71
|
-
* from the final output (leading whitespace is always trimmed). Defaults to
|
|
72
|
-
* `true` — the conventional "no trailing blank lines" document shape. Set to
|
|
73
|
-
* `false` for grammars whose values may legitimately END the document with
|
|
74
|
-
* blank lines that must survive a round-trip — e.g. a multi-line block-scalar
|
|
75
|
-
* property (see `YamlSerializerOptions.blockScalarProperties`),
|
|
76
|
-
* where a trailing-trim would silently eat user-typed blank lines.
|
|
77
|
-
*/
|
|
78
|
-
readonly trimTrailingWhitespace?: boolean;
|
|
79
69
|
}
|
|
80
70
|
|
|
81
71
|
/**
|
|
@@ -110,8 +100,11 @@ export interface AbstractSerializerOptions extends LogNameOptions {
|
|
|
110
100
|
* **Extension points** (override in a subclass):
|
|
111
101
|
* - {@link serializeReferenceText} — extract the textual form of a
|
|
112
102
|
* cross-reference; defaults to the value's `$refText`.
|
|
103
|
+
* - {@link formatString} — quote a string, as a primitive or a reference, for
|
|
104
|
+
* the grammar's string terminal; the one override for a grammar whose
|
|
105
|
+
* terminal or value converter differs from Langium's default.
|
|
113
106
|
* - {@link formatReferenceValue} — format a cross-reference value for emission;
|
|
114
|
-
* defaults to
|
|
107
|
+
* defaults to {@link formatString}.
|
|
115
108
|
* - {@link serializeCustomValue} — type-specific serialization for values
|
|
116
109
|
* that don't fit the generic paths. Runs after all reference detection, so
|
|
117
110
|
* references never reach this hook. Returns `undefined` to fall through to
|
|
@@ -124,6 +117,25 @@ export abstract class AbstractSerializer<
|
|
|
124
117
|
TAst extends AstNode = AstNode,
|
|
125
118
|
TTransfer extends TransferElement = TransferElement
|
|
126
119
|
> implements Serializer<TAst, TTransfer> {
|
|
120
|
+
/**
|
|
121
|
+
* The escapes {@link formatString} writes, read through the subclass, so a
|
|
122
|
+
* grammar adding one overrides this table alone. Langium's
|
|
123
|
+
* `ValueConverter.convertString` decodes the short escapes here and reads
|
|
124
|
+
* any other escaped character as itself, which is how `\\` and `\"` read
|
|
125
|
+
* back, and why a `\u` escape would read back as `u`.
|
|
126
|
+
*/
|
|
127
|
+
protected static readonly STRING_ESCAPES: ReadonlyMap<string, string> = new Map([
|
|
128
|
+
['\\', '\\\\'],
|
|
129
|
+
['"', '\\"'],
|
|
130
|
+
['\b', '\\b'],
|
|
131
|
+
['\f', '\\f'],
|
|
132
|
+
['\n', '\\n'],
|
|
133
|
+
['\r', '\\r'],
|
|
134
|
+
['\t', '\\t'],
|
|
135
|
+
['\v', '\\v'],
|
|
136
|
+
['\0', '\\0']
|
|
137
|
+
]);
|
|
138
|
+
|
|
127
139
|
protected readonly reflection: AstReflection;
|
|
128
140
|
protected readonly tracer: Tracer;
|
|
129
141
|
|
|
@@ -139,29 +151,20 @@ export abstract class AbstractSerializer<
|
|
|
139
151
|
* Entry point for AST-shape inputs. Typically the grammar root, but any
|
|
140
152
|
* AST node works — the walker is recursive and shape-agnostic.
|
|
141
153
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
154
|
+
* **Emits the model and nothing else — do not trim here.** Trailing
|
|
155
|
+
* whitespace belongs to the author, and a write path holding the prior
|
|
156
|
+
* document restores it from there; trimming at this end deletes it before
|
|
157
|
+
* that restore sees it. A serializer has no prior document to consult, so it
|
|
158
|
+
* cannot tell a deliberate blank line from an accidental one.
|
|
159
|
+
*
|
|
160
|
+
* **Nothing trims what a subclass emits**, at either end. Emitting leading
|
|
161
|
+
* whitespace therefore puts it in the file, where no write path removes it.
|
|
162
|
+
*
|
|
163
|
+
* Returns whatever `serializeNode` returns, so a fully sync subclass keeps a
|
|
164
|
+
* bare `string` with no promise allocation.
|
|
146
165
|
*/
|
|
147
166
|
serializeAst(model: TAst): MaybePromise<string> {
|
|
148
|
-
|
|
149
|
-
if (isPromiseLike(result)) {
|
|
150
|
-
return result.then(text => this.trimSerialized(text));
|
|
151
|
-
}
|
|
152
|
-
return this.trimSerialized(result);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Trim the final serialized output. Leading whitespace is always removed;
|
|
157
|
-
* trailing whitespace is removed unless {@link AbstractSerializerOptions.trimTrailingWhitespace}
|
|
158
|
-
* is `false` (which preserves document-ending blank lines, e.g. inside a block scalar).
|
|
159
|
-
*/
|
|
160
|
-
protected trimSerialized(text: string | undefined): string {
|
|
161
|
-
if (text === undefined) {
|
|
162
|
-
return '';
|
|
163
|
-
}
|
|
164
|
-
return this.options.trimTrailingWhitespace === false ? text.trimStart() : text.trim();
|
|
167
|
+
return this.serializeNode(model, 0);
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
/**
|
|
@@ -426,29 +429,42 @@ export abstract class AbstractSerializer<
|
|
|
426
429
|
}
|
|
427
430
|
|
|
428
431
|
/**
|
|
429
|
-
* Format a cross-reference value for emission. Defaults to
|
|
430
|
-
* Override to apply language-specific reference
|
|
431
|
-
* id-reference formatter that mirrors the grammar's id
|
|
432
|
+
* Format a cross-reference value for emission. Defaults to
|
|
433
|
+
* {@link formatString}. Override to apply language-specific reference
|
|
434
|
+
* quoting — e.g. an id-reference formatter that mirrors the grammar's id
|
|
435
|
+
* convention.
|
|
432
436
|
*
|
|
433
437
|
* Returns {@link MaybePromise} so adopters with async formatting needs
|
|
434
438
|
* (remote schema lookup, external canonical-id resolution) can return a
|
|
435
439
|
* `Promise<string>`. Sync overrides remain valid.
|
|
436
440
|
*/
|
|
437
441
|
protected formatReferenceValue(value: string): MaybePromise<string> {
|
|
438
|
-
return
|
|
442
|
+
return this.formatString(value);
|
|
439
443
|
}
|
|
440
444
|
|
|
441
445
|
/**
|
|
442
|
-
* Format a primitive value (string, number, boolean) for emission.
|
|
443
|
-
*
|
|
444
|
-
*
|
|
446
|
+
* Format a primitive value (string, number, boolean) for emission. A string
|
|
447
|
+
* goes through {@link formatString}, any other value through
|
|
448
|
+
* `JSON.stringify`.
|
|
445
449
|
*
|
|
446
450
|
* Returns {@link MaybePromise} so adopters with async formatting needs
|
|
447
451
|
* (e.g. delegating to `prettier.format` for a specific value class) can
|
|
448
452
|
* return a `Promise<string>`.
|
|
449
453
|
*/
|
|
450
454
|
protected formatPrimitive(value: unknown): MaybePromise<string> {
|
|
451
|
-
return JSON.stringify(value);
|
|
455
|
+
return typeof value === 'string' ? this.formatString(value) : JSON.stringify(value);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Quote a string, as a primitive or a reference, for its reader: the
|
|
460
|
+
* grammar's string terminal and value converter. Defaults to the inverse of
|
|
461
|
+
* Langium's default `STRING` terminal and converter: double quotes, `\` and
|
|
462
|
+
* `"` escaped, the converter's short escapes, every other character as it
|
|
463
|
+
* is. A grammar with another terminal or converter overrides this.
|
|
464
|
+
*/
|
|
465
|
+
protected formatString(value: string): string {
|
|
466
|
+
const escapes = (this.constructor as typeof AbstractSerializer).STRING_ESCAPES;
|
|
467
|
+
return `"${Array.from(value, char => escapes.get(char) ?? char).join('')}"`;
|
|
452
468
|
}
|
|
453
469
|
|
|
454
470
|
/**
|
|
@@ -224,13 +224,24 @@ export class JsonSerializer<TAst extends AstNode = AstNode, TTransfer extends Tr
|
|
|
224
224
|
* encodings.
|
|
225
225
|
*/
|
|
226
226
|
protected override formatReferenceValue(value: string): MaybePromise<string> {
|
|
227
|
+
const quoted = this.formatString(value);
|
|
227
228
|
if (this.referenceEncoding === 'string') {
|
|
228
|
-
return
|
|
229
|
+
return quoted;
|
|
229
230
|
}
|
|
230
231
|
if (this.compact) {
|
|
231
|
-
return `{${JSON.stringify('$ref')}:${
|
|
232
|
+
return `{${JSON.stringify('$ref')}:${quoted}}`;
|
|
232
233
|
}
|
|
233
|
-
return `{ ${JSON.stringify('$ref')}: ${
|
|
234
|
+
return `{ ${JSON.stringify('$ref')}: ${quoted} }`;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* `JSON.stringify`, so the output stays valid JSON for other tools. The
|
|
239
|
+
* grammar reading it back needs a terminal and value converter that decode
|
|
240
|
+
* the `\u` escape JSON writes for a control character without a short
|
|
241
|
+
* escape; Langium's default converter reads `\u0001` as `u0001`.
|
|
242
|
+
*/
|
|
243
|
+
protected override formatString(value: string): string {
|
|
244
|
+
return JSON.stringify(value);
|
|
234
245
|
}
|
|
235
246
|
|
|
236
247
|
protected composeObject(entries: readonly (readonly [string, string])[], indentationLevel: number): string {
|
|
@@ -34,7 +34,7 @@ import type { AstNode } from '@hydranium/langium';
|
|
|
34
34
|
* Neither method requires the input to be the grammar root — the walker is
|
|
35
35
|
* recursive and shape-agnostic, so any element from either tree serializes
|
|
36
36
|
* correctly. Callers typically pass a root (that's what
|
|
37
|
-
* `
|
|
37
|
+
* `DefaultModelService.serialize`
|
|
38
38
|
* and the GLSP source-model flows hand in), but sub-tree serialization works
|
|
39
39
|
* for unit tests, snippet rendering, and tooling.
|
|
40
40
|
*/
|
|
@@ -87,6 +87,10 @@ export interface YamlSerializerOptions extends AbstractSerializerOptions {
|
|
|
87
87
|
* points. YAML's one addition is unquoted-terminal emission, handled by its
|
|
88
88
|
* {@link serializeCustomValue} override driven by
|
|
89
89
|
* {@link YamlSerializerOptions.unquotedProperties}.
|
|
90
|
+
*
|
|
91
|
+
* The grammar, not a YAML parser, reads its quoted strings back, so a control
|
|
92
|
+
* character without a short escape is written raw, which a strict YAML parser
|
|
93
|
+
* such as js-yaml refuses.
|
|
90
94
|
*/
|
|
91
95
|
export class YamlSerializer<TAst extends AstNode = AstNode, TTransfer extends TransferElement = TransferElement> extends AbstractSerializer<
|
|
92
96
|
TAst,
|
|
@@ -114,6 +118,9 @@ export class YamlSerializer<TAst extends AstNode = AstNode, TTransfer extends Tr
|
|
|
114
118
|
this.newlineChar = options.newlineChar ?? YamlSerializer.DEFAULT_NEWLINE_CHAR;
|
|
115
119
|
this.indentationChar = options.indentationChar ?? YamlSerializer.DEFAULT_INDENTATION_CHAR;
|
|
116
120
|
this.indentationAmount = options.indentationAmount ?? YamlSerializer.DEFAULT_INDENTATION_AMOUNT;
|
|
121
|
+
if (!Number.isInteger(this.indentationAmount) || this.indentationAmount < 1) {
|
|
122
|
+
throw new Error(`[hydranium] YamlSerializer indentationAmount must be a positive integer, got ${this.indentationAmount}.`);
|
|
123
|
+
}
|
|
117
124
|
this.typeSpecificKeywords = options.typeSpecificKeywords ?? YamlSerializer.DEFAULT_TYPE_SPECIFIC_KEYWORDS;
|
|
118
125
|
}
|
|
119
126
|
|
|
@@ -258,11 +265,11 @@ export class YamlSerializer<TAst extends AstNode = AstNode, TTransfer extends Tr
|
|
|
258
265
|
if (isPromiseLike(maybe)) {
|
|
259
266
|
const resumeAt = i + 1;
|
|
260
267
|
return maybe.then(formatted => {
|
|
261
|
-
lines.push(this.
|
|
268
|
+
lines.push(this.arrayItemLine(formatted, indentationLevel));
|
|
262
269
|
return this.collectReferenceArrayLines(items, indentationLevel, lines, resumeAt);
|
|
263
270
|
});
|
|
264
271
|
}
|
|
265
|
-
lines.push(this.
|
|
272
|
+
lines.push(this.arrayItemLine(maybe, indentationLevel));
|
|
266
273
|
}
|
|
267
274
|
return lines.join(this.newlineChar);
|
|
268
275
|
}
|
|
@@ -286,7 +293,7 @@ export class YamlSerializer<TAst extends AstNode = AstNode, TTransfer extends Tr
|
|
|
286
293
|
if (item === undefined) {
|
|
287
294
|
continue;
|
|
288
295
|
}
|
|
289
|
-
const maybe = this.serializePropertyValue(nodeType, key, item, indentationLevel, /* isArrayElement */ true);
|
|
296
|
+
const maybe = this.serializePropertyValue(nodeType, key, item, this.arrayItemLevel(indentationLevel), /* isArrayElement */ true);
|
|
290
297
|
if (isPromiseLike(maybe)) {
|
|
291
298
|
const resumeAt = i + 1;
|
|
292
299
|
return maybe.then(serialized => {
|
|
@@ -303,7 +310,22 @@ export class YamlSerializer<TAst extends AstNode = AstNode, TTransfer extends Tr
|
|
|
303
310
|
if (serialized === undefined) {
|
|
304
311
|
return;
|
|
305
312
|
}
|
|
306
|
-
lines.push(this.
|
|
313
|
+
lines.push(this.arrayItemLine(serialized, indentationLevel));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Level an array item's properties sit at: the first level at least four columns
|
|
318
|
+
* right of the array's key, so `- ` fits under the key and every property of the
|
|
319
|
+
* item starts at one column. Columns count {@link indentationChar} as one.
|
|
320
|
+
*/
|
|
321
|
+
protected arrayItemLevel(indentationLevel: number): number {
|
|
322
|
+
return indentationLevel - 1 + Math.ceil(4 / this.indentationAmount);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** Prefix an array item with `- `, placed so the item's content starts at {@link arrayItemLevel}. */
|
|
326
|
+
protected arrayItemLine(text: string, indentationLevel: number): string {
|
|
327
|
+
const column = this.arrayItemLevel(indentationLevel) * this.indentationAmount - '- '.length;
|
|
328
|
+
return `${this.indentationChar.repeat(column)}- ${text}`;
|
|
307
329
|
}
|
|
308
330
|
|
|
309
331
|
/**
|
|
@@ -209,6 +209,19 @@ export class ExtendedServiceRegistry<
|
|
|
209
209
|
return super.getServices(arg);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Every registered language's services, typed as `TServices` like the
|
|
214
|
+
* lookups here rather than as Langium's base shape, so a sweep of the whole
|
|
215
|
+
* set reaches what a URI or a typed handle would have given it.
|
|
216
|
+
*
|
|
217
|
+
* The cast is sound because {@link register} is the only way a language
|
|
218
|
+
* enters and takes `TServices`; the inherited accessor is typed to Langium's
|
|
219
|
+
* base, which is the only reason one is needed.
|
|
220
|
+
*/
|
|
221
|
+
override get all(): readonly TServices[] {
|
|
222
|
+
return super.all as readonly TServices[];
|
|
223
|
+
}
|
|
224
|
+
|
|
212
225
|
/**
|
|
213
226
|
* Lookup by anything that identifies a document — an AST node (routed by
|
|
214
227
|
* the document it lives in), a `URI`, or a URI string. `undefined` when the
|
|
@@ -255,9 +268,13 @@ export class ExtendedServiceRegistry<
|
|
|
255
268
|
* inherited Langium semantics, which throws on miss). Used for
|
|
256
269
|
* dynamically-routed lookups where the language id comes from
|
|
257
270
|
* external input.
|
|
271
|
+
*
|
|
272
|
+
* The cast is sound because {@link register} is the only way a language
|
|
273
|
+
* enters and takes `TServices`; `languageIdMap` is inherited and typed to
|
|
274
|
+
* Langium's base, which is the only reason one is needed.
|
|
258
275
|
*/
|
|
259
|
-
getServicesById(languageId: string):
|
|
260
|
-
return this.languageIdMap.get(languageId);
|
|
276
|
+
getServicesById(languageId: string): TServices | undefined {
|
|
277
|
+
return this.languageIdMap.get(languageId) as TServices | undefined;
|
|
261
278
|
}
|
|
262
279
|
|
|
263
280
|
/**
|
|
@@ -299,6 +316,28 @@ export class ExtendedServiceRegistry<
|
|
|
299
316
|
return owners.length === 1 ? owners[0] : undefined;
|
|
300
317
|
}
|
|
301
318
|
|
|
319
|
+
/**
|
|
320
|
+
* The language the strongest signal given names: a declared `languageId`,
|
|
321
|
+
* then `target`'s document, then the only registered language, then the sole
|
|
322
|
+
* producer of `type`. `undefined` when none answers, which leaves the
|
|
323
|
+
* fallback to the caller, since it differs per caller.
|
|
324
|
+
*
|
|
325
|
+
* A declared id comes first because every later signal is inferred, and an
|
|
326
|
+
* inference must not override a caller that said which grammar it means.
|
|
327
|
+
*/
|
|
328
|
+
getLanguageFor(hint: { readonly languageId?: string; readonly target?: LanguageTarget; readonly type?: string }): TServices | undefined {
|
|
329
|
+
const declared = hint.languageId === undefined ? undefined : this.getServicesById(hint.languageId);
|
|
330
|
+
const located = declared ?? this.getServicesFor(hint.target);
|
|
331
|
+
if (located) {
|
|
332
|
+
return located;
|
|
333
|
+
}
|
|
334
|
+
const all = this.all;
|
|
335
|
+
if (all.length === 1) {
|
|
336
|
+
return all[0];
|
|
337
|
+
}
|
|
338
|
+
return hint.type === undefined ? undefined : this.soleServicesByType(hint.type);
|
|
339
|
+
}
|
|
340
|
+
|
|
302
341
|
/**
|
|
303
342
|
* Drop the memoised type index, so a language registered after the first
|
|
304
343
|
* type lookup is accounted for. The reason this index belongs on the
|