@hydranium/core 1.0.0-next.35 → 1.0.0-next.350
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 +266 -124
- package/lib/documents/ast-document-manager.d.ts.map +1 -1
- package/lib/documents/ast-document-manager.js +293 -132
- 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 -483
- 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 +138 -0
- package/lib/documents/version-sync-service.d.ts.map +1 -0
- package/lib/documents/version-sync-service.js +173 -0
- package/lib/documents/version-sync-service.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -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 +83 -44
- 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 +142 -0
- package/lib/langium/diagnostics/console-tee.js.map +1 -0
- package/lib/langium/diagnostics/format-log-arg.d.ts +18 -0
- package/lib/langium/diagnostics/format-log-arg.d.ts.map +1 -0
- package/lib/langium/diagnostics/format-log-arg.js +36 -0
- package/lib/langium/diagnostics/format-log-arg.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 -45
- 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 +28 -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 +310 -41
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
- package/lib/langium/document-builder/document-builder.js +490 -79
- 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 +40 -24
- 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 +17 -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 +95 -27
- package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
- package/lib/langium/integrity/integrity-service.js +303 -63
- package/lib/langium/integrity/integrity-service.js.map +1 -1
- package/lib/langium/keys/name-based-key-provider.d.ts.map +1 -1
- 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 +18 -4
- package/lib/langium/language-module.js.map +1 -1
- package/lib/langium/model-service/client-session.d.ts +383 -0
- package/lib/langium/model-service/client-session.d.ts.map +1 -0
- package/lib/langium/model-service/client-session.js +455 -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 +66 -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 +456 -300
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +571 -466
- package/lib/langium/model-service/model-service.js.map +1 -1
- package/lib/langium/module.d.ts +141 -40
- package/lib/langium/module.d.ts.map +1 -1
- package/lib/langium/module.js +52 -40
- 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.map +1 -1
- package/lib/langium/project/abstract-project-manager.js +13 -6
- package/lib/langium/project/abstract-project-manager.js.map +1 -1
- package/lib/langium/project/project-change-event.d.ts +2 -2
- package/lib/langium/project/single-project-manager.d.ts.map +1 -1
- package/lib/langium/project/single-project-manager.js.map +1 -1
- package/lib/langium/residency/cst-residency-service.d.ts +38 -14
- package/lib/langium/residency/cst-residency-service.d.ts.map +1 -1
- package/lib/langium/residency/cst-residency-service.js +24 -58
- package/lib/langium/residency/cst-residency-service.js.map +1 -1
- package/lib/langium/scope/ast-node-description-provider.d.ts.map +1 -1
- package/lib/langium/scope/ast-node-description-provider.js.map +1 -1
- 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 +115 -32
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.js +201 -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 +13 -7
- 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 +86 -37
- package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -1
- package/lib/langium/transfer/transfer-encoder.js +36 -25
- 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 +1164 -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/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 +31 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.js +54 -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 +103 -21
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.js +184 -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 +1 -0
- package/lib/langium/workspace/index.d.ts.map +1 -1
- package/lib/langium/workspace/index.js +1 -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/langium/workspace/self-save-registry.d.ts +84 -0
- package/lib/langium/workspace/self-save-registry.d.ts.map +1 -0
- package/lib/{documents → langium/workspace}/self-save-registry.js +33 -22
- package/lib/langium/workspace/self-save-registry.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 +19 -5
- package/lib/locale/server-locale.d.ts.map +1 -1
- package/lib/locale/server-locale.js +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 +235 -102
- 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 +32 -7
- package/lib/messages/renderer.d.ts.map +1 -1
- package/lib/messages/renderer.js +7 -1
- 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.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.d.ts +4 -4
- package/lib/testing/make-noop-shared-services.d.ts.map +1 -1
- package/lib/testing/make-noop-shared-services.js +4 -4
- package/lib/testing/make-noop-shared-services.js.map +1 -1
- package/lib/testing/make-test-services.d.ts +51 -20
- package/lib/testing/make-test-services.d.ts.map +1 -1
- package/lib/testing/make-test-services.js +29 -13
- 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 -52
- package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
- package/lib/testing/stub-ast-document-manager.js +31 -62
- 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 +103 -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 +9 -8
- package/lib/testing/stub-model-service.d.ts.map +1 -1
- package/lib/testing/stub-model-service.js +6 -6
- package/lib/testing/stub-model-service.js.map +1 -1
- 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 +74 -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 +479 -233
- package/src/documents/client-ids.ts +5 -22
- package/src/documents/client-session-errors.ts +24 -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 -595
- 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 +275 -0
- package/src/index.ts +7 -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 +87 -51
- 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 +151 -0
- package/src/langium/diagnostics/format-log-arg.ts +36 -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 -44
- package/src/langium/document-builder/build-pipeline-integration.ts +46 -32
- package/src/langium/document-builder/build-session.ts +4 -3
- package/src/langium/document-builder/document-builder.ts +615 -79
- package/src/langium/integration-services.ts +59 -28
- package/src/langium/integrity/integrity-rule.ts +17 -8
- package/src/langium/integrity/integrity-service.ts +332 -69
- package/src/langium/language-module.ts +49 -8
- package/src/langium/model-service/client-session.ts +726 -0
- package/src/langium/model-service/index.ts +2 -0
- package/src/langium/model-service/model-events.ts +80 -0
- package/src/langium/model-service/model-service.ts +878 -494
- package/src/langium/module.ts +195 -72
- package/src/langium/naming/name-provider.ts +34 -8
- package/src/langium/project/abstract-project-manager.ts +13 -5
- package/src/langium/project/project-change-event.ts +2 -2
- package/src/langium/residency/cst-residency-service.ts +54 -19
- 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 +228 -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 +16 -7
- package/src/langium/single-langium-copy.ts +42 -0
- package/src/langium/transfer/transfer-encoder.ts +104 -47
- package/src/langium/trivia/comment-preserver.ts +1409 -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/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 +83 -0
- package/src/langium/workspace/hydranium-workspace-lock.ts +86 -2
- package/src/langium/workspace/hydranium-workspace-manager.ts +212 -35
- package/src/langium/workspace/in-memory-file-system-provider.ts +54 -23
- package/src/langium/workspace/index.ts +1 -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/langium/workspace/self-save-registry.ts +118 -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 +20 -5
- 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 +285 -111
- 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 +34 -6
- 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 +5 -5
- 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-noop-shared-services.ts +6 -6
- package/src/testing/make-test-services.ts +93 -41
- 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 -128
- package/src/testing/stub-document-builder.ts +138 -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 +11 -10
- 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 +80 -15
- package/src/util/environment.ts +24 -2
- package/lib/documents/language-client-text-shadow.d.ts +0 -101
- package/lib/documents/language-client-text-shadow.d.ts.map +0 -1
- package/lib/documents/language-client-text-shadow.js +0 -156
- package/lib/documents/language-client-text-shadow.js.map +0 -1
- package/lib/documents/self-save-registry.d.ts +0 -55
- 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 -175
- package/src/documents/self-save-registry.ts +0 -81
- package/src/lsp/instrument-connection.ts +0 -66
- package/src/node/process-memory.ts +0 -299
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
import {
|
|
11
11
|
defineMessage,
|
|
12
12
|
describeError,
|
|
13
|
+
interpolate,
|
|
14
|
+
type MessageDefinition,
|
|
15
|
+
type MessageParams,
|
|
13
16
|
messageData,
|
|
17
|
+
type ParamsArg,
|
|
18
|
+
type ParamsOf,
|
|
14
19
|
type LogThreshold,
|
|
15
20
|
type MaybeObservableValue,
|
|
16
21
|
ObservableValue,
|
|
@@ -26,13 +31,14 @@ import {
|
|
|
26
31
|
DocumentValidator,
|
|
27
32
|
type LangiumDocument,
|
|
28
33
|
type LangiumCoreServices,
|
|
34
|
+
type Lexer,
|
|
29
35
|
type ValidateSingleNodeOptions,
|
|
30
36
|
type ValidationOptions,
|
|
31
37
|
type ValidationSeverity
|
|
32
38
|
} from '@hydranium/langium';
|
|
33
39
|
import type { CancellationToken } from 'vscode-languageserver-protocol';
|
|
34
40
|
// A VALUE import, for `Diagnostic.getMessageString`: `message` is
|
|
35
|
-
// `string | MarkupContent`
|
|
41
|
+
// `string | MarkupContent` since LSP 3.18, so upstream's own reader is what
|
|
36
42
|
// narrows it rather than a hand-rolled union check here.
|
|
37
43
|
import { Diagnostic } from 'vscode-languageserver-types';
|
|
38
44
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
@@ -40,9 +46,15 @@ import { isSyntheticNode } from '../workspace/synthetic.js';
|
|
|
40
46
|
import { isVirtualUri } from '../workspace/virtual-document.js';
|
|
41
47
|
|
|
42
48
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* {@link TransferDiagnostic}.
|
|
49
|
+
* The AST-layer diagnostic: what the build left on `LangiumDocument`, and what
|
|
50
|
+
* an `AstDocument` carries. An LSP {@link Diagnostic} that MAY also carry the
|
|
51
|
+
* `element` path and `property` name from {@link TransferDiagnostic}.
|
|
52
|
+
*
|
|
53
|
+
* **Not interchangeable with {@link TransferDiagnostic}, which is the other end
|
|
54
|
+
* of the same conversion.** They disagree on field types as well as on which
|
|
55
|
+
* fields exist — `severity` is LSP's numeric enum here and a string union there
|
|
56
|
+
* — so a slot typed with the wrong one still accepts the value and then reads
|
|
57
|
+
* `undefined`, or compares equal to nothing.
|
|
46
58
|
*
|
|
47
59
|
* `element` is optional because a document's diagnostics do not all come from
|
|
48
60
|
* this validator. {@link HydraniumDocumentValidator.toDiagnostic} always sets
|
|
@@ -57,7 +69,7 @@ import { isVirtualUri } from '../workspace/virtual-document.js';
|
|
|
57
69
|
* condition. Consumers therefore cast at the read, and the cast is sound only
|
|
58
70
|
* because this field is optional.
|
|
59
71
|
*/
|
|
60
|
-
export interface
|
|
72
|
+
export interface AstDiagnostic extends Diagnostic {
|
|
61
73
|
element?: string;
|
|
62
74
|
property?: string;
|
|
63
75
|
}
|
|
@@ -107,11 +119,117 @@ export const UNRESOLVED_REFERENCE = defineMessage(
|
|
|
107
119
|
* means: chevrotain reports how many characters the lexer discarded to recover,
|
|
108
120
|
* which for a single stray character is one and for a run of them is the run.
|
|
109
121
|
*/
|
|
110
|
-
export const
|
|
111
|
-
'hydranium/core/
|
|
122
|
+
export const UNEXPECTED_CHARACTER = defineMessage(
|
|
123
|
+
'hydranium/core/unexpected-character',
|
|
112
124
|
'unexpected character: ->{character}<- at offset: {offset}, skipped {skipped} characters.'
|
|
113
125
|
);
|
|
114
126
|
|
|
127
|
+
/**
|
|
128
|
+
* A token the grammar does not admit at this position.
|
|
129
|
+
*
|
|
130
|
+
* **The English is byte-identical to Langium's
|
|
131
|
+
* `LangiumParserErrorMessageProvider.buildMismatchTokenMessage`, and must stay
|
|
132
|
+
* so**, on the same rule as {@link UNRESOLVED_REFERENCE}.
|
|
133
|
+
*
|
|
134
|
+
* `expected` is a token type name, which is grammar vocabulary rather than
|
|
135
|
+
* translatable text — only the frame around it is. Promoting it into the code
|
|
136
|
+
* instead would make the catalogue as large as the grammar.
|
|
137
|
+
*/
|
|
138
|
+
export const UNEXPECTED_TOKEN = defineMessage(
|
|
139
|
+
'hydranium/core/unexpected-token',
|
|
140
|
+
"Expecting token of type '{expected}' but found `{found}`."
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Input left over once the entry rule had matched.
|
|
145
|
+
*
|
|
146
|
+
* **The English is byte-identical to Langium's
|
|
147
|
+
* `LangiumParserErrorMessageProvider.buildNotAllInputParsedMessage`, and must
|
|
148
|
+
* stay so.**
|
|
149
|
+
*/
|
|
150
|
+
export const TRAILING_INPUT = defineMessage('hydranium/core/trailing-input', 'Expecting end of file but found `{found}`.');
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* A mode-popping token reached with nothing on the lexer's mode stack.
|
|
154
|
+
*
|
|
155
|
+
* **The English is byte-identical to CHEVROTAIN's
|
|
156
|
+
* `defaultLexerErrorProvider.buildUnableToPopLexerModeMessage`, and must stay
|
|
157
|
+
* so**, the closing clause running on without punctuation exactly as upstream
|
|
158
|
+
* writes it.
|
|
159
|
+
*
|
|
160
|
+
* Reachable only from a multi-mode lexer, which a grammar opts into through a
|
|
161
|
+
* custom token builder.
|
|
162
|
+
*/
|
|
163
|
+
export const UNPOPPABLE_LEXER_MODE = defineMessage(
|
|
164
|
+
'hydranium/core/unpoppable-lexer-mode',
|
|
165
|
+
'Unable to pop Lexer Mode after encountering Token ->{image}<- The Mode Stack is empty'
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* A dedent that lines up with no enclosing indentation level.
|
|
170
|
+
*
|
|
171
|
+
* **The English is byte-identical to LANGIUM's `IndentationAwareTokenBuilder`,
|
|
172
|
+
* and must stay so** — the one lexing sentence Langium words itself rather than
|
|
173
|
+
* relaying from chevrotain, which is why it renders through no
|
|
174
|
+
* `ILexerErrorMessageProvider` and an adopter cannot reach it by replacing one.
|
|
175
|
+
*
|
|
176
|
+
* `stack` is the indentation stack as the template literal upstream stringifies
|
|
177
|
+
* it, comma-joined: structure would have to survive {@link MessageParams}, which
|
|
178
|
+
* holds scalars, and a translation has nothing to say about the numbers anyway.
|
|
179
|
+
*/
|
|
180
|
+
export const INVALID_DEDENT = defineMessage(
|
|
181
|
+
'hydranium/core/invalid-dedent',
|
|
182
|
+
'Invalid dedent level {level} at offset: {offset}. Current indentation stack: {stack}'
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* A position where none of a rule's alternatives can start.
|
|
187
|
+
*
|
|
188
|
+
* **The English is byte-identical to CHEVROTAIN's
|
|
189
|
+
* `defaultParserErrorProvider.buildNoViableAltMessage`, and must stay so** —
|
|
190
|
+
* one layer further out than {@link UNEXPECTED_TOKEN}, because Langium overrides
|
|
191
|
+
* only two of the four parser sentences and passes this one straight through.
|
|
192
|
+
*
|
|
193
|
+
* `sequences` is the token-sequence list chevrotain generated, carried whole
|
|
194
|
+
* rather than as structure: {@link MessageParams} holds scalars, and the list is
|
|
195
|
+
* token names in any case, so only the frame around it is translatable.
|
|
196
|
+
*/
|
|
197
|
+
export const NO_VIABLE_ALTERNATIVE = defineMessage(
|
|
198
|
+
'hydranium/core/no-viable-alternative',
|
|
199
|
+
"Expecting: one of these possible Token sequences:\n{sequences}\nbut found: '{found}'"
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* A repetition that had to match at least once and matched nothing.
|
|
204
|
+
*
|
|
205
|
+
* **The English is byte-identical to CHEVROTAIN's
|
|
206
|
+
* `defaultParserErrorProvider.buildEarlyExitMessage`, and must stay so**,
|
|
207
|
+
* including the doubled colon after `sequences::`, which is upstream's and not a
|
|
208
|
+
* typo to repair here — a divergence would silently stop the identity attaching.
|
|
209
|
+
*
|
|
210
|
+
* Named for the empty repetition rather than for chevrotain's `EarlyExit`, which
|
|
211
|
+
* describes its own control flow rather than the reader's problem.
|
|
212
|
+
*/
|
|
213
|
+
export const MISSING_ITERATION = defineMessage(
|
|
214
|
+
'hydranium/core/missing-iteration',
|
|
215
|
+
"Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\n <{sequences}>\nbut found: '{found}'"
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The two sentences whose only free parameter is a generated list, in the order
|
|
220
|
+
* {@link HydraniumDocumentValidator.identifyParsingError} tries them. Order is
|
|
221
|
+
* free: their frames share a prefix but diverge before the list begins, so at
|
|
222
|
+
* most one can match.
|
|
223
|
+
*/
|
|
224
|
+
const SEQUENCE_LISTING_MESSAGES = [NO_VIABLE_ALTERNATIVE, MISSING_ITERATION];
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Splits a template into alternating frame and placeholder NAME, for
|
|
228
|
+
* {@link HydraniumDocumentValidator.sliceFramed}. The capturing group is what
|
|
229
|
+
* keeps the names in the result rather than discarding them.
|
|
230
|
+
*/
|
|
231
|
+
const PLACEHOLDER_CAPTURE = /\{([^}]+)\}/;
|
|
232
|
+
|
|
115
233
|
/**
|
|
116
234
|
* Langium's own `data.code` values for a diagnostic that came out of the lexer.
|
|
117
235
|
*
|
|
@@ -165,7 +283,7 @@ export interface DocumentValidatorOptions extends LogNameOptions {
|
|
|
165
283
|
* - **Skip-validation hook** via the virtual {@link shouldSkipValidation}
|
|
166
284
|
* predicate, which adopters override to compose additional skip reasons.
|
|
167
285
|
* - **Diagnostic mapping** to {@link TransferDiagnostic}-shaped
|
|
168
|
-
* {@link
|
|
286
|
+
* {@link AstDiagnostic}: every emitted diagnostic carries the AST
|
|
169
287
|
* node's path (built via Langium's `AstNodeLocator`) plus the optional
|
|
170
288
|
* offending property name.
|
|
171
289
|
* - **Optional timing wrap** on `validateDocument`, on by default.
|
|
@@ -174,6 +292,12 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
174
292
|
protected readonly tracer: Tracer;
|
|
175
293
|
protected readonly astNodeLocator: AstNodeLocator;
|
|
176
294
|
protected readonly reflection: AstReflection;
|
|
295
|
+
protected readonly lexer: Lexer;
|
|
296
|
+
/**
|
|
297
|
+
* {@link tokenTypeNames}' answer. Nothing invalidates it: the vocabulary
|
|
298
|
+
* comes from the grammar, which is fixed once the DI tree is composed.
|
|
299
|
+
*/
|
|
300
|
+
protected expectedNames?: readonly string[];
|
|
177
301
|
protected readonly logLevel: ObservableValue<LogThreshold>;
|
|
178
302
|
protected readonly logAfterMs: ObservableValue<number>;
|
|
179
303
|
protected readonly validateVirtualDocuments: ObservableValue<boolean>;
|
|
@@ -184,6 +308,7 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
184
308
|
this.tracer = services.shared.Tracer.for(options.logName ?? 'DocumentValidator').trace('instantiated');
|
|
185
309
|
this.astNodeLocator = services.workspace.AstNodeLocator;
|
|
186
310
|
this.reflection = services.shared.AstReflection;
|
|
311
|
+
this.lexer = services.parser.Lexer;
|
|
187
312
|
this.logLevel = ObservableValue.from(options.logLevel ?? 'debug');
|
|
188
313
|
this.logAfterMs = ObservableValue.from(options.logAfterMs ?? 20);
|
|
189
314
|
this.validateVirtualDocuments = ObservableValue.from(options.validateVirtualDocuments ?? false);
|
|
@@ -216,18 +341,22 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
216
341
|
}
|
|
217
342
|
|
|
218
343
|
/**
|
|
219
|
-
* Langium's validation pass, plus the framework identity on the lexing
|
|
220
|
-
* diagnostics it produced.
|
|
344
|
+
* Langium's validation pass, plus the framework identity on the lexing and
|
|
345
|
+
* parsing diagnostics it produced.
|
|
346
|
+
*
|
|
347
|
+
* **Here rather than in an override of `processLexingErrors` /
|
|
348
|
+
* `processParsingErrors`, and the reason is that neither seam can see what
|
|
349
|
+
* the identity needs.** Langium hands them a `ParseResult`, which carries the
|
|
350
|
+
* AST and the error lists but not the source text — and the offending
|
|
351
|
+
* CHARACTER, or the offending TOKEN, is the parameter a translation exists to
|
|
352
|
+
* interpolate. The document does carry it, and this is the innermost point
|
|
353
|
+
* that still holds one.
|
|
221
354
|
*
|
|
222
|
-
*
|
|
223
|
-
* is
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* the innermost point that still holds one. Reconstructing the character by
|
|
228
|
-
* matching it out of the finished sentence was the alternative, and it
|
|
229
|
-
* inverts the direction the rest of this file works in: every other identity
|
|
230
|
-
* here is derived from structured fields and CHECKED against the prose.
|
|
355
|
+
* Correlating the finished diagnostics back to the `ParseResult`'s error
|
|
356
|
+
* lists positionally is the alternative, and it is unsound for the parsing
|
|
357
|
+
* half: `processParsingErrors` DROPS an error whose token offsets are `NaN`
|
|
358
|
+
* and whose exception carries no `previousToken`, so the two lists differ in
|
|
359
|
+
* length exactly when recovery has been at work.
|
|
231
360
|
*
|
|
232
361
|
* Inside the timing span rather than around it, so the line accounts for the
|
|
233
362
|
* whole pass.
|
|
@@ -241,15 +370,19 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
241
370
|
// Mapped in place over the array Langium built, rather than filtered and
|
|
242
371
|
// re-concatenated: the publish order is the diagnostic order and a
|
|
243
372
|
// reordering would move a squiggle's entry in the problems list.
|
|
373
|
+
// Each pass guards on its own `data.code`, so at most one can claim a
|
|
374
|
+
// given diagnostic and the order between them carries no meaning.
|
|
244
375
|
for (let index = 0; index < diagnostics.length; index++) {
|
|
245
376
|
diagnostics[index] = this.identifyLexingError(document, diagnostics[index]);
|
|
377
|
+
diagnostics[index] = this.identifyParsingError(document, diagnostics[index]);
|
|
246
378
|
}
|
|
247
379
|
return diagnostics;
|
|
248
380
|
}
|
|
249
381
|
|
|
250
382
|
/**
|
|
251
|
-
* Add
|
|
252
|
-
* untouched when
|
|
383
|
+
* Add whichever lexing identity renders `diagnostic`'s sentence, or return it
|
|
384
|
+
* untouched when none of them does — a custom lexer's own report, which
|
|
385
|
+
* Langium admits through `lexerReport`, being the case that reaches the end.
|
|
253
386
|
*
|
|
254
387
|
* The parameters come from the diagnostic's own RANGE, not from
|
|
255
388
|
* `parseResult.lexerErrors`. Both hold the same numbers, and the range is the
|
|
@@ -269,19 +402,165 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
269
402
|
return diagnostic;
|
|
270
403
|
}
|
|
271
404
|
const text = document.textDocument;
|
|
405
|
+
const message = Diagnostic.getMessageString(diagnostic);
|
|
272
406
|
const offset = text.offsetAt(diagnostic.range.start);
|
|
273
|
-
const
|
|
407
|
+
const stray = {
|
|
274
408
|
character: text.getText().charAt(offset),
|
|
275
409
|
offset,
|
|
276
410
|
skipped: text.offsetAt(diagnostic.range.end) - offset
|
|
277
411
|
};
|
|
278
|
-
if (
|
|
412
|
+
if (message === UNEXPECTED_CHARACTER.format(stray)) {
|
|
413
|
+
return this.identified(diagnostic, UNEXPECTED_CHARACTER, stray);
|
|
414
|
+
}
|
|
415
|
+
// The mode-pop error's range spans the offending token exactly, upstream
|
|
416
|
+
// reporting its `startOffset` with the image's own length.
|
|
417
|
+
const image = text.getText(diagnostic.range);
|
|
418
|
+
if (message === UNPOPPABLE_LEXER_MODE.format({ image })) {
|
|
419
|
+
return this.identified(diagnostic, UNPOPPABLE_LEXER_MODE, { image });
|
|
420
|
+
}
|
|
421
|
+
// `level` and `stack` are lexer state that reaches no field here, so they
|
|
422
|
+
// are sliced; `offset` is given, which is what anchors the slice.
|
|
423
|
+
const dedent = this.sliceFramed(message, INVALID_DEDENT, { offset });
|
|
424
|
+
return dedent === undefined ? diagnostic : this.identified(diagnostic, INVALID_DEDENT, dedent);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Add whichever parser identity renders `diagnostic`'s sentence, or return it
|
|
429
|
+
* untouched when none of them does — an adopter that replaced the parser
|
|
430
|
+
* error-message provider being the case that reaches the last branch.
|
|
431
|
+
*
|
|
432
|
+
* `found` comes from the diagnostic's own RANGE, for the same reason
|
|
433
|
+
* {@link identifyLexingError} reads its parameters there. A token whose
|
|
434
|
+
* offsets chevrotain could not report collapses to a zero-width range, which
|
|
435
|
+
* yields the empty string the sentence already renders for it.
|
|
436
|
+
*
|
|
437
|
+
* **`expected` is recovered by SEARCHING the vocabulary, because nothing
|
|
438
|
+
* carries it.** Chevrotain hands the expected token type to the message
|
|
439
|
+
* provider and keeps it on neither the exception nor the diagnostic, so the
|
|
440
|
+
* only structured source left is the grammar's own vocabulary: every token
|
|
441
|
+
* type is offered to the same `format` the identity renders with, and the one
|
|
442
|
+
* that reproduces the message supplies the parameter. Matching it out of the
|
|
443
|
+
* prose instead would derive a parameter from a sentence that a Langium
|
|
444
|
+
* reword can change without warning. Two distinct names cannot render one
|
|
445
|
+
* sentence, so the match is unique where it exists.
|
|
446
|
+
*/
|
|
447
|
+
protected identifyParsingError(document: LangiumDocument, diagnostic: Diagnostic): Diagnostic {
|
|
448
|
+
const data = diagnostic.data as { code?: unknown } | undefined;
|
|
449
|
+
if (data?.code !== DocumentValidator.ParsingError) {
|
|
279
450
|
return diagnostic;
|
|
280
451
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
452
|
+
const message = Diagnostic.getMessageString(diagnostic);
|
|
453
|
+
const found = document.textDocument.getText(diagnostic.range);
|
|
454
|
+
if (message === TRAILING_INPUT.format({ found })) {
|
|
455
|
+
return this.identified(diagnostic, TRAILING_INPUT, { found });
|
|
456
|
+
}
|
|
457
|
+
const expected = this.tokenTypeNames().find(name => UNEXPECTED_TOKEN.format({ expected: name, found }) === message);
|
|
458
|
+
if (expected !== undefined) {
|
|
459
|
+
return this.identified(diagnostic, UNEXPECTED_TOKEN, { expected, found });
|
|
460
|
+
}
|
|
461
|
+
for (const definition of SEQUENCE_LISTING_MESSAGES) {
|
|
462
|
+
const params = this.sliceFramed(message, definition, { found });
|
|
463
|
+
if (params !== undefined) {
|
|
464
|
+
return this.identified(diagnostic, definition, params);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return diagnostic;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/** `diagnostic` carrying `definition`'s identity, over whatever `data` it already had. */
|
|
471
|
+
protected identified<S extends string>(diagnostic: Diagnostic, definition: MessageDefinition<S>, ...params: ParamsArg<S>): Diagnostic {
|
|
472
|
+
// Merged OVER the existing data, so Langium's `code` survives for the
|
|
473
|
+
// readers that switch on it — `stopAfterParsingErrors` is one, and the
|
|
474
|
+
// GLSP head's read-only decision is another.
|
|
475
|
+
const data = diagnostic.data as object | undefined;
|
|
476
|
+
return { ...diagnostic, code: definition.code, data: { ...data, ...messageData(definition, ...params) } };
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* `definition`'s parameters as they appear in `message`, taking the ones in
|
|
481
|
+
* `known` as given, or `undefined` when `message` is not that sentence.
|
|
482
|
+
*
|
|
483
|
+
* **The only parameters in this file taken OUT of the prose rather than
|
|
484
|
+
* derived and checked against it, and the bound on that is what `known`
|
|
485
|
+
* is for.** A generated token-sequence list, a lexer's indentation stack: for
|
|
486
|
+
* these there is no finite candidate set to offer to `format` the way a token
|
|
487
|
+
* type name can be, and no structured field carries them. What keeps the read
|
|
488
|
+
* honest is that everything else in the sentence is either a fixed literal or
|
|
489
|
+
* a parameter the caller derived independently, so the frame either matches
|
|
490
|
+
* exactly or the sentence is declined.
|
|
491
|
+
*
|
|
492
|
+
* **The trailing format-and-compare is load-bearing once more than one
|
|
493
|
+
* parameter is unknown.** Each is captured up to the NEXT fixed separator, so
|
|
494
|
+
* a separator that also occurs inside a value would cut early — re-rendering
|
|
495
|
+
* catches that, where for a single unknown between two affixes it could not
|
|
496
|
+
* fail. Two adjacent placeholders are declined outright: nothing marks the
|
|
497
|
+
* boundary, so no capture is recoverable.
|
|
498
|
+
*
|
|
499
|
+
* The frame is split off the declaration's own `text`, so it cannot drift
|
|
500
|
+
* from the sentence `format` renders.
|
|
501
|
+
*/
|
|
502
|
+
protected sliceFramed<S extends string>(
|
|
503
|
+
message: string,
|
|
504
|
+
definition: MessageDefinition<S>,
|
|
505
|
+
known: MessageParams
|
|
506
|
+
): ParamsOf<S> | undefined {
|
|
507
|
+
// `split` with a capturing group interleaves literals and placeholder
|
|
508
|
+
// names, so even indices are frame and odd ones are parameters.
|
|
509
|
+
const parts = definition.text.split(PLACEHOLDER_CAPTURE);
|
|
510
|
+
const params: Record<string, string | number> = { ...known };
|
|
511
|
+
let cursor = 0;
|
|
512
|
+
for (let index = 0; index < parts.length; index += 2) {
|
|
513
|
+
const literal = parts[index];
|
|
514
|
+
if (!message.startsWith(literal, cursor)) {
|
|
515
|
+
return undefined;
|
|
516
|
+
}
|
|
517
|
+
cursor += literal.length;
|
|
518
|
+
const name = parts[index + 1];
|
|
519
|
+
if (name === undefined) {
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
const given = params[name];
|
|
523
|
+
if (given !== undefined) {
|
|
524
|
+
const rendered = String(given);
|
|
525
|
+
if (!message.startsWith(rendered, cursor)) {
|
|
526
|
+
return undefined;
|
|
527
|
+
}
|
|
528
|
+
cursor += rendered.length;
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
const separator = parts[index + 2];
|
|
532
|
+
const trailing = parts[index + 3] === undefined;
|
|
533
|
+
if (separator === '' && !trailing) {
|
|
534
|
+
return undefined;
|
|
535
|
+
}
|
|
536
|
+
const at = trailing && separator === '' ? message.length : message.indexOf(separator, cursor);
|
|
537
|
+
if (at < cursor) {
|
|
538
|
+
return undefined;
|
|
539
|
+
}
|
|
540
|
+
params[name] = message.slice(cursor, at);
|
|
541
|
+
cursor = at;
|
|
542
|
+
}
|
|
543
|
+
if (cursor !== message.length || interpolate(definition.text, params) !== message) {
|
|
544
|
+
return undefined;
|
|
545
|
+
}
|
|
546
|
+
// Narrowing only: every placeholder the template names was either given or
|
|
547
|
+
// captured above, which is precisely what `ParamsOf` requires.
|
|
548
|
+
return params as ParamsOf<S>;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Every token type name the grammar declares, as
|
|
553
|
+
* {@link identifyParsingError} candidates.
|
|
554
|
+
*
|
|
555
|
+
* Read off the lexer, whose `definition` the `Lexer` INTERFACE declares —
|
|
556
|
+
* the parser holds the same vocabulary only behind Langium's default class,
|
|
557
|
+
* where an adopter's replacement need not keep it. A token type the parser
|
|
558
|
+
* expects but the lexer does not declare yields no match, which declines the
|
|
559
|
+
* identity rather than attaching a wrong one.
|
|
560
|
+
*/
|
|
561
|
+
protected tokenTypeNames(): readonly string[] {
|
|
562
|
+
this.expectedNames ??= Object.keys(this.lexer.definition);
|
|
563
|
+
return this.expectedNames;
|
|
285
564
|
}
|
|
286
565
|
|
|
287
566
|
/**
|
|
@@ -395,7 +674,7 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
395
674
|
severity: ValidationSeverity,
|
|
396
675
|
message: string,
|
|
397
676
|
info: DiagnosticInfo<N, string>
|
|
398
|
-
):
|
|
677
|
+
): AstDiagnostic {
|
|
399
678
|
const base = super.toDiagnostic(severity, message, info);
|
|
400
679
|
const node = info.node;
|
|
401
680
|
if (!node) {
|
|
@@ -419,9 +698,11 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
419
698
|
*/
|
|
420
699
|
protected buildElementPath<N extends AstNode>(node: N, info: DiagnosticInfo<N, string>): string {
|
|
421
700
|
const directPath = this.astNodeLocator.getAstNodePath(node);
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
|
|
701
|
+
// The locator answers '' for the root, which is the root's path rather than a miss.
|
|
702
|
+
const isRoot = node.$container === undefined;
|
|
703
|
+
const containerPath = directPath || isRoot ? undefined : this.astNodeLocator.getAstNodePath(node.$container);
|
|
704
|
+
const nodePath = directPath || containerPath || '';
|
|
705
|
+
if (!nodePath && !isRoot) {
|
|
425
706
|
this.tracer.warn('Cannot create diagnostic element path: Unable to determine AST node path.');
|
|
426
707
|
return '';
|
|
427
708
|
}
|
|
@@ -15,6 +15,15 @@ import { type ValidationCheckRegistry } from './validation-contribution.js';
|
|
|
15
15
|
|
|
16
16
|
export type ValidationContributionCollectorOptions = LogNameOptions;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* The validation-collector slot. Empty because the service registers checks in
|
|
20
|
+
* its constructor and nothing calls it; typing the slot by the class would stop
|
|
21
|
+
* an adopter's subclass from a second package copy satisfying it. The cost: any
|
|
22
|
+
* non-null value satisfies it, so a mis-bound slot compiles and registers no check.
|
|
23
|
+
*/
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- the slot has no public member to name
|
|
25
|
+
export interface ValidationContributionCollector {}
|
|
26
|
+
|
|
18
27
|
/**
|
|
19
28
|
* Per-language eager collector that wires `ValidationCheckContribution`s
|
|
20
29
|
* declared under `services.validation.checks` into Langium's native
|
|
@@ -32,7 +41,7 @@ export type ValidationContributionCollectorOptions = LogNameOptions;
|
|
|
32
41
|
* DI proxy. That is what gets the checks into the registry before Langium
|
|
33
42
|
* reaches the `Validated` phase — nothing else constructs this service.
|
|
34
43
|
*/
|
|
35
|
-
export class ValidationContributionCollector {
|
|
44
|
+
export class DefaultValidationContributionCollector implements ValidationContributionCollector {
|
|
36
45
|
protected readonly tracer: Tracer;
|
|
37
46
|
|
|
38
47
|
constructor(services: ServerLanguageServices, options: ValidationContributionCollectorOptions = {}) {
|
|
@@ -21,6 +21,8 @@ import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
|
21
21
|
*/
|
|
22
22
|
export interface RealpathCapableFileSystem {
|
|
23
23
|
realpath?(uri: URI): URI | undefined;
|
|
24
|
+
/** `uri` with its links followed, those to nothing included; see `WritableFileSystemProvider.resolveLinks`. */
|
|
25
|
+
resolveLinks?(uri: URI): URI;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -51,16 +53,17 @@ export function findRealpathDivergence(uri: URI | string, fs: RealpathCapableFil
|
|
|
51
53
|
* - {@link canonicalUri} — TOTAL: maps any URI to the single canonical *string*
|
|
52
54
|
* the framework keys a document by, regardless of whether the file exists.
|
|
53
55
|
* This is the form that MUST match the adopter's `LangiumDocuments` keying so
|
|
54
|
-
* the text store,
|
|
55
|
-
* (`AstDocumentManager.onUpdate` / `onSave` / `onClientClosed`), and
|
|
56
|
+
* the text store, `ModelService`'s event filters, and
|
|
56
57
|
* `LangiumDocuments` lookups all agree on one identity for the same file. Use
|
|
57
58
|
* for keying, comparison, and the text-store ↔ document-store bridges.
|
|
58
59
|
*
|
|
59
60
|
* - {@link loadUri} — EXISTENCE-AWARE: maps a URI to the *load* URI, or
|
|
60
61
|
* `undefined` when there is no loadable on-disk content for it. Use where the
|
|
61
62
|
* next step actually touches the filesystem (loading a document, walking a
|
|
62
|
-
* directory): `undefined` means "skip
|
|
63
|
-
*
|
|
63
|
+
* directory): `undefined` means "skip the read" rather than attempt a doomed
|
|
64
|
+
* one. It does not mean there is no document: one created and not yet saved
|
|
65
|
+
* has no file, and the text store and `LangiumDocuments` hold it under
|
|
66
|
+
* {@link canonicalUri}. The default treats every URI as loadable (returns it
|
|
64
67
|
* unchanged); a real-path policy returns the resolved file URI, or `undefined`
|
|
65
68
|
* for a not-yet-written path.
|
|
66
69
|
*
|
|
@@ -84,7 +87,9 @@ export interface DocumentUriPolicy {
|
|
|
84
87
|
/**
|
|
85
88
|
* Existence-aware resolution to the load URI, or `undefined` when there is
|
|
86
89
|
* no loadable content for `uri` (missing / synthetic). Callers that read the
|
|
87
|
-
* filesystem next use `undefined` to skip rather than attempt a doomed read
|
|
90
|
+
* filesystem next use `undefined` to skip rather than attempt a doomed read,
|
|
91
|
+
* and still look the URI up under {@link canonicalUri}: a document created
|
|
92
|
+
* and not yet saved is held there with no file behind it.
|
|
88
93
|
*/
|
|
89
94
|
loadUri(uri: URI | string): URI | undefined;
|
|
90
95
|
}
|
|
@@ -146,17 +151,21 @@ export class DefaultDocumentUriPolicy implements DocumentUriPolicy {
|
|
|
146
151
|
* The raw `realpath` syscall lives on the `FileSystemProvider`
|
|
147
152
|
* (`@hydranium/core/node`'s `DefaultFileSystemProvider`), not here — this policy
|
|
148
153
|
* is pure routing over that seam, so it carries no `node:fs` import and is
|
|
149
|
-
* browser-neutral. Both methods follow the *same* policy: `canonicalUri`
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
+
* browser-neutral. Both methods follow the *same* policy: `canonicalUri` keys a
|
|
155
|
+
* path that can't be resolved by the links it follows, where the provider has
|
|
156
|
+
* `resolveLinks`, else by its syntactic form (optimistic — a file that appears
|
|
157
|
+
* later canonicalises to the same key once present, also one reached through a
|
|
158
|
+
* link that pointed at nothing), while `loadUri` returns `undefined` for an
|
|
159
|
+
* absent path (honest about existence, so a caller about to read the
|
|
160
|
+
* filesystem skips it).
|
|
154
161
|
*
|
|
155
|
-
* If the
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* `
|
|
162
|
+
* If the provider for a URI's scheme has no `realpath` (in-memory / browser /
|
|
163
|
+
* empty), the framework's `FileSystemProviderRegistry` returns the URI
|
|
164
|
+
* unchanged and both methods answer as {@link DefaultDocumentUriPolicy} does. A
|
|
165
|
+
* slot bound to a provider without `realpath` degrades the same way: the
|
|
166
|
+
* `loadUri` ternary tests the *method's presence*, not its return, so
|
|
167
|
+
* `loadUri` returns `undefined` only when `realpath` is present and reports the
|
|
168
|
+
* path absent.
|
|
160
169
|
*/
|
|
161
170
|
export class RealpathDocumentUriPolicy extends DefaultDocumentUriPolicy {
|
|
162
171
|
protected readonly fs: RealpathCapableFileSystem;
|
|
@@ -168,9 +177,14 @@ export class RealpathDocumentUriPolicy extends DefaultDocumentUriPolicy {
|
|
|
168
177
|
|
|
169
178
|
override canonicalUri(uri: URI | string): CanonicalUri {
|
|
170
179
|
const parsed = UriUtils.toUri(uri);
|
|
171
|
-
|
|
172
|
-
//
|
|
173
|
-
//
|
|
180
|
+
// An absent path keys by the links it follows, so a file reached through
|
|
181
|
+
// a link keys the same before it exists and once it does; a provider
|
|
182
|
+
// without `resolveLinks`, or without `realpath`, keys it syntactically.
|
|
183
|
+
// `resolveLinks` alone where it exists: it resolves a present path as
|
|
184
|
+
// `realpath` does, and asking both would cost an absent path a second
|
|
185
|
+
// miss.
|
|
186
|
+
const real = parsed && (this.fs.resolveLinks ? this.fs.resolveLinks(parsed) : this.fs.realpath?.(parsed));
|
|
187
|
+
// Mint via `asCanonicalUri` once normalised.
|
|
174
188
|
return real ? asCanonicalUri(UriUtils.normalize(real)) : super.canonicalUri(uri);
|
|
175
189
|
}
|
|
176
190
|
|
|
@@ -0,0 +1,35 @@
|
|
|
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 URI } from '@hydranium/langium';
|
|
11
|
+
|
|
12
|
+
// Not re-exported from the workspace barrel: the framework's providers and
|
|
13
|
+
// the release handler share it, and it is no API of theirs.
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A missing-file error shaped as a Node file system raises it, with code
|
|
17
|
+
* `ENOENT` and the path: callers tell a missing file from any other failure by
|
|
18
|
+
* those two fields, whichever provider is bound. The release relies on it to
|
|
19
|
+
* tell a document gone meanwhile from any other failed rebuild.
|
|
20
|
+
*/
|
|
21
|
+
export function notFound(message: string, uri: URI): Error {
|
|
22
|
+
return Object.assign(new Error(message), { code: 'ENOENT', path: uri.fsPath });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether `err` reports that the file of `target` does not exist, as a Node
|
|
27
|
+
* file system and {@link notFound} do: code `ENOENT`, with `target`'s path. A
|
|
28
|
+
* missing file of another document is a different failure.
|
|
29
|
+
*/
|
|
30
|
+
export function isFileNotFound(err: unknown, target: URI): boolean {
|
|
31
|
+
if (typeof err !== 'object' || err === null || !('code' in err) || err.code !== 'ENOENT') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return !('path' in err) || err.path === target.fsPath;
|
|
35
|
+
}
|