@hydranium/core 1.0.0-next.12 → 1.0.0-next.123
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 +5 -1
- package/lib/documents/ast-document-manager.d.ts +92 -19
- package/lib/documents/ast-document-manager.d.ts.map +1 -1
- package/lib/documents/ast-document-manager.js +107 -26
- 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 +138 -0
- package/lib/documents/client-session-registry.d.ts.map +1 -0
- package/lib/documents/client-session-registry.js +184 -0
- package/lib/documents/client-session-registry.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 +324 -57
- package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
- package/lib/documents/hydranium-text-documents.js +590 -114
- package/lib/documents/hydranium-text-documents.js.map +1 -1
- package/lib/documents/index.d.ts +3 -0
- package/lib/documents/index.d.ts.map +1 -1
- package/lib/documents/index.js +3 -0
- package/lib/documents/index.js.map +1 -1
- package/lib/documents/language-client-text-shadow.d.ts +41 -9
- package/lib/documents/language-client-text-shadow.d.ts.map +1 -1
- package/lib/documents/language-client-text-shadow.js +56 -11
- package/lib/documents/language-client-text-shadow.js.map +1 -1
- package/lib/documents/self-save-registry.d.ts +37 -6
- package/lib/documents/self-save-registry.d.ts.map +1 -1
- package/lib/documents/self-save-registry.js +28 -15
- package/lib/documents/self-save-registry.js.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.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.map +1 -1
- package/lib/langium/bootstrap.js +16 -9
- package/lib/langium/bootstrap.js.map +1 -1
- 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/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 +40 -6
- package/lib/langium/diagnostics/lsp-logger.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 +93 -0
- package/lib/langium/document-builder/build-session.d.ts.map +1 -0
- package/lib/langium/document-builder/build-session.js +72 -0
- package/lib/langium/document-builder/build-session.js.map +1 -0
- package/lib/langium/document-builder/document-builder.d.ts +165 -9
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
- package/lib/langium/document-builder/document-builder.js +313 -13
- package/lib/langium/document-builder/document-builder.js.map +1 -1
- package/lib/langium/document-builder/index.d.ts +1 -0
- package/lib/langium/document-builder/index.d.ts.map +1 -1
- package/lib/langium/document-builder/index.js +1 -0
- package/lib/langium/document-builder/index.js.map +1 -1
- package/lib/langium/integration-services.d.ts +45 -1
- 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 +13 -5
- 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 +54 -6
- package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
- package/lib/langium/integrity/integrity-service.js +192 -17
- 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/language-module.d.ts +27 -2
- package/lib/langium/language-module.d.ts.map +1 -1
- package/lib/langium/language-module.js +16 -2
- package/lib/langium/language-module.js.map +1 -1
- package/lib/langium/model-service/client-session.d.ts +299 -0
- package/lib/langium/model-service/client-session.d.ts.map +1 -0
- package/lib/langium/model-service/client-session.js +379 -0
- package/lib/langium/model-service/client-session.js.map +1 -0
- package/lib/langium/model-service/index.d.ts +1 -0
- package/lib/langium/model-service/index.d.ts.map +1 -1
- package/lib/langium/model-service/index.js +1 -0
- package/lib/langium/model-service/index.js.map +1 -1
- package/lib/langium/model-service/model-service.d.ts +224 -160
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +191 -288
- package/lib/langium/model-service/model-service.js.map +1 -1
- package/lib/langium/module.d.ts +95 -16
- package/lib/langium/module.d.ts.map +1 -1
- package/lib/langium/module.js +30 -12
- 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/residency/cst-residency-service.d.ts +31 -11
- package/lib/langium/residency/cst-residency-service.d.ts.map +1 -1
- package/lib/langium/residency/cst-residency-service.js +13 -56
- package/lib/langium/residency/cst-residency-service.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/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/service-registry.d.ts +15 -1
- package/lib/langium/service-registry.d.ts.map +1 -1
- package/lib/langium/service-registry.js +16 -0
- package/lib/langium/service-registry.js.map +1 -1
- package/lib/langium/shared-services.d.ts +15 -2
- package/lib/langium/shared-services.d.ts.map +1 -1
- package/lib/langium/shared-services.js.map +1 -1
- package/lib/langium/transfer/transfer-encoder.d.ts +60 -17
- package/lib/langium/transfer/transfer-encoder.d.ts.map +1 -1
- package/lib/langium/transfer/transfer-encoder.js +38 -16
- 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/update-rewrite.d.ts +1 -1
- package/lib/langium/validation/document-validator.d.ts +294 -10
- 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/workspace/document-uri-policy.d.ts +3 -4
- package/lib/langium/workspace/document-uri-policy.d.ts.map +1 -1
- package/lib/langium/workspace/document-uri-policy.js +3 -4
- package/lib/langium/workspace/document-uri-policy.js.map +1 -1
- package/lib/langium/workspace/file-system-provider.d.ts +9 -1
- package/lib/langium/workspace/file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/file-system-provider.js +40 -7
- package/lib/langium/workspace/file-system-provider.js.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +25 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.js +25 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.js.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts +21 -1
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.js +28 -0
- package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts +23 -0
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.js +55 -9
- package/lib/langium/workspace/in-memory-file-system-provider.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 +79 -17
- package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
- package/lib/langium/workspace/langium-documents.js +83 -28
- package/lib/langium/workspace/langium-documents.js.map +1 -1
- package/lib/langium/workspace/virtual-document.d.ts +18 -3
- package/lib/langium/workspace/virtual-document.d.ts.map +1 -1
- package/lib/langium/workspace/virtual-document.js +19 -2
- package/lib/langium/workspace/virtual-document.js.map +1 -1
- package/lib/langium/workspace/write-lock-scope.d.ts +1 -1
- package/lib/langium/workspace/write-lock-scope.js +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 +70 -62
- package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
- package/lib/lsp/hydranium-document-update-handler.js +123 -75
- 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/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 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +1 -0
- 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/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/node-file-system-provider.d.ts +35 -1
- package/lib/node/node-file-system-provider.d.ts.map +1 -1
- package/lib/node/node-file-system-provider.js +140 -45
- 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.map +1 -1
- package/lib/node/profiling-run.d.ts +2 -2
- package/lib/node/profiling-run.js +1 -1
- 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 +15 -0
- package/lib/node/socket-launcher.d.ts.map +1 -1
- package/lib/node/socket-launcher.js +3 -2
- package/lib/node/socket-launcher.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/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 +61 -13
- package/lib/testing/make-test-services.d.ts.map +1 -1
- package/lib/testing/make-test-services.js +25 -5
- package/lib/testing/make-test-services.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 +42 -9
- 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 +33 -1
- 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/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 +14 -4
- package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-capture.js +21 -4
- 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 +10 -9
- package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
- package/lib/testing/stub-ast-document-manager.js +8 -9
- package/lib/testing/stub-ast-document-manager.js.map +1 -1
- package/lib/testing/stub-document-builder.d.ts +8 -0
- package/lib/testing/stub-document-builder.d.ts.map +1 -1
- package/lib/testing/stub-document-builder.js +22 -3
- package/lib/testing/stub-document-builder.js.map +1 -1
- package/lib/testing/stub-hydranium-text-documents.d.ts +19 -6
- package/lib/testing/stub-hydranium-text-documents.d.ts.map +1 -1
- package/lib/testing/stub-hydranium-text-documents.js +53 -15
- package/lib/testing/stub-hydranium-text-documents.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/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/package.json +17 -8
- package/src/documents/ast-document-manager.ts +188 -45
- package/src/documents/client-ids.ts +5 -22
- package/src/documents/client-session-errors.ts +22 -0
- package/src/documents/client-session-registry.ts +237 -0
- package/src/documents/file-system-task-queue.ts +68 -0
- package/src/documents/hydranium-text-documents.ts +724 -142
- package/src/documents/index.ts +3 -0
- package/src/documents/language-client-text-shadow.ts +59 -11
- package/src/documents/self-save-registry.ts +52 -13
- package/src/index.ts +6 -0
- package/src/langium/ast-extension/ast-node-builder.ts +66 -22
- package/src/langium/bootstrap.ts +16 -9
- package/src/langium/config/configuration-provider.ts +119 -0
- package/src/langium/config/index.ts +1 -0
- package/src/langium/diagnostics/lsp-logger.ts +41 -6
- package/src/langium/document-builder/build-pipeline-integration.ts +50 -5
- package/src/langium/document-builder/build-session.ts +87 -0
- package/src/langium/document-builder/document-builder.ts +355 -13
- package/src/langium/document-builder/index.ts +1 -0
- package/src/langium/integration-services.ts +67 -6
- package/src/langium/integrity/integrity-rule.ts +13 -5
- package/src/langium/integrity/integrity-service.ts +201 -17
- 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 +42 -4
- package/src/langium/model-service/client-session.ts +581 -0
- package/src/langium/model-service/index.ts +1 -0
- package/src/langium/model-service/model-service.ts +332 -274
- package/src/langium/module.ts +119 -22
- package/src/langium/naming/name-provider.ts +27 -5
- package/src/langium/naming/name-separator-validation.ts +34 -5
- package/src/langium/residency/cst-residency-service.ts +36 -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 +19 -2
- package/src/langium/shared-services.ts +19 -2
- package/src/langium/transfer/transfer-encoder.ts +85 -24
- 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 +537 -11
- package/src/langium/workspace/document-uri-policy.ts +3 -4
- package/src/langium/workspace/file-system-provider.ts +48 -8
- package/src/langium/workspace/hydranium-langium-document-factory.ts +34 -0
- package/src/langium/workspace/hydranium-workspace-manager.ts +30 -1
- package/src/langium/workspace/in-memory-file-system-provider.ts +62 -10
- package/src/langium/workspace/initialize-workspace.ts +43 -5
- package/src/langium/workspace/langium-documents.ts +106 -33
- package/src/langium/workspace/virtual-document.ts +21 -3
- package/src/langium/workspace/write-lock-scope.ts +1 -1
- 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 +152 -79
- 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 -0
- 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 +154 -47
- package/src/node/profile-capture.ts +8 -2
- package/src/node/profiling-run.ts +3 -3
- package/src/node/rename-over-open-readers.ts +78 -0
- package/src/node/socket-launcher.ts +18 -2
- package/src/testing/fake-document.ts +24 -5
- package/src/testing/make-noop-shared-services.ts +50 -2
- package/src/testing/make-test-services.ts +99 -24
- 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 +61 -11
- package/src/testing/node/scratch-workspace.ts +10 -5
- package/src/testing/node/spawned-server.ts +35 -1
- package/src/testing/node/unhandled-rejections.ts +31 -0
- 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 +24 -5
- 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 +18 -31
- package/src/testing/stub-document-builder.ts +32 -3
- package/src/testing/stub-hydranium-text-documents.ts +78 -21
- package/src/testing/stub-langium-documents.ts +3 -2
- package/src/testing/stub-model-service.ts +9 -8
- package/src/util/connection-liveness.ts +37 -14
- 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/src/lsp/instrument-connection.ts +0 -66
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
import type { CanonicalUri } from '@hydranium/protocol';
|
|
11
11
|
import type { ApplyWorkspaceEditResult } from 'vscode-languageserver';
|
|
12
|
-
import { Disposable } from 'vscode-languageserver';
|
|
12
|
+
import { Disposable, Emitter } from 'vscode-languageserver';
|
|
13
13
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
14
14
|
import { LANGUAGE_CLIENT_ID } from '../documents/client-ids.js';
|
|
15
|
-
import
|
|
15
|
+
import { ClientSessionRegistry } from '../documents/client-session-registry.js';
|
|
16
|
+
import type { ClientTextDocumentChangeEvent, HydraniumTextDocuments, LastOpenClosedEvent } from '../documents/hydranium-text-documents.js';
|
|
16
17
|
|
|
17
18
|
/** Snapshot of an open document tracked by the stub. */
|
|
18
19
|
export interface StubTextDocumentEntry {
|
|
@@ -27,9 +28,12 @@ export interface StubTextDocumentEntry {
|
|
|
27
28
|
* reads from on test paths — the content channel
|
|
28
29
|
* (`notifyDidChangeTextDocument` / `applyContentChange` / `version` /
|
|
29
30
|
* `getAuthor`), the open-state probes (`isOpenInLanguageClient` /
|
|
30
|
-
* `isOpenInAnyClient` / `
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* `isOpenInAnyClient` / `isOpenInClient` / `isRevertPending` /
|
|
32
|
+
* `openDocuments`), the push channel
|
|
33
|
+
* to the language client (`applyEditToLanguageClient` / `stagePendingContent`),
|
|
34
|
+
* the save / close notifications, and the client-session table
|
|
35
|
+
* (`registerSession` / `closeSession` / `onDidCloseSession`), which is a real
|
|
36
|
+
* `ClientSessionRegistry` — plus test-only helpers:
|
|
33
37
|
*
|
|
34
38
|
* - {@link seedOpen} — pre-populate an open document without firing change
|
|
35
39
|
* events. Use to set up a baseline version before exercising an `update`.
|
|
@@ -66,9 +70,16 @@ export interface StubHydraniumTextDocuments extends Pick<
|
|
|
66
70
|
| 'getAuthor'
|
|
67
71
|
| 'isOpenInLanguageClient'
|
|
68
72
|
| 'isOpenInAnyClient'
|
|
73
|
+
| 'isRevertPending'
|
|
69
74
|
| 'applyEditToLanguageClient'
|
|
70
75
|
| 'stagePendingContent'
|
|
71
76
|
| 'openDocuments'
|
|
77
|
+
| 'isOpenInClient'
|
|
78
|
+
| 'attachClient'
|
|
79
|
+
| 'registerSession'
|
|
80
|
+
| 'closeSession'
|
|
81
|
+
| 'onDidCloseSession'
|
|
82
|
+
| 'onDidCloseLastOpen'
|
|
72
83
|
> {
|
|
73
84
|
/**
|
|
74
85
|
* Stub-tailored read accessor. Returns just the surface the framework's
|
|
@@ -91,9 +102,19 @@ export interface StubHydraniumTextDocuments extends Pick<
|
|
|
91
102
|
seedOpen(uri: string, text: string, clientId: string): void;
|
|
92
103
|
/** Mark `uri` as open in the LSP textual language client (drives {@link isOpenInLanguageClient}). */
|
|
93
104
|
seedOpenInLanguageClient(uri: string): void;
|
|
94
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Synchronously deliver `onDidClose` to subscribers, then `onDidCloseLastOpen`
|
|
107
|
+
* when no client has `uri` open any more. The stub keeps no revert grace, so
|
|
108
|
+
* a last close is announced at once.
|
|
109
|
+
*/
|
|
95
110
|
fireClose(uri: string, clientId: string): void;
|
|
96
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Drop recorded state. Useful for `beforeEach` resets.
|
|
113
|
+
*
|
|
114
|
+
* Sessions end without announcing it, so a model service built on this
|
|
115
|
+
* stub still holds the handles it started before the reset. Build a fresh
|
|
116
|
+
* service after a reset rather than reusing one across it.
|
|
117
|
+
*/
|
|
97
118
|
reset(): void;
|
|
98
119
|
readonly changes: readonly StubTextDocumentEntry[];
|
|
99
120
|
readonly saves: readonly { uri: string; clientId: string }[];
|
|
@@ -125,8 +146,14 @@ export function makeStubHydraniumTextDocuments(): StubHydraniumTextDocuments {
|
|
|
125
146
|
let applyEditHandler: (uri: string, text: string) => ApplyWorkspaceEditResult | undefined = () => ({ applied: true });
|
|
126
147
|
const saveListeners: Array<(event: { document: { uri: string }; clientId: string }) => void> = [];
|
|
127
148
|
const closeListeners: Array<(event: ClientTextDocumentChangeEvent<TextDocument>) => void> = [];
|
|
149
|
+
// The real registry, so the session table, the opens and the closing state
|
|
150
|
+
// behave as the store's do. The stub's plain-string keys
|
|
151
|
+
// stand in for canonical URIs (one stub-boundary cast, like `fireClose`).
|
|
152
|
+
const sessions = new ClientSessionRegistry();
|
|
153
|
+
const key = (uri: string): CanonicalUri => uri as CanonicalUri;
|
|
154
|
+
const lastOpenClosed = new Emitter<LastOpenClosedEvent>();
|
|
128
155
|
|
|
129
|
-
|
|
156
|
+
const stub: StubHydraniumTextDocuments = {
|
|
130
157
|
get changes() {
|
|
131
158
|
return changes;
|
|
132
159
|
},
|
|
@@ -207,21 +234,40 @@ export function makeStubHydraniumTextDocuments(): StubHydraniumTextDocuments {
|
|
|
207
234
|
isOpenInAnyClient(uri) {
|
|
208
235
|
return docs.has(uri) || languageClientOpen.has(uri);
|
|
209
236
|
},
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
237
|
+
isOpenInClient(uri, clientId) {
|
|
238
|
+
return sessions.isOpenIn(key(uri), clientId);
|
|
239
|
+
},
|
|
240
|
+
isRevertPending(uri) {
|
|
241
|
+
return sessions.isRevertPending(key(uri));
|
|
242
|
+
},
|
|
243
|
+
attachClient(uri, clientId) {
|
|
244
|
+
return docs.has(uri) && sessions.addOpen(key(uri), clientId);
|
|
245
|
+
},
|
|
246
|
+
registerSession(clientId) {
|
|
247
|
+
sessions.register(clientId);
|
|
248
|
+
},
|
|
249
|
+
closeSession(clientId) {
|
|
250
|
+
if (!sessions.isRegistered(clientId)) {
|
|
251
|
+
return;
|
|
216
252
|
}
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
253
|
+
try {
|
|
254
|
+
for (const uri of sessions.beginClose(clientId)) {
|
|
255
|
+
stub.fireClose(uri, clientId);
|
|
256
|
+
}
|
|
257
|
+
} finally {
|
|
258
|
+
sessions.unregister(clientId);
|
|
221
259
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return
|
|
260
|
+
},
|
|
261
|
+
get onDidCloseSession() {
|
|
262
|
+
return sessions.onDidCloseSession;
|
|
263
|
+
},
|
|
264
|
+
get onDidCloseLastOpen() {
|
|
265
|
+
return lastOpenClosed.event;
|
|
266
|
+
},
|
|
267
|
+
openDocuments() {
|
|
268
|
+
// From the registry that also answers `isOpenInClient`, which both
|
|
269
|
+
// seeding channels feed, so the two never disagree about an open.
|
|
270
|
+
return sessions.openDocuments();
|
|
225
271
|
},
|
|
226
272
|
setApplyEditHandler(handler) {
|
|
227
273
|
applyEditHandler = handler;
|
|
@@ -234,9 +280,11 @@ export function makeStubHydraniumTextDocuments(): StubHydraniumTextDocuments {
|
|
|
234
280
|
staged.push({ uri, text });
|
|
235
281
|
},
|
|
236
282
|
seedOpen(uri, text, clientId) {
|
|
283
|
+
sessions.addOpen(key(uri), clientId);
|
|
237
284
|
docs.set(uri, { uri, version: 1, text, clientId });
|
|
238
285
|
},
|
|
239
286
|
seedOpenInLanguageClient(uri) {
|
|
287
|
+
sessions.addOpen(key(uri), LANGUAGE_CLIENT_ID);
|
|
240
288
|
languageClientOpen.add(uri);
|
|
241
289
|
},
|
|
242
290
|
fireClose(uri, clientId) {
|
|
@@ -247,6 +295,7 @@ export function makeStubHydraniumTextDocuments(): StubHydraniumTextDocuments {
|
|
|
247
295
|
if (holder && holder.clientId === clientId) {
|
|
248
296
|
docs.delete(uri);
|
|
249
297
|
}
|
|
298
|
+
const removed = sessions.removeOpen(key(uri), clientId);
|
|
250
299
|
if (clientId === LANGUAGE_CLIENT_ID) {
|
|
251
300
|
languageClientOpen.delete(uri);
|
|
252
301
|
}
|
|
@@ -254,6 +303,9 @@ export function makeStubHydraniumTextDocuments(): StubHydraniumTextDocuments {
|
|
|
254
303
|
for (const listener of closeListeners.slice()) {
|
|
255
304
|
listener(event);
|
|
256
305
|
}
|
|
306
|
+
if (removed && !sessions.isOpen(key(uri))) {
|
|
307
|
+
lastOpenClosed.fire({ uri: key(uri) });
|
|
308
|
+
}
|
|
257
309
|
},
|
|
258
310
|
reset() {
|
|
259
311
|
docs.clear();
|
|
@@ -265,6 +317,11 @@ export function makeStubHydraniumTextDocuments(): StubHydraniumTextDocuments {
|
|
|
265
317
|
saveListeners.length = 0;
|
|
266
318
|
closeListeners.length = 0;
|
|
267
319
|
applyEditHandler = () => ({ applied: true });
|
|
320
|
+
// Cleared in place rather than replaced: a model service built on the
|
|
321
|
+
// stub subscribed to `onDidCloseSession` once, and a new registry would
|
|
322
|
+
// leave that subscription on one nothing fires.
|
|
323
|
+
sessions.clear();
|
|
268
324
|
}
|
|
269
325
|
};
|
|
326
|
+
return stub;
|
|
270
327
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { type AstNode, type LangiumDocument, type LangiumDocuments, stream, type URI } from '@hydranium/langium';
|
|
11
11
|
import { makeFakeAstNode, makeFakeDocument, type FakeDocumentOptions } from './fake-document.js';
|
|
12
|
+
import { type AstDiagnostic } from '../langium/validation/document-validator.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Map-backed stub for Langium's {@link LangiumDocuments} registry. Implements
|
|
@@ -31,7 +32,7 @@ import { makeFakeAstNode, makeFakeDocument, type FakeDocumentOptions } from './f
|
|
|
31
32
|
* production code reads the slot value through the `LangiumDocuments`
|
|
32
33
|
* interface and a narrowing cast bridges the stub at the binding site.
|
|
33
34
|
*/
|
|
34
|
-
export interface StubLangiumDocuments<TAst extends AstNode = AstNode, TDiagnostic =
|
|
35
|
+
export interface StubLangiumDocuments<TAst extends AstNode = AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic> extends Pick<
|
|
35
36
|
LangiumDocuments,
|
|
36
37
|
'getDocument' | 'hasDocument' | 'getOrCreateDocument' | 'all'
|
|
37
38
|
> {
|
|
@@ -51,7 +52,7 @@ export interface StubLangiumDocuments<TAst extends AstNode = AstNode, TDiagnosti
|
|
|
51
52
|
* Build a {@link StubLangiumDocuments}. Seed entries via the optional
|
|
52
53
|
* `seeds` parameter so simple tests don't need a separate `set` call.
|
|
53
54
|
*/
|
|
54
|
-
export function makeStubLangiumDocuments<TAst extends AstNode = AstNode, TDiagnostic =
|
|
55
|
+
export function makeStubLangiumDocuments<TAst extends AstNode = AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic>(
|
|
55
56
|
seeds: ReadonlyArray<{ uri: string | URI; root: TAst; options?: FakeDocumentOptions<TAst, TDiagnostic> }> = []
|
|
56
57
|
): StubLangiumDocuments<TAst, TDiagnostic> {
|
|
57
58
|
const docs = new Map<string, LangiumDocument<TAst>>();
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
11
|
+
import type { AstDiagnostic } from '../langium/validation/document-validator.js';
|
|
11
12
|
import type { AstNode } from '@hydranium/langium';
|
|
12
|
-
import { ModelService, type ModelServiceOptions } from '../langium/model-service/model-service.js';
|
|
13
|
+
import { DefaultModelService, type ModelService, type ModelServiceOptions } from '../langium/model-service/model-service.js';
|
|
13
14
|
import type { ServerSharedServices } from '../langium/module.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -21,9 +22,9 @@ import type { ServerSharedServices } from '../langium/module.js';
|
|
|
21
22
|
*/
|
|
22
23
|
class StubModelServiceImpl<
|
|
23
24
|
TAst extends AstNode,
|
|
24
|
-
TDiagnostic extends
|
|
25
|
+
TDiagnostic extends AstDiagnostic = AstDiagnostic,
|
|
25
26
|
TTransfer extends TransferElement = TransferElement
|
|
26
|
-
> extends
|
|
27
|
+
> extends DefaultModelService<TAst, TDiagnostic, TTransfer> {
|
|
27
28
|
constructor(
|
|
28
29
|
services: ServerSharedServices,
|
|
29
30
|
protected readonly serializeFn: (uri: string, root: TTransfer) => string,
|
|
@@ -40,7 +41,7 @@ class StubModelServiceImpl<
|
|
|
40
41
|
/** The type of the model-service test double produced by {@link makeStubModelService}. */
|
|
41
42
|
export type StubModelService<
|
|
42
43
|
TAst extends AstNode,
|
|
43
|
-
TDiagnostic extends
|
|
44
|
+
TDiagnostic extends AstDiagnostic = AstDiagnostic,
|
|
44
45
|
TTransfer extends TransferElement = TransferElement
|
|
45
46
|
> = ModelService<TAst, TDiagnostic, TTransfer>;
|
|
46
47
|
|
|
@@ -52,8 +53,8 @@ export type StubModelService<
|
|
|
52
53
|
* `makeTestServices` wires this stub automatically.
|
|
53
54
|
*
|
|
54
55
|
* `options` are the framework {@link ModelServiceOptions}, forwarded verbatim, so
|
|
55
|
-
* a test can exercise an option-gated code path (`serializeBuilds
|
|
56
|
-
*
|
|
56
|
+
* a test can exercise an option-gated code path (`serializeBuilds`) without
|
|
57
|
+
* hand-rolling a subclass just to reach the constructor.
|
|
57
58
|
*
|
|
58
59
|
* Adopters that need richer override behaviour — the framework's own extension
|
|
59
60
|
* surface is {@link ModelService.rewriteModel} alongside `serialize` — should
|
|
@@ -61,7 +62,7 @@ export type StubModelService<
|
|
|
61
62
|
*/
|
|
62
63
|
export function makeStubModelService<
|
|
63
64
|
TAst extends AstNode,
|
|
64
|
-
TDiagnostic extends
|
|
65
|
+
TDiagnostic extends AstDiagnostic = AstDiagnostic,
|
|
65
66
|
TTransfer extends TransferElement = TransferElement
|
|
66
67
|
>(
|
|
67
68
|
services: ServerSharedServices,
|
|
@@ -8,39 +8,62 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Phrases
|
|
12
|
-
*
|
|
11
|
+
* Phrases that mean a call lost its connection. Matched on the message because
|
|
12
|
+
* the condition surfaces in shapes that share no discriminator:
|
|
13
13
|
*
|
|
14
14
|
* - a **throw** from `throwIfClosedOrDisposed` (`Connection is disposed.` /
|
|
15
15
|
* `Connection is closed.`), a `ConnectionError` raised synchronously by
|
|
16
16
|
* `sendRequest` / `sendNotification` and by `RemoteConsole.send`;
|
|
17
17
|
* - a **rejection** of an already-issued request (`Pending response rejected
|
|
18
18
|
* since connection got disposed`), a `ResponseError` produced when the
|
|
19
|
-
* pending-response map is drained on teardown
|
|
19
|
+
* pending-response map is drained on teardown;
|
|
20
|
+
* - a **write into a destroyed transport** (`Cannot call write after a stream
|
|
21
|
+
* was destroyed`), Node's own error for a message the writer queued before
|
|
22
|
+
* the connection was disposed and flushed after its stream was destroyed.
|
|
23
|
+
* A notification rejects with Node's error itself, which
|
|
24
|
+
* {@link isDestroyedStreamError} catches by its code; a request rejects with
|
|
25
|
+
* a `ResponseError` that copies only the message, so the phrase is needed
|
|
26
|
+
* too.
|
|
20
27
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
28
|
+
* The typed errors come from different classes carrying codes from different
|
|
29
|
+
* enums, so no single code check covers them. Kept lowercase-normalised and
|
|
30
|
+
* anchored on `connection` or `stream` so an unrelated "disposed" message
|
|
31
|
+
* cannot match.
|
|
25
32
|
*/
|
|
26
|
-
const CONNECTION_GONE_PATTERNS = [
|
|
33
|
+
const CONNECTION_GONE_PATTERNS = [
|
|
34
|
+
/connection is disposed/,
|
|
35
|
+
/connection is closed/,
|
|
36
|
+
/connection got disposed/,
|
|
37
|
+
/connection got closed/,
|
|
38
|
+
/after a stream was destroyed/
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const DESTROYED_STREAM_CODE = 'ERR_STREAM_DESTROYED';
|
|
42
|
+
|
|
43
|
+
function isDestroyedStreamError(err: unknown): boolean {
|
|
44
|
+
return err instanceof Error && 'code' in err && err.code === DESTROYED_STREAM_CODE;
|
|
45
|
+
}
|
|
27
46
|
|
|
28
47
|
/**
|
|
29
48
|
* Whether `err` means "the peer is gone", as opposed to a genuine failure of
|
|
30
49
|
* the operation.
|
|
31
50
|
*
|
|
32
|
-
* The
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
51
|
+
* The two are indistinguishable at the call site otherwise, and callers act on
|
|
52
|
+
* the answer: a gone peer is logged at `debug` or dropped, a genuine failure is
|
|
53
|
+
* logged at `error` or re-raised as an unhandled rejection. Pushing an edit to
|
|
54
|
+
* a language client that has already disconnected is a no-op, not a fault — it
|
|
55
|
+
* happens on every ordinary shutdown — so a `false` here turns routine teardown
|
|
56
|
+
* into errors that look like they need investigation. A `true` for a real
|
|
57
|
+
* `applyEdit` failure (the client refused, the request malformed) hides it.
|
|
38
58
|
*
|
|
39
59
|
* Callers that only need to *survive* a dead connection rather than classify it
|
|
40
60
|
* should just catch — see `LspLogger.emit`, whose fallback path does exactly
|
|
41
61
|
* that, since a logger has nowhere to report a logging failure anyway.
|
|
42
62
|
*/
|
|
43
63
|
export function isConnectionGoneError(err: unknown): boolean {
|
|
64
|
+
if (isDestroyedStreamError(err)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
44
67
|
const message = err instanceof Error ? err.message : String(err);
|
|
45
68
|
const normalized = message.toLowerCase();
|
|
46
69
|
return CONNECTION_GONE_PATTERNS.some(pattern => pattern.test(normalized));
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the MIT License which is available in the project root.
|
|
6
|
-
*
|
|
7
|
-
* SPDX-License-Identifier: MIT
|
|
8
|
-
********************************************************************************/
|
|
9
|
-
import type { LatencyCollector } from '@hydranium/protocol';
|
|
10
|
-
/**
|
|
11
|
-
* Wrap an LSP `Connection` so every request handler registered through
|
|
12
|
-
* `onRequest` is timed into `latency` under its method name — the LSP analog of
|
|
13
|
-
* the data-server RPC chokepoint. Langium's `startLanguageServer` registers
|
|
14
|
-
* `onCompletion`/`onHover`/… one handler at a time, so there is no single
|
|
15
|
-
* dispatch point; but every registration funnels through the ONE `onRequest`
|
|
16
|
-
* on the shared `Connection`, so decorating it catches every method with no
|
|
17
|
-
* Langium fork and no per-handler code.
|
|
18
|
-
*
|
|
19
|
-
* Opt in where the head creates the connection, before it hands it to the
|
|
20
|
-
* services factory — wrapping it afterwards is too late, because Langium has
|
|
21
|
-
* already registered its handlers against the raw connection.
|
|
22
|
-
*
|
|
23
|
-
* `onRequest` has several overloads: most register a handler for a specific
|
|
24
|
-
* method (a string, or a typed request whose `.method` names it) and one is the
|
|
25
|
-
* `StarRequestHandler` catch-all `onRequest(handler)`. The star form fires only
|
|
26
|
-
* for methods with no registered handler, so timing it would be misleading — it
|
|
27
|
-
* is passed through untouched. Every other member of the connection is
|
|
28
|
-
* forwarded unchanged.
|
|
29
|
-
*
|
|
30
|
-
* When `latency` is `undefined` the seam is off: the connection is returned
|
|
31
|
-
* unchanged (no Proxy, no per-request timing), so a head can pass the result of
|
|
32
|
-
* an env-gated factory (`latencyFromEnv()`) straight through and pay nothing
|
|
33
|
-
* when latency is not enabled.
|
|
34
|
-
*/
|
|
35
|
-
export declare function instrumentLspConnection<C extends object>(connection: C, latency: LatencyCollector | undefined): C;
|
|
36
|
-
//# sourceMappingURL=instrument-connection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-connection.d.ts","sourceRoot":"","sources":["../../src/lsp/instrument-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,CAAC,CA2BjH"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the MIT License which is available in the project root.
|
|
6
|
-
*
|
|
7
|
-
* SPDX-License-Identifier: MIT
|
|
8
|
-
********************************************************************************/
|
|
9
|
-
/**
|
|
10
|
-
* Wrap an LSP `Connection` so every request handler registered through
|
|
11
|
-
* `onRequest` is timed into `latency` under its method name — the LSP analog of
|
|
12
|
-
* the data-server RPC chokepoint. Langium's `startLanguageServer` registers
|
|
13
|
-
* `onCompletion`/`onHover`/… one handler at a time, so there is no single
|
|
14
|
-
* dispatch point; but every registration funnels through the ONE `onRequest`
|
|
15
|
-
* on the shared `Connection`, so decorating it catches every method with no
|
|
16
|
-
* Langium fork and no per-handler code.
|
|
17
|
-
*
|
|
18
|
-
* Opt in where the head creates the connection, before it hands it to the
|
|
19
|
-
* services factory — wrapping it afterwards is too late, because Langium has
|
|
20
|
-
* already registered its handlers against the raw connection.
|
|
21
|
-
*
|
|
22
|
-
* `onRequest` has several overloads: most register a handler for a specific
|
|
23
|
-
* method (a string, or a typed request whose `.method` names it) and one is the
|
|
24
|
-
* `StarRequestHandler` catch-all `onRequest(handler)`. The star form fires only
|
|
25
|
-
* for methods with no registered handler, so timing it would be misleading — it
|
|
26
|
-
* is passed through untouched. Every other member of the connection is
|
|
27
|
-
* forwarded unchanged.
|
|
28
|
-
*
|
|
29
|
-
* When `latency` is `undefined` the seam is off: the connection is returned
|
|
30
|
-
* unchanged (no Proxy, no per-request timing), so a head can pass the result of
|
|
31
|
-
* an env-gated factory (`latencyFromEnv()`) straight through and pay nothing
|
|
32
|
-
* when latency is not enabled.
|
|
33
|
-
*/
|
|
34
|
-
export function instrumentLspConnection(connection, latency) {
|
|
35
|
-
if (!latency) {
|
|
36
|
-
return connection;
|
|
37
|
-
}
|
|
38
|
-
return new Proxy(connection, {
|
|
39
|
-
get(target, property, receiver) {
|
|
40
|
-
const value = Reflect.get(target, property, receiver);
|
|
41
|
-
if (property !== 'onRequest' || typeof value !== 'function') {
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
const onRequest = value;
|
|
45
|
-
return (...args) => {
|
|
46
|
-
const [first, handler] = args;
|
|
47
|
-
// Star form `onRequest(handler)` — pass through; it is not a timer.
|
|
48
|
-
if (typeof first === 'function' || typeof handler !== 'function') {
|
|
49
|
-
return onRequest.apply(target, args);
|
|
50
|
-
}
|
|
51
|
-
const method = typeof first === 'string' ? first : first.method;
|
|
52
|
-
if (typeof method !== 'string') {
|
|
53
|
-
return onRequest.apply(target, args);
|
|
54
|
-
}
|
|
55
|
-
const original = handler;
|
|
56
|
-
const timed = (...handlerArgs) => latency.time(method, () => original(...handlerArgs));
|
|
57
|
-
return onRequest.apply(target, [first, timed, ...args.slice(2)]);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=instrument-connection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-connection.js","sourceRoot":"","sources":["../../src/lsp/instrument-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,uBAAuB,CAAmB,UAAa,EAAE,OAAqC;IAC3G,IAAI,CAAC,OAAO,EAAE,CAAC;QACZ,OAAO,UAAU,CAAC;IACrB,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,UAAU,EAAE;QAC1B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ;YAC3B,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC/D,IAAI,QAAQ,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;gBAC3D,OAAO,KAAK,CAAC;YAChB,CAAC;YACD,MAAM,SAAS,GAAG,KAAwC,CAAC;YAC3D,OAAO,CAAC,GAAG,IAAe,EAAW,EAAE;gBACpC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;gBAC9B,oEAAoE;gBACpE,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;oBAChE,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC;gBACD,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,KAA8B,CAAC,MAAM,CAAC;gBAC1F,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAC9B,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC;gBACD,MAAM,QAAQ,GAAG,OAAyB,CAAC;gBAC3C,MAAM,KAAK,GAAmB,CAAC,GAAG,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;gBACvG,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC;QACL,CAAC;KACH,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the MIT License which is available in the project root.
|
|
6
|
-
*
|
|
7
|
-
* SPDX-License-Identifier: MIT
|
|
8
|
-
********************************************************************************/
|
|
9
|
-
|
|
10
|
-
import type { LatencyCollector } from '@hydranium/protocol';
|
|
11
|
-
|
|
12
|
-
type RequestHandler = (...args: unknown[]) => unknown;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Wrap an LSP `Connection` so every request handler registered through
|
|
16
|
-
* `onRequest` is timed into `latency` under its method name — the LSP analog of
|
|
17
|
-
* the data-server RPC chokepoint. Langium's `startLanguageServer` registers
|
|
18
|
-
* `onCompletion`/`onHover`/… one handler at a time, so there is no single
|
|
19
|
-
* dispatch point; but every registration funnels through the ONE `onRequest`
|
|
20
|
-
* on the shared `Connection`, so decorating it catches every method with no
|
|
21
|
-
* Langium fork and no per-handler code.
|
|
22
|
-
*
|
|
23
|
-
* Opt in where the head creates the connection, before it hands it to the
|
|
24
|
-
* services factory — wrapping it afterwards is too late, because Langium has
|
|
25
|
-
* already registered its handlers against the raw connection.
|
|
26
|
-
*
|
|
27
|
-
* `onRequest` has several overloads: most register a handler for a specific
|
|
28
|
-
* method (a string, or a typed request whose `.method` names it) and one is the
|
|
29
|
-
* `StarRequestHandler` catch-all `onRequest(handler)`. The star form fires only
|
|
30
|
-
* for methods with no registered handler, so timing it would be misleading — it
|
|
31
|
-
* is passed through untouched. Every other member of the connection is
|
|
32
|
-
* forwarded unchanged.
|
|
33
|
-
*
|
|
34
|
-
* When `latency` is `undefined` the seam is off: the connection is returned
|
|
35
|
-
* unchanged (no Proxy, no per-request timing), so a head can pass the result of
|
|
36
|
-
* an env-gated factory (`latencyFromEnv()`) straight through and pay nothing
|
|
37
|
-
* when latency is not enabled.
|
|
38
|
-
*/
|
|
39
|
-
export function instrumentLspConnection<C extends object>(connection: C, latency: LatencyCollector | undefined): C {
|
|
40
|
-
if (!latency) {
|
|
41
|
-
return connection;
|
|
42
|
-
}
|
|
43
|
-
return new Proxy(connection, {
|
|
44
|
-
get(target, property, receiver): unknown {
|
|
45
|
-
const value: unknown = Reflect.get(target, property, receiver);
|
|
46
|
-
if (property !== 'onRequest' || typeof value !== 'function') {
|
|
47
|
-
return value;
|
|
48
|
-
}
|
|
49
|
-
const onRequest = value as (...args: unknown[]) => unknown;
|
|
50
|
-
return (...args: unknown[]): unknown => {
|
|
51
|
-
const [first, handler] = args;
|
|
52
|
-
// Star form `onRequest(handler)` — pass through; it is not a timer.
|
|
53
|
-
if (typeof first === 'function' || typeof handler !== 'function') {
|
|
54
|
-
return onRequest.apply(target, args);
|
|
55
|
-
}
|
|
56
|
-
const method = typeof first === 'string' ? first : (first as { method?: unknown }).method;
|
|
57
|
-
if (typeof method !== 'string') {
|
|
58
|
-
return onRequest.apply(target, args);
|
|
59
|
-
}
|
|
60
|
-
const original = handler as RequestHandler;
|
|
61
|
-
const timed: RequestHandler = (...handlerArgs) => latency.time(method, () => original(...handlerArgs));
|
|
62
|
-
return onRequest.apply(target, [first, timed, ...args.slice(2)]);
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|