@hydranium/core 1.0.0-next.8 → 1.0.0-next.85
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 +55 -21
- package/lib/documents/hydranium-text-documents.d.ts.map +1 -1
- package/lib/documents/hydranium-text-documents.js +142 -46
- 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 +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -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 +13 -1
- package/lib/langium/document-builder/build-pipeline-integration.d.ts.map +1 -1
- package/lib/langium/document-builder/build-pipeline-integration.js +1 -1
- 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 +5 -0
- package/lib/langium/integrity/integrity-service.d.ts.map +1 -1
- package/lib/langium/integrity/integrity-service.js +34 -1
- 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/model-service/model-service.d.ts +149 -10
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +120 -93
- 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 -9
- 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 +32 -13
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.js +37 -20
- package/lib/langium/scope/hydranium-scope-provider.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/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/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 +8 -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 +11 -2
- package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -1
- package/lib/langium/workspace/initialize-workspace.d.ts +22 -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/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/hydranium-document-update-handler.js +1 -1
- package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
- package/lib/lsp/index.d.ts +1 -1
- package/lib/lsp/index.d.ts.map +1 -1
- package/lib/lsp/index.js +1 -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/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/node-file-system-provider.d.ts.map +1 -1
- package/lib/node/node-file-system-provider.js +1 -40
- package/lib/node/node-file-system-provider.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/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 +44 -8
- 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/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/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/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 +167 -61
- package/src/documents/language-client-text-shadow.ts +59 -11
- package/src/documents/self-save-registry.ts +52 -13
- package/src/index.ts +5 -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 +14 -1
- 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 +35 -1
- 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/model-service/model-service.ts +211 -30
- 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 -12
- package/src/langium/scope/hydranium-scope-provider.ts +40 -22
- package/src/langium/shared-services.ts +19 -2
- package/src/langium/transfer/transfer-encoder.ts +85 -24
- package/src/langium/validation/document-validator.ts +537 -11
- package/src/langium/workspace/document-uri-policy.ts +3 -4
- 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 +13 -3
- package/src/langium/workspace/initialize-workspace.ts +34 -5
- package/src/langium/workspace/langium-documents.ts +106 -33
- package/src/locale/index.ts +10 -0
- package/src/locale/server-locale.ts +86 -0
- package/src/lsp/hydranium-document-update-handler.ts +1 -1
- package/src/lsp/index.ts +1 -1
- package/src/lsp/lsp-latency.ts +62 -0
- package/src/lsp/semantic-token-provider.ts +74 -7
- package/src/messages/carriers.ts +78 -0
- package/src/messages/index.ts +36 -0
- package/src/messages/renderer.ts +204 -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/node-file-system-provider.ts +1 -41
- package/src/node/profiling-run.ts +3 -3
- package/src/node/rename-over-open-readers.ts +78 -0
- 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 +73 -18
- package/src/testing/node/spawned-server.ts +35 -1
- package/src/testing/playwright/flaky-network-proxy.ts +240 -0
- package/src/testing/playwright/index.ts +1 -0
- package/src/testing/playwright/server-log-capture.ts +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/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,12 +6,13 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import type {
|
|
9
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
10
|
+
import type { AstDiagnostic } from '../langium/validation/document-validator.js';
|
|
10
11
|
import type { AstNode } from '@hydranium/langium';
|
|
11
|
-
import { ModelService, type ModelServiceOptions } from '../langium/model-service/model-service.js';
|
|
12
|
+
import { type ModelService, type ModelServiceOptions } from '../langium/model-service/model-service.js';
|
|
12
13
|
import type { ServerSharedServices } from '../langium/module.js';
|
|
13
14
|
/** The type of the model-service test double produced by {@link makeStubModelService}. */
|
|
14
|
-
export type StubModelService<TAst extends AstNode, TDiagnostic extends
|
|
15
|
+
export type StubModelService<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic, TTransfer extends TransferElement = TransferElement> = ModelService<TAst, TDiagnostic, TTransfer>;
|
|
15
16
|
/**
|
|
16
17
|
* Build a {@link StubModelService} — a {@link ModelService} test double that
|
|
17
18
|
* takes `serialize` as a constructor callback. The stub services tree has no
|
|
@@ -27,5 +28,5 @@ export type StubModelService<TAst extends AstNode, TDiagnostic extends TransferD
|
|
|
27
28
|
* surface is {@link ModelService.rewriteModel} alongside `serialize` — should
|
|
28
29
|
* subclass {@link ModelService} directly instead.
|
|
29
30
|
*/
|
|
30
|
-
export declare function makeStubModelService<TAst extends AstNode, TDiagnostic extends
|
|
31
|
+
export declare function makeStubModelService<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic, TTransfer extends TransferElement = TransferElement>(services: ServerSharedServices, serialize: (uri: string, root: TTransfer) => string, options?: ModelServiceOptions): StubModelService<TAst, TDiagnostic, TTransfer>;
|
|
31
32
|
//# sourceMappingURL=stub-model-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stub-model-service.d.ts","sourceRoot":"","sources":["../../src/testing/stub-model-service.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"stub-model-service.d.ts","sourceRoot":"","sources":["../../src/testing/stub-model-service.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAuB,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAC7H,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AA2BjE,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,CACzB,IAAI,SAAS,OAAO,EACpB,WAAW,SAAS,aAAa,GAAG,aAAa,EACjD,SAAS,SAAS,eAAe,GAAG,eAAe,IAClD,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CACjC,IAAI,SAAS,OAAO,EACpB,WAAW,SAAS,aAAa,GAAG,aAAa,EACjD,SAAS,SAAS,eAAe,GAAG,eAAe,EAEnD,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,MAAM,EACnD,OAAO,CAAC,EAAE,mBAAmB,GAC7B,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,CAEhD"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import {
|
|
9
|
+
import { DefaultModelService } from '../langium/model-service/model-service.js';
|
|
10
10
|
/**
|
|
11
11
|
* Implementation detail of {@link makeStubModelService}. A {@link ModelService}
|
|
12
12
|
* subclass that takes `serialize` as a constructor callback — the test stub
|
|
@@ -14,7 +14,7 @@ import { ModelService } from '../langium/model-service/model-service.js';
|
|
|
14
14
|
* path would fail. Construct it through the factory; the {@link StubModelService}
|
|
15
15
|
* type alias is the public type name.
|
|
16
16
|
*/
|
|
17
|
-
class StubModelServiceImpl extends
|
|
17
|
+
class StubModelServiceImpl extends DefaultModelService {
|
|
18
18
|
serializeFn;
|
|
19
19
|
constructor(services, serializeFn, options) {
|
|
20
20
|
super(services, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stub-model-service.js","sourceRoot":"","sources":["../../src/testing/stub-model-service.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"stub-model-service.js","sourceRoot":"","sources":["../../src/testing/stub-model-service.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAKlF,OAAO,EAAE,mBAAmB,EAA+C,MAAM,2CAA2C,CAAC;AAG7H;;;;;;GAMG;AACH,MAAM,oBAIJ,SAAQ,mBAAiD;IAGlC;IAFtB,YACG,QAA8B,EACX,WAAqD,EACxE,OAA6B;QAE7B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAHN,gBAAW,GAAX,WAAW,CAA0C;IAI3E,CAAC;IAEkB,SAAS,CAAC,GAAW,EAAE,IAAe;QACtD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CACH;AASD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAKjC,QAA8B,EAC9B,SAAmD,EACnD,OAA6B;IAE7B,OAAO,IAAI,oBAAoB,CAA+B,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC/F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/core",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.85",
|
|
4
4
|
"description": "Foundational runtime of the hydranium framework: AST coordination layer (services, integrity, AST extension, serialization, multi-client documents) plus the LSP textual head at the /lsp subpath. Consumed by protocol-head packages (@hydranium/data-server, @hydranium/glsp-server).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hydranium",
|
|
@@ -72,6 +72,14 @@
|
|
|
72
72
|
"./lib/testing/playwright": {
|
|
73
73
|
"types": "./lib/testing/playwright/index.d.ts",
|
|
74
74
|
"default": "./lib/testing/playwright/index.js"
|
|
75
|
+
},
|
|
76
|
+
"./messages": {
|
|
77
|
+
"types": "./lib/messages/index.d.ts",
|
|
78
|
+
"default": "./lib/messages/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./lib/messages": {
|
|
81
|
+
"types": "./lib/messages/index.d.ts",
|
|
82
|
+
"default": "./lib/messages/index.js"
|
|
75
83
|
}
|
|
76
84
|
},
|
|
77
85
|
"main": "lib/index.js",
|
|
@@ -96,8 +104,8 @@
|
|
|
96
104
|
"diff": "^5.2.0"
|
|
97
105
|
},
|
|
98
106
|
"devDependencies": {
|
|
99
|
-
"@hydranium/langium": "1.0.0-next.
|
|
100
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
107
|
+
"@hydranium/langium": "1.0.0-next.85",
|
|
108
|
+
"@hydranium/protocol": "1.0.0-next.85",
|
|
101
109
|
"@playwright/test": "^1.40.0",
|
|
102
110
|
"@types/diff": "^5.2.0",
|
|
103
111
|
"rimraf": "^5.0.0",
|
|
@@ -109,12 +117,12 @@
|
|
|
109
117
|
"vscode-languageserver-types": "^3.17.5"
|
|
110
118
|
},
|
|
111
119
|
"peerDependencies": {
|
|
112
|
-
"@hydranium/langium": "1.0.0-next.
|
|
113
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
120
|
+
"@hydranium/langium": "1.0.0-next.85",
|
|
121
|
+
"@hydranium/protocol": "1.0.0-next.85",
|
|
114
122
|
"@playwright/test": "^1.40.0",
|
|
115
|
-
"vscode-jsonrpc": "
|
|
116
|
-
"vscode-languageserver": "
|
|
117
|
-
"vscode-languageserver-protocol": "
|
|
123
|
+
"vscode-jsonrpc": "9.0.1",
|
|
124
|
+
"vscode-languageserver": "~10.0.1",
|
|
125
|
+
"vscode-languageserver-protocol": "~3.18.1",
|
|
118
126
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
119
127
|
"vscode-languageserver-types": "^3.17.5"
|
|
120
128
|
},
|
|
@@ -129,6 +137,7 @@
|
|
|
129
137
|
"publishConfig": {
|
|
130
138
|
"access": "public"
|
|
131
139
|
},
|
|
140
|
+
"//peerDependencies": "`vscode-jsonrpc` is EXACT rather than a range, because it is one link of an atomic chain with no independently movable link: `vscode-languageserver-protocol` depends on it at exactly 9.0.1, so any other value an adopter supplies is a SECOND physical copy rather than an upgrade. This wire stack breaks on copy identity rather than on structure — `ParameterStructures.auto` is a singleton compared by `===` in connection.js, so a request type built by one copy and sent over a connection owned by the other throws `Unknown parameter structure auto`. A caret or union range was rejected because npm then resolves a `vscode-jsonrpc@8.2.0` tree SILENTLY, with no diagnostic at all, and the failure surfaces only later at server init. Exact does not fail the install either — npm downgrades an unsatisfiable peer to a warning — but it is a NAMED ERESOLVE warning printing the required version beside the found one, and a hard error for anyone installing with `--strict-peer-deps`. It does NOT prevent a NESTED copy — `@eclipse-glsp/*` carries its own exact `vscode-jsonrpc@8.2.0` dependency and root `overrides` do not ship — so a consumer of the GLSP head must pin the chain in its own manifest, and docs/adopting/requirements.md carries the block to paste. This manifest declares the two links ABOVE the transport as well, and they carry `~` for the same reason: each admits exactly what `langium@4.3.1` itself admits, and a wider range reaches a `vscode-languageserver@9` / `vscode-languageserver-protocol@3.17.x` that depends on the 8.x transport, which is the same split one level up. `vscode-languageserver-types` and `vscode-languageserver-textdocument` are deliberately NOT narrowed: both declare zero dependencies and expose structural APIs, so a duplicate of either drags no transport in and no identity check reads it.",
|
|
132
141
|
"//prepack": "The publish guard, and it deliberately is NOT a `prepare`: npm runs a workspace `prepare` BEFORE the root `postinstall` that applies patches/vscode-jsonrpc+9.0.1.patch, so building there fails on a cold clone and npm rolls the entire install back. `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. It FAILS rather than rebuilds, because the rebuild is exactly the part that ordering defeats. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error.",
|
|
133
142
|
"//sideEffects": "NOT `false`: two barrels do work at module load that their re-exports do not account for, and a bundler skips an unflagged re-export barrel outright. `node/index.js` calls `installNodeLogFileSink()` and `installNodeWriteLockScope()`, which is how a Node host gets the log file-tee and write-lock reentrancy detection merely by importing `@hydranium/core/node`. `util/index.js` carries a bare `import '@hydranium/langium'` so the `UriUtils` namespace augmentation stays loaded for anything importing from here. Both failures are runtime-only and silent — a missing log file, a `UriUtils.toUri` that is `undefined`."
|
|
134
143
|
}
|
|
@@ -12,7 +12,9 @@ import {
|
|
|
12
12
|
type Tracer,
|
|
13
13
|
type TransferSavedEvent,
|
|
14
14
|
type TransferUpdatedEvent,
|
|
15
|
-
type OpenModelArgs
|
|
15
|
+
type OpenModelArgs,
|
|
16
|
+
asSnapshotVersion,
|
|
17
|
+
type SnapshotVersion
|
|
16
18
|
} from '@hydranium/protocol';
|
|
17
19
|
import {
|
|
18
20
|
type AstNode,
|
|
@@ -24,6 +26,7 @@ import {
|
|
|
24
26
|
UriUtils
|
|
25
27
|
} from '@hydranium/langium';
|
|
26
28
|
import { type LogNameOptions } from '../langium/diagnostics/logger.js';
|
|
29
|
+
import { type AstDiagnostic } from '../langium/validation/document-validator.js';
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* File-system provider extension that supports writes. Langium's standard
|
|
@@ -102,19 +105,19 @@ export interface UpdateInfo {
|
|
|
102
105
|
* twins; the type-system distinction is the generic constraint, and the
|
|
103
106
|
* conversion seam between them is the framework `TransferEncoder`.
|
|
104
107
|
*/
|
|
105
|
-
export interface AstDocument<TAst extends AstNode, TDiagnostic> {
|
|
108
|
+
export interface AstDocument<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic> {
|
|
106
109
|
root: TAst;
|
|
107
110
|
diagnostics: TDiagnostic[];
|
|
108
111
|
uri: string;
|
|
109
112
|
/**
|
|
110
113
|
* Text-document version this snapshot was taken at — read from
|
|
111
114
|
* `LangiumDocument.textDocument.version`. Symmetric with
|
|
112
|
-
* `TransferDocument.version` on the wire side: in-process
|
|
113
|
-
*
|
|
114
|
-
* `TransferUpdateArgs.
|
|
115
|
-
*
|
|
115
|
+
* `TransferDocument.version` on the wire side: an in-process caller that
|
|
116
|
+
* holds an `AstDocument` and mutates it sends this straight back as
|
|
117
|
+
* `TransferUpdateArgs.basedOn` / `TransferSaveArgs.basedOn`, and the
|
|
118
|
+
* conflict gate arms on it.
|
|
116
119
|
*/
|
|
117
|
-
version:
|
|
120
|
+
version: SnapshotVersion;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
export namespace AstDocument {
|
|
@@ -124,13 +127,13 @@ export namespace AstDocument {
|
|
|
124
127
|
* don't need to repeat the empty array at every call site. Mirrors
|
|
125
128
|
* `TransferDocument.create` on the wire side.
|
|
126
129
|
*/
|
|
127
|
-
export function create<TAst extends AstNode, TDiagnostic =
|
|
130
|
+
export function create<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic>(
|
|
128
131
|
uri: string,
|
|
129
132
|
version: number,
|
|
130
133
|
root: TAst,
|
|
131
134
|
diagnostics: TDiagnostic[] = []
|
|
132
135
|
): AstDocument<TAst, TDiagnostic> {
|
|
133
|
-
return { uri, version, root, diagnostics };
|
|
136
|
+
return { uri, version: asSnapshotVersion(version), root, diagnostics };
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
/**
|
|
@@ -146,26 +149,82 @@ export namespace AstDocument {
|
|
|
146
149
|
* carry that identity, not the subscriber's (possibly non-canonical) URI:
|
|
147
150
|
* a subscriber already knows the URI it subscribed with, so the useful
|
|
148
151
|
* thing to surface is the canonical one every other layer keys by.
|
|
152
|
+
*
|
|
153
|
+
* Narrowing `TDiagnostic` below the constraint asserts that the validators
|
|
154
|
+
* in play produce that shape, and nothing here checks it: the build fills the
|
|
155
|
+
* array, so a document carrying a diagnostic from elsewhere — a lexer error,
|
|
156
|
+
* another validator — satisfies the declared type and not the narrowed one.
|
|
149
157
|
*/
|
|
150
|
-
export function from<TAst extends AstNode, TDiagnostic =
|
|
158
|
+
export function from<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic>(
|
|
159
|
+
document: LangiumDocument
|
|
160
|
+
): AstDocument<TAst, TDiagnostic> {
|
|
151
161
|
return create<TAst, TDiagnostic>(
|
|
152
162
|
document.textDocument.uri,
|
|
153
163
|
document.textDocument.version,
|
|
154
164
|
document.parseResult.value as TAst,
|
|
155
|
-
(document.diagnostics ?? []) as
|
|
165
|
+
(document.diagnostics ?? []) as TDiagnostic[]
|
|
156
166
|
);
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
/** Update event delivered by {@link AstDocumentManager.onUpdate} — typed alias over the generic event wrapper. */
|
|
161
|
-
export type AstDocumentUpdatedEvent<TAst extends AstNode, TDiagnostic> = TransferUpdatedEvent<
|
|
171
|
+
export type AstDocumentUpdatedEvent<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic> = TransferUpdatedEvent<
|
|
172
|
+
AstDocument<TAst, TDiagnostic>
|
|
173
|
+
>;
|
|
162
174
|
|
|
163
175
|
/** Save event delivered by {@link AstDocumentManager.onSave} — typed alias over the generic event wrapper. */
|
|
164
|
-
export type AstDocumentSavedEvent<TAst extends AstNode, TDiagnostic> = TransferSavedEvent<
|
|
176
|
+
export type AstDocumentSavedEvent<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic> = TransferSavedEvent<
|
|
177
|
+
AstDocument<TAst, TDiagnostic>
|
|
178
|
+
>;
|
|
165
179
|
|
|
166
180
|
/** Construction options for {@link AstDocumentManager}. */
|
|
167
181
|
export type AstDocumentManagerOptions = LogNameOptions;
|
|
168
182
|
|
|
183
|
+
/**
|
|
184
|
+
* The document slot the model server and the integrity service talk to:
|
|
185
|
+
* open/close/update/save plus the AST-typed event streams, with the LSP
|
|
186
|
+
* plumbing hidden.
|
|
187
|
+
*
|
|
188
|
+
* Generic over `<TAst extends AstNode, TDiagnostic>` so each consumer projects
|
|
189
|
+
* its own AST root type and diagnostic shape into the emitted
|
|
190
|
+
* {@link AstDocument} envelopes.
|
|
191
|
+
*
|
|
192
|
+
* **URI contract.** Every URI-accepting member takes a URI in *any* spelling
|
|
193
|
+
* (canonical, symlinked, `..`/case-divergent) and canonicalizes internally
|
|
194
|
+
* through the {@link DocumentUriPolicy}, so a caller never has to canonicalize
|
|
195
|
+
* first and an implementation may not require it.
|
|
196
|
+
*/
|
|
197
|
+
export interface AstDocumentManager<TAst extends AstNode, TDiagnostic extends AstDiagnostic = AstDiagnostic> {
|
|
198
|
+
open(args: OpenModelArgs): Promise<Disposable>;
|
|
199
|
+
close(args: CloseModelArgs): Promise<void>;
|
|
200
|
+
isOpen(uri: string): boolean;
|
|
201
|
+
|
|
202
|
+
/** Apply `text` as `clientId`'s edit. Resolves to the resulting text-document version. */
|
|
203
|
+
update(uri: string, text: string, clientId: string): Promise<number>;
|
|
204
|
+
save(uri: string, clientId: string): Promise<void>;
|
|
205
|
+
|
|
206
|
+
onUpdate(uri: string, listener: (event: AstDocumentUpdatedEvent<TAst, TDiagnostic>) => void): Disposable;
|
|
207
|
+
onSave(uri: string, listener: (event: AstDocumentSavedEvent<TAst, TDiagnostic>) => void | Promise<void>): Disposable;
|
|
208
|
+
onClientClosed(uri: string, clientId: string, listener: () => void): Disposable;
|
|
209
|
+
|
|
210
|
+
getDocument(uri: string): LangiumDocument | undefined;
|
|
211
|
+
|
|
212
|
+
/** Client id that authored the document's current version, or `undefined` for a framework-internal build. */
|
|
213
|
+
getAuthor(document: LangiumDocument): string | undefined;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Whether `uri` is one of the URIs the most recent build request named, as
|
|
217
|
+
* opposed to a document that build swept in as a dependent. Deletions are
|
|
218
|
+
* excluded: they never reach this layer, since a deleted document is
|
|
219
|
+
* removed before the build set is computed.
|
|
220
|
+
*
|
|
221
|
+
* The answer refers to the latest request, which may still be building, and
|
|
222
|
+
* it is retained between builds — so outside a build it describes whichever
|
|
223
|
+
* one ran last.
|
|
224
|
+
*/
|
|
225
|
+
isTriggeringEdit(uri: string): boolean;
|
|
226
|
+
}
|
|
227
|
+
|
|
169
228
|
/**
|
|
170
229
|
* Higher-level facade over {@link HydraniumTextDocuments} that speaks the
|
|
171
230
|
* model-server protocol (open/close/update/save with the transfer-model event
|
|
@@ -186,7 +245,10 @@ export type AstDocumentManagerOptions = LogNameOptions;
|
|
|
186
245
|
* resolution (the egress `applyEditToLanguageClient`) stay on
|
|
187
246
|
* {@link HydraniumTextDocuments}, their owner.
|
|
188
247
|
*/
|
|
189
|
-
export class
|
|
248
|
+
export class DefaultAstDocumentManager<
|
|
249
|
+
TAst extends AstNode,
|
|
250
|
+
TDiagnostic extends AstDiagnostic = AstDiagnostic
|
|
251
|
+
> implements AstDocumentManager<TAst, TDiagnostic> {
|
|
190
252
|
protected lastUpdate?: UpdateInfo;
|
|
191
253
|
|
|
192
254
|
protected readonly textDocuments: HydraniumTextDocuments<TextDocument>;
|
|
@@ -311,11 +373,12 @@ export class AstDocumentManager<TAst extends AstNode = AstNode, TDiagnostic = un
|
|
|
311
373
|
const event: TransferUpdatedEvent<AstDocument<TAst, TDiagnostic>> = {
|
|
312
374
|
document: this.toAstDocument(document),
|
|
313
375
|
sourceClientId,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
376
|
+
// No `'deleted'` arm: `DocumentBuilder.update` drops a deleted
|
|
377
|
+
// document from `LangiumDocuments` before deriving the rebuild set
|
|
378
|
+
// from it, so a deleted URI is never built and never reaches this
|
|
379
|
+
// phase listener. A subscriber needing deletions has to be told on
|
|
380
|
+
// a channel that does not require a built document.
|
|
381
|
+
reason: this.lastUpdate?.changed.some(changed => UriUtils.equals(changed, document.uri)) ? 'changed' : 'rebuilt'
|
|
319
382
|
};
|
|
320
383
|
this.tracer.with(uri).trace(`emitUpdate start: source=${sourceClientId}, reason=${event.reason}`);
|
|
321
384
|
listener(event);
|
|
@@ -334,7 +397,7 @@ export class AstDocumentManager<TAst extends AstNode = AstNode, TDiagnostic = un
|
|
|
334
397
|
* concrete value (the `onUpdate` event's `sourceClientId`, the data-server's
|
|
335
398
|
* `resolveSourceClientId`).
|
|
336
399
|
*/
|
|
337
|
-
getAuthor(document: LangiumDocument
|
|
400
|
+
getAuthor(document: LangiumDocument): string | undefined {
|
|
338
401
|
return this.textDocuments.getAuthor(document.textDocument.uri, document.textDocument.version);
|
|
339
402
|
}
|
|
340
403
|
|
|
@@ -355,10 +418,17 @@ export class AstDocumentManager<TAst extends AstNode = AstNode, TDiagnostic = un
|
|
|
355
418
|
// transiently breaks cross-document linking mid-rebuild (a dependent briefly
|
|
356
419
|
// seeing an `extends`/`type` reference unresolved). And because the constructor
|
|
357
420
|
// wires `onDidOpen -> this.open`, it would fire a second, identical rebuild on
|
|
358
|
-
// every first open.
|
|
421
|
+
// every first open.
|
|
422
|
+
//
|
|
423
|
+
// So an already-open `open()` records the attaching client's hold and nothing
|
|
424
|
+
// else. The hold is per `(uri, clientId)` and the last-close revert counts down
|
|
425
|
+
// to it, so skipping it lets the first holder's close tear down a document
|
|
426
|
+
// another client is still reading.
|
|
359
427
|
if (!this.isOpen(args.uri)) {
|
|
360
428
|
const textDocument = await this.createDocumentFromTextOrFileSystem(args.uri, args.languageId, args.version, args.text);
|
|
361
429
|
this.textDocuments.notifyDidOpenTextDocument({ textDocument }, args.clientId);
|
|
430
|
+
} else {
|
|
431
|
+
this.textDocuments.attachClient(args.uri, args.clientId);
|
|
362
432
|
}
|
|
363
433
|
return Disposable.create(() => this.close(args));
|
|
364
434
|
}
|
|
@@ -393,29 +463,56 @@ export class AstDocumentManager<TAst extends AstNode = AstNode, TDiagnostic = un
|
|
|
393
463
|
* callers don't need to pass it — the manager owns content and version
|
|
394
464
|
* sequencing.
|
|
395
465
|
*
|
|
466
|
+
* **The write is skipped when the file already holds that text; the
|
|
467
|
+
* notification is not.** A save announces that the content is on disk, which
|
|
468
|
+
* is true either way — so a subscriber clearing a dirty marker or reacting to
|
|
469
|
+
* a persist behaves the same, while an mtime is not moved for byte-identical
|
|
470
|
+
* content that a downstream mtime-keyed build would then read as new work.
|
|
471
|
+
*
|
|
396
472
|
* Throws if no document is open for `uri`.
|
|
397
473
|
*/
|
|
398
474
|
async save(uri: string, clientId: string): Promise<void> {
|
|
399
|
-
|
|
475
|
+
// Canonical throughout: the write and the read that gates it must address
|
|
476
|
+
// the same file the store was keyed by, or a divergent spelling compares
|
|
477
|
+
// one file and writes another.
|
|
478
|
+
const canonical = this.uriPolicy.canonicalUri(uri);
|
|
479
|
+
const document = this.textDocuments.get(canonical);
|
|
400
480
|
if (!document) {
|
|
401
481
|
throw new Error(`Document ${uri} hasn't been opened for saving yet`);
|
|
402
482
|
}
|
|
403
483
|
const text = document.getText();
|
|
404
|
-
await this.
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
484
|
+
if (!(await this.matchesDisk(canonical, text))) {
|
|
485
|
+
await this.tracer.with(canonical).time(
|
|
486
|
+
`Write file (${text.length} bytes, from ${clientId})`,
|
|
487
|
+
// Async write so a slow disk does not block the event loop for the duration of the fs call.
|
|
488
|
+
() => this.fileSystemProvider.writeFile(UriUtils.toUri(canonical), text),
|
|
489
|
+
'debug'
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
this.textDocuments.notifyDidSaveTextDocument({ textDocument: TextDocumentIdentifier.create(canonical), text }, clientId);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Whether the file at `uri` already holds `text`.
|
|
497
|
+
*
|
|
498
|
+
* Compared by CONTENT rather than against a remembered version, so a write
|
|
499
|
+
* from outside this server is still corrected: a version this manager already
|
|
500
|
+
* saved says nothing about what is on disk now. `false` when the file cannot
|
|
501
|
+
* be read at all, which is the answer that writes — a document whose file does
|
|
502
|
+
* not exist yet is exactly the one a first save has to create.
|
|
503
|
+
*/
|
|
504
|
+
protected async matchesDisk(uri: string, text: string): Promise<boolean> {
|
|
505
|
+
return this.fileSystemProvider
|
|
506
|
+
.readFile(UriUtils.toUri(uri))
|
|
507
|
+
.then(onDisk => onDisk === text)
|
|
508
|
+
.catch(() => false);
|
|
411
509
|
}
|
|
412
510
|
|
|
413
511
|
isOpen(uri: string): boolean {
|
|
414
512
|
return !!this.textDocuments.get(uri);
|
|
415
513
|
}
|
|
416
514
|
|
|
417
|
-
|
|
418
|
-
isDirectChange(uri: string): boolean {
|
|
515
|
+
isTriggeringEdit(uri: string): boolean {
|
|
419
516
|
const canonical = this.uriPolicy.canonicalUri(uri);
|
|
420
517
|
return this.lastUpdate?.changed.some(changed => this.uriPolicy.canonicalUri(changed) === canonical) ?? false;
|
|
421
518
|
}
|
|
@@ -437,11 +534,7 @@ export class AstDocumentManager<TAst extends AstNode = AstNode, TDiagnostic = un
|
|
|
437
534
|
version = 0,
|
|
438
535
|
text?: string
|
|
439
536
|
): Promise<TextDocumentItem> {
|
|
440
|
-
return { uri, languageId, version, text: text ?? (await this.readFile(uri)) };
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
async readFile(uri: string): Promise<string> {
|
|
444
|
-
return this.fileSystemProvider.readFile(UriUtils.toUri(uri));
|
|
537
|
+
return { uri, languageId, version, text: text ?? (await this.fileSystemProvider.readFile(UriUtils.toUri(uri))) };
|
|
445
538
|
}
|
|
446
539
|
|
|
447
540
|
/**
|
|
@@ -8,26 +8,9 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* client, and/or a structured-form client. Each kind carries a stable id so
|
|
16
|
-
* the server can route outbound corrections, edits, and notifications to the
|
|
17
|
-
* right transport.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/** Identifier for an LSP-text client (Monaco, VS Code, …). */
|
|
21
|
-
export const LANGUAGE_CLIENT_ID = 'language-client';
|
|
22
|
-
|
|
23
|
-
/** Fallback identifier when a document's author is unknown (e.g. cold workspace-init load). */
|
|
24
|
-
export const UNKNOWN_CLIENT_ID = 'unknown';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Synthetic author id on the `onDocumentUpdated` broadcast a data-server
|
|
28
|
-
* emits after the LAST client closed a document and the framework rebuilt it
|
|
29
|
-
* from its disk content (discarding unsaved in-session edits). Not a real
|
|
30
|
-
* client: it lets consumers distinguish the revert broadcast from
|
|
31
|
-
* client-authored updates.
|
|
11
|
+
* Re-export, because these are WIRE values and the side that has to recognise
|
|
12
|
+
* them is the client. They are defined in `@hydranium/protocol` so a frontend
|
|
13
|
+
* can name them without depending on the server tier; this path stays so
|
|
14
|
+
* server-side code keeps importing them from where it already does.
|
|
32
15
|
*/
|
|
33
|
-
export
|
|
16
|
+
export { FRAMEWORK_CLIENT_IDS, LANGUAGE_CLIENT_ID, REVERT_ON_CLOSE_CLIENT_ID, UNKNOWN_CLIENT_ID } from '@hydranium/protocol';
|