@eclipse-glsp/server 1.1.0-next.e49c816.56 → 1.1.0-next.f0fc2cf.63

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 (43) hide show
  1. package/lib/common/di/diagram-module.d.ts +3 -0
  2. package/lib/common/di/diagram-module.d.ts.map +1 -1
  3. package/lib/common/di/diagram-module.js +14 -5
  4. package/lib/common/di/diagram-module.js.map +1 -1
  5. package/lib/common/features/model/model-submission-handler.d.ts +2 -0
  6. package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
  7. package/lib/common/features/model/model-submission-handler.js +10 -0
  8. package/lib/common/features/model/model-submission-handler.js.map +1 -1
  9. package/lib/common/features/model/request-model-action-handler.d.ts +5 -6
  10. package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
  11. package/lib/common/features/model/request-model-action-handler.js +34 -12
  12. package/lib/common/features/model/request-model-action-handler.js.map +1 -1
  13. package/lib/common/features/progress/progress-service.d.ts +44 -0
  14. package/lib/common/features/progress/progress-service.d.ts.map +1 -0
  15. package/lib/common/features/progress/progress-service.js +50 -0
  16. package/lib/common/features/progress/progress-service.js.map +1 -0
  17. package/lib/common/features/validation/model-validator.d.ts +47 -2
  18. package/lib/common/features/validation/model-validator.d.ts.map +1 -1
  19. package/lib/common/features/validation/model-validator.js +79 -1
  20. package/lib/common/features/validation/model-validator.js.map +1 -1
  21. package/lib/common/features/validation/request-markers-handler.d.ts +15 -0
  22. package/lib/common/features/validation/request-markers-handler.d.ts.map +1 -1
  23. package/lib/common/features/validation/request-markers-handler.js +3 -9
  24. package/lib/common/features/validation/request-markers-handler.js.map +1 -1
  25. package/lib/common/utils/client-options-util.d.ts +3 -0
  26. package/lib/common/utils/client-options-util.d.ts.map +1 -1
  27. package/lib/common/utils/client-options-util.js +5 -15
  28. package/lib/common/utils/client-options-util.js.map +1 -1
  29. package/lib/node/abstract-json-model-storage.d.ts.map +1 -1
  30. package/lib/node/abstract-json-model-storage.js +8 -2
  31. package/lib/node/abstract-json-model-storage.js.map +1 -1
  32. package/lib/node/launch/cli-parser.js +1 -1
  33. package/lib/node/launch/cli-parser.js.map +1 -1
  34. package/package.json +3 -4
  35. package/src/common/di/diagram-module.ts +20 -7
  36. package/src/common/features/model/model-submission-handler.ts +12 -0
  37. package/src/common/features/model/request-model-action-handler.ts +36 -16
  38. package/src/common/features/progress/progress-service.ts +74 -0
  39. package/src/common/features/validation/model-validator.ts +75 -3
  40. package/src/common/features/validation/request-markers-handler.ts +4 -10
  41. package/src/common/utils/client-options-util.ts +8 -0
  42. package/src/node/abstract-json-model-storage.ts +8 -2
  43. package/src/node/launch/cli-parser.ts +1 -1
@@ -1,3 +1,18 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022-2023 STMicroelectronics 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
+ ********************************************************************************/
1
16
  import { Action, RequestMarkersAction } from '@eclipse-glsp/protocol';
2
17
  import { ActionHandler } from '../../actions/action-handler';
3
18
  import { ModelState } from '../model/model-state';
@@ -1 +1 @@
1
- {"version":3,"file":"request-markers-handler.d.ts","sourceRoot":"","sources":["../../../../src/common/features/validation/request-markers-handler.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAU,oBAAoB,EAAoB,MAAM,wBAAwB,CAAC;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBACa,qBAAsB,YAAW,aAAa;IACvD,WAAW,WAA+B;IAEN,SAAS,EAAE,cAAc,CAAC;IAC1C,UAAU,EAAE,UAAU,CAAC;IAErC,OAAO,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAoBjE"}
1
+ {"version":3,"file":"request-markers-handler.d.ts","sourceRoot":"","sources":["../../../../src/common/features/validation/request-markers-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAiB,oBAAoB,EAAoB,MAAM,wBAAwB,CAAC;AAEvG,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBACa,qBAAsB,YAAW,aAAa;IACvD,WAAW,WAA+B;IAEN,SAAS,EAAE,cAAc,CAAC;IAC1C,UAAU,EAAE,UAAU,CAAC;IAErC,OAAO,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAejE"}
@@ -25,7 +25,6 @@ exports.RequestMarkersHandler = void 0;
25
25
  *
26
26
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
27
27
  ********************************************************************************/
28
- const graph_1 = require("@eclipse-glsp/graph");
29
28
  const protocol_1 = require("@eclipse-glsp/protocol");
30
29
  const inversify_1 = require("inversify");
31
30
  const glsp_server_error_1 = require("../../utils/glsp-server-error");
@@ -36,6 +35,7 @@ let RequestMarkersHandler = exports.RequestMarkersHandler = class RequestMarkers
36
35
  this.actionKinds = [protocol_1.RequestMarkersAction.KIND];
37
36
  }
38
37
  async execute(action) {
38
+ var _a;
39
39
  let elementIDs = action.elementsIDs;
40
40
  if (!this.validator) {
41
41
  throw new glsp_server_error_1.GLSPServerError('Cannot compute markers! No implementation for ModelValidator has been bound');
@@ -43,14 +43,8 @@ let RequestMarkersHandler = exports.RequestMarkersHandler = class RequestMarkers
43
43
  if (!elementIDs || elementIDs.length === 0 || (elementIDs.length === 1 && elementIDs[0] === 'EMPTY')) {
44
44
  elementIDs = [this.modelState.root.id];
45
45
  }
46
- let markers = [];
47
- const currentModelIndex = this.modelState.index;
48
- for (const elementID of elementIDs) {
49
- const modelElement = currentModelIndex.findByClass(elementID, graph_1.GGraph);
50
- if (modelElement) {
51
- markers = markers.concat(await this.validator.validate([modelElement]));
52
- }
53
- }
46
+ const modelElements = this.modelState.index.getAll(elementIDs);
47
+ const markers = await this.validator.validate(modelElements, (_a = action.reason) !== null && _a !== void 0 ? _a : protocol_1.MarkersReason.BATCH);
54
48
  return [protocol_1.SetMarkersAction.create(markers)];
55
49
  }
56
50
  };
@@ -1 +1 @@
1
- {"version":3,"file":"request-markers-handler.js","sourceRoot":"","sources":["../../../../src/common/features/validation/request-markers-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,+CAA6C;AAC7C,qDAAgG;AAChG,yCAAyD;AAEzD,qEAAgE;AAChE,sDAAkD;AAClD,uDAAmD;AAG5C,IAAM,qBAAqB,mCAA3B,MAAM,qBAAqB;IAA3B;QACH,gBAAW,GAAG,CAAC,+BAAoB,CAAC,IAAI,CAAC,CAAC;IAyB9C,CAAC;IApBG,KAAK,CAAC,OAAO,CAAC,MAA4B;QACtC,IAAI,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,MAAM,IAAI,mCAAe,CAAC,6EAA6E,CAAC,CAAC;SAC5G;QAED,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,EAAE;YAClG,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC1C;QAED,IAAI,OAAO,GAAa,EAAE,CAAC;QAC3B,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAChD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAChC,MAAM,YAAY,GAAG,iBAAiB,CAAC,WAAW,CAAC,SAAS,EAAE,cAAM,CAAC,CAAC;YACtE,IAAI,YAAY,EAAE;gBACd,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAC3E;SACJ;QACD,OAAO,CAAC,2BAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ,CAAA;AAvBuC;IAAnC,IAAA,kBAAM,EAAC,gCAAc,CAAC;IAAE,IAAA,oBAAQ,GAAE;;wDAA2B;AAC1C;IAAnB,IAAA,kBAAM,EAAC,wBAAU,CAAC;;yDAAwB;gCAJlC,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CA0BjC"}
1
+ {"version":3,"file":"request-markers-handler.js","sourceRoot":"","sources":["../../../../src/common/features/validation/request-markers-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAuG;AACvG,yCAAyD;AAEzD,qEAAgE;AAChE,sDAAkD;AAClD,uDAAmD;AAG5C,IAAM,qBAAqB,mCAA3B,MAAM,qBAAqB;IAA3B;QACH,gBAAW,GAAG,CAAC,+BAAoB,CAAC,IAAI,CAAC,CAAC;IAoB9C,CAAC;IAfG,KAAK,CAAC,OAAO,CAAC,MAA4B;;QACtC,IAAI,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,MAAM,IAAI,mCAAe,CAAC,6EAA6E,CAAC,CAAC;SAC5G;QAED,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,EAAE;YAClG,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC1C;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAA,MAAM,CAAC,MAAM,mCAAI,wBAAa,CAAC,KAAK,CAAC,CAAC;QAEnG,OAAO,CAAC,2BAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ,CAAA;AAlBuC;IAAnC,IAAA,kBAAM,EAAC,gCAAc,CAAC;IAAE,IAAA,oBAAQ,GAAE;;wDAA2B;AAC1C;IAAnB,IAAA,kBAAM,EAAC,wBAAU,CAAC;;yDAAwB;gCAJlC,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CAqBjC"}
@@ -13,8 +13,11 @@
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';
16
17
  export declare class ClientOptionsUtil {
17
18
  private static FILE_PREFIX;
19
+ static IS_RECONNECTING: string;
18
20
  static adaptUri(uri: string): string;
21
+ static isReconnecting(options?: Args): boolean;
19
22
  }
20
23
  //# sourceMappingURL=client-options-util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-options-util.d.ts","sourceRoot":"","sources":["../../../src/common/utils/client-options-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,MAAM,CAAC,WAAW,CAAa;WAEzB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAG9C"}
1
+ {"version":3,"file":"client-options-util.d.ts","sourceRoot":"","sources":["../../../src/common/utils/client-options-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,MAAM,CAAC,WAAW,CAAa;IACvC,OAAc,eAAe,SAAoB;WAEnC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;WAI7B,cAAc,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO;CAGxD"}
@@ -1,26 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientOptionsUtil = void 0;
4
- /********************************************************************************
5
- * Copyright (c) 2022-2023 STMicroelectronics and others.
6
- *
7
- * This program and the accompanying materials are made available under the
8
- * terms of the Eclipse Public License v. 2.0 which is available at
9
- * http://www.eclipse.org/legal/epl-2.0.
10
- *
11
- * This Source Code may also be made available under the following Secondary
12
- * Licenses when the conditions for such availability set forth in the Eclipse
13
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
- * with the GNU Classpath Exception which is available at
15
- * https://www.gnu.org/software/classpath/license.html.
16
- *
17
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
- ********************************************************************************/
4
+ const args_util_1 = require("./args-util");
19
5
  class ClientOptionsUtil {
20
6
  static adaptUri(uri) {
21
7
  return uri.replace(this.FILE_PREFIX, '');
22
8
  }
9
+ static isReconnecting(options) {
10
+ return args_util_1.ArgsUtil.getBoolean(options, ClientOptionsUtil.IS_RECONNECTING);
11
+ }
23
12
  }
24
13
  exports.ClientOptionsUtil = ClientOptionsUtil;
25
14
  ClientOptionsUtil.FILE_PREFIX = 'file://';
15
+ ClientOptionsUtil.IS_RECONNECTING = 'isReconnecting';
26
16
  //# sourceMappingURL=client-options-util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-options-util.js","sourceRoot":"","sources":["../../../src/common/utils/client-options-util.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,MAAa,iBAAiB;IAGnB,MAAM,CAAC,QAAQ,CAAC,GAAW;QAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;;AALL,8CAMC;AALkB,6BAAW,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"client-options-util.js","sourceRoot":"","sources":["../../../src/common/utils/client-options-util.ts"],"names":[],"mappings":";;;AAgBA,2CAAuC;AAEvC,MAAa,iBAAiB;IAInB,MAAM,CAAC,QAAQ,CAAC,GAAW;QAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,OAAc;QACvC,OAAO,oBAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC3E,CAAC;;AAVL,8CAWC;AAVkB,6BAAW,GAAG,SAAS,CAAC;AACzB,iCAAe,GAAG,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-json-model-storage.d.ts","sourceRoot":"","sources":["../../src/node/abstract-json-model-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAItG,OAAO,EAAE,UAAU,EAAkB,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAA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AC;AAKtG,OAAO,EAAE,UAAU,EAAkB,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGnF;;;GAGG;AACH,8BACsB,wBAAyB,YAAW,kBAAkB;IAExE,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAEjC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAAC,IAAI,CAAC;IAExE,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC;IAErE,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IAQ1D,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAClD,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;IAoBpE;;;;;;OAMG;IACH,SAAS,CAAC,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAIpE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAYrD,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAI9C,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAS3C,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM;IAQrD,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAM1D,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAG7C"}
@@ -10,8 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AbstractJsonModelStorage = void 0;
13
- const fs = require("fs-extra");
13
+ const fs = require("fs");
14
14
  const inversify_1 = require("inversify");
15
+ const os = require("os");
15
16
  const url_1 = require("url");
16
17
  const model_state_1 = require("../common/features/model/model-state");
17
18
  const glsp_server_error_1 = require("../common/utils/glsp-server-error");
@@ -73,7 +74,12 @@ let AbstractJsonModelStorage = exports.AbstractJsonModelStorage = class Abstract
73
74
  return JSON.parse(fileContent);
74
75
  }
75
76
  toPath(sourceUri) {
76
- return sourceUri.startsWith('file://') ? (0, url_1.fileURLToPath)(sourceUri) : sourceUri;
77
+ let path = sourceUri.startsWith('file://') ? (0, url_1.fileURLToPath)(sourceUri) : sourceUri;
78
+ if (os.platform() === 'win32') {
79
+ // Remove the leading slash if it exists (Windows paths don't have it)
80
+ path = path.replace(/^\//, '');
81
+ }
82
+ return path;
77
83
  }
78
84
  getFileUri(action) {
79
85
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-json-model-storage.js","sourceRoot":"","sources":["../../src/node/abstract-json-model-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,+BAA+B;AAC/B,yCAA+C;AAC/C,6BAAoC;AACpC,sEAAkF;AAElF,yEAAoE;AAEpE;;;GAGG;AAEI,IAAe,wBAAwB,sCAAvC,MAAe,wBAAwB;IAQhC,YAAY,CAAC,MAA0B;;QAC7C,MAAM,SAAS,GAAG,MAAA,MAAM,CAAC,OAAO,0CAAG,4BAAc,CAAC,CAAC;QACnD,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YAC/B,MAAM,IAAI,mCAAe,CAAC,0DAA0D,4BAAc,GAAG,CAAC,CAAC;SAC1G;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAIS,YAAY,CAAI,SAAiB,EAAE,KAAoB;QAC7D,IAAI;YACA,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACpC,IAAI,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAA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,CAAC;IAES,MAAM,CAAC,SAAiB;QAC9B,IAAI,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,mBAAa,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClF,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,EAAE;YAC3B,sEAAsE;YACtE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SAClC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,UAAU,CAAC,MAAuB;;QACxC,MAAM,GAAG,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,4BAAc,CAAC,CAAC;QAClE,IAAI,CAAC,GAAG,EAAE;YACN,MAAM,IAAI,mCAAe,CAAC,8DAA8D,CAAC,CAAC;SAC7F;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAES,SAAS,CAAC,OAAe,EAAE,KAAc;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrC,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAES,QAAQ,CAAC,KAAc;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAA;AAxFa;IADT,IAAA,kBAAM,EAAC,wBAAU,CAAC;;4DACc;mCAFf,wBAAwB;IAD7C,IAAA,sBAAU,GAAE;GACS,wBAAwB,CA0F7C"}
@@ -17,7 +17,7 @@ exports.isDirectory = exports.processLogDir = exports.processLogLevel = exports.
17
17
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
18
  ********************************************************************************/
19
19
  const cmd = require("commander");
20
- const fs = require("fs-extra");
20
+ const fs = require("fs");
21
21
  const path = require("path");
22
22
  const logger_1 = require("../../common/utils/logger");
23
23
  exports.defaultLaunchOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"cli-parser.js","sourceRoot":"","sources":["../../../src/node/launch/cli-parser.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iCAAiC;AACjC,+BAA+B;AAC/B,6BAA6B;AAC7B,sDAAsF;AAazE,QAAA,oBAAoB,GAA4B;IACzD,QAAQ,EAAE,iBAAQ,CAAC,IAAI;IACvB,MAAM,EAAE,SAAS;IACjB,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,KAAK;CACjB,CAAC;AAEF,SAAgB,eAAe,CAA0C,UAAyB,4BAAoB;IAClH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE;SAC5B,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,aAAa,CAAC;SAC1B,kBAAkB,CAAC,IAAI,CAAC;SACxB,IAAI,CAAC,sBAAsB,CAAC;SAC5B,MAAM,CAAC,4BAA4B,EAAE,gCAAgC,OAAO,CAAC,QAAQ,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC;SAC7H,MAAM,CACH,wBAAwB,EACxB,2EAA2E,OAAO,CAAC,MAAM,GAAG,EAC5F,aAAa,EACb,OAAO,CAAC,MAAM,CACjB;SACA,WAAW,CAAC,UAAU,EAAE,yCAAyC,CAAC,CAAC;IAExE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,CAAI,OAAO,EAAE,OAAqB,EAAE,IAAI,CAAC,EAAE,CAAC;AACtF,CAAC;AAhBD,0CAgBC;AAED,SAAgB,KAAK,CAA6B,OAAoB,EAAE,cAA0B,EAAE,IAAe;IAC/G,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,uCA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AAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;QACzE,MAAM,IAAI,GAAG,CAAC,oBAAoB,CAAC,oCAAoC,CAAC,CAAC;KAC5E;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAPD,sCAOC;AAED,SAAgB,WAAW,CAAC,KAAa;IACrC,IAAI;QACA,OAAO,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;KAC3C;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;AACL,CAAC;AAND,kCAMC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/server",
3
- "version": "1.1.0-next.e49c816.56+e49c816",
3
+ "version": "1.1.0-next.f0fc2cf.63+f0fc2cf",
4
4
  "description": "A js server framework for Eclipse GLSP",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -59,7 +59,7 @@
59
59
  "watch": "tsc -w"
60
60
  },
61
61
  "dependencies": {
62
- "@eclipse-glsp/graph": "1.1.0-next.e49c816.56+e49c816",
62
+ "@eclipse-glsp/graph": "1.1.0-next.f0fc2cf.63+f0fc2cf",
63
63
  "@eclipse-glsp/protocol": "next",
64
64
  "@types/uuid": "8.3.1",
65
65
  "commander": "^8.3.0",
@@ -68,7 +68,6 @@
68
68
  "ws": "^8.12.1"
69
69
  },
70
70
  "devDependencies": {
71
- "@types/fs-extra": "^9.0.13",
72
71
  "@types/ws": "^8.5.4"
73
72
  },
74
73
  "peerDependencies": {
@@ -77,5 +76,5 @@
77
76
  "publishConfig": {
78
77
  "access": "public"
79
78
  },
80
- "gitHead": "e49c8161b27481e4861b9429b7cab85946ce6700"
79
+ "gitHead": "f0fc2cff642fb4a62729d618b2fdd1bbb1041581"
81
80
  }
@@ -16,6 +16,7 @@
16
16
  import {
17
17
  CenterAction,
18
18
  DeleteMarkersAction,
19
+ EndProgressAction,
19
20
  ExportSvgAction,
20
21
  FitToScreenAction,
21
22
  NavigateToExternalTargetAction,
@@ -39,9 +40,11 @@ import {
39
40
  SetTypeHintsAction,
40
41
  SetViewportAction,
41
42
  SourceModelChangedAction,
43
+ StartProgressAction,
42
44
  TriggerEdgeCreationAction,
43
45
  TriggerNodeCreationAction,
44
- UpdateModelAction
46
+ UpdateModelAction,
47
+ UpdateProgressAction
45
48
  } from '@eclipse-glsp/protocol';
46
49
  import { interfaces } from 'inversify';
47
50
  import { ActionDispatcher, DefaultActionDispatcher } from '../actions/action-dispatcher';
@@ -86,6 +89,7 @@ import { RequestNavigationTargetsActionHandler } from '../features/navigation/re
86
89
  import { ResolveNavigationTargetsActionHandler } from '../features/navigation/resolve-navigation-targets-action-handler';
87
90
  import { PopupModelFactory } from '../features/popup/popup-model-factory';
88
91
  import { RequestPopupModelActionHandler } from '../features/popup/request-popup-model-action-handler';
92
+ import { DefaultProgressService, ProgressService } from '../features/progress/progress-service';
89
93
  import { ModelValidator } from '../features/validation/model-validator';
90
94
  import { RequestMarkersHandler } from '../features/validation/request-markers-handler';
91
95
  import { CompoundOperationHandler } from '../operations/compound-operation-handler';
@@ -93,7 +97,7 @@ import { OperationActionHandler } from '../operations/operation-action-handler';
93
97
  import { OperationHandlerConstructor, OperationHandlerFactory } from '../operations/operation-handler';
94
98
  import { OperationHandlerRegistry, OperationHandlerRegistryInitializer } from '../operations/operation-handler-registry';
95
99
  import { ClientSessionInitializer } from '../session/client-session-initializer';
96
- import { applyBindingTarget, applyOptionalBindingTarget, BindingTarget } from './binding-target';
100
+ import { BindingTarget, applyBindingTarget, applyOptionalBindingTarget } from './binding-target';
97
101
  import { GLSPModule } from './glsp-module';
98
102
  import { InstanceMultiBinding, MultiBinding } from './multi-binding';
99
103
  import {
@@ -133,6 +137,7 @@ import {
133
137
  * - {@link ContextActionsProviders} as {@link ClassMultiBinding<ContextActionsProvider>} (empty)
134
138
  * - {@link ContextActionsProviderRegistry}
135
139
  * - {@link ActionDispatcher}
140
+ * - {@link ProgressService}
136
141
  * - {@link ClientActionKinds} as {@link InstanceMultiBinding<string>}
137
142
  * - {@link ActionHandler} as {@link InstanceMultiBinding<ActionHandlerConstructor>}
138
143
  * - {@link ActionHandlerFactory}
@@ -217,6 +222,7 @@ export abstract class DiagramModule extends GLSPModule {
217
222
  this.configureMultiBinding(new MultiBinding<ClientSessionInitializer>(ClientSessionInitializer), binding =>
218
223
  this.configureClientSessionInitializers(binding)
219
224
  );
225
+ applyBindingTarget(context, ProgressService, this.bindProgressService()).inSingletonScope();
220
226
  applyOptionalBindingTarget(context, PopupModelFactory, this.bindPopupModelFactory());
221
227
  applyOptionalBindingTarget(context, LayoutEngine, this.bindLayoutEngine?.());
222
228
  }
@@ -308,6 +314,10 @@ export abstract class DiagramModule extends GLSPModule {
308
314
  binding.add(LayoutOperationHandler);
309
315
  }
310
316
 
317
+ protected bindProgressService(): BindingTarget<ProgressService> {
318
+ return DefaultProgressService;
319
+ }
320
+
311
321
  protected configureContextActionProviders(binding: MultiBinding<ContextActionsProvider>): void {
312
322
  // empty as default
313
323
  }
@@ -322,16 +332,17 @@ export abstract class DiagramModule extends GLSPModule {
322
332
 
323
333
  protected configureClientActions(binding: InstanceMultiBinding<string>): void {
324
334
  binding.add(CenterAction.KIND);
325
- binding.add(ExportSvgAction.KIND);
326
335
  binding.add(DeleteMarkersAction.KIND);
336
+ binding.add(EndProgressAction.KIND);
337
+ binding.add(ExportSvgAction.KIND);
327
338
  binding.add(FitToScreenAction.KIND);
328
- binding.add(SourceModelChangedAction.KIND);
329
- binding.add(NavigateToTargetAction.KIND);
330
339
  binding.add(NavigateToExternalTargetAction.KIND);
340
+ binding.add(NavigateToTargetAction.KIND);
331
341
  binding.add(RequestBoundsAction.KIND);
332
342
  binding.add(SelectAction.KIND);
333
343
  binding.add(SelectAllAction.KIND);
334
344
  binding.add(ServerMessageAction.KIND);
345
+ binding.add(ServerStatusAction.KIND);
335
346
  binding.add(SetBoundsAction.KIND);
336
347
  binding.add(SetClipboardDataAction.KIND);
337
348
  binding.add(SetContextActions.KIND);
@@ -345,10 +356,12 @@ export abstract class DiagramModule extends GLSPModule {
345
356
  binding.add(SetResolvedNavigationTargetAction.KIND);
346
357
  binding.add(SetTypeHintsAction.KIND);
347
358
  binding.add(SetViewportAction.KIND);
348
- binding.add(ServerStatusAction.KIND);
349
- binding.add(TriggerNodeCreationAction.KIND);
359
+ binding.add(SourceModelChangedAction.KIND);
360
+ binding.add(StartProgressAction.KIND);
350
361
  binding.add(TriggerEdgeCreationAction.KIND);
362
+ binding.add(TriggerNodeCreationAction.KIND);
351
363
  binding.add(UpdateModelAction.KIND);
364
+ binding.add(UpdateProgressAction.KIND);
352
365
  }
353
366
 
354
367
  protected bindContextActionsProviderRegistry(): BindingTarget<ContextActionsProviderRegistry> {
@@ -17,16 +17,20 @@ import { GModelRootSchema } from '@eclipse-glsp/graph';
17
17
  import {
18
18
  Action,
19
19
  DirtyStateChangeReason,
20
+ MarkersReason,
20
21
  MaybePromise,
21
22
  RequestBoundsAction,
22
23
  SetDirtyStateAction,
24
+ SetMarkersAction,
23
25
  SetModelAction,
24
26
  UpdateModelAction
25
27
  } from '@eclipse-glsp/protocol';
28
+
26
29
  import { inject, injectable, optional } from 'inversify';
27
30
  import { CommandStack } from '../../command/command-stack';
28
31
  import { DiagramConfiguration, ServerLayoutKind } from '../../diagram/diagram-configuration';
29
32
  import { LayoutEngine } from '../layout/layout-engine';
33
+ import { ModelValidator } from '../validation/model-validator';
30
34
  import { GModelFactory } from './gmodel-factory';
31
35
  import { GModelSerializer } from './gmodel-serializer';
32
36
  import { ModelState } from './model-state';
@@ -52,6 +56,10 @@ export class ModelSubmissionHandler {
52
56
  @inject(CommandStack)
53
57
  protected commandStack: CommandStack;
54
58
 
59
+ @inject(ModelValidator)
60
+ @optional()
61
+ protected validator?: ModelValidator;
62
+
55
63
  /**
56
64
  * Returns a list of actions to update the client-side model, based on the specified <code>modelState</code>.
57
65
  *
@@ -101,6 +109,10 @@ export class ModelSubmissionHandler {
101
109
  if (!this.diagramConfiguration.needsClientLayout) {
102
110
  result.push(SetDirtyStateAction.create(this.commandStack.isDirty, { reason }));
103
111
  }
112
+ if (this.validator) {
113
+ const markers = await this.validator.validate([this.modelState.root], MarkersReason.LIVE);
114
+ result.push(SetMarkersAction.create(markers, { reason: MarkersReason.LIVE }));
115
+ }
104
116
  return result;
105
117
  }
106
118
 
@@ -13,11 +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 { Action, RequestModelAction, ServerMessageAction, ServerStatusAction } from '@eclipse-glsp/protocol';
16
+ import { Action, RequestModelAction, ServerStatusAction } from '@eclipse-glsp/protocol';
17
17
  import { inject, injectable } from 'inversify';
18
18
  import { ActionDispatcher } from '../../actions/action-dispatcher';
19
19
  import { ActionHandler } from '../../actions/action-handler';
20
+ import { ClientOptionsUtil } from '../../utils/client-options-util';
20
21
  import { Logger } from '../../utils/logger';
22
+ import { ProgressMonitor, ProgressService } from '../progress/progress-service';
21
23
  import { ModelState } from './model-state';
22
24
  import { ModelSubmissionHandler } from './model-submission-handler';
23
25
  import { SourceModelStorage } from './source-model-storage';
@@ -41,27 +43,45 @@ export class RequestModelActionHandler implements ActionHandler {
41
43
  @inject(ModelSubmissionHandler)
42
44
  protected submissionHandler: ModelSubmissionHandler;
43
45
 
46
+ @inject(ProgressService)
47
+ protected progressService: ProgressService;
48
+
44
49
  async execute(action: RequestModelAction): Promise<Action[]> {
45
50
  this.logger.debug('Execute RequestModelAction:', action);
46
51
  this.modelState.setAll(action.options ?? {});
47
52
 
48
- this.notifyClient('Model loading in progress');
49
- await this.sourceModelStorage.loadSourceModel(action);
50
- // Clear the previous notification.
51
- this.notifyClient();
53
+ const isReconnecting = ClientOptionsUtil.isReconnecting(action.options);
54
+
55
+ const progress = this.reportModelLoading('Model loading in progress');
56
+
57
+ if (isReconnecting) {
58
+ await this.handleReconnect(action);
59
+ } else {
60
+ await this.sourceModelStorage.loadSourceModel(action);
61
+ }
62
+ this.reportModelLoadingFinished(progress);
63
+
52
64
  return this.submissionHandler.submitModel();
53
65
  }
54
66
 
55
- /**
56
- * Send a message and status notification with the given message to the client.
57
- * An empty message is an indication for the client to clear previously received notifications.
58
- * @param message The message that should be sent to the client
59
- */
60
- protected notifyClient(message = ''): void {
61
- const severity = message.length > 0 ? 'INFO' : 'NONE';
62
- this.actionDispatcher.dispatchAll(
63
- ServerMessageAction.create(message, { severity }),
64
- ServerStatusAction.create(message, { severity })
65
- );
67
+ protected async handleReconnect(action: RequestModelAction): Promise<void> {
68
+ const oldModelRoot = this.modelState.root;
69
+ if (oldModelRoot) {
70
+ // decrease revision by one, as each submit will increase it by one;
71
+ // the next save would produce warning that source model was changed otherwise
72
+ this.modelState.root.revision = (this.modelState.root.revision ?? 0) - 1;
73
+ } else {
74
+ await this.sourceModelStorage.loadSourceModel(action);
75
+ }
76
+ }
77
+
78
+ protected reportModelLoading(message: string): ProgressMonitor {
79
+ this.actionDispatcher.dispatch(ServerStatusAction.create(message, { severity: 'INFO' }));
80
+ return this.progressService.start(message);
81
+ }
82
+
83
+ protected reportModelLoadingFinished(monitor: ProgressMonitor): void {
84
+ this.actionDispatcher.dispatch(ServerStatusAction.create('', { severity: 'NONE' }));
85
+ monitor.end();
66
86
  }
67
87
  }
@@ -0,0 +1,74 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 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 { EndProgressAction, StartProgressAction, UpdateProgressAction } from '@eclipse-glsp/protocol';
17
+ import { inject, injectable } from 'inversify';
18
+ import * as uuid from 'uuid';
19
+ import { ActionDispatcher } from '../../actions/action-dispatcher';
20
+
21
+ export const ProgressService = Symbol('ProgressService');
22
+
23
+ /**
24
+ * Service for starting and monitoring progress reporting to the client.
25
+ */
26
+ export interface ProgressService {
27
+ /**
28
+ * Start a progress reporting.
29
+ * @param title The title shown in the UI for the progress reporting.
30
+ * @param options Additional optional options for the progress reporting.
31
+ * @returns a monitor to update and end the progress reporting later.
32
+ */
33
+ start(title: string, options?: ProgressOptions): ProgressMonitor;
34
+ }
35
+
36
+ /**
37
+ * Optional progress reporting options.
38
+ */
39
+ export interface ProgressOptions {
40
+ /** A message shown in the UI. */
41
+ message?: string;
42
+ /* The percentage (value range: 0 to 100) to show in the progress reporting. */
43
+ percentage?: number;
44
+ }
45
+
46
+ /**
47
+ * The monitor of a progress reporting, which can be used to update and end the reporting.
48
+ */
49
+ export interface ProgressMonitor {
50
+ /**
51
+ * Updates an ongoing progress reporting.
52
+ * @param options Updated message and/or percentage (value range: 0 to 100).
53
+ */
54
+ update(options: { message?: string; percentage?: number }): void;
55
+ /**
56
+ * Ends an ongoing progress reporting.
57
+ */
58
+ end(): void;
59
+ }
60
+
61
+ @injectable()
62
+ export class DefaultProgressService implements ProgressService {
63
+ @inject(ActionDispatcher)
64
+ protected actionDispatcher: ActionDispatcher;
65
+
66
+ start(title: string, options?: ProgressOptions): ProgressMonitor {
67
+ const progressId = uuid.v4();
68
+ this.actionDispatcher.dispatch(StartProgressAction.create({ progressId, title, ...options }));
69
+ return {
70
+ update: updateOptions => this.actionDispatcher.dispatch(UpdateProgressAction.create(progressId, updateOptions)),
71
+ end: () => this.actionDispatcher.dispatch(EndProgressAction.create(progressId))
72
+ };
73
+ }
74
+ }
@@ -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 { GModelElement } from '@eclipse-glsp/graph';
17
- import { Marker, MaybePromise } from '@eclipse-glsp/protocol';
17
+ import { Marker, MarkersReason, MaybePromise } from '@eclipse-glsp/protocol';
18
+ import { injectable } from 'inversify';
18
19
 
19
20
  export const ModelValidator = Symbol('ModelValidator');
20
21
 
@@ -28,7 +29,78 @@ export interface ModelValidator {
28
29
  * Validates the given list of {@link GModelElement}s and returns a list of {@link Marker}s.
29
30
  *
30
31
  * @param elements The list of {@link GModelElement} to validate.
31
- * @returns A list of {@link Marker}s for the validated {@link GModelElement}s.
32
+ * @param reason The reason for a validation request, such as "batch" or "live" validation.
33
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}s.
32
34
  */
33
- validate(elements: GModelElement[]): MaybePromise<Marker[]>;
35
+ validate(elements: GModelElement[], reason?: string): MaybePromise<Marker[]>;
36
+ }
37
+
38
+ @injectable()
39
+ export abstract class AbstractModelValidator implements ModelValidator {
40
+ validate(elements: GModelElement[], reason: string): Marker[] {
41
+ const markers: Marker[] = [];
42
+ for (const element of elements) {
43
+ if (MarkersReason.LIVE === reason) {
44
+ markers.push(...this.doLiveValidation(element));
45
+ } else if (MarkersReason.BATCH === reason) {
46
+ markers.push(...this.doBatchValidation(element));
47
+ } else {
48
+ markers.push(...this.doValidationForCustomReason(element));
49
+ }
50
+ if (element.children) {
51
+ markers.push(...this.validate(element.children, reason));
52
+ }
53
+ }
54
+ return markers;
55
+ }
56
+
57
+ /**
58
+ * Perform the live validation rules for the given <code>element</code>.
59
+ *
60
+ * This will be invoked on start and after each operation for all elements.
61
+ * Thus, the validation should be rather inexpensive.
62
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
63
+ * this method for all children anyway.
64
+ *
65
+ * @param element The element to validate.
66
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
67
+ */
68
+ doLiveValidation(element: GModelElement): Marker[] {
69
+ return [];
70
+ }
71
+
72
+ /**
73
+ * Perform the batch validation rules for the given <code>element</code>.
74
+ *
75
+ * <p>
76
+ * This will be invoked on demand by the client.
77
+ * Thus, the validation can include more expensive validation rules.
78
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
79
+ * this method for all children anyway.
80
+ * </p>
81
+ *
82
+ * @param element The element to validate.
83
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
84
+ */
85
+ doBatchValidation(element: GModelElement): Marker[] {
86
+ return [];
87
+ }
88
+
89
+ /**
90
+ * Perform a validation for a custom <code>reason</code> with the given <code>element</code>.
91
+ *
92
+ * <p>
93
+ * GLSP editors may add custom reasons for triggering a validation, other than <code>live</code> and
94
+ * <code>batch</code>.
95
+ * Validation requests that are not live or batch validations will be handled by this method.
96
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
97
+ * this method for all children anyway.
98
+ * </p>
99
+ *
100
+ * @param element The element to validate.
101
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
102
+ */
103
+ doValidationForCustomReason(element: GModelElement): Marker[] {
104
+ return [];
105
+ }
34
106
  }
@@ -13,8 +13,7 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { GGraph } from '@eclipse-glsp/graph';
17
- import { Action, Marker, RequestMarkersAction, SetMarkersAction } from '@eclipse-glsp/protocol';
16
+ import { Action, MarkersReason, RequestMarkersAction, SetMarkersAction } from '@eclipse-glsp/protocol';
18
17
  import { inject, injectable, optional } from 'inversify';
19
18
  import { ActionHandler } from '../../actions/action-handler';
20
19
  import { GLSPServerError } from '../../utils/glsp-server-error';
@@ -38,14 +37,9 @@ export class RequestMarkersHandler implements ActionHandler {
38
37
  elementIDs = [this.modelState.root.id];
39
38
  }
40
39
 
41
- let markers: Marker[] = [];
42
- const currentModelIndex = this.modelState.index;
43
- for (const elementID of elementIDs) {
44
- const modelElement = currentModelIndex.findByClass(elementID, GGraph);
45
- if (modelElement) {
46
- markers = markers.concat(await this.validator.validate([modelElement]));
47
- }
48
- }
40
+ const modelElements = this.modelState.index.getAll(elementIDs);
41
+ const markers = await this.validator.validate(modelElements, action.reason ?? MarkersReason.BATCH);
42
+
49
43
  return [SetMarkersAction.create(markers)];
50
44
  }
51
45
  }