@eclipse-glsp/server 1.1.0-RC10 → 1.1.0-next.342c713.66

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.
Files changed (238) hide show
  1. package/lib/browser/launch/worker-server-launcher.js +26 -2
  2. package/lib/browser/launch/worker-server-launcher.js.map +1 -1
  3. package/lib/common/actions/action-dispatcher.d.ts +2 -1
  4. package/lib/common/actions/action-dispatcher.d.ts.map +1 -1
  5. package/lib/common/actions/action-dispatcher.js +9 -6
  6. package/lib/common/actions/action-dispatcher.js.map +1 -1
  7. package/lib/common/actions/action-handler-registry.js +4 -2
  8. package/lib/common/actions/action-handler-registry.js.map +1 -1
  9. package/lib/common/actions/client-action-handler.d.ts +17 -8
  10. package/lib/common/actions/client-action-handler.d.ts.map +1 -1
  11. package/lib/common/actions/client-action-handler.js +32 -21
  12. package/lib/common/actions/client-action-handler.js.map +1 -1
  13. package/lib/common/actions/global-action-provider.d.ts +6 -21
  14. package/lib/common/actions/global-action-provider.d.ts.map +1 -1
  15. package/lib/common/actions/global-action-provider.js +17 -21
  16. package/lib/common/actions/global-action-provider.js.map +1 -1
  17. package/lib/common/command/command-stack.js +2 -1
  18. package/lib/common/command/command-stack.js.map +1 -1
  19. package/lib/common/command/recording-command.d.ts +9 -14
  20. package/lib/common/command/recording-command.d.ts.map +1 -1
  21. package/lib/common/command/recording-command.js +36 -27
  22. package/lib/common/command/recording-command.js.map +1 -1
  23. package/lib/common/command/undo-redo-action-handler.js +2 -1
  24. package/lib/common/command/undo-redo-action-handler.js.map +1 -1
  25. package/lib/common/di/client-session-module.d.ts +9 -1
  26. package/lib/common/di/client-session-module.d.ts.map +1 -1
  27. package/lib/common/di/client-session-module.js +9 -9
  28. package/lib/common/di/client-session-module.js.map +1 -1
  29. package/lib/common/di/diagram-module.d.ts +20 -1
  30. package/lib/common/di/diagram-module.d.ts.map +1 -1
  31. package/lib/common/di/diagram-module.js +10 -48
  32. package/lib/common/di/diagram-module.js.map +1 -1
  33. package/lib/common/di/glsp-module.js +2 -1
  34. package/lib/common/di/glsp-module.js.map +1 -1
  35. package/lib/common/di/server-module.d.ts +0 -1
  36. package/lib/common/di/server-module.d.ts.map +1 -1
  37. package/lib/common/di/server-module.js +0 -1
  38. package/lib/common/di/server-module.js.map +1 -1
  39. package/lib/common/diagram/request-type-hints-action-handler.js +2 -1
  40. package/lib/common/diagram/request-type-hints-action-handler.js.map +1 -1
  41. package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +2 -1
  42. package/lib/common/features/clipboard/request-clipboard-data-action-handler.js.map +1 -1
  43. package/lib/common/features/contextactions/command-palette-action-provider.js +2 -1
  44. package/lib/common/features/contextactions/command-palette-action-provider.js.map +1 -1
  45. package/lib/common/features/contextactions/context-actions-provider-registry.js +2 -1
  46. package/lib/common/features/contextactions/context-actions-provider-registry.js.map +1 -1
  47. package/lib/common/features/contextactions/context-menu-item-provider.js +2 -1
  48. package/lib/common/features/contextactions/context-menu-item-provider.js.map +1 -1
  49. package/lib/common/features/contextactions/request-context-actions-handler.js +2 -1
  50. package/lib/common/features/contextactions/request-context-actions-handler.js.map +1 -1
  51. package/lib/common/features/contextactions/tool-palette-item-provider.js +4 -2
  52. package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
  53. package/lib/common/features/directediting/context-edit-validator-registry.js +2 -1
  54. package/lib/common/features/directediting/context-edit-validator-registry.js.map +1 -1
  55. package/lib/common/features/directediting/label-edit-validator.js +2 -1
  56. package/lib/common/features/directediting/label-edit-validator.js.map +1 -1
  57. package/lib/common/features/directediting/request-edit-validation-handler.js +2 -1
  58. package/lib/common/features/directediting/request-edit-validation-handler.js.map +1 -1
  59. package/lib/common/features/layout/computed-bounds-action-handler.js +2 -1
  60. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
  61. package/lib/common/features/layout/layout-operation-handler.js +2 -1
  62. package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
  63. package/lib/common/features/model/gmodel-factory.js +2 -1
  64. package/lib/common/features/model/gmodel-factory.js.map +1 -1
  65. package/lib/common/features/model/gmodel-index.js +2 -1
  66. package/lib/common/features/model/gmodel-index.js.map +1 -1
  67. package/lib/common/features/model/gmodel-serializer.js +2 -1
  68. package/lib/common/features/model/gmodel-serializer.js.map +1 -1
  69. package/lib/common/features/model/model-state.d.ts.map +1 -1
  70. package/lib/common/features/model/model-state.js +5 -1
  71. package/lib/common/features/model/model-state.js.map +1 -1
  72. package/lib/common/features/model/model-submission-handler.d.ts +30 -2
  73. package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
  74. package/lib/common/features/model/model-submission-handler.js +58 -8
  75. package/lib/common/features/model/model-submission-handler.js.map +1 -1
  76. package/lib/common/features/model/request-model-action-handler.d.ts +5 -6
  77. package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
  78. package/lib/common/features/model/request-model-action-handler.js +37 -14
  79. package/lib/common/features/model/request-model-action-handler.js.map +1 -1
  80. package/lib/common/features/model/save-model-action-handler.js +2 -1
  81. package/lib/common/features/model/save-model-action-handler.js.map +1 -1
  82. package/lib/common/features/navigation/navigation-target-provider-registry.js +2 -1
  83. package/lib/common/features/navigation/navigation-target-provider-registry.js.map +1 -1
  84. package/lib/common/features/navigation/navigation-target-resolver.js +2 -1
  85. package/lib/common/features/navigation/navigation-target-resolver.js.map +1 -1
  86. package/lib/common/features/navigation/request-navigation-targets-action-handler.js +2 -1
  87. package/lib/common/features/navigation/request-navigation-targets-action-handler.js.map +1 -1
  88. package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js +2 -1
  89. package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js.map +1 -1
  90. package/lib/common/features/popup/request-popup-model-action-handler.js +2 -1
  91. package/lib/common/features/popup/request-popup-model-action-handler.js.map +1 -1
  92. package/lib/common/features/progress/progress-service.d.ts +44 -0
  93. package/lib/common/features/progress/progress-service.d.ts.map +1 -0
  94. package/lib/common/features/progress/progress-service.js +74 -0
  95. package/lib/common/features/progress/progress-service.js.map +1 -0
  96. package/lib/common/features/validation/model-validator.d.ts +47 -2
  97. package/lib/common/features/validation/model-validator.d.ts.map +1 -1
  98. package/lib/common/features/validation/model-validator.js +80 -1
  99. package/lib/common/features/validation/model-validator.js.map +1 -1
  100. package/lib/common/features/validation/request-markers-handler.d.ts +15 -0
  101. package/lib/common/features/validation/request-markers-handler.d.ts.map +1 -1
  102. package/lib/common/features/validation/request-markers-handler.js +5 -10
  103. package/lib/common/features/validation/request-markers-handler.js.map +1 -1
  104. package/lib/common/gmodel/apply-label-edit-operation-handler.js +2 -1
  105. package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
  106. package/lib/common/gmodel/change-bounds-operation-handler.js +2 -1
  107. package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
  108. package/lib/common/gmodel/change-routing-points-operation-handler.js +2 -1
  109. package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
  110. package/lib/common/gmodel/cut-operation-handler.js +2 -1
  111. package/lib/common/gmodel/cut-operation-handler.js.map +1 -1
  112. package/lib/common/gmodel/delete-operation-handler.js +2 -1
  113. package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
  114. package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts +3 -3
  115. package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts.map +1 -1
  116. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +2 -1
  117. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
  118. package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts +3 -3
  119. package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts.map +1 -1
  120. package/lib/common/gmodel/gmodel-create-node-operation-handler.js +2 -1
  121. package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
  122. package/lib/common/gmodel/gmodel-diagram-module.js +2 -1
  123. package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
  124. package/lib/common/gmodel/paste-operation-handler.js +26 -2
  125. package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
  126. package/lib/common/gmodel/reconnect-edge-operation-handler.js +2 -1
  127. package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
  128. package/lib/common/index.d.ts +1 -0
  129. package/lib/common/index.d.ts.map +1 -1
  130. package/lib/common/index.js +1 -0
  131. package/lib/common/index.js.map +1 -1
  132. package/lib/common/launch/glsp-server-launcher.js +2 -1
  133. package/lib/common/launch/glsp-server-launcher.js.map +1 -1
  134. package/lib/common/launch/jsonrpc-server-launcher.js +2 -1
  135. package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -1
  136. package/lib/common/operations/compound-operation-handler.d.ts +5 -0
  137. package/lib/common/operations/compound-operation-handler.d.ts.map +1 -1
  138. package/lib/common/operations/compound-operation-handler.js +8 -2
  139. package/lib/common/operations/compound-operation-handler.js.map +1 -1
  140. package/lib/common/operations/create-operation-handler.d.ts +19 -5
  141. package/lib/common/operations/create-operation-handler.d.ts.map +1 -1
  142. package/lib/common/operations/create-operation-handler.js +2 -1
  143. package/lib/common/operations/create-operation-handler.js.map +1 -1
  144. package/lib/common/operations/json-operation-handler.d.ts +94 -0
  145. package/lib/common/operations/json-operation-handler.d.ts.map +1 -0
  146. package/lib/common/operations/json-operation-handler.js +120 -0
  147. package/lib/common/operations/json-operation-handler.js.map +1 -0
  148. package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
  149. package/lib/common/operations/operation-action-handler.js +3 -2
  150. package/lib/common/operations/operation-action-handler.js.map +1 -1
  151. package/lib/common/operations/operation-handler-registry.d.ts +1 -9
  152. package/lib/common/operations/operation-handler-registry.d.ts.map +1 -1
  153. package/lib/common/operations/operation-handler-registry.js +4 -12
  154. package/lib/common/operations/operation-handler-registry.js.map +1 -1
  155. package/lib/common/operations/operation-handler.d.ts +2 -2
  156. package/lib/common/operations/operation-handler.d.ts.map +1 -1
  157. package/lib/common/operations/operation-handler.js +2 -1
  158. package/lib/common/operations/operation-handler.js.map +1 -1
  159. package/lib/common/protocol/client-action.d.ts +31 -0
  160. package/lib/common/protocol/client-action.d.ts.map +1 -0
  161. package/lib/common/protocol/client-action.js +35 -0
  162. package/lib/common/protocol/client-action.js.map +1 -0
  163. package/lib/common/protocol/glsp-server.d.ts +1 -1
  164. package/lib/common/protocol/glsp-server.d.ts.map +1 -1
  165. package/lib/common/protocol/glsp-server.js +9 -10
  166. package/lib/common/protocol/glsp-server.js.map +1 -1
  167. package/lib/common/session/client-session-factory.js +5 -4
  168. package/lib/common/session/client-session-factory.js.map +1 -1
  169. package/lib/common/session/client-session-manager.js +2 -1
  170. package/lib/common/session/client-session-manager.js.map +1 -1
  171. package/lib/common/utils/client-options-util.d.ts +3 -0
  172. package/lib/common/utils/client-options-util.d.ts.map +1 -1
  173. package/lib/common/utils/client-options-util.js +5 -15
  174. package/lib/common/utils/client-options-util.js.map +1 -1
  175. package/lib/common/utils/console-logger.js +2 -1
  176. package/lib/common/utils/console-logger.js.map +1 -1
  177. package/lib/common/utils/logger.js +2 -1
  178. package/lib/common/utils/logger.js.map +1 -1
  179. package/lib/common/utils/promise-queue.d.ts.map +1 -1
  180. package/lib/common/utils/promise-queue.js +3 -6
  181. package/lib/common/utils/promise-queue.js.map +1 -1
  182. package/lib/common/utils/registry.d.ts +3 -1
  183. package/lib/common/utils/registry.d.ts.map +1 -1
  184. package/lib/common/utils/registry.js +15 -4
  185. package/lib/common/utils/registry.js.map +1 -1
  186. package/lib/node/abstract-json-model-storage.d.ts.map +1 -1
  187. package/lib/node/abstract-json-model-storage.js +33 -3
  188. package/lib/node/abstract-json-model-storage.js.map +1 -1
  189. package/lib/node/di/app-module.js +24 -1
  190. package/lib/node/di/app-module.js.map +1 -1
  191. package/lib/node/gmodel/gmodel-storage.js +2 -1
  192. package/lib/node/gmodel/gmodel-storage.js.map +1 -1
  193. package/lib/node/launch/cli-parser.js +26 -3
  194. package/lib/node/launch/cli-parser.js.map +1 -1
  195. package/lib/node/launch/socket-cli-parser.js +24 -1
  196. package/lib/node/launch/socket-cli-parser.js.map +1 -1
  197. package/lib/node/launch/socket-server-launcher.js +27 -3
  198. package/lib/node/launch/socket-server-launcher.js.map +1 -1
  199. package/lib/node/launch/websocket-server-launcher.js +27 -3
  200. package/lib/node/launch/websocket-server-launcher.js.map +1 -1
  201. package/package.json +4 -5
  202. package/src/common/actions/action-dispatcher.spec.ts +3 -2
  203. package/src/common/actions/action-dispatcher.ts +8 -5
  204. package/src/common/actions/client-action-handler.ts +28 -18
  205. package/src/common/actions/global-action-provider.spec.ts +4 -15
  206. package/src/common/actions/global-action-provider.ts +21 -25
  207. package/src/common/command/recording-command.spec.ts +15 -5
  208. package/src/common/command/recording-command.ts +16 -26
  209. package/src/common/di/client-session-module.ts +17 -10
  210. package/src/common/di/diagram-module.ts +14 -66
  211. package/src/common/di/server-module.ts +0 -1
  212. package/src/common/features/model/model-state.ts +3 -0
  213. package/src/common/features/model/model-submission-handler.ts +63 -6
  214. package/src/common/features/model/request-model-action-handler.ts +37 -17
  215. package/src/common/features/progress/progress-service.ts +74 -0
  216. package/src/common/features/validation/model-validator.ts +75 -3
  217. package/src/common/features/validation/request-markers-handler.ts +4 -10
  218. package/src/common/gmodel/gmodel-create-edge-operation-handler.ts +3 -3
  219. package/src/common/gmodel/gmodel-create-node-operation-handler.ts +3 -3
  220. package/src/common/index.ts +1 -0
  221. package/src/common/operations/compound-operation-handler.ts +6 -1
  222. package/src/common/operations/create-operation-handler.ts +22 -5
  223. package/src/common/operations/json-operation-handler.ts +147 -0
  224. package/src/common/operations/operation-action-handler.ts +2 -2
  225. package/src/common/operations/operation-handler-registry.ts +1 -12
  226. package/src/common/operations/operation-handler.ts +2 -2
  227. package/src/common/protocol/client-action.ts +38 -0
  228. package/src/common/protocol/glsp-server.spec.ts +11 -10
  229. package/src/common/protocol/glsp-server.ts +11 -14
  230. package/src/common/session/client-session-factory.spec.ts +2 -2
  231. package/src/common/session/client-session-factory.ts +3 -3
  232. package/src/common/session/client-session-manager.spec.ts +4 -3
  233. package/src/common/utils/client-options-util.ts +8 -0
  234. package/src/common/utils/promise-queue.ts +4 -5
  235. package/src/common/utils/registry.spec.ts +3 -1
  236. package/src/common/utils/registry.ts +8 -3
  237. package/src/node/abstract-json-model-storage.ts +8 -2
  238. package/src/node/launch/cli-parser.ts +1 -1
@@ -47,7 +47,7 @@ describe('test DefaultClientSessionFactory', () => {
47
47
  const factory = container.resolve(DefaultClientSessionFactory);
48
48
 
49
49
  it('create - new client session', () => {
50
- const session = factory.create({ clientSessionId, diagramType });
50
+ const session = factory.create({ clientSessionId, diagramType, clientActionKinds: [] });
51
51
  expect(session.id).to.be.equal(clientSessionId);
52
52
  expect(session.diagramType).to.be.equal(diagramType);
53
53
  expect(session.container.parent).to.be.equal(container);
@@ -55,6 +55,6 @@ describe('test DefaultClientSessionFactory', () => {
55
55
  });
56
56
 
57
57
  it('create - unknown diagram type', () => {
58
- expect(() => factory.create({ clientSessionId, diagramType: 'unknown-type' })).to.throw(GLSPServerError);
58
+ expect(() => factory.create({ clientSessionId, diagramType: 'unknown-type', clientActionKinds: [] })).to.throw(GLSPServerError);
59
59
  });
60
60
  });
@@ -52,18 +52,18 @@ export class DefaultClientSessionFactory implements ClientSessionFactory {
52
52
  protected glspClient: GLSPClientProxy;
53
53
 
54
54
  create(params: InitializeClientSessionParameters): ClientSession {
55
- const { clientSessionId: id, diagramType, args } = params;
55
+ const { clientSessionId: clientId, diagramType, clientActionKinds, args } = params;
56
56
  const diagramModules = this.diagramModules.get(diagramType);
57
57
  if (!diagramModules || diagramModules.length === 0) {
58
58
  throw new GLSPServerError(`Could not retrieve diagram module configuration for diagram type: '${diagramType}''`);
59
59
  }
60
60
 
61
- const sessionModule = createClientSessionModule(id, this.glspClient);
61
+ const sessionModule = createClientSessionModule({ clientId, glspClient: this.glspClient, clientActionKinds });
62
62
  const sessionContainer = this.serverContainer.createChild();
63
63
  sessionContainer.load(...diagramModules, sessionModule);
64
64
  const initializers = sessionContainer.getAll<ClientSessionInitializer>(ClientSessionInitializer);
65
65
  initializers.forEach(service => service.initialize(args));
66
66
  const actionDispatcher = sessionContainer.get<ActionDispatcher>(ActionDispatcher);
67
- return new DefaultClientSession(id, diagramType, actionDispatcher, sessionContainer);
67
+ return new DefaultClientSession(clientId, diagramType, actionDispatcher, sessionContainer);
68
68
  }
69
69
  }
@@ -13,13 +13,13 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { expect } from 'chai';
16
17
  import { Container, ContainerModule } from 'inversify';
18
+ import * as sinon from 'sinon';
17
19
  import * as mock from '../test/mock-util';
18
20
  import { Logger } from '../utils/logger';
19
21
  import { ClientSessionFactory } from './client-session-factory';
20
22
  import { DefaultClientSessionManager } from './client-session-manager';
21
- import { expect } from 'chai';
22
- import * as sinon from 'sinon';
23
23
 
24
24
  describe('test DefaultClientSessionManager', () => {
25
25
  const testSession = mock.createClientSession('myId', 'myDiagram');
@@ -47,7 +47,8 @@ describe('test DefaultClientSessionManager', () => {
47
47
  // Test execution
48
48
  const createdSession = sessionManager.getOrCreateClientSession({
49
49
  clientSessionId: testSession.id,
50
- diagramType: testSession.diagramType
50
+ diagramType: testSession.diagramType,
51
+ clientActionKinds: []
51
52
  });
52
53
  expect(createdSession).to.not.be.undefined;
53
54
  expect(createdSession.id).to.be.equal(testSession.id);
@@ -13,10 +13,18 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { Args } from '@eclipse-glsp/protocol';
17
+ import { ArgsUtil } from './args-util';
18
+
16
19
  export class ClientOptionsUtil {
17
20
  private static FILE_PREFIX = 'file://';
21
+ public static IS_RECONNECTING = 'isReconnecting';
18
22
 
19
23
  public static adaptUri(uri: string): string {
20
24
  return uri.replace(this.FILE_PREFIX, '');
21
25
  }
26
+
27
+ public static isReconnecting(options?: Args): boolean {
28
+ return ArgsUtil.getBoolean(options, ClientOptionsUtil.IS_RECONNECTING);
29
+ }
22
30
  }
@@ -62,14 +62,13 @@ export class PromiseQueue<T = void> {
62
62
  return false;
63
63
  }
64
64
 
65
- try {
66
- this.busy = true;
67
- this.resolveQueuedPromise(element);
68
- } catch (error) {
65
+ this.busy = true;
66
+ this.resolveQueuedPromise(element).catch(error => {
69
67
  element.reject(error);
70
68
  this.busy = false;
71
69
  this.dequeue();
72
- }
70
+ });
71
+
73
72
  return true;
74
73
  }
75
74
 
@@ -13,14 +13,16 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { MultiRegistry, Registry } from './registry';
17
16
  import { expect } from 'chai';
17
+ import { NullLogger } from './logger';
18
+ import { MultiRegistry, Registry } from './registry';
18
19
 
19
20
  describe('Test Registry', () => {
20
21
  let registry: Registry<string, string>;
21
22
 
22
23
  beforeEach(() => {
23
24
  registry = new Registry();
25
+ registry['logger'] = new NullLogger();
24
26
  });
25
27
 
26
28
  it('register - with new key-value pair', () => {
@@ -14,7 +14,8 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  import { remove } from '@eclipse-glsp/protocol/lib/utils/array-util';
17
- import { injectable } from 'inversify';
17
+ import { inject, injectable } from 'inversify';
18
+ import { Logger } from './logger';
18
19
 
19
20
  /**
20
21
  * A registry manages a set of key-value pairs and provides query functionality. In GLSP this is typically used to
@@ -27,6 +28,9 @@ import { injectable } from 'inversify';
27
28
 
28
29
  @injectable()
29
30
  export class Registry<K, V> {
31
+ @inject(Logger)
32
+ protected logger: Logger;
33
+
30
34
  protected elements: Map<K, V> = new Map();
31
35
  /**
32
36
  * Registers a new key-value pair.
@@ -36,11 +40,12 @@ export class Registry<K, V> {
36
40
  * @returns `true` if the pair was registered successfully, `false` if another pair with the same key is already
37
41
  * registered.
38
42
  */
39
- register(key: K, instance: V): boolean {
43
+ register(key: K, value: V): boolean {
40
44
  if (!this.hasKey(key)) {
41
- this.elements.set(key, instance);
45
+ this.elements.set(key, value);
42
46
  return true;
43
47
  }
48
+ this.logger.warn('Could not register key-value pair. Key is already registered', { key, value });
44
49
  return false;
45
50
  }
46
51
 
@@ -14,8 +14,9 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  import { MaybePromise, RequestModelAction, SaveModelAction, TypeGuard } from '@eclipse-glsp/protocol';
17
- import * as fs from 'fs-extra';
17
+ import * as fs from 'fs';
18
18
  import { inject, injectable } from 'inversify';
19
+ import * as os from 'os';
19
20
  import { fileURLToPath } from 'url';
20
21
  import { ModelState, SOURCE_URI_ARG } from '../common/features/model/model-state';
21
22
  import { SourceModelStorage } from '../common/features/model/source-model-storage';
@@ -91,7 +92,12 @@ export abstract class AbstractJsonModelStorage implements SourceModelStorage {
91
92
  }
92
93
 
93
94
  protected toPath(sourceUri: string): string {
94
- return sourceUri.startsWith('file://') ? fileURLToPath(sourceUri) : sourceUri;
95
+ let path = sourceUri.startsWith('file://') ? fileURLToPath(sourceUri) : sourceUri;
96
+ if (os.platform() === 'win32') {
97
+ // Remove the leading slash if it exists (Windows paths don't have it)
98
+ path = path.replace(/^\//, '');
99
+ }
100
+ return path;
95
101
  }
96
102
 
97
103
  protected getFileUri(action: SaveModelAction): string {
@@ -14,7 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  import * as cmd from 'commander';
17
- import * as fs from 'fs-extra';
17
+ import * as fs from 'fs';
18
18
  import * as path from 'path';
19
19
  import { LogLevel, LoggerConfigOptions, asLogLevel } from '../../common/utils/logger';
20
20