@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
|
@@ -7,31 +7,45 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import 'reflect-metadata';
|
|
10
|
-
import { ClientSessionManager, EndProgressAction, GLSPClientProxy, GLSPServer, ModelState, RequestBoundsAction, RequestModelAction, SOURCE_URI_ARG, SetDirtyStateAction, SetModelAction, StartProgressAction, StatusAction, UpdateModelAction, UpdateProgressAction } from '@eclipse-glsp/server';
|
|
10
|
+
import { ActionDispatchScope, ClientSessionManager, EndProgressAction, GLSPClientProxy, GLSPServer, MessageAction, ModelState, RejectAction, RequestBoundsAction, RequestModelAction, SOURCE_URI_ARG, SetDirtyStateAction, SetMarkersAction, SetModelAction, StartProgressAction, StatusAction, UpdateModelAction, UpdateProgressAction } from '@eclipse-glsp/server';
|
|
11
11
|
import { DefaultGLSPServer, InjectionContainer, Logger as GlspLogger, LoggerFactory, NodeActionDispatchScope, getRequestParentName } from '@eclipse-glsp/server/node.js';
|
|
12
|
-
import { ActionDispatchScope } from '@eclipse-glsp/server';
|
|
13
12
|
import { Container, ContainerModule } from 'inversify';
|
|
14
13
|
import { HydraniumTypes } from '../state/hydranium-shared-core-services.js';
|
|
15
14
|
import { createGlspServerOverrides } from '../launcher/glsp-server-overrides.js';
|
|
16
15
|
import { makeNoopGlspLogger } from './make-noop-glsp-logger.js';
|
|
17
16
|
/**
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* The fewest client-bound action kinds a session can declare and still finish
|
|
18
|
+
* a model round-trip without the server's dispatcher erroring with "no handler
|
|
19
|
+
* registered" for an ordinary server→client action.
|
|
20
|
+
*
|
|
21
|
+
* A real GLSP client declares every kind its own handler registry holds, which
|
|
22
|
+
* is far more than this, and GLSP ships no fixed list to declare instead. So a
|
|
23
|
+
* test session that leaves one of these out sees errors no deployed client
|
|
24
|
+
* would, or none at all: a dispatch the server does not await, such as the
|
|
25
|
+
* markers after a load, fails without telling the client. The harness declares
|
|
26
|
+
* them by default; adopter-specific kinds are added via
|
|
23
27
|
* {@link MakeGlspHarnessOptions.additionalClientActionKinds}.
|
|
24
28
|
*/
|
|
25
|
-
const
|
|
29
|
+
export const MINIMAL_CLIENT_ACTION_KINDS = Object.freeze([
|
|
26
30
|
SetModelAction.KIND,
|
|
27
31
|
UpdateModelAction.KIND,
|
|
28
32
|
RequestBoundsAction.KIND,
|
|
29
33
|
SetDirtyStateAction.KIND,
|
|
30
34
|
StatusAction.KIND,
|
|
35
|
+
MessageAction.KIND,
|
|
36
|
+
SetMarkersAction.KIND,
|
|
31
37
|
StartProgressAction.KIND,
|
|
32
38
|
UpdateProgressAction.KIND,
|
|
33
39
|
EndProgressAction.KIND
|
|
34
|
-
];
|
|
40
|
+
]);
|
|
41
|
+
/**
|
|
42
|
+
* Whether the server reported a failure to the client: a rejected request, or
|
|
43
|
+
* an ERROR or FATAL message. A server can fail a request and still send the
|
|
44
|
+
* model, so a test that sees the model has not yet seen the load succeed.
|
|
45
|
+
*/
|
|
46
|
+
export function isRejectionOrError(action) {
|
|
47
|
+
return RejectAction.is(action) || (MessageAction.is(action) && (action.severity === 'ERROR' || action.severity === 'FATAL'));
|
|
48
|
+
}
|
|
35
49
|
/**
|
|
36
50
|
* The actions that mean "the server published a model".
|
|
37
51
|
*
|
|
@@ -61,10 +75,12 @@ export const MODEL_SUBMISSION_KINDS = [SetModelAction.KIND, UpdateModelAction.KI
|
|
|
61
75
|
export function makeGlspHarness(options) {
|
|
62
76
|
const applicationId = options.applicationId ?? 'test-app';
|
|
63
77
|
const clientSessionId = options.clientSessionId ?? 'test-session';
|
|
64
|
-
const clientActionKinds = [...
|
|
78
|
+
const clientActionKinds = [...MINIMAL_CLIENT_ACTION_KINDS, ...(options.additionalClientActionKinds ?? [])];
|
|
65
79
|
const createLogger = options.createLogger ?? (() => makeNoopGlspLogger());
|
|
66
80
|
const actions = [];
|
|
67
81
|
const consumed = new WeakSet();
|
|
82
|
+
// Where the last dispatch fell in `actions`; a wait matches only from here.
|
|
83
|
+
let dispatchedAt = 0;
|
|
68
84
|
const waiters = [];
|
|
69
85
|
const captureProxy = {
|
|
70
86
|
process(message) {
|
|
@@ -80,8 +96,9 @@ export function makeGlspHarness(options) {
|
|
|
80
96
|
}
|
|
81
97
|
};
|
|
82
98
|
/**
|
|
83
|
-
* Resolve with the first unconsumed action matching any of `kinds`
|
|
84
|
-
* already captured resolves immediately, otherwise the
|
|
99
|
+
* Resolve with the first unconsumed action matching any of `kinds` since the
|
|
100
|
+
* last dispatch — one already captured resolves immediately, otherwise the
|
|
101
|
+
* next arrival wins.
|
|
85
102
|
*
|
|
86
103
|
* `rejectOnTimeout` is what lets a caller distinguish the two questions a
|
|
87
104
|
* test asks. `true` (the default) is "this must happen", and a timeout is a
|
|
@@ -91,7 +108,7 @@ export function makeGlspHarness(options) {
|
|
|
91
108
|
* `ActionDispatcher.requestUntil(action, timeoutMs, rejectOnTimeout)`.
|
|
92
109
|
*/
|
|
93
110
|
function waitFor(kinds, timeoutMs, rejectOnTimeout) {
|
|
94
|
-
const existing = actions.find(action => kinds.includes(action.kind) && !consumed.has(action));
|
|
111
|
+
const existing = actions.find((action, index) => index >= dispatchedAt && kinds.includes(action.kind) && !consumed.has(action));
|
|
95
112
|
if (existing) {
|
|
96
113
|
consumed.add(existing);
|
|
97
114
|
return Promise.resolve(existing);
|
|
@@ -113,8 +130,17 @@ export function makeGlspHarness(options) {
|
|
|
113
130
|
// Distinguishing "nothing happened" from "something else
|
|
114
131
|
// happened" is the difference between a five-minute hunt and a
|
|
115
132
|
// one-line diagnosis.
|
|
116
|
-
|
|
117
|
-
|
|
133
|
+
// Split at the last dispatch, since a wait matches only what
|
|
134
|
+
// came after it: an earlier match is no answer to this one.
|
|
135
|
+
const kindsIn = (from, to) => actions
|
|
136
|
+
.slice(from, to)
|
|
137
|
+
.map(captured => captured.kind)
|
|
138
|
+
.join(', ') || 'nothing';
|
|
139
|
+
const context = actions.length === 0
|
|
140
|
+
? 'no actions were captured at all'
|
|
141
|
+
: dispatchedAt === 0
|
|
142
|
+
? `captured since start: ${kindsIn(0)}`
|
|
143
|
+
: `captured before the last dispatch, which a wait does not match: ${kindsIn(0, dispatchedAt)}; since: ${kindsIn(dispatchedAt)}`;
|
|
118
144
|
reject(new Error(`makeGlspHarness: no ${kinds.map(kind => `'${kind}'`).join(' / ')} action within ${timeoutMs}ms — ${context}`));
|
|
119
145
|
}
|
|
120
146
|
else {
|
|
@@ -146,10 +172,10 @@ export function makeGlspHarness(options) {
|
|
|
146
172
|
const container = new Container();
|
|
147
173
|
container.load(defaultAppModule, ...(options.appModules ?? []), captureProxyModule);
|
|
148
174
|
container.load(options.serverModule);
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
//
|
|
175
|
+
// Into the container the serverModule binds `GLSPServer` in, as the
|
|
176
|
+
// launchers' `configure` loads it: a harness that skipped it would keep
|
|
177
|
+
// upstream's server and answer request failures differently from every
|
|
178
|
+
// real bringup.
|
|
153
179
|
container.load(createGlspServerOverrides());
|
|
154
180
|
const server = container.get(GLSPServer);
|
|
155
181
|
let sessionContainer;
|
|
@@ -191,6 +217,7 @@ export function makeGlspHarness(options) {
|
|
|
191
217
|
server.shutdown();
|
|
192
218
|
},
|
|
193
219
|
dispatch(action) {
|
|
220
|
+
dispatchedAt = actions.length;
|
|
194
221
|
server.process({ clientId: clientSessionId, action });
|
|
195
222
|
},
|
|
196
223
|
nextAction(kind, timeoutMs = 2000) {
|
|
@@ -200,6 +227,7 @@ export function makeGlspHarness(options) {
|
|
|
200
227
|
if (!state) {
|
|
201
228
|
throw new Error('makeGlspHarness: openDocument() is only valid after start()');
|
|
202
229
|
}
|
|
230
|
+
dispatchedAt = actions.length;
|
|
203
231
|
server.process({
|
|
204
232
|
clientId: clientSessionId,
|
|
205
233
|
action: RequestModelAction.create({ options: { [SOURCE_URI_ARG]: sourceUri } })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-harness.js","sourceRoot":"","sources":["../../src/testing/glsp-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"glsp-harness.js","sourceRoot":"","sources":["../../src/testing/glsp-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAEJ,mBAAmB,EAEnB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACJ,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,IAAI,UAAU,EACpB,aAAa,EACb,uBAAuB,EAEvB,oBAAoB,EACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAmB,MAAM,WAAW,CAAC;AAKxE,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,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CAAC,CAAC;YAC1E,mEAAmE;YACnE,OAAO,UAAoB,CAAC;QAC/B,CAAC;QAED,mBAAmB,CAAC,OAAO,GAA+B,EAAE;YACzD,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,eAAe,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;YAC7D,OAAO,OAAO,CAAC,sBAAsB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;QACtE,CAAC;QAED,cAAc,CAAC,GAAW,EAAE,IAA4C;YACrE,IAAI,CAAC,KAAK,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;YACpF,CAAC;YACD,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClC,CAAC;QAED,OAAO;YACJ,IAAI,QAAQ,EAAE,CAAC;gBACZ,OAAO;YACV,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC;YAChB,MAAM,CAAC,QAAQ,EAAE,CAAC;YAClB,SAAS,CAAC,SAAS,EAAE,CAAC;QACzB,CAAC;KACH,CAAC;AACL,CAAC"}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type Marker } from '@eclipse-glsp/
|
|
9
|
+
import { type Marker } from '@eclipse-glsp/server';
|
|
10
10
|
import { type AstNode } from '@hydranium/langium';
|
|
11
|
-
import { type
|
|
11
|
+
import { type AstDiagnostic } from '@hydranium/core';
|
|
12
12
|
/**
|
|
13
13
|
* The model-shaped lookups the diagnostic→marker translation needs, injected so
|
|
14
14
|
* the pure mapping can be unit-tested without GLSP/Langium DI. The validator
|
|
@@ -44,5 +44,5 @@ export interface DiagnosticMarkerLookups {
|
|
|
44
44
|
* `MarkersReason` so a fresh `SetMarkersAction` replaces the previous markers
|
|
45
45
|
* (an empty result clears them when all errors are fixed).
|
|
46
46
|
*/
|
|
47
|
-
export declare function diagnosticsToMarkers(diagnostics: readonly
|
|
47
|
+
export declare function diagnosticsToMarkers(diagnostics: readonly AstDiagnostic[], lookups: DiagnosticMarkerLookups): Marker[];
|
|
48
48
|
//# sourceMappingURL=diagnostic-markers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic-markers.d.ts","sourceRoot":"","sources":["../../src/validation/diagnostic-markers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"diagnostic-markers.d.ts","sourceRoot":"","sources":["../../src/validation/diagnostic-markers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACrC;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACzD;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,EAAE,OAAO,EAAE,uBAAuB,GAAG,MAAM,EAAE,CAWtH"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { MarkerKind } from '@eclipse-glsp/
|
|
9
|
+
import { MarkerKind } from '@eclipse-glsp/server';
|
|
10
10
|
import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-types';
|
|
11
11
|
/**
|
|
12
12
|
* Translate the current document's LSP diagnostics into GLSP {@link Marker}s
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic-markers.js","sourceRoot":"","sources":["../../src/validation/diagnostic-markers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAe,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"diagnostic-markers.js","sourceRoot":"","sources":["../../src/validation/diagnostic-markers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAe,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAuB7E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAqC,EAAE,OAAgC;IACzG,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC7C,0EAA0E;QAC1E,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACxD,KAAK,MAAM,SAAS,IAAI,kBAAkB,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;YACvE,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3E,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AAClB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAC,WAA+B,EAAE,OAAgC;IAC1F,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACb,CAAC;IACD,IAAI,IAAI,GAAwB,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACpE,OAAO,IAAI,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,GAAG,CAAC;QACd,CAAC;QACD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;IAC1B,CAAC;IACD,OAAO,EAAE,CAAC;AACb,CAAC;AAED,iHAAiH;AACjH,SAAS,UAAU,CAAC,QAAwC;IACzD,QAAQ,QAAQ,EAAE,CAAC;QAChB,KAAK,kBAAkB,CAAC,OAAO;YAC5B,OAAO,UAAU,CAAC,OAAO,CAAC;QAC7B,KAAK,kBAAkB,CAAC,WAAW,CAAC;QACpC,KAAK,kBAAkB,CAAC,IAAI;YACzB,OAAO,UAAU,CAAC,IAAI,CAAC;QAC1B,KAAK,kBAAkB,CAAC,KAAK,CAAC;QAC9B;YACG,OAAO,UAAU,CAAC,KAAK,CAAC;IAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type Marker } from '@eclipse-glsp/
|
|
10
|
-
import { type GModelElement, type ModelValidator } from '@eclipse-glsp/server';
|
|
9
|
+
import { type GModelElement, type Marker, type ModelValidator } from '@eclipse-glsp/server';
|
|
11
10
|
import { type AstNode } from '@hydranium/langium';
|
|
12
11
|
import { type ServerSharedServices } from '@hydranium/core';
|
|
13
12
|
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-glsp-model-validator.d.ts","sourceRoot":"","sources":["../../src/validation/hydranium-glsp-model-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-model-validator.d.ts","sourceRoot":"","sources":["../../src/validation/hydranium-glsp-model-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAc,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAExG,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,oBAAoB,EAAsB,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAI5F;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,2BAA2B,CAAC,KAAK,SAAS,OAAO,GAAG,OAAO,CAAE,YAAW,cAAc;IACrD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAG,oBAAoB,CAAC;IAChF,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAEtF,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAE/D;IAED;;;;;OAKG;IACH,OAAO,IAAI,MAAM,EAAE,CA4ClB;CACH"}
|
|
@@ -75,7 +75,7 @@ let HydraniumGlspModelValidator = class HydraniumGlspModelValidator {
|
|
|
75
75
|
continue;
|
|
76
76
|
}
|
|
77
77
|
// Diagnostics are produced by the framework's `HydraniumDocumentValidator`,
|
|
78
|
-
// which emits `
|
|
78
|
+
// which emits `AstDiagnostic` (LSP `Diagnostic` + `element` path).
|
|
79
79
|
// Parser/lexer diagnostics carry no `element`; the lookup drops them.
|
|
80
80
|
const diagnostics = document.diagnostics;
|
|
81
81
|
if (!diagnostics || diagnostics.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-glsp-model-validator.js","sourceRoot":"","sources":["../../src/validation/hydranium-glsp-model-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-model-validator.js","sourceRoot":"","sources":["../../src/validation/hydranium-glsp-model-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAAmC,UAAU,EAAuB,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAgC,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACyB,cAAc,CAAwB;IAC7D,UAAU,CAAqC;IAEtF,QAAQ,CAAC,SAA0B,EAAE,OAAgB;QAClD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,OAAO;QACJ,mEAAmE;QACnE,0EAA0E;QAC1E,wEAAwE;QACxE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACb,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACpC,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,uEAAuE;QACvE,qEAAqE;QACrE,cAAc;QACd,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC;YAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5F,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACb,SAAS;YACZ,CAAC;YACD,4EAA4E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;IAA7D,MAAM,CAAC,cAAc,CAAC,kBAAkB,CAAC;;mEAA0D;AAC7D;IAAtC,MAAM,CAAC,UAAU,CAAC;;+DAAmE;AAF5E,2BAA2B;IADvC,UAAU,EAAE;GACA,2BAA2B,CA2DvC"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/glsp-server",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.315",
|
|
4
4
|
"description": "GLSP protocol head for the hydranium framework. Peer of @hydranium/core/lsp and @hydranium/data-server; built on @hydranium/core.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"diagram",
|
|
7
|
+
"glsp",
|
|
6
8
|
"hydranium",
|
|
7
9
|
"langium",
|
|
8
10
|
"language-server",
|
|
9
|
-
"lsp"
|
|
10
|
-
"glsp",
|
|
11
|
-
"diagram"
|
|
11
|
+
"lsp"
|
|
12
12
|
],
|
|
13
13
|
"homepage": "https://github.com/eclipse-emfcloud/hydranium/tree/main/packages/glsp-server",
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/eclipse-emfcloud/hydranium/issues"
|
|
16
16
|
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Hydranium Team"
|
|
20
|
+
},
|
|
17
21
|
"repository": {
|
|
18
22
|
"type": "git",
|
|
19
23
|
"url": "https://github.com/eclipse-emfcloud/hydranium.git",
|
|
20
24
|
"directory": "packages/glsp-server"
|
|
21
25
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
+
"files": [
|
|
27
|
+
"lib",
|
|
28
|
+
"src",
|
|
29
|
+
"!lib/**/*.tsbuildinfo"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
26
32
|
"sideEffects": [
|
|
27
33
|
"./lib/testing/glsp-harness.js"
|
|
28
34
|
],
|
|
29
|
-
"
|
|
35
|
+
"main": "lib/index.js",
|
|
36
|
+
"types": "lib/index.d.ts",
|
|
30
37
|
"exports": {
|
|
31
38
|
".": {
|
|
32
39
|
"types": "./lib/index.d.ts",
|
|
@@ -36,85 +43,57 @@
|
|
|
36
43
|
"types": "./lib/browser/index.d.ts",
|
|
37
44
|
"default": "./lib/browser/index.js"
|
|
38
45
|
},
|
|
39
|
-
"./lib/browser": {
|
|
40
|
-
"types": "./lib/browser/index.d.ts",
|
|
41
|
-
"default": "./lib/browser/index.js"
|
|
42
|
-
},
|
|
43
46
|
"./node": {
|
|
44
47
|
"types": "./lib/node/index.d.ts",
|
|
45
48
|
"default": "./lib/node/index.js"
|
|
46
49
|
},
|
|
47
|
-
"./lib/node": {
|
|
48
|
-
"types": "./lib/node/index.d.ts",
|
|
49
|
-
"default": "./lib/node/index.js"
|
|
50
|
-
},
|
|
51
50
|
"./messages": {
|
|
52
51
|
"types": "./lib/messages/index.d.ts",
|
|
53
52
|
"default": "./lib/messages/index.js"
|
|
54
53
|
},
|
|
55
|
-
"./lib/messages": {
|
|
56
|
-
"types": "./lib/messages/index.d.ts",
|
|
57
|
-
"default": "./lib/messages/index.js"
|
|
58
|
-
},
|
|
59
54
|
"./testing": {
|
|
60
55
|
"types": "./lib/testing/index.d.ts",
|
|
61
56
|
"default": "./lib/testing/index.js"
|
|
62
|
-
},
|
|
63
|
-
"./lib/testing": {
|
|
64
|
-
"types": "./lib/testing/index.d.ts",
|
|
65
|
-
"default": "./lib/testing/index.js"
|
|
66
57
|
}
|
|
67
58
|
},
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"lib",
|
|
72
|
-
"src",
|
|
73
|
-
"!lib/**/*.tsbuildinfo"
|
|
74
|
-
],
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
75
62
|
"scripts": {
|
|
76
63
|
"build": "tsc -b",
|
|
77
64
|
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
78
|
-
"lint": "
|
|
65
|
+
"lint": "oxlint --format stylish --config ../../oxlint.config.cjs src test --max-warnings 0",
|
|
79
66
|
"prepack": "node -e \"const m=require('./package.json'),fs=require('node:fs');const missing=[m.main,...Object.values(m.bin||{})].filter(entry=>entry&&!fs.existsSync(entry));if(missing.length){console.error('prepack '+m.name+': not built ('+missing.join(', ')+' missing). Run the build before packing: a files entry that matches nothing is skipped silently, so the tarball would ship src only.');process.exit(1);}\"",
|
|
80
67
|
"test": "npm run typecheck:test && vitest run",
|
|
81
68
|
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
82
69
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
83
70
|
},
|
|
84
|
-
"dependencies": {
|
|
85
|
-
"uuid": "^10.0.0"
|
|
86
|
-
},
|
|
87
71
|
"devDependencies": {
|
|
88
|
-
"@eclipse-glsp/protocol": "2.7.0",
|
|
89
72
|
"@eclipse-glsp/server": "2.7.0",
|
|
90
|
-
"@hydranium/core": "1.0.0-next.
|
|
91
|
-
"@hydranium/langium": "1.0.0-next.
|
|
92
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
73
|
+
"@hydranium/core": "1.0.0-next.315",
|
|
74
|
+
"@hydranium/langium": "1.0.0-next.315",
|
|
75
|
+
"@hydranium/protocol": "1.0.0-next.315",
|
|
93
76
|
"inversify": "6.2.2",
|
|
94
77
|
"reflect-metadata": "0.2.2",
|
|
95
78
|
"rimraf": "^5.0.0",
|
|
96
|
-
"typescript": "^
|
|
97
|
-
"vscode-jsonrpc": "9.0.
|
|
79
|
+
"typescript": "^7.0.2",
|
|
80
|
+
"vscode-jsonrpc": "9.0.0",
|
|
98
81
|
"vscode-languageserver-types": "^3.17.5"
|
|
99
82
|
},
|
|
100
83
|
"peerDependencies": {
|
|
101
|
-
"@eclipse-glsp/protocol": "^2.6.0",
|
|
102
84
|
"@eclipse-glsp/server": "^2.6.0",
|
|
103
|
-
"@hydranium/core": "1.0.0-next.
|
|
104
|
-
"@hydranium/langium": "1.0.0-next.
|
|
105
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
85
|
+
"@hydranium/core": "1.0.0-next.315",
|
|
86
|
+
"@hydranium/langium": "1.0.0-next.315",
|
|
87
|
+
"@hydranium/protocol": "1.0.0-next.315",
|
|
106
88
|
"inversify": "^6.0.0",
|
|
107
89
|
"reflect-metadata": "^0.2.2",
|
|
108
|
-
"vscode-jsonrpc": "9.0.
|
|
90
|
+
"vscode-jsonrpc": "^9.0.0",
|
|
109
91
|
"vscode-languageserver-types": "^3.17.5"
|
|
110
92
|
},
|
|
111
93
|
"engines": {
|
|
112
94
|
"node": ">=22.13"
|
|
113
95
|
},
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
"//peerDependencies": "`vscode-jsonrpc` is EXACT rather than a range, because it is one link of an atomic chain with no independently movable link: `vscode-languageserver-protocol` depends on it at exactly 9.0.1, so any other value an adopter supplies is a SECOND physical copy rather than an upgrade. This wire stack breaks on copy identity rather than on structure — `ParameterStructures.auto` is a singleton compared by `===` in connection.js, so a request type built by one copy and sent over a connection owned by the other throws `Unknown parameter structure auto`. A caret or union range was rejected because npm then resolves a `vscode-jsonrpc@8.2.0` tree SILENTLY, with no diagnostic at all, and the failure surfaces only later at server init. Exact does not fail the install either — npm downgrades an unsatisfiable peer to a warning — but it is a NAMED ERESOLVE warning printing the required version beside the found one, and a hard error for anyone installing with `--strict-peer-deps`. **This is the head where it is not enough**: `@eclipse-glsp/*` carries its own exact `vscode-jsonrpc@8.2.0` dependency and root `overrides` do not ship, so a first install of this package ALWAYS lands two copies and the adopter must pin the chain in their own manifest.",
|
|
118
|
-
"//prepack": "The publish guard, and it deliberately is NOT a `prepare`: npm runs a workspace `prepare` BEFORE the root `postinstall` that applies patches/vscode-jsonrpc+9.0.1.patch, so building there fails on a cold clone and npm rolls the entire install back. `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. It FAILS rather than rebuilds, because the rebuild is exactly the part that ordering defeats. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error.",
|
|
96
|
+
"//peerDependencies": "`vscode-jsonrpc` takes a caret, so the framework shares the transport the LSP connection resolves, which an `init` scaffold pins: each `vscode-languageserver-protocol` release pins its transport exactly, so an exact peer would name a copy a fresh install rarely holds. The caret excludes 8.x, so a tree whose top holds GLSP's copy fails the peer with a named ERESOLVE warning, an error under `--strict-peer-deps`, rather than resolving silently. No peer reaches a NESTED copy, such as GLSP's or one the LSP packages nest. The wire compares message types and `ResponseError`s by copy identity, so both launchers here build their connection from this copy and send GLSP's typed messages by method name, and the framework recognises errors with `isResponseError` rather than `instanceof`. `@eclipse-glsp/protocol` is no peer: the framework imports it through `@eclipse-glsp/server`'s re-exports, so it shares the server's copy, where a peer would let npm install a second release beside it.",
|
|
97
|
+
"//prepack": "The publish guard, a `prepack` rather than a `prepare`: `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error.",
|
|
119
98
|
"//sideEffects": "The harness bare-imports `reflect-metadata`, which installs a global `Reflect` polyfill the inversify decorators in this package need before any container is built. That effect is invisible from the module's exports, so a bundler that treats the file as pure may reorder or drop the import and every `@injectable` resolution then fails at runtime. The rest of the package constructs no module-level state beyond frozen constants and DI symbols."
|
|
120
99
|
}
|
|
@@ -14,43 +14,63 @@ import {
|
|
|
14
14
|
WorkerServerLauncher,
|
|
15
15
|
createAppModule
|
|
16
16
|
} from '@eclipse-glsp/server/browser.js';
|
|
17
|
-
import { Container,
|
|
18
|
-
import
|
|
17
|
+
import { Container, ContainerModule, injectable } from 'inversify';
|
|
18
|
+
import {
|
|
19
|
+
createMessagePortTransport,
|
|
20
|
+
describeErrorWithStack,
|
|
21
|
+
sendByMethodName,
|
|
22
|
+
type Logger,
|
|
23
|
+
type TransferredMessagePort
|
|
24
|
+
} from '@hydranium/protocol';
|
|
25
|
+
import { createMessageConnection } from 'vscode-jsonrpc/browser';
|
|
19
26
|
import type { IntegratedServer } from '@hydranium/core';
|
|
27
|
+
import { dropNotificationsToGoneClient } from '../launcher/drop-notifications-to-gone-client.js';
|
|
28
|
+
import { createGlspConnectionLogger } from '../launcher/glsp-connection-logger.js';
|
|
20
29
|
import { createGlspFrameworkOverrides } from '../launcher/glsp-framework-overrides.js';
|
|
21
30
|
import { createGlspServerOverrides } from '../launcher/glsp-server-overrides.js';
|
|
22
31
|
|
|
32
|
+
// Re-exported so the type of this head's `context` still resolves from here.
|
|
33
|
+
export type { TransferredMessagePort } from '@hydranium/protocol';
|
|
34
|
+
|
|
23
35
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
36
|
+
* The default worker launcher of {@link startGlspServerInWorker}: GLSP's
|
|
37
|
+
* own, with its connection built over `createMessagePortTransport` rather than
|
|
38
|
+
* over `BrowserMessageReader`/`BrowserMessageWriter`, which never report a
|
|
39
|
+
* close. So the client disposing its connection closes this one, and upstream
|
|
40
|
+
* disposes the server instance, and with it every client session, as it does
|
|
41
|
+
* when a socket closes.
|
|
30
42
|
*
|
|
31
|
-
*
|
|
32
|
-
* the worker global**, both of which the launcher's own reader would otherwise
|
|
33
|
-
* accept. Only a port needs starting, so `start` is what tells the three apart,
|
|
34
|
-
* and naming it here turns "never bind a head to the global" from a rule in a
|
|
35
|
-
* document into a compile error at the call site.
|
|
43
|
+
* Requires `context`: unlike upstream it never falls back to the worker global.
|
|
36
44
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
* The connection sends GLSP's typed messages by method name: it comes from this
|
|
46
|
+
* package's copy of `vscode-jsonrpc` and the types from GLSP's own copy, and a
|
|
47
|
+
* type sent over another copy's connection throws.
|
|
48
|
+
*/
|
|
49
|
+
@injectable()
|
|
50
|
+
export class HydraniumGlspWorkerServerLauncher extends WorkerServerLauncher {
|
|
51
|
+
protected override createConnection(options: WorkerLaunchOptions): ReturnType<WorkerServerLauncher['createConnection']> {
|
|
52
|
+
const transport = createMessagePortTransport(options.context as unknown as TransferredMessagePort);
|
|
53
|
+
return dropNotificationsToGoneClient(
|
|
54
|
+
sendByMethodName(createMessageConnection(transport.reader, transport.writer, createGlspConnectionLogger(this.logger))),
|
|
55
|
+
this.logger
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Binds GLSP's own `WorkerServerLauncher` token to
|
|
62
|
+
* {@link HydraniumGlspWorkerServerLauncher}. {@link startGlspServerInWorker}
|
|
63
|
+
* loads it before the adopter's `appModules`, so an adopter replaces the launcher
|
|
64
|
+
* with `rebind`; a second `bind` makes the resolve ambiguous and the start throws.
|
|
65
|
+
* A replacement extends {@link HydraniumGlspWorkerServerLauncher}: GLSP's own
|
|
66
|
+
* launcher builds its connection from GLSP's copy, so framework errors lose
|
|
67
|
+
* their code, and GLSP's typed messages throw where its packages nest
|
|
68
|
+
* separate copies.
|
|
49
69
|
*/
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
export function createGlspWorkerLauncherModule(): ContainerModule {
|
|
71
|
+
return new ContainerModule(bind => {
|
|
72
|
+
bind(WorkerServerLauncher).to(HydraniumGlspWorkerServerLauncher);
|
|
73
|
+
});
|
|
54
74
|
}
|
|
55
75
|
|
|
56
76
|
/**
|
|
@@ -66,14 +86,15 @@ export interface BrowserGlspServerOptions {
|
|
|
66
86
|
/**
|
|
67
87
|
* The port the host transferred into the worker for this head.
|
|
68
88
|
*
|
|
69
|
-
* **Required
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
89
|
+
* **Required: the worker global is no substitute.** A head on the global
|
|
90
|
+
* receives every other head's traffic — a reader filters nothing, so this is
|
|
91
|
+
* not a race under load but every message delivered to the wrong reader — and
|
|
92
|
+
* GLSP's launcher posts its startup string through the global `postMessage`
|
|
93
|
+
* regardless of the connection it was given, which no JSON-RPC reader parses.
|
|
94
|
+
* Unlike upstream's, this head's launcher never falls back to the global.
|
|
95
|
+
*
|
|
96
|
+
* The page's end must connect through `createMessagePortTransport` as well:
|
|
97
|
+
* the head reads its close signal from the port, and posts one on it.
|
|
77
98
|
*/
|
|
78
99
|
readonly context: TransferredMessagePort;
|
|
79
100
|
/**
|
|
@@ -93,8 +114,10 @@ export interface BrowserGlspServerOptions {
|
|
|
93
114
|
readonly serverModule: ServerModule;
|
|
94
115
|
/**
|
|
95
116
|
* Additional Inversify modules to load on the app container AFTER GLSP's
|
|
96
|
-
* own app module
|
|
97
|
-
*
|
|
117
|
+
* own app module, the framework overrides and
|
|
118
|
+
* {@link createGlspWorkerLauncherModule}. Adopters wire language-services
|
|
119
|
+
* bindings (e.g. their own shared-services symbol) here, and replace the
|
|
120
|
+
* launcher with `rebind`.
|
|
98
121
|
*/
|
|
99
122
|
readonly appModules?: ReadonlyArray<ContainerModule>;
|
|
100
123
|
/**
|
|
@@ -126,8 +149,9 @@ export interface BrowserGlspServerOptions {
|
|
|
126
149
|
* below. There is no transport handshake to wait on: the port arrived live,
|
|
127
150
|
* and the launcher's own readiness signal is a string it posts on the worker
|
|
128
151
|
* global, which nothing here reads.
|
|
129
|
-
* - `stopped` resolves when the connection closes,
|
|
130
|
-
* error.
|
|
152
|
+
* - `stopped` resolves when the connection closes, which the client disposing
|
|
153
|
+
* its connection causes, and rejects on a connection error. Nothing reports a
|
|
154
|
+
* page that dies, because the port cannot.
|
|
131
155
|
*/
|
|
132
156
|
export function startGlspServerInWorker(options: BrowserGlspServerOptions): IntegratedServer {
|
|
133
157
|
const lifecycle = options.logger;
|
|
@@ -143,20 +167,24 @@ export function startGlspServerInWorker(options: BrowserGlspServerOptions): Inte
|
|
|
143
167
|
const glspAppModule = createAppModule({ consoleLog: false });
|
|
144
168
|
|
|
145
169
|
const appContainer = new Container();
|
|
146
|
-
appContainer.load(
|
|
170
|
+
appContainer.load(
|
|
171
|
+
glspAppModule,
|
|
172
|
+
createGlspFrameworkOverrides(options.createLogger),
|
|
173
|
+
createGlspWorkerLauncherModule(),
|
|
174
|
+
...(options.appModules ?? [])
|
|
175
|
+
);
|
|
147
176
|
|
|
148
|
-
const launcher = appContainer.
|
|
177
|
+
const launcher = appContainer.get<WorkerServerLauncher>(WorkerServerLauncher);
|
|
149
178
|
// Additional module rather than an app-container binding, as on Node: the
|
|
150
|
-
// launcher loads these into the per-connection SERVER container, the
|
|
151
|
-
//
|
|
152
|
-
// rebindable.
|
|
179
|
+
// launcher loads these into the per-connection SERVER container, the tier
|
|
180
|
+
// where each connection gets a server of its own.
|
|
153
181
|
launcher.configure(options.serverModule, createGlspServerOverrides());
|
|
154
182
|
|
|
155
183
|
try {
|
|
156
|
-
// Upstream declares `WorkerLaunchOptions.context` as `Worker`,
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
//
|
|
184
|
+
// Upstream declares `WorkerLaunchOptions.context` as `Worker`, and
|
|
185
|
+
// `HydraniumGlspWorkerServerLauncher.createConnection` reads it as a
|
|
186
|
+
// port — so the value that is CORRECT here is the one the declaration
|
|
187
|
+
// names as wrong.
|
|
160
188
|
//
|
|
161
189
|
// **The cast is currently redundant, and is kept deliberately.** `Worker`
|
|
162
190
|
// does not resolve under this package's `lib`, so `skipLibCheck` leaves
|
|
@@ -189,7 +217,7 @@ export function startGlspServerInWorker(options: BrowserGlspServerOptions): Inte
|
|
|
189
217
|
'startGlspServerInWorker: the launcher built no connection synchronously — ' +
|
|
190
218
|
'WorkerServerLauncher.run has become asynchronous and readiness now needs a real signal'
|
|
191
219
|
);
|
|
192
|
-
lifecycle?.error(`[GlspServer] ${error
|
|
220
|
+
lifecycle?.error(`[GlspServer] ${describeErrorWithStack(error)}`);
|
|
193
221
|
return { started: Promise.reject(error), stopped: stoppedPromise };
|
|
194
222
|
}
|
|
195
223
|
|