@eclipse-glsp/server 2.6.0 → 2.7.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/di/app-module.d.ts +1 -1
- package/lib/browser/di/app-module.d.ts.map +1 -1
- package/lib/browser/di/app-module.js +5 -1
- package/lib/browser/di/app-module.js.map +1 -1
- package/lib/browser/di/browser-action-dispatch-scope.d.ts +39 -0
- package/lib/browser/di/browser-action-dispatch-scope.d.ts.map +1 -0
- package/lib/browser/di/browser-action-dispatch-scope.js +77 -0
- package/lib/browser/di/browser-action-dispatch-scope.js.map +1 -0
- package/lib/browser/index.d.ts +2 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +2 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/common/actions/action-dispatcher.d.ts +107 -5
- package/lib/common/actions/action-dispatcher.d.ts.map +1 -1
- package/lib/common/actions/action-dispatcher.js +205 -26
- package/lib/common/actions/action-dispatcher.js.map +1 -1
- package/lib/common/actions/client-action-handler.d.ts +1 -1
- package/lib/common/actions/client-action-handler.js +2 -2
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/actions/global-action-provider.d.ts.map +1 -1
- package/lib/common/actions/global-action-provider.js +2 -3
- package/lib/common/actions/global-action-provider.js.map +1 -1
- package/lib/common/di/client-session-module.d.ts +8 -1
- package/lib/common/di/client-session-module.d.ts.map +1 -1
- package/lib/common/di/client-session-module.js +9 -1
- package/lib/common/di/client-session-module.js.map +1 -1
- package/lib/common/di/server-module.d.ts +3 -2
- package/lib/common/di/server-module.d.ts.map +1 -1
- package/lib/common/di/server-module.js +5 -1
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/di/service-identifiers.d.ts +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.d.ts +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +1 -2
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.d.ts +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +1 -1
- package/lib/common/features/model/model-submission-handler.js +1 -1
- package/lib/common/features/model/request-model-action-handler.d.ts +1 -1
- package/lib/common/features/model/request-model-action-handler.js +1 -1
- package/lib/common/features/progress/progress-service.js +1 -1
- package/lib/common/index.d.ts +3 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +3 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.d.ts +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.js +4 -1
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -1
- package/lib/common/operations/create-operation-handler.d.ts +8 -2
- package/lib/common/operations/create-operation-handler.d.ts.map +1 -1
- package/lib/common/operations/create-operation-handler.js +16 -2
- package/lib/common/operations/create-operation-handler.js.map +1 -1
- package/lib/common/protocol/glsp-server.d.ts +10 -3
- package/lib/common/protocol/glsp-server.d.ts.map +1 -1
- package/lib/common/protocol/glsp-server.js +58 -6
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-manager.d.ts +8 -1
- package/lib/common/session/client-session-manager.d.ts.map +1 -1
- package/lib/common/session/client-session-manager.js +4 -1
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/common/utils/action-queue.d.ts +58 -0
- package/lib/common/utils/action-queue.d.ts.map +1 -0
- package/lib/common/utils/action-queue.js +99 -0
- package/lib/common/utils/action-queue.js.map +1 -0
- package/lib/common/utils/promise-queue.d.ts +5 -1
- package/lib/common/utils/promise-queue.d.ts.map +1 -1
- package/lib/common/utils/promise-queue.js +5 -1
- package/lib/common/utils/promise-queue.js.map +1 -1
- package/lib/node/di/app-module.d.ts +1 -1
- package/lib/node/di/app-module.d.ts.map +1 -1
- package/lib/node/di/app-module.js +2 -0
- package/lib/node/di/app-module.js.map +1 -1
- package/lib/node/di/node-action-dispatch-scope.d.ts +26 -0
- package/lib/node/di/node-action-dispatch-scope.d.ts.map +1 -0
- package/lib/node/di/node-action-dispatch-scope.js +45 -0
- package/lib/node/di/node-action-dispatch-scope.js.map +1 -0
- package/lib/node/index.d.ts +2 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +2 -1
- package/lib/node/index.js.map +1 -1
- package/package.json +5 -5
- package/src/browser/di/app-module.ts +6 -2
- package/src/browser/di/browser-action-dispatch-scope.spec.ts +75 -0
- package/src/browser/di/browser-action-dispatch-scope.ts +67 -0
- package/src/browser/index.ts +2 -1
- package/src/common/actions/action-dispatcher.ts +298 -25
- package/src/common/actions/client-action-handler.ts +2 -2
- package/src/common/actions/global-action-provider.ts +3 -4
- package/src/common/command/recording-command.spec.ts +1 -2
- package/src/common/di/client-session-module.ts +9 -1
- package/src/common/di/server-module.ts +9 -2
- package/src/common/di/service-identifiers.ts +1 -1
- package/src/common/features/clipboard/request-clipboard-data-action-handler.ts +2 -2
- package/src/common/features/contextactions/context-actions-provider-registry.spec.ts +2 -2
- package/src/common/features/layout/computed-bounds-action-handler.ts +1 -1
- package/src/common/features/model/model-submission-handler.ts +1 -1
- package/src/common/features/model/request-model-action-handler.ts +1 -1
- package/src/common/features/progress/progress-service.ts +1 -1
- package/src/common/index.ts +3 -1
- package/src/common/launch/jsonrpc-server-launcher.ts +4 -1
- package/src/common/operations/create-operation-handler.ts +16 -3
- package/src/common/protocol/glsp-server.ts +64 -3
- package/src/common/session/client-session-manager.ts +12 -1
- package/src/common/test/mock-util.ts +21 -3
- package/src/common/utils/action-queue.spec.ts +133 -0
- package/src/common/utils/action-queue.ts +107 -0
- package/src/common/utils/promise-queue.spec.ts +6 -2
- package/src/common/utils/promise-queue.ts +5 -1
- package/src/node/actions/action-dispatcher.spec.ts +678 -0
- package/src/node/di/app-module.ts +4 -2
- package/src/node/di/node-action-dispatch-scope.ts +35 -0
- package/src/node/index.ts +2 -1
- package/src/common/actions/action-dispatcher.spec.ts +0 -291
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ActionQueue = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* Producer/consumer queue with a single async consumer loop. Items are processed in FIFO order.
|
|
21
|
+
*/
|
|
22
|
+
class ActionQueue {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.queue = [];
|
|
25
|
+
this.stopped = false;
|
|
26
|
+
this.consuming = false;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Enqueues an item. The returned promise settles when the consumer finishes processing it,
|
|
30
|
+
* propagating results back to the producer. Rejects immediately if the queue has been stopped.
|
|
31
|
+
*/
|
|
32
|
+
push(item) {
|
|
33
|
+
if (this.stopped) {
|
|
34
|
+
return Promise.reject(new Error('ActionQueue is stopped'));
|
|
35
|
+
}
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
var _a;
|
|
38
|
+
this.queue.push({ item, resolve, reject });
|
|
39
|
+
(_a = this.notify) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Yields pending entries, suspending until the next {@link push} when the queue is empty. Exits
|
|
44
|
+
* once the queue is stopped and has been drained.
|
|
45
|
+
*
|
|
46
|
+
* Single-consumer: calling `consume()` a second time throws an error.
|
|
47
|
+
*/
|
|
48
|
+
async *consume() {
|
|
49
|
+
if (this.consuming) {
|
|
50
|
+
throw new Error('ActionQueue supports only a single consumer');
|
|
51
|
+
}
|
|
52
|
+
this.consuming = true;
|
|
53
|
+
try {
|
|
54
|
+
while (!this.stopped || this.queue.length > 0) {
|
|
55
|
+
while (this.queue.length > 0) {
|
|
56
|
+
yield this.queue.shift();
|
|
57
|
+
}
|
|
58
|
+
if (this.stopped) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
await new Promise(resolve => {
|
|
62
|
+
this.notify = resolve;
|
|
63
|
+
});
|
|
64
|
+
this.notify = undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
this.consuming = false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Stops the queue. Further {@link push} calls reject. The consumer loop exits after
|
|
73
|
+
* the remaining queued entries have been yielded (or immediately if the queue is empty).
|
|
74
|
+
*/
|
|
75
|
+
stop() {
|
|
76
|
+
var _a;
|
|
77
|
+
this.stopped = true;
|
|
78
|
+
(_a = this.notify) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Rejects all queued entries with the given reason so producers awaiting their
|
|
82
|
+
* `push()` promises do not hang. Does not stop the queue.
|
|
83
|
+
*/
|
|
84
|
+
rejectPending(reason = new Error('ActionQueue cleared')) {
|
|
85
|
+
const pending = this.queue;
|
|
86
|
+
this.queue = [];
|
|
87
|
+
for (const entry of pending) {
|
|
88
|
+
entry.reject(reason);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
get size() {
|
|
92
|
+
return this.queue.length;
|
|
93
|
+
}
|
|
94
|
+
get isStopped() {
|
|
95
|
+
return this.stopped;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.ActionQueue = ActionQueue;
|
|
99
|
+
//# sourceMappingURL=action-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-queue.js","sourceRoot":"","sources":["../../../src/common/utils/action-queue.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAYlF;;GAEG;AACH,MAAa,WAAW;IAAxB;QACc,UAAK,GAA0B,EAAE,CAAC;QAElC,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;IAyEhC,CAAC;IAvEG;;;OAGG;IACH,IAAI,CAAC,IAAO;QACR,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;;YACnC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3C,MAAA,IAAI,CAAC,MAAM,oDAAI,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,CAAC,OAAO;QACV,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC3B,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAG,CAAC;gBAC9B,CAAC;gBACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,OAAO;gBACX,CAAC;gBACD,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;oBAC9B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;gBAC1B,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YAC5B,CAAC;QACL,CAAC;gBAAS,CAAC;YACP,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QAC3B,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAI;;QACA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,MAAA,IAAI,CAAC,MAAM,oDAAI,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,SAAgB,IAAI,KAAK,CAAC,qBAAqB,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC1B,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ;AA7ED,kCA6EC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-
|
|
2
|
+
* Copyright (c) 2022-2026 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -27,6 +27,10 @@ export interface PromiseQueueElement<T = void> {
|
|
|
27
27
|
* of promises. Promises that are put in this queue are processed one by one.
|
|
28
28
|
* i.e. After the first promise in the queue is resolved, it will be removed from the queue and the resolving of the
|
|
29
29
|
* the next promise (if present) will start. The queue can only resolve one promise at a given time.
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Since 2.7. The `DefaultActionDispatcher` no longer uses this queue. Kept for
|
|
32
|
+
* backwards compatibility; will be removed in a future release. New code should use
|
|
33
|
+
* {@link ActionQueue} or native async patterns instead.
|
|
30
34
|
*/
|
|
31
35
|
export declare class PromiseQueue<T = void> {
|
|
32
36
|
protected queue: PromiseQueueElement<T>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise-queue.d.ts","sourceRoot":"","sources":["../../../src/common/utils/promise-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,IAAI;IACzC,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC;AAED
|
|
1
|
+
{"version":3,"file":"promise-queue.d.ts","sourceRoot":"","sources":["../../../src/common/utils/promise-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,IAAI;IACzC,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY,CAAC,CAAC,GAAG,IAAI;IAC9B,SAAS,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAM;IAC/C,SAAS,CAAC,IAAI,UAAS;IAEvB;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAY9C,SAAS,CAAC,OAAO,IAAI,OAAO;cAoBZ,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAYpF,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,KAAK,IAAI,IAAI;CAGhB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/********************************************************************************
|
|
3
|
-
* Copyright (c) 2022-
|
|
3
|
+
* Copyright (c) 2022-2026 STMicroelectronics and others.
|
|
4
4
|
*
|
|
5
5
|
* This program and the accompanying materials are made available under the
|
|
6
6
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -21,6 +21,10 @@ exports.PromiseQueue = void 0;
|
|
|
21
21
|
* of promises. Promises that are put in this queue are processed one by one.
|
|
22
22
|
* i.e. After the first promise in the queue is resolved, it will be removed from the queue and the resolving of the
|
|
23
23
|
* the next promise (if present) will start. The queue can only resolve one promise at a given time.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated Since 2.7. The `DefaultActionDispatcher` no longer uses this queue. Kept for
|
|
26
|
+
* backwards compatibility; will be removed in a future release. New code should use
|
|
27
|
+
* {@link ActionQueue} or native async patterns instead.
|
|
24
28
|
*/
|
|
25
29
|
class PromiseQueue {
|
|
26
30
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise-queue.js","sourceRoot":"","sources":["../../../src/common/utils/promise-queue.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAYlF
|
|
1
|
+
{"version":3,"file":"promise-queue.js","sourceRoot":"","sources":["../../../src/common/utils/promise-queue.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAYlF;;;;;;;;;GASG;AACH,MAAa,YAAY;IAAzB;QACc,UAAK,GAA6B,EAAE,CAAC;QACrC,SAAI,GAAG,KAAK,CAAC;IAmE3B,CAAC;IAjEG;;;;;OAKG;IACH,OAAO,CAAC,OAAyB;QAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,MAAM,OAAO,GAAG;gBACZ,OAAO;gBACP,OAAO;gBACP,MAAM;aACT,CAAC;YACF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IAES,OAAO;QACb,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;YAClB,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,KAAK,CAAC,oBAAoB,CAAC,OAA+B;QAChE,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YACtC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;gBAAS,CAAC;YACP,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;YAClB,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACpB,CAAC;CACJ;AArED,oCAqEC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-
|
|
2
|
+
* Copyright (c) 2022-2026 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-module.d.ts","sourceRoot":"","sources":["../../../src/node/di/app-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"app-module.d.ts","sourceRoot":"","sources":["../../../src/node/di/app-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAOvE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,aAAa,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAyBzF;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,aAAa,EAC1D,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,CAAC,EACV,MAAM,UAAO,EACb,iBAAiB,GAAE,CAAC,aAAa,EAAE,CAAC,KAAK,OAAO,CAAC,MAA8B,GAChF,IAAI,CAwBN"}
|
|
@@ -6,10 +6,12 @@ exports.configureWinstonLogger = configureWinstonLogger;
|
|
|
6
6
|
const inversify_1 = require("inversify");
|
|
7
7
|
const winston = require("winston");
|
|
8
8
|
const common_1 = require("../../common");
|
|
9
|
+
const node_action_dispatch_scope_1 = require("./node-action-dispatch-scope");
|
|
9
10
|
const winston_logger_1 = require("./winston-logger");
|
|
10
11
|
function createAppModule(options) {
|
|
11
12
|
return new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
|
|
12
13
|
bind(common_1.InjectionContainer).toDynamicValue(dynamicContext => dynamicContext.container);
|
|
14
|
+
bind(common_1.ActionDispatchScope).to(node_action_dispatch_scope_1.NodeActionDispatchScope).inSingletonScope();
|
|
13
15
|
const context = { bind, unbind, isBound, rebind };
|
|
14
16
|
configureWinstonLogger(context, options);
|
|
15
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-module.js","sourceRoot":"","sources":["../../../src/node/di/app-module.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"app-module.js","sourceRoot":"","sources":["../../../src/node/di/app-module.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
17
|
+
import { ActionDispatchScope } from '../../common/actions/action-dispatcher';
|
|
18
|
+
/**
|
|
19
|
+
* Node.js {@link ActionDispatchScope} backed by native `AsyncLocalStorage`.
|
|
20
|
+
*/
|
|
21
|
+
export declare class NodeActionDispatchScope implements ActionDispatchScope {
|
|
22
|
+
protected storage: AsyncLocalStorage<boolean>;
|
|
23
|
+
enter<R>(callback: () => R): R;
|
|
24
|
+
isReentrant(): boolean;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=node-action-dispatch-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-action-dispatch-scope.d.ts","sourceRoot":"","sources":["../../../src/node/di/node-action-dispatch-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E;;GAEG;AACH,qBACa,uBAAwB,YAAW,mBAAmB;IAC/D,SAAS,CAAC,OAAO,6BAAoC;IAErD,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAI9B,WAAW,IAAI,OAAO;CAGzB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
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;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.NodeActionDispatchScope = void 0;
|
|
25
|
+
const async_hooks_1 = require("async_hooks");
|
|
26
|
+
const inversify_1 = require("inversify");
|
|
27
|
+
/**
|
|
28
|
+
* Node.js {@link ActionDispatchScope} backed by native `AsyncLocalStorage`.
|
|
29
|
+
*/
|
|
30
|
+
let NodeActionDispatchScope = class NodeActionDispatchScope {
|
|
31
|
+
constructor() {
|
|
32
|
+
this.storage = new async_hooks_1.AsyncLocalStorage();
|
|
33
|
+
}
|
|
34
|
+
enter(callback) {
|
|
35
|
+
return this.storage.run(true, callback);
|
|
36
|
+
}
|
|
37
|
+
isReentrant() {
|
|
38
|
+
return this.storage.getStore() === true;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.NodeActionDispatchScope = NodeActionDispatchScope;
|
|
42
|
+
exports.NodeActionDispatchScope = NodeActionDispatchScope = __decorate([
|
|
43
|
+
(0, inversify_1.injectable)()
|
|
44
|
+
], NodeActionDispatchScope);
|
|
45
|
+
//# sourceMappingURL=node-action-dispatch-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-action-dispatch-scope.js","sourceRoot":"","sources":["../../../src/node/di/node-action-dispatch-scope.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,6CAAgD;AAChD,yCAAuC;AAGvC;;GAEG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QACO,YAAO,GAAG,IAAI,+BAAiB,EAAW,CAAC;IASzD,CAAC;IAPG,KAAK,CAAI,QAAiB;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED,WAAW;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC;IAC5C,CAAC;CACJ,CAAA;AAVY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAUnC"}
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-
|
|
2
|
+
* Copyright (c) 2022-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
export * from './abstract-json-model-storage';
|
|
17
17
|
export * from './di/app-module';
|
|
18
|
+
export * from './di/node-action-dispatch-scope';
|
|
18
19
|
export * from './di/winston-logger';
|
|
19
20
|
export * from './gmodel/gmodel-storage';
|
|
20
21
|
export * from './launch/cli-parser';
|
package/lib/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,YAAY,CAAC"}
|
package/lib/node/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/********************************************************************************
|
|
18
|
-
* Copyright (c) 2022-
|
|
18
|
+
* Copyright (c) 2022-2026 EclipseSource and others.
|
|
19
19
|
*
|
|
20
20
|
* This program and the accompanying materials are made available under the
|
|
21
21
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -31,6 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
********************************************************************************/
|
|
32
32
|
__exportStar(require("./abstract-json-model-storage"), exports);
|
|
33
33
|
__exportStar(require("./di/app-module"), exports);
|
|
34
|
+
__exportStar(require("./di/node-action-dispatch-scope"), exports);
|
|
34
35
|
__exportStar(require("./di/winston-logger"), exports);
|
|
35
36
|
__exportStar(require("./gmodel/gmodel-storage"), exports);
|
|
36
37
|
__exportStar(require("./launch/cli-parser"), exports);
|
package/lib/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,gEAA8C;AAC9C,kDAAgC;AAChC,sDAAoC;AACpC,0DAAwC;AACxC,sDAAoC;AACpC,6DAA2C;AAC3C,kEAAgD;AAChD,qEAAmD;AACnD,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,gEAA8C;AAC9C,kDAAgC;AAChC,kEAAgD;AAChD,sDAAoC;AACpC,0DAAwC;AACxC,sDAAoC;AACpC,6DAA2C;AAC3C,kEAAgD;AAChD,qEAAmD;AACnD,6CAA2B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0-next.10+bed0bb0",
|
|
4
4
|
"description": "A js server framework for Eclipse GLSP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
"build": "tsc -b",
|
|
52
52
|
"clean": "rimraf lib *.tsbuildinfo coverage .nyc_output",
|
|
53
53
|
"generate:index": "glsp generateIndex src/browser src/common src/node -s -f",
|
|
54
|
-
"lint": "eslint
|
|
54
|
+
"lint": "eslint ./src",
|
|
55
55
|
"test": "mocha --config ../../.mocharc \"./src/**/*.spec.?(ts|tsx)\"",
|
|
56
56
|
"test:ci": "yarn test --reporter mocha-ctrf-json-reporter",
|
|
57
57
|
"test:coverage": "nyc yarn test:ci",
|
|
58
58
|
"watch": "tsc -w"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@eclipse-glsp/graph": "2.
|
|
62
|
-
"@eclipse-glsp/protocol": "
|
|
61
|
+
"@eclipse-glsp/graph": "2.7.0-next.10+bed0bb0",
|
|
62
|
+
"@eclipse-glsp/protocol": "next",
|
|
63
63
|
"@types/uuid": "8.3.1",
|
|
64
64
|
"commander": "^8.3.0",
|
|
65
65
|
"fast-json-patch": "^3.1.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "bed0bb089fb49e7a5cf5be5dfe02d4116dae944f"
|
|
82
82
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-
|
|
2
|
+
* Copyright (c) 2022-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -15,12 +15,16 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { ContainerModule } from 'inversify';
|
|
18
|
-
import { InjectionContainer, LogLevel, LoggerConfigOptions, configureConsoleLogger } from '../../common/';
|
|
18
|
+
import { ActionDispatchScope, InjectionContainer, LogLevel, LoggerConfigOptions, configureConsoleLogger } from '../../common/';
|
|
19
|
+
import { BrowserActionDispatchScope } from './browser-action-dispatch-scope';
|
|
19
20
|
|
|
20
21
|
export function createAppModule(options: LoggerConfigOptions = {}): ContainerModule {
|
|
21
22
|
const resolvedOptions: LoggerConfigOptions = { consoleLog: true, logLevel: LogLevel.info, ...options };
|
|
22
23
|
return new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
23
24
|
bind(InjectionContainer).toDynamicValue(dynamicContext => dynamicContext.container);
|
|
25
|
+
// Transient on purpose: a singleton at the server-container level would be shared across
|
|
26
|
+
// sessions and leak the browser flag between them.
|
|
27
|
+
bind(ActionDispatchScope).to(BrowserActionDispatchScope);
|
|
24
28
|
const context = { bind, unbind, isBound, rebind };
|
|
25
29
|
configureConsoleLogger(context, resolvedOptions);
|
|
26
30
|
});
|
|
@@ -0,0 +1,75 @@
|
|
|
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 Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { Action } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import { ClientAction } from '../../common/protocol/client-action';
|
|
19
|
+
import * as mock from '../../common/test/mock-util';
|
|
20
|
+
import { BrowserActionDispatchScope } from './browser-action-dispatch-scope';
|
|
21
|
+
|
|
22
|
+
describe('BrowserActionDispatchScope', () => {
|
|
23
|
+
const action: Action = { kind: 'foo' };
|
|
24
|
+
const markedClientAction = ((): Action => {
|
|
25
|
+
const a: Action = { kind: 'bar' };
|
|
26
|
+
ClientAction.mark(a);
|
|
27
|
+
return a;
|
|
28
|
+
})();
|
|
29
|
+
|
|
30
|
+
let scope: BrowserActionDispatchScope;
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
scope = new BrowserActionDispatchScope();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('isReentrant is false outside enter()', () => {
|
|
36
|
+
expect(scope.isReentrant(action)).to.be.false;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('isReentrant is true during a synchronous enter()', () => {
|
|
40
|
+
scope.enter(() => {
|
|
41
|
+
expect(scope.isReentrant(action)).to.be.true;
|
|
42
|
+
});
|
|
43
|
+
expect(scope.isReentrant(action)).to.be.false;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('isReentrant is true during an async enter() and false after settle', async () => {
|
|
47
|
+
const probe: Promise<boolean> = scope.enter(async () => {
|
|
48
|
+
await Promise.resolve();
|
|
49
|
+
return scope.isReentrant(action);
|
|
50
|
+
});
|
|
51
|
+
expect(await probe).to.be.true;
|
|
52
|
+
expect(scope.isReentrant(action)).to.be.false;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('resets active flag when callback throws synchronously', () => {
|
|
56
|
+
expect(() =>
|
|
57
|
+
scope.enter(() => {
|
|
58
|
+
throw new Error('boom');
|
|
59
|
+
})
|
|
60
|
+
).to.throw('boom');
|
|
61
|
+
expect(scope.isReentrant(action)).to.be.false;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('resets active flag when async callback rejects', async () => {
|
|
65
|
+
await mock.expectToThrowAsync(() => scope.enter(() => Promise.reject(new Error('boom'))), 'boom');
|
|
66
|
+
expect(scope.isReentrant(action)).to.be.false;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('isReentrant is false for client-originated actions even when scope is active', () => {
|
|
70
|
+
scope.enter(() => {
|
|
71
|
+
expect(scope.isReentrant(markedClientAction)).to.be.false;
|
|
72
|
+
expect(scope.isReentrant(action)).to.be.true;
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
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 Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import { Action } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { injectable } from 'inversify';
|
|
19
|
+
import { ActionDispatchScope } from '../../common/actions/action-dispatcher';
|
|
20
|
+
import { ClientAction } from '../../common/protocol/client-action';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Browser-compatible {@link ActionDispatchScope} backed by a single boolean flag, used because
|
|
24
|
+
* available `AsyncLocalStorage` polyfills do not work reliably across browser engines (e.g. V8).
|
|
25
|
+
*
|
|
26
|
+
* The flag cannot distinguish "still inside the handler's async continuation" from "unrelated
|
|
27
|
+
* event fired during the handler's await". Any dispatch arriving in such a gap is observed as
|
|
28
|
+
* reentrant and routed inline. Client-originated actions are explicitly treated as non-reentrant
|
|
29
|
+
* to cover the dominant case, but server-side dispatches from non-handler contexts (timer
|
|
30
|
+
* callbacks, event listeners, adopter code) cannot be filtered this way and may interleave with
|
|
31
|
+
* the in-flight handler.
|
|
32
|
+
*
|
|
33
|
+
* The dispatcher normally serializes handler execution; the inline interleaving breaks that
|
|
34
|
+
* guarantee. A handler that pauses on `await` may resume to find that another handler has mutated
|
|
35
|
+
* state in between (model state, command stack, caches), leading to unexpected behavior.
|
|
36
|
+
* Avoid dispatching from non-handler contexts where possible.
|
|
37
|
+
*/
|
|
38
|
+
@injectable()
|
|
39
|
+
export class BrowserActionDispatchScope implements ActionDispatchScope {
|
|
40
|
+
protected active = false;
|
|
41
|
+
|
|
42
|
+
// Assumes serial invocation by the dispatcher's queue processor; concurrent enter() calls
|
|
43
|
+
// would corrupt the prior-restore logic and leave the flag stuck.
|
|
44
|
+
enter<R>(callback: () => R): R {
|
|
45
|
+
const prior = this.active;
|
|
46
|
+
this.active = true;
|
|
47
|
+
let result: R;
|
|
48
|
+
try {
|
|
49
|
+
result = callback();
|
|
50
|
+
} catch (error) {
|
|
51
|
+
this.active = prior;
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
if (result instanceof Promise) {
|
|
55
|
+
// Cast required because TS cannot prove the .finally() result matches the generic R.
|
|
56
|
+
return result.finally(() => {
|
|
57
|
+
this.active = prior;
|
|
58
|
+
}) as unknown as R;
|
|
59
|
+
}
|
|
60
|
+
this.active = prior;
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
isReentrant(action: Action): boolean {
|
|
65
|
+
return this.active && !ClientAction.is(action);
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/browser/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-
|
|
2
|
+
* Copyright (c) 2022-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
export * from './di/app-module';
|
|
17
|
+
export * from './di/browser-action-dispatch-scope';
|
|
17
18
|
export * from './launch/worker-server-launcher';
|
|
18
19
|
export * from './reexport';
|