@hydranium/core 1.0.0-next.11 → 1.0.0-next.112
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/lib/documents/ast-document-manager.d.ts +75 -16
- package/lib/documents/ast-document-manager.d.ts.map +1 -1
- package/lib/documents/ast-document-manager.js +57 -19
- 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/hydranium-text-documents.d.ts +132 -42
- package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
- package/lib/documents/hydranium-text-documents.js +199 -57
- package/lib/documents/hydranium-text-documents.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 +150 -7
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
- package/lib/langium/document-builder/document-builder.js +298 -11
- 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-service.d.ts +16 -0
- package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
- package/lib/langium/integrity/integrity-service.js +110 -2
- 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 +25 -0
- package/lib/langium/language-module.d.ts.map +1 -1
- package/lib/langium/language-module.js +14 -0
- package/lib/langium/language-module.js.map +1 -1
- package/lib/langium/model-service/model-service.d.ts +161 -10
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +176 -97
- package/lib/langium/model-service/model-service.js.map +1 -1
- package/lib/langium/module.d.ts +84 -15
- package/lib/langium/module.d.ts.map +1 -1
- package/lib/langium/module.js +26 -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/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 +47 -9
- package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -1
- package/lib/langium/workspace/initialize-workspace.d.ts +23 -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/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.map +1 -1
- package/lib/lsp/hydranium-document-update-handler.js +10 -1
- 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/start-language-server.d.ts +5 -3
- package/lib/lsp/start-language-server.d.ts.map +1 -1
- package/lib/lsp/start-language-server.js +10 -3
- 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 +136 -0
- package/lib/messages/renderer.d.ts.map +1 -0
- package/lib/messages/renderer.js +159 -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 +45 -9
- package/lib/testing/make-test-services.d.ts.map +1 -1
- package/lib/testing/make-test-services.js +19 -3
- 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 +10 -2
- 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 +9 -4
- 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/stub-ast-document-manager.d.ts +5 -5
- package/lib/testing/stub-ast-document-manager.d.ts.map +1 -1
- package/lib/testing/stub-ast-document-manager.js +4 -6
- 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-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 +5 -4
- package/lib/testing/stub-model-service.d.ts.map +1 -1
- package/lib/testing/stub-model-service.js +2 -2
- 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 +129 -36
- package/src/documents/client-ids.ts +5 -22
- package/src/documents/hydranium-text-documents.ts +256 -81
- 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 +339 -11
- package/src/langium/document-builder/index.ts +1 -0
- package/src/langium/integration-services.ts +67 -6
- package/src/langium/integrity/integrity-service.ts +116 -2
- 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 +38 -0
- package/src/langium/model-service/model-service.ts +266 -34
- package/src/langium/module.ts +106 -21
- 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/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 +53 -10
- package/src/langium/workspace/initialize-workspace.ts +35 -5
- package/src/langium/workspace/langium-documents.ts +106 -33
- package/src/langium/workspace/virtual-document.ts +21 -3
- 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 +10 -1
- 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/start-language-server.ts +10 -3
- package/src/messages/carriers.ts +78 -0
- package/src/messages/index.ts +36 -0
- package/src/messages/renderer.ts +206 -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 +74 -18
- 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 +60 -10
- package/src/testing/node/scratch-workspace.ts +9 -4
- 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/stub-ast-document-manager.ts +10 -14
- package/src/testing/stub-document-builder.ts +32 -3
- package/src/testing/stub-langium-documents.ts +3 -2
- package/src/testing/stub-model-service.ts +7 -6
- 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
|
@@ -6,13 +6,41 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type
|
|
10
|
-
import { type AstNode, DefaultLangiumDocuments, type LangiumDocument, type URI } from '@hydranium/langium';
|
|
9
|
+
import { type AstNode, DefaultLangiumDocuments, type LangiumDocument, type LangiumDocuments, type URI } from '@hydranium/langium';
|
|
11
10
|
import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
12
11
|
import { type DocumentUriPolicy } from './document-uri-policy.js';
|
|
12
|
+
import { type HydraniumLangiumDocumentFactory } from './hydranium-langium-document-factory.js';
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* The document a caller asked to load is not there.
|
|
15
|
+
*
|
|
16
|
+
* User-facing, and the Node host's spelling of it: `loadUri` returns `undefined`
|
|
17
|
+
* exactly when the URI policy's `realpath` reports the path absent. A host whose
|
|
18
|
+
* provider has no `realpath` never reaches this — the miss surfaces from the
|
|
19
|
+
* provider instead, so the same condition has one declaration per host.
|
|
20
|
+
*/
|
|
21
|
+
export declare const NO_LOADABLE_CONTENT: import("@hydranium/protocol").MessageDefinition<"No loadable content for {uri}">;
|
|
22
|
+
/**
|
|
23
|
+
* A stand-in was asked for at a URI that routes to no grammar, and no language
|
|
24
|
+
* id was given to route it instead.
|
|
25
|
+
*
|
|
26
|
+
* User-facing, and raised BEFORE the parse: left to Langium's ladder the same
|
|
27
|
+
* condition surfaces as `no services for the extension ''`, which names neither
|
|
28
|
+
* the URI nor the argument that would have answered.
|
|
29
|
+
*/
|
|
30
|
+
export declare const NO_LANGUAGE_FOR_STAND_IN: import("@hydranium/protocol").MessageDefinition<"No grammar routes {uri}; pass a languageId to say which one the stand-in should parse with">;
|
|
31
|
+
/**
|
|
32
|
+
* The registry surface the framework adds on top of Langium's
|
|
33
|
+
* {@link LangiumDocuments}. Declared separately from the implementing class so
|
|
34
|
+
* the shared-services slot can narrow to it: the class takes the services tree
|
|
35
|
+
* as its constructor parameter, so naming the CLASS there would make that type
|
|
36
|
+
* depend on itself.
|
|
37
|
+
*/
|
|
38
|
+
export interface HydraniumDocumentRegistry extends LangiumDocuments {
|
|
39
|
+
createEmptyDocument(uri: URI, languageId?: string): LangiumDocument<AstNode>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Default `LangiumDocuments` for `@hydranium/core` consumers, extending
|
|
43
|
+
* Langium's {@link DefaultLangiumDocuments} with:
|
|
16
44
|
*
|
|
17
45
|
* 1. **Identity via the {@link DocumentUriPolicy} seam.**
|
|
18
46
|
* `getOrCreateDocument` resolves the requested URI through the seam — the
|
|
@@ -22,26 +50,60 @@ import { type DocumentUriPolicy } from './document-uri-policy.js';
|
|
|
22
50
|
* `LangiumDocuments` override. The default resolves to the URI unchanged
|
|
23
51
|
* (`DefaultDocumentUriPolicy`), matching Langium's own keying.
|
|
24
52
|
*
|
|
25
|
-
* 2.
|
|
26
|
-
* document
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
53
|
+
* 2. **A load that finds nothing rejects**, rather than answering with a
|
|
54
|
+
* transient empty document. An empty AST validates clean, so a placeholder
|
|
55
|
+
* hands the caller something that silently is not the file, and a caller
|
|
56
|
+
* that wants a document for a URI with no content on disk cannot use one
|
|
57
|
+
* anyway: it is unregistered, so no build, index or save can see it, and
|
|
58
|
+
* `LangiumDocumentFactory.update` reads from disk. Content that legitimately
|
|
59
|
+
* lives outside the filesystem belongs in a virtual document, which carries
|
|
60
|
+
* real source text.
|
|
33
61
|
*/
|
|
34
|
-
export declare
|
|
62
|
+
export declare class HydraniumLangiumDocuments extends DefaultLangiumDocuments implements HydraniumDocumentRegistry {
|
|
35
63
|
protected readonly services: ServerSharedServicesMinimal;
|
|
36
64
|
/** Document-identity seam, shared with the text store, event filters, and builder. */
|
|
37
65
|
protected readonly uriPolicy: DocumentUriPolicy;
|
|
38
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Narrows the inherited Langium factory field to the framework's, so the
|
|
68
|
+
* language-explicit `fromStringInLanguage` below needs no cast. The
|
|
69
|
+
* framework's shared module binds that class.
|
|
70
|
+
*/
|
|
71
|
+
protected readonly langiumDocumentFactory: HydraniumLangiumDocumentFactory;
|
|
39
72
|
constructor(services: ServerSharedServicesMinimal);
|
|
40
73
|
/**
|
|
41
|
-
* Build a transient
|
|
42
|
-
*
|
|
74
|
+
* Build a transient document for `uri` by parsing empty text with the
|
|
75
|
+
* grammar `languageId` names, or the one `uri` routes to when it is
|
|
76
|
+
* omitted, so the root is that language's entry type with every containment
|
|
77
|
+
* list initialised.
|
|
78
|
+
*
|
|
79
|
+
* For callers that need a document at a URI with no content on disk — the
|
|
80
|
+
* scope provider querying before a file exists is the case it was added for.
|
|
81
|
+
* `getOrCreateDocument` deliberately does NOT fall back to this: fabricating
|
|
82
|
+
* a document behind a caller that asked to LOAD one hands back something
|
|
83
|
+
* that silently is not the file, whereas calling this is a caller saying it
|
|
84
|
+
* wants a stand-in.
|
|
85
|
+
*
|
|
86
|
+
* **Pass `languageId` whenever the URI names no file.** The create-element
|
|
87
|
+
* flow this exists for asks at the DIRECTORY a file is about to be written
|
|
88
|
+
* into, and a directory URI has no extension for the routing ladder to end
|
|
89
|
+
* on — so omitting the id there fails inside the parse, on an empty
|
|
90
|
+
* extension rather than on the URI. A caller in that position always knows
|
|
91
|
+
* its language: {@link HydraniumScopeProvider} is bound per grammar, and a
|
|
92
|
+
* request that names no document at all still carries the AST type
|
|
93
|
+
* `ExtendedServiceRegistry.soleServicesByType` routes on.
|
|
94
|
+
*
|
|
95
|
+
* The result is not registered, so nothing downstream can see it, and
|
|
96
|
+
* `LangiumDocumentFactory.update` would read from disk. It is a probe, not a
|
|
97
|
+
* document under construction; content that must survive belongs in a
|
|
98
|
+
* virtual document, which carries real source text.
|
|
99
|
+
*
|
|
100
|
+
* Building the root by hand instead needs the entry type name and a cast
|
|
101
|
+
* past the generated types, and leaves those lists `undefined`. A grammar
|
|
102
|
+
* whose entry rule opens with mandatory syntax yields a parse error here,
|
|
103
|
+
* and it is kept: `AstReflection.isComplete` is `false` for such a root
|
|
104
|
+
* however it is built, so the error states the same thing.
|
|
43
105
|
*/
|
|
44
|
-
|
|
106
|
+
createEmptyDocument(uri: URI, languageId?: string): LangiumDocument<AstNode>;
|
|
45
107
|
getOrCreateDocument(uri: URI): Promise<LangiumDocument<AstNode>>;
|
|
46
108
|
}
|
|
47
109
|
//# sourceMappingURL=langium-documents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langium-documents.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"langium-documents.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAElI,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAE/F;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,kFAAuF,CAAC;AAExH;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,+IAGpC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IAChE,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;CAC/E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,SAAQ,uBAAwB,YAAW,yBAAyB;uBAWhE,QAAQ,EAAE,2BAA2B;IAV7E,sFAAsF;IACtF,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEhD;;;;OAIG;IACH,mBAA2B,sBAAsB,EAAE,+BAA+B,CAAC;gBAE3C,QAAQ,EAAE,2BAA2B;IAK7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC;IAe7D,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;CAgCjF"}
|
|
@@ -7,9 +7,28 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { DefaultLangiumDocuments } from '@hydranium/langium';
|
|
10
|
+
import { defineMessage } from '@hydranium/protocol';
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* The document a caller asked to load is not there.
|
|
13
|
+
*
|
|
14
|
+
* User-facing, and the Node host's spelling of it: `loadUri` returns `undefined`
|
|
15
|
+
* exactly when the URI policy's `realpath` reports the path absent. A host whose
|
|
16
|
+
* provider has no `realpath` never reaches this — the miss surfaces from the
|
|
17
|
+
* provider instead, so the same condition has one declaration per host.
|
|
18
|
+
*/
|
|
19
|
+
export const NO_LOADABLE_CONTENT = defineMessage('hydranium/core/no-loadable-content', 'No loadable content for {uri}');
|
|
20
|
+
/**
|
|
21
|
+
* A stand-in was asked for at a URI that routes to no grammar, and no language
|
|
22
|
+
* id was given to route it instead.
|
|
23
|
+
*
|
|
24
|
+
* User-facing, and raised BEFORE the parse: left to Langium's ladder the same
|
|
25
|
+
* condition surfaces as `no services for the extension ''`, which names neither
|
|
26
|
+
* the URI nor the argument that would have answered.
|
|
27
|
+
*/
|
|
28
|
+
export const NO_LANGUAGE_FOR_STAND_IN = defineMessage('hydranium/core/no-language-for-stand-in', 'No grammar routes {uri}; pass a languageId to say which one the stand-in should parse with');
|
|
29
|
+
/**
|
|
30
|
+
* Default `LangiumDocuments` for `@hydranium/core` consumers, extending
|
|
31
|
+
* Langium's {@link DefaultLangiumDocuments} with:
|
|
13
32
|
*
|
|
14
33
|
* 1. **Identity via the {@link DocumentUriPolicy} seam.**
|
|
15
34
|
* `getOrCreateDocument` resolves the requested URI through the seam — the
|
|
@@ -19,25 +38,70 @@ import { DefaultLangiumDocuments } from '@hydranium/langium';
|
|
|
19
38
|
* `LangiumDocuments` override. The default resolves to the URI unchanged
|
|
20
39
|
* (`DefaultDocumentUriPolicy`), matching Langium's own keying.
|
|
21
40
|
*
|
|
22
|
-
* 2.
|
|
23
|
-
* document
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
41
|
+
* 2. **A load that finds nothing rejects**, rather than answering with a
|
|
42
|
+
* transient empty document. An empty AST validates clean, so a placeholder
|
|
43
|
+
* hands the caller something that silently is not the file, and a caller
|
|
44
|
+
* that wants a document for a URI with no content on disk cannot use one
|
|
45
|
+
* anyway: it is unregistered, so no build, index or save can see it, and
|
|
46
|
+
* `LangiumDocumentFactory.update` reads from disk. Content that legitimately
|
|
47
|
+
* lives outside the filesystem belongs in a virtual document, which carries
|
|
48
|
+
* real source text.
|
|
30
49
|
*/
|
|
31
|
-
export class
|
|
50
|
+
export class HydraniumLangiumDocuments extends DefaultLangiumDocuments {
|
|
32
51
|
services;
|
|
33
52
|
/** Document-identity seam, shared with the text store, event filters, and builder. */
|
|
34
53
|
uriPolicy;
|
|
35
|
-
tracer;
|
|
36
54
|
constructor(services) {
|
|
37
55
|
super(services);
|
|
38
56
|
this.services = services;
|
|
39
57
|
this.uriPolicy = services.workspace.DocumentUriPolicy;
|
|
40
|
-
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Build a transient document for `uri` by parsing empty text with the
|
|
61
|
+
* grammar `languageId` names, or the one `uri` routes to when it is
|
|
62
|
+
* omitted, so the root is that language's entry type with every containment
|
|
63
|
+
* list initialised.
|
|
64
|
+
*
|
|
65
|
+
* For callers that need a document at a URI with no content on disk — the
|
|
66
|
+
* scope provider querying before a file exists is the case it was added for.
|
|
67
|
+
* `getOrCreateDocument` deliberately does NOT fall back to this: fabricating
|
|
68
|
+
* a document behind a caller that asked to LOAD one hands back something
|
|
69
|
+
* that silently is not the file, whereas calling this is a caller saying it
|
|
70
|
+
* wants a stand-in.
|
|
71
|
+
*
|
|
72
|
+
* **Pass `languageId` whenever the URI names no file.** The create-element
|
|
73
|
+
* flow this exists for asks at the DIRECTORY a file is about to be written
|
|
74
|
+
* into, and a directory URI has no extension for the routing ladder to end
|
|
75
|
+
* on — so omitting the id there fails inside the parse, on an empty
|
|
76
|
+
* extension rather than on the URI. A caller in that position always knows
|
|
77
|
+
* its language: {@link HydraniumScopeProvider} is bound per grammar, and a
|
|
78
|
+
* request that names no document at all still carries the AST type
|
|
79
|
+
* `ExtendedServiceRegistry.soleServicesByType` routes on.
|
|
80
|
+
*
|
|
81
|
+
* The result is not registered, so nothing downstream can see it, and
|
|
82
|
+
* `LangiumDocumentFactory.update` would read from disk. It is a probe, not a
|
|
83
|
+
* document under construction; content that must survive belongs in a
|
|
84
|
+
* virtual document, which carries real source text.
|
|
85
|
+
*
|
|
86
|
+
* Building the root by hand instead needs the entry type name and a cast
|
|
87
|
+
* past the generated types, and leaves those lists `undefined`. A grammar
|
|
88
|
+
* whose entry rule opens with mandatory syntax yields a parse error here,
|
|
89
|
+
* and it is kept: `AstReflection.isComplete` is `false` for such a root
|
|
90
|
+
* however it is built, so the error states the same thing.
|
|
91
|
+
*/
|
|
92
|
+
createEmptyDocument(uri, languageId) {
|
|
93
|
+
if (languageId !== undefined) {
|
|
94
|
+
return this.langiumDocumentFactory.fromStringInLanguage('', uri, languageId);
|
|
95
|
+
}
|
|
96
|
+
if (!this.services.ServiceRegistry.getServicesFor(uri)) {
|
|
97
|
+
// Reported here rather than left to the parse, which ends on the empty
|
|
98
|
+
// extension and so names neither the URI nor the id that would have
|
|
99
|
+
// answered.
|
|
100
|
+
throw new Error(NO_LANGUAGE_FOR_STAND_IN.format({ uri: uri.toString() }));
|
|
101
|
+
}
|
|
102
|
+
// The two-argument overload is synchronous; passing a cancellation token
|
|
103
|
+
// selects the promise-returning one, which this contract cannot await.
|
|
104
|
+
return this.langiumDocumentFactory.fromString('', uri);
|
|
41
105
|
}
|
|
42
106
|
async getOrCreateDocument(uri) {
|
|
43
107
|
const resolved = this.uriPolicy.loadUri(uri);
|
|
@@ -58,28 +122,19 @@ export class AbstractHydraniumLangiumDocuments extends DefaultLangiumDocuments {
|
|
|
58
122
|
}
|
|
59
123
|
catch (error) {
|
|
60
124
|
// Load lost a race with a concurrent create — return that document.
|
|
125
|
+
// Checked before propagating, so a race is not reported as a
|
|
126
|
+
// missing file; cancellation carries no document and falls through.
|
|
61
127
|
const reentrant = this.getDocument(resolved);
|
|
62
128
|
if (reentrant) {
|
|
63
129
|
this.services.workspace.CstResidencyService.rehydrate(reentrant);
|
|
64
130
|
return reentrant;
|
|
65
131
|
}
|
|
66
|
-
|
|
67
|
-
// below still runs, because the file-not-found case is the ordinary
|
|
68
|
-
// one here and no provider-independent way to recognise it exists:
|
|
69
|
-
// Node's provider throws `ENOENT`, the in-memory one a bare `Error`,
|
|
70
|
-
// and the provider is a seam an adopter rebinds. Discriminating on
|
|
71
|
-
// message text across that seam would be a worse defect than the
|
|
72
|
-
// one it fixes. So the failure is TRACED rather than propagated —
|
|
73
|
-
// an unreadable-but-present file still degrades to an empty
|
|
74
|
-
// document, but it stops doing so silently.
|
|
75
|
-
this.tracer
|
|
76
|
-
.with(resolved.toString())
|
|
77
|
-
.debug(`Load failed, falling back to an empty document: ${error instanceof Error ? error.message : String(error)}`);
|
|
132
|
+
throw error;
|
|
78
133
|
}
|
|
79
134
|
}
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
135
|
+
// The seam reports no loadable content, so there is nothing to read and
|
|
136
|
+
// no error from a read to carry.
|
|
137
|
+
throw new Error(NO_LOADABLE_CONTENT.format({ uri: uri.toString() }));
|
|
83
138
|
}
|
|
84
139
|
}
|
|
85
140
|
//# sourceMappingURL=langium-documents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langium-documents.js","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"langium-documents.js","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAgB,uBAAuB,EAAyD,MAAM,oBAAoB,CAAC;AAClI,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKpD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,oCAAoC,EAAE,+BAA+B,CAAC,CAAC;AAExH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAClD,yCAAyC,EACzC,4FAA4F,CAC9F,CAAC;AAaF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAW3B;IAVxC,sFAAsF;IACnE,SAAS,CAAoB;IAShD,YAAwC,QAAqC;QAC1E,KAAK,CAAC,QAAQ,CAAC,CAAC;QADqB,aAAQ,GAAR,QAAQ,CAA6B;QAE1E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,mBAAmB,CAAC,GAAQ,EAAE,UAAmB;QAC9C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACtD,uEAAuE;YACvE,oEAAoE;YACpE,YAAY;YACZ,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QAC7E,CAAC;QACD,yEAAyE;QACzE,uEAAuE;QACvE,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;IAEQ,KAAK,CAAC,mBAAmB,CAAC,GAAQ;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,QAAQ,EAAE,CAAC;YACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,QAAQ,EAAE,CAAC;gBACZ,iEAAiE;gBACjE,kEAAkE;gBAClE,sEAAsE;gBACtE,kEAAkE;gBAClE,uDAAuD;gBACvD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAChE,OAAO,QAAQ,CAAC;YACnB,CAAC;YACD,IAAI,CAAC;gBACF,4DAA4D;gBAC5D,OAAO,MAAM,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACvB,oEAAoE;gBACpE,6DAA6D;gBAC7D,oEAAoE;gBACpE,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;gBAC7C,IAAI,SAAS,EAAE,CAAC;oBACb,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;oBACjE,OAAO,SAAS,CAAC;gBACpB,CAAC;gBACD,MAAM,KAAK,CAAC;YACf,CAAC;QACJ,CAAC;QACD,wEAAwE;QACxE,iCAAiC;QACjC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;CACH"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { URI } from '@hydranium/langium';
|
|
9
|
+
import { type FileSystemNode, URI } from '@hydranium/langium';
|
|
10
10
|
import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
11
11
|
/**
|
|
12
12
|
* URI scheme for virtual documents — LangiumDocuments that have no backing
|
|
@@ -65,14 +65,29 @@ export declare function isVirtualUri(uri: URI | string): boolean;
|
|
|
65
65
|
* is not virtual or no document is registered for it (so a FileSystemProvider
|
|
66
66
|
* delegates to its real backing).
|
|
67
67
|
*
|
|
68
|
-
* The framework's FileSystemProvider defaults
|
|
69
|
-
*
|
|
68
|
+
* The framework's FileSystemProvider defaults consult this across their whole
|
|
69
|
+
* read surface, so a virtual document survives a re-read:
|
|
70
70
|
* `DocumentBuilder.update` / `LangiumDocumentFactory.update` re-read a changed
|
|
71
71
|
* URI from the FileSystemProvider, and nothing on disk backs a virtual URI. The
|
|
72
72
|
* text comes from the registered document — the original source for a
|
|
73
73
|
* `fromString` document, or the serialized form retained by the framework's
|
|
74
74
|
* `fromModel` (which fills in the text Langium leaves empty). No serializer is
|
|
75
75
|
* consulted here; the text is already on the document.
|
|
76
|
+
*
|
|
77
|
+
* **Every read method has to agree.** Serving only the text methods leaves one
|
|
78
|
+
* provider answering "here is the content" and "nothing is there" about one
|
|
79
|
+
* URI, which is a worse contract than answering neither: a caller cannot probe
|
|
80
|
+
* before reading.
|
|
76
81
|
*/
|
|
77
82
|
export declare function serveVirtualDocument(services: ServerSharedServicesMinimal, uri: URI): string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* The filesystem node a registered virtual document presents as, or `undefined`
|
|
85
|
+
* on the same terms as {@link serveVirtualDocument}.
|
|
86
|
+
*
|
|
87
|
+
* Always a FILE: a virtual document is a leaf carrying text, and nothing is
|
|
88
|
+
* addressable beneath it. Reporting it as a directory instead would put it in
|
|
89
|
+
* front of a workspace walk that would then try to enumerate children it has
|
|
90
|
+
* none of.
|
|
91
|
+
*/
|
|
92
|
+
export declare function serveVirtualNode(services: ServerSharedServicesMinimal, uri: URI): FileSystemNode | undefined;
|
|
78
93
|
//# sourceMappingURL=virtual-document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-document.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/virtual-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"virtual-document.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/virtual-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG,CAG1E;AAED,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,OAAO,CAGvD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,2BAA2B,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAMxG;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,2BAA2B,EAAE,GAAG,EAAE,GAAG,GAAG,cAAc,GAAG,SAAS,CAE5G"}
|
|
@@ -70,14 +70,19 @@ export function isVirtualUri(uri) {
|
|
|
70
70
|
* is not virtual or no document is registered for it (so a FileSystemProvider
|
|
71
71
|
* delegates to its real backing).
|
|
72
72
|
*
|
|
73
|
-
* The framework's FileSystemProvider defaults
|
|
74
|
-
*
|
|
73
|
+
* The framework's FileSystemProvider defaults consult this across their whole
|
|
74
|
+
* read surface, so a virtual document survives a re-read:
|
|
75
75
|
* `DocumentBuilder.update` / `LangiumDocumentFactory.update` re-read a changed
|
|
76
76
|
* URI from the FileSystemProvider, and nothing on disk backs a virtual URI. The
|
|
77
77
|
* text comes from the registered document — the original source for a
|
|
78
78
|
* `fromString` document, or the serialized form retained by the framework's
|
|
79
79
|
* `fromModel` (which fills in the text Langium leaves empty). No serializer is
|
|
80
80
|
* consulted here; the text is already on the document.
|
|
81
|
+
*
|
|
82
|
+
* **Every read method has to agree.** Serving only the text methods leaves one
|
|
83
|
+
* provider answering "here is the content" and "nothing is there" about one
|
|
84
|
+
* URI, which is a worse contract than answering neither: a caller cannot probe
|
|
85
|
+
* before reading.
|
|
81
86
|
*/
|
|
82
87
|
export function serveVirtualDocument(services, uri) {
|
|
83
88
|
if (!isVirtualUri(uri)) {
|
|
@@ -86,4 +91,16 @@ export function serveVirtualDocument(services, uri) {
|
|
|
86
91
|
const document = services.workspace.LangiumDocuments.getDocument(uri);
|
|
87
92
|
return document ? document.textDocument.getText() : undefined;
|
|
88
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The filesystem node a registered virtual document presents as, or `undefined`
|
|
96
|
+
* on the same terms as {@link serveVirtualDocument}.
|
|
97
|
+
*
|
|
98
|
+
* Always a FILE: a virtual document is a leaf carrying text, and nothing is
|
|
99
|
+
* addressable beneath it. Reporting it as a directory instead would put it in
|
|
100
|
+
* front of a workspace walk that would then try to enumerate children it has
|
|
101
|
+
* none of.
|
|
102
|
+
*/
|
|
103
|
+
export function serveVirtualNode(services, uri) {
|
|
104
|
+
return serveVirtualDocument(services, uri) === undefined ? undefined : { isFile: true, isDirectory: false, uri };
|
|
105
|
+
}
|
|
89
106
|
//# sourceMappingURL=virtual-document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-document.js","sourceRoot":"","sources":["../../../src/langium/workspace/virtual-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"virtual-document.js","sourceRoot":"","sources":["../../../src/langium/workspace/virtual-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuB,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAG9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,UAAU,CAAC,WAAmB,EAAE,GAAG,QAAkB;IAClE,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,cAAc,IAAI,WAAW,GAAG,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC3C,MAAM,MAAM,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAC5E,OAAO,MAAM,KAAK,cAAc,CAAC;AACpC,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAqC,EAAE,GAAQ;IACjF,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACpB,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAqC,EAAE,GAAQ;IAC7E,OAAO,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './server-locale.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './server-locale.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 { Locale, Tracer } from '@hydranium/protocol';
|
|
10
|
+
import { type LogNameOptions } from '../langium/diagnostics/logger.js';
|
|
11
|
+
import type { ServerSharedServicesMinimal } from '../langium/shared-services.js';
|
|
12
|
+
/** Construction options for {@link ServerLocale}. */
|
|
13
|
+
export type ServerLocaleOptions = LogNameOptions;
|
|
14
|
+
/**
|
|
15
|
+
* The locale contract the `ServerLocale` slot holds, implemented by
|
|
16
|
+
* {@link DefaultServerLocale}.
|
|
17
|
+
*
|
|
18
|
+
* An interface rather than the class, so the slot is compared STRUCTURALLY —
|
|
19
|
+
* a class-typed slot carries its `protected` members into every assignability
|
|
20
|
+
* check, compared nominally, which makes it unsatisfiable across two physical
|
|
21
|
+
* copies of this package and unreplaceable by an adopter's own declaration.
|
|
22
|
+
*/
|
|
23
|
+
export interface ServerLocale {
|
|
24
|
+
/** The locale, or `undefined` when no init supplied one — the framework's English. */
|
|
25
|
+
readonly value: Locale | undefined;
|
|
26
|
+
accept(locale: Locale): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The locale the server was handed at init, for whoever needs to render in the
|
|
30
|
+
* reading user's language. Held apart from the message renderer that reads it,
|
|
31
|
+
* so replacing the renderer cannot drop locale handling.
|
|
32
|
+
*
|
|
33
|
+
* A plain string in and out. A consumer that must react to a change rather than
|
|
34
|
+
* read the current value wraps this itself — nothing does today, and both real
|
|
35
|
+
* hosts respawn the server on a display-language switch.
|
|
36
|
+
*/
|
|
37
|
+
export declare class DefaultServerLocale implements ServerLocale {
|
|
38
|
+
protected readonly tracer: Tracer;
|
|
39
|
+
protected current: Locale | undefined;
|
|
40
|
+
constructor(services: ServerSharedServicesMinimal, options?: ServerLocaleOptions);
|
|
41
|
+
/** The locale, or `undefined` when no init supplied one — which means the framework's English. */
|
|
42
|
+
get value(): Locale | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Take the locale an init declared.
|
|
45
|
+
*
|
|
46
|
+
* **One locale per process, and the reason the OTHER heads need none of
|
|
47
|
+
* their own.** The data and GLSP heads publish a port over the LSP
|
|
48
|
+
* connection and are reached by forwarding a socket to it, so they are the
|
|
49
|
+
* same process as the LSP head that was handed this locale — there is no
|
|
50
|
+
* topology in which one of them serves a second frontend. The Theia backend
|
|
51
|
+
* is the case that would break it, and it holds no locale precisely because
|
|
52
|
+
* it serves every frontend at once; nothing there writes here.
|
|
53
|
+
*
|
|
54
|
+
* The framework accepts a locale and never sources one, and neither
|
|
55
|
+
* validates nor normalises the tag: rejecting an unfamiliar one would be
|
|
56
|
+
* selecting a locale.
|
|
57
|
+
*
|
|
58
|
+
* Override to ignore the argument, which is how a host pins a locale it
|
|
59
|
+
* already knows but has no LSP client to declare.
|
|
60
|
+
*
|
|
61
|
+
* **The line is at `info`, which is a deliberate exception to the
|
|
62
|
+
* per-service default.** A locale is written once per process and it is the
|
|
63
|
+
* one setting that silently changes every user-facing sentence the server
|
|
64
|
+
* produces, so a reader trying to explain an unexpected language has nothing
|
|
65
|
+
* else to look at: the framework ships no catalogue, so "no entry for this
|
|
66
|
+
* code" and "no locale declared" both render the English and are
|
|
67
|
+
* indistinguishable in the output. At `debug` the line is below the default
|
|
68
|
+
* threshold and therefore absent from exactly the log someone would be
|
|
69
|
+
* reading.
|
|
70
|
+
*/
|
|
71
|
+
accept(locale: Locale): void;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=server-locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-locale.d.ts","sourceRoot":"","sources":["../../src/locale/server-locale.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,qDAAqD;AACrD,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC1B,sFAAsF;IACtF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IACrD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE1B,QAAQ,EAAE,2BAA2B,EAAE,OAAO,GAAE,mBAAwB;IAIpF,kGAAkG;IAClG,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAI9B"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
* The locale the server was handed at init, for whoever needs to render in the
|
|
11
|
+
* reading user's language. Held apart from the message renderer that reads it,
|
|
12
|
+
* so replacing the renderer cannot drop locale handling.
|
|
13
|
+
*
|
|
14
|
+
* A plain string in and out. A consumer that must react to a change rather than
|
|
15
|
+
* read the current value wraps this itself — nothing does today, and both real
|
|
16
|
+
* hosts respawn the server on a display-language switch.
|
|
17
|
+
*/
|
|
18
|
+
export class DefaultServerLocale {
|
|
19
|
+
tracer;
|
|
20
|
+
current;
|
|
21
|
+
constructor(services, options = {}) {
|
|
22
|
+
this.tracer = services.Tracer.for(options.logName ?? 'ServerLocale').trace('instantiated');
|
|
23
|
+
}
|
|
24
|
+
/** The locale, or `undefined` when no init supplied one — which means the framework's English. */
|
|
25
|
+
get value() {
|
|
26
|
+
return this.current;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Take the locale an init declared.
|
|
30
|
+
*
|
|
31
|
+
* **One locale per process, and the reason the OTHER heads need none of
|
|
32
|
+
* their own.** The data and GLSP heads publish a port over the LSP
|
|
33
|
+
* connection and are reached by forwarding a socket to it, so they are the
|
|
34
|
+
* same process as the LSP head that was handed this locale — there is no
|
|
35
|
+
* topology in which one of them serves a second frontend. The Theia backend
|
|
36
|
+
* is the case that would break it, and it holds no locale precisely because
|
|
37
|
+
* it serves every frontend at once; nothing there writes here.
|
|
38
|
+
*
|
|
39
|
+
* The framework accepts a locale and never sources one, and neither
|
|
40
|
+
* validates nor normalises the tag: rejecting an unfamiliar one would be
|
|
41
|
+
* selecting a locale.
|
|
42
|
+
*
|
|
43
|
+
* Override to ignore the argument, which is how a host pins a locale it
|
|
44
|
+
* already knows but has no LSP client to declare.
|
|
45
|
+
*
|
|
46
|
+
* **The line is at `info`, which is a deliberate exception to the
|
|
47
|
+
* per-service default.** A locale is written once per process and it is the
|
|
48
|
+
* one setting that silently changes every user-facing sentence the server
|
|
49
|
+
* produces, so a reader trying to explain an unexpected language has nothing
|
|
50
|
+
* else to look at: the framework ships no catalogue, so "no entry for this
|
|
51
|
+
* code" and "no locale declared" both render the English and are
|
|
52
|
+
* indistinguishable in the output. At `debug` the line is below the default
|
|
53
|
+
* threshold and therefore absent from exactly the log someone would be
|
|
54
|
+
* reading.
|
|
55
|
+
*/
|
|
56
|
+
accept(locale) {
|
|
57
|
+
this.current = locale;
|
|
58
|
+
this.tracer.info(`rendering messages in locale '${locale}'`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=server-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-locale.js","sourceRoot":"","sources":["../../src/locale/server-locale.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAwBlF;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IACV,MAAM,CAAS;IACxB,OAAO,CAAqB;IAEtC,YAAY,QAAqC,EAAE,UAA+B,EAAE;QACjF,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC9F,CAAC;IAED,kGAAkG;IAClG,IAAI,KAAK;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,MAAc;QAClB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,MAAM,GAAG,CAAC,CAAC;IAChE,CAAC;CACH"}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type AstNodeDescription, type ReferenceInfo, type Stream } from '@hydranium/langium';
|
|
9
|
+
import { type AstNodeDescription, type LangiumDocument, type ReferenceInfo, type Stream } from '@hydranium/langium';
|
|
10
10
|
import { DefaultCompletionProvider, type CompletionContext, type CompletionValueItem } from '@hydranium/langium/lsp';
|
|
11
|
-
import type
|
|
11
|
+
import { CompletionList, type CancellationToken, type CompletionItem, type CompletionParams, type Position } from 'vscode-languageserver';
|
|
12
12
|
import { type ReferenceCandidateProvider } from '../../langium/scope/reference-candidate-provider.js';
|
|
13
13
|
import { type ServerLanguageServices } from '../../langium/language-module.js';
|
|
14
14
|
/**
|
|
@@ -50,10 +50,52 @@ import { type ServerLanguageServices } from '../../langium/language-module.js';
|
|
|
50
50
|
* elements. The provider owns that pipeline in one place, so the
|
|
51
51
|
* text-editor dropdown and the protocol candidate picker stay in sync; this
|
|
52
52
|
* class keeps only the LSP-specific {@link fillCompletionItem} upgrade.
|
|
53
|
+
*
|
|
54
|
+
* **A comment is not a completion site.** Langium's context builder reads the
|
|
55
|
+
* non-hidden token stream alone, so a cursor in a comment is indistinguishable
|
|
56
|
+
* from one in the whitespace between the tokens surrounding it: the grammar's
|
|
57
|
+
* follow-set goes out as keyword proposals, and none of them is filtered,
|
|
58
|
+
* because the characters the user typed belong to the hidden token and the
|
|
59
|
+
* prefix matched against is therefore empty. {@link isInsideComment} suppresses
|
|
60
|
+
* the request instead.
|
|
53
61
|
*/
|
|
54
62
|
export declare class HydraniumCompletionProvider extends DefaultCompletionProvider {
|
|
55
63
|
protected readonly candidateProvider: ReferenceCandidateProvider;
|
|
56
64
|
constructor(services: ServerLanguageServices);
|
|
65
|
+
/**
|
|
66
|
+
* Answer no proposals at all when the cursor is inside a comment.
|
|
67
|
+
*
|
|
68
|
+
* Suppressing the whole request is what makes the rule hold for every
|
|
69
|
+
* proposal kind at once. Filtering the built contexts instead has to catch
|
|
70
|
+
* each context kind the base builds separately, and a kind added upstream
|
|
71
|
+
* arrives unguarded.
|
|
72
|
+
*
|
|
73
|
+
* The list is marked incomplete so the client re-asks on the next keystroke
|
|
74
|
+
* and proposals resume the moment the cursor leaves the comment.
|
|
75
|
+
*/
|
|
76
|
+
getCompletion(document: LangiumDocument, params: CompletionParams, cancelToken?: CancellationToken): Promise<CompletionList | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* Whether `position` falls in text a comment terminal claims.
|
|
79
|
+
*
|
|
80
|
+
* The two comment kinds part company at their far edge. A single-line
|
|
81
|
+
* comment runs to the line break, so a cursor at its end offset is still in
|
|
82
|
+
* prose and that offset counts as inside. A multi-line comment is
|
|
83
|
+
* terminated, so a cursor at its end offset has passed the terminator and is
|
|
84
|
+
* back in code. A cursor ON the opening delimiter is outside either way,
|
|
85
|
+
* that offset being a legal position for whatever token the comment
|
|
86
|
+
* displaced.
|
|
87
|
+
*
|
|
88
|
+
* The hidden token stream decides rather than the CST. A leaf lookup by
|
|
89
|
+
* offset misses the position a cursor reaches by typing prose into a
|
|
90
|
+
* trailing comment, because that comment ends AT the line break and
|
|
91
|
+
* whitespace is discarded before a CST node is built over it — so the
|
|
92
|
+
* lookup answers nothing exactly where proposals are least wanted.
|
|
93
|
+
*
|
|
94
|
+
* An adopter whose comment syntax carries completable content — a
|
|
95
|
+
* documentation tag naming a type — narrows this to return `false` over that
|
|
96
|
+
* region rather than replacing {@link getCompletion}.
|
|
97
|
+
*/
|
|
98
|
+
protected isInsideComment(document: LangiumDocument, position: Position): boolean;
|
|
57
99
|
/**
|
|
58
100
|
* Delegate cross-reference candidate gathering to the candidate provider
|
|
59
101
|
* so the LSP completion dropdown applies the same filter / canonical
|