@hydranium/glsp-server 1.0.0-next.148 → 1.0.0-next.155
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/launcher/glsp-server-overrides.d.ts +4 -3
- package/lib/launcher/glsp-server-overrides.d.ts.map +1 -1
- package/lib/launcher/glsp-server-overrides.js +17 -5
- package/lib/launcher/glsp-server-overrides.js.map +1 -1
- package/package.json +7 -7
- package/src/launcher/glsp-server-overrides.ts +19 -7
|
@@ -21,9 +21,10 @@ import { ContainerModule } from 'inversify';
|
|
|
21
21
|
* **An adopter's server is kept when it extends {@link HydraniumGlspServer}.**
|
|
22
22
|
* Any other `GLSPServer` the adopter's `ServerModule` binds, upstream's default
|
|
23
23
|
* included, is replaced when the container first creates it, so a server that
|
|
24
|
-
* extends upstream's directly is discarded
|
|
25
|
-
* activation because `rebind` would replace an
|
|
26
|
-
* discarded server is constructed once and
|
|
24
|
+
* extends upstream's directly is discarded, with a warning naming its class.
|
|
25
|
+
* The replacement happens on activation because `rebind` would replace an
|
|
26
|
+
* adopter's subclass as well; the discarded server is constructed once and
|
|
27
|
+
* never used.
|
|
27
28
|
*
|
|
28
29
|
* Keeping this out of the adopter's hands is the point: an adopter passes their
|
|
29
30
|
* own `ServerModule` in, so anything they must add themselves is a fix the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-server-overrides.d.ts","sourceRoot":"","sources":["../../src/launcher/glsp-server-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C
|
|
1
|
+
{"version":3,"file":"glsp-server-overrides.d.ts","sourceRoot":"","sources":["../../src/launcher/glsp-server-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,yBAAyB,IAAI,eAAe,CAkB3D"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { GLSPServer } from '@eclipse-glsp/server';
|
|
9
|
+
import { DefaultGLSPServer, GLSPServer, LoggerFactory } from '@eclipse-glsp/server';
|
|
10
10
|
import { ContainerModule } from 'inversify';
|
|
11
11
|
import { HydraniumGlspServer } from './hydranium-glsp-server.js';
|
|
12
12
|
/**
|
|
@@ -23,9 +23,10 @@ import { HydraniumGlspServer } from './hydranium-glsp-server.js';
|
|
|
23
23
|
* **An adopter's server is kept when it extends {@link HydraniumGlspServer}.**
|
|
24
24
|
* Any other `GLSPServer` the adopter's `ServerModule` binds, upstream's default
|
|
25
25
|
* included, is replaced when the container first creates it, so a server that
|
|
26
|
-
* extends upstream's directly is discarded
|
|
27
|
-
* activation because `rebind` would replace an
|
|
28
|
-
* discarded server is constructed once and
|
|
26
|
+
* extends upstream's directly is discarded, with a warning naming its class.
|
|
27
|
+
* The replacement happens on activation because `rebind` would replace an
|
|
28
|
+
* adopter's subclass as well; the discarded server is constructed once and
|
|
29
|
+
* never used.
|
|
29
30
|
*
|
|
30
31
|
* Keeping this out of the adopter's hands is the point: an adopter passes their
|
|
31
32
|
* own `ServerModule` in, so anything they must add themselves is a fix the
|
|
@@ -41,7 +42,18 @@ import { HydraniumGlspServer } from './hydranium-glsp-server.js';
|
|
|
41
42
|
export function createGlspServerOverrides() {
|
|
42
43
|
return new ContainerModule((bind, _unbind, _isBound, _rebind, _unbindAsync, onActivation) => {
|
|
43
44
|
bind(HydraniumGlspServer).toSelf().inSingletonScope();
|
|
44
|
-
onActivation(GLSPServer, (context, server) =>
|
|
45
|
+
onActivation(GLSPServer, (context, server) => {
|
|
46
|
+
if (server instanceof HydraniumGlspServer) {
|
|
47
|
+
return server;
|
|
48
|
+
}
|
|
49
|
+
if (server.constructor !== DefaultGLSPServer) {
|
|
50
|
+
context.container
|
|
51
|
+
.get(LoggerFactory)('HydraniumGlspServer')
|
|
52
|
+
.warn(`Replacing the bound GLSP server ${server.constructor.name} with HydraniumGlspServer; ` +
|
|
53
|
+
'extend HydraniumGlspServer to keep its behaviour.');
|
|
54
|
+
}
|
|
55
|
+
return context.container.get(HydraniumGlspServer);
|
|
56
|
+
});
|
|
45
57
|
});
|
|
46
58
|
}
|
|
47
59
|
//# sourceMappingURL=glsp-server-overrides.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-server-overrides.js","sourceRoot":"","sources":["../../src/launcher/glsp-server-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"glsp-server-overrides.js","sourceRoot":"","sources":["../../src/launcher/glsp-server-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,yBAAyB;IACtC,OAAO,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE;QACzF,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtD,YAAY,CAAa,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtD,IAAI,MAAM,YAAY,mBAAmB,EAAE,CAAC;gBACzC,OAAO,MAAM,CAAC;YACjB,CAAC;YACD,IAAI,MAAM,CAAC,WAAW,KAAK,iBAAiB,EAAE,CAAC;gBAC5C,OAAO,CAAC,SAAS;qBACb,GAAG,CAAgB,aAAa,CAAC,CAAC,qBAAqB,CAAC;qBACxD,IAAI,CACF,mCAAmC,MAAM,CAAC,WAAW,CAAC,IAAI,6BAA6B;oBACpF,mDAAmD,CACxD,CAAC;YACR,CAAC;YACD,OAAO,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/glsp-server",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.155",
|
|
4
4
|
"description": "GLSP protocol head for the hydranium framework. Peer of @hydranium/core/lsp and @hydranium/data-server; built on @hydranium/core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hydranium",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@eclipse-glsp/protocol": "2.7.0",
|
|
89
89
|
"@eclipse-glsp/server": "2.7.0",
|
|
90
|
-
"@hydranium/core": "1.0.0-next.
|
|
91
|
-
"@hydranium/langium": "1.0.0-next.
|
|
92
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
90
|
+
"@hydranium/core": "1.0.0-next.155",
|
|
91
|
+
"@hydranium/langium": "1.0.0-next.155",
|
|
92
|
+
"@hydranium/protocol": "1.0.0-next.155",
|
|
93
93
|
"inversify": "6.2.2",
|
|
94
94
|
"reflect-metadata": "0.2.2",
|
|
95
95
|
"rimraf": "^5.0.0",
|
|
@@ -100,9 +100,9 @@
|
|
|
100
100
|
"peerDependencies": {
|
|
101
101
|
"@eclipse-glsp/protocol": "^2.6.0",
|
|
102
102
|
"@eclipse-glsp/server": "^2.6.0",
|
|
103
|
-
"@hydranium/core": "1.0.0-next.
|
|
104
|
-
"@hydranium/langium": "1.0.0-next.
|
|
105
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
103
|
+
"@hydranium/core": "1.0.0-next.155",
|
|
104
|
+
"@hydranium/langium": "1.0.0-next.155",
|
|
105
|
+
"@hydranium/protocol": "1.0.0-next.155",
|
|
106
106
|
"inversify": "^6.0.0",
|
|
107
107
|
"reflect-metadata": "^0.2.2",
|
|
108
108
|
"vscode-jsonrpc": "9.0.1",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
|
-
import { GLSPServer } from '@eclipse-glsp/server';
|
|
10
|
+
import { DefaultGLSPServer, GLSPServer, LoggerFactory } from '@eclipse-glsp/server';
|
|
11
11
|
import { ContainerModule } from 'inversify';
|
|
12
12
|
import { HydraniumGlspServer } from './hydranium-glsp-server.js';
|
|
13
13
|
|
|
@@ -25,9 +25,10 @@ import { HydraniumGlspServer } from './hydranium-glsp-server.js';
|
|
|
25
25
|
* **An adopter's server is kept when it extends {@link HydraniumGlspServer}.**
|
|
26
26
|
* Any other `GLSPServer` the adopter's `ServerModule` binds, upstream's default
|
|
27
27
|
* included, is replaced when the container first creates it, so a server that
|
|
28
|
-
* extends upstream's directly is discarded
|
|
29
|
-
* activation because `rebind` would replace an
|
|
30
|
-
* discarded server is constructed once and
|
|
28
|
+
* extends upstream's directly is discarded, with a warning naming its class.
|
|
29
|
+
* The replacement happens on activation because `rebind` would replace an
|
|
30
|
+
* adopter's subclass as well; the discarded server is constructed once and
|
|
31
|
+
* never used.
|
|
31
32
|
*
|
|
32
33
|
* Keeping this out of the adopter's hands is the point: an adopter passes their
|
|
33
34
|
* own `ServerModule` in, so anything they must add themselves is a fix the
|
|
@@ -43,8 +44,19 @@ import { HydraniumGlspServer } from './hydranium-glsp-server.js';
|
|
|
43
44
|
export function createGlspServerOverrides(): ContainerModule {
|
|
44
45
|
return new ContainerModule((bind, _unbind, _isBound, _rebind, _unbindAsync, onActivation) => {
|
|
45
46
|
bind(HydraniumGlspServer).toSelf().inSingletonScope();
|
|
46
|
-
onActivation<GLSPServer>(GLSPServer, (context, server) =>
|
|
47
|
-
server instanceof HydraniumGlspServer
|
|
48
|
-
|
|
47
|
+
onActivation<GLSPServer>(GLSPServer, (context, server) => {
|
|
48
|
+
if (server instanceof HydraniumGlspServer) {
|
|
49
|
+
return server;
|
|
50
|
+
}
|
|
51
|
+
if (server.constructor !== DefaultGLSPServer) {
|
|
52
|
+
context.container
|
|
53
|
+
.get<LoggerFactory>(LoggerFactory)('HydraniumGlspServer')
|
|
54
|
+
.warn(
|
|
55
|
+
`Replacing the bound GLSP server ${server.constructor.name} with HydraniumGlspServer; ` +
|
|
56
|
+
'extend HydraniumGlspServer to keep its behaviour.'
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return context.container.get(HydraniumGlspServer);
|
|
60
|
+
});
|
|
49
61
|
});
|
|
50
62
|
}
|