@hydranium/glsp-client-theia 1.0.0-next.32 → 1.0.0-next.321
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 +60 -98
- package/lib/browser/client-contribution.d.ts +87 -25
- package/lib/browser/client-contribution.d.ts.map +1 -1
- package/lib/browser/client-contribution.js +233 -53
- package/lib/browser/client-contribution.js.map +1 -1
- package/lib/browser/diagram-only-marker-manager.d.ts.map +1 -1
- package/lib/browser/diagram-only-marker-manager.js.map +1 -1
- package/lib/browser/diagram-widget.d.ts +43 -25
- package/lib/browser/diagram-widget.d.ts.map +1 -1
- package/lib/browser/diagram-widget.js +76 -26
- package/lib/browser/diagram-widget.js.map +1 -1
- package/lib/browser/glsp-client-theia-module.d.ts +12 -5
- package/lib/browser/glsp-client-theia-module.d.ts.map +1 -1
- package/lib/browser/glsp-client-theia-module.js +27 -12
- package/lib/browser/glsp-client-theia-module.js.map +1 -1
- package/lib/browser/glsp-diagram-manager.d.ts +40 -1
- package/lib/browser/glsp-diagram-manager.d.ts.map +1 -1
- package/lib/browser/glsp-diagram-manager.js +100 -0
- package/lib/browser/glsp-diagram-manager.js.map +1 -1
- package/lib/browser/glsp-message-service.d.ts.map +1 -1
- package/lib/browser/glsp-message-service.js.map +1 -1
- package/lib/browser/glsp-saveable.d.ts +67 -0
- package/lib/browser/glsp-saveable.d.ts.map +1 -0
- package/lib/browser/glsp-saveable.js +110 -0
- package/lib/browser/glsp-saveable.js.map +1 -0
- package/lib/browser/glsp-theia-frontend-module.d.ts.map +1 -1
- package/lib/browser/glsp-theia-frontend-module.js +4 -1
- package/lib/browser/glsp-theia-frontend-module.js.map +1 -1
- package/lib/browser/hydranium-glsp-diagram-configuration.d.ts +3 -1
- package/lib/browser/hydranium-glsp-diagram-configuration.d.ts.map +1 -1
- package/lib/browser/hydranium-glsp-diagram-configuration.js +3 -1
- package/lib/browser/hydranium-glsp-diagram-configuration.js.map +1 -1
- package/lib/browser/index.d.ts +4 -3
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +7 -5
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/theia-diagram-loader.d.ts +25 -0
- package/lib/browser/theia-diagram-loader.d.ts.map +1 -0
- package/lib/browser/theia-diagram-loader.js +42 -0
- package/lib/browser/theia-diagram-loader.js.map +1 -0
- package/lib/browser/window-session.d.ts +57 -0
- package/lib/browser/window-session.d.ts.map +1 -0
- package/lib/browser/window-session.js +102 -0
- package/lib/browser/window-session.js.map +1 -0
- package/lib/node/connection-container-module.js.map +1 -1
- package/lib/node/glsp-server-connection-handler.d.ts +11 -20
- package/lib/node/glsp-server-connection-handler.d.ts.map +1 -1
- package/lib/node/glsp-server-connection-handler.js +12 -15
- package/lib/node/glsp-server-connection-handler.js.map +1 -1
- package/package.json +37 -46
- package/src/browser/client-contribution.ts +254 -55
- package/src/browser/diagram-widget.ts +80 -28
- package/src/browser/glsp-client-theia-module.ts +34 -13
- package/src/browser/glsp-diagram-manager.ts +112 -3
- package/src/browser/glsp-saveable.ts +111 -0
- package/src/browser/glsp-theia-frontend-module.ts +4 -1
- package/src/browser/hydranium-glsp-diagram-configuration.ts +3 -1
- package/src/browser/index.ts +12 -5
- package/src/browser/theia-diagram-loader.ts +31 -0
- package/src/browser/window-session.ts +114 -0
- package/src/node/glsp-server-connection-handler.ts +12 -24
- package/style/diagram-loading.css +2 -5
- package/lib/browser/action-dispatcher.d.ts +0 -85
- package/lib/browser/action-dispatcher.d.ts.map +0 -1
- package/lib/browser/action-dispatcher.js +0 -238
- package/lib/browser/action-dispatcher.js.map +0 -1
- package/lib/browser/diagram-loader.d.ts +0 -123
- package/lib/browser/diagram-loader.d.ts.map +0 -1
- package/lib/browser/diagram-loader.js +0 -153
- package/lib/browser/diagram-loader.js.map +0 -1
- package/lib/browser/hidden-bounds-updater.d.ts +0 -122
- package/lib/browser/hidden-bounds-updater.d.ts.map +0 -1
- package/lib/browser/hidden-bounds-updater.js +0 -207
- package/lib/browser/hidden-bounds-updater.js.map +0 -1
- package/lib/testing/bind-recorder.d.ts +0 -67
- package/lib/testing/bind-recorder.d.ts.map +0 -1
- package/lib/testing/bind-recorder.js +0 -72
- package/lib/testing/bind-recorder.js.map +0 -1
- package/lib/testing/index.d.ts +0 -10
- package/lib/testing/index.d.ts.map +0 -1
- package/lib/testing/index.js +0 -30
- package/lib/testing/index.js.map +0 -1
- package/src/browser/action-dispatcher.ts +0 -257
- package/src/browser/diagram-loader.ts +0 -173
- package/src/browser/hidden-bounds-updater.ts +0 -212
- package/src/testing/bind-recorder.ts +0 -126
- package/src/testing/index.ts +0 -15
|
@@ -13,12 +13,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
13
13
|
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;
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
20
|
exports.HydraniumGlspDiagramWidget = exports.DIAGRAM_LOADING_FAILED_CLASS = exports.DIAGRAM_LOADING_CLASS = void 0;
|
|
18
21
|
const client_1 = require("@eclipse-glsp/client");
|
|
22
|
+
const protocol_1 = require("@hydranium/protocol");
|
|
19
23
|
const theia_integration_1 = require("@eclipse-glsp/theia-integration");
|
|
24
|
+
const glsp_client_1 = require("@hydranium/glsp-client");
|
|
25
|
+
const core_1 = require("@theia/core");
|
|
20
26
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const
|
|
27
|
+
const glsp_saveable_1 = require("./glsp-saveable");
|
|
28
|
+
const window_session_1 = require("./window-session");
|
|
22
29
|
// Shipped by this package rather than left to adopters: an overlay whose
|
|
23
30
|
// stylesheet was forgotten is an unstyled div in normal flow, which is a silent
|
|
24
31
|
// failure. Adopters override individual rules from their own stylesheet.
|
|
@@ -37,30 +44,50 @@ exports.DIAGRAM_LOADING_FAILED_CLASS = `${exports.DIAGRAM_LOADING_CLASS}-failed`
|
|
|
37
44
|
* model to read as a broken editor rather than a slow one.
|
|
38
45
|
*
|
|
39
46
|
* **How the pending state is sourced.** From {@link HydraniumDiagramLoader}, not
|
|
40
|
-
* from `actionDispatcher.onceModelInitialized()
|
|
41
|
-
* as well as on success,
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* the widget node, while GLSP's `StatusOverlay` — where the loader reports the
|
|
45
|
-
* failure — mounts *inside* the diagram's base div. Keyed on model
|
|
46
|
-
* initialization, a failed load would leave a spinner turning on top of the
|
|
47
|
-
* error message explaining it. Keyed on the loader, exactly one component decides
|
|
48
|
-
* whether the canvas is pending and the two mechanisms compose instead of
|
|
49
|
-
* competing.
|
|
47
|
+
* from `actionDispatcher.onceModelInitialized()`: the loader settles on failure
|
|
48
|
+
* as well as on success, even when its own error report throws, while
|
|
49
|
+
* `onceModelInitialized()` never settles on a failed load and would leave the
|
|
50
|
+
* spinner turning for good.
|
|
50
51
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* `StatusAction` — the action dispatcher was what failed — so the status overlay
|
|
54
|
-
* shows nothing. Uncovering the canvas would then leave a blank diagram whose only
|
|
55
|
-
* explanation is a line in the Output channel. In that case, and only that case,
|
|
56
|
-
* the overlay stays up and swaps the spinner for the error text.
|
|
52
|
+
* A failed load keeps the overlay up with the error and a Retry, which asks for
|
|
53
|
+
* a fresh widget through {@link onDidRequestReopen}.
|
|
57
54
|
*
|
|
58
55
|
* Bound unconditionally by `AbstractHydraniumGlspTheiaFrontendModule`. To opt out,
|
|
59
56
|
* override {@link showLoadingOverlay} to a no-op; to change what is rendered,
|
|
60
57
|
* override {@link createLoadingOverlay} or {@link loadingLabel}.
|
|
58
|
+
*
|
|
59
|
+
* Its saveable is a {@link HydraniumGlspSaveable}, which keeps a pending save
|
|
60
|
+
* dirty, so Theia's exit check still counts it; see {@link createSaveable}.
|
|
61
61
|
*/
|
|
62
62
|
let HydraniumGlspDiagramWidget = class HydraniumGlspDiagramWidget extends theia_integration_1.GLSPDiagramWidget {
|
|
63
|
+
windowSessions;
|
|
63
64
|
loadingOverlay;
|
|
65
|
+
reopenRequestEmitter = new core_1.Emitter();
|
|
66
|
+
/** Fires when this diagram asks to be replaced by a fresh widget, as its
|
|
67
|
+
* Retry does; `AbstractHydraniumGlspDiagramManager` reopens it. A load is
|
|
68
|
+
* not repeated in place, since GLSP's model source registers its handlers
|
|
69
|
+
* once per load. */
|
|
70
|
+
onDidRequestReopen = this.reopenRequestEmitter.event;
|
|
71
|
+
/**
|
|
72
|
+
* Replaces the saveable GLSP's `configure` builds inline, with no factory
|
|
73
|
+
* seam. The widget factory calls `configure` before the widget reaches the
|
|
74
|
+
* shell, so Theia only ever tracks this one.
|
|
75
|
+
*/
|
|
76
|
+
configure(options, diContainer) {
|
|
77
|
+
super.configure(options, diContainer);
|
|
78
|
+
this.saveable.dispose();
|
|
79
|
+
this.saveable = this.createSaveable();
|
|
80
|
+
this.toDispose.push(this.saveable);
|
|
81
|
+
this.toDispose.push(this.reopenRequestEmitter);
|
|
82
|
+
}
|
|
83
|
+
/** The widget's saveable. Override to change how saves and dirty state behave. */
|
|
84
|
+
createSaveable() {
|
|
85
|
+
return new glsp_saveable_1.HydraniumGlspSaveable(this.actionDispatcher, this.diContainer.get(client_1.EditorContextService));
|
|
86
|
+
}
|
|
87
|
+
/** Adds the window's resume token, so a reload or reconnect takes this diagram's session over. */
|
|
88
|
+
getRequestModelOptions() {
|
|
89
|
+
return { ...super.getRequestModelOptions(), [protocol_1.RESUME_TOKEN_ARG]: this.windowSessions.current().resumeToken };
|
|
90
|
+
}
|
|
64
91
|
onAfterAttach(msg) {
|
|
65
92
|
// Before `super`, which is what starts the load on first attach — so the
|
|
66
93
|
// overlay is already up when the round trip begins.
|
|
@@ -71,6 +98,16 @@ let HydraniumGlspDiagramWidget = class HydraniumGlspDiagramWidget extends theia_
|
|
|
71
98
|
this.hideLoadingOverlay();
|
|
72
99
|
super.dispose();
|
|
73
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* GLSP's restore with `animate: false`; compare the two on a GLSP upgrade.
|
|
103
|
+
* An animated restore holds back every later command, so a Delete right
|
|
104
|
+
* after a select-all typed as the diagram opens finds nothing selected.
|
|
105
|
+
*/
|
|
106
|
+
async setViewportData(viewportData) {
|
|
107
|
+
if (this.actionDispatcher instanceof client_1.GLSPActionDispatcher) {
|
|
108
|
+
this.actionDispatcher.dispatchOnceModelInitialized(client_1.SetViewportAction.create(viewportData.elementId, viewportData.viewportData, { animate: false }));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
74
111
|
/**
|
|
75
112
|
* Cover the canvas until the load settles.
|
|
76
113
|
*
|
|
@@ -94,15 +131,9 @@ let HydraniumGlspDiagramWidget = class HydraniumGlspDiagramWidget extends theia_
|
|
|
94
131
|
// outcome it cannot report, which is the safe reading.
|
|
95
132
|
loader.onceLoadSettled().then(outcome => this.onLoadSettled(outcome), () => this.hideLoadingOverlay());
|
|
96
133
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Take the overlay down, or keep it as the failure's only reporter.
|
|
99
|
-
*
|
|
100
|
-
* The overlay is retained ONLY for a failure the loader could not surface;
|
|
101
|
-
* anything else uncovers the canvas, so a load that failed *and was reported*
|
|
102
|
-
* reveals GLSP's status overlay rather than double-reporting on top of it.
|
|
103
|
-
*/
|
|
134
|
+
/** Take the overlay down, or keep it as the failure's report. */
|
|
104
135
|
onLoadSettled(outcome) {
|
|
105
|
-
if (outcome.status === 'failed'
|
|
136
|
+
if (outcome.status === 'failed') {
|
|
106
137
|
this.showLoadFailure(outcome.error);
|
|
107
138
|
return;
|
|
108
139
|
}
|
|
@@ -129,6 +160,21 @@ let HydraniumGlspDiagramWidget = class HydraniumGlspDiagramWidget extends theia_
|
|
|
129
160
|
if (label) {
|
|
130
161
|
label.textContent = loader.loadFailureLabel(error);
|
|
131
162
|
}
|
|
163
|
+
overlay.appendChild(this.createRetryButton());
|
|
164
|
+
}
|
|
165
|
+
/** Ask for a fresh widget, after a failed load. */
|
|
166
|
+
retryLoad() {
|
|
167
|
+
if (this.hydraniumDiagramLoader?.loadOutcome?.status === 'failed') {
|
|
168
|
+
this.reopenRequestEmitter.fire();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** Build the failure overlay's Retry button, which calls {@link retryLoad}. */
|
|
172
|
+
createRetryButton() {
|
|
173
|
+
const button = document.createElement('button');
|
|
174
|
+
button.className = `theia-button ${exports.DIAGRAM_LOADING_CLASS}-retry`;
|
|
175
|
+
button.textContent = core_1.nls.localize('hydranium/glsp-client-theia/diagram-load-retry', 'Retry');
|
|
176
|
+
button.addEventListener('click', () => this.retryLoad());
|
|
177
|
+
return button;
|
|
132
178
|
}
|
|
133
179
|
hideLoadingOverlay() {
|
|
134
180
|
this.loadingOverlay?.remove();
|
|
@@ -162,10 +208,14 @@ let HydraniumGlspDiagramWidget = class HydraniumGlspDiagramWidget extends theia_
|
|
|
162
208
|
*/
|
|
163
209
|
get hydraniumDiagramLoader() {
|
|
164
210
|
const loader = this.diContainer.get(client_1.DiagramLoader);
|
|
165
|
-
return loader instanceof
|
|
211
|
+
return loader instanceof glsp_client_1.HydraniumDiagramLoader ? loader : undefined;
|
|
166
212
|
}
|
|
167
213
|
};
|
|
168
214
|
exports.HydraniumGlspDiagramWidget = HydraniumGlspDiagramWidget;
|
|
215
|
+
__decorate([
|
|
216
|
+
(0, inversify_1.inject)(window_session_1.WindowSessionService),
|
|
217
|
+
__metadata("design:type", Object)
|
|
218
|
+
], HydraniumGlspDiagramWidget.prototype, "windowSessions", void 0);
|
|
169
219
|
exports.HydraniumGlspDiagramWidget = HydraniumGlspDiagramWidget = __decorate([
|
|
170
220
|
(0, inversify_1.injectable)()
|
|
171
221
|
], HydraniumGlspDiagramWidget);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagram-widget.js","sourceRoot":"","sources":["../../src/browser/diagram-widget.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"diagram-widget.js","sourceRoot":"","sources":["../../src/browser/diagram-widget.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;AAElF,iDAA+H;AAC/H,kDAAuD;AACvD,uEAAmG;AACnG,wDAAyF;AAIzF,sCAAuD;AACvD,4DAAkF;AAClF,mDAAwD;AACxD,qDAAwD;AACxD,yEAAyE;AACzE,gFAAgF;AAChF,yEAAyE;AACzE,2CAAyC;AAEzC,8EAA8E;AACjE,QAAA,qBAAqB,GAAG,2BAA2B,CAAC;AAEjE;kFACkF;AACrE,QAAA,4BAA4B,GAAG,GAAG,QAAA,qBAAqB,SAAS,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,qCAAiB;IACb,cAAc,CAAwB;IAC7E,cAAc,CAAe;IACpB,oBAAoB,GAAG,IAAI,cAAO,EAAQ,CAAC;IAE9D;;;yBAGqB;IACZ,kBAAkB,GAAgB,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;IAE3E;;;;OAIG;IACM,SAAS,CAAC,OAAiC,EAAE,WAAsB;QACzE,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAClD,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c,sBAAsB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAgB,sBAAa,CAAC,CAAC;QAClE,OAAO,MAAM,YAAY,oCAAsB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,CAAC;CACH,CAAA;;AA3KmD;IAAhD,IAAA,kBAAM,EAAC,qCAAoB,CAAC;;kEAA0D;qCAD7E,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CA4KtC"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type ChannelLoggerOptions } from '@hydranium/client-theia/lib/browser';
|
|
10
9
|
import { type BindingContext } from '@eclipse-glsp/client';
|
|
10
|
+
import { type ChannelLoggerOptions } from '@hydranium/client-theia/browser';
|
|
11
11
|
/** Options for `createGlspClientTheiaModule`. The adopter supplies the channel
|
|
12
12
|
* logger configuration ({@link ChannelLoggerOptions} — a `channelName`, and
|
|
13
13
|
* optionally a `component` label); the framework owns the dispatcher type and
|
|
@@ -18,10 +18,17 @@ export interface GlspClientTheiaModuleOptions {
|
|
|
18
18
|
readonly channelLogger: ChannelLoggerOptions;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Composes the standard framework client bindings: the
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* Composes the standard framework client bindings for a Theia frontend: the
|
|
22
|
+
* cross-head Output-channel logger, the host-neutral classes
|
|
23
|
+
* `createGlspClientModule` binds, fed from that channel, the loader that renders
|
|
24
|
+
* its failure through Theia's catalogue, and the message service that drops
|
|
25
|
+
* the duplicate model-loading notification.
|
|
26
|
+
*
|
|
27
|
+
* The neutral tokens are bound BEFORE the neutral binder runs, so it binds no
|
|
28
|
+
* console defaults. The logger binding tags each line with the requesting
|
|
29
|
+
* class, as `bindChannelLogger`'s own does; a plain `toService` alias would
|
|
30
|
+
* start a fresh request and lose the tag. The clock is resolved lazily, so a
|
|
31
|
+
* clock an adopter module binds after this one is still the one used.
|
|
25
32
|
*
|
|
26
33
|
* Takes the whole {@link BindingContext} rather than `(bind, rebind)`: the
|
|
27
34
|
* message-service rebind has to know whether GLSP's `theiaNotificationModule`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-client-theia-module.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-client-theia-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"glsp-client-theia-module.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-client-theia-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAGJ,KAAK,oBAAoB,EAG3B,MAAM,iCAAiC,CAAC;AAOzC;;;;;qEAKqE;AACrE,MAAM,WAAW,4BAA4B;IAC1C,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,4BAA4B,GAAG,IAAI,CAehH"}
|
|
@@ -9,17 +9,25 @@
|
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.createGlspClientTheiaModule = createGlspClientTheiaModule;
|
|
12
|
-
const browser_1 = require("@hydranium/client-theia/lib/browser");
|
|
13
12
|
const client_1 = require("@eclipse-glsp/client");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
13
|
+
const browser_1 = require("@hydranium/client-theia/browser");
|
|
14
|
+
const common_1 = require("@hydranium/client-theia/common");
|
|
15
|
+
const glsp_client_1 = require("@hydranium/glsp-client");
|
|
16
|
+
const protocol_1 = require("@hydranium/protocol");
|
|
16
17
|
const glsp_message_service_1 = require("./glsp-message-service");
|
|
17
|
-
const
|
|
18
|
+
const theia_diagram_loader_1 = require("./theia-diagram-loader");
|
|
18
19
|
/**
|
|
19
|
-
* Composes the standard framework client bindings: the
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Composes the standard framework client bindings for a Theia frontend: the
|
|
21
|
+
* cross-head Output-channel logger, the host-neutral classes
|
|
22
|
+
* `createGlspClientModule` binds, fed from that channel, the loader that renders
|
|
23
|
+
* its failure through Theia's catalogue, and the message service that drops
|
|
24
|
+
* the duplicate model-loading notification.
|
|
25
|
+
*
|
|
26
|
+
* The neutral tokens are bound BEFORE the neutral binder runs, so it binds no
|
|
27
|
+
* console defaults. The logger binding tags each line with the requesting
|
|
28
|
+
* class, as `bindChannelLogger`'s own does; a plain `toService` alias would
|
|
29
|
+
* start a fresh request and lose the tag. The clock is resolved lazily, so a
|
|
30
|
+
* clock an adopter module binds after this one is still the one used.
|
|
23
31
|
*
|
|
24
32
|
* Takes the whole {@link BindingContext} rather than `(bind, rebind)`: the
|
|
25
33
|
* message-service rebind has to know whether GLSP's `theiaNotificationModule`
|
|
@@ -37,10 +45,17 @@ const hidden_bounds_updater_1 = require("./hidden-bounds-updater");
|
|
|
37
45
|
function createGlspClientTheiaModule(context, options) {
|
|
38
46
|
const { bind, isBound, rebind } = context;
|
|
39
47
|
(0, browser_1.bindChannelLogger)(bind, options.channelLogger);
|
|
40
|
-
bind(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
bind(glsp_client_1.HydraniumClientTypes.Logger).toDynamicValue(ctx => {
|
|
49
|
+
const base = ctx.container.get(browser_1.ChannelLogger);
|
|
50
|
+
const parentName = (0, browser_1.getRequestParentName)(ctx);
|
|
51
|
+
return parentName ? base.for(parentName) : base;
|
|
52
|
+
});
|
|
53
|
+
bind(glsp_client_1.HydraniumClientTypes.Tracer).toService(browser_1.ChannelTracer);
|
|
54
|
+
bind(glsp_client_1.HydraniumClientTypes.Clock)
|
|
55
|
+
.toDynamicValue(ctx => (ctx.container.isBound(common_1.Clock) ? ctx.container.get(common_1.Clock) : new protocol_1.SystemClock()))
|
|
56
|
+
.inSingletonScope();
|
|
57
|
+
(0, glsp_client_1.createGlspClientModule)(context);
|
|
58
|
+
rebind(client_1.DiagramLoader).to(theia_diagram_loader_1.HydraniumGlspTheiaDiagramLoader).inSingletonScope();
|
|
44
59
|
(0, glsp_message_service_1.bindHydraniumGlspMessageService)(bind, isBound, rebind);
|
|
45
60
|
}
|
|
46
61
|
//# sourceMappingURL=glsp-client-theia-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-client-theia-module.js","sourceRoot":"","sources":["../../src/browser/glsp-client-theia-module.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"glsp-client-theia-module.js","sourceRoot":"","sources":["../../src/browser/glsp-client-theia-module.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,iDAA0E;AAC1E,6DAMyC;AACzC,2DAAuD;AACvD,wDAAsF;AACtF,kDAAkD;AAClD,iEAAyE;AACzE,iEAAyE;AAYzE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qCAA4C,OAAuB,EAAE,OAAqC;IACvG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC1C,IAAA,2BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/C,IAAI,CAAC,kCAAoB,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QACpD,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,uBAAa,CAAC,CAAC;QAC9C,MAAM,UAAU,GAAG,IAAA,8BAAoB,EAAC,GAAG,CAAC,CAAC;QAC7C,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,kCAAoB,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,uBAAa,CAAC,CAAC;IAC3D,IAAI,CAAC,kCAAoB,CAAC,KAAK,CAAC;SAC5B,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,cAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAQ,cAAK,CAAC,CAAC,CAAC,CAAC,IAAI,sBAAW,EAAE,CAAC,CAAC;SAC3G,gBAAgB,EAAE,CAAC;IACvB,IAAA,oCAAsB,EAAC,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,sBAAa,CAAC,CAAC,EAAE,CAAC,sDAA+B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC7E,IAAA,sDAA+B,EAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
import { type IDiagramOptions } from '@eclipse-glsp/client';
|
|
9
10
|
import { GLSPDiagramManager } from '@eclipse-glsp/theia-integration';
|
|
10
11
|
import { type GLSPDiagramLanguage } from '@eclipse-glsp/theia-integration/lib/common';
|
|
11
|
-
import { type GLSPDiagramWidget } from '@eclipse-glsp/theia-integration/lib/browser';
|
|
12
|
+
import { type GLSPDiagramWidget, type GLSPDiagramWidgetOptions } from '@eclipse-glsp/theia-integration/lib/browser';
|
|
12
13
|
import { type WidgetOpenerOptions } from '@theia/core/lib/browser';
|
|
14
|
+
import { type Disposable } from '@theia/core';
|
|
15
|
+
import { WindowSessionService } from './window-session';
|
|
13
16
|
/**
|
|
14
17
|
* `GLSPDiagramManager` subclass that derives the language-correlated getters
|
|
15
18
|
* (`fileExtensions`, `diagramType`, `contributionId`, `iconClass`) from a
|
|
@@ -39,11 +42,47 @@ export declare abstract class AbstractHydraniumGlspDiagramManager extends GLSPDi
|
|
|
39
42
|
protected abstract readonly managerLabel: string;
|
|
40
43
|
/** Optional icon-class override; takes precedence over the language's `iconClass`. */
|
|
41
44
|
protected readonly customIconClass?: string;
|
|
45
|
+
protected readonly windowSessions: WindowSessionService;
|
|
46
|
+
protected clientListeners?: Disposable;
|
|
47
|
+
/** The reopens asked for so far, which run one at a time. */
|
|
48
|
+
protected reopening: Promise<void>;
|
|
42
49
|
get fileExtensions(): string[];
|
|
43
50
|
get diagramType(): string;
|
|
44
51
|
get contributionId(): string;
|
|
45
52
|
get iconClass(): string;
|
|
46
53
|
get label(): string;
|
|
54
|
+
createWidget(options?: unknown): Promise<GLSPDiagramWidget>;
|
|
55
|
+
/**
|
|
56
|
+
* The same client id for the same diagram in this window, across a reload
|
|
57
|
+
* and a reopen after a lost client, so its load takes over the session the
|
|
58
|
+
* old connection left and keeps its unsaved text. A diagram closed by the
|
|
59
|
+
* user ends its session, and opening it again starts afresh.
|
|
60
|
+
*
|
|
61
|
+
* The widget options enter as a hash: GLSP makes the id an element id and
|
|
62
|
+
* finds it with an `#id` selector, which a URI's `:` and `/` break. The
|
|
63
|
+
* options identify the widget, so two widgets of one document, in two edit
|
|
64
|
+
* modes or set apart by an option an adopter adds, do not take each other's
|
|
65
|
+
* session over.
|
|
66
|
+
*/
|
|
67
|
+
protected createDiagramOptions(options: GLSPDiagramWidgetOptions): IDiagramOptions;
|
|
68
|
+
/**
|
|
69
|
+
* Reopen every diagram once its client is lost, since none of them has a
|
|
70
|
+
* server behind it any more, and a failed one once a client starts.
|
|
71
|
+
*/
|
|
72
|
+
protected listenToClient(): void;
|
|
73
|
+
protected reopenAll(which: (widget: GLSPDiagramWidget) => boolean): void;
|
|
74
|
+
protected loadFailed(widget: GLSPDiagramWidget): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Replace `widget` with a fresh one for the same diagram, in the same tab
|
|
77
|
+
* position and with its viewport: a new container and load under the same
|
|
78
|
+
* client id, which takes over the session the old connection left.
|
|
79
|
+
* Reopens run one at a time, since each places its replacement next to a
|
|
80
|
+
* neighbour that a reopen running alongside could take out of the layout.
|
|
81
|
+
*/
|
|
82
|
+
reopen(widget: GLSPDiagramWidget): Promise<void>;
|
|
83
|
+
/** Taken down as a close does, but without its save prompt, since a dirty
|
|
84
|
+
* diagram whose server is gone has nothing to save to. */
|
|
85
|
+
protected replaceWidget(widget: GLSPDiagramWidget): Promise<void>;
|
|
47
86
|
/**
|
|
48
87
|
* Drops a `selection` key that is present but `undefined` before the base
|
|
49
88
|
* class reads it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-diagram-manager.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-diagram-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"glsp-diagram-manager.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-diagram-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAmC,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EACJ,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAE/B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,aAAa,CAAC;AAMpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,8BACsB,mCAAoC,SAAQ,kBAAkB;IACjF,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H,UAAmB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAMtG;CACH"}
|
|
@@ -13,11 +13,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
13
13
|
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;
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
20
|
exports.AbstractHydraniumGlspDiagramManager = void 0;
|
|
18
21
|
const client_1 = require("@eclipse-glsp/client");
|
|
19
22
|
const theia_integration_1 = require("@eclipse-glsp/theia-integration");
|
|
23
|
+
const core_1 = require("@theia/core");
|
|
20
24
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
25
|
+
const protocol_1 = require("@hydranium/protocol");
|
|
26
|
+
const glsp_client_1 = require("@hydranium/glsp-client");
|
|
27
|
+
const client_contribution_1 = require("./client-contribution");
|
|
28
|
+
const diagram_widget_1 = require("./diagram-widget");
|
|
29
|
+
const window_session_1 = require("./window-session");
|
|
21
30
|
/**
|
|
22
31
|
* `GLSPDiagramManager` subclass that derives the language-correlated getters
|
|
23
32
|
* (`fileExtensions`, `diagramType`, `contributionId`, `iconClass`) from a
|
|
@@ -43,6 +52,10 @@ const inversify_1 = require("@theia/core/shared/inversify");
|
|
|
43
52
|
let AbstractHydraniumGlspDiagramManager = class AbstractHydraniumGlspDiagramManager extends theia_integration_1.GLSPDiagramManager {
|
|
44
53
|
/** Optional icon-class override; takes precedence over the language's `iconClass`. */
|
|
45
54
|
customIconClass;
|
|
55
|
+
windowSessions;
|
|
56
|
+
clientListeners;
|
|
57
|
+
/** The reopens asked for so far, which run one at a time. */
|
|
58
|
+
reopening = Promise.resolve();
|
|
46
59
|
get fileExtensions() {
|
|
47
60
|
return [...this.diagramLanguage.fileExtensions];
|
|
48
61
|
}
|
|
@@ -58,6 +71,89 @@ let AbstractHydraniumGlspDiagramManager = class AbstractHydraniumGlspDiagramMana
|
|
|
58
71
|
get label() {
|
|
59
72
|
return this.managerLabel;
|
|
60
73
|
}
|
|
74
|
+
async createWidget(options) {
|
|
75
|
+
this.listenToClient();
|
|
76
|
+
const widget = await super.createWidget(options);
|
|
77
|
+
if (widget instanceof diagram_widget_1.HydraniumGlspDiagramWidget) {
|
|
78
|
+
widget.onDidRequestReopen(() => void this.reopen(widget));
|
|
79
|
+
}
|
|
80
|
+
return widget;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The same client id for the same diagram in this window, across a reload
|
|
84
|
+
* and a reopen after a lost client, so its load takes over the session the
|
|
85
|
+
* old connection left and keeps its unsaved text. A diagram closed by the
|
|
86
|
+
* user ends its session, and opening it again starts afresh.
|
|
87
|
+
*
|
|
88
|
+
* The widget options enter as a hash: GLSP makes the id an element id and
|
|
89
|
+
* finds it with an `#id` selector, which a URI's `:` and `/` break. The
|
|
90
|
+
* options identify the widget, so two widgets of one document, in two edit
|
|
91
|
+
* modes or set apart by an option an adopter adds, do not take each other's
|
|
92
|
+
* session over.
|
|
93
|
+
*/
|
|
94
|
+
createDiagramOptions(options) {
|
|
95
|
+
const clientId = `${this.diagramType}_${this.windowSessions.current().id}_${(0, protocol_1.textHash)(JSON.stringify(options))}`;
|
|
96
|
+
return { ...super.createDiagramOptions(options), clientId };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Reopen every diagram once its client is lost, since none of them has a
|
|
100
|
+
* server behind it any more, and a failed one once a client starts.
|
|
101
|
+
*/
|
|
102
|
+
listenToClient() {
|
|
103
|
+
if (this.clientListeners) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const contribution = this.diagramServiceProvider.getGLSPClientContribution(this.contributionId);
|
|
107
|
+
this.clientListeners =
|
|
108
|
+
contribution instanceof client_contribution_1.HydraniumGlspClientContribution
|
|
109
|
+
? new core_1.DisposableCollection(contribution.onDidLoseClient(() => this.reopenAll(() => true)), contribution.onDidStartClient(() => this.reopenAll(widget => this.loadFailed(widget))))
|
|
110
|
+
: new core_1.DisposableCollection();
|
|
111
|
+
}
|
|
112
|
+
reopenAll(which) {
|
|
113
|
+
for (const widget of this.all.filter(which)) {
|
|
114
|
+
void this.reopen(widget);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
loadFailed(widget) {
|
|
118
|
+
const loader = widget.diContainer.get(client_1.DiagramLoader);
|
|
119
|
+
return loader instanceof glsp_client_1.HydraniumDiagramLoader && loader.loadOutcome?.status === 'failed';
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Replace `widget` with a fresh one for the same diagram, in the same tab
|
|
123
|
+
* position and with its viewport: a new container and load under the same
|
|
124
|
+
* client id, which takes over the session the old connection left.
|
|
125
|
+
* Reopens run one at a time, since each places its replacement next to a
|
|
126
|
+
* neighbour that a reopen running alongside could take out of the layout.
|
|
127
|
+
*/
|
|
128
|
+
reopen(widget) {
|
|
129
|
+
const reopened = this.reopening.then(() => this.replaceWidget(widget));
|
|
130
|
+
this.reopening = reopened.catch(() => undefined);
|
|
131
|
+
return reopened;
|
|
132
|
+
}
|
|
133
|
+
/** Taken down as a close does, but without its save prompt, since a dirty
|
|
134
|
+
* diagram whose server is gone has nothing to save to. */
|
|
135
|
+
async replaceWidget(widget) {
|
|
136
|
+
if (widget.isDisposed) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const tabBar = this.shell.getTabBarFor(widget);
|
|
140
|
+
const titles = tabBar?.titles ?? [];
|
|
141
|
+
const index = titles.indexOf(widget.title);
|
|
142
|
+
// ponytail: a diagram alone in its tab bar reopens where a new one opens,
|
|
143
|
+
// since its split closes with it; restore the dock layout if that matters.
|
|
144
|
+
const neighbour = index > 0 ? titles[index - 1].owner : titles[index + 1]?.owner;
|
|
145
|
+
const mode = this.shell.activeWidget === widget ? 'activate' : tabBar?.currentTitle === widget.title ? 'reveal' : 'open';
|
|
146
|
+
// Detached before the dispose, as a close does: the widget stores its
|
|
147
|
+
// viewport on detach, and its dispose empties the container it reads.
|
|
148
|
+
widget.parent = null;
|
|
149
|
+
widget.dispose();
|
|
150
|
+
const options = {
|
|
151
|
+
mode,
|
|
152
|
+
editMode: widget.options.editMode,
|
|
153
|
+
widgetOptions: neighbour ? { ref: neighbour, mode: index > 0 ? 'tab-after' : 'tab-before' } : undefined
|
|
154
|
+
};
|
|
155
|
+
await this.open(widget.uri, options);
|
|
156
|
+
}
|
|
61
157
|
/**
|
|
62
158
|
* Drops a `selection` key that is present but `undefined` before the base
|
|
63
159
|
* class reads it.
|
|
@@ -86,6 +182,10 @@ let AbstractHydraniumGlspDiagramManager = class AbstractHydraniumGlspDiagramMana
|
|
|
86
182
|
}
|
|
87
183
|
};
|
|
88
184
|
exports.AbstractHydraniumGlspDiagramManager = AbstractHydraniumGlspDiagramManager;
|
|
185
|
+
__decorate([
|
|
186
|
+
(0, inversify_1.inject)(window_session_1.WindowSessionService),
|
|
187
|
+
__metadata("design:type", Object)
|
|
188
|
+
], AbstractHydraniumGlspDiagramManager.prototype, "windowSessions", void 0);
|
|
89
189
|
exports.AbstractHydraniumGlspDiagramManager = AbstractHydraniumGlspDiagramManager = __decorate([
|
|
90
190
|
(0, inversify_1.injectable)()
|
|
91
191
|
], AbstractHydraniumGlspDiagramManager);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-diagram-manager.js","sourceRoot":"","sources":["../../src/browser/glsp-diagram-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"glsp-diagram-manager.js","sourceRoot":"","sources":["../../src/browser/glsp-diagram-manager.ts"],"names":[],"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AAc,MAAM,8BAA8B,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4BAA4B,8BAA8B,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,qBACa,2BAA4B,SAAQ,uBAAuB;IACrE;;mBAEe;IACf,SAAS,CAAC,qBAAqB,cAAqB;
|
|
1
|
+
{"version":3,"file":"glsp-message-service.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-message-service.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,8BAA8B,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4BAA4B,8BAA8B,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,qBACa,2BAA4B,SAAQ,uBAAuB;IACrE;;mBAEe;IACf,SAAS,CAAC,qBAAqB,cAAqB;IAEpD,UAAmB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAMlE;IAED,UAAmB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAKpE;IAED,UAAmB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAO9D;CACH;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,IAAI,CAMnI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-message-service.js","sourceRoot":"","sources":["../../src/browser/glsp-message-service.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+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M,CAAC,2CAAuB,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACtF,CAAC;SAAM,CAAC;QACL,IAAI,CAAC,2CAAuB,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { GLSPSaveable } from '@eclipse-glsp/theia-integration/lib/browser/diagram/glsp-saveable';
|
|
10
|
+
/**
|
|
11
|
+
* A `GLSPSaveable` whose every save is a request the server answers, and which
|
|
12
|
+
* stays dirty until that answer arrives.
|
|
13
|
+
*
|
|
14
|
+
* GLSP's sends a `SaveModelAction`, which the server does not answer. It takes
|
|
15
|
+
* the next dirty-state change to clean as the answer, but the editor context
|
|
16
|
+
* reports a change only when the dirty flag changes: the second of two saves
|
|
17
|
+
* gets no answer, and a failed save gets none either. Here each save sends a
|
|
18
|
+
* `RequestSaveModelAction` and settles on the response to that request only:
|
|
19
|
+
* it resolves when the server has saved, rejects when the server rejects it,
|
|
20
|
+
* and rejects when {@link saveTimeout} runs out. A save sent while another is
|
|
21
|
+
* pending is a request of its own, so an edit made between the two is saved.
|
|
22
|
+
*
|
|
23
|
+
* GLSP's also reports not dirty from the moment it sends a save. Theia's exit
|
|
24
|
+
* check asks only whether anything is dirty, so the window closes over a save
|
|
25
|
+
* the server has not finished, and a page reloaded right after Ctrl+S gives no
|
|
26
|
+
* warning. Here the saveable is dirty while any save is pending. GLSP's also
|
|
27
|
+
* gives up after 2 s, and Theia's Save All then counts the save as failed and
|
|
28
|
+
* closes the window anyway, so a slow save of a large model is cut off.
|
|
29
|
+
*
|
|
30
|
+
* The dirty flag still comes from the server. An edit whose dirty-state change
|
|
31
|
+
* has not arrived when Save All runs does not make the saveable dirty, so that
|
|
32
|
+
* edit is not saved.
|
|
33
|
+
*
|
|
34
|
+
* The server answers only where the diagram module registers the request's
|
|
35
|
+
* handler; `AbstractHydraniumGlspDiagramModule` does. A server without it does
|
|
36
|
+
* not advertise the request, and against such a server the saveable is GLSP's:
|
|
37
|
+
* it sends a `SaveModelAction` and reports dirty as GLSP's does. It does not
|
|
38
|
+
* keep only the dirty-while-pending half there, because GLSP's tracks one
|
|
39
|
+
* pending save and a second save overwrites it, so the first would never
|
|
40
|
+
* report clean.
|
|
41
|
+
*
|
|
42
|
+
* The answer means the server has done what its save does, which is not always
|
|
43
|
+
* the disk write: under the `fire-and-forget` `SaveDeliveryPolicy` the server
|
|
44
|
+
* answers before the write finishes and answers a failed write as saved, so a
|
|
45
|
+
* window closed on that answer can still lose the write.
|
|
46
|
+
*/
|
|
47
|
+
export declare class HydraniumGlspSaveable extends GLSPSaveable {
|
|
48
|
+
/**
|
|
49
|
+
* How long a save waits for the server's response before it rejects. The
|
|
50
|
+
* server answers up to its language-client settle bound after the write, so
|
|
51
|
+
* this exceeds that bound with room for the write itself; a save that
|
|
52
|
+
* rejects in Theia's Save All lets the window close over it.
|
|
53
|
+
*/
|
|
54
|
+
protected saveTimeout: number;
|
|
55
|
+
/** The saves sent and not yet settled. */
|
|
56
|
+
protected readonly pendingSaves: Set<Promise<void>>;
|
|
57
|
+
get dirty(): boolean;
|
|
58
|
+
save(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the server answers a {@link RequestSaveModelAction}. GLSP's model
|
|
61
|
+
* source registers a handler for each kind the server advertises before it
|
|
62
|
+
* requests the model, so the dispatcher knows it from the first save on.
|
|
63
|
+
*/
|
|
64
|
+
protected serverAnswersSaves(): boolean;
|
|
65
|
+
protected sendSave(): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=glsp-saveable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-saveable.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-saveable.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,OAAO,EAAE,YAAY,EAAE,MAAM,mEAAmE,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACpD;;;;;OAKG;IACH,UAAmB,WAAW,SAAU;IACxC,0CAA0C;IAC1C,SAAS,CAAC,QAAQ,CAAC,YAAY,qBAA4B;IAE3D,IAAa,KAAK,IAAI,OAAO,CAK5B;IAEQ,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAS7B;IAED;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,IAAI,OAAO,CAEtC;IAED,SAAS,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAmBlC;CACH"}
|