@eclipse-glsp/server 2.6.0-next.3 → 2.7.0-next.6
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/di/browser-dispatch-context.d.ts +39 -0
- package/lib/browser/di/browser-dispatch-context.d.ts.map +1 -0
- package/lib/browser/di/browser-dispatch-context.js +57 -0
- package/lib/browser/di/browser-dispatch-context.js.map +1 -0
- package/lib/browser/di/sync-dispatch-context.d.ts +39 -0
- package/lib/browser/di/sync-dispatch-context.d.ts.map +1 -0
- package/lib/browser/di/sync-dispatch-context.js +57 -0
- package/lib/browser/di/sync-dispatch-context.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 +199 -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.js +1 -2
- package/lib/common/actions/global-action-provider.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/layout/computed-bounds-action-handler.d.ts.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +6 -4
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +7 -5
- package/lib/common/features/model/model-submission-handler.js.map +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 +2 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +2 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/protocol/glsp-server.d.ts +4 -2
- package/lib/common/protocol/glsp-server.d.ts.map +1 -1
- package/lib/common/protocol/glsp-server.js +35 -4
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/utils/action-channel.d.ts +58 -0
- package/lib/common/utils/action-channel.d.ts.map +1 -0
- package/lib/common/utils/action-channel.js +99 -0
- package/lib/common/utils/action-channel.js.map +1 -0
- 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/async-dispatch-context.d.ts +26 -0
- package/lib/node/di/async-dispatch-context.d.ts.map +1 -0
- package/lib/node/di/async-dispatch-context.js +35 -0
- package/lib/node/di/async-dispatch-context.js.map +1 -0
- 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/di/node-dispatch-context.d.ts +26 -0
- package/lib/node/di/node-dispatch-context.d.ts.map +1 -0
- package/lib/node/di/node-dispatch-context.js +35 -0
- package/lib/node/di/node-dispatch-context.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 +4 -4
- 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 +292 -25
- package/src/common/actions/client-action-handler.ts +2 -2
- package/src/common/actions/global-action-provider.ts +2 -2
- package/src/common/command/recording-command.spec.ts +1 -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 +6 -3
- package/src/common/features/model/model-submission-handler.ts +8 -5
- 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 +2 -1
- package/src/common/protocol/glsp-server.ts +41 -2
- package/src/common/test/mock-util.ts +17 -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 +656 -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,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 { ActionDispatchContext } from '../../common/actions/action-dispatcher';
|
|
18
|
+
/**
|
|
19
|
+
* Node.js {@link ActionDispatchContext} backed by native `AsyncLocalStorage`.
|
|
20
|
+
*/
|
|
21
|
+
export declare class AsyncDispatchContext implements ActionDispatchContext {
|
|
22
|
+
protected storage: AsyncLocalStorage<boolean>;
|
|
23
|
+
run<R>(callback: () => R): R;
|
|
24
|
+
isInContext(): boolean;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=async-dispatch-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-dispatch-context.d.ts","sourceRoot":"","sources":["../../../src/node/di/async-dispatch-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E;;GAEG;AACH,qBAAa,oBAAqB,YAAW,qBAAqB;IAC9D,SAAS,CAAC,OAAO,6BAAoC;IAErD,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAI5B,WAAW,IAAI,OAAO;CAGzB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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.AsyncDispatchContext = void 0;
|
|
19
|
+
const async_hooks_1 = require("async_hooks");
|
|
20
|
+
/**
|
|
21
|
+
* Node.js {@link ActionDispatchContext} backed by native `AsyncLocalStorage`.
|
|
22
|
+
*/
|
|
23
|
+
class AsyncDispatchContext {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.storage = new async_hooks_1.AsyncLocalStorage();
|
|
26
|
+
}
|
|
27
|
+
run(callback) {
|
|
28
|
+
return this.storage.run(true, callback);
|
|
29
|
+
}
|
|
30
|
+
isInContext() {
|
|
31
|
+
return this.storage.getStore() === true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AsyncDispatchContext = AsyncDispatchContext;
|
|
35
|
+
//# sourceMappingURL=async-dispatch-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-dispatch-context.js","sourceRoot":"","sources":["../../../src/node/di/async-dispatch-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,6CAAgD;AAGhD;;GAEG;AACH,MAAa,oBAAoB;IAAjC;QACc,YAAO,GAAG,IAAI,+BAAiB,EAAW,CAAC;IASzD,CAAC;IAPG,GAAG,CAAI,QAAiB;QACpB,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;AAVD,oDAUC"}
|
|
@@ -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"}
|
|
@@ -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 { ActionDispatchContext } from '../../common/actions/action-dispatcher';
|
|
18
|
+
/**
|
|
19
|
+
* Node.js {@link ActionDispatchContext} backed by native `AsyncLocalStorage`.
|
|
20
|
+
*/
|
|
21
|
+
export declare class NodeDispatchContext implements ActionDispatchContext {
|
|
22
|
+
protected storage: AsyncLocalStorage<boolean>;
|
|
23
|
+
run<R>(callback: () => R): R;
|
|
24
|
+
isInContext(): boolean;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=node-dispatch-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-dispatch-context.d.ts","sourceRoot":"","sources":["../../../src/node/di/node-dispatch-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E;;GAEG;AACH,qBAAa,mBAAoB,YAAW,qBAAqB;IAC7D,SAAS,CAAC,OAAO,6BAAoC;IAErD,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAI5B,WAAW,IAAI,OAAO;CAGzB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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.NodeDispatchContext = void 0;
|
|
19
|
+
const async_hooks_1 = require("async_hooks");
|
|
20
|
+
/**
|
|
21
|
+
* Node.js {@link ActionDispatchContext} backed by native `AsyncLocalStorage`.
|
|
22
|
+
*/
|
|
23
|
+
class NodeDispatchContext {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.storage = new async_hooks_1.AsyncLocalStorage();
|
|
26
|
+
}
|
|
27
|
+
run(callback) {
|
|
28
|
+
return this.storage.run(true, callback);
|
|
29
|
+
}
|
|
30
|
+
isInContext() {
|
|
31
|
+
return this.storage.getStore() === true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.NodeDispatchContext = NodeDispatchContext;
|
|
35
|
+
//# sourceMappingURL=node-dispatch-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-dispatch-context.js","sourceRoot":"","sources":["../../../src/node/di/node-dispatch-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,6CAAgD;AAGhD;;GAEG;AACH,MAAa,mBAAmB;IAAhC;QACc,YAAO,GAAG,IAAI,+BAAiB,EAAW,CAAC;IASzD,CAAC;IAPG,GAAG,CAAI,QAAiB;QACpB,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;AAVD,kDAUC"}
|
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.6+2d275ee",
|
|
4
4
|
"description": "A js server framework for Eclipse GLSP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -51,14 +51,14 @@
|
|
|
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.
|
|
61
|
+
"@eclipse-glsp/graph": "2.7.0-next.6+2d275ee",
|
|
62
62
|
"@eclipse-glsp/protocol": "next",
|
|
63
63
|
"@types/uuid": "8.3.1",
|
|
64
64
|
"commander": "^8.3.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "2d275ee9c4ea080f5fd99171e5c760f53ad34f49"
|
|
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';
|