@hydranium/core 1.0.0-next.32 → 1.0.0-next.321
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 +256 -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 +436 -282
- package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
- package/lib/documents/hydranium-text-documents.js +886 -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 +17 -0
- package/lib/langium/diagnostics/lsp-logger.d.ts.map +1 -1
- package/lib/langium/diagnostics/lsp-logger.js +68 -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 +283 -41
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
- package/lib/langium/document-builder/document-builder.js +448 -78
- 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/containment.d.ts +64 -0
- package/lib/langium/keys/containment.d.ts.map +1 -0
- package/lib/langium/keys/containment.js +53 -0
- package/lib/langium/keys/containment.js.map +1 -0
- package/lib/langium/keys/index.d.ts +1 -0
- package/lib/langium/keys/index.d.ts.map +1 -1
- package/lib/langium/keys/index.js +1 -0
- package/lib/langium/keys/index.js.map +1 -1
- package/lib/langium/keys/name-based-key-provider.d.ts +4 -0
- package/lib/langium/keys/name-based-key-provider.d.ts.map +1 -1
- package/lib/langium/keys/name-based-key-provider.js +4 -0
- 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 +455 -290
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +571 -458
- 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 +29 -11
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.js +37 -15
- 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 +41 -37
- package/lib/langium/scope/scope-extension-service.d.ts.map +1 -1
- package/lib/langium/scope/scope-extension-service.js +57 -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 +4 -0
- package/lib/langium/serialization/yaml-serializer.d.ts.map +1 -1
- package/lib/langium/serialization/yaml-serializer.js +4 -0
- 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 +423 -0
- package/lib/langium/trivia/comment-preserver.d.ts.map +1 -0
- package/lib/langium/trivia/comment-preserver.js +906 -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 +216 -10
- package/lib/langium/validation/document-validator.d.ts.map +1 -1
- package/lib/langium/validation/document-validator.js +353 -8
- 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 +113 -21
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.js +197 -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 +29 -5
- package/lib/locale/server-locale.d.ts.map +1 -1
- package/lib/locale/server-locale.js +12 -2
- 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/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 +4 -1
- package/lib/lsp/index.d.ts.map +1 -1
- package/lib/lsp/index.js +4 -1
- 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 +34 -1
- package/lib/lsp/semantic-token-provider.d.ts.map +1 -1
- package/lib/lsp/semantic-token-provider.js +55 -8
- 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 +11 -7
- package/lib/lsp/start-language-server.d.ts.map +1 -1
- package/lib/lsp/start-language-server.js +18 -7
- package/lib/lsp/start-language-server.js.map +1 -1
- package/lib/messages/carriers.d.ts +11 -6
- package/lib/messages/carriers.d.ts.map +1 -1
- package/lib/messages/carriers.js +14 -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/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 +39 -58
- 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 +467 -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 +1011 -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 +70 -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 +553 -78
- 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/keys/containment.ts +87 -0
- package/src/langium/keys/index.ts +1 -0
- package/src/langium/keys/name-based-key-provider.ts +4 -0
- package/src/langium/language-module.ts +49 -8
- package/src/langium/model-service/client-session.ts +718 -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 -486
- 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 +49 -16
- 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 +74 -59
- 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 +4 -0
- 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 +1100 -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 +411 -12
- 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 +224 -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 +31 -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/hydranium-document-update-handler.ts +285 -111
- package/src/lsp/index.ts +4 -1
- package/src/lsp/lsp-latency.ts +62 -0
- package/src/lsp/save-text-document.ts +63 -0
- package/src/lsp/semantic-token-provider.ts +74 -7
- package/src/lsp/shared-module.ts +4 -8
- package/src/lsp/start-language-server.ts +18 -7
- package/src/messages/carriers.ts +15 -7
- 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/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 +133 -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,
|
|
@@ -23,22 +28,33 @@ import {
|
|
|
23
28
|
type AstReflection,
|
|
24
29
|
DefaultDocumentValidator,
|
|
25
30
|
type DiagnosticInfo,
|
|
31
|
+
DocumentValidator,
|
|
26
32
|
type LangiumDocument,
|
|
27
33
|
type LangiumCoreServices,
|
|
34
|
+
type Lexer,
|
|
28
35
|
type ValidateSingleNodeOptions,
|
|
29
36
|
type ValidationOptions,
|
|
30
37
|
type ValidationSeverity
|
|
31
38
|
} from '@hydranium/langium';
|
|
32
39
|
import type { CancellationToken } from 'vscode-languageserver-protocol';
|
|
33
|
-
import
|
|
40
|
+
// A VALUE import, for `Diagnostic.getMessageString`: `message` is
|
|
41
|
+
// `string | MarkupContent` in LSP 3.17+, so upstream's own reader is what
|
|
42
|
+
// narrows it rather than a hand-rolled union check here.
|
|
43
|
+
import { Diagnostic } from 'vscode-languageserver-types';
|
|
34
44
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
35
45
|
import { isSyntheticNode } from '../workspace/synthetic.js';
|
|
36
46
|
import { isVirtualUri } from '../workspace/virtual-document.js';
|
|
37
47
|
|
|
38
48
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* {@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.
|
|
42
58
|
*
|
|
43
59
|
* `element` is optional because a document's diagnostics do not all come from
|
|
44
60
|
* this validator. {@link HydraniumDocumentValidator.toDiagnostic} always sets
|
|
@@ -53,7 +69,7 @@ import { isVirtualUri } from '../workspace/virtual-document.js';
|
|
|
53
69
|
* condition. Consumers therefore cast at the read, and the cast is sound only
|
|
54
70
|
* because this field is optional.
|
|
55
71
|
*/
|
|
56
|
-
export interface
|
|
72
|
+
export interface AstDiagnostic extends Diagnostic {
|
|
57
73
|
element?: string;
|
|
58
74
|
property?: string;
|
|
59
75
|
}
|
|
@@ -78,6 +94,157 @@ export const UNRESOLVED_REFERENCE = defineMessage(
|
|
|
78
94
|
"Could not resolve reference to {referenceType} named '{refText}'."
|
|
79
95
|
);
|
|
80
96
|
|
|
97
|
+
/**
|
|
98
|
+
* A character no token of the grammar can start with.
|
|
99
|
+
*
|
|
100
|
+
* **The English is byte-identical to CHEVROTAIN's
|
|
101
|
+
* `defaultLexerErrorProvider.buildUnexpectedCharactersMessage`, and must stay
|
|
102
|
+
* so** — one layer further out than {@link UNRESOLVED_REFERENCE}, whose sentence
|
|
103
|
+
* is Langium's. Langium words neither: `processLexingErrors` copies
|
|
104
|
+
* `lexerDiagnostic.message` through untouched, so the text an adopter sees today
|
|
105
|
+
* is produced two dependencies down and is the only thing this identity may
|
|
106
|
+
* claim to be. {@link HydraniumDocumentValidator.identifyLexingError} attaches
|
|
107
|
+
* it only when the two match exactly, which is also what keeps a custom lexer's
|
|
108
|
+
* own diagnostics — Langium admits any of them through `lexerReport` — from
|
|
109
|
+
* being mislabelled as this one.
|
|
110
|
+
*
|
|
111
|
+
* It exists because a lexing error is the FIRST message a user of a new language
|
|
112
|
+
* sees and the one an adopter cannot reach: every other diagnostic worth
|
|
113
|
+
* translating either carries an identity already or is raised by adopter code,
|
|
114
|
+
* while this one arrives with a Langium `data.code` naming a KIND and no
|
|
115
|
+
* parameters at all — so a catalogue had nothing to key on and nothing to
|
|
116
|
+
* interpolate.
|
|
117
|
+
*
|
|
118
|
+
* `skipped` rather than `length`, matching what the sentence says the number
|
|
119
|
+
* means: chevrotain reports how many characters the lexer discarded to recover,
|
|
120
|
+
* which for a single stray character is one and for a run of them is the run.
|
|
121
|
+
*/
|
|
122
|
+
export const UNEXPECTED_CHARACTER = defineMessage(
|
|
123
|
+
'hydranium/core/unexpected-character',
|
|
124
|
+
'unexpected character: ->{character}<- at offset: {offset}, skipped {skipped} characters.'
|
|
125
|
+
);
|
|
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
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Langium's own `data.code` values for a diagnostic that came out of the lexer.
|
|
235
|
+
*
|
|
236
|
+
* All four severities, not just the error one: `lexerReport` admits warnings and
|
|
237
|
+
* below, and a token builder that downgrades a stray character still produces
|
|
238
|
+
* the same sentence. Gating on the error code alone would leave the identity off
|
|
239
|
+
* a message that is word-for-word the one it names.
|
|
240
|
+
*/
|
|
241
|
+
const LEXING_CODES: ReadonlySet<unknown> = new Set([
|
|
242
|
+
DocumentValidator.LexingError,
|
|
243
|
+
DocumentValidator.LexingWarning,
|
|
244
|
+
DocumentValidator.LexingInfo,
|
|
245
|
+
DocumentValidator.LexingHint
|
|
246
|
+
]);
|
|
247
|
+
|
|
81
248
|
export interface DocumentValidatorOptions extends LogNameOptions {
|
|
82
249
|
/**
|
|
83
250
|
* Level at which the `validateDocument` timing line is emitted, or `'off'`
|
|
@@ -116,7 +283,7 @@ export interface DocumentValidatorOptions extends LogNameOptions {
|
|
|
116
283
|
* - **Skip-validation hook** via the virtual {@link shouldSkipValidation}
|
|
117
284
|
* predicate, which adopters override to compose additional skip reasons.
|
|
118
285
|
* - **Diagnostic mapping** to {@link TransferDiagnostic}-shaped
|
|
119
|
-
* {@link
|
|
286
|
+
* {@link AstDiagnostic}: every emitted diagnostic carries the AST
|
|
120
287
|
* node's path (built via Langium's `AstNodeLocator`) plus the optional
|
|
121
288
|
* offending property name.
|
|
122
289
|
* - **Optional timing wrap** on `validateDocument`, on by default.
|
|
@@ -125,6 +292,12 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
125
292
|
protected readonly tracer: Tracer;
|
|
126
293
|
protected readonly astNodeLocator: AstNodeLocator;
|
|
127
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[];
|
|
128
301
|
protected readonly logLevel: ObservableValue<LogThreshold>;
|
|
129
302
|
protected readonly logAfterMs: ObservableValue<number>;
|
|
130
303
|
protected readonly validateVirtualDocuments: ObservableValue<boolean>;
|
|
@@ -135,6 +308,7 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
135
308
|
this.tracer = services.shared.Tracer.for(options.logName ?? 'DocumentValidator').trace('instantiated');
|
|
136
309
|
this.astNodeLocator = services.workspace.AstNodeLocator;
|
|
137
310
|
this.reflection = services.shared.AstReflection;
|
|
311
|
+
this.lexer = services.parser.Lexer;
|
|
138
312
|
this.logLevel = ObservableValue.from(options.logLevel ?? 'debug');
|
|
139
313
|
this.logAfterMs = ObservableValue.from(options.logAfterMs ?? 20);
|
|
140
314
|
this.validateVirtualDocuments = ObservableValue.from(options.validateVirtualDocuments ?? false);
|
|
@@ -156,16 +330,239 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
156
330
|
}
|
|
157
331
|
const level = this.logLevel.value;
|
|
158
332
|
if (level === 'off') {
|
|
159
|
-
return
|
|
333
|
+
return this.validateAndIdentify(document, options, cancelToken);
|
|
160
334
|
}
|
|
161
335
|
// `level` is narrowed to `LogLevel` past the early-return.
|
|
162
336
|
return this.tracer
|
|
163
337
|
.withUri(document.uri.toString())
|
|
164
|
-
.time('validateDocument', () =>
|
|
338
|
+
.time('validateDocument', () => this.validateAndIdentify(document, options, cancelToken), level, {
|
|
165
339
|
logAfterMs: this.logAfterMs.value
|
|
166
340
|
});
|
|
167
341
|
}
|
|
168
342
|
|
|
343
|
+
/**
|
|
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.
|
|
354
|
+
*
|
|
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.
|
|
360
|
+
*
|
|
361
|
+
* Inside the timing span rather than around it, so the line accounts for the
|
|
362
|
+
* whole pass.
|
|
363
|
+
*/
|
|
364
|
+
protected async validateAndIdentify(
|
|
365
|
+
document: LangiumDocument,
|
|
366
|
+
options?: ValidationOptions,
|
|
367
|
+
cancelToken?: CancellationToken
|
|
368
|
+
): Promise<Diagnostic[]> {
|
|
369
|
+
const diagnostics = await super.validateDocument(document, options, cancelToken);
|
|
370
|
+
// Mapped in place over the array Langium built, rather than filtered and
|
|
371
|
+
// re-concatenated: the publish order is the diagnostic order and a
|
|
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.
|
|
375
|
+
for (let index = 0; index < diagnostics.length; index++) {
|
|
376
|
+
diagnostics[index] = this.identifyLexingError(document, diagnostics[index]);
|
|
377
|
+
diagnostics[index] = this.identifyParsingError(document, diagnostics[index]);
|
|
378
|
+
}
|
|
379
|
+
return diagnostics;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
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.
|
|
386
|
+
*
|
|
387
|
+
* The parameters come from the diagnostic's own RANGE, not from
|
|
388
|
+
* `parseResult.lexerErrors`. Both hold the same numbers, and the range is the
|
|
389
|
+
* one that needs no assumption about upstream: correlating the two lists
|
|
390
|
+
* would depend on Langium appending one diagnostic per lexer error in order,
|
|
391
|
+
* which is true today and is an internal of the method being wrapped.
|
|
392
|
+
*
|
|
393
|
+
* **The format-and-compare is the whole discriminator, and it validates the
|
|
394
|
+
* reconstruction as well as the identity.** A range that did not round-trip
|
|
395
|
+
* to the offset chevrotain reported would produce a different sentence and be
|
|
396
|
+
* declined, so a wrong parameter set can never be attached to a right-looking
|
|
397
|
+
* message.
|
|
398
|
+
*/
|
|
399
|
+
protected identifyLexingError(document: LangiumDocument, diagnostic: Diagnostic): Diagnostic {
|
|
400
|
+
const data = diagnostic.data as { code?: unknown } | undefined;
|
|
401
|
+
if (!LEXING_CODES.has(data?.code)) {
|
|
402
|
+
return diagnostic;
|
|
403
|
+
}
|
|
404
|
+
const text = document.textDocument;
|
|
405
|
+
const message = Diagnostic.getMessageString(diagnostic);
|
|
406
|
+
const offset = text.offsetAt(diagnostic.range.start);
|
|
407
|
+
const stray = {
|
|
408
|
+
character: text.getText().charAt(offset),
|
|
409
|
+
offset,
|
|
410
|
+
skipped: text.offsetAt(diagnostic.range.end) - offset
|
|
411
|
+
};
|
|
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) {
|
|
450
|
+
return diagnostic;
|
|
451
|
+
}
|
|
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;
|
|
564
|
+
}
|
|
565
|
+
|
|
169
566
|
/**
|
|
170
567
|
* Skip validation for a node **and its children** when
|
|
171
568
|
* {@link shouldSkipValidation} returns true.
|
|
@@ -277,7 +674,7 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
277
674
|
severity: ValidationSeverity,
|
|
278
675
|
message: string,
|
|
279
676
|
info: DiagnosticInfo<N, string>
|
|
280
|
-
):
|
|
677
|
+
): AstDiagnostic {
|
|
281
678
|
const base = super.toDiagnostic(severity, message, info);
|
|
282
679
|
const node = info.node;
|
|
283
680
|
if (!node) {
|
|
@@ -301,9 +698,11 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
301
698
|
*/
|
|
302
699
|
protected buildElementPath<N extends AstNode>(node: N, info: DiagnosticInfo<N, string>): string {
|
|
303
700
|
const directPath = this.astNodeLocator.getAstNodePath(node);
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
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) {
|
|
307
706
|
this.tracer.warn('Cannot create diagnostic element path: Unable to determine AST node path.');
|
|
308
707
|
return '';
|
|
309
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
|
+
}
|