@hydranium/glsp-server 1.0.0-next.31 → 1.0.0-next.315
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -88
- package/lib/browser/start-glsp-server-in-worker.d.ts +43 -42
- package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
- package/lib/browser/start-glsp-server-in-worker.js +62 -13
- package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
- package/lib/command/diagram-edit-dropped-error.d.ts +31 -0
- package/lib/command/diagram-edit-dropped-error.d.ts.map +1 -0
- package/lib/command/diagram-edit-dropped-error.js +48 -0
- package/lib/command/diagram-edit-dropped-error.js.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts +33 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.js +63 -0
- package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
- package/lib/command/hydranium-glsp-operation-action-handler.d.ts +64 -0
- package/lib/command/hydranium-glsp-operation-action-handler.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-operation-action-handler.js +142 -0
- package/lib/command/hydranium-glsp-operation-action-handler.js.map +1 -0
- package/lib/command/hydranium-glsp-operation-command.d.ts +250 -0
- package/lib/command/hydranium-glsp-operation-command.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-operation-command.js +491 -0
- package/lib/command/hydranium-glsp-operation-command.js.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts +26 -87
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +40 -117
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts +23 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js +41 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js.map +1 -0
- package/lib/command/index.d.ts +5 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +5 -0
- package/lib/command/index.js.map +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts.map +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js +2 -2
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -1
- package/lib/dispatcher/server-action-dispatcher.d.ts +25 -24
- package/lib/dispatcher/server-action-dispatcher.d.ts.map +1 -1
- package/lib/dispatcher/server-action-dispatcher.js +38 -26
- package/lib/dispatcher/server-action-dispatcher.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +35 -59
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +60 -71
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
- package/lib/launcher/drop-notifications-to-gone-client.d.ts +23 -0
- package/lib/launcher/drop-notifications-to-gone-client.d.ts.map +1 -0
- package/lib/launcher/drop-notifications-to-gone-client.js +43 -0
- package/lib/launcher/drop-notifications-to-gone-client.js.map +1 -0
- package/lib/launcher/glsp-app-module.d.ts +1 -2
- package/lib/launcher/glsp-app-module.d.ts.map +1 -1
- package/lib/launcher/glsp-app-module.js.map +1 -1
- package/lib/launcher/glsp-connection-logger.d.ts +19 -0
- package/lib/launcher/glsp-connection-logger.d.ts.map +1 -0
- package/lib/launcher/glsp-connection-logger.js +24 -0
- package/lib/launcher/glsp-connection-logger.js.map +1 -0
- package/lib/launcher/glsp-server-overrides.d.ts +10 -8
- package/lib/launcher/glsp-server-overrides.d.ts.map +1 -1
- package/lib/launcher/glsp-server-overrides.js +25 -11
- package/lib/launcher/glsp-server-overrides.js.map +1 -1
- package/lib/launcher/hydranium-glsp-server.d.ts +60 -15
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
- package/lib/launcher/hydranium-glsp-server.js +145 -22
- package/lib/launcher/hydranium-glsp-server.js.map +1 -1
- package/lib/launcher/index.d.ts +2 -0
- package/lib/launcher/index.d.ts.map +1 -1
- package/lib/launcher/index.js +5 -4
- package/lib/launcher/index.js.map +1 -1
- package/lib/logging/glsp-client-logger.d.ts +10 -6
- package/lib/logging/glsp-client-logger.d.ts.map +1 -1
- package/lib/logging/glsp-client-logger.js +14 -7
- package/lib/logging/glsp-client-logger.js.map +1 -1
- package/lib/messages/index.d.ts +11 -6
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +11 -6
- package/lib/messages/index.js.map +1 -1
- package/lib/node/start-glsp-server.d.ts +50 -15
- package/lib/node/start-glsp-server.d.ts.map +1 -1
- package/lib/node/start-glsp-server.js +97 -30
- package/lib/node/start-glsp-server.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +326 -102
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +529 -139
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/state/diagram-status.d.ts +38 -0
- package/lib/state/diagram-status.d.ts.map +1 -0
- package/lib/state/diagram-status.js +27 -0
- package/lib/state/diagram-status.js.map +1 -0
- package/lib/state/full-text-hydranium-glsp-state.d.ts +22 -9
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.js +45 -18
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
- package/lib/state/hydranium-glsp-index.d.ts +40 -29
- package/lib/state/hydranium-glsp-index.d.ts.map +1 -1
- package/lib/state/hydranium-glsp-index.js +82 -45
- package/lib/state/hydranium-glsp-index.js.map +1 -1
- package/lib/state/hydranium-shared-core-services.d.ts +16 -29
- package/lib/state/hydranium-shared-core-services.d.ts.map +1 -1
- package/lib/state/hydranium-shared-core-services.js +15 -28
- package/lib/state/hydranium-shared-core-services.js.map +1 -1
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.d.ts.map +1 -1
- package/lib/state/index.js +1 -0
- package/lib/state/index.js.map +1 -1
- package/lib/state/model-ready-timeout-error.d.ts.map +1 -1
- package/lib/state/model-ready-timeout-error.js.map +1 -1
- package/lib/state/reconcile-source-model-write.d.ts +13 -27
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
- package/lib/state/reconcile-source-model-write.js +44 -32
- package/lib/state/reconcile-source-model-write.js.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +125 -69
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +242 -100
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +36 -28
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +59 -42
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- package/lib/status/diagram-status-reporter.d.ts +44 -0
- package/lib/status/diagram-status-reporter.d.ts.map +1 -0
- package/lib/status/diagram-status-reporter.js +88 -0
- package/lib/status/diagram-status-reporter.js.map +1 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.d.ts +27 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.d.ts.map +1 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.js +52 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.js.map +1 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts +27 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts.map +1 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js +53 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js.map +1 -0
- package/lib/status/index.d.ts +12 -0
- package/lib/status/index.d.ts.map +1 -0
- package/lib/status/index.js +12 -0
- package/lib/status/index.js.map +1 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts +30 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts.map +1 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.js +47 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.js.map +1 -0
- package/lib/storage/hydranium-glsp-storage.d.ts +324 -143
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
- package/lib/storage/hydranium-glsp-storage.js +569 -213
- package/lib/storage/hydranium-glsp-storage.js.map +1 -1
- package/lib/storage/index.d.ts +2 -1
- package/lib/storage/index.d.ts.map +1 -1
- package/lib/storage/index.js +2 -1
- package/lib/storage/index.js.map +1 -1
- package/lib/storage/save-delivery-policy.d.ts +51 -0
- package/lib/storage/save-delivery-policy.d.ts.map +1 -0
- package/lib/storage/{save-conflict-policy.js → save-delivery-policy.js} +7 -8
- package/lib/storage/save-delivery-policy.js.map +1 -0
- package/lib/submission/hydranium-glsp-submission-handler.d.ts +44 -4
- package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -1
- package/lib/submission/hydranium-glsp-submission-handler.js +82 -6
- package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -1
- package/lib/testing/glsp-harness.d.ts +34 -7
- package/lib/testing/glsp-harness.d.ts.map +1 -1
- package/lib/testing/glsp-harness.js +47 -19
- package/lib/testing/glsp-harness.js.map +1 -1
- package/lib/validation/diagnostic-markers.d.ts +3 -3
- package/lib/validation/diagnostic-markers.d.ts.map +1 -1
- package/lib/validation/diagnostic-markers.js +1 -1
- package/lib/validation/diagnostic-markers.js.map +1 -1
- package/lib/validation/hydranium-glsp-model-validator.d.ts +1 -2
- package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -1
- package/lib/validation/hydranium-glsp-model-validator.js +1 -1
- package/lib/validation/hydranium-glsp-model-validator.js.map +1 -1
- package/package.json +31 -52
- package/src/browser/start-glsp-server-in-worker.ts +79 -51
- package/src/command/diagram-edit-dropped-error.ts +51 -0
- package/src/command/hydranium-glsp-command-stack.ts +47 -0
- package/src/command/hydranium-glsp-operation-action-handler.ts +141 -0
- package/src/command/hydranium-glsp-operation-command.ts +602 -0
- package/src/command/hydranium-glsp-recording-command.ts +40 -121
- package/src/command/hydranium-glsp-undo-redo-action-handler.ts +29 -0
- package/src/command/index.ts +10 -0
- package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +2 -2
- package/src/dispatcher/server-action-dispatcher.ts +39 -31
- package/src/index.ts +1 -0
- package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +79 -91
- package/src/launcher/drop-notifications-to-gone-client.ts +47 -0
- package/src/launcher/glsp-app-module.ts +1 -2
- package/src/launcher/glsp-connection-logger.ts +27 -0
- package/src/launcher/glsp-server-overrides.ts +27 -11
- package/src/launcher/hydranium-glsp-server.ts +153 -23
- package/src/launcher/index.ts +5 -4
- package/src/logging/glsp-client-logger.ts +16 -9
- package/src/messages/index.ts +16 -6
- package/src/node/start-glsp-server.ts +133 -40
- package/src/state/abstract-hydranium-glsp-state.ts +609 -154
- package/src/state/diagram-status.ts +41 -0
- package/src/state/full-text-hydranium-glsp-state.ts +46 -18
- package/src/state/hydranium-glsp-index.ts +85 -41
- package/src/state/hydranium-shared-core-services.ts +16 -29
- package/src/state/index.ts +1 -0
- package/src/state/reconcile-source-model-write.ts +51 -53
- package/src/state/reconciling-multi-document-glsp-state.ts +276 -102
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +67 -45
- package/src/status/diagram-status-reporter.ts +106 -0
- package/src/status/hydranium-glsp-request-model-action-handler.ts +43 -0
- package/src/status/hydranium-glsp-set-edit-mode-action-handler.ts +38 -0
- package/src/status/index.ts +12 -0
- package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
- package/src/storage/hydranium-glsp-storage.ts +647 -223
- package/src/storage/index.ts +2 -1
- package/src/storage/save-delivery-policy.ts +49 -0
- package/src/submission/hydranium-glsp-submission-handler.ts +91 -5
- package/src/testing/glsp-harness.ts +67 -25
- package/src/validation/diagnostic-markers.ts +3 -3
- package/src/validation/hydranium-glsp-model-validator.ts +4 -5
- package/lib/storage/save-conflict-policy.d.ts +0 -56
- package/lib/storage/save-conflict-policy.d.ts.map +0 -1
- package/lib/storage/save-conflict-policy.js.map +0 -1
- package/src/storage/save-conflict-policy.ts +0 -52
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { DefaultModelState, type MaybePromise } from '@eclipse-glsp/server';
|
|
10
10
|
import { Emitter, type Event } from 'vscode-jsonrpc';
|
|
11
|
-
import { type AstNode, DocumentState } from '@hydranium/langium';
|
|
12
|
-
import { type HydraniumScopeProvider, type LanguageTarget, type NameProvider, type ReferenceCandidateProvider, type ServerLanguageServices, type ServerSharedServices } from '@hydranium/core';
|
|
13
|
-
import type
|
|
11
|
+
import { type AstNode, DocumentState, type Reference, type ReferenceInfo } from '@hydranium/langium';
|
|
12
|
+
import { type ClientSession, type HydraniumScopeProvider, type LanguageTarget, type NameProvider, type ReferenceCandidateProvider, type ServerLanguageServices, type ServerSharedServices } from '@hydranium/core';
|
|
13
|
+
import { type BaseVersion, type ModelVersion, type ConflictResolver, type Logger, type Tracer, type TransferElement } from '@hydranium/protocol';
|
|
14
|
+
import { type OperationTransition } from '../command/hydranium-glsp-operation-command.js';
|
|
15
|
+
import { type DiagramStatus, type DiagramStatusEntry } from './diagram-status.js';
|
|
14
16
|
import { type HydraniumGlspIndex } from './hydranium-glsp-index.js';
|
|
15
17
|
import { ModelReadyTimeoutError } from './model-ready-timeout-error.js';
|
|
16
18
|
/**
|
|
@@ -38,7 +40,7 @@ import { ModelReadyTimeoutError } from './model-ready-timeout-error.js';
|
|
|
38
40
|
* override only to change the error shape (richer per-adopter output comes
|
|
39
41
|
* from overriding `wsRelativePath` / `formatBuildStatus`).
|
|
40
42
|
* - logging — see {@link baseTracer}. Adopters wanting a different label
|
|
41
|
-
* override `
|
|
43
|
+
* override `captureSourceRoot` and derive via
|
|
42
44
|
* `this.baseTracer.for('Name').withUri(uri)`.
|
|
43
45
|
*
|
|
44
46
|
* **Lifecycle ordering.** Reading {@link sourceUri} or {@link sourceRoot}
|
|
@@ -47,7 +49,7 @@ import { ModelReadyTimeoutError } from './model-ready-timeout-error.js';
|
|
|
47
49
|
* (typically from the storage `loadSourceModel` flow) before reading them.
|
|
48
50
|
* The {@link logger}/{@link tracer} are the exception: the injected
|
|
49
51
|
* {@link baseTracer} is always available, so the getters fall back to it
|
|
50
|
-
* before {@link
|
|
52
|
+
* before {@link captureSourceRoot} derives the URI-tagged {@link _tracer} —
|
|
51
53
|
* logging is never `undefined`.
|
|
52
54
|
*/
|
|
53
55
|
export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode, TSourceModel = string> extends DefaultModelState {
|
|
@@ -62,21 +64,69 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
62
64
|
* `updateSourceModel` implementations.
|
|
63
65
|
*/
|
|
64
66
|
readonly conflictResolver: ConflictResolver;
|
|
67
|
+
/**
|
|
68
|
+
* Writes of one diagram edit, the first included, that may conflict before
|
|
69
|
+
* the edit is dropped with a warning; each further write reconciles again.
|
|
70
|
+
*/
|
|
71
|
+
protected readonly maxSourceModelWrites: number;
|
|
65
72
|
/**
|
|
66
73
|
* Per-class tracer, caller-tagged with this state's runtime subclass name by
|
|
67
|
-
* the `HydraniumTypes.Tracer` binding. {@link
|
|
74
|
+
* the `HydraniumTypes.Tracer` binding. {@link captureSourceRoot} derives the
|
|
68
75
|
* URI-tagged {@link _tracer} from it; the {@link tracer}/{@link logger}
|
|
69
76
|
* getters fall back to it before then, so logging is never `undefined`.
|
|
70
77
|
*/
|
|
71
78
|
protected readonly baseTracer: Tracer;
|
|
72
79
|
/** Narrows {@link DefaultModelState.index} to the framework-extended index type. */
|
|
73
80
|
readonly index: HydraniumGlspIndex;
|
|
81
|
+
/**
|
|
82
|
+
* The client session this diagram works as, registered under `clientId` by
|
|
83
|
+
* the source-model storage's load and ended with the GLSP client session,
|
|
84
|
+
* or by a resume that takes it over. `undefined` before the load, for
|
|
85
|
+
* GLSP's placeholder client, and when another participant held the id, in
|
|
86
|
+
* which case the diagram does not load.
|
|
87
|
+
*
|
|
88
|
+
* Every write of the diagram goes through this session, which writes only a
|
|
89
|
+
* document it has open and opens nothing. A one-shot write to a document
|
|
90
|
+
* outside the write set goes through
|
|
91
|
+
* {@link ClientSession.withOpen}, and a document the diagram brings into
|
|
92
|
+
* existence through {@link ClientSession.create}.
|
|
93
|
+
*/
|
|
94
|
+
modelSession?: ClientSession<AstNode>;
|
|
95
|
+
/**
|
|
96
|
+
* {@link modelSession}, or a throw without one: the diagram never loaded or
|
|
97
|
+
* has ended. Looking `clientId` up through `ModelService.getSession` instead
|
|
98
|
+
* would write as whichever participant holds that id.
|
|
99
|
+
*/
|
|
100
|
+
protected requireModelSession(): ClientSession<AstNode>;
|
|
74
101
|
protected _sourceUri: string;
|
|
102
|
+
/**
|
|
103
|
+
* The language {@link _sourceUri} routed to at the last capture, or
|
|
104
|
+
* `undefined` when it routes nowhere. Captured rather than looked up on
|
|
105
|
+
* each {@link diagramLanguage} read, which a GModel factory may make once
|
|
106
|
+
* per element, because the lookup parses the URI and walks the registry.
|
|
107
|
+
*/
|
|
108
|
+
protected _sourceLanguage?: ServerLanguageServices;
|
|
109
|
+
/**
|
|
110
|
+
* The root the last capture took, which every reader of the document
|
|
111
|
+
* shares. A projection that must see an operation's edits reads
|
|
112
|
+
* {@link sourceRoot}, which is a copy of it during an operation.
|
|
113
|
+
*/
|
|
75
114
|
protected _sourceRoot: TRoot;
|
|
115
|
+
/** Settles when the last {@link runExclusive} call queued so far has. */
|
|
116
|
+
protected exclusiveTail: Promise<unknown>;
|
|
76
117
|
protected _tracer?: Tracer;
|
|
77
|
-
protected
|
|
78
|
-
/**
|
|
79
|
-
|
|
118
|
+
protected _baseVersion: ModelVersion;
|
|
119
|
+
/**
|
|
120
|
+
* The built root each secondary's version was read from, keyed by
|
|
121
|
+
* canonical URI, and during an operation the root of any other document it
|
|
122
|
+
* first reached. An operation copies a secondary from here, so the copy,
|
|
123
|
+
* the base a conflict reconciles from and the version its write is gated
|
|
124
|
+
* on describe one revision; the registry's current root can be a later
|
|
125
|
+
* build's.
|
|
126
|
+
*/
|
|
127
|
+
protected readonly capturedRoots: Map<string, AstNode>;
|
|
128
|
+
/** Model versions of the secondary write set, keyed by URI. See {@link trackSecondaryDocument}. */
|
|
129
|
+
protected readonly _secondaryVersions: Map<string, ModelVersion>;
|
|
80
130
|
/** Backing emitter for {@link onSecondaryUrisChanged}; fired only on a membership change. */
|
|
81
131
|
protected readonly secondaryUrisChangedEmitter: Emitter<void>;
|
|
82
132
|
/** Default of one minute. */
|
|
@@ -84,45 +134,162 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
84
134
|
/** Maximum wait inside {@link readyWithTimeout} before raising {@link ModelReadyTimeoutError}. */
|
|
85
135
|
protected readyTimeoutMs: number;
|
|
86
136
|
/**
|
|
87
|
-
* Capture a freshly built source root alongside its URI
|
|
88
|
-
*
|
|
89
|
-
*
|
|
137
|
+
* Capture a freshly built source root alongside its URI through
|
|
138
|
+
* {@link captureSourceRoot}, and index the AST so downstream GModel
|
|
139
|
+
* projection can resolve elements back to nodes.
|
|
140
|
+
*
|
|
141
|
+
* Capturing the document already captured keeps what the last GModel build
|
|
142
|
+
* registered in the index, which only the next build makes again, and drops
|
|
143
|
+
* an id added through `indexSemanticElement` whose node a rebuild replaced.
|
|
90
144
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* stay consistent with the typed field.
|
|
145
|
+
* Throws during an operation: a capture there swaps the root out from under
|
|
146
|
+
* the nodes a handler resolved, and the operation captures when it ends.
|
|
94
147
|
*/
|
|
95
148
|
setSourceRoot(uri: string, root: TRoot): void;
|
|
149
|
+
/**
|
|
150
|
+
* Take `root` as the source root and read everything derived from it: the
|
|
151
|
+
* base version, every tracked secondary version, the URI mirrored into the
|
|
152
|
+
* inherited properties map under {@link SOURCE_URI_ARG}, and the
|
|
153
|
+
* URI-labelled logger. Everything but the index, which
|
|
154
|
+
* {@link setSourceRoot} sets. Override to derive more from a capture.
|
|
155
|
+
*/
|
|
156
|
+
protected captureSourceRoot(uri: string, root: TRoot): void;
|
|
96
157
|
/**
|
|
97
158
|
* Typed override of {@link DefaultModelState.sourceUri}. Narrows the
|
|
98
159
|
* inherited `string | undefined` to `string` (defined after
|
|
99
160
|
* {@link setSourceRoot}; throws on definite-assignment otherwise).
|
|
100
161
|
*/
|
|
101
162
|
get sourceUri(): string;
|
|
163
|
+
/** The root operation handlers edit: during an operation a copy of the built root, outside one the built root. */
|
|
102
164
|
get sourceRoot(): TRoot;
|
|
103
165
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
166
|
+
* Run `run` once every earlier call has settled, thrown or not: the
|
|
167
|
+
* boundary that orders operations, undo and redo, and the storage's capture
|
|
168
|
+
* and render. Code running inside it never calls this again, since the
|
|
169
|
+
* call would wait for the section it runs in.
|
|
170
|
+
*/
|
|
171
|
+
runExclusive<T>(run: () => MaybePromise<T>): Promise<T>;
|
|
172
|
+
/**
|
|
173
|
+
* The root of `uri` that operation handlers edit: during an operation a
|
|
174
|
+
* copy made on the first request and returned for the rest of it, outside
|
|
175
|
+
* one the root itself. The root is the built root of `uri`, or `orElse()`
|
|
176
|
+
* when `uri` has no document; `undefined` when neither gives one.
|
|
177
|
+
*
|
|
178
|
+
* A handler that edits another document than the source reaches its root
|
|
179
|
+
* through this, or the edit lands on the root every reader shares. An id
|
|
180
|
+
* added through `indexSemanticElement` for a node of that root names the
|
|
181
|
+
* node's copy from then on.
|
|
182
|
+
*/
|
|
183
|
+
workingRootOf(uri: string, orElse?: () => AstNode | undefined): AstNode | undefined;
|
|
184
|
+
/** The copy of `uri` the open operation made, without making one. */
|
|
185
|
+
protected existingWorkingRootOf(uri: string): AstNode | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* The key of `uri` among an operation's copies: its canonical form, so two
|
|
188
|
+
* spellings of one document share one copy.
|
|
189
|
+
*/
|
|
190
|
+
protected workingKey(uri: string): string;
|
|
191
|
+
/**
|
|
192
|
+
* The built node `node` was copied from during an operation; `node` itself
|
|
193
|
+
* for a built node, for a node the operation created, and outside one.
|
|
194
|
+
*
|
|
195
|
+
* A copy has no `$document`, so a lookup that reads its document, scope or
|
|
196
|
+
* project throws or answers for no document. Handlers pass the built node
|
|
197
|
+
* there and keep editing the copy. A candidate query takes
|
|
198
|
+
* {@link referenceInfoOf} instead, since a created node has no built node.
|
|
199
|
+
*/
|
|
200
|
+
builtNodeOf<T extends AstNode>(node: T): T;
|
|
201
|
+
/**
|
|
202
|
+
* A reference to `target` whose `ref` is `target` itself, a copy node
|
|
203
|
+
* included, so an identity comparison later in the operation finds it.
|
|
204
|
+
* `undefined` when no reference can be formed. Outside an operation the
|
|
205
|
+
* nodes are built ones and this is the `ReferenceBuilder`'s answer as is.
|
|
206
|
+
*
|
|
207
|
+
* With `tier: 'own'` the `$refText` is the target's own name as
|
|
208
|
+
* `toOwnReference` gives it, read off `target` itself, so a name the
|
|
209
|
+
* operation edited is the one written; the builder is the target's
|
|
210
|
+
* language's, which a copy node, having no `$document`, would not otherwise
|
|
211
|
+
* reach. `source` plays no part in that tier.
|
|
212
|
+
*
|
|
213
|
+
* By default it is `getReferenceName` from `source`'s context, with the
|
|
214
|
+
* builder of `source`'s language, since `$refText` encoding follows the
|
|
215
|
+
* grammar writing it. That call reads both nodes' projects, to pick the
|
|
216
|
+
* qualification and to refuse a reference across projects the target's is
|
|
217
|
+
* not visible to, and a copy node has none; so it is asked about the built
|
|
218
|
+
* target, which names a target as built, before any rename in the
|
|
219
|
+
* operation, and about {@link builtContextOf} the source. A target the
|
|
220
|
+
* operation created has no built node, and is asked about without a
|
|
221
|
+
* project.
|
|
222
|
+
*/
|
|
223
|
+
referenceTo<T extends AstNode>(target: T, source?: AstNode, options?: {
|
|
224
|
+
readonly tier?: 'own';
|
|
225
|
+
}): Reference<T> | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* A candidate query for `property` of `node`, to pass to
|
|
228
|
+
* `candidateProviderFor(node)?.find`. It is asked from the built node, and
|
|
229
|
+
* for a node the operation created from a stand-in of its type under the
|
|
230
|
+
* built containers it sits in, one per created level: a scope reads local
|
|
231
|
+
* names off every container up the chain, so anchoring higher drops them.
|
|
232
|
+
* A protocol context cannot express this: an element source resolves only
|
|
233
|
+
* through a `resolveElementByName` override, and through the index only
|
|
234
|
+
* for the nodes it exports. `undefined` for a node whose `$container` chain
|
|
235
|
+
* reaches no document and no copy, such as a node built with no
|
|
236
|
+
* `$container` that is not a document's root.
|
|
237
|
+
*
|
|
238
|
+
* A node not created yet is asked about through a stand-in built with
|
|
239
|
+
* `buildAstNode`: its type, `$container` the container it would join, and
|
|
240
|
+
* `$containerProperty`, left unattached.
|
|
241
|
+
*/
|
|
242
|
+
referenceInfoOf(node: AstNode, property: string): ReferenceInfo | undefined;
|
|
243
|
+
/**
|
|
244
|
+
* The built node of `node`, or of its nearest container that has one: a
|
|
245
|
+
* node the operation created has no built node, but its container's
|
|
246
|
+
* document and project are its own.
|
|
247
|
+
*/
|
|
248
|
+
protected builtContextOf(node: AstNode): AstNode;
|
|
249
|
+
/**
|
|
250
|
+
* Take `root`, which a write of this state's own produced, as the source
|
|
251
|
+
* root; during an operation the operation takes it and captures it when it
|
|
252
|
+
* ends.
|
|
253
|
+
*/
|
|
254
|
+
protected captureWrittenRoot(root: TRoot): void;
|
|
255
|
+
/**
|
|
256
|
+
* Resync after a write whose reconcile dropped the edit: during an
|
|
257
|
+
* operation the operation undoes its side effects, pushes nothing, and
|
|
258
|
+
* captures the document's current root when it ends.
|
|
259
|
+
*/
|
|
260
|
+
protected writeDropped(): void;
|
|
261
|
+
/**
|
|
262
|
+
* Take the document's built root as the source root; during an operation,
|
|
263
|
+
* as the root the operation closes on. A write the document already held,
|
|
264
|
+
* and an undo or redo that wrote nothing while its steps may have rebuilt
|
|
265
|
+
* the document, leave this state on a root that predates the document. The
|
|
266
|
+
* built root can lag the text until the next build, whose refresh captures
|
|
267
|
+
* that, as after {@link writeDropped}.
|
|
268
|
+
*/
|
|
269
|
+
captureBuiltRoot(): void;
|
|
270
|
+
/**
|
|
271
|
+
* Whether `node` belongs to the root its document is built to now, or to no
|
|
272
|
+
* document; a root a rebuild replaced holds only stale nodes.
|
|
273
|
+
*/
|
|
274
|
+
protected isCurrentBuiltNode(node: AstNode): boolean;
|
|
275
|
+
/**
|
|
276
|
+
* The language services of the diagram document: the language
|
|
277
|
+
* {@link sourceUri} routed to at the last {@link setSourceRoot}.
|
|
106
278
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* {@link languageServicesFor}. Making that choice explicit at the call site
|
|
111
|
-
* is the point; a neutral-looking `languageServices` invites the diagram's
|
|
112
|
-
* grammar to be applied to a foreign node, which is the defect this whole
|
|
113
|
-
* seam exists to prevent.
|
|
279
|
+
* `undefined` until a document is loaded, as GLSP builds a session's
|
|
280
|
+
* handlers at `InitializeClientSession`, before `RequestModelAction`
|
|
281
|
+
* supplies the URI: read it when called, not at construction.
|
|
114
282
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* `@optional()` so a harness that binds no diagram module still resolves;
|
|
119
|
-
* `undefined` then means no diagram module declared a grammar.
|
|
283
|
+
* Reach for it only when the thing you are asking about lives in the
|
|
284
|
+
* diagram document itself. Anything reached through a reference is decided
|
|
285
|
+
* by its own document: use {@link languageServicesFor}.
|
|
120
286
|
*/
|
|
121
|
-
|
|
287
|
+
get diagramLanguage(): ServerLanguageServices | undefined;
|
|
122
288
|
/**
|
|
123
289
|
* The language services owning `target` — an AST node (routed by its
|
|
124
|
-
* document), a URI, or a URI string — falling back to
|
|
125
|
-
*
|
|
290
|
+
* document), a URI, or a URI string — falling back, for a node, to the
|
|
291
|
+
* language the index read from the diagram's root, and otherwise to
|
|
292
|
+
* {@link diagramLanguage}, when `target` routes nowhere.
|
|
126
293
|
*
|
|
127
294
|
* Use this wherever the thing being named, keyed or completed may live in
|
|
128
295
|
* another document than the diagram. Two registered languages are free to
|
|
@@ -132,6 +299,9 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
132
299
|
* diagnostic. The fallback covers the genuinely unroutable case, a synthetic
|
|
133
300
|
* node not yet attached to a document, where the diagram's own language is
|
|
134
301
|
* the only defensible answer.
|
|
302
|
+
*
|
|
303
|
+
* A node routes through {@link HydraniumGlspIndex.languageServicesFor}, so
|
|
304
|
+
* an override of the index's routing applies here too.
|
|
135
305
|
*/
|
|
136
306
|
languageServicesFor(target: LanguageTarget | undefined): ServerLanguageServices | undefined;
|
|
137
307
|
/**
|
|
@@ -151,46 +321,35 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
151
321
|
scopeProviderFor(target: LanguageTarget | undefined): HydraniumScopeProvider | undefined;
|
|
152
322
|
/** The `ReferenceCandidateProvider` of the language owning `target`. See {@link nameProviderFor}. */
|
|
153
323
|
candidateProviderFor(target: LanguageTarget | undefined): ReferenceCandidateProvider | undefined;
|
|
154
|
-
/**
|
|
155
|
-
* Warn when the loaded document does not route to the grammar this diagram
|
|
156
|
-
* module declared.
|
|
157
|
-
*
|
|
158
|
-
* The declared language is the one fact the module states that the grammar
|
|
159
|
-
* itself does not, so it is the one that can drift — a diagram type pointed
|
|
160
|
-
* at the wrong `LanguageMetaData`, or a file extension reassigned. Both
|
|
161
|
-
* would otherwise surface much later as references resolving against the
|
|
162
|
-
* wrong scope. Only a warning, not a throw: the document is loaded and
|
|
163
|
-
* usable either way, and a hard failure here would take out a diagram over
|
|
164
|
-
* a mismatch that may be intentional in an adopter serving one diagram type
|
|
165
|
-
* over several grammars.
|
|
166
|
-
*/
|
|
167
|
-
protected checkDeclaredLanguage(uri: string): void;
|
|
168
324
|
/** The observability handle as a plain {@link Logger} (a {@link Tracer} is-a Logger). */
|
|
169
325
|
get logger(): Logger;
|
|
170
|
-
/** URI-tagged once
|
|
326
|
+
/** URI-tagged once a source root is captured; the class-tagged injected {@link baseTracer} before that. */
|
|
171
327
|
get tracer(): Tracer;
|
|
172
328
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* at that point in time — frozen until the next `setSourceRoot`, then
|
|
176
|
-
* re-read from `LangiumDocuments`.
|
|
329
|
+
* Model version of the root the last {@link captureSourceRoot} took,
|
|
330
|
+
* frozen until the next one.
|
|
177
331
|
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* conflict gate against the captured based-on version. See
|
|
332
|
+
* The base an operation's write is gated on, taken when the operation
|
|
333
|
+
* opens; nothing captures during an operation, so it is the version of the
|
|
334
|
+
* root the operation's copies were made from. See
|
|
182
335
|
* `@hydranium/protocol#ConflictError` for the detection contract.
|
|
183
336
|
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
|
|
188
|
-
|
|
337
|
+
* **This, not a number read at write time, is what a write must be gated
|
|
338
|
+
* on.** A version read when the write is issued is the store's current one,
|
|
339
|
+
* so it matches by construction and the gate can never fire.
|
|
340
|
+
*/
|
|
341
|
+
get baseVersion(): ModelVersion;
|
|
342
|
+
/**
|
|
343
|
+
* {@link baseVersion} as a plain number: the store's version of the text the
|
|
344
|
+
* root was parsed from.
|
|
345
|
+
*
|
|
346
|
+
* `UNRECORDED_VERSION` when the document was not built when the snapshot
|
|
347
|
+
* was taken, which no write matches.
|
|
189
348
|
*/
|
|
190
349
|
get version(): number;
|
|
191
350
|
/**
|
|
192
|
-
* Register `uri` as a document this state also writes,
|
|
193
|
-
* text-document version.
|
|
351
|
+
* Register `uri` as a document this state also writes, snapshotting its
|
|
352
|
+
* current text-document version.
|
|
194
353
|
*
|
|
195
354
|
* A diagram whose layout lives in its own file, or whose canvas creates
|
|
196
355
|
* elements in a referenced semantic document, writes more than the document
|
|
@@ -203,7 +362,7 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
203
362
|
* identified once the operation names the node. What the framework supplies
|
|
204
363
|
* is the part an adopter cannot reconstruct after the fact — the version each
|
|
205
364
|
* document was at BEFORE the command mutated anything (see
|
|
206
|
-
* {@link
|
|
365
|
+
* {@link baseVersionOf}). Idempotent; registering the primary is ignored,
|
|
207
366
|
* since {@link version} already tracks it. Registering a URI not already in
|
|
208
367
|
* the set fires {@link onSecondaryUrisChanged}.
|
|
209
368
|
*/
|
|
@@ -215,14 +374,15 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
215
374
|
untrackSecondaryDocuments(): void;
|
|
216
375
|
/**
|
|
217
376
|
* Fires whenever the secondary write set gains or loses a URI — never when a
|
|
218
|
-
* tracked document's
|
|
219
|
-
* every {@link
|
|
377
|
+
* tracked document's model version is merely refreshed, which happens on
|
|
378
|
+
* every {@link captureSourceRoot} and changes nothing a subscriber cares about.
|
|
220
379
|
*
|
|
221
380
|
* **This exists so no caller has to know when the set can change.** The set is
|
|
222
381
|
* usually discovered rather than known, and the discovery point is an
|
|
223
|
-
* operation handler naming a node — not a
|
|
224
|
-
* re-derived the set after each
|
|
225
|
-
* it silently: the document would simply never be
|
|
382
|
+
* operation handler naming a node — not a read of the source root. A
|
|
383
|
+
* subscriber that instead re-derived the set after each such read would miss
|
|
384
|
+
* exactly that case, and miss it silently: the document would simply never be
|
|
385
|
+
* watched, with nothing logged.
|
|
226
386
|
* Announcing the change here moves the obligation to the one place that can
|
|
227
387
|
* always discharge it.
|
|
228
388
|
*
|
|
@@ -234,27 +394,53 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
234
394
|
get onSecondaryUrisChanged(): Event<void>;
|
|
235
395
|
/** Registered secondary document URIs, in registration order. */
|
|
236
396
|
get secondaryUris(): readonly string[];
|
|
397
|
+
/** Active statuses, least recently set first. See {@link setStatus}. */
|
|
398
|
+
protected readonly statuses: Map<DiagramStatus, DiagramStatusEntry>;
|
|
399
|
+
/** Backing emitter for {@link onStatusChanged}. */
|
|
400
|
+
protected readonly statusChangedEmitter: Emitter<void>;
|
|
237
401
|
/**
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
* {@link setSourceRoot}) for a secondary, `undefined` for anything untracked.
|
|
402
|
+
* Set `status`'s entry, or withdraw it with `undefined`, and recompute
|
|
403
|
+
* {@link currentStatus} and {@link editMode} from every active entry.
|
|
241
404
|
*
|
|
242
|
-
* `
|
|
243
|
-
*
|
|
244
|
-
*
|
|
405
|
+
* `editMode` is derived here and nowhere else: a writer that assigns it
|
|
406
|
+
* directly is overwritten by the next status change, and its write is not
|
|
407
|
+
* announced on {@link onStatusChanged}.
|
|
245
408
|
*/
|
|
246
|
-
|
|
409
|
+
setStatus(status: DiagramStatus, entry: DiagramStatusEntry | undefined): void;
|
|
410
|
+
/** The active entry whose message the client shows: highest severity, then most recently set. */
|
|
411
|
+
get currentStatus(): DiagramStatusEntry | undefined;
|
|
412
|
+
/** The active statuses that block editing; empty while the diagram is editable. */
|
|
413
|
+
get readonlyStatuses(): DiagramStatus[];
|
|
414
|
+
/** The status that supplies {@link currentStatus}, for a log line naming it. */
|
|
415
|
+
get currentStatusSource(): DiagramStatus | undefined;
|
|
416
|
+
/** Fires when {@link currentStatus} or {@link editMode} changes. */
|
|
417
|
+
get onStatusChanged(): Event<void>;
|
|
247
418
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
419
|
+
* The base version of a write of `uri`: {@link baseVersion} for the primary,
|
|
420
|
+
* the version taken at {@link trackSecondaryDocument} (refreshed by
|
|
421
|
+
* {@link captureSourceRoot}) for a secondary, `undefined` for anything untracked.
|
|
422
|
+
*
|
|
423
|
+
* `undefined` rather than v0 for an untracked URI deliberately: `0` is a real
|
|
424
|
+
* version meaning "present but never edited", so collapsing the two would let
|
|
425
|
+
* a caller gate a write against a document this state never read.
|
|
254
426
|
*/
|
|
255
|
-
|
|
256
|
-
/** Re-
|
|
427
|
+
baseVersionOf(uri: string): ModelVersion | undefined;
|
|
428
|
+
/** Re-take every registered secondary's built root and the model version of that root. */
|
|
257
429
|
protected refreshSecondaryVersions(): void;
|
|
430
|
+
/**
|
|
431
|
+
* The built root of `uri`, looked up through the model service's
|
|
432
|
+
* canonicalizing gateway so a symlinked URI does not strand without one;
|
|
433
|
+
* `undefined` for a URI with no parsed document, whose version is then
|
|
434
|
+
* `UNRECORDED_VERSION`, which no write matches. The store counts a file it
|
|
435
|
+
* has not built at `0`, and so does the placeholder the builder registers
|
|
436
|
+
* before its parse, and a write based on `0` overwrites text this state
|
|
437
|
+
* never read.
|
|
438
|
+
*/
|
|
439
|
+
protected readBuiltRoot(uri: string): AstNode | undefined;
|
|
440
|
+
/** Take `root` as the secondary `uri` was read at, and its version, `UNRECORDED_VERSION` without one. */
|
|
441
|
+
protected recordSecondary(uri: string, root: AstNode | undefined): void;
|
|
442
|
+
/** The root the secondary `uri` was read at; see {@link capturedRoots}. */
|
|
443
|
+
protected capturedRootOf(uri: string): AstNode | undefined;
|
|
258
444
|
/**
|
|
259
445
|
* Re-capture the source root from the current Langium document,
|
|
260
446
|
* replacing any orphaned root. A rebuild between an earlier
|
|
@@ -263,18 +449,38 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
263
449
|
* handlers) must see the root the freshly built document carries.
|
|
264
450
|
*/
|
|
265
451
|
protected refreshSourceRoot(): void;
|
|
452
|
+
/**
|
|
453
|
+
* The root that `uri`'s text parses to (the text store's, or the built
|
|
454
|
+
* document's when the store holds none) and the store's version of that
|
|
455
|
+
* text, read once the document has validated; `undefined` when it cannot be
|
|
456
|
+
* read. The version is read in the tick the text is, so a write based on it
|
|
457
|
+
* conflicts with any edit made after.
|
|
458
|
+
*
|
|
459
|
+
* **Parsed afresh, never the built root.** The built root can lag the
|
|
460
|
+
* store, and a root behind the text it is versioned with makes the replay
|
|
461
|
+
* drop the edits it lacks. The root is parsed, not linked: an encoder hook
|
|
462
|
+
* reading a reference's `ref` sees `undefined` on it.
|
|
463
|
+
*/
|
|
464
|
+
protected readCurrentRoot(uri: string): Promise<{
|
|
465
|
+
root: AstNode;
|
|
466
|
+
version: ModelVersion;
|
|
467
|
+
} | undefined>;
|
|
266
468
|
/**
|
|
267
469
|
* Wait until the captured document reaches `state`, then run
|
|
268
470
|
* {@link onReadyRefreshed} so consumers see a fresh AST. Wraps the
|
|
269
471
|
* wait in {@link Tracer.time} for observability.
|
|
472
|
+
*
|
|
473
|
+
* A source not in the document registry is built first, through
|
|
474
|
+
* `ModelService.rebuild`. For a source with neither a file nor text, that
|
|
475
|
+
* build leaves no document, and this rejects rather than timing out.
|
|
270
476
|
*/
|
|
271
477
|
ready(state: DocumentState): Promise<void>;
|
|
272
478
|
/**
|
|
273
|
-
* Race `ModelService.
|
|
274
|
-
* {@link readyTimeoutMs}. If the timeout fires but the
|
|
275
|
-
* already reached `state
|
|
276
|
-
*
|
|
277
|
-
* {@link ModelReadyTimeoutError} via {@link buildReadyTimeoutError}.
|
|
479
|
+
* Race `ModelService.ensureDocumentState`, which builds a root behind its
|
|
480
|
+
* text, against {@link readyTimeoutMs}. If the timeout fires but the
|
|
481
|
+
* document has already reached `state`, log a warning naming the cause, a
|
|
482
|
+
* root behind its text or a missed phase event, and resolve; otherwise
|
|
483
|
+
* raise {@link ModelReadyTimeoutError} via {@link buildReadyTimeoutError}.
|
|
278
484
|
*/
|
|
279
485
|
protected readyWithTimeout(state: DocumentState): Promise<void>;
|
|
280
486
|
/**
|
|
@@ -295,11 +501,13 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
295
501
|
*/
|
|
296
502
|
protected buildReadyTimeoutError(state: DocumentState, elapsed: number): ModelReadyTimeoutError;
|
|
297
503
|
/**
|
|
298
|
-
* Persist a new source-model representation back to the document store
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
504
|
+
* Persist a new source-model representation back to the document store after
|
|
505
|
+
* an interactive edit. Adopters wire this against their language-services
|
|
506
|
+
* facade. An operation calls it once, with the model projected from its
|
|
507
|
+
* copies; an undo or redo calls it with the transition resolved onto the
|
|
508
|
+
* current model. An implementation takes the root it wrote through
|
|
509
|
+
* {@link captureWrittenRoot}, which during an operation leaves the capture
|
|
510
|
+
* to the operation.
|
|
303
511
|
*
|
|
304
512
|
* Adopters whose source model is a structured transfer projection
|
|
305
513
|
* round-tripped through `ModelService` should extend
|
|
@@ -320,14 +528,30 @@ export declare abstract class AbstractHydraniumGlspState<TRoot extends AstNode,
|
|
|
320
528
|
* `JsonModelState` shape meet the framework state via structural
|
|
321
529
|
* intersection at the recording-command call site.
|
|
322
530
|
*
|
|
323
|
-
* `
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
|
|
331
|
-
|
|
531
|
+
* `baseVersion` is what the write was authored against: an operation's
|
|
532
|
+
* write, and an undo's or redo's, passes the {@link baseVersion} it read
|
|
533
|
+
* the model at. Adopters that write through the diagram's session forward
|
|
534
|
+
* it as the args' `baseVersion` field; adopters whose write path doesn't go
|
|
535
|
+
* through the session ignore it.
|
|
536
|
+
*
|
|
537
|
+
* **Optional, and every implementation must default it to {@link baseVersion}
|
|
538
|
+
* rather than to `'any'`.** Optional is forced: GLSP's `JsonModelState`
|
|
539
|
+
* declares a one-parameter `updateSourceModel` and calls it with one
|
|
540
|
+
* argument, so a second required parameter makes the state unassignable to
|
|
541
|
+
* the slot it has to fill. Defaulting to the state's own model version is
|
|
542
|
+
* what keeps that from costing anything — an operation handler calling
|
|
543
|
+
* `updateSourceModel(model)` gets the gate, and skipping it has to be typed
|
|
544
|
+
* out as `'any'`.
|
|
545
|
+
*/
|
|
546
|
+
abstract updateSourceModel(model: TSourceModel, baseVersion?: BaseVersion): MaybePromise<void>;
|
|
547
|
+
/**
|
|
548
|
+
* `transition` as the documents would hold both ends after a write. A
|
|
549
|
+
* serializer may normalize what it writes, provided normalizing again
|
|
550
|
+
* changes nothing; an end left as recorded makes an undo or redo conflict
|
|
551
|
+
* with the write it follows. Default: unchanged.
|
|
552
|
+
*/
|
|
553
|
+
normalizeTransition(transition: OperationTransition<TSourceModel>): Promise<OperationTransition<TSourceModel>>;
|
|
554
|
+
/** The root `model` parses back to once serialized for `uri`, as a write would leave it; nothing is written. */
|
|
555
|
+
protected roundTrip(uri: string, model: TransferElement): Promise<AstNode>;
|
|
332
556
|
}
|
|
333
557
|
//# sourceMappingURL=abstract-hydranium-glsp-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-hydranium-glsp-state.d.ts","sourceRoot":"","sources":["../../src/state/abstract-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"abstract-hydranium-glsp-state.d.ts","sourceRoot":"","sources":["../../src/state/abstract-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,iBAAiB,EAAY,KAAK,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,KAAK,OAAO,EAAY,aAAa,EAAa,KAAK,SAAS,EAAE,KAAK,aAAa,EAAO,MAAM,oBAAoB,CAAC;AAC/H,OAAO,EAEJ,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,sB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