@eclipse-glsp/server 1.1.0-next.ea31916.59 → 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.
- package/lib/common/features/model/model-submission-handler.d.ts +2 -0
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +10 -0
- package/lib/common/features/model/model-submission-handler.js.map +1 -1
- package/lib/common/features/model/request-model-action-handler.d.ts +1 -0
- package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
- package/lib/common/features/model/request-model-action-handler.js +20 -1
- package/lib/common/features/model/request-model-action-handler.js.map +1 -1
- package/lib/common/features/validation/model-validator.d.ts +47 -2
- package/lib/common/features/validation/model-validator.d.ts.map +1 -1
- package/lib/common/features/validation/model-validator.js +79 -1
- package/lib/common/features/validation/model-validator.js.map +1 -1
- package/lib/common/features/validation/request-markers-handler.d.ts +15 -0
- package/lib/common/features/validation/request-markers-handler.d.ts.map +1 -1
- package/lib/common/features/validation/request-markers-handler.js +3 -9
- package/lib/common/features/validation/request-markers-handler.js.map +1 -1
- package/lib/common/utils/client-options-util.d.ts +3 -0
- package/lib/common/utils/client-options-util.d.ts.map +1 -1
- package/lib/common/utils/client-options-util.js +5 -15
- package/lib/common/utils/client-options-util.js.map +1 -1
- package/lib/node/abstract-json-model-storage.d.ts.map +1 -1
- package/lib/node/abstract-json-model-storage.js +8 -2
- package/lib/node/abstract-json-model-storage.js.map +1 -1
- package/lib/node/launch/cli-parser.js +1 -1
- package/lib/node/launch/cli-parser.js.map +1 -1
- package/package.json +3 -4
- package/src/common/features/model/model-submission-handler.ts +12 -0
- package/src/common/features/model/request-model-action-handler.ts +20 -1
- package/src/common/features/validation/model-validator.ts +75 -3
- package/src/common/features/validation/request-markers-handler.ts +4 -10
- package/src/common/utils/client-options-util.ts +8 -0
- package/src/node/abstract-json-model-storage.ts +8 -2
- package/src/node/launch/cli-parser.ts +1 -1
|
@@ -18,6 +18,7 @@ import { Action, DirtyStateChangeReason, MaybePromise } from '@eclipse-glsp/prot
|
|
|
18
18
|
import { CommandStack } from '../../command/command-stack';
|
|
19
19
|
import { DiagramConfiguration } from '../../diagram/diagram-configuration';
|
|
20
20
|
import { LayoutEngine } from '../layout/layout-engine';
|
|
21
|
+
import { ModelValidator } from '../validation/model-validator';
|
|
21
22
|
import { GModelFactory } from './gmodel-factory';
|
|
22
23
|
import { GModelSerializer } from './gmodel-serializer';
|
|
23
24
|
import { ModelState } from './model-state';
|
|
@@ -28,6 +29,7 @@ export declare class ModelSubmissionHandler {
|
|
|
28
29
|
protected modelState: ModelState;
|
|
29
30
|
protected layoutEngine: LayoutEngine;
|
|
30
31
|
protected commandStack: CommandStack;
|
|
32
|
+
protected validator?: ModelValidator;
|
|
31
33
|
/**
|
|
32
34
|
* Returns a list of actions to update the client-side model, based on the specified <code>modelState</code>.
|
|
33
35
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-submission-handler.d.ts","sourceRoot":"","sources":["../../../../src/common/features/model/model-submission-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACH,MAAM,EACN,sBAAsB,
|
|
1
|
+
{"version":3,"file":"model-submission-handler.d.ts","sourceRoot":"","sources":["../../../../src/common/features/model/model-submission-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACH,MAAM,EACN,sBAAsB,EAEtB,YAAY,EAMf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAoB,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qBACa,sBAAsB;IAE/B,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAGrD,SAAS,CAAC,UAAU,EAAE,gBAAgB,CAAC;IAGvC,SAAS,CAAC,YAAY,EAAE,aAAa,CAAC;IAGtC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAIjC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAGrC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAIrC,SAAS,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC;IAErC;;;;;;;;OAQG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAWpE;;;;;;;;;;;;;OAaG;IACG,mBAAmB,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAsB7E,SAAS,CAAC,eAAe,IAAI,gBAAgB;CAGhD"}
|
|
@@ -15,6 +15,7 @@ const inversify_1 = require("inversify");
|
|
|
15
15
|
const command_stack_1 = require("../../command/command-stack");
|
|
16
16
|
const diagram_configuration_1 = require("../../diagram/diagram-configuration");
|
|
17
17
|
const layout_engine_1 = require("../layout/layout-engine");
|
|
18
|
+
const model_validator_1 = require("../validation/model-validator");
|
|
18
19
|
const gmodel_factory_1 = require("./gmodel-factory");
|
|
19
20
|
const gmodel_serializer_1 = require("./gmodel-serializer");
|
|
20
21
|
const model_state_1 = require("./model-state");
|
|
@@ -64,6 +65,10 @@ let ModelSubmissionHandler = exports.ModelSubmissionHandler = class ModelSubmiss
|
|
|
64
65
|
if (!this.diagramConfiguration.needsClientLayout) {
|
|
65
66
|
result.push(protocol_1.SetDirtyStateAction.create(this.commandStack.isDirty, { reason }));
|
|
66
67
|
}
|
|
68
|
+
if (this.validator) {
|
|
69
|
+
const markers = await this.validator.validate([this.modelState.root], protocol_1.MarkersReason.LIVE);
|
|
70
|
+
result.push(protocol_1.SetMarkersAction.create(markers, { reason: protocol_1.MarkersReason.LIVE }));
|
|
71
|
+
}
|
|
67
72
|
return result;
|
|
68
73
|
}
|
|
69
74
|
serializeGModel() {
|
|
@@ -95,6 +100,11 @@ __decorate([
|
|
|
95
100
|
(0, inversify_1.inject)(command_stack_1.CommandStack),
|
|
96
101
|
__metadata("design:type", Object)
|
|
97
102
|
], ModelSubmissionHandler.prototype, "commandStack", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, inversify_1.inject)(model_validator_1.ModelValidator),
|
|
105
|
+
(0, inversify_1.optional)(),
|
|
106
|
+
__metadata("design:type", Object)
|
|
107
|
+
], ModelSubmissionHandler.prototype, "validator", void 0);
|
|
98
108
|
exports.ModelSubmissionHandler = ModelSubmissionHandler = __decorate([
|
|
99
109
|
(0, inversify_1.injectable)()
|
|
100
110
|
], ModelSubmissionHandler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-submission-handler.js","sourceRoot":"","sources":["../../../../src/common/features/model/model-submission-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,
|
|
1
|
+
{"version":3,"file":"model-submission-handler.js","sourceRoot":"","sources":["../../../../src/common/features/model/model-submission-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,qDAUgC;AAEhC,yCAAyD;AACzD,+DAA2D;AAC3D,+EAA6F;AAC7F,2DAAuD;AACvD,mEAA+D;AAC/D,qDAAiD;AACjD,2DAAuD;AACvD,+CAA2C;AAGpC,IAAM,sBAAsB,oCAA5B,MAAM,sBAAsB;IAwB/B;;;;;;;;OAQG;IACH,WAAW,CAAC,MAA+B;;QACvC,IAAI,CAAC,YAAY,CAAC,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EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;SAClF;QACD,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,wBAAa,CAAC,IAAI,CAAC,CAAC;YAC1F,MAAM,CAAC,IAAI,CAAC,2BAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,wBAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SACjF;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAES,eAAe;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;CACJ,CAAA;AAjFa;IADT,IAAA,kBAAM,EAAC,4CAAoB,CAAC;;oEACwB;AAG3C;IADT,IAAA,kBAAM,EAAC,oCAAgB,CAAC;;0DACc;AAG7B;IADT,IAAA,kBAAM,EAAC,8BAAa,CAAC;;4DACgB;AAG5B;IADT,IAAA,kBAAM,EAAC,wBAAU,CAAC;;0DACc;AAIvB;IAFT,IAAA,kBAAM,EAAC,4BAAY,CAAC;IACpB,IAAA,oBAAQ,GAAE;;4DAC0B;AAG3B;IADT,IAAA,kBAAM,EAAC,4BAAY,CAAC;;4DACgB;AAI3B;IAFT,IAAA,kBAAM,EAAC,gCAAc,CAAC;IACtB,IAAA,oBAAQ,GAAE;;yDAC0B;iCAtB5B,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAmFlC"}
|
|
@@ -29,6 +29,7 @@ export declare class RequestModelActionHandler implements ActionHandler {
|
|
|
29
29
|
protected submissionHandler: ModelSubmissionHandler;
|
|
30
30
|
protected progressService: ProgressService;
|
|
31
31
|
execute(action: RequestModelAction): Promise<Action[]>;
|
|
32
|
+
protected handleReconnect(action: RequestModelAction): Promise<void>;
|
|
32
33
|
protected reportModelLoading(message: string): ProgressMonitor;
|
|
33
34
|
protected reportModelLoadingFinished(monitor: ProgressMonitor): void;
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-model-action-handler.d.ts","sourceRoot":"","sources":["../../../../src/common/features/model/request-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAsB,MAAM,wBAAwB,CAAC;AAExF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"request-model-action-handler.d.ts","sourceRoot":"","sources":["../../../../src/common/features/model/request-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAsB,MAAM,wBAAwB,CAAC;AAExF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,qBACa,yBAA0B,YAAW,aAAa;IAC3D,WAAW,WAA6B;IAGxC,OAAO,CAAC,MAAM,CAAS;IAGvB,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAGjD,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAG7C,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAGjC,SAAS,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IAGpD,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAErC,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;cAkB5C,eAAe,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1E,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;IAK9D,SAAS,CAAC,0BAA0B,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAIvE"}
|
|
@@ -28,6 +28,7 @@ exports.RequestModelActionHandler = void 0;
|
|
|
28
28
|
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
29
29
|
const inversify_1 = require("inversify");
|
|
30
30
|
const action_dispatcher_1 = require("../../actions/action-dispatcher");
|
|
31
|
+
const client_options_util_1 = require("../../utils/client-options-util");
|
|
31
32
|
const logger_1 = require("../../utils/logger");
|
|
32
33
|
const progress_service_1 = require("../progress/progress-service");
|
|
33
34
|
const model_state_1 = require("./model-state");
|
|
@@ -41,11 +42,29 @@ let RequestModelActionHandler = exports.RequestModelActionHandler = class Reques
|
|
|
41
42
|
var _a;
|
|
42
43
|
this.logger.debug('Execute RequestModelAction:', action);
|
|
43
44
|
this.modelState.setAll((_a = action.options) !== null && _a !== void 0 ? _a : {});
|
|
45
|
+
const isReconnecting = client_options_util_1.ClientOptionsUtil.isReconnecting(action.options);
|
|
44
46
|
const progress = this.reportModelLoading('Model loading in progress');
|
|
45
|
-
|
|
47
|
+
if (isReconnecting) {
|
|
48
|
+
await this.handleReconnect(action);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
await this.sourceModelStorage.loadSourceModel(action);
|
|
52
|
+
}
|
|
46
53
|
this.reportModelLoadingFinished(progress);
|
|
47
54
|
return this.submissionHandler.submitModel();
|
|
48
55
|
}
|
|
56
|
+
async handleReconnect(action) {
|
|
57
|
+
var _a;
|
|
58
|
+
const oldModelRoot = this.modelState.root;
|
|
59
|
+
if (oldModelRoot) {
|
|
60
|
+
// decrease revision by one, as each submit will increase it by one;
|
|
61
|
+
// the next save would produce warning that source model was changed otherwise
|
|
62
|
+
this.modelState.root.revision = ((_a = this.modelState.root.revision) !== null && _a !== void 0 ? _a : 0) - 1;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
await this.sourceModelStorage.loadSourceModel(action);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
49
68
|
reportModelLoading(message) {
|
|
50
69
|
this.actionDispatcher.dispatch(protocol_1.ServerStatusAction.create(message, { severity: 'INFO' }));
|
|
51
70
|
return this.progressService.start(message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-model-action-handler.js","sourceRoot":"","sources":["../../../../src/common/features/model/request-model-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAwF;AACxF,yCAA+C;AAC/C,uEAAmE;AAEnE,+CAA4C;AAC5C,mEAAgF;AAChF,+CAA2C;AAC3C,yEAAoE;AACpE,iEAA4D;AAGrD,IAAM,yBAAyB,uCAA/B,MAAM,yBAAyB;IAA/B;QACH,gBAAW,GAAG,CAAC,6BAAkB,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"request-model-action-handler.js","sourceRoot":"","sources":["../../../../src/common/features/model/request-model-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAwF;AACxF,yCAA+C;AAC/C,uEAAmE;AAEnE,yEAAoE;AACpE,+CAA4C;AAC5C,mEAAgF;AAChF,+CAA2C;AAC3C,yEAAoE;AACpE,iEAA4D;AAGrD,IAAM,yBAAyB,uCAA/B,MAAM,yBAAyB;IAA/B;QACH,gBAAW,GAAG,CAAC,6BAAkB,CAAC,IAAI,CAAC,CAAC;IA0D5C,CAAC;IAtCG,KAAK,CAAC,OAAO,CAAC,MAA0B;;QACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,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AAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,6BAAkB,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,EAAE,CAAC;IAClB,CAAC;CACJ,CAAA;AAvDW;IADP,IAAA,kBAAM,EAAC,eAAM,CAAC;8BACC,eAAM;yDAAC;AAGb;IADT,IAAA,kBAAM,EAAC,yCAAkB,CAAC;;qEACsB;AAGvC;IADT,IAAA,kBAAM,EAAC,oCAAgB,CAAC;;mEACoB;AAGnC;IADT,IAAA,kBAAM,EAAC,wBAAU,CAAC;;6DACc;AAGvB;IADT,IAAA,kBAAM,EAAC,iDAAsB,CAAC;8BACF,iDAAsB;oEAAC;AAG1C;IADT,IAAA,kBAAM,EAAC,kCAAe,CAAC;;kEACmB;oCAnBlC,yBAAyB;IADrC,IAAA,sBAAU,GAAE;GACA,yBAAyB,CA2DrC"}
|
|
@@ -26,8 +26,53 @@ export interface ModelValidator {
|
|
|
26
26
|
* Validates the given list of {@link GModelElement}s and returns a list of {@link Marker}s.
|
|
27
27
|
*
|
|
28
28
|
* @param elements The list of {@link GModelElement} to validate.
|
|
29
|
-
* @
|
|
29
|
+
* @param reason The reason for a validation request, such as "batch" or "live" validation.
|
|
30
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}s.
|
|
30
31
|
*/
|
|
31
|
-
validate(elements: GModelElement[]): MaybePromise<Marker[]>;
|
|
32
|
+
validate(elements: GModelElement[], reason?: string): MaybePromise<Marker[]>;
|
|
33
|
+
}
|
|
34
|
+
export declare abstract class AbstractModelValidator implements ModelValidator {
|
|
35
|
+
validate(elements: GModelElement[], reason: string): Marker[];
|
|
36
|
+
/**
|
|
37
|
+
* Perform the live validation rules for the given <code>element</code>.
|
|
38
|
+
*
|
|
39
|
+
* This will be invoked on start and after each operation for all elements.
|
|
40
|
+
* Thus, the validation should be rather inexpensive.
|
|
41
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
42
|
+
* this method for all children anyway.
|
|
43
|
+
*
|
|
44
|
+
* @param element The element to validate.
|
|
45
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
46
|
+
*/
|
|
47
|
+
doLiveValidation(element: GModelElement): Marker[];
|
|
48
|
+
/**
|
|
49
|
+
* Perform the batch validation rules for the given <code>element</code>.
|
|
50
|
+
*
|
|
51
|
+
* <p>
|
|
52
|
+
* This will be invoked on demand by the client.
|
|
53
|
+
* Thus, the validation can include more expensive validation rules.
|
|
54
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
55
|
+
* this method for all children anyway.
|
|
56
|
+
* </p>
|
|
57
|
+
*
|
|
58
|
+
* @param element The element to validate.
|
|
59
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
60
|
+
*/
|
|
61
|
+
doBatchValidation(element: GModelElement): Marker[];
|
|
62
|
+
/**
|
|
63
|
+
* Perform a validation for a custom <code>reason</code> with the given <code>element</code>.
|
|
64
|
+
*
|
|
65
|
+
* <p>
|
|
66
|
+
* GLSP editors may add custom reasons for triggering a validation, other than <code>live</code> and
|
|
67
|
+
* <code>batch</code>.
|
|
68
|
+
* Validation requests that are not live or batch validations will be handled by this method.
|
|
69
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
70
|
+
* this method for all children anyway.
|
|
71
|
+
* </p>
|
|
72
|
+
*
|
|
73
|
+
* @param element The element to validate.
|
|
74
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
75
|
+
*/
|
|
76
|
+
doValidationForCustomReason(element: GModelElement): Marker[];
|
|
32
77
|
}
|
|
33
78
|
//# sourceMappingURL=model-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-validator.d.ts","sourceRoot":"","sources":["../../../../src/common/features/validation/model-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"model-validator.d.ts","sourceRoot":"","sources":["../../../../src/common/features/validation/model-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAiB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG7E,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;CAChF;AAED,8BACsB,sBAAuB,YAAW,cAAc;IAClE,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAiB7D;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE;IAIlD;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE;IAInD;;;;;;;;;;;;;OAaG;IACH,2BAA2B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE;CAGhE"}
|
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModelValidator = void 0;
|
|
9
|
+
exports.AbstractModelValidator = exports.ModelValidator = void 0;
|
|
10
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
11
|
+
const inversify_1 = require("inversify");
|
|
4
12
|
exports.ModelValidator = Symbol('ModelValidator');
|
|
13
|
+
let AbstractModelValidator = exports.AbstractModelValidator = class AbstractModelValidator {
|
|
14
|
+
validate(elements, reason) {
|
|
15
|
+
const markers = [];
|
|
16
|
+
for (const element of elements) {
|
|
17
|
+
if (protocol_1.MarkersReason.LIVE === reason) {
|
|
18
|
+
markers.push(...this.doLiveValidation(element));
|
|
19
|
+
}
|
|
20
|
+
else if (protocol_1.MarkersReason.BATCH === reason) {
|
|
21
|
+
markers.push(...this.doBatchValidation(element));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
markers.push(...this.doValidationForCustomReason(element));
|
|
25
|
+
}
|
|
26
|
+
if (element.children) {
|
|
27
|
+
markers.push(...this.validate(element.children, reason));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return markers;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Perform the live validation rules for the given <code>element</code>.
|
|
34
|
+
*
|
|
35
|
+
* This will be invoked on start and after each operation for all elements.
|
|
36
|
+
* Thus, the validation should be rather inexpensive.
|
|
37
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
38
|
+
* this method for all children anyway.
|
|
39
|
+
*
|
|
40
|
+
* @param element The element to validate.
|
|
41
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
42
|
+
*/
|
|
43
|
+
doLiveValidation(element) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Perform the batch validation rules for the given <code>element</code>.
|
|
48
|
+
*
|
|
49
|
+
* <p>
|
|
50
|
+
* This will be invoked on demand by the client.
|
|
51
|
+
* Thus, the validation can include more expensive validation rules.
|
|
52
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
53
|
+
* this method for all children anyway.
|
|
54
|
+
* </p>
|
|
55
|
+
*
|
|
56
|
+
* @param element The element to validate.
|
|
57
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
58
|
+
*/
|
|
59
|
+
doBatchValidation(element) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Perform a validation for a custom <code>reason</code> with the given <code>element</code>.
|
|
64
|
+
*
|
|
65
|
+
* <p>
|
|
66
|
+
* GLSP editors may add custom reasons for triggering a validation, other than <code>live</code> and
|
|
67
|
+
* <code>batch</code>.
|
|
68
|
+
* Validation requests that are not live or batch validations will be handled by this method.
|
|
69
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
70
|
+
* this method for all children anyway.
|
|
71
|
+
* </p>
|
|
72
|
+
*
|
|
73
|
+
* @param element The element to validate.
|
|
74
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
75
|
+
*/
|
|
76
|
+
doValidationForCustomReason(element) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.AbstractModelValidator = AbstractModelValidator = __decorate([
|
|
81
|
+
(0, inversify_1.injectable)()
|
|
82
|
+
], AbstractModelValidator);
|
|
5
83
|
//# sourceMappingURL=model-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-validator.js","sourceRoot":"","sources":["../../../../src/common/features/validation/model-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model-validator.js","sourceRoot":"","sources":["../../../../src/common/features/validation/model-validator.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,qDAA6E;AAC7E,yCAAuC;AAE1B,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAmBhD,IAAe,sBAAsB,oCAArC,MAAe,sBAAsB;IACxC,QAAQ,CAAC,QAAyB,EAAE,MAAc;QAC9C,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC5B,IAAI,wBAAa,CAAC,IAAI,KAAK,MAAM,EAAE;gBAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;aACnD;iBAAM,IAAI,wBAAa,CAAC,KAAK,KAAK,MAAM,EAAE;gBACvC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;aACpD;iBAAM;gBACH,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;aAC9D;YACD,IAAI,OAAO,CAAC,QAAQ,EAAE;gBAClB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;aAC5D;SACJ;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,OAAsB;QACnC,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,OAAsB;QACpC,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,2BAA2B,CAAC,OAAsB;QAC9C,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;iCAnEqB,sBAAsB;IAD3C,IAAA,sBAAU,GAAE;GACS,sBAAsB,CAmE3C"}
|
|
@@ -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":"
|
|
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
|
-
|
|
47
|
-
const
|
|
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
|
|
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;
|
|
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":";;;
|
|
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;
|
|
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;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
|
|
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
|
-
|
|
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
|
|
1
|
+
{"version":3,"file":"abstract-json-model-storage.js","sourceRoot":"","sources":["../../src/node/abstract-json-model-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yBAAyB;AACzB,yCAA+C;AAC/C,yBAAyB;AACzB,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,CAAC;YACtC,IAAI,CAAC,WAAW,EAAE;gBACd,WAAW,GAAG,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;gBACjD,IAAI,CAAC,WAAW,EAAE;oBACd,MAAM,IAAI,mCAAe,CAAC,8CAA8C,IAAI,cAAc,CAAC,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AC,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
|
|
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
|
|
1
|
+
{"version":3,"file":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AChC,IAAI,CAAC,KAAK,EAAE;QACR,MAAM,IAAI,GAAG,CAAC,oBAAoB,CAAC,0DAA0D,CAAC,CAAC;KAClG;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAND,0CAMC;AAED,SAAgB,aAAa,CAAC,KAAa;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,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.
|
|
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.
|
|
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": "
|
|
79
|
+
"gitHead": "f0fc2cff642fb4a62729d618b2fdd1bbb1041581"
|
|
81
80
|
}
|
|
@@ -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
|
|
|
@@ -17,6 +17,7 @@ import { Action, RequestModelAction, ServerStatusAction } from '@eclipse-glsp/pr
|
|
|
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';
|
|
21
22
|
import { ProgressMonitor, ProgressService } from '../progress/progress-service';
|
|
22
23
|
import { ModelState } from './model-state';
|
|
@@ -49,13 +50,31 @@ export class RequestModelActionHandler implements ActionHandler {
|
|
|
49
50
|
this.logger.debug('Execute RequestModelAction:', action);
|
|
50
51
|
this.modelState.setAll(action.options ?? {});
|
|
51
52
|
|
|
53
|
+
const isReconnecting = ClientOptionsUtil.isReconnecting(action.options);
|
|
54
|
+
|
|
52
55
|
const progress = this.reportModelLoading('Model loading in progress');
|
|
53
|
-
|
|
56
|
+
|
|
57
|
+
if (isReconnecting) {
|
|
58
|
+
await this.handleReconnect(action);
|
|
59
|
+
} else {
|
|
60
|
+
await this.sourceModelStorage.loadSourceModel(action);
|
|
61
|
+
}
|
|
54
62
|
this.reportModelLoadingFinished(progress);
|
|
55
63
|
|
|
56
64
|
return this.submissionHandler.submitModel();
|
|
57
65
|
}
|
|
58
66
|
|
|
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
|
+
|
|
59
78
|
protected reportModelLoading(message: string): ProgressMonitor {
|
|
60
79
|
this.actionDispatcher.dispatch(ServerStatusAction.create(message, { severity: 'INFO' }));
|
|
61
80
|
return this.progressService.start(message);
|
|
@@ -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
|
-
* @
|
|
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 {
|
|
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
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
|