@hydranium/core 1.0.0-next.25 → 1.0.0-next.251
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 +64 -82
- package/lib/documents/ast-document-manager.d.ts +219 -122
- package/lib/documents/ast-document-manager.d.ts.map +1 -1
- package/lib/documents/ast-document-manager.js +241 -130
- 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 +79 -0
- package/lib/documents/dirty-state-tracker.d.ts.map +1 -0
- package/lib/documents/dirty-state-tracker.js +69 -0
- package/lib/documents/dirty-state-tracker.js.map +1 -0
- package/lib/documents/document-release-handler.d.ts +179 -0
- package/lib/documents/document-release-handler.d.ts.map +1 -0
- package/lib/documents/document-release-handler.js +283 -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 +49 -0
- package/lib/documents/file-system-task-queue.d.ts.map +1 -0
- package/lib/documents/file-system-task-queue.js +34 -0
- package/lib/documents/file-system-task-queue.js.map +1 -0
- package/lib/documents/hydranium-text-documents.d.ts +399 -282
- package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
- package/lib/documents/hydranium-text-documents.js +816 -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 +218 -0
- package/lib/documents/language-client-shadow.d.ts.map +1 -0
- package/lib/documents/language-client-shadow.js +283 -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 +134 -0
- package/lib/documents/version-sync-service.d.ts.map +1 -0
- package/lib/documents/version-sync-service.js +171 -0
- package/lib/documents/version-sync-service.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -1
- package/lib/langium/ast-extension/ast-extension-service.d.ts.map +1 -1
- package/lib/langium/ast-extension/ast-extension-service.js.map +1 -1
- package/lib/langium/ast-extension/ast-node-builder.d.ts +32 -9
- package/lib/langium/ast-extension/ast-node-builder.d.ts.map +1 -1
- package/lib/langium/ast-extension/ast-node-builder.js +60 -22
- package/lib/langium/ast-extension/ast-node-builder.js.map +1 -1
- package/lib/langium/bootstrap.d.ts +23 -16
- package/lib/langium/bootstrap.d.ts.map +1 -1
- package/lib/langium/bootstrap.js +66 -28
- package/lib/langium/bootstrap.js.map +1 -1
- 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.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/hydranium-langium-profiler.d.ts.map +1 -1
- package/lib/langium/diagnostics/hydranium-langium-profiler.js.map +1 -1
- package/lib/langium/diagnostics/logger.d.ts +10 -3
- package/lib/langium/diagnostics/logger.d.ts.map +1 -1
- package/lib/langium/diagnostics/logger.js +12 -5
- 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 +57 -16
- 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 +32 -5
- package/lib/langium/document-builder/build-pipeline-integration.js.map +1 -1
- package/lib/langium/document-builder/build-session.d.ts.map +1 -1
- package/lib/langium/document-builder/build-session.js.map +1 -1
- package/lib/langium/document-builder/document-builder.d.ts +294 -33
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
- package/lib/langium/document-builder/document-builder.js +477 -61
- 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 +61 -19
- package/lib/langium/integration-services.d.ts.map +1 -1
- package/lib/langium/integration-services.js +10 -5
- package/lib/langium/integration-services.js.map +1 -1
- package/lib/langium/integrity/integrity-rule.d.ts +16 -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 +81 -24
- package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
- package/lib/langium/integrity/integrity-service.js +264 -57
- 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 +29 -4
- 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 +343 -0
- package/lib/langium/model-service/client-session.d.ts.map +1 -0
- package/lib/langium/model-service/client-session.js +411 -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 +61 -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 +432 -282
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +504 -438
- package/lib/langium/model-service/model-service.js.map +1 -1
- package/lib/langium/module.d.ts +150 -35
- package/lib/langium/module.d.ts.map +1 -1
- package/lib/langium/module.js +47 -35
- package/lib/langium/module.js.map +1 -1
- package/lib/langium/naming/name-provider.d.ts +25 -4
- package/lib/langium/naming/name-provider.d.ts.map +1 -1
- package/lib/langium/naming/name-provider.js +2 -1
- package/lib/langium/naming/name-provider.js.map +1 -1
- package/lib/langium/naming/name-separator-validation.d.ts +23 -0
- package/lib/langium/naming/name-separator-validation.d.ts.map +1 -1
- package/lib/langium/naming/name-separator-validation.js +30 -1
- package/lib/langium/naming/name-separator-validation.js.map +1 -1
- package/lib/langium/project/abstract-project-manager.d.ts.map +1 -1
- package/lib/langium/project/abstract-project-manager.js +9 -2
- 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 +30 -10
- package/lib/langium/residency/cst-residency-service.d.ts.map +1 -1
- package/lib/langium/residency/cst-residency-service.js +23 -57
- 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/hydranium-scope-computation.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-computation.js.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.d.ts +48 -13
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.js +56 -20
- package/lib/langium/scope/hydranium-scope-provider.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.map +1 -1
- package/lib/langium/scope/reference-candidate-provider.js.map +1 -1
- package/lib/langium/scope/scope-extension-service.d.ts.map +1 -1
- package/lib/langium/scope/scope-extension-service.js.map +1 -1
- package/lib/langium/serialization/abstract-serializer.d.ts +11 -20
- package/lib/langium/serialization/abstract-serializer.d.ts.map +1 -1
- package/lib/langium/serialization/abstract-serializer.js +12 -21
- package/lib/langium/serialization/abstract-serializer.js.map +1 -1
- package/lib/langium/serialization/json-serializer.d.ts +1 -1
- package/lib/langium/serialization/json-serializer.d.ts.map +1 -1
- package/lib/langium/serialization/json-serializer.js.map +1 -1
- package/lib/langium/serialization/yaml-serializer.d.ts.map +1 -1
- 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 +21 -6
- 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 +77 -26
- package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -1
- package/lib/langium/transfer/transfer-encoder.js +46 -24
- 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 +43 -0
- package/lib/langium/trivia/document-ending-preserver.d.ts.map +1 -0
- package/lib/langium/trivia/document-ending-preserver.js +48 -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 +50 -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.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 +280 -9
- package/lib/langium/validation/document-validator.d.ts.map +1 -1
- package/lib/langium/validation/document-validator.js +448 -5
- 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 +15 -10
- package/lib/langium/workspace/document-uri-policy.d.ts.map +1 -1
- package/lib/langium/workspace/document-uri-policy.js +7 -5
- 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 +135 -9
- package/lib/langium/workspace/file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/file-system-provider.js +93 -14
- package/lib/langium/workspace/file-system-provider.js.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +56 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.js +79 -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 +82 -9
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.js +128 -10
- package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts +26 -3
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.js +41 -15
- 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 +31 -2
- package/lib/langium/workspace/initialize-workspace.d.ts.map +1 -1
- package/lib/langium/workspace/initialize-workspace.js +13 -5
- package/lib/langium/workspace/initialize-workspace.js.map +1 -1
- package/lib/langium/workspace/langium-documents.d.ts +46 -4
- package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
- package/lib/langium/workspace/langium-documents.js +60 -5
- package/lib/langium/workspace/langium-documents.js.map +1 -1
- package/lib/langium/workspace/persistent-file-system-provider.d.ts +1 -8
- package/lib/langium/workspace/persistent-file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/persistent-file-system-provider.js +0 -7
- package/lib/langium/workspace/persistent-file-system-provider.js.map +1 -1
- package/lib/{documents → langium/workspace}/self-save-registry.d.ts +38 -7
- package/lib/langium/workspace/self-save-registry.d.ts.map +1 -0
- package/lib/{documents → langium/workspace}/self-save-registry.js +29 -16
- package/lib/langium/workspace/self-save-registry.js.map +1 -0
- package/lib/langium/workspace/virtual-document.d.ts +48 -15
- package/lib/langium/workspace/virtual-document.d.ts.map +1 -1
- package/lib/langium/workspace/virtual-document.js +78 -18
- package/lib/langium/workspace/virtual-document.js.map +1 -1
- package/lib/langium/workspace/write-lock-scope.d.ts +20 -10
- package/lib/langium/workspace/write-lock-scope.d.ts.map +1 -1
- package/lib/langium/workspace/write-lock-scope.js +12 -4
- package/lib/langium/workspace/write-lock-scope.js.map +1 -1
- package/lib/locale/index.d.ts +10 -0
- package/lib/locale/index.d.ts.map +1 -0
- package/lib/locale/index.js +10 -0
- package/lib/locale/index.js.map +1 -0
- package/lib/locale/server-locale.d.ts +73 -0
- package/lib/locale/server-locale.d.ts.map +1 -0
- package/lib/locale/server-locale.js +61 -0
- package/lib/locale/server-locale.js.map +1 -0
- 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 +92 -81
- package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
- package/lib/lsp/hydranium-document-update-handler.js +153 -99
- package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
- package/lib/lsp/index.d.ts +3 -1
- package/lib/lsp/index.d.ts.map +1 -1
- package/lib/lsp/index.js +3 -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/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 +8 -7
- package/lib/lsp/start-language-server.d.ts.map +1 -1
- package/lib/lsp/start-language-server.js +13 -7
- package/lib/lsp/start-language-server.js.map +1 -1
- package/lib/messages/carriers.d.ts +54 -0
- package/lib/messages/carriers.d.ts.map +1 -0
- package/lib/messages/carriers.js +62 -0
- package/lib/messages/carriers.js.map +1 -0
- package/lib/messages/index.d.ts +25 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +25 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/renderer.d.ts +142 -0
- package/lib/messages/renderer.d.ts.map +1 -0
- package/lib/messages/renderer.js +165 -0
- package/lib/messages/renderer.js.map +1 -0
- 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 +1 -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/measure-memory.d.ts.map +1 -1
- package/lib/node/measure-memory.js +1 -0
- package/lib/node/measure-memory.js.map +1 -1
- package/lib/node/memory-monitor.js.map +1 -1
- package/lib/node/node-file-system-provider.d.ts +41 -6
- package/lib/node/node-file-system-provider.d.ts.map +1 -1
- package/lib/node/node-file-system-provider.js +109 -49
- package/lib/node/node-file-system-provider.js.map +1 -1
- package/lib/node/profile-capture.d.ts +8 -2
- package/lib/node/profile-capture.d.ts.map +1 -1
- package/lib/node/profile-capture.js +1 -1
- 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 +52 -0
- package/lib/node/rename-over-open-readers.d.ts.map +1 -0
- package/lib/node/rename-over-open-readers.js +66 -0
- package/lib/node/rename-over-open-readers.js.map +1 -0
- package/lib/node/socket-launcher.d.ts +20 -4
- package/lib/node/socket-launcher.d.ts.map +1 -1
- package/lib/node/socket-launcher.js +5 -4
- package/lib/node/socket-launcher.js.map +1 -1
- package/lib/node/stdio-launcher.d.ts +6 -5
- package/lib/node/stdio-launcher.d.ts.map +1 -1
- package/lib/node/stdio-launcher.js +2 -2
- package/lib/node/stdio-launcher.js.map +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 +16 -4
- package/lib/testing/fake-document.d.ts.map +1 -1
- package/lib/testing/fake-document.js +18 -3
- 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 +14 -0
- package/lib/testing/make-noop-shared-services.d.ts.map +1 -1
- package/lib/testing/make-noop-shared-services.js +28 -2
- package/lib/testing/make-noop-shared-services.js.map +1 -1
- package/lib/testing/make-test-services.d.ts +72 -14
- package/lib/testing/make-test-services.d.ts.map +1 -1
- package/lib/testing/make-test-services.js +42 -10
- 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/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 +11 -3
- package/lib/testing/node/lsp-server-connection.d.ts.map +1 -1
- package/lib/testing/node/lsp-server-connection.js +43 -10
- 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 +14 -0
- package/lib/testing/node/spawned-server.d.ts.map +1 -1
- package/lib/testing/node/spawned-server.js +34 -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 +24 -8
- package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-capture.js +27 -6
- package/lib/testing/playwright/server-log-capture.js.map +1 -1
- package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-rename-reporter.js +10 -1
- package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -1
- package/lib/testing/run-update-pipeline.d.ts +4 -4
- package/lib/testing/run-update-pipeline.d.ts.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 +24 -65
- package/lib/testing/stub-ast-document-manager.js.map +1 -1
- package/lib/testing/stub-document-builder.d.ts +26 -11
- package/lib/testing/stub-document-builder.d.ts.map +1 -1
- package/lib/testing/stub-document-builder.js +78 -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 +115 -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 +7 -6
- package/lib/testing/stub-model-service.d.ts.map +1 -1
- package/lib/testing/stub-model-service.js +4 -4
- package/lib/testing/stub-model-service.js.map +1 -1
- package/lib/testing/stub-project-manager.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/util/connection-liveness.d.ts +7 -6
- package/lib/util/connection-liveness.d.ts.map +1 -1
- package/lib/util/connection-liveness.js +35 -14
- package/lib/util/connection-liveness.js.map +1 -1
- package/lib/util/environment.d.ts.map +1 -1
- package/lib/util/environment.js.map +1 -1
- package/lib/util/registry.d.ts.map +1 -1
- package/package.json +32 -48
- package/src/documents/ast-document-manager.ts +379 -231
- 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 +130 -0
- package/src/documents/document-release-handler.ts +365 -0
- package/src/documents/document-release-scheduler.ts +121 -0
- package/src/documents/file-system-task-queue.ts +68 -0
- package/src/documents/hydranium-text-documents.ts +931 -595
- package/src/documents/index.ts +10 -2
- package/src/documents/language-client-shadow.ts +451 -0
- package/src/documents/model-ledger.ts +66 -0
- package/src/documents/text-ledger.ts +112 -0
- package/src/documents/version-sync-service.ts +267 -0
- package/src/index.ts +8 -0
- package/src/langium/ast-extension/ast-node-builder.ts +66 -22
- package/src/langium/bootstrap.ts +66 -28
- 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/logger.ts +12 -5
- package/src/langium/diagnostics/lsp-logger.ts +59 -15
- package/src/langium/document-builder/build-pipeline-integration.ts +50 -5
- package/src/langium/document-builder/document-builder.ts +565 -59
- package/src/langium/integration-services.ts +83 -24
- package/src/langium/integrity/integrity-rule.ts +16 -8
- package/src/langium/integrity/integrity-service.ts +287 -62
- 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 +48 -7
- package/src/langium/model-service/client-session.ts +644 -0
- package/src/langium/model-service/index.ts +2 -0
- package/src/langium/model-service/model-events.ts +75 -0
- package/src/langium/model-service/model-service.ts +790 -468
- package/src/langium/module.ts +199 -64
- package/src/langium/naming/name-provider.ts +27 -5
- package/src/langium/naming/name-separator-validation.ts +34 -5
- package/src/langium/project/abstract-project-manager.ts +9 -1
- package/src/langium/project/project-change-event.ts +2 -2
- package/src/langium/residency/cst-residency-service.ts +45 -14
- package/src/langium/scope/hydranium-scope-provider.ts +60 -22
- package/src/langium/serialization/abstract-serializer.ts +13 -32
- package/src/langium/service-registry.ts +41 -2
- package/src/langium/shared-services.ts +21 -6
- package/src/langium/single-langium-copy.ts +42 -0
- package/src/langium/transfer/transfer-encoder.ts +104 -37
- package/src/langium/trivia/comment-preserver.ts +1100 -0
- package/src/langium/trivia/document-ending-preserver.ts +55 -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 +54 -0
- package/src/langium/trivia/trivia-service.ts +99 -0
- package/src/langium/update-rewrite/update-rewrite.ts +1 -1
- package/src/langium/validation/document-validator.ts +523 -10
- package/src/langium/validation/validation-contribution-collector.ts +10 -1
- package/src/langium/workspace/document-uri-policy.ts +15 -10
- package/src/langium/workspace/file-not-found.ts +35 -0
- package/src/langium/workspace/file-system-provider.ts +205 -17
- package/src/langium/workspace/hydranium-langium-document-factory.ts +117 -0
- package/src/langium/workspace/hydranium-workspace-lock.ts +86 -2
- package/src/langium/workspace/hydranium-workspace-manager.ts +154 -14
- package/src/langium/workspace/in-memory-file-system-provider.ts +48 -17
- package/src/langium/workspace/index.ts +1 -0
- package/src/langium/workspace/initialize-workspace.ts +43 -5
- package/src/langium/workspace/langium-documents.ts +75 -6
- package/src/langium/workspace/persistent-file-system-provider.ts +1 -8
- package/src/{documents → langium/workspace}/self-save-registry.ts +54 -15
- package/src/langium/workspace/virtual-document.ts +96 -19
- package/src/langium/workspace/write-lock-scope.ts +24 -11
- package/src/locale/index.ts +10 -0
- package/src/locale/server-locale.ts +86 -0
- 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 +187 -108
- package/src/lsp/index.ts +3 -1
- package/src/lsp/lsp-latency.ts +62 -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 +13 -7
- package/src/messages/carriers.ts +78 -0
- package/src/messages/index.ts +36 -0
- package/src/messages/renderer.ts +212 -0
- package/src/node/heap-ceiling.ts +108 -0
- package/src/node/index.ts +1 -1
- package/src/node/latency-from-env.ts +1 -1
- package/src/node/measure-memory.ts +1 -0
- package/src/node/node-file-system-provider.ts +124 -53
- package/src/node/profile-capture.ts +9 -3
- package/src/node/profiling-run.ts +30 -8
- package/src/node/rename-over-open-readers.ts +78 -0
- package/src/node/socket-launcher.ts +24 -8
- package/src/node/stdio-launcher.ts +8 -7
- package/src/testing/fake-document.ts +24 -5
- package/src/testing/index.ts +2 -1
- package/src/testing/langium-test-helpers.ts +1 -0
- package/src/testing/make-noop-shared-services.ts +50 -2
- package/src/testing/make-test-services.ts +125 -31
- package/src/testing/make-test-tracer.ts +26 -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 +66 -12
- package/src/testing/node/scratch-workspace.ts +10 -5
- package/src/testing/node/spawned-server.ts +36 -2
- 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 +45 -11
- package/src/testing/playwright/server-log-rename-reporter.ts +12 -1
- package/src/testing/run-update-pipeline.ts +4 -4
- package/src/testing/stub-ast-document-manager.ts +36 -138
- package/src/testing/stub-document-builder.ts +102 -18
- package/src/testing/stub-hydranium-text-documents.ts +165 -27
- package/src/testing/stub-langium-documents.ts +3 -2
- package/src/testing/stub-model-service.ts +9 -8
- 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 +1 -1
- package/src/util/connection-liveness.ts +37 -14
- package/src/util/environment.ts +9 -1
- 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.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/lsp/instrument-connection.ts +0 -66
- package/src/node/process-memory.ts +0 -299
|
@@ -6,87 +6,93 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type CanonicalUri, type
|
|
9
|
+
import { type CanonicalUri, type MaybeObservableValue, type MaybePromise, ObservableValue, type TransferElement, type TextVersion, type Tracer } from '@hydranium/protocol';
|
|
10
10
|
import { type AstNode, DocumentState, type LangiumDocument, type URI } from '@hydranium/langium';
|
|
11
|
+
import { type AstDiagnostic } from '../validation/document-validator.js';
|
|
11
12
|
import { type DocumentUriPolicy } from '../workspace/document-uri-policy.js';
|
|
12
|
-
import {
|
|
13
|
-
import { AstDocument
|
|
13
|
+
import { CancellationToken, Disposable } from 'vscode-languageserver';
|
|
14
|
+
import { AstDocument } from '../../documents/ast-document-manager.js';
|
|
14
15
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
16
|
+
import { type OpenOptions } from '../../documents/client-session-registry.js';
|
|
15
17
|
import { type ServerSharedServices } from '../module.js';
|
|
18
|
+
import { type ClientSession } from './client-session.js';
|
|
19
|
+
import { type ModelDeletedEvent, type ModelDirtyChangedEvent, type ModelEventFilter, type ModelPhaseFilter, type ModelReleasedEvent, type ModelSavedEvent, type ModelsBuiltEvent, type ModelUpdatedEvent } from './model-events.js';
|
|
20
|
+
/**
|
|
21
|
+
* The undo-stack entry for a server-authored write pushed to the editor.
|
|
22
|
+
*
|
|
23
|
+
* **A user-facing LABEL, not a log string**, which is easy to miss because it
|
|
24
|
+
* travels as an options field rather than as a message: LSP specifies
|
|
25
|
+
* `ApplyWorkspaceEditParams.label` as "presented in the user interface for
|
|
26
|
+
* example on an undo stack to undo the workspace edit". So a user who edits
|
|
27
|
+
* through a form or drags a diagram node reads this in their editor's undo menu
|
|
28
|
+
* — which is why it is rendered like any other message the server sends rather
|
|
29
|
+
* than left as the English literal it was.
|
|
30
|
+
*
|
|
31
|
+
* Parameterless deliberately. The obvious improvement is to name the document,
|
|
32
|
+
* and it is the wrong one: an undo menu is already grouped under the file, so
|
|
33
|
+
* the URI would be noise in the one place it is redundant.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MODEL_UPDATE_EDIT: import("@hydranium/protocol").MessageDefinition<"Update Model">;
|
|
16
36
|
/**
|
|
17
37
|
* Constructor options for {@link ModelService}. All fields are optional,
|
|
18
38
|
* and the defaults are the behaviour described on each one.
|
|
19
39
|
*/
|
|
20
40
|
export interface ModelServiceOptions extends LogNameOptions {
|
|
21
41
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
readonly slowUpdateWarnMs?: MaybeObservableValue<number>;
|
|
44
|
-
/**
|
|
45
|
-
* Serialise the facade's own build under the workspace WRITE lock, the way
|
|
46
|
-
* Langium's `DefaultDocumentUpdateHandler` dispatches its build. Default
|
|
47
|
-
* `true`.
|
|
48
|
-
*
|
|
49
|
-
* **Why it defaults on.** Unlocked, the facade's build races the LSP bridge's
|
|
50
|
-
* build of the same URI — both are legitimate (the bridge exists only under a
|
|
51
|
-
* `Connection`, so the facade stands in for it headless), but nothing
|
|
52
|
-
* serialises them, so both run a full validation pass and Langium appends the
|
|
53
|
-
* second onto the first. Every diagnostic is then duplicated, and the
|
|
54
|
-
* duplication compounds per rebuild. Serialised, Langium elides the second
|
|
55
|
-
* build entirely, so the redundant work goes too.
|
|
56
|
-
*
|
|
57
|
-
* **What `false` costs.** The facade's build is then unserialised and can run
|
|
58
|
-
* concurrently with the bridge's build of the same URI, so the affected
|
|
59
|
-
* documents are validated twice per write — double the validation work.
|
|
60
|
-
* Reported diagnostics stay correct even then, because
|
|
61
|
-
* `HydraniumDocumentBuilder.dedupeDiagnostics` collapses the byte-identical
|
|
62
|
-
* duplicates a repeated pass produces before any listener sees them; what this
|
|
63
|
-
* option removes is the wasted pass, not just its visible symptom.
|
|
64
|
-
*
|
|
65
|
-
* **What `false` buys.** `WorkspaceLock` is not reentrant. A caller that
|
|
66
|
-
* reaches `update` / `save` / `rebuild` while already holding the write lock —
|
|
67
|
-
* an integrity rule or build-phase pass that writes through this facade —
|
|
68
|
-
* deadlocks: acquiring the lock cancels the running holder, and the new
|
|
69
|
-
* acquisition then waits for that holder to release while the holder waits
|
|
70
|
-
* for this call. On `true` that shape is DETECTED and rejected with
|
|
71
|
-
* {@link ReentrantWriteLockError} rather than hanging, wherever a host
|
|
72
|
-
* installs a write-lock scope tracker (`@hydranium/core/node` does at entry
|
|
73
|
-
* load; see {@link isInsideWriteLock}). Setting `false` is the escape hatch
|
|
74
|
-
* for an adopter whose reentrant shape is unavoidable — nothing acquires the
|
|
75
|
-
* lock then, so there is nothing to be reentrant about; prefer it over
|
|
76
|
-
* unserialised builds only in that case.
|
|
42
|
+
* Let the facade's build run without the workspace write lock when its
|
|
43
|
+
* caller already holds it: an integrity rule or build-phase pass that
|
|
44
|
+
* writes back through a session's `update` / `save`, or calls `rebuild`.
|
|
45
|
+
* Default `false`.
|
|
46
|
+
*
|
|
47
|
+
* `WorkspaceLock` is not reentrant. Taking it from inside a holder cancels
|
|
48
|
+
* that holder and then waits for it to end, while the holder waits for this
|
|
49
|
+
* call, so neither completes. On `false` that call fails with
|
|
50
|
+
* {@link ReentrantWriteLockError} instead, wherever a host installs a
|
|
51
|
+
* write-lock scope tracker (`@hydranium/core/node` does at entry load); on
|
|
52
|
+
* `true` its build takes no lock. The wait after that build can still hang,
|
|
53
|
+
* because a document no build will carry is re-queued through the lock, and
|
|
54
|
+
* the re-queue waits for the holder to end.
|
|
55
|
+
*
|
|
56
|
+
* Every other facade build takes the lock on either value. Unlocked, it can
|
|
57
|
+
* overlap another build of the same document: both run a full validation
|
|
58
|
+
* pass that Langium appends, and a caller can be handed a version that an
|
|
59
|
+
* integrity repair still running in the other build then moves past. Without
|
|
60
|
+
* a tracker the two cases cannot be told apart (see
|
|
61
|
+
* {@link isWriteLockScopeInstalled}), so `true` builds without the lock every
|
|
62
|
+
* time and accepts both.
|
|
77
63
|
*
|
|
78
64
|
* Accepts a {@link MaybeObservableValue} so it can be bound to a setting and
|
|
79
65
|
* flipped without a restart.
|
|
80
66
|
*/
|
|
81
|
-
readonly
|
|
67
|
+
readonly allowReentrantBuilds?: MaybeObservableValue<boolean>;
|
|
68
|
+
}
|
|
69
|
+
/** One {@link ModelService.onModelUpdated} subscription; `uri` is canonical, absent for every document. */
|
|
70
|
+
export interface ModelUpdateSubscriber<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic> {
|
|
71
|
+
readonly uri?: CanonicalUri;
|
|
72
|
+
readonly listener: (event: ModelUpdatedEvent<TAst, TDiagnostic>) => void;
|
|
73
|
+
}
|
|
74
|
+
/** Options for a {@link DefaultModelService} wait on one document. */
|
|
75
|
+
export interface SyncedWaitOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Build a root parsed from text older than the store's at the call, and
|
|
78
|
+
* reject once that build, or one the builder re-queues, is given up. Without
|
|
79
|
+
* it, such a root is left to other builds, and a wait they never end stays
|
|
80
|
+
* pending until its token is cancelled.
|
|
81
|
+
*/
|
|
82
|
+
readonly sync?: boolean;
|
|
82
83
|
}
|
|
83
84
|
/**
|
|
85
|
+
* The seam every non-LSP head talks to: the data server, the GLSP head and an
|
|
86
|
+
* adopter's own services reach documents through this slot rather than through
|
|
87
|
+
* the workspace stores.
|
|
88
|
+
*
|
|
84
89
|
* In-process facade over the framework's document plumbing
|
|
85
90
|
* (`HydraniumTextDocuments`, `LangiumDocuments`,
|
|
86
|
-
* `DocumentBuilder`, `WritableFileSystemProvider`). Owns the
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* doesn't have to be re-implemented per
|
|
91
|
+
* `DocumentBuilder`, `WritableFileSystemProvider`). Owns the document
|
|
92
|
+
* lifecycle the data-server and GLSP heads delegate to — client sessions that
|
|
93
|
+
* open, update, save and close documents, the phase reads, and `ready` — so
|
|
94
|
+
* coordinating those primitives doesn't have to be re-implemented per head.
|
|
95
|
+
* Every open and write goes through a session from {@link createSession}.
|
|
90
96
|
*
|
|
91
97
|
* "Model" here means the parsed AST — distinct from the wire-shape
|
|
92
98
|
* `TransferDocument` in `@hydranium/protocol`.
|
|
@@ -96,9 +102,9 @@ export interface ModelServiceOptions extends LogNameOptions {
|
|
|
96
102
|
* Multiple in-process consumers want the same workspace-level
|
|
97
103
|
* operations:
|
|
98
104
|
* - The data-server head turns these into typed RPC methods.
|
|
99
|
-
* - The GLSP head uses the same lifecycle for diagram-driven edits
|
|
100
|
-
*
|
|
101
|
-
*
|
|
105
|
+
* - The GLSP head uses the same lifecycle for diagram-driven edits: GModel
|
|
106
|
+
* operation handlers write through the diagram's session and wait on phases
|
|
107
|
+
* before reading.
|
|
102
108
|
* - Server-internal callers (integrity service, ad-hoc bridges, tests)
|
|
103
109
|
* want the same operations without the wire serialisation step.
|
|
104
110
|
*
|
|
@@ -111,15 +117,16 @@ export interface ModelServiceOptions extends LogNameOptions {
|
|
|
111
117
|
*
|
|
112
118
|
* **Read-latest supersession**
|
|
113
119
|
*
|
|
114
|
-
*
|
|
115
|
-
* `DocumentBuilder.waitUntil` to wait for the integrity-settled
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* event. Adopters wanting strict
|
|
120
|
-
* with vN's snapshot specifically, log
|
|
121
|
-
*
|
|
122
|
-
*
|
|
120
|
+
* A session's default `update` and `save` use Langium's per-URI
|
|
121
|
+
* `DocumentBuilder.waitUntil` to wait for `Validated` (the integrity-settled
|
|
122
|
+
* landmark {@link IntegrityService.SettledState} when rebuilds do not
|
|
123
|
+
* validate), then read the post-build state. Concurrent in-process callers
|
|
124
|
+
* on the same URI all see the latest post-build snapshot — none deadlock
|
|
125
|
+
* waiting for a specific version's settled event. Adopters wanting strict
|
|
126
|
+
* version-matched semantics (resolve with vN's snapshot specifically, log
|
|
127
|
+
* "vN superseded by vM at vN+1") override
|
|
128
|
+
* `DefaultClientSession.updateDocument` to attach a phase-listener with
|
|
129
|
+
* explicit version checks; the framework default doesn't need it for safety.
|
|
123
130
|
*
|
|
124
131
|
* **Returns AST snapshots, not wire envelopes**
|
|
125
132
|
*
|
|
@@ -132,25 +139,159 @@ export interface ModelServiceOptions extends LogNameOptions {
|
|
|
132
139
|
* the injected `TransferEncoder` — symmetric with the
|
|
133
140
|
* `getModelDocument` envelope path.
|
|
134
141
|
*
|
|
135
|
-
* **Subscriptions** (
|
|
136
|
-
*
|
|
137
|
-
* `
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
142
|
+
* **Subscriptions** (`on*`) are how a head follows documents; it subscribes
|
|
143
|
+
* here rather than to the builder or the text store. Each takes a filter, and
|
|
144
|
+
* one without a `uri` hears every document.
|
|
145
|
+
*
|
|
146
|
+
* **Two families.** `waitFor*` only waits: it rejects for a URI with no
|
|
147
|
+
* document, and for a root behind the store's text it waits for whatever
|
|
148
|
+
* builds it next, so it never ends if nothing does. `ensureDocumentState` and
|
|
149
|
+
* the phase shorthands over it build a missing document, and build a root
|
|
150
|
+
* behind its text, rejecting when that build fails twice. Both re-queue a
|
|
151
|
+
* document the builder's last build left short of the state.
|
|
152
|
+
*
|
|
153
|
+
* Both resolve at the state with a root parsed from text no older than the
|
|
154
|
+
* store's version at the call; inside the write lock, at the state alone, since
|
|
155
|
+
* the build that would sync the document to that version cannot start until
|
|
156
|
+
* it is released.
|
|
157
|
+
*
|
|
158
|
+
* Do not await one inside a build phase listener: a browser host installs no
|
|
159
|
+
* write-lock scope, so the wait cannot tell it is inside a build and waits for
|
|
160
|
+
* one that cannot start. Nor inside a `WorkspaceLock.read`: the lock starts no
|
|
161
|
+
* write, the build included, while a read runs.
|
|
162
|
+
*
|
|
163
|
+
* **Diagnostics are typed `never` below `Validated`.** Validation is the last
|
|
164
|
+
* phase, so at any earlier landmark the array either is not yet computed or
|
|
165
|
+
* still holds the previous build's, and reading it would take stale results
|
|
166
|
+
* for fresh ones. A caller that needs diagnostics asks for {@link validated}.
|
|
167
|
+
*
|
|
168
|
+
* What the `never` buys, exactly: reading a field off an element is a compile
|
|
169
|
+
* error, and nothing can be appended. It does NOT stop a caller assigning an
|
|
170
|
+
* element to a typed variable, because `never` is assignable to everything — so
|
|
171
|
+
* this is a guard against reaching for diagnostics by accident, not a seal
|
|
172
|
+
* against doing it deliberately.
|
|
173
|
+
*
|
|
174
|
+
* The waits resolve at or ABOVE their target, so an already-validated document
|
|
175
|
+
* does carry usable diagnostics and the `never` over-forbids there. That
|
|
176
|
+
* direction is the safe one: the alternative permits stale reads silently. A
|
|
177
|
+
* member taking a phase as a PARAMETER returns `TDiagnostic`, and leaves them
|
|
178
|
+
* absent for a phase below `Validated`.
|
|
141
179
|
*
|
|
142
180
|
* **Generic parameters.**
|
|
143
181
|
* - `TAst` — the AST root type each consumer expects on the returned
|
|
144
182
|
* {@link AstDocument}. Constrained to {@link AstNode}.
|
|
145
|
-
* - `TDiagnostic` —
|
|
146
|
-
* `
|
|
147
|
-
*
|
|
183
|
+
* - `TDiagnostic` — the AST-layer diagnostic: whatever the build left on
|
|
184
|
+
* `LangiumDocument.diagnostics`, carried through on the returned
|
|
185
|
+
* {@link AstDocument}. Defaults to {@link AstDiagnostic}.
|
|
186
|
+
* **Not the `TransferEncoder`'s parameter of the same name**, which is
|
|
187
|
+
* that encoder's OUTPUT and so names the wire shape. This one names its
|
|
188
|
+
* input, and an adopter binds the two to different types.
|
|
189
|
+
* - `TTransfer` — transfer-model root a session's `update` / `save` accept
|
|
148
190
|
* args. Constrained to {@link TransferElement}. Defaults to the
|
|
149
191
|
* structural base.
|
|
150
192
|
*/
|
|
151
|
-
export
|
|
193
|
+
export interface ModelService<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic, TTransfer extends TransferElement = TransferElement> {
|
|
194
|
+
/**
|
|
195
|
+
* Resolves once the workspace has been initialised and its first build has
|
|
196
|
+
* completed — the gate every read should wait behind, since a document
|
|
197
|
+
* queried before it may be unbuilt and reach no phase.
|
|
198
|
+
*
|
|
199
|
+
* A property rather than a method, matching `ProjectManager.ready` and
|
|
200
|
+
* Langium's `WorkspaceManager.ready`. An implementation needing a stricter
|
|
201
|
+
* gate supplies a Promise that awaits its own concern as well.
|
|
202
|
+
*/
|
|
203
|
+
readonly ready: Promise<void>;
|
|
204
|
+
waitForDocumentState(uri: string, state: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
205
|
+
waitForDocumentSettled(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst, never>>;
|
|
206
|
+
waitForBuilderState(state: DocumentState, cancelToken?: CancellationToken): Promise<void>;
|
|
207
|
+
ensureDocumentState(uri: string, state?: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
208
|
+
rebuild(uri: string, state?: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
209
|
+
/**
|
|
210
|
+
* Throw where {@link rebuild} would reject as reentrant. A write calls it
|
|
211
|
+
* before applying its text: a text applied and then refused stays applied
|
|
212
|
+
* with no build to follow it.
|
|
213
|
+
*/
|
|
214
|
+
assertCanBuild(uri: string): void;
|
|
215
|
+
parsed(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst, never>>;
|
|
216
|
+
linked(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst, never>>;
|
|
217
|
+
settled(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst, never>>;
|
|
218
|
+
indexed(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst, never>>;
|
|
219
|
+
validated(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
220
|
+
isOpen(uri: string): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* The version the document at `uri` was opened at, which a client's write
|
|
223
|
+
* or an integrity repair steps past; `undefined` while it is not open.
|
|
224
|
+
*/
|
|
225
|
+
openedVersion(uri: string): TextVersion | undefined;
|
|
226
|
+
snapshot(uri: string): AstDocument<TAst, TDiagnostic> | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* The text a session's write of `model` to `uri` applies: a textual model
|
|
229
|
+
* as given, a structured one rewritten and serialised.
|
|
230
|
+
*/
|
|
231
|
+
modelToText(uri: string, model: TTransfer | string, cancelToken?: CancellationToken): Promise<string>;
|
|
232
|
+
getDocument(uri: string): LangiumDocument | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Fires as a document reaches the filter's phase, `Validated` by default.
|
|
235
|
+
* Listeners run inside the build, so one that throws is logged and the
|
|
236
|
+
* others still run.
|
|
237
|
+
*/
|
|
238
|
+
onModelUpdated(listener: (event: ModelUpdatedEvent<TAst, TDiagnostic>) => void, filter?: ModelPhaseFilter): Disposable;
|
|
239
|
+
/**
|
|
240
|
+
* Fires once per build that reaches the phase, with every document it
|
|
241
|
+
* carried there. A listener that throws is logged, as for {@link onModelUpdated}.
|
|
242
|
+
*/
|
|
243
|
+
onModelsBuilt(listener: (event: ModelsBuiltEvent) => void, filter?: Pick<ModelPhaseFilter, 'phase'>): Disposable;
|
|
244
|
+
/**
|
|
245
|
+
* Fires for every save, whichever client made it, as the store announces
|
|
246
|
+
* it. A document saved before its first build arrives as an empty envelope
|
|
247
|
+
* at `UNRECORDED_VERSION`, whose `root` is `undefined` despite its type.
|
|
248
|
+
*/
|
|
249
|
+
onModelSaved(listener: (event: ModelSavedEvent<TAst, TDiagnostic>) => void, filter?: ModelEventFilter): Disposable;
|
|
250
|
+
onModelDeleted(listener: (event: ModelDeletedEvent) => void, filter?: ModelEventFilter): Disposable;
|
|
251
|
+
/** Fires when a document's text starts or stops differing from its file. */
|
|
252
|
+
onDirtyChanged(listener: (event: ModelDirtyChangedEvent) => void, filter?: ModelEventFilter): Disposable;
|
|
253
|
+
/**
|
|
254
|
+
* Fires when the store releases a document no client has open any more.
|
|
255
|
+
* What the build keeps for it is up to the
|
|
256
|
+
* `DocumentReleaseHandler` slot; the default reverts it to disk, and that
|
|
257
|
+
* rebuild follows as an {@link onModelUpdated} event, unless a client opens
|
|
258
|
+
* the document first or its file is deleted.
|
|
259
|
+
*/
|
|
260
|
+
onModelReleased(listener: (event: ModelReleasedEvent) => void, filter?: ModelEventFilter): Disposable;
|
|
261
|
+
/** Fires when `filter.clientId` closes `filter.uri`, its session ending included. */
|
|
262
|
+
onClientClosed(listener: () => void, filter: {
|
|
263
|
+
readonly uri: string;
|
|
264
|
+
readonly clientId: string;
|
|
265
|
+
}): Disposable;
|
|
266
|
+
/**
|
|
267
|
+
* Start a client session, the only way to open and write documents through
|
|
268
|
+
* this service. Pass a `label` naming the participant; without one it is
|
|
269
|
+
* `session`. The id defaults to `label#` plus a random UUID; a fixed
|
|
270
|
+
* `clientId` is taken as given. Throws `ReservedClientIdError` when the id
|
|
271
|
+
* is reserved by the framework, and `DuplicateClientIdError` when it is
|
|
272
|
+
* held by another live session or has documents open under it as a client
|
|
273
|
+
* that is not a session.
|
|
274
|
+
*
|
|
275
|
+
* A `resumeToken` matching the one the live session under `clientId` was
|
|
276
|
+
* started with ends that session as lost first, so the documents it was
|
|
277
|
+
* last to hold keep their unsaved text for the new one. The token guards
|
|
278
|
+
* against taking over a session by accident, not against a peer: anyone who
|
|
279
|
+
* knows it can end the session.
|
|
280
|
+
*
|
|
281
|
+
* `TOpenOptions` types the options the session's `open` takes and its
|
|
282
|
+
* `openOptions` returns. The narrowing is an unchecked cast, and it holds
|
|
283
|
+
* only for the caller that started the session: a holder reached through
|
|
284
|
+
* {@link getSession} sees plain `OpenOptions`.
|
|
285
|
+
*/
|
|
286
|
+
createSession<TOpenOptions extends OpenOptions = OpenOptions>(label?: string, clientId?: string, options?: {
|
|
287
|
+
readonly resumeToken?: string;
|
|
288
|
+
}): ClientSession<TAst, TDiagnostic, TTransfer, TOpenOptions>;
|
|
289
|
+
/** The live session started under `clientId`, or `undefined` once it has ended or was never started. */
|
|
290
|
+
getSession(clientId: string): ClientSession<TAst, TDiagnostic, TTransfer> | undefined;
|
|
291
|
+
}
|
|
292
|
+
export declare class DefaultModelService<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic,
|
|
152
293
|
/**
|
|
153
|
-
* Structured payload
|
|
294
|
+
* Structured payload a session's `update` / `save` accept. Constrained to
|
|
154
295
|
* {@link TransferElement} — the minimal `{ readonly $type: string }`
|
|
155
296
|
* shape. Both transfer-model overlay roots (which extend
|
|
156
297
|
* `TransferElement` explicitly) and AST root types (which have
|
|
@@ -158,7 +299,7 @@ export declare class ModelService<TAst extends AstNode, TDiagnostic = TransferDi
|
|
|
158
299
|
* constraint, so in-process callers (e.g. GLSP state or an
|
|
159
300
|
* integrity service) that pass AST roots remain compatible.
|
|
160
301
|
*/
|
|
161
|
-
TTransfer extends TransferElement = TransferElement> {
|
|
302
|
+
TTransfer extends TransferElement = TransferElement> implements ModelService<TAst, TDiagnostic, TTransfer> {
|
|
162
303
|
protected readonly services: ServerSharedServices;
|
|
163
304
|
protected readonly tracer: Tracer;
|
|
164
305
|
/**
|
|
@@ -170,14 +311,8 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
170
311
|
* (see {@link DocumentUriPolicy}).
|
|
171
312
|
*/
|
|
172
313
|
protected readonly uriPolicy: DocumentUriPolicy;
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
* was not supplied (warn line + stopwatch disabled). Reads `.value` per
|
|
176
|
-
* update so a setting-bound threshold retunes without reconstruction.
|
|
177
|
-
*/
|
|
178
|
-
protected readonly slowUpdateWarn?: ObservableValue<number>;
|
|
179
|
-
/** See {@link ModelServiceOptions.serializeBuilds}. Defaults to `true`. */
|
|
180
|
-
protected readonly serializeBuilds: ObservableValue<boolean>;
|
|
314
|
+
/** See {@link ModelServiceOptions.allowReentrantBuilds}. Defaults to `false`. */
|
|
315
|
+
protected readonly allowReentrantBuilds: ObservableValue<boolean>;
|
|
181
316
|
/**
|
|
182
317
|
* Per-URI applyEdit coalescing: at most one in-flight `applyEditToLanguageClient`
|
|
183
318
|
* RPC per URI, newest text wins. A newer settle while the current RPC is in
|
|
@@ -186,6 +321,22 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
186
321
|
*/
|
|
187
322
|
protected readonly syncChains: Map<string, Promise<void>>;
|
|
188
323
|
protected readonly pendingSync: Map<string, string>;
|
|
324
|
+
/** The live sessions this service started, by client id, for {@link getSession}. */
|
|
325
|
+
protected readonly sessions: Map<string, ClientSession<TAst, TDiagnostic, TTransfer, object>>;
|
|
326
|
+
/**
|
|
327
|
+
* Drops an ended session from {@link sessions}. Subscribed by the first
|
|
328
|
+
* {@link createSession} rather than at construction, so a services tree with
|
|
329
|
+
* no text store, or one that knows nothing of sessions, still constructs
|
|
330
|
+
* this service.
|
|
331
|
+
*/
|
|
332
|
+
protected sessionCloseListener?: Disposable;
|
|
333
|
+
/** The token each live session was started with, by client id, for a takeover by {@link createSession}. */
|
|
334
|
+
protected readonly resumeTokens: Map<string, string>;
|
|
335
|
+
/**
|
|
336
|
+
* The {@link onModelUpdated} subscribers, by phase. One builder listener per
|
|
337
|
+
* phase serves them all, kept for the life of the service.
|
|
338
|
+
*/
|
|
339
|
+
protected readonly updateSubscribers: Map<DocumentState, Set<ModelUpdateSubscriber<TAst, TDiagnostic>>>;
|
|
189
340
|
/**
|
|
190
341
|
* Workspace-level readiness gate. Resolves when the framework has
|
|
191
342
|
* finished its first workspace build cycle and the `ModelService`
|
|
@@ -221,10 +372,12 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
221
372
|
readonly ready: Promise<void>;
|
|
222
373
|
constructor(services: ServerSharedServices, options?: ModelServiceOptions);
|
|
223
374
|
/**
|
|
224
|
-
* Wait for the document at `uri` to reach `state
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
375
|
+
* Wait for the document at `uri` to reach `state` with a root no older than
|
|
376
|
+
* the store's text at the call. Rejects if `uri` is not in the document
|
|
377
|
+
* registry. A root behind its text is not built: the wait lasts until
|
|
378
|
+
* something else builds it, so use {@link ensureDocumentState} where
|
|
379
|
+
* nothing may. Builds that keep failing leave the wait pending, to its
|
|
380
|
+
* cancellation token.
|
|
228
381
|
*
|
|
229
382
|
* Wrapped in a debug-level timing log via {@link Tracer.time} so
|
|
230
383
|
* slow per-URI waits surface in build telemetry; the URI is
|
|
@@ -235,10 +388,9 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
235
388
|
* Wait for the document at `uri` to reach the integrity-settled landmark
|
|
236
389
|
* ({@link IntegrityService.SettledState}) — the earliest phase at which the
|
|
237
390
|
* AST + serialised text are stable post-integrity. Convenience wrapper over
|
|
238
|
-
* {@link waitForDocumentState}
|
|
239
|
-
* case (e.g. settling a save). Pure wait — does not trigger a build.
|
|
391
|
+
* {@link waitForDocumentState}, and like it builds nothing behind its text.
|
|
240
392
|
*/
|
|
241
|
-
waitForDocumentSettled(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst,
|
|
393
|
+
waitForDocumentSettled(uri: string, cancelToken?: CancellationToken): Promise<AstDocument<TAst, never>>;
|
|
242
394
|
/**
|
|
243
395
|
* Internal wait core operating on an already-{@link CanonicalUri canonical}
|
|
244
396
|
* URI. The public string doors ({@link waitForDocumentState} /
|
|
@@ -248,8 +400,31 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
248
400
|
* the identity once instead of re-running the (filesystem-touching) `realpath`
|
|
249
401
|
* at every wait. The `CanonicalUri` parameter type enforces that — a raw
|
|
250
402
|
* `string` cannot be passed without minting through the URI policy.
|
|
403
|
+
*
|
|
404
|
+
* With `options.sync`, a root behind the store's text is built, as in
|
|
405
|
+
* {@link ensureDocumentState}; without it, the root is left to other builds,
|
|
406
|
+
* as in {@link waitForDocumentState}. Below `Validated` the envelope has no
|
|
407
|
+
* diagnostics: see {@link withoutDiagnostics}.
|
|
251
408
|
*/
|
|
252
|
-
protected waitForDocumentStateCanonical(uri: CanonicalUri, state: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
409
|
+
protected waitForDocumentStateCanonical(uri: CanonicalUri, state: DocumentState, cancelToken?: CancellationToken, options?: SyncedWaitOptions): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
410
|
+
/**
|
|
411
|
+
* Wait for `state` with a root parsed from text at `textVersion` or later. A
|
|
412
|
+
* root no factory recorded counts as synced, since no build records it.
|
|
413
|
+
* With `options.sync`, a root still behind is built through
|
|
414
|
+
* `VersionSyncService.syncTo`, and the wait rejects once that build, or one
|
|
415
|
+
* the builder re-queues to reach `state`, is given up. Without it, the wait
|
|
416
|
+
* lasts until another build parses the text, and stays pending when the
|
|
417
|
+
* builder gives up re-queuing the document.
|
|
418
|
+
*/
|
|
419
|
+
protected waitUntilSynced(uri: URI, state: DocumentState, textVersion: TextVersion | undefined, cancelToken?: CancellationToken, options?: SyncedWaitOptions): Promise<void>;
|
|
420
|
+
/**
|
|
421
|
+
* Resolves once a parse of `uri` has been recorded or a build has deleted
|
|
422
|
+
* it, rejecting with `OperationCancelled` when `cancelToken` is cancelled
|
|
423
|
+
* first, and with an error when `build`, the build requested for it, is
|
|
424
|
+
* given up. A `Parsed` phase listener cannot serve: a cancel right after the
|
|
425
|
+
* parse skips it, and the resumed build does not parse again.
|
|
426
|
+
*/
|
|
427
|
+
protected nextParseOrDeletion(uri: URI, cancelToken?: CancellationToken, build?: Promise<boolean>): Promise<void>;
|
|
253
428
|
/**
|
|
254
429
|
* Wait for the document builder to reach `state` across its currently-
|
|
255
430
|
* queued documents. Pure wait — does not trigger a build. Used by
|
|
@@ -264,31 +439,35 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
264
439
|
* Force a fresh build of the document at `uri` and wait for it to
|
|
265
440
|
* reach `state` (or the integrity-settled landmark
|
|
266
441
|
* {@link IntegrityService.SettledState} if omitted).
|
|
267
|
-
* Always
|
|
268
|
-
*
|
|
269
|
-
* you want to re-process from scratch.
|
|
442
|
+
* Always builds the document, whether or not it is already in the
|
|
443
|
+
* registry, in a build of its own or in one already scheduled that carries
|
|
444
|
+
* it — call this when you want to re-process from scratch.
|
|
270
445
|
*
|
|
271
|
-
* The facade is responsible for
|
|
272
|
-
* directly because Langium's `DefaultDocumentUpdateHandler.didChangeContent`
|
|
446
|
+
* The facade is responsible for requesting the build itself because Langium's `DefaultDocumentUpdateHandler.didChangeContent`
|
|
273
447
|
* (the standard text-document → builder bridge) only runs under an
|
|
274
448
|
* LSP `Connection`. Running headless the bridge never fires; the
|
|
275
449
|
* facade stands in for it on its own update path.
|
|
276
450
|
*
|
|
277
451
|
* Coexistence with an LSP head running on the same `DocumentBuilder` is
|
|
278
|
-
* fine
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
* and Langium appends the second set onto the first, duplicating every
|
|
285
|
-
* diagnostic.
|
|
286
|
-
* {@link ModelServiceOptions.
|
|
287
|
-
* non-reentrancy hazard
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
452
|
+
* fine: the LSP head builds from the LSP-driven event and the facade from
|
|
453
|
+
* its own RPC-driven event — both legitimate — and both go through
|
|
454
|
+
* `HydraniumDocumentBuilder.scheduleUpdate`, which serialises them under
|
|
455
|
+
* the workspace WRITE lock and lets the second share the first's build
|
|
456
|
+
* where that build carries it. Langium alone does not coalesce concurrent
|
|
457
|
+
* builds of one URI: two unserialised builds each run a full validation
|
|
458
|
+
* pass and Langium appends the second set onto the first, duplicating every
|
|
459
|
+
* diagnostic. A caller that already holds the lock builds without it only
|
|
460
|
+
* under {@link ModelServiceOptions.allowReentrantBuilds} — see there for the
|
|
461
|
+
* non-reentrancy hazard.
|
|
462
|
+
*
|
|
463
|
+
* An override calls the base before it awaits. Under an LSP connection the
|
|
464
|
+
* store's change event has already asked the update handler to build a
|
|
465
|
+
* session's write; an override whose await outlasts that build makes the
|
|
466
|
+
* base's request start a build of its own, so the write is built and
|
|
467
|
+
* delivered twice.
|
|
468
|
+
*
|
|
469
|
+
* Rejects when the build leaves no document for `uri`, as for a URI with
|
|
470
|
+
* neither a file nor text: the wait after it has nothing to wait on.
|
|
292
471
|
*
|
|
293
472
|
* Consumers wanting "give me this doc at state X, building only if
|
|
294
473
|
* needed" — use the per-state methods ({@link parsed} / {@link linked}
|
|
@@ -297,30 +476,36 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
297
476
|
rebuild(uri: string, state?: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
298
477
|
/**
|
|
299
478
|
* Internal build core operating on an already-{@link CanonicalUri canonical}
|
|
300
|
-
* URI — the build counterpart to {@link waitForDocumentStateCanonical}.
|
|
301
|
-
*
|
|
479
|
+
* URI — the build counterpart to {@link waitForDocumentStateCanonical}.
|
|
480
|
+
* Requests the build, then waits via the canonical wait core, so the
|
|
302
481
|
* identity is resolved once at the public door and neither sink re-runs the
|
|
303
482
|
* `realpath`. (`DocumentBuilder.update` still resolves each URI internally for
|
|
304
483
|
* directory flattening — that is the build's own existence-aware resolution,
|
|
305
484
|
* not a redundant identity canonicalisation.)
|
|
306
485
|
*/
|
|
307
486
|
protected rebuildCanonical(uri: CanonicalUri, state?: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
487
|
+
assertCanBuild(uri: string): void;
|
|
308
488
|
/**
|
|
309
489
|
* Per-state typed convenience methods. Each ensures the document at
|
|
310
490
|
* `uri` reaches the named phase and returns the AST envelope with
|
|
311
|
-
* the narrowest accurate diagnostics type for that phase
|
|
312
|
-
*
|
|
313
|
-
* registry) just waits via {@link waitForDocumentState}; cold path
|
|
314
|
-
* triggers a build via {@link rebuild}. Consumers do not need to
|
|
315
|
-
* know which path was taken.
|
|
491
|
+
* the narrowest accurate diagnostics type for that phase, building as
|
|
492
|
+
* {@link ensureDocumentState} does.
|
|
316
493
|
*
|
|
317
494
|
* Phase invariants encoded in the return type:
|
|
318
495
|
* - `parsed` / `linked` / `settled` / `indexed` return
|
|
319
|
-
* `AstDocument<TAst, never>` — diagnostics
|
|
320
|
-
*
|
|
496
|
+
* `AstDocument<TAst, never>` — no diagnostics have been computed at
|
|
497
|
+
* those phases.
|
|
321
498
|
* - `validated` returns `AstDocument<TAst, TDiagnostic>` — diagnostics
|
|
322
499
|
* are populated.
|
|
323
500
|
*
|
|
501
|
+
* **The `never` is enforced, not merely declared.** The wait underneath
|
|
502
|
+
* resolves at or ABOVE the requested state, so a document something else
|
|
503
|
+
* already carried past `Validated` would otherwise come back from
|
|
504
|
+
* `settled()` carrying a full diagnostics array typed `never`; these four
|
|
505
|
+
* strip it. An empty array here therefore means "this read does not report
|
|
506
|
+
* diagnostics", never "this document is clean" — call {@link validated}
|
|
507
|
+
* when the answer has to mean the second.
|
|
508
|
+
*
|
|
324
509
|
* `settled` is the integrity-overlay name for "all integrity rules
|
|
325
510
|
* have fired"; it maps to {@link IntegrityService.SettledState} (which
|
|
326
511
|
* equals `DocumentState.IndexedReferences`), but the dedicated method
|
|
@@ -335,18 +520,13 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
335
520
|
/**
|
|
336
521
|
* Ensure the document at `uri` reaches `state` (or the integrity-settled
|
|
337
522
|
* landmark {@link IntegrityService.SettledState} if omitted) and return its
|
|
338
|
-
* AST envelope.
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* document. Also pairs with {@link waitForDocumentState} — the verb
|
|
346
|
-
* difference (`ensure` vs `waitFor`) signals the side-effect
|
|
347
|
-
* difference. The per-state convenience methods (`parsed` / `linked`
|
|
348
|
-
* / `settled` / `indexed` / `validated`) all delegate here with an
|
|
349
|
-
* explicit phase.
|
|
523
|
+
* AST envelope, with a root no older than the store's text at the call.
|
|
524
|
+
* A document not in `LangiumDocuments` is built via {@link rebuild}; a
|
|
525
|
+
* loaded one whose root is behind its text is built through
|
|
526
|
+
* `VersionSyncService.syncTo`. Until `state` is reached, the call rejects
|
|
527
|
+
* once that build, or one the builder re-queues, has failed twice, or the
|
|
528
|
+
* builder stops re-queuing the document. A loaded, current document is only
|
|
529
|
+
* awaited.
|
|
350
530
|
*/
|
|
351
531
|
ensureDocumentState(uri: string, state?: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
352
532
|
/**
|
|
@@ -361,80 +541,45 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
361
541
|
*/
|
|
362
542
|
protected ensureDocumentStateCanonical(uri: CanonicalUri, state?: DocumentState, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
363
543
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* structured), pushed into the multi-client text-document store with
|
|
367
|
-
* a fresh version, drives a build to the target phase, and returns
|
|
368
|
-
* the post-build AST snapshot.
|
|
369
|
-
*
|
|
370
|
-
* **Read-latest supersession**: concurrent callers on the same URI
|
|
371
|
-
* all see the same post-build state once `waitUntil` resolves; none
|
|
372
|
-
* deadlock waiting for a specific version's settled event. The
|
|
373
|
-
* framework emits a post-resolution `debug` log line distinguishing
|
|
374
|
-
* "vN ready" from "vN ready at vM (superseded)" so callers can
|
|
375
|
-
* observe when their write was overtaken by a newer one before
|
|
376
|
-
* settling — purely observability, doesn't change resolution
|
|
377
|
-
* semantics. Adopters wanting version-matched resolution (resolve
|
|
378
|
-
* with vN's specific settled snapshot, intermediate-phase
|
|
379
|
-
* observability, slow-warn / hard-timeout behaviour) override this
|
|
380
|
-
* method.
|
|
381
|
-
*/
|
|
382
|
-
update(args: TransferUpdateArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
383
|
-
/**
|
|
384
|
-
* Persist `uri` to disk. Same content-change + settled-phase flow as
|
|
385
|
-
* {@link update}, then writes via the
|
|
386
|
-
* `WritableFileSystemProvider` and notifies the multi-client
|
|
387
|
-
* text-document store of the save (so any open LSP-side editor sees
|
|
388
|
-
* the `onDidSave` event regardless of who originated the persist).
|
|
389
|
-
*
|
|
390
|
-
* Returns the post-save AST snapshot.
|
|
391
|
-
*/
|
|
392
|
-
save(args: TransferSaveArgs<TTransfer>, cancelToken?: CancellationToken): Promise<AstDocument<TAst, TDiagnostic>>;
|
|
393
|
-
/**
|
|
394
|
-
* Wait for the document at `uri` to reach the integrity-settled landmark and
|
|
544
|
+
* Wait for the document at `uri` to reach the integrity-settled landmark,
|
|
545
|
+
* building a root behind its text as {@link ensureDocumentState} does, and
|
|
395
546
|
* drain any in-flight write-path applyEdit sync chain (see {@link syncChains})
|
|
396
547
|
* so every language client reflects the latest content before a save returns.
|
|
397
548
|
* No-op tail for headless adopters — `syncChains` is empty without an LSP
|
|
398
549
|
* client. Bounded by {@link SAVE_SETTLE_TIMEOUT_MS} so a hung build, or an
|
|
399
|
-
* applyEdit reverse-RPC deadlock, can't freeze the caller; on timeout
|
|
400
|
-
* a warning and returns rather than throwing.
|
|
550
|
+
* applyEdit reverse-RPC deadlock, can't freeze the caller; on timeout or a
|
|
551
|
+
* failed wait it logs a warning and returns rather than throwing.
|
|
401
552
|
*
|
|
402
553
|
* Adopters with a save flow that must converge editor + disk before returning
|
|
403
554
|
* (e.g. a dual form/code editor that would otherwise show a content-conflict
|
|
404
555
|
* dialog on rapid save) call this after their `save`.
|
|
405
556
|
*/
|
|
406
557
|
protected settleSave(uri: string, cancelToken?: CancellationToken): Promise<void>;
|
|
407
|
-
/**
|
|
408
|
-
* Open the document at `args.uri` on behalf of `args.clientId`.
|
|
409
|
-
* Multi-client: each (uri, clientId) pair is tracked as one
|
|
410
|
-
* registration; the underlying document stays open until the last
|
|
411
|
-
* client closes it. If `args.text` is omitted the document content
|
|
412
|
-
* is read from the `FileSystemProvider`.
|
|
413
|
-
*
|
|
414
|
-
* Returns a {@link Disposable} that closes the registration when
|
|
415
|
-
* disposed — useful for `using` blocks and shutdown cleanup.
|
|
416
|
-
*
|
|
417
|
-
* Delegates to the framework-bound
|
|
418
|
-
* `services.workspace.AstDocumentManager`. Adopter subclasses with
|
|
419
|
-
* extra open-time behaviour (logging, sync-chain bootstrapping)
|
|
420
|
-
* override on their `ModelService` subclass and call `super.open`.
|
|
421
|
-
*
|
|
422
|
-
* The open path does not thread cancellation: `AstDocumentManager.open`
|
|
423
|
-
* and the filesystem read behind it take no token, so a cancelled caller
|
|
424
|
-
* still completes the open.
|
|
425
|
-
*/
|
|
426
|
-
open(args: OpenModelArgs): Promise<Disposable>;
|
|
427
|
-
/**
|
|
428
|
-
* Close the document at `args.uri` for `args.clientId`. Counterpart
|
|
429
|
-
* to {@link open}; the underlying document stays open until every
|
|
430
|
-
* registered client has closed.
|
|
431
|
-
*/
|
|
432
|
-
close(args: CloseModelArgs): Promise<void>;
|
|
433
558
|
/**
|
|
434
559
|
* True when the document at `uri` is currently open for at least one
|
|
435
560
|
* client. Pure read; no side effects.
|
|
436
561
|
*/
|
|
437
562
|
isOpen(uri: string): boolean;
|
|
563
|
+
openedVersion(uri: string): TextVersion | undefined;
|
|
564
|
+
/**
|
|
565
|
+
* Snapshot of `uri` as it stands RIGHT NOW — the synchronous sibling of the
|
|
566
|
+
* phase reads, which all wait. `undefined` when no document is registered,
|
|
567
|
+
* or only the builder's placeholder for one its build has not parsed yet:
|
|
568
|
+
* that root is no parse of any text, and its version gates no write.
|
|
569
|
+
*
|
|
570
|
+
* **This is what a writer wants, and {@link getDocument} is not.** The
|
|
571
|
+
* envelope's `version` is copied by value at projection time, so it cannot
|
|
572
|
+
* move afterwards; a version read off the live document at write time is
|
|
573
|
+
* whatever the server is at *now*, which is the number an optimistic gate is
|
|
574
|
+
* about to compare it against.
|
|
575
|
+
*
|
|
576
|
+
* Diagnostics only from a document that has reached `Validated`, and absent
|
|
577
|
+
* otherwise. Unlike the phase reads this one names no phase, so
|
|
578
|
+
* the state it finds is the only thing that can say whether the array
|
|
579
|
+
* describes the content being handed back or whatever an earlier build left.
|
|
580
|
+
* A caller that needs them unconditionally waits, via {@link validated}.
|
|
581
|
+
*/
|
|
582
|
+
snapshot(uri: string): AstDocument<TAst, TDiagnostic> | undefined;
|
|
438
583
|
/**
|
|
439
584
|
* The built {@link LangiumDocument} for `uri`, looked up by canonical identity —
|
|
440
585
|
* the synchronous, phase-agnostic sibling of {@link ensureDocumentState} /
|
|
@@ -443,24 +588,43 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
443
588
|
* into `LangiumDocuments` directly: a symlinked / `..` / case-divergent URI
|
|
444
589
|
* still resolves to the one document the build keys by its real path. Returns
|
|
445
590
|
* `undefined` if no document is registered for `uri`.
|
|
591
|
+
*
|
|
592
|
+
* **Live, so do not take a base version off it.** `textDocument` is the
|
|
593
|
+
* store's own object rather than a copy, so `.version` read here answers for
|
|
594
|
+
* the moment of the READ, not the moment of the earlier content — pass it to
|
|
595
|
+
* a write and the server compares its current version against itself, the
|
|
596
|
+
* gate passes unconditionally, and a concurrent edit is overwritten with
|
|
597
|
+
* nothing logged. Use {@link snapshot} for that, or a phase read.
|
|
446
598
|
*/
|
|
447
599
|
getDocument(uri: string): LangiumDocument | undefined;
|
|
600
|
+
createSession<TOpenOptions extends OpenOptions = OpenOptions>(label?: string, clientId?: string, options?: {
|
|
601
|
+
readonly resumeToken?: string;
|
|
602
|
+
}): ClientSession<TAst, TDiagnostic, TTransfer, TOpenOptions>;
|
|
603
|
+
getSession(clientId: string): ClientSession<TAst, TDiagnostic, TTransfer> | undefined;
|
|
604
|
+
/**
|
|
605
|
+
* Convert a structured-or-textual `model` payload to its textual form.
|
|
606
|
+
*
|
|
607
|
+
* Textual payloads (LSP / pre-serialised callers) pass through untouched.
|
|
608
|
+
* Structured payloads run the per-language `UpdateRewriteService` chain
|
|
609
|
+
* (transfer-model transforms; diff-aware rewrites see the previous AST root),
|
|
610
|
+
* then serialise. The chain is the single transfer-model-transform seam — a
|
|
611
|
+
* unary normalisation is just a rewrite that ignores `previous`, as
|
|
612
|
+
* `NormalizeEmptyStringsContribution` does. The chain is empty by
|
|
613
|
+
* default, so this is a no-op for adopters that register none.
|
|
614
|
+
*/
|
|
615
|
+
modelToText(uri: string, model: TTransfer | string, cancelToken?: CancellationToken): Promise<string>;
|
|
448
616
|
/**
|
|
449
617
|
* Mirror a server-side change of `document` back to the LSP textual language
|
|
450
618
|
* client, run per document as it reaches the post-integrity settled phase.
|
|
451
619
|
* The single framework caller of
|
|
452
|
-
* `HydraniumTextDocuments.applyEditToLanguageClient
|
|
453
|
-
* `HydraniumTextDocuments.stagePendingContent`.
|
|
454
|
-
*
|
|
455
|
-
* Routes to one of two mechanisms by language-client registration, because
|
|
456
|
-
* an open and a closed document answer different questions:
|
|
620
|
+
* `HydraniumTextDocuments.applyEditToLanguageClient`.
|
|
457
621
|
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
622
|
+
* Only a document open in the language client is mirrored, through
|
|
623
|
+
* {@link syncOpenDocument}, routed purely by **content**. A document open
|
|
624
|
+
* only in another client needs nothing: a language client opening it joins
|
|
625
|
+
* the existing entry and is refreshed from the store. A session writes only
|
|
626
|
+
* what it has open, so no session edit of a closed document waits here for
|
|
627
|
+
* the language client's next open.
|
|
464
628
|
*
|
|
465
629
|
* The decision is **re-derived from the current settled state every time** (it
|
|
466
630
|
* is not a one-shot enrolment), which is what makes it self-healing: a doc
|
|
@@ -481,35 +645,6 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
481
645
|
* author-based skip is needed.
|
|
482
646
|
*/
|
|
483
647
|
protected syncOpenDocument(uri: string, text: string): void;
|
|
484
|
-
/**
|
|
485
|
-
* Stage the settled text of a document closed in the language client so the
|
|
486
|
-
* eventual first `didOpen` sees this in-memory text instead of stale disk —
|
|
487
|
-
* but only for a {@link isNonLanguageClientEdit genuine non-language-client edit}.
|
|
488
|
-
* A document rebuilt by an internal build is skipped, leaving disk authoritative
|
|
489
|
-
* on the next open.
|
|
490
|
-
*/
|
|
491
|
-
protected stageClosedDocument(document: LangiumDocument): void;
|
|
492
|
-
/**
|
|
493
|
-
* Whether `document`'s settled state is a genuine edit by a client *other than
|
|
494
|
-
* the language client* — a write a form / GLSP / integrity client actually made.
|
|
495
|
-
* Excludes two non-edits: the **language client** itself (the LSP/Monaco text
|
|
496
|
-
* client — it already holds its own edits, and the staging here exists to feed
|
|
497
|
-
* it) and an **internal build** (workspace startup, a cascade relink, a
|
|
498
|
-
* `didClose`-reload). This is the gate for {@link stageClosedDocument}: staging
|
|
499
|
-
* an internal build would
|
|
500
|
-
* (a) pre-stage every file on boot and (b) re-stage discarded content after
|
|
501
|
-
* close (e.g. a disposing GLSP session's debounced submit firing after close),
|
|
502
|
-
* which then shadows clean disk on the next open.
|
|
503
|
-
*
|
|
504
|
-
* The signal is "a known client other than the language client authored this
|
|
505
|
-
* version **and** the URI was in the last build's changed set
|
|
506
|
-
* (`isDirectChange`)". A framework-internal rebuild reports no author
|
|
507
|
-
* (`getAuthor` → `undefined`), so it fails `hasKnownAuthor` without comparing
|
|
508
|
-
* against a sentinel. This is NOT redundant with content/registration — it
|
|
509
|
-
* distinguishes "client edited" from "framework rebuilt", which neither the
|
|
510
|
-
* shadow nor `isDirectChange` alone can.
|
|
511
|
-
*/
|
|
512
|
-
protected isNonLanguageClientEdit(document: LangiumDocument): boolean;
|
|
513
648
|
/**
|
|
514
649
|
* Enqueue a sync to the language client. The pending slot per URI holds only
|
|
515
650
|
* the latest text: if a newer settle fires while the current RPC is in
|
|
@@ -518,33 +653,36 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
518
653
|
* per URI so the shadow never drifts from Monaco.
|
|
519
654
|
*/
|
|
520
655
|
protected queueSync(uri: string, text: string): void;
|
|
521
|
-
protected drainSyncQueue(uri: string): Promise<void>;
|
|
522
|
-
/**
|
|
523
|
-
* Subscribe to AST-snapshot updates for `uri`. Fires after each
|
|
524
|
-
* rebuild that reaches the target phase. Delegates to the
|
|
525
|
-
* `HydraniumTextDocuments` — single listener registration shared with
|
|
526
|
-
* any direct `HydraniumTextDocuments.onUpdate` subscriber, so the same
|
|
527
|
-
* underlying `DocumentBuilder.onDocumentPhase` listener serves both
|
|
528
|
-
* call paths. `sourceClientId` is resolved from the multi-client
|
|
529
|
-
* author history; reason discrimination follows the manager's own
|
|
530
|
-
* `lastUpdate` snapshot (see `AstDocumentManager.onUpdate`).
|
|
531
|
-
*/
|
|
532
|
-
onModelUpdated(uri: string, listener: (event: AstDocumentUpdatedEvent<TAst, TDiagnostic>) => void): Disposable;
|
|
533
656
|
/**
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
* the
|
|
539
|
-
*
|
|
540
|
-
|
|
541
|
-
onModelSaved(uri: string, listener: (event: AstDocumentSavedEvent<TAst, TDiagnostic>) => void): Disposable;
|
|
542
|
-
/**
|
|
543
|
-
* Subscribe to the `(uri, clientId)` close event. Delegates to the
|
|
544
|
-
* manager so the listener registry is shared with any direct
|
|
545
|
-
* `HydraniumTextDocuments.onClientClosed` subscriber.
|
|
657
|
+
* The undo-stack label for a server-authored write, in the locale the server
|
|
658
|
+
* was handed at init.
|
|
659
|
+
*
|
|
660
|
+
* One method rather than the literal at each `applyEdit`, because the two
|
|
661
|
+
* call sites are the same edit — a push and its full-replace retry — and an
|
|
662
|
+
* undo menu showing two different words for one operation would read as two
|
|
663
|
+
* operations.
|
|
546
664
|
*/
|
|
547
|
-
|
|
665
|
+
protected editLabel(): string;
|
|
666
|
+
protected drainSyncQueue(uri: string): Promise<void>;
|
|
667
|
+
onModelUpdated(listener: (event: ModelUpdatedEvent<TAst, TDiagnostic>) => void, filter?: ModelPhaseFilter): Disposable;
|
|
668
|
+
onModelsBuilt(listener: (event: ModelsBuiltEvent) => void, filter?: Pick<ModelPhaseFilter, 'phase'>): Disposable;
|
|
669
|
+
onModelSaved(listener: (event: ModelSavedEvent<TAst, TDiagnostic>) => void, filter?: ModelEventFilter): Disposable;
|
|
670
|
+
onModelDeleted(listener: (event: ModelDeletedEvent) => void, filter?: ModelEventFilter): Disposable;
|
|
671
|
+
onDirtyChanged(listener: (event: ModelDirtyChangedEvent) => void, filter?: ModelEventFilter): Disposable;
|
|
672
|
+
onModelReleased(listener: (event: ModelReleasedEvent) => void, filter?: ModelEventFilter): Disposable;
|
|
673
|
+
onClientClosed(listener: () => void, filter: {
|
|
674
|
+
readonly uri: string;
|
|
675
|
+
readonly clientId: string;
|
|
676
|
+
}): Disposable;
|
|
677
|
+
protected filterUri(filter: ModelEventFilter): CanonicalUri | undefined;
|
|
678
|
+
protected matches(target: CanonicalUri | undefined, uri: CanonicalUri): boolean;
|
|
679
|
+
/**
|
|
680
|
+
* Hand every subscriber of `phase` for `document` one event, built once, so
|
|
681
|
+
* all of them see the same attribution. Built inside the build's listener
|
|
682
|
+
* and handed out without an await: after one, another build can have reset
|
|
683
|
+
* the document.
|
|
684
|
+
*/
|
|
685
|
+
protected deliverUpdate(phase: DocumentState, subscribers: ReadonlySet<ModelUpdateSubscriber<TAst, TDiagnostic>>, document: LangiumDocument, cancelToken: CancellationToken): void;
|
|
548
686
|
/**
|
|
549
687
|
* Serialise a transfer-model root via the language-specific
|
|
550
688
|
* `Serializer` bound at `services.serializer.Serializer`,
|
|
@@ -556,28 +694,22 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
556
694
|
* Adopters whose serializer call shape differs (custom service
|
|
557
695
|
* names, generator-driven YAML pretty printers, etc.) override this
|
|
558
696
|
* method. Routes through `Serializer.serializeTransfer` because
|
|
559
|
-
* `
|
|
697
|
+
* a session's `update` / `save` always receive a
|
|
560
698
|
* transfer-model shape (cross-references as plain strings) from
|
|
561
699
|
* adopter callers — the AST-shape entry point is `serializeAst`.
|
|
562
700
|
*
|
|
563
701
|
* Returns {@link MaybePromise} so adopter `Serializer` overrides can be
|
|
564
702
|
* async (remote schema lookup, external canonical-value resolution); the
|
|
565
|
-
* single caller ({@link modelToText}
|
|
703
|
+
* single caller ({@link modelToText}) is already `async`,
|
|
566
704
|
* so a naive `await` covers both branches without extra ceremony.
|
|
567
705
|
*/
|
|
568
706
|
protected serialize(uri: string, root: TTransfer): MaybePromise<string>;
|
|
569
707
|
/**
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
* Structured payloads run the per-language `UpdateRewriteService` chain
|
|
574
|
-
* (transfer-model transforms; diff-aware rewrites see the previous AST root),
|
|
575
|
-
* then serialise. The chain is the single transfer-model-transform seam — a
|
|
576
|
-
* unary normalisation is just a rewrite that ignores `previous`, as
|
|
577
|
-
* `NormalizeEmptyStringsContribution` does. The chain is empty by
|
|
578
|
-
* default, so this is a no-op for adopters that register none.
|
|
708
|
+
* The text a write into a document not yet built should take its trivia
|
|
709
|
+
* from: the store's, which a write always has, since it writes only a
|
|
710
|
+
* document its client has open.
|
|
579
711
|
*/
|
|
580
|
-
protected
|
|
712
|
+
protected textToTakeTriviaFrom(uri: string, _target: URI): Promise<string | undefined>;
|
|
581
713
|
/**
|
|
582
714
|
* Run the per-language transfer-model rewrite chain. Resolves the
|
|
583
715
|
* `UpdateRewriteService` per-URI (like {@link serialize}) and threads
|
|
@@ -588,11 +720,29 @@ TTransfer extends TransferElement = TransferElement> {
|
|
|
588
720
|
protected rewriteModel(uri: string, model: TTransfer, cancelToken?: CancellationToken): Promise<TTransfer>;
|
|
589
721
|
/**
|
|
590
722
|
* Build an {@link AstDocument} envelope from the current
|
|
591
|
-
* {@link LangiumDocument} state via
|
|
592
|
-
* projection. Returns an empty envelope (built via
|
|
723
|
+
* {@link LangiumDocument} state via `AstDocumentManager.toAstDocument`,
|
|
724
|
+
* the projection events use too. Returns an empty envelope (built via
|
|
593
725
|
* {@link AstDocument.create}) when the document is absent from the
|
|
594
|
-
* registry — adopters that prefer to throw override on their subclass.
|
|
726
|
+
* registry — adopters that prefer to throw override on their subclass. Its
|
|
727
|
+
* version is {@link UNRECORDED_VERSION}, so a write based on it conflicts.
|
|
595
728
|
*/
|
|
596
729
|
protected toAstDocument(uri: URI): AstDocument<TAst, TDiagnostic>;
|
|
730
|
+
/**
|
|
731
|
+
* The same envelope with no diagnostics, for a read that names a phase below
|
|
732
|
+
* `Validated`. Absent rather than `[]`, which says the document was validated
|
|
733
|
+
* and found clean.
|
|
734
|
+
*
|
|
735
|
+
* Langium fills `LangiumDocument.diagnostics` from inside `validateDocument`
|
|
736
|
+
* and from nowhere else, so below that phase the array holds whatever an
|
|
737
|
+
* EARLIER build left — a verdict about text the document may no longer have.
|
|
738
|
+
* The wait underneath resolves at or above the phase asked for, so a document
|
|
739
|
+
* something else carried past `Validated` would otherwise hand a full array
|
|
740
|
+
* back from `parsed()`.
|
|
741
|
+
*
|
|
742
|
+
* A copy rather than a clear: the envelope is freshly built here, but
|
|
743
|
+
* {@link toAstDocument} is overridable and an adopter's version may return
|
|
744
|
+
* one it also keeps.
|
|
745
|
+
*/
|
|
746
|
+
protected withoutDiagnostics(document: AstDocument<TAst, TDiagnostic>): AstDocument<TAst, never>;
|
|
597
747
|
}
|
|
598
748
|
//# sourceMappingURL=model-service.d.ts.map
|