@hydranium/glsp-server 1.0.0-next.13 → 1.0.0-next.132
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 +20 -5
- package/lib/browser/start-glsp-server-in-worker.d.ts +30 -39
- package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
- package/lib/browser/start-glsp-server-in-worker.js +43 -8
- package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
- package/lib/command/hydranium-glsp-command-stack.d.ts +27 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.js +53 -0
- package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts +22 -22
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +25 -26
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
- package/lib/command/index.d.ts +1 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +1 -0
- package/lib/command/index.js.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +12 -3
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +18 -2
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
- package/lib/launcher/hydranium-glsp-server.d.ts +10 -6
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
- package/lib/launcher/hydranium-glsp-server.js +16 -6
- package/lib/launcher/hydranium-glsp-server.js.map +1 -1
- package/lib/messages/index.d.ts +24 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +24 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/node/start-glsp-server.d.ts +1 -1
- package/lib/node/start-glsp-server.d.ts.map +1 -1
- package/lib/node/start-glsp-server.js +2 -2
- package/lib/node/start-glsp-server.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +110 -43
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +139 -60
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.d.ts +6 -6
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.js +6 -10
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
- package/lib/state/reconcile-source-model-write.d.ts +9 -8
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
- package/lib/state/reconcile-source-model-write.js +8 -8
- package/lib/state/reconcile-source-model-write.js.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +59 -59
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +84 -82
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +19 -18
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +26 -30
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- 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 +295 -79
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
- package/lib/storage/hydranium-glsp-storage.js +435 -94
- 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 +46 -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/validation/diagnostic-markers.d.ts +2 -2
- package/lib/validation/diagnostic-markers.d.ts.map +1 -1
- package/lib/validation/diagnostic-markers.js +7 -0
- package/lib/validation/diagnostic-markers.js.map +1 -1
- 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 +17 -8
- package/src/browser/start-glsp-server-in-worker.ts +41 -44
- package/src/command/hydranium-glsp-command-stack.ts +36 -0
- package/src/command/hydranium-glsp-recording-command.ts +26 -26
- package/src/command/index.ts +1 -0
- package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +27 -3
- package/src/launcher/hydranium-glsp-server.ts +16 -6
- package/src/messages/index.ts +30 -0
- package/src/node/start-glsp-server.ts +2 -3
- package/src/state/abstract-hydranium-glsp-state.ts +174 -73
- package/src/state/full-text-hydranium-glsp-state.ts +7 -11
- package/src/state/reconcile-source-model-write.ts +18 -15
- package/src/state/reconciling-multi-document-glsp-state.ts +86 -83
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +27 -31
- package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
- package/src/storage/hydranium-glsp-storage.ts +497 -103
- package/src/storage/index.ts +2 -1
- package/src/storage/save-delivery-policy.ts +44 -0
- package/src/validation/diagnostic-markers.ts +10 -3
- package/src/validation/hydranium-glsp-model-validator.ts +3 -3
- 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
package/README.md
CHANGED
|
@@ -20,9 +20,12 @@ the diagram model is adopter-side, bound per diagram module.
|
|
|
20
20
|
over the GModel.
|
|
21
21
|
- **Load / save against the live AST.** `HydraniumGlspStorage` loads a document
|
|
22
22
|
on diagram open and writes user operations back through the shared model
|
|
23
|
-
coordination layer, with `
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
coordination layer, with `SaveDeliveryPolicy` deciding whether the save action
|
|
24
|
+
awaits the write. `HydraniumGlspRequestSaveModelActionHandler` answers each
|
|
25
|
+
save the Theia client sends, or rejects it when the save fails; GLSP's own
|
|
26
|
+
save action stays unanswered for other clients.
|
|
27
|
+
`HydraniumGlspRecordingCommand` is the operation-handler seam — the framework
|
|
28
|
+
provides no base handler class.
|
|
26
29
|
- **A submission and dispatch lifecycle that waits for the model.**
|
|
27
30
|
`HydraniumGlspSubmissionHandler` gates submit on the readiness event,
|
|
28
31
|
`HydraniumGlspServerActionDispatcher` adds timing and direction to dispatch,
|
|
@@ -49,12 +52,21 @@ dependency is `uuid`. You must already have a composed hydranium shared services
|
|
|
49
52
|
tree, a grammar, and a GModel factory of your own — there is no framework GModel
|
|
50
53
|
factory.
|
|
51
54
|
|
|
55
|
+
**This head needs one line in your own root manifest, and the install works
|
|
56
|
+
without it right up until the server starts.** `@eclipse-glsp/*` depends on
|
|
57
|
+
`vscode-jsonrpc@8.2.0` exactly, while the Langium chain under hydranium pins the
|
|
58
|
+
transport at `9.0.1` — the version this package declares as its peer. Two
|
|
59
|
+
physical copies in one process throw `Unknown parameter structure auto` during
|
|
60
|
+
GLSP server init, and no peer declaration can prevent a nested copy. Add an
|
|
61
|
+
`overrides` block collapsing the chain and reinstall from scratch;
|
|
62
|
+
[Requirements](../../docs/adopting/requirements.md) gives the exact block.
|
|
63
|
+
|
|
52
64
|
## Exports
|
|
53
65
|
|
|
54
66
|
| subpath | holds | platform |
|
|
55
67
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
|
56
68
|
| `.` | Composition and the head itself: app / diagram modules, state, storage, submission, command, dispatcher, computed-bounds, validation, logging, `serviceIdentifier`. | browser-neutral |
|
|
57
|
-
| `./browser` | `startGlspServerInWorker
|
|
69
|
+
| `./browser` | `startGlspServerInWorker`, `BrowserGlspServerOptions`, `HydraniumGlspWorkerServerLauncher` — the web-worker bringup on GLSP's `WorkerServerLauncher`. | browser-only |
|
|
58
70
|
| `./node` | `startGlspServer`, `GlspServerOptions`, `StartedGlspServer` — the socket bringup on GLSP's `SocketServerLauncher`. | Node-only |
|
|
59
71
|
| `./testing` | `makeGlspHarness`, `makeNoopGlspLogger`, `makeCapturingGlspLogger`. | browser-neutral |
|
|
60
72
|
|
|
@@ -73,7 +85,8 @@ Each subpath also has a `./lib/…` twin for consumers on
|
|
|
73
85
|
|
|
74
86
|
Build the app container, load `HydraniumGlspAppModule` plus your own app modules,
|
|
75
87
|
and hand the result to `startGlspServer` (or `startGlspServerInWorker`, whose
|
|
76
|
-
`context` is a required transferred `MessagePort`
|
|
88
|
+
`context` is a required transferred `MessagePort` whose page end connects
|
|
89
|
+
through `createMessagePortTransport`). Per diagram open, storage
|
|
77
90
|
loads the document, your GModel factory renders it, and user operations travel
|
|
78
91
|
back into the shared AST through the recording command, after which the GModel is
|
|
79
92
|
re-derived and every listener on that document is notified. The module-by-module
|
|
@@ -85,6 +98,8 @@ framework/adopter seams are in
|
|
|
85
98
|
[`docs/concepts/framework-vs-adopter.md`](../../docs/concepts/framework-vs-adopter.md).
|
|
86
99
|
The Theia-side client wiring lives in `@hydranium/glsp-client-theia`.
|
|
87
100
|
|
|
101
|
+
For the adopter path from a read-only projection to a writable diagram, see [Make a diagram editable](../../docs/guides/editable-diagram.md). It follows the per-diagram module, operation-handler, and shared-services boundaries.
|
|
102
|
+
|
|
88
103
|
## Status
|
|
89
104
|
|
|
90
105
|
Alpha — pre-v0, not yet published. The API is not stable and may change without a
|
|
@@ -6,41 +6,30 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type Logger as GlspLogger, type ServerModule } from '@eclipse-glsp/server/browser.js';
|
|
9
|
+
import { type Logger as GlspLogger, type ServerModule, type WorkerLaunchOptions, WorkerServerLauncher } from '@eclipse-glsp/server/browser.js';
|
|
10
10
|
import { type ContainerModule } from 'inversify';
|
|
11
|
-
import type
|
|
11
|
+
import { type Logger, type TransferredMessagePort } from '@hydranium/protocol';
|
|
12
|
+
import { type MessageConnection } from 'vscode-jsonrpc/browser';
|
|
12
13
|
import type { IntegratedServer } from '@hydranium/core';
|
|
14
|
+
export type { TransferredMessagePort } from '@hydranium/protocol';
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* The worker launcher every {@link startGlspServerInWorker} head runs on: GLSP's
|
|
17
|
+
* own, with its connection built over `createMessagePortTransport` rather than
|
|
18
|
+
* over `BrowserMessageReader`/`BrowserMessageWriter`, which never report a
|
|
19
|
+
* close. So the client disposing its connection closes this one, and upstream
|
|
20
|
+
* disposes the server instance, and with it every client session, as it does
|
|
21
|
+
* when a socket closes.
|
|
15
22
|
*
|
|
16
|
-
*
|
|
17
|
-
* without the DOM lib, which is what keeps `document` / `window` compile errors
|
|
18
|
-
* here — so `MessagePort` has no name either and the contract has to be spelled
|
|
19
|
-
* out.
|
|
23
|
+
* Requires `context`: unlike upstream it never falls back to the worker global.
|
|
20
24
|
*
|
|
21
|
-
* **The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* **That compile error happens at the ADOPTER, not here.** This project resolves
|
|
28
|
-
* neither `MessagePort` nor `Worker` as a type, so nothing in this package can
|
|
29
|
-
* demonstrate the rejection; a host compiling its worker against `lib.webworker`
|
|
30
|
-
* (or a page against `lib.dom`) is where the names resolve and the guard bites.
|
|
31
|
-
* Measured there: passing the worker global fails with `Property 'start' is
|
|
32
|
-
* missing in type 'DedicatedWorkerGlobalScope'`.
|
|
33
|
-
*
|
|
34
|
-
* `addEventListener` is not a discriminator — `postMessage` plus `start` already
|
|
35
|
-
* excludes the other two — and nothing in this module calls any of the three
|
|
36
|
-
* (the reader assigns `onmessage`, which starts a port implicitly). It is listed
|
|
37
|
-
* because it is part of what the reader uses, so the interface reads as the
|
|
38
|
-
* contract rather than as a minimal trick.
|
|
25
|
+
* **The install needs a single `vscode-jsonrpc`.** The connection comes from
|
|
26
|
+
* this package's copy, and GLSP's request and notification types from the copy
|
|
27
|
+
* `@eclipse-glsp/protocol` resolves. With two copies, a typed notification or
|
|
28
|
+
* request GLSP sends throws `Unknown parameter structure auto`, because the
|
|
29
|
+
* connection compares the type's parameter-structure marker by identity.
|
|
39
30
|
*/
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
addEventListener(type: 'message', listener: (event: unknown) => void, options?: unknown): void;
|
|
43
|
-
start(): void;
|
|
31
|
+
export declare class HydraniumGlspWorkerServerLauncher extends WorkerServerLauncher {
|
|
32
|
+
protected createConnection(options: WorkerLaunchOptions): MessageConnection;
|
|
44
33
|
}
|
|
45
34
|
/**
|
|
46
35
|
* Options for {@link startGlspServerInWorker}.
|
|
@@ -55,14 +44,15 @@ export interface BrowserGlspServerOptions {
|
|
|
55
44
|
/**
|
|
56
45
|
* The port the host transferred into the worker for this head.
|
|
57
46
|
*
|
|
58
|
-
* **Required
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
47
|
+
* **Required: the worker global is no substitute.** A head on the global
|
|
48
|
+
* receives every other head's traffic — a reader filters nothing, so this is
|
|
49
|
+
* not a race under load but every message delivered to the wrong reader — and
|
|
50
|
+
* GLSP's launcher posts its startup string through the global `postMessage`
|
|
51
|
+
* regardless of the connection it was given, which no JSON-RPC reader parses.
|
|
52
|
+
* Unlike upstream's, this head's launcher never falls back to the global.
|
|
53
|
+
*
|
|
54
|
+
* The page's end must connect through `createMessagePortTransport` as well:
|
|
55
|
+
* the head reads its close signal from the port, and posts one on it.
|
|
66
56
|
*/
|
|
67
57
|
readonly context: TransferredMessagePort;
|
|
68
58
|
/**
|
|
@@ -114,8 +104,9 @@ export interface BrowserGlspServerOptions {
|
|
|
114
104
|
* below. There is no transport handshake to wait on: the port arrived live,
|
|
115
105
|
* and the launcher's own readiness signal is a string it posts on the worker
|
|
116
106
|
* global, which nothing here reads.
|
|
117
|
-
* - `stopped` resolves when the connection closes,
|
|
118
|
-
* error.
|
|
107
|
+
* - `stopped` resolves when the connection closes, which the client disposing
|
|
108
|
+
* its connection causes, and rejects on a connection error. Nothing reports a
|
|
109
|
+
* page that dies, because the port cannot.
|
|
119
110
|
*/
|
|
120
111
|
export declare function startGlspServerInWorker(options: BrowserGlspServerOptions): IntegratedServer;
|
|
121
112
|
//# sourceMappingURL=start-glsp-server-in-worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-glsp-server-in-worker.d.ts","sourceRoot":"","sources":["../../src/browser/start-glsp-server-in-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,IAAI,UAAU,EACzB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"start-glsp-server-in-worker.d.ts","sourceRoot":"","sources":["../../src/browser/start-glsp-server-in-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,IAAI,UAAU,EACzB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,oBAAoB,EAEtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAA8B,KAAK,MAAM,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,qBACa,iCAAkC,SAAQ,oBAAoB;cACrD,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,iBAAiB;CAItF;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACtC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB,CAsE3F"}
|
|
@@ -6,10 +6,44 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
9
15
|
import { WorkerServerLauncher, createAppModule } from '@eclipse-glsp/server/browser.js';
|
|
10
|
-
import { Container } from 'inversify';
|
|
16
|
+
import { Container, injectable } from 'inversify';
|
|
17
|
+
import { createMessagePortTransport } from '@hydranium/protocol';
|
|
18
|
+
import { createMessageConnection } from 'vscode-jsonrpc/browser';
|
|
11
19
|
import { createGlspFrameworkOverrides } from '../launcher/glsp-framework-overrides.js';
|
|
12
20
|
import { createGlspServerOverrides } from '../launcher/glsp-server-overrides.js';
|
|
21
|
+
/**
|
|
22
|
+
* The worker launcher every {@link startGlspServerInWorker} head runs on: GLSP's
|
|
23
|
+
* own, with its connection built over `createMessagePortTransport` rather than
|
|
24
|
+
* over `BrowserMessageReader`/`BrowserMessageWriter`, which never report a
|
|
25
|
+
* close. So the client disposing its connection closes this one, and upstream
|
|
26
|
+
* disposes the server instance, and with it every client session, as it does
|
|
27
|
+
* when a socket closes.
|
|
28
|
+
*
|
|
29
|
+
* Requires `context`: unlike upstream it never falls back to the worker global.
|
|
30
|
+
*
|
|
31
|
+
* **The install needs a single `vscode-jsonrpc`.** The connection comes from
|
|
32
|
+
* this package's copy, and GLSP's request and notification types from the copy
|
|
33
|
+
* `@eclipse-glsp/protocol` resolves. With two copies, a typed notification or
|
|
34
|
+
* request GLSP sends throws `Unknown parameter structure auto`, because the
|
|
35
|
+
* connection compares the type's parameter-structure marker by identity.
|
|
36
|
+
*/
|
|
37
|
+
let HydraniumGlspWorkerServerLauncher = class HydraniumGlspWorkerServerLauncher extends WorkerServerLauncher {
|
|
38
|
+
createConnection(options) {
|
|
39
|
+
const transport = createMessagePortTransport(options.context);
|
|
40
|
+
return createMessageConnection(transport.reader, transport.writer);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
HydraniumGlspWorkerServerLauncher = __decorate([
|
|
44
|
+
injectable()
|
|
45
|
+
], HydraniumGlspWorkerServerLauncher);
|
|
46
|
+
export { HydraniumGlspWorkerServerLauncher };
|
|
13
47
|
/**
|
|
14
48
|
* Start a GLSP head on a transferred `MessagePort` inside a web worker, with no
|
|
15
49
|
* Node runtime and no backend process.
|
|
@@ -32,8 +66,9 @@ import { createGlspServerOverrides } from '../launcher/glsp-server-overrides.js'
|
|
|
32
66
|
* below. There is no transport handshake to wait on: the port arrived live,
|
|
33
67
|
* and the launcher's own readiness signal is a string it posts on the worker
|
|
34
68
|
* global, which nothing here reads.
|
|
35
|
-
* - `stopped` resolves when the connection closes,
|
|
36
|
-
* error.
|
|
69
|
+
* - `stopped` resolves when the connection closes, which the client disposing
|
|
70
|
+
* its connection causes, and rejects on a connection error. Nothing reports a
|
|
71
|
+
* page that dies, because the port cannot.
|
|
37
72
|
*/
|
|
38
73
|
export function startGlspServerInWorker(options) {
|
|
39
74
|
const lifecycle = options.logger;
|
|
@@ -48,17 +83,17 @@ export function startGlspServerInWorker(options) {
|
|
|
48
83
|
const glspAppModule = createAppModule({ consoleLog: false });
|
|
49
84
|
const appContainer = new Container();
|
|
50
85
|
appContainer.load(glspAppModule, createGlspFrameworkOverrides(options.createLogger), ...(options.appModules ?? []));
|
|
51
|
-
const launcher = appContainer.resolve(
|
|
86
|
+
const launcher = appContainer.resolve(HydraniumGlspWorkerServerLauncher);
|
|
52
87
|
// Additional module rather than an app-container binding, as on Node: the
|
|
53
88
|
// launcher loads these into the per-connection SERVER container, the only
|
|
54
89
|
// tier where the adopter's `ServerModule` binding of `GLSPServer` is
|
|
55
90
|
// rebindable.
|
|
56
91
|
launcher.configure(options.serverModule, createGlspServerOverrides());
|
|
57
92
|
try {
|
|
58
|
-
// Upstream declares `WorkerLaunchOptions.context` as `Worker`,
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
93
|
+
// Upstream declares `WorkerLaunchOptions.context` as `Worker`, and
|
|
94
|
+
// `HydraniumGlspWorkerServerLauncher.createConnection` reads it as a
|
|
95
|
+
// port — so the value that is CORRECT here is the one the declaration
|
|
96
|
+
// names as wrong.
|
|
62
97
|
//
|
|
63
98
|
// **The cast is currently redundant, and is kept deliberately.** `Worker`
|
|
64
99
|
// does not resolve under this package's `lib`, so `skipLibCheck` leaves
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-glsp-server-in-worker.js","sourceRoot":"","sources":["../../src/browser/start-glsp-server-in-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"start-glsp-server-in-worker.js","sourceRoot":"","sources":["../../src/browser/start-glsp-server-in-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAElF,OAAO,EAIJ,oBAAoB,EACpB,eAAe,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAwB,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAA4C,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,uBAAuB,EAA0B,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAKjF;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,oBAAoB;IACrD,gBAAgB,CAAC,OAA4B;QAC7D,MAAM,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,OAA4C,CAAC,CAAC;QACnG,OAAO,uBAAuB,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;CACH,CAAA;AALY,iCAAiC;IAD7C,UAAU,EAAE;GACA,iCAAiC,CAK7C;;AAsDD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAiC;IACtE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAEjC,uEAAuE;IACvE,4EAA4E;IAC5E,iFAAiF;IACjF,6EAA6E;IAC7E,2EAA2E;IAC3E,0EAA0E;IAC1E,oEAAoE;IACpE,sCAAsC;IACt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,UAAU,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,IAAI,KAAK,CACpB,4EAA4E;gBACzE,wFAAwF,CAC7F,CAAC;YACF,SAAS,EAAE,KAAK,CAAC,gBAAgB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAClD,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QACtE,CAAC;QAED,SAAS,EAAE,IAAI,CAAC,sEAAsE,CAAC,CAAC;QACxF,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACd,SAAS,EAAE,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QACjE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;IACzE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { DefaultCommandStack, ModelState } from '@eclipse-glsp/server';
|
|
10
|
+
import { type ServerSharedServices } from '@hydranium/core';
|
|
11
|
+
/**
|
|
12
|
+
* GLSP's command stack with the diagram's dirty state read from the text store:
|
|
13
|
+
* dirty while any document the diagram's client session has open differs from
|
|
14
|
+
* its file, as the store last knew the file. Undo and redo are GLSP's.
|
|
15
|
+
*
|
|
16
|
+
* GLSP's own answer counts the diagram's commands since its last save, so it
|
|
17
|
+
* misses every change the diagram did not make: another client's unsaved edit
|
|
18
|
+
* leaves it clean, and a save it did not make of a document other than the
|
|
19
|
+
* diagram's own leaves it dirty. Every `SetDirtyStateAction` GLSP sends reads
|
|
20
|
+
* this answer.
|
|
21
|
+
*/
|
|
22
|
+
export declare class HydraniumGlspCommandStack extends DefaultCommandStack {
|
|
23
|
+
protected readonly modelState: ModelState;
|
|
24
|
+
protected readonly sharedServices: ServerSharedServices;
|
|
25
|
+
get isDirty(): boolean;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=hydranium-glsp-command-stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-command-stack.d.ts","sourceRoot":"","sources":["../../src/command/hydranium-glsp-command-stack.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAI5D;;;;;;;;;;GAUG;AACH,qBACa,yBAA0B,SAAQ,mBAAmB;IAC3C,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAG,UAAU,CAAC;IACpB,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAG,oBAAoB,CAAC;IAEpG,IAAa,OAAO,IAAI,OAAO,CAI9B;CACH"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
17
|
+
};
|
|
18
|
+
import { DefaultCommandStack, ModelState } from '@eclipse-glsp/server';
|
|
19
|
+
import { inject, injectable } from 'inversify';
|
|
20
|
+
import { HydraniumTypes } from '../state/hydranium-shared-core-services.js';
|
|
21
|
+
/**
|
|
22
|
+
* GLSP's command stack with the diagram's dirty state read from the text store:
|
|
23
|
+
* dirty while any document the diagram's client session has open differs from
|
|
24
|
+
* its file, as the store last knew the file. Undo and redo are GLSP's.
|
|
25
|
+
*
|
|
26
|
+
* GLSP's own answer counts the diagram's commands since its last save, so it
|
|
27
|
+
* misses every change the diagram did not make: another client's unsaved edit
|
|
28
|
+
* leaves it clean, and a save it did not make of a document other than the
|
|
29
|
+
* diagram's own leaves it dirty. Every `SetDirtyStateAction` GLSP sends reads
|
|
30
|
+
* this answer.
|
|
31
|
+
*/
|
|
32
|
+
let HydraniumGlspCommandStack = class HydraniumGlspCommandStack extends DefaultCommandStack {
|
|
33
|
+
modelState;
|
|
34
|
+
sharedServices;
|
|
35
|
+
get isDirty() {
|
|
36
|
+
const textDocuments = this.sharedServices.workspace.TextDocuments;
|
|
37
|
+
const clientId = this.modelState.clientId;
|
|
38
|
+
return textDocuments.openDocuments().some(open => open.clients.includes(clientId) && textDocuments.isDirty(open.uri));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
inject(ModelState),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], HydraniumGlspCommandStack.prototype, "modelState", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
inject(HydraniumTypes.SharedCoreServices),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], HydraniumGlspCommandStack.prototype, "sharedServices", void 0);
|
|
49
|
+
HydraniumGlspCommandStack = __decorate([
|
|
50
|
+
injectable()
|
|
51
|
+
], HydraniumGlspCommandStack);
|
|
52
|
+
export { HydraniumGlspCommandStack };
|
|
53
|
+
//# sourceMappingURL=hydranium-glsp-command-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-command-stack.js","sourceRoot":"","sources":["../../src/command/hydranium-glsp-command-stack.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E;;;;;;;;;;GAUG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,mBAAmB;IACxB,UAAU,CAAc;IACD,cAAc,CAAwB;IAEpG,IAAa,OAAO;QACjB,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC;QAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1C,OAAO,aAAa,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACzH,CAAC;CACH,CAAA;AARyC;IAAtC,MAAM,CAAC,UAAU,CAAC;;6DAA4C;AACD;IAA7D,MAAM,CAAC,cAAc,CAAC,kBAAkB,CAAC;;iEAA0D;AAF1F,yBAAyB;IADrC,UAAU,EAAE;GACA,yBAAyB,CASrC"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { type AnyObject, type JsonModelState, JsonRecordingCommand, type MaybePromise } from '@eclipse-glsp/server';
|
|
10
10
|
import { type AstNode } from '@hydranium/langium';
|
|
11
11
|
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
12
|
+
import { type BasedOn } from '@hydranium/protocol';
|
|
12
13
|
/**
|
|
13
14
|
* Source-model state shape consumed by {@link HydraniumGlspRecordingCommand}.
|
|
14
15
|
* The intersection ties together GLSP's read-side
|
|
@@ -42,13 +43,13 @@ export type HydraniumGlspRecordingState<TSourceModel extends AnyObject> = Abstra
|
|
|
42
43
|
*
|
|
43
44
|
* **postChange semantics.** GLSP's `JsonRecordingCommand.postChange` calls
|
|
44
45
|
* `modelState.updateSourceModel(newModel)` with the model only. The
|
|
45
|
-
* framework lift overrides `postChange` so it also threads the
|
|
46
|
-
* version
|
|
47
|
-
* `
|
|
48
|
-
* postChange calls
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
46
|
+
* framework lift overrides `postChange` so it also threads the snapshot
|
|
47
|
+
* version taken at command start — letting the downstream
|
|
48
|
+
* session `update` opt into the `ConflictError` gate. Undo / redo
|
|
49
|
+
* postChange calls pass `'anything'`: the user authored against the recorded
|
|
50
|
+
* patch, not against a specific server version, so re-applying it should
|
|
51
|
+
* succeed regardless of intervening edits. The recorded patch itself encodes
|
|
52
|
+
* the semantic intent.
|
|
52
53
|
*/
|
|
53
54
|
export declare class HydraniumGlspRecordingCommand<TSourceModel extends AnyObject> extends JsonRecordingCommand<TSourceModel> {
|
|
54
55
|
/** Human-readable label for the operation; appears in the timing-pair log line. */
|
|
@@ -60,13 +61,13 @@ export declare class HydraniumGlspRecordingCommand<TSourceModel extends AnyObjec
|
|
|
60
61
|
protected readonly redoAction?: (() => MaybePromise<void>) | undefined;
|
|
61
62
|
protected modelState: HydraniumGlspRecordingState<TSourceModel>;
|
|
62
63
|
/**
|
|
63
|
-
*
|
|
64
|
-
* {@link postChange} so
|
|
65
|
-
*
|
|
66
|
-
* returns so undo / redo paths fall through
|
|
67
|
-
*
|
|
64
|
+
* What the command was authored against, taken at {@link execute} start and
|
|
65
|
+
* threaded into {@link postChange} so
|
|
66
|
+
* {@link AbstractHydraniumGlspState.updateSourceModel} gates on it. Reset to
|
|
67
|
+
* `'anything'` after `execute` returns so undo / redo paths fall through
|
|
68
|
+
* ungated.
|
|
68
69
|
*/
|
|
69
|
-
protected
|
|
70
|
+
protected activeBasedOn: BasedOn;
|
|
70
71
|
/**
|
|
71
72
|
* Source-model snapshots captured at {@link execute} — the state the
|
|
72
73
|
* command left ({@link afterSnapshot}) and the state it started from
|
|
@@ -92,21 +93,20 @@ export declare class HydraniumGlspRecordingCommand<TSourceModel extends AnyObjec
|
|
|
92
93
|
* via {@link AbstractHydraniumGlspState.updateSourceModel}). The label combines
|
|
93
94
|
* the operation name with the source-uri-stamped logger.
|
|
94
95
|
*
|
|
95
|
-
*
|
|
96
|
-
* can thread
|
|
97
|
-
*
|
|
98
|
-
* see a stale captured version.
|
|
96
|
+
* Takes {@link AbstractHydraniumGlspState.basedOn} at start so {@link postChange}
|
|
97
|
+
* can thread it into `updateSourceModel`. Scoped with `try`/`finally` so undo
|
|
98
|
+
* / redo paths invoked later do not see a stale value.
|
|
99
99
|
*/
|
|
100
100
|
execute(): Promise<void>;
|
|
101
101
|
/**
|
|
102
102
|
* Override of GLSP's {@link JsonRecordingCommand.postChange} so the
|
|
103
103
|
* call to {@link AbstractHydraniumGlspState.updateSourceModel} threads the
|
|
104
|
-
*
|
|
104
|
+
* based-on version alongside the new model.
|
|
105
105
|
*
|
|
106
|
-
* During {@link execute}
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
106
|
+
* During {@link execute} it is the snapshot version taken at command start;
|
|
107
|
+
* during {@link undo} / {@link redo} it is `'anything'` — replaying a
|
|
108
|
+
* recorded patch does not author against a specific server version, so no
|
|
109
|
+
* gate applies.
|
|
110
110
|
*/
|
|
111
111
|
protected postChange(newModel: TSourceModel): MaybePromise<void>;
|
|
112
112
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-glsp-recording-command.d.ts","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-recording-command.d.ts","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,2BAA2B,CAAC,YAAY,SAAS,SAAS,IAAI,0BAA0B,CAAC,OAAO,EAAE,YAAY,CAAC,GACxH,cAAc,CAAC,YAAY,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,6BAA6B,CAAC,YAAY,SAAS,SAAS,CAAE,SAAQ,oBAAoB,CAAC,YAAY,CAAC;IA0B/G,mFAAmF;IACnF,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAEhC;uEACmE;IACnE,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC;IACxD,gEAAgE;IAChE,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC;IAhC3D,UAAkB,UAAU,EAAE,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,SAAS,CAAC,aAAa,EAAE,OAAO,CAAc;IAE9C;;;;;;;;OAQG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC;IACxC,SAAS,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC;gBAGpC,UAAU,EAAE,2BAA2B,CAAC,YAAY,CAAC;IACrD,mFAAmF;IAChE,KAAK,EAAE,MAAM,EAChC,SAAS,EAAE,MAAM,YAAY,CAAC,IAAI,CAAC;IACnC;uEACmE;IAChD,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC,aAAA;IACxD,gEAAgE;IAC7C,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC,aAAA;IAK3D;;;;;;;;;OASG;IACY,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAavC;;;;;;;;;OASG;cACgB,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC;IAIzE;;;;;;;;;;;OAWG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBpC;;;;OAIG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgBtC"}
|
|
@@ -29,26 +29,26 @@ import { JsonRecordingCommand } from '@eclipse-glsp/server';
|
|
|
29
29
|
*
|
|
30
30
|
* **postChange semantics.** GLSP's `JsonRecordingCommand.postChange` calls
|
|
31
31
|
* `modelState.updateSourceModel(newModel)` with the model only. The
|
|
32
|
-
* framework lift overrides `postChange` so it also threads the
|
|
33
|
-
* version
|
|
34
|
-
* `
|
|
35
|
-
* postChange calls
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
32
|
+
* framework lift overrides `postChange` so it also threads the snapshot
|
|
33
|
+
* version taken at command start — letting the downstream
|
|
34
|
+
* session `update` opt into the `ConflictError` gate. Undo / redo
|
|
35
|
+
* postChange calls pass `'anything'`: the user authored against the recorded
|
|
36
|
+
* patch, not against a specific server version, so re-applying it should
|
|
37
|
+
* succeed regardless of intervening edits. The recorded patch itself encodes
|
|
38
|
+
* the semantic intent.
|
|
39
39
|
*/
|
|
40
40
|
export class HydraniumGlspRecordingCommand extends JsonRecordingCommand {
|
|
41
41
|
label;
|
|
42
42
|
undoAction;
|
|
43
43
|
redoAction;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
* {@link postChange} so
|
|
47
|
-
*
|
|
48
|
-
* returns so undo / redo paths fall through
|
|
49
|
-
*
|
|
45
|
+
* What the command was authored against, taken at {@link execute} start and
|
|
46
|
+
* threaded into {@link postChange} so
|
|
47
|
+
* {@link AbstractHydraniumGlspState.updateSourceModel} gates on it. Reset to
|
|
48
|
+
* `'anything'` after `execute` returns so undo / redo paths fall through
|
|
49
|
+
* ungated.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
activeBasedOn = 'anything';
|
|
52
52
|
/**
|
|
53
53
|
* Source-model snapshots captured at {@link execute} — the state the
|
|
54
54
|
* command left ({@link afterSnapshot}) and the state it started from
|
|
@@ -79,36 +79,35 @@ export class HydraniumGlspRecordingCommand extends JsonRecordingCommand {
|
|
|
79
79
|
* via {@link AbstractHydraniumGlspState.updateSourceModel}). The label combines
|
|
80
80
|
* the operation name with the source-uri-stamped logger.
|
|
81
81
|
*
|
|
82
|
-
*
|
|
83
|
-
* can thread
|
|
84
|
-
*
|
|
85
|
-
* see a stale captured version.
|
|
82
|
+
* Takes {@link AbstractHydraniumGlspState.basedOn} at start so {@link postChange}
|
|
83
|
+
* can thread it into `updateSourceModel`. Scoped with `try`/`finally` so undo
|
|
84
|
+
* / redo paths invoked later do not see a stale value.
|
|
86
85
|
*/
|
|
87
86
|
async execute() {
|
|
88
87
|
const logger = this.modelState.logger.for('HydraniumGlspRecordingCommand');
|
|
89
|
-
this.
|
|
90
|
-
logger.debug(`Executing '${this.label}' (based-on doc.version=v${this.
|
|
88
|
+
this.activeBasedOn = this.modelState.basedOn;
|
|
89
|
+
logger.debug(`Executing '${this.label}' (based-on doc.version=v${this.modelState.version})`);
|
|
91
90
|
this.beforeSnapshot = this.deepClone(await this.getJsonObject());
|
|
92
91
|
try {
|
|
93
92
|
await this.modelState.tracer.for('HydraniumGlspRecordingCommand').time(`Execute command '${this.label}'`, () => super.execute());
|
|
94
93
|
}
|
|
95
94
|
finally {
|
|
96
|
-
this.
|
|
95
|
+
this.activeBasedOn = 'anything';
|
|
97
96
|
}
|
|
98
97
|
this.afterSnapshot = this.deepClone(await this.getJsonObject());
|
|
99
98
|
}
|
|
100
99
|
/**
|
|
101
100
|
* Override of GLSP's {@link JsonRecordingCommand.postChange} so the
|
|
102
101
|
* call to {@link AbstractHydraniumGlspState.updateSourceModel} threads the
|
|
103
|
-
*
|
|
102
|
+
* based-on version alongside the new model.
|
|
104
103
|
*
|
|
105
|
-
* During {@link execute}
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
104
|
+
* During {@link execute} it is the snapshot version taken at command start;
|
|
105
|
+
* during {@link undo} / {@link redo} it is `'anything'` — replaying a
|
|
106
|
+
* recorded patch does not author against a specific server version, so no
|
|
107
|
+
* gate applies.
|
|
109
108
|
*/
|
|
110
109
|
postChange(newModel) {
|
|
111
|
-
return this.modelState.updateSourceModel(newModel, this.
|
|
110
|
+
return this.modelState.updateSourceModel(newModel, this.activeBasedOn);
|
|
112
111
|
}
|
|
113
112
|
/**
|
|
114
113
|
* Reconcile the recorded `after → before` transition against the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-glsp-recording-command.js","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuC,oBAAoB,EAAqB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-recording-command.js","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuC,oBAAoB,EAAqB,MAAM,sBAAsB,CAAC;AAkBpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,6BAA8D,SAAQ,oBAAkC;IA2B5F;IAIA;IAEA;IA9BtB;;;;;;OAMG;IACO,aAAa,GAAY,UAAU,CAAC;IAE9C;;;;;;;;OAQG;IACO,cAAc,CAAgB;IAC9B,aAAa,CAAgB;IAEvC,YACG,UAAqD;IACrD,mFAAmF;IAChE,KAAa,EAChC,SAAmC;IACnC;uEACmE;IAChD,UAAqC;IACxD,gEAAgE;IAC7C,UAAqC;QAExD,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QARV,UAAK,GAAL,KAAK,CAAQ;QAIb,eAAU,GAAV,UAAU,CAA2B;QAErC,eAAU,GAAV,UAAU,CAA2B;IAG3D,CAAC;IAED;;;;;;;;;OASG;IACM,KAAK,CAAC,OAAO;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC3E,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAC7C,MAAM,CAAC,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,4BAA4B,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;QAC7F,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAA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],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC"}
|
package/lib/command/index.js
CHANGED
package/lib/command/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { DiagramModule } from '@eclipse-glsp/server';
|
|
9
|
+
import { type ActionHandlerConstructor, type BindingTarget, type CommandStack, DiagramModule, type InstanceMultiBinding } from '@eclipse-glsp/server';
|
|
10
10
|
import { type interfaces } from 'inversify';
|
|
11
11
|
import type { LanguageMetaData } from '@hydranium/langium';
|
|
12
12
|
/**
|
|
@@ -16,8 +16,10 @@ import type { LanguageMetaData } from '@hydranium/langium';
|
|
|
16
16
|
* Exported separately from {@link AbstractHydraniumGlspDiagramModule} for adopters
|
|
17
17
|
* whose diagram module already extends an intermediate base of their own and
|
|
18
18
|
* cannot take the framework base class; call it from `configure` after
|
|
19
|
-
* `super.configure(...)
|
|
20
|
-
*
|
|
19
|
+
* `super.configure(...)`, add {@link HydraniumGlspRequestSaveModelActionHandler}
|
|
20
|
+
* in `configureActionHandlers`, and return {@link HydraniumGlspCommandStack} from
|
|
21
|
+
* `bindCommandStack`, all of which the base also does. The base class is the
|
|
22
|
+
* preferred entry point because it makes the declaration non-optional.
|
|
21
23
|
*
|
|
22
24
|
* **Why the session tier.** GLSP builds its app container once per process,
|
|
23
25
|
* before any document exists, so a per-language service bound there can only
|
|
@@ -71,5 +73,12 @@ export declare abstract class AbstractHydraniumGlspDiagramModule extends Diagram
|
|
|
71
73
|
*/
|
|
72
74
|
protected abstract declareLanguage(): LanguageMetaData;
|
|
73
75
|
protected configure(bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind): void;
|
|
76
|
+
/** {@link HydraniumGlspCommandStack}, so the diagram is dirty exactly while a document it has open is. */
|
|
77
|
+
protected bindCommandStack(): BindingTarget<CommandStack>;
|
|
78
|
+
/**
|
|
79
|
+
* Adds {@link HydraniumGlspRequestSaveModelActionHandler}, the save the
|
|
80
|
+
* Theia client sends, beside GLSP's own save handler.
|
|
81
|
+
*/
|
|
82
|
+
protected configureActionHandlers(binding: InstanceMultiBinding<ActionHandlerConstructor>): void;
|
|
74
83
|
}
|
|
75
84
|
//# sourceMappingURL=abstract-hydranium-glsp-diagram-module.d.ts.map
|