sysml-v2-lsp 0.34.0 → 0.36.0
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/CHANGELOG.md +30 -0
- package/dist/server/browserServerMain.js +453 -71
- package/dist/server/mcpServer.js +420 -93
- package/dist/server/server.js +472 -90
- package/package.json +1 -1
package/dist/server/server.js
CHANGED
|
@@ -3375,8 +3375,8 @@ var require_main2 = __commonJS({
|
|
|
3375
3375
|
}
|
|
3376
3376
|
uinteger2.is = is;
|
|
3377
3377
|
})(uinteger || (exports3.uinteger = uinteger = {}));
|
|
3378
|
-
var
|
|
3379
|
-
(function(
|
|
3378
|
+
var Position3;
|
|
3379
|
+
(function(Position4) {
|
|
3380
3380
|
function create(line, character) {
|
|
3381
3381
|
if (line === Number.MAX_VALUE) {
|
|
3382
3382
|
line = uinteger.MAX_VALUE;
|
|
@@ -3386,31 +3386,31 @@ var require_main2 = __commonJS({
|
|
|
3386
3386
|
}
|
|
3387
3387
|
return { line, character };
|
|
3388
3388
|
}
|
|
3389
|
-
|
|
3389
|
+
Position4.create = create;
|
|
3390
3390
|
function is(value) {
|
|
3391
3391
|
var candidate = value;
|
|
3392
3392
|
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
|
|
3393
3393
|
}
|
|
3394
|
-
|
|
3395
|
-
})(
|
|
3396
|
-
var
|
|
3397
|
-
(function(
|
|
3394
|
+
Position4.is = is;
|
|
3395
|
+
})(Position3 || (exports3.Position = Position3 = {}));
|
|
3396
|
+
var Range3;
|
|
3397
|
+
(function(Range4) {
|
|
3398
3398
|
function create(one, two, three, four) {
|
|
3399
3399
|
if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
|
|
3400
|
-
return { start:
|
|
3401
|
-
} else if (
|
|
3400
|
+
return { start: Position3.create(one, two), end: Position3.create(three, four) };
|
|
3401
|
+
} else if (Position3.is(one) && Position3.is(two)) {
|
|
3402
3402
|
return { start: one, end: two };
|
|
3403
3403
|
} else {
|
|
3404
3404
|
throw new Error("Range#create called with invalid arguments[".concat(one, ", ").concat(two, ", ").concat(three, ", ").concat(four, "]"));
|
|
3405
3405
|
}
|
|
3406
3406
|
}
|
|
3407
|
-
|
|
3407
|
+
Range4.create = create;
|
|
3408
3408
|
function is(value) {
|
|
3409
3409
|
var candidate = value;
|
|
3410
|
-
return Is.objectLiteral(candidate) &&
|
|
3410
|
+
return Is.objectLiteral(candidate) && Position3.is(candidate.start) && Position3.is(candidate.end);
|
|
3411
3411
|
}
|
|
3412
|
-
|
|
3413
|
-
})(
|
|
3412
|
+
Range4.is = is;
|
|
3413
|
+
})(Range3 || (exports3.Range = Range3 = {}));
|
|
3414
3414
|
var Location2;
|
|
3415
3415
|
(function(Location3) {
|
|
3416
3416
|
function create(uri, range) {
|
|
@@ -3419,7 +3419,7 @@ var require_main2 = __commonJS({
|
|
|
3419
3419
|
Location3.create = create;
|
|
3420
3420
|
function is(value) {
|
|
3421
3421
|
var candidate = value;
|
|
3422
|
-
return Is.objectLiteral(candidate) &&
|
|
3422
|
+
return Is.objectLiteral(candidate) && Range3.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
|
|
3423
3423
|
}
|
|
3424
3424
|
Location3.is = is;
|
|
3425
3425
|
})(Location2 || (exports3.Location = Location2 = {}));
|
|
@@ -3431,7 +3431,7 @@ var require_main2 = __commonJS({
|
|
|
3431
3431
|
LocationLink2.create = create;
|
|
3432
3432
|
function is(value) {
|
|
3433
3433
|
var candidate = value;
|
|
3434
|
-
return Is.objectLiteral(candidate) &&
|
|
3434
|
+
return Is.objectLiteral(candidate) && Range3.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range3.is(candidate.targetSelectionRange) && (Range3.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
|
|
3435
3435
|
}
|
|
3436
3436
|
LocationLink2.is = is;
|
|
3437
3437
|
})(LocationLink || (exports3.LocationLink = LocationLink = {}));
|
|
@@ -3463,7 +3463,7 @@ var require_main2 = __commonJS({
|
|
|
3463
3463
|
ColorInformation2.create = create;
|
|
3464
3464
|
function is(value) {
|
|
3465
3465
|
var candidate = value;
|
|
3466
|
-
return Is.objectLiteral(candidate) &&
|
|
3466
|
+
return Is.objectLiteral(candidate) && Range3.is(candidate.range) && Color.is(candidate.color);
|
|
3467
3467
|
}
|
|
3468
3468
|
ColorInformation2.is = is;
|
|
3469
3469
|
})(ColorInformation || (exports3.ColorInformation = ColorInformation = {}));
|
|
@@ -3574,7 +3574,7 @@ var require_main2 = __commonJS({
|
|
|
3574
3574
|
function is(value) {
|
|
3575
3575
|
var _a;
|
|
3576
3576
|
var candidate = value;
|
|
3577
|
-
return Is.defined(candidate) &&
|
|
3577
|
+
return Is.defined(candidate) && Range3.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
|
|
3578
3578
|
}
|
|
3579
3579
|
Diagnostic7.is = is;
|
|
3580
3580
|
})(Diagnostic6 || (exports3.Diagnostic = Diagnostic6 = {}));
|
|
@@ -3614,7 +3614,7 @@ var require_main2 = __commonJS({
|
|
|
3614
3614
|
TextEdit5.del = del;
|
|
3615
3615
|
function is(value) {
|
|
3616
3616
|
var candidate = value;
|
|
3617
|
-
return Is.objectLiteral(candidate) && Is.string(candidate.newText) &&
|
|
3617
|
+
return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range3.is(candidate.range);
|
|
3618
3618
|
}
|
|
3619
3619
|
TextEdit5.is = is;
|
|
3620
3620
|
})(TextEdit4 || (exports3.TextEdit = TextEdit4 = {}));
|
|
@@ -4158,7 +4158,7 @@ var require_main2 = __commonJS({
|
|
|
4158
4158
|
InsertReplaceEdit2.create = create;
|
|
4159
4159
|
function is(value) {
|
|
4160
4160
|
var candidate = value;
|
|
4161
|
-
return candidate && Is.string(candidate.newText) &&
|
|
4161
|
+
return candidate && Is.string(candidate.newText) && Range3.is(candidate.insert) && Range3.is(candidate.replace);
|
|
4162
4162
|
}
|
|
4163
4163
|
InsertReplaceEdit2.is = is;
|
|
4164
4164
|
})(InsertReplaceEdit || (exports3.InsertReplaceEdit = InsertReplaceEdit = {}));
|
|
@@ -4205,7 +4205,7 @@ var require_main2 = __commonJS({
|
|
|
4205
4205
|
(function(Hover4) {
|
|
4206
4206
|
function is(value) {
|
|
4207
4207
|
var candidate = value;
|
|
4208
|
-
return !!candidate && Is.objectLiteral(candidate) && (MarkupContent2.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 ||
|
|
4208
|
+
return !!candidate && Is.objectLiteral(candidate) && (MarkupContent2.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range3.is(value.range));
|
|
4209
4209
|
}
|
|
4210
4210
|
Hover4.is = is;
|
|
4211
4211
|
})(Hover3 || (exports3.Hover = Hover3 = {}));
|
|
@@ -4326,7 +4326,7 @@ var require_main2 = __commonJS({
|
|
|
4326
4326
|
DocumentSymbol3.create = create;
|
|
4327
4327
|
function is(value) {
|
|
4328
4328
|
var candidate = value;
|
|
4329
|
-
return candidate && Is.string(candidate.name) && Is.number(candidate.kind) &&
|
|
4329
|
+
return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range3.is(candidate.range) && Range3.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
|
|
4330
4330
|
}
|
|
4331
4331
|
DocumentSymbol3.is = is;
|
|
4332
4332
|
})(DocumentSymbol2 || (exports3.DocumentSymbol = DocumentSymbol2 = {}));
|
|
@@ -4403,7 +4403,7 @@ var require_main2 = __commonJS({
|
|
|
4403
4403
|
CodeLens2.create = create;
|
|
4404
4404
|
function is(value) {
|
|
4405
4405
|
var candidate = value;
|
|
4406
|
-
return Is.defined(candidate) &&
|
|
4406
|
+
return Is.defined(candidate) && Range3.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
|
|
4407
4407
|
}
|
|
4408
4408
|
CodeLens2.is = is;
|
|
4409
4409
|
})(CodeLens || (exports3.CodeLens = CodeLens = {}));
|
|
@@ -4427,7 +4427,7 @@ var require_main2 = __commonJS({
|
|
|
4427
4427
|
DocumentLink2.create = create;
|
|
4428
4428
|
function is(value) {
|
|
4429
4429
|
var candidate = value;
|
|
4430
|
-
return Is.defined(candidate) &&
|
|
4430
|
+
return Is.defined(candidate) && Range3.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
|
|
4431
4431
|
}
|
|
4432
4432
|
DocumentLink2.is = is;
|
|
4433
4433
|
})(DocumentLink || (exports3.DocumentLink = DocumentLink = {}));
|
|
@@ -4439,7 +4439,7 @@ var require_main2 = __commonJS({
|
|
|
4439
4439
|
SelectionRange2.create = create;
|
|
4440
4440
|
function is(value) {
|
|
4441
4441
|
var candidate = value;
|
|
4442
|
-
return Is.objectLiteral(candidate) &&
|
|
4442
|
+
return Is.objectLiteral(candidate) && Range3.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
|
|
4443
4443
|
}
|
|
4444
4444
|
SelectionRange2.is = is;
|
|
4445
4445
|
})(SelectionRange || (exports3.SelectionRange = SelectionRange = {}));
|
|
@@ -4498,7 +4498,7 @@ var require_main2 = __commonJS({
|
|
|
4498
4498
|
InlineValueText2.create = create;
|
|
4499
4499
|
function is(value) {
|
|
4500
4500
|
var candidate = value;
|
|
4501
|
-
return candidate !== void 0 && candidate !== null &&
|
|
4501
|
+
return candidate !== void 0 && candidate !== null && Range3.is(candidate.range) && Is.string(candidate.text);
|
|
4502
4502
|
}
|
|
4503
4503
|
InlineValueText2.is = is;
|
|
4504
4504
|
})(InlineValueText || (exports3.InlineValueText = InlineValueText = {}));
|
|
@@ -4510,7 +4510,7 @@ var require_main2 = __commonJS({
|
|
|
4510
4510
|
InlineValueVariableLookup2.create = create;
|
|
4511
4511
|
function is(value) {
|
|
4512
4512
|
var candidate = value;
|
|
4513
|
-
return candidate !== void 0 && candidate !== null &&
|
|
4513
|
+
return candidate !== void 0 && candidate !== null && Range3.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
|
|
4514
4514
|
}
|
|
4515
4515
|
InlineValueVariableLookup2.is = is;
|
|
4516
4516
|
})(InlineValueVariableLookup || (exports3.InlineValueVariableLookup = InlineValueVariableLookup = {}));
|
|
@@ -4522,7 +4522,7 @@ var require_main2 = __commonJS({
|
|
|
4522
4522
|
InlineValueEvaluatableExpression2.create = create;
|
|
4523
4523
|
function is(value) {
|
|
4524
4524
|
var candidate = value;
|
|
4525
|
-
return candidate !== void 0 && candidate !== null &&
|
|
4525
|
+
return candidate !== void 0 && candidate !== null && Range3.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
|
|
4526
4526
|
}
|
|
4527
4527
|
InlineValueEvaluatableExpression2.is = is;
|
|
4528
4528
|
})(InlineValueEvaluatableExpression || (exports3.InlineValueEvaluatableExpression = InlineValueEvaluatableExpression = {}));
|
|
@@ -4534,7 +4534,7 @@ var require_main2 = __commonJS({
|
|
|
4534
4534
|
InlineValueContext2.create = create;
|
|
4535
4535
|
function is(value) {
|
|
4536
4536
|
var candidate = value;
|
|
4537
|
-
return Is.defined(candidate) &&
|
|
4537
|
+
return Is.defined(candidate) && Range3.is(value.stoppedLocation);
|
|
4538
4538
|
}
|
|
4539
4539
|
InlineValueContext2.is = is;
|
|
4540
4540
|
})(InlineValueContext || (exports3.InlineValueContext = InlineValueContext = {}));
|
|
@@ -4571,7 +4571,7 @@ var require_main2 = __commonJS({
|
|
|
4571
4571
|
InlayHint2.create = create;
|
|
4572
4572
|
function is(value) {
|
|
4573
4573
|
var candidate = value;
|
|
4574
|
-
return Is.objectLiteral(candidate) &&
|
|
4574
|
+
return Is.objectLiteral(candidate) && Position3.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit4.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent2.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
|
|
4575
4575
|
}
|
|
4576
4576
|
InlayHint2.is = is;
|
|
4577
4577
|
})(InlayHint || (exports3.InlayHint = InlayHint = {}));
|
|
@@ -4760,7 +4760,7 @@ var require_main2 = __commonJS({
|
|
|
4760
4760
|
var lineOffsets = this.getLineOffsets();
|
|
4761
4761
|
var low = 0, high = lineOffsets.length;
|
|
4762
4762
|
if (high === 0) {
|
|
4763
|
-
return
|
|
4763
|
+
return Position3.create(0, offset);
|
|
4764
4764
|
}
|
|
4765
4765
|
while (low < high) {
|
|
4766
4766
|
var mid = Math.floor((low + high) / 2);
|
|
@@ -4771,7 +4771,7 @@ var require_main2 = __commonJS({
|
|
|
4771
4771
|
}
|
|
4772
4772
|
}
|
|
4773
4773
|
var line = low - 1;
|
|
4774
|
-
return
|
|
4774
|
+
return Position3.create(line, offset - lineOffsets[line]);
|
|
4775
4775
|
};
|
|
4776
4776
|
FullTextDocument3.prototype.offsetAt = function(position) {
|
|
4777
4777
|
var lineOffsets = this.getLineOffsets();
|
|
@@ -121638,6 +121638,10 @@ var SYSML_KEYWORDS = new Set(SYSML_KEYWORDS_ARRAY);
|
|
|
121638
121638
|
function canonicalUri(uri) {
|
|
121639
121639
|
return uri.replace(/^file:\/\/\/([A-Za-z])(?::|%3[Aa])(?=\/|$)/, (_m, drive) => `file:///${drive.toLowerCase()}:`);
|
|
121640
121640
|
}
|
|
121641
|
+
function isInFolder(uri, folderUri) {
|
|
121642
|
+
const folder = canonicalUri(folderUri);
|
|
121643
|
+
return canonicalUri(uri).startsWith(folder.endsWith("/") ? folder : `${folder}/`);
|
|
121644
|
+
}
|
|
121641
121645
|
function isSameDocumentUri(a, b) {
|
|
121642
121646
|
return a === b || canonicalUri(a) === canonicalUri(b);
|
|
121643
121647
|
}
|
|
@@ -121740,6 +121744,7 @@ var v5_default = v5;
|
|
|
121740
121744
|
var NAMESPACE_URL = v5_default.URL;
|
|
121741
121745
|
var DEFAULT_URL_PREFIX = "https://github.com/daltskin/sysml-v2-lsp/";
|
|
121742
121746
|
var urlPrefix = DEFAULT_URL_PREFIX;
|
|
121747
|
+
var folderPrefixes = [];
|
|
121743
121748
|
function setProjectId(projectId) {
|
|
121744
121749
|
if (projectId === void 0) {
|
|
121745
121750
|
urlPrefix = DEFAULT_URL_PREFIX;
|
|
@@ -121749,8 +121754,14 @@ function setProjectId(projectId) {
|
|
|
121749
121754
|
urlPrefix = `urn:uuid:${projectId.toLowerCase()}/`;
|
|
121750
121755
|
return true;
|
|
121751
121756
|
}
|
|
121752
|
-
function
|
|
121753
|
-
|
|
121757
|
+
function setFolderProjectIds(projectIds) {
|
|
121758
|
+
const rejected = projectIds.filter((p) => !validate_default(p.projectId));
|
|
121759
|
+
folderPrefixes = projectIds.filter((p) => validate_default(p.projectId)).map((p) => ({ folderUri: p.folderUri, prefix: `urn:uuid:${p.projectId.toLowerCase()}/` })).sort((a, b) => b.folderUri.length - a.folderUri.length);
|
|
121760
|
+
return rejected;
|
|
121761
|
+
}
|
|
121762
|
+
function getUrlPrefix(uri) {
|
|
121763
|
+
const match = uri === void 0 ? void 0 : folderPrefixes.find((f) => isInFolder(uri, f.folderUri));
|
|
121764
|
+
return match?.prefix ?? urlPrefix;
|
|
121754
121765
|
}
|
|
121755
121766
|
function uuidV5(namespace, name) {
|
|
121756
121767
|
return v5_default(name, namespace);
|
|
@@ -121832,6 +121843,10 @@ function toMetaclassName(kind) {
|
|
|
121832
121843
|
return "RequirementDefinition";
|
|
121833
121844
|
case "requirement" /* RequirementUsage */:
|
|
121834
121845
|
return "RequirementUsage";
|
|
121846
|
+
case "concern def" /* ConcernDef */:
|
|
121847
|
+
return "ConcernDefinition";
|
|
121848
|
+
case "concern" /* ConcernUsage */:
|
|
121849
|
+
return "ConcernUsage";
|
|
121835
121850
|
case "constraint def" /* ConstraintDef */:
|
|
121836
121851
|
return "ConstraintDefinition";
|
|
121837
121852
|
case "constraint" /* ConstraintUsage */:
|
|
@@ -121954,7 +121969,7 @@ var IdRegistry = class {
|
|
|
121954
121969
|
declaration.parentId = owner?.symbolId;
|
|
121955
121970
|
const path3 = declaration.qualifiedName !== void 0 ? this.qualifiedNameAsWritten(declaration) : owner ? `${this.paths.get(owner)}/${segmentOf(declaration)}` : segmentOf(declaration);
|
|
121956
121971
|
const namespace = owner ? this.topLevelOf(owner).symbolId : NAMESPACE_URL;
|
|
121957
|
-
const key = owner ? path3 : getUrlPrefix() + encodeURIComponent(path3);
|
|
121972
|
+
const key = owner ? path3 : getUrlPrefix(declaration.uri) + encodeURIComponent(path3);
|
|
121958
121973
|
const groupId = this.uuidOf(namespace, key);
|
|
121959
121974
|
this.groupKeys.set(groupId, { namespace, key, path: path3 });
|
|
121960
121975
|
this.groupOf.set(declaration, groupId);
|
|
@@ -122139,6 +122154,12 @@ var RULE_INDEX_TO_KIND = /* @__PURE__ */ new Map([
|
|
|
122139
122154
|
// 343
|
|
122140
122155
|
[SysMLv2Parser.RULE_requirementDefinition, "requirement def" /* RequirementDef */],
|
|
122141
122156
|
// 384
|
|
122157
|
+
[SysMLv2Parser.RULE_concernDefinition, "concern def" /* ConcernDef */],
|
|
122158
|
+
// 405
|
|
122159
|
+
[SysMLv2Parser.RULE_concernUsage, "concern" /* ConcernUsage */],
|
|
122160
|
+
// 406
|
|
122161
|
+
[SysMLv2Parser.RULE_framedConcernUsage, "concern" /* ConcernUsage */],
|
|
122162
|
+
// 394
|
|
122142
122163
|
[SysMLv2Parser.RULE_constraintDefinition, "constraint def" /* ConstraintDef */],
|
|
122143
122164
|
// 380
|
|
122144
122165
|
[SysMLv2Parser.RULE_itemDefinition, "item def" /* ItemDef */],
|
|
@@ -122211,6 +122232,10 @@ var RULE_INDEX_TO_KIND = /* @__PURE__ */ new Map([
|
|
|
122211
122232
|
// 268
|
|
122212
122233
|
[SysMLv2Parser.RULE_performActionUsage, "perform action" /* PerformActionUsage */],
|
|
122213
122234
|
// 298
|
|
122235
|
+
// A state's `entry`/`do`/`exit` action (`exit action a : A;`, `exit a;`): the
|
|
122236
|
+
// StatePerformActionUsage production, a PerformActionUsage without `perform`.
|
|
122237
|
+
[SysMLv2Parser.RULE_statePerformActionUsage, "perform action" /* PerformActionUsage */],
|
|
122238
|
+
// 352
|
|
122214
122239
|
[SysMLv2Parser.RULE_exhibitStateUsage, "exhibit state" /* ExhibitStateUsage */],
|
|
122215
122240
|
// 359
|
|
122216
122241
|
[SysMLv2Parser.RULE_transitionUsage, "transition" /* TransitionUsage */],
|
|
@@ -122334,8 +122359,10 @@ var TYPE_RECURSE_RULE_INDICES = /* @__PURE__ */ new Set([
|
|
|
122334
122359
|
// 210
|
|
122335
122360
|
SysMLv2Parser.RULE_definition,
|
|
122336
122361
|
// 192
|
|
122337
|
-
SysMLv2Parser.RULE_usage
|
|
122362
|
+
SysMLv2Parser.RULE_usage,
|
|
122338
122363
|
// 208
|
|
122364
|
+
SysMLv2Parser.RULE_payloadFeatureSpecializationPart
|
|
122365
|
+
// 157
|
|
122339
122366
|
]);
|
|
122340
122367
|
var DOC_RULE_INDICES = /* @__PURE__ */ new Set([
|
|
122341
122368
|
SysMLv2Parser.RULE_comment,
|
|
@@ -122960,8 +122987,9 @@ var SymbolTable = class {
|
|
|
122960
122987
|
const shortName = transition || isFlowUsage(kind) && !declaredName ? void 0 : this.extractShortName(ctx);
|
|
122961
122988
|
const qualifiedName = anonymous || owner && owner.qualifiedName === void 0 ? void 0 : owner ? `${owner.qualifiedName}::${name}` : name;
|
|
122962
122989
|
const selectionRange = anonymous ? ctx.start ? tokenToRange(ctx.start) : range : this.extractNameRange(ctx) ?? range;
|
|
122963
|
-
const typeNames = isFlowUsage(kind) ? this.extractFlowTypeNames(ctx) : this.extractTypeNames(ctx);
|
|
122990
|
+
const typeNames = isFlowUsage(kind) ? this.extractFlowTypeNames(ctx) : transition ? this.extractTransitionTypeNames(ctx) : this.extractTypeNames(ctx);
|
|
122964
122991
|
const specializationNames = this.extractSpecializationNames(ctx);
|
|
122992
|
+
const redefinedFeatureTargets = this.extractRedefinedFeatureTargets(ctx);
|
|
122965
122993
|
const typeName = typeNames[0];
|
|
122966
122994
|
const documentation = this.extractDocumentation(ctx);
|
|
122967
122995
|
const visibility = this.extractVisibility(ctx);
|
|
@@ -122992,6 +123020,7 @@ var SymbolTable = class {
|
|
|
122992
123020
|
typeName,
|
|
122993
123021
|
typeNames,
|
|
122994
123022
|
specializationNames,
|
|
123023
|
+
redefinedFeatureTargets: redefinedFeatureTargets.length > 0 ? redefinedFeatureTargets : void 0,
|
|
122995
123024
|
documentation,
|
|
122996
123025
|
visibility,
|
|
122997
123026
|
source: transition?.source,
|
|
@@ -123075,6 +123104,25 @@ var SymbolTable = class {
|
|
|
123075
123104
|
const typeDeclaration = declaration && (this.findOwnHeaderRule(declaration, SysMLv2Parser.RULE_featureDeclaration) ?? this.findOwnHeaderRule(declaration, SysMLv2Parser.RULE_usageDeclaration));
|
|
123076
123105
|
return typeDeclaration ? this.extractTypeNames(typeDeclaration) : [];
|
|
123077
123106
|
}
|
|
123107
|
+
/**
|
|
123108
|
+
* A transition's own typing, then the types of the payload its trigger
|
|
123109
|
+
* accepts (`accept cmd : Command`, `accept Command`; TriggerAction ->
|
|
123110
|
+
* AcceptParameterPart -> PayloadParameter). Read from the parse tree only:
|
|
123111
|
+
* the regex fallback of `extractTypeNames` runs on whitespace-free text, where
|
|
123112
|
+
* the payload type runs into the guard, effect or target that follows it
|
|
123113
|
+
* (`Commandifcmd`, `Commandthenbusy`).
|
|
123114
|
+
*/
|
|
123115
|
+
extractTransitionTypeNames(ctx) {
|
|
123116
|
+
const names = [];
|
|
123117
|
+
this.collectTypeNamesFromTree(ctx, names, 0);
|
|
123118
|
+
const trigger = this.findOwnHeaderRule(ctx, SysMLv2Parser.RULE_triggerActionMember);
|
|
123119
|
+
const parameter = trigger && this.findRuleContext(trigger, SysMLv2Parser.RULE_payloadParameter);
|
|
123120
|
+
if (parameter) {
|
|
123121
|
+
const payload = this.findRuleContext(parameter, SysMLv2Parser.RULE_payloadFeature) ?? parameter;
|
|
123122
|
+
this.collectTypeNamesFromTree(payload, names, 0);
|
|
123123
|
+
}
|
|
123124
|
+
return names;
|
|
123125
|
+
}
|
|
123078
123126
|
/** Find the first descendant of `ctx` with rule `ruleIndex`, in source order. */
|
|
123079
123127
|
findRuleContext(ctx, ruleIndex) {
|
|
123080
123128
|
const matches = [];
|
|
@@ -123200,7 +123248,7 @@ var SymbolTable = class {
|
|
|
123200
123248
|
*/
|
|
123201
123249
|
anonymousDeclaration(ctx, kind, transition) {
|
|
123202
123250
|
if (!isDefinition(kind) && !isUsage(kind)) return void 0;
|
|
123203
|
-
if (transition && !(transition.source && transition.target) && this.
|
|
123251
|
+
if (transition && !(transition.source && transition.target) && this.extractTransitionTypeNames(ctx).length === 0) return void 0;
|
|
123204
123252
|
return this.declarationText(ctx);
|
|
123205
123253
|
}
|
|
123206
123254
|
/**
|
|
@@ -123224,15 +123272,28 @@ var SymbolTable = class {
|
|
|
123224
123272
|
* such as `#metadata`.
|
|
123225
123273
|
*/
|
|
123226
123274
|
findOwnHeaderRule(ctx, ruleIndex) {
|
|
123275
|
+
const matches = [];
|
|
123276
|
+
this.findOwnHeaderRules(ctx, ruleIndex, matches, true);
|
|
123277
|
+
return matches[0];
|
|
123278
|
+
}
|
|
123279
|
+
findOwnHeaderRules(ctx, ruleIndex, matches, firstOnly = false) {
|
|
123227
123280
|
for (let i = 0; i < ctx.getChildCount(); i++) {
|
|
123228
123281
|
const child = ctx.getChild(i);
|
|
123229
123282
|
if (!(child instanceof ParserRuleContext)) continue;
|
|
123230
|
-
if (child.ruleIndex === ruleIndex)
|
|
123283
|
+
if (child.ruleIndex === ruleIndex) {
|
|
123284
|
+
matches.push(child);
|
|
123285
|
+
if (firstOnly) return;
|
|
123286
|
+
continue;
|
|
123287
|
+
}
|
|
123231
123288
|
if (RULE_INDEX_TO_KIND.has(child.ruleIndex) || BODY_RULE_INDICES.has(child.ruleIndex) || child.ruleIndex === SysMLv2Parser.RULE_valuePart || FLOW_PART_RULE_INDICES.has(child.ruleIndex) || child.ruleIndex === SysMLv2Parser.RULE_ownedCrossMultiplicityMember || this.isPrefixOrExtensionContext(child)) continue;
|
|
123232
|
-
|
|
123233
|
-
if (
|
|
123289
|
+
this.findOwnHeaderRules(child, ruleIndex, matches, firstOnly);
|
|
123290
|
+
if (firstOnly && matches.length > 0) return;
|
|
123234
123291
|
}
|
|
123235
|
-
|
|
123292
|
+
}
|
|
123293
|
+
extractRedefinedFeatureTargets(ctx) {
|
|
123294
|
+
const targets = [];
|
|
123295
|
+
this.findOwnHeaderRules(ctx, SysMLv2Parser.RULE_ownedRedefinition, targets);
|
|
123296
|
+
return targets.map((target) => target.getText());
|
|
123236
123297
|
}
|
|
123237
123298
|
/**
|
|
123238
123299
|
* A connection, interface or allocation usage's end reference paths, in
|
|
@@ -123260,13 +123321,7 @@ var SymbolTable = class {
|
|
|
123260
123321
|
const segment = reference.getText().split(/::|\./).pop();
|
|
123261
123322
|
return segment ? this.unquoteName(segment) : void 0;
|
|
123262
123323
|
}
|
|
123263
|
-
|
|
123264
|
-
* An element's declaration as written, without its body: its tokens up to
|
|
123265
|
-
* its body or closing `;`, each exactly as written (a quoted name keeps its
|
|
123266
|
-
* spaces), with one space wherever the source has whitespace or a comment
|
|
123267
|
-
* between two of them (`connect a.p to b.p`, `connection : Conn`).
|
|
123268
|
-
*/
|
|
123269
|
-
declarationText(ctx) {
|
|
123324
|
+
declarationTokens(ctx) {
|
|
123270
123325
|
const tokens = [];
|
|
123271
123326
|
const visit = (node) => {
|
|
123272
123327
|
for (let i = 0; i < node.getChildCount(); i++) {
|
|
@@ -123281,6 +123336,16 @@ var SymbolTable = class {
|
|
|
123281
123336
|
return false;
|
|
123282
123337
|
};
|
|
123283
123338
|
visit(ctx);
|
|
123339
|
+
return tokens;
|
|
123340
|
+
}
|
|
123341
|
+
/**
|
|
123342
|
+
* An element's declaration as written, without its body: its tokens up to
|
|
123343
|
+
* its body or closing `;`, each exactly as written (a quoted name keeps its
|
|
123344
|
+
* spaces), with one space wherever the source has whitespace or a comment
|
|
123345
|
+
* between two of them (`connect a.p to b.p`, `connection : Conn`).
|
|
123346
|
+
*/
|
|
123347
|
+
declarationText(ctx) {
|
|
123348
|
+
const tokens = this.declarationTokens(ctx);
|
|
123284
123349
|
let text = "";
|
|
123285
123350
|
tokens.forEach((token, i) => {
|
|
123286
123351
|
if (i > 0 && token.start > tokens[i - 1].stop + 1) text += " ";
|
|
@@ -123421,17 +123486,16 @@ var SymbolTable = class {
|
|
|
123421
123486
|
const names = [];
|
|
123422
123487
|
this.collectTypeNamesFromTree(ctx, names, 0);
|
|
123423
123488
|
if (names.length > 0) return names;
|
|
123424
|
-
const
|
|
123425
|
-
|
|
123426
|
-
let text = braceIdx >= 0 ? fullText.substring(0, braceIdx) : fullText;
|
|
123489
|
+
const { text: declarationText, quotedName } = this.maskedDeclaration(ctx);
|
|
123490
|
+
let text = declarationText;
|
|
123427
123491
|
text = text.replace(RE_KEYWORD_TRUNCATE, "");
|
|
123428
123492
|
const specMatch = text.match(RE_SPEC);
|
|
123429
123493
|
if (specMatch) {
|
|
123430
123494
|
const specStr = text.substring(text.indexOf(specMatch[0]) + specMatch[0].indexOf(specMatch[1]));
|
|
123431
123495
|
for (const part of specStr.split(",")) {
|
|
123432
|
-
const
|
|
123433
|
-
if (
|
|
123434
|
-
names.push(
|
|
123496
|
+
const quoted = quotedName(part);
|
|
123497
|
+
if (quoted !== void 0) {
|
|
123498
|
+
names.push(quoted);
|
|
123435
123499
|
continue;
|
|
123436
123500
|
}
|
|
123437
123501
|
const m2 = part.trim().match(RE_IDENT_START);
|
|
@@ -123452,9 +123516,9 @@ var SymbolTable = class {
|
|
|
123452
123516
|
const fullMatchIdx = text.indexOf(typingMatch[0]);
|
|
123453
123517
|
const afterColon = text.substring(fullMatchIdx + 1).trim();
|
|
123454
123518
|
for (const part of afterColon.split(",")) {
|
|
123455
|
-
const
|
|
123456
|
-
if (
|
|
123457
|
-
names.push(
|
|
123519
|
+
const quoted = quotedName(part);
|
|
123520
|
+
if (quoted !== void 0) {
|
|
123521
|
+
names.push(quoted);
|
|
123458
123522
|
continue;
|
|
123459
123523
|
}
|
|
123460
123524
|
const m2 = part.trim().match(RE_IDENT_START);
|
|
@@ -123464,6 +123528,28 @@ var SymbolTable = class {
|
|
|
123464
123528
|
}
|
|
123465
123529
|
return names;
|
|
123466
123530
|
}
|
|
123531
|
+
/**
|
|
123532
|
+
* The declaration tokens before the body, with each lexer STRING token
|
|
123533
|
+
* replaced by a numbered placeholder (`'0'`, `'1'`, ...), and
|
|
123534
|
+
* `quotedName`, which turns a placeholder in a part of that text back into
|
|
123535
|
+
* the name. SysML 2.0 section 7.2.2 permits punctuation in unrestricted
|
|
123536
|
+
* names (the STRING lexer production), so fallback regexes must never see
|
|
123537
|
+
* their `:`, `:>`, `{` or keywords. Documentation is not a name token.
|
|
123538
|
+
*/
|
|
123539
|
+
maskedDeclaration(ctx) {
|
|
123540
|
+
const quoted = [];
|
|
123541
|
+
const masked = this.declarationTokens(ctx).map((token) => {
|
|
123542
|
+
const text = token.text ?? "";
|
|
123543
|
+
return token.type === SysMLv2Lexer.STRING ? `'${quoted.push(text.slice(1, -1)) - 1}'` : text;
|
|
123544
|
+
}).join("");
|
|
123545
|
+
return {
|
|
123546
|
+
text: masked,
|
|
123547
|
+
quotedName: (part) => {
|
|
123548
|
+
const qm = part.match(RE_QUOTED_NAME);
|
|
123549
|
+
return qm ? quoted[Number(qm[1])] : void 0;
|
|
123550
|
+
}
|
|
123551
|
+
};
|
|
123552
|
+
}
|
|
123467
123553
|
/**
|
|
123468
123554
|
* Extract only the specialization names (:> / specializes / subsets) from a context.
|
|
123469
123555
|
* Uses the same tree-walk as extractTypeNames but restricted to
|
|
@@ -123474,17 +123560,15 @@ var SymbolTable = class {
|
|
|
123474
123560
|
const names = [];
|
|
123475
123561
|
this.collectNamesFromTree(ctx, names, 0, TYPE_SPECIALIZATION_RULE_INDICES);
|
|
123476
123562
|
if (names.length > 0) return names;
|
|
123477
|
-
const
|
|
123478
|
-
const
|
|
123479
|
-
let text = braceIdx >= 0 ? fullText.substring(0, braceIdx) : fullText;
|
|
123480
|
-
text = text.replace(RE_KEYWORD_TRUNCATE_SPEC, "");
|
|
123563
|
+
const { text: declarationText, quotedName } = this.maskedDeclaration(ctx);
|
|
123564
|
+
const text = declarationText.replace(RE_KEYWORD_TRUNCATE_SPEC, "");
|
|
123481
123565
|
const specMatch = text.match(RE_SPEC_WITH_SUBSETS);
|
|
123482
123566
|
if (specMatch) {
|
|
123483
123567
|
const specStr = text.substring(text.indexOf(specMatch[0]) + specMatch[0].indexOf(specMatch[1]));
|
|
123484
123568
|
for (const part of specStr.split(",")) {
|
|
123485
|
-
const
|
|
123486
|
-
if (
|
|
123487
|
-
names.push(
|
|
123569
|
+
const quoted = quotedName(part);
|
|
123570
|
+
if (quoted !== void 0) {
|
|
123571
|
+
names.push(quoted);
|
|
123488
123572
|
continue;
|
|
123489
123573
|
}
|
|
123490
123574
|
const m2 = part.trim().match(RE_IDENT_START);
|
|
@@ -124280,6 +124364,17 @@ var DocumentManager = class {
|
|
|
124280
124364
|
}
|
|
124281
124365
|
return this.wsSymbolTable;
|
|
124282
124366
|
}
|
|
124367
|
+
/**
|
|
124368
|
+
* Rebuild the symbol tables of `uris` on next use, e.g. after their projectId
|
|
124369
|
+
* changed, which changes their symbol IDs (see `setFolderProjectIds`).
|
|
124370
|
+
*/
|
|
124371
|
+
invalidateSymbols(uris) {
|
|
124372
|
+
for (const uri of uris) {
|
|
124373
|
+
const cached = this.cache.get(uri);
|
|
124374
|
+
if (cached) cached.symbolTable = void 0;
|
|
124375
|
+
this.wsBuiltVersions.delete(uri);
|
|
124376
|
+
}
|
|
124377
|
+
}
|
|
124283
124378
|
/**
|
|
124284
124379
|
* Cache semantic diagnostics for the current document version.
|
|
124285
124380
|
*/
|
|
@@ -125319,14 +125414,21 @@ var NamespaceResolver = class {
|
|
|
125319
125414
|
* namespace.
|
|
125320
125415
|
*/
|
|
125321
125416
|
isLocallyVisible(symbol, name, indexes) {
|
|
125322
|
-
return this.
|
|
125417
|
+
return this.resolveNameFrom(symbol, name, indexes) !== void 0;
|
|
125418
|
+
}
|
|
125419
|
+
/**
|
|
125420
|
+
* Resolve a (possibly qualified) name from the namespace containing
|
|
125421
|
+
* `symbol`, respecting namespace membership and visibility.
|
|
125422
|
+
*/
|
|
125423
|
+
resolveNameFrom(symbol, name, indexes) {
|
|
125424
|
+
return this.resolveQualifiedNameFrom(ownerKeyOf(symbol, indexes.byId), name, indexes);
|
|
125323
125425
|
}
|
|
125324
125426
|
/**
|
|
125325
125427
|
* Resolve a (possibly qualified) name to its symbol per §7.5.1, searching
|
|
125326
125428
|
* outward from namespace `start` and its enclosing namespaces (its own resolved
|
|
125327
125429
|
* members first, then its parent's, ...). Shared by `isLocallyVisible` (an
|
|
125328
|
-
* ordinary reference resolving relative to its own enclosing namespace)
|
|
125329
|
-
* import-target resolution (an `import` declaration's target is itself a
|
|
125430
|
+
* ordinary reference resolving relative to its own enclosing namespace),
|
|
125431
|
+
* `resolveNameFrom`, and import-target resolution (an `import` declaration's target is itself a
|
|
125330
125432
|
* qualifiedName, resolved the same relative way -- not as an absolute/global
|
|
125331
125433
|
* name -- so a bare `import C;` inside a nested package can pick up a `C`
|
|
125332
125434
|
* its own enclosing package already imported, per §7.5.1/§7.5.3).
|
|
@@ -128273,6 +128375,8 @@ function toSysMLSymbolKind(kind) {
|
|
|
128273
128375
|
// Requirements → Object
|
|
128274
128376
|
case "requirement def" /* RequirementDef */:
|
|
128275
128377
|
case "requirement" /* RequirementUsage */:
|
|
128378
|
+
case "concern def" /* ConcernDef */:
|
|
128379
|
+
case "concern" /* ConcernUsage */:
|
|
128276
128380
|
case "actor" /* ActorUsage */:
|
|
128277
128381
|
case "subject" /* SubjectUsage */:
|
|
128278
128382
|
case "stakeholder" /* StakeholderUsage */:
|
|
@@ -129531,6 +129635,13 @@ var CONSTRAINT_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
129531
129635
|
"assert",
|
|
129532
129636
|
"assume"
|
|
129533
129637
|
]);
|
|
129638
|
+
var CONNECTOR_KINDS = /* @__PURE__ */ new Set([
|
|
129639
|
+
"connection" /* ConnectionUsage */,
|
|
129640
|
+
"interface" /* InterfaceUsage */,
|
|
129641
|
+
"allocation" /* AllocationUsage */,
|
|
129642
|
+
"flow" /* FlowUsage */,
|
|
129643
|
+
"succession flow" /* SuccessionFlowUsage */
|
|
129644
|
+
]);
|
|
129534
129645
|
var SemanticValidator = class _SemanticValidator {
|
|
129535
129646
|
constructor(documentManager2) {
|
|
129536
129647
|
this.documentManager = documentManager2;
|
|
@@ -129607,7 +129718,7 @@ var SemanticValidator = class _SemanticValidator {
|
|
|
129607
129718
|
diagnostics.push(...this.checkAmbiguousNamespaceName(symbols, allSymbols));
|
|
129608
129719
|
diagnostics.push(...this.checkUnusedDefinitions(allSymbols, uri));
|
|
129609
129720
|
diagnostics.push(...this.checkRedefinitionMultiplicity(symbols, indexes, text));
|
|
129610
|
-
diagnostics.push(...this.checkPortCompatibility(text, uri, indexes));
|
|
129721
|
+
diagnostics.push(...this.checkPortCompatibility(text, uri, symbols, indexes));
|
|
129611
129722
|
diagnostics.push(...this.checkConstraintBodyReferences(text, uri, symbols, indexes));
|
|
129612
129723
|
diagnostics.push(...this.checkCircularSpecialization(symbols, indexes));
|
|
129613
129724
|
diagnostics.push(...this.checkUnsatisfiedRequirements(symbols, indexes));
|
|
@@ -129828,7 +129939,7 @@ var SemanticValidator = class _SemanticValidator {
|
|
|
129828
129939
|
opts?.text ? [opts.text] : []
|
|
129829
129940
|
));
|
|
129830
129941
|
if (opts?.text && opts.uri) {
|
|
129831
|
-
diagnostics.push(...instance.checkPortCompatibility(opts.text, opts.uri, indexes));
|
|
129942
|
+
diagnostics.push(...instance.checkPortCompatibility(opts.text, opts.uri, symbolsInUri, indexes));
|
|
129832
129943
|
diagnostics.push(...instance.checkConstraintBodyReferences(opts.text, opts.uri, symbolsInUri, indexes));
|
|
129833
129944
|
}
|
|
129834
129945
|
return instance.dedupeDiagnostics(diagnostics);
|
|
@@ -130191,17 +130302,20 @@ var SemanticValidator = class _SemanticValidator {
|
|
|
130191
130302
|
* - The connection is within an interface usage
|
|
130192
130303
|
* - Both ports are untyped (empty port defs with no features)
|
|
130193
130304
|
*/
|
|
130194
|
-
checkPortCompatibility(text, uri, indexes) {
|
|
130305
|
+
checkPortCompatibility(text, uri, symbolsInUri, indexes) {
|
|
130195
130306
|
if (!text) return [];
|
|
130196
130307
|
const diagnostics = [];
|
|
130197
130308
|
const lines = text.split("\n");
|
|
130198
130309
|
const re = /\bconnect\s+([A-Za-z_][\w.]*)\s+to\s+([A-Za-z_][\w.]*)/g;
|
|
130199
130310
|
let m2;
|
|
130200
130311
|
while ((m2 = re.exec(text)) !== null) {
|
|
130201
|
-
const
|
|
130202
|
-
const
|
|
130203
|
-
const
|
|
130204
|
-
const
|
|
130312
|
+
const leftPath = m2[1].split(".");
|
|
130313
|
+
const rightPath = m2[2].split(".");
|
|
130314
|
+
const left = leftPath[leftPath.length - 1];
|
|
130315
|
+
const right = rightPath[rightPath.length - 1];
|
|
130316
|
+
const scope = this.connectorScope(symbolsInUri, this.indexToRange(text, m2.index, 0).start, indexes);
|
|
130317
|
+
const lSym = this.resolveConnectorEnd(leftPath, scope, indexes);
|
|
130318
|
+
const rSym = this.resolveConnectorEnd(rightPath, scope, indexes);
|
|
130205
130319
|
if (!lSym || !rSym) continue;
|
|
130206
130320
|
const lType = lSym.typeNames[0] ?? lSym.typeName;
|
|
130207
130321
|
const rType = rSym.typeNames[0] ?? rSym.typeName;
|
|
@@ -130251,6 +130365,55 @@ var SemanticValidator = class _SemanticValidator {
|
|
|
130251
130365
|
}
|
|
130252
130366
|
return diagnostics;
|
|
130253
130367
|
}
|
|
130368
|
+
/**
|
|
130369
|
+
* The innermost element around `position` that owns a connector declared
|
|
130370
|
+
* there: the connector's own symbol, when it has one, is skipped.
|
|
130371
|
+
*/
|
|
130372
|
+
connectorScope(symbols, position, indexes) {
|
|
130373
|
+
const before = (a, b) => a.line < b.line || a.line === b.line && a.character <= b.character;
|
|
130374
|
+
const size = (r) => (r.end.line - r.start.line) * 1e6 + (r.end.character - r.start.character);
|
|
130375
|
+
let scope;
|
|
130376
|
+
for (const s of symbols) {
|
|
130377
|
+
if (!before(s.range.start, position) || !before(position, s.range.end)) continue;
|
|
130378
|
+
if (!scope || size(s.range) < size(scope.range)) scope = s;
|
|
130379
|
+
}
|
|
130380
|
+
while (scope && CONNECTOR_KINDS.has(scope.kind)) scope = ownerOf(scope, indexes);
|
|
130381
|
+
return scope;
|
|
130382
|
+
}
|
|
130383
|
+
/**
|
|
130384
|
+
* The port that a connector end (`a.p`, `a.p.q`) names, resolved from
|
|
130385
|
+
* `scope` outward: its first segment is a feature of `scope` or of one of
|
|
130386
|
+
* its owners, each next one a feature of the one before. Two parts can each
|
|
130387
|
+
* have a port of the same name, so an end is never matched by its last
|
|
130388
|
+
* segment alone, except when the path does not resolve and the workspace
|
|
130389
|
+
* has only one port of that name.
|
|
130390
|
+
*/
|
|
130391
|
+
resolveConnectorEnd(path3, scope, indexes) {
|
|
130392
|
+
let feature;
|
|
130393
|
+
for (let namespace = scope; namespace && !feature; namespace = ownerOf(namespace, indexes)) {
|
|
130394
|
+
feature = this.findFeature(namespace, path3[0], indexes);
|
|
130395
|
+
}
|
|
130396
|
+
for (const name of path3.slice(1)) {
|
|
130397
|
+
feature = feature && this.findFeature(feature, name, indexes);
|
|
130398
|
+
}
|
|
130399
|
+
if (feature) return feature.kind === "port" /* PortUsage */ ? feature : void 0;
|
|
130400
|
+
const sameName = indexes.portsByName.get(path3[path3.length - 1]) ?? [];
|
|
130401
|
+
return sameName.length === 1 ? sameName[0] : void 0;
|
|
130402
|
+
}
|
|
130403
|
+
/** The feature `name` of `owner`: its own member, else a member of one of its types or their supertypes. */
|
|
130404
|
+
findFeature(owner, name, indexes) {
|
|
130405
|
+
const own = (indexes.byParent.get(namespaceKeyOf(owner)) ?? []).find((s) => s.name === name);
|
|
130406
|
+
if (own) return own;
|
|
130407
|
+
for (const typeName of owner.typeNames) {
|
|
130408
|
+
const type = this.namespaceResolver.resolveNameFrom(owner, typeName, indexes);
|
|
130409
|
+
if (!type || !isDefinition(type.kind)) continue;
|
|
130410
|
+
for (const definition of this.getSpecializationHierarchy(type, indexes).flat()) {
|
|
130411
|
+
const member = (indexes.byParent.get(namespaceKeyOf(definition)) ?? []).find((s) => s.name === name);
|
|
130412
|
+
if (member) return member;
|
|
130413
|
+
}
|
|
130414
|
+
}
|
|
130415
|
+
return void 0;
|
|
130416
|
+
}
|
|
130254
130417
|
/**
|
|
130255
130418
|
* Resolve the full type hierarchy for a type name by following
|
|
130256
130419
|
* specialization chains transitively (max depth 10).
|
|
@@ -130298,7 +130461,7 @@ var SemanticValidator = class _SemanticValidator {
|
|
|
130298
130461
|
}
|
|
130299
130462
|
const parent = this.findConstraintScopeSymbol(symbolsInUri, indexes, b.startLine);
|
|
130300
130463
|
if (!parent) continue;
|
|
130301
|
-
const parentMembers =
|
|
130464
|
+
const parentMembers = this.getConstraintScopeMembers(parent, indexes);
|
|
130302
130465
|
if (parentMembers.length === 0) continue;
|
|
130303
130466
|
const ignoredRanges = this.getIgnoredBodyRanges(b.body);
|
|
130304
130467
|
const idRe = /\b([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*)\b/g;
|
|
@@ -130357,18 +130520,135 @@ var SemanticValidator = class _SemanticValidator {
|
|
|
130357
130520
|
const root = parentMembers.find((s) => s.name === path3[0]);
|
|
130358
130521
|
if (!root) return false;
|
|
130359
130522
|
if (path3.length === 1) return true;
|
|
130360
|
-
let
|
|
130523
|
+
let current = root;
|
|
130361
130524
|
for (let i = 1; i < path3.length; i++) {
|
|
130525
|
+
const typeName = current.typeNames[0] ?? current.typeName;
|
|
130362
130526
|
if (!typeName) return false;
|
|
130363
|
-
const
|
|
130364
|
-
|
|
130365
|
-
|
|
130366
|
-
const member = (indexes.byParent.get(namespaceKeyOf(typeDef)) ?? []).find((s) => s.name === path3[i]);
|
|
130527
|
+
const typeDef = this.namespaceResolver.resolveNameFrom(current, typeName, indexes);
|
|
130528
|
+
if (!typeDef || !isDefinition(typeDef.kind)) return false;
|
|
130529
|
+
const member = this.getConstraintScopeMembers(typeDef, indexes, true).find((s) => s.name === path3[i]);
|
|
130367
130530
|
if (!member) return false;
|
|
130368
|
-
|
|
130531
|
+
current = member;
|
|
130369
130532
|
}
|
|
130370
130533
|
return true;
|
|
130371
130534
|
}
|
|
130535
|
+
getConstraintScopeMembers(scope, indexes, publicOnly = false) {
|
|
130536
|
+
const hierarchy = [[scope]];
|
|
130537
|
+
const visited = /* @__PURE__ */ new Set([scope]);
|
|
130538
|
+
let frontier = [scope];
|
|
130539
|
+
while (frontier.length > 0) {
|
|
130540
|
+
const next = [];
|
|
130541
|
+
for (const current of frontier) {
|
|
130542
|
+
for (const typeName of current.typeNames) {
|
|
130543
|
+
const supertype = this.namespaceResolver.resolveNameFrom(current, typeName, indexes);
|
|
130544
|
+
if (!supertype || !isDefinition(supertype.kind) || visited.has(supertype)) continue;
|
|
130545
|
+
visited.add(supertype);
|
|
130546
|
+
next.push(supertype);
|
|
130547
|
+
}
|
|
130548
|
+
}
|
|
130549
|
+
if (next.length > 0) hierarchy.push(next);
|
|
130550
|
+
frontier = next;
|
|
130551
|
+
}
|
|
130552
|
+
const membersByLevel = hierarchy.map((level) => level.flatMap((namespace) => indexes.byParent.get(namespaceKeyOf(namespace)) ?? []));
|
|
130553
|
+
const hiddenMembers = /* @__PURE__ */ new Set();
|
|
130554
|
+
for (let level = membersByLevel.length - 1; level >= 0; level--) {
|
|
130555
|
+
for (const redefining of membersByLevel[level]) {
|
|
130556
|
+
for (const target of redefining.redefinedFeatureTargets ?? []) {
|
|
130557
|
+
const owner = ownerOf(redefining, indexes);
|
|
130558
|
+
if (!owner) continue;
|
|
130559
|
+
for (const candidate of this.resolveInheritedRedefinitionTarget(owner, target, hiddenMembers, indexes)) {
|
|
130560
|
+
hiddenMembers.add(candidate.symbolId);
|
|
130561
|
+
}
|
|
130562
|
+
}
|
|
130563
|
+
if (redefining.kind === "subject" /* SubjectUsage */) {
|
|
130564
|
+
const owner = ownerOf(redefining, indexes);
|
|
130565
|
+
if (!owner) continue;
|
|
130566
|
+
for (const ancestor of this.getSpecializationHierarchy(owner, indexes).slice(1).flat()) {
|
|
130567
|
+
for (const candidate of indexes.byParent.get(namespaceKeyOf(ancestor)) ?? []) {
|
|
130568
|
+
if (candidate.kind === "subject" /* SubjectUsage */) hiddenMembers.add(candidate.symbolId);
|
|
130569
|
+
}
|
|
130570
|
+
}
|
|
130571
|
+
}
|
|
130572
|
+
}
|
|
130573
|
+
}
|
|
130574
|
+
const membersByName = /* @__PURE__ */ new Map();
|
|
130575
|
+
for (let level = 0; level < membersByLevel.length; level++) {
|
|
130576
|
+
for (const member of membersByLevel[level]) {
|
|
130577
|
+
if (level > 0 && member.visibility === "private") continue;
|
|
130578
|
+
if (publicOnly && member.visibility !== void 0 && member.visibility !== "public") continue;
|
|
130579
|
+
if (hiddenMembers.has(member.symbolId) || membersByName.has(member.name)) continue;
|
|
130580
|
+
membersByName.set(member.name, member);
|
|
130581
|
+
}
|
|
130582
|
+
}
|
|
130583
|
+
return [...membersByName.values()];
|
|
130584
|
+
}
|
|
130585
|
+
resolveInheritedRedefinitionTarget(owner, target, alreadyRedefined, indexes) {
|
|
130586
|
+
if (target.includes(".")) return [];
|
|
130587
|
+
const segments = target.split("::");
|
|
130588
|
+
const targetName = segments.pop()?.replace(/^'|'$/g, "");
|
|
130589
|
+
if (!targetName) return [];
|
|
130590
|
+
const qualifier = segments.join("::").replace(/^'|'$/g, "");
|
|
130591
|
+
const matches = /* @__PURE__ */ new Map();
|
|
130592
|
+
for (const supertype of this.resolveDirectSupertypes(owner, indexes)) {
|
|
130593
|
+
const branch = this.getSpecializationHierarchy(supertype, indexes);
|
|
130594
|
+
const anchors = qualifier ? branch.flat().filter((type) => this.matchesSpecializationQualifier(type, qualifier)) : [supertype];
|
|
130595
|
+
for (const anchor of anchors) {
|
|
130596
|
+
let frontier = [anchor];
|
|
130597
|
+
const visited = new Set(frontier);
|
|
130598
|
+
const candidates = [];
|
|
130599
|
+
while (frontier.length > 0 && candidates.length === 0) {
|
|
130600
|
+
for (const type of frontier) {
|
|
130601
|
+
for (const member of indexes.byParent.get(namespaceKeyOf(type)) ?? []) {
|
|
130602
|
+
if (member.name === targetName && member.visibility !== "private" && !alreadyRedefined.has(member.symbolId)) {
|
|
130603
|
+
candidates.push(member);
|
|
130604
|
+
}
|
|
130605
|
+
}
|
|
130606
|
+
}
|
|
130607
|
+
if (candidates.length > 0) break;
|
|
130608
|
+
const next = /* @__PURE__ */ new Map();
|
|
130609
|
+
for (const type of frontier) {
|
|
130610
|
+
for (const parent of this.resolveDirectSupertypes(type, indexes)) {
|
|
130611
|
+
if (visited.has(parent)) continue;
|
|
130612
|
+
visited.add(parent);
|
|
130613
|
+
next.set(parent.symbolId, parent);
|
|
130614
|
+
}
|
|
130615
|
+
}
|
|
130616
|
+
frontier = [...next.values()];
|
|
130617
|
+
}
|
|
130618
|
+
for (const candidate of candidates) matches.set(candidate.symbolId, candidate);
|
|
130619
|
+
}
|
|
130620
|
+
}
|
|
130621
|
+
return matches.size === 1 ? [...matches.values()] : [];
|
|
130622
|
+
}
|
|
130623
|
+
resolveDirectSupertypes(scope, indexes) {
|
|
130624
|
+
const supertypes = /* @__PURE__ */ new Map();
|
|
130625
|
+
for (const typeName of scope.typeNames) {
|
|
130626
|
+
const supertype = this.namespaceResolver.resolveNameFrom(scope, typeName, indexes);
|
|
130627
|
+
if (supertype && isDefinition(supertype.kind)) supertypes.set(supertype.symbolId, supertype);
|
|
130628
|
+
}
|
|
130629
|
+
return [...supertypes.values()];
|
|
130630
|
+
}
|
|
130631
|
+
getSpecializationHierarchy(scope, indexes) {
|
|
130632
|
+
const levels = [[scope]];
|
|
130633
|
+
const visited = /* @__PURE__ */ new Set([scope]);
|
|
130634
|
+
let frontier = [scope];
|
|
130635
|
+
while (frontier.length > 0) {
|
|
130636
|
+
const next = [];
|
|
130637
|
+
for (const type of frontier) {
|
|
130638
|
+
for (const parent of this.resolveDirectSupertypes(type, indexes)) {
|
|
130639
|
+
if (visited.has(parent)) continue;
|
|
130640
|
+
visited.add(parent);
|
|
130641
|
+
next.push(parent);
|
|
130642
|
+
}
|
|
130643
|
+
}
|
|
130644
|
+
if (next.length > 0) levels.push(next);
|
|
130645
|
+
frontier = next;
|
|
130646
|
+
}
|
|
130647
|
+
return levels;
|
|
130648
|
+
}
|
|
130649
|
+
matchesSpecializationQualifier(type, qualifier) {
|
|
130650
|
+
return type.name === qualifier || type.qualifiedName === qualifier || type.qualifiedName?.endsWith(`::${qualifier}`) === true;
|
|
130651
|
+
}
|
|
130372
130652
|
findContainingSymbolByLine(symbols, line) {
|
|
130373
130653
|
return symbols.filter((s) => s.range.start.line <= line && s.range.end.line >= line).sort((a, b) => {
|
|
130374
130654
|
const ar = (a.range.end.line - a.range.start.line) * 1e3 + (a.range.end.character - a.range.start.character);
|
|
@@ -130379,7 +130659,7 @@ var SemanticValidator = class _SemanticValidator {
|
|
|
130379
130659
|
findConstraintScopeSymbol(symbolsInUri, indexes, line) {
|
|
130380
130660
|
let scope = this.findContainingSymbolByLine(symbolsInUri, line);
|
|
130381
130661
|
while (scope) {
|
|
130382
|
-
const members =
|
|
130662
|
+
const members = this.getConstraintScopeMembers(scope, indexes);
|
|
130383
130663
|
if (members.length > 0) return scope;
|
|
130384
130664
|
if (!scope.parentId) return scope;
|
|
130385
130665
|
scope = ownerOf(scope, indexes);
|
|
@@ -130666,6 +130946,10 @@ hoverProvider.setSemanticValidator(semanticValidator);
|
|
|
130666
130946
|
var hasConfigurationCapability = false;
|
|
130667
130947
|
var hasWorkspaceFolderCapability = false;
|
|
130668
130948
|
var workspaceRoots = [];
|
|
130949
|
+
var workspaceFolderUris = [];
|
|
130950
|
+
function rootsOf(folderUris) {
|
|
130951
|
+
return folderUris.map((uri) => toFsPath(uri)).filter((p) => p !== void 0);
|
|
130952
|
+
}
|
|
130669
130953
|
var isWorkspaceFile = false;
|
|
130670
130954
|
var preloadOnOpen = "workspaceOnly";
|
|
130671
130955
|
var disabledDiagnosticCodes = /* @__PURE__ */ new Set();
|
|
@@ -130677,6 +130961,10 @@ function publishDiagnostics(uri, diagnostics) {
|
|
|
130677
130961
|
}
|
|
130678
130962
|
var skipDirs = new Set(DEFAULT_SKIP_DIRS);
|
|
130679
130963
|
var serverReady = false;
|
|
130964
|
+
var resolveInitialization;
|
|
130965
|
+
var initialization = new Promise((resolve2) => {
|
|
130966
|
+
resolveInitialization = resolve2;
|
|
130967
|
+
});
|
|
130680
130968
|
var earlyOpenUris = /* @__PURE__ */ new Set();
|
|
130681
130969
|
var workerRequestId = 0;
|
|
130682
130970
|
var isBrowserServer = typeof __SYSML_BROWSER_SERVER__ !== "undefined" && __SYSML_BROWSER_SERVER__;
|
|
@@ -130790,7 +131078,8 @@ connection.onInitialize((params) => {
|
|
|
130790
131078
|
connection.console.warn(`projectId is not a UUID: ${initOpts.projectId}; symbol IDs are unique only within this workspace`);
|
|
130791
131079
|
}
|
|
130792
131080
|
if (params.workspaceFolders) {
|
|
130793
|
-
|
|
131081
|
+
workspaceFolderUris = params.workspaceFolders.map((f) => f.uri);
|
|
131082
|
+
workspaceRoots = rootsOf(workspaceFolderUris);
|
|
130794
131083
|
} else if (params.rootUri) {
|
|
130795
131084
|
const root = toFsPath(params.rootUri);
|
|
130796
131085
|
if (root) workspaceRoots = [root];
|
|
@@ -130840,7 +131129,8 @@ connection.onInitialize((params) => {
|
|
|
130840
131129
|
if (hasWorkspaceFolderCapability) {
|
|
130841
131130
|
result.capabilities.workspace = {
|
|
130842
131131
|
workspaceFolders: {
|
|
130843
|
-
supported: true
|
|
131132
|
+
supported: true,
|
|
131133
|
+
changeNotifications: true
|
|
130844
131134
|
}
|
|
130845
131135
|
};
|
|
130846
131136
|
}
|
|
@@ -130852,8 +131142,17 @@ connection.onInitialized(async () => {
|
|
|
130852
131142
|
import_node12.DidChangeConfigurationNotification.type,
|
|
130853
131143
|
void 0
|
|
130854
131144
|
);
|
|
131145
|
+
}
|
|
131146
|
+
if (hasWorkspaceFolderCapability) {
|
|
131147
|
+
connection.workspace.onDidChangeWorkspaceFolders((event) => {
|
|
131148
|
+
onWorkspaceFoldersChanged(event).catch((e) => connection.console.error(`Workspace folder change failed: ${e}`));
|
|
131149
|
+
});
|
|
131150
|
+
}
|
|
131151
|
+
if (hasConfigurationCapability) {
|
|
130855
131152
|
await pullSettings().catch(() => {
|
|
130856
131153
|
});
|
|
131154
|
+
await pullFolderProjectIds().catch(() => {
|
|
131155
|
+
});
|
|
130857
131156
|
}
|
|
130858
131157
|
const libCount = initLibraryIndex(__dirname);
|
|
130859
131158
|
connection.console.log(`SysML v2 Language Server initialized (${libCount} library packages indexed)`);
|
|
@@ -130869,14 +131168,13 @@ connection.onInitialized(async () => {
|
|
|
130869
131168
|
);
|
|
130870
131169
|
}
|
|
130871
131170
|
serverReady = true;
|
|
131171
|
+
resolveInitialization();
|
|
130872
131172
|
spawnParseWorker();
|
|
130873
131173
|
if (workspaceRoots.length > 0 && (preloadOnOpen === "always" || preloadOnOpen === "workspaceOnly" && isWorkspaceFile)) {
|
|
130874
|
-
|
|
130875
|
-
scanWorkspaceFoldersAsync(workspaceRoots).then(({ fileCount, scanMs }) => {
|
|
131174
|
+
scanWorkspaceFolders(workspaceRoots).then(({ fileCount, scanMs }) => {
|
|
130876
131175
|
connection.console.log(
|
|
130877
131176
|
`Workspace scan: pre-parsed ${fileCount} .sysml files in ${scanMs} ms`
|
|
130878
131177
|
);
|
|
130879
|
-
documentManager.setWorkspaceScanComplete(true);
|
|
130880
131178
|
revalidateOpenDocuments();
|
|
130881
131179
|
});
|
|
130882
131180
|
}
|
|
@@ -130911,9 +131209,80 @@ function applySettings(config) {
|
|
|
130911
131209
|
}
|
|
130912
131210
|
}
|
|
130913
131211
|
connection.onDidChangeConfiguration((_change) => {
|
|
130914
|
-
pullSettings().then(() => revalidateOpenDocuments()).catch(() => {
|
|
131212
|
+
pullSettings().then(() => pullFolderProjectIds()).then(() => revalidateOpenDocuments()).catch(() => {
|
|
131213
|
+
});
|
|
131214
|
+
});
|
|
131215
|
+
function latestWins(task) {
|
|
131216
|
+
let calls = 0;
|
|
131217
|
+
let latest = Promise.resolve();
|
|
131218
|
+
return () => {
|
|
131219
|
+
const call = ++calls;
|
|
131220
|
+
const isSuperseded = () => call !== calls;
|
|
131221
|
+
const run = task(isSuperseded).then(() => isSuperseded() ? latest : void 0);
|
|
131222
|
+
latest = run;
|
|
131223
|
+
return run;
|
|
131224
|
+
};
|
|
131225
|
+
}
|
|
131226
|
+
var pullFolderProjectIds = latestWins(async (isSuperseded) => {
|
|
131227
|
+
if (!hasConfigurationCapability) return;
|
|
131228
|
+
const folderUris = [...workspaceFolderUris];
|
|
131229
|
+
const answers = folderUris.length === 0 ? [] : await connection.workspace.getConfiguration(folderUris.map((scopeUri) => ({ scopeUri, section: "sysml.project" })));
|
|
131230
|
+
if (isSuperseded()) return;
|
|
131231
|
+
const projectIds = folderUris.flatMap((folderUri, i) => {
|
|
131232
|
+
const projectId = answers[i]?.projectId;
|
|
131233
|
+
return typeof projectId === "string" ? [{ folderUri, projectId }] : [];
|
|
130915
131234
|
});
|
|
131235
|
+
const uris = documentManager.getUris();
|
|
131236
|
+
const prefixBefore = new Map(uris.map((uri) => [uri, getUrlPrefix(uri)]));
|
|
131237
|
+
const rejected = setFolderProjectIds(projectIds);
|
|
131238
|
+
for (const entry of rejected) {
|
|
131239
|
+
connection.console.warn(`projectId of ${entry.folderUri} is not a UUID: ${entry.projectId}; ignored, so its documents use the projectId of an enclosing folder, else initializationOptions.projectId, else the default prefix`);
|
|
131240
|
+
}
|
|
131241
|
+
documentManager.invalidateSymbols(uris.filter((uri) => getUrlPrefix(uri) !== prefixBefore.get(uri)));
|
|
131242
|
+
logFolderPrefixes(new Set(projectIds.filter((p) => !rejected.includes(p)).map((p) => p.folderUri)));
|
|
130916
131243
|
});
|
|
131244
|
+
var loggedFolderPrefixes = /* @__PURE__ */ new Map();
|
|
131245
|
+
function logFolderPrefixes(ownProjectIds) {
|
|
131246
|
+
for (const folderUri of workspaceFolderUris) {
|
|
131247
|
+
const prefix = getUrlPrefix(`${folderUri.endsWith("/") ? folderUri : `${folderUri}/`}_.sysml`);
|
|
131248
|
+
if (loggedFolderPrefixes.get(folderUri) === prefix) continue;
|
|
131249
|
+
loggedFolderPrefixes.set(folderUri, prefix);
|
|
131250
|
+
const source = ownProjectIds.has(folderUri) ? "its projectId" : prefix === getUrlPrefix() ? prefix === DEFAULT_URL_PREFIX ? "the default prefix, no projectId" : "initializationOptions.projectId" : "an enclosing folder's projectId";
|
|
131251
|
+
const folderPath = toFsPath(folderUri) ?? folderUri;
|
|
131252
|
+
connection.console.debug(`Folder ${folderPath}: element ID namespace ${prefix} (${source}; ID namespace only, no network access)`);
|
|
131253
|
+
}
|
|
131254
|
+
for (const folderUri of loggedFolderPrefixes.keys()) {
|
|
131255
|
+
if (!workspaceFolderUris.includes(folderUri)) loggedFolderPrefixes.delete(folderUri);
|
|
131256
|
+
}
|
|
131257
|
+
}
|
|
131258
|
+
async function onWorkspaceFoldersChanged(event) {
|
|
131259
|
+
const initialScanPending = !serverReady;
|
|
131260
|
+
const removed = new Set(event.removed.map((f) => f.uri));
|
|
131261
|
+
workspaceFolderUris = [...workspaceFolderUris.filter((uri) => !removed.has(uri)), ...event.added.map((f) => f.uri)];
|
|
131262
|
+
workspaceRoots = rootsOf(workspaceFolderUris);
|
|
131263
|
+
dropDocumentsOutsideWorkspace(event.removed.map((f) => f.uri));
|
|
131264
|
+
await pullFolderProjectIds().catch(() => {
|
|
131265
|
+
});
|
|
131266
|
+
if (initialScanPending) return;
|
|
131267
|
+
const addedRoots = rootsOf(event.added.map((f) => f.uri).filter((uri) => workspaceFolderUris.includes(uri)));
|
|
131268
|
+
if (addedRoots.length > 0 && (preloadOnOpen === "always" || preloadOnOpen === "workspaceOnly" && isWorkspaceFile)) {
|
|
131269
|
+
const { fileCount, scanMs } = await scanWorkspaceFolders(addedRoots);
|
|
131270
|
+
connection.console.log(`Workspace scan: pre-parsed ${fileCount} .sysml files of ${addedRoots.length} added folder(s) in ${scanMs} ms`);
|
|
131271
|
+
}
|
|
131272
|
+
revalidateOpenDocuments();
|
|
131273
|
+
}
|
|
131274
|
+
function dropDocumentsOutsideWorkspace(folderUris) {
|
|
131275
|
+
for (const uri of documentManager.getUris()) {
|
|
131276
|
+
if (openDocumentFor(uri)) continue;
|
|
131277
|
+
if (folderUris.some((f) => isInFolder(uri, f)) && !isInWorkspace(uri)) {
|
|
131278
|
+
documentManager.remove(uri);
|
|
131279
|
+
modelProvider.removeUri(uri);
|
|
131280
|
+
}
|
|
131281
|
+
}
|
|
131282
|
+
}
|
|
131283
|
+
function isInWorkspace(uri) {
|
|
131284
|
+
return workspaceRoots.some((root) => isInFolder(uri, (0, import_node_url2.pathToFileURL)(root).toString()));
|
|
131285
|
+
}
|
|
130917
131286
|
function openDocumentFor(uri) {
|
|
130918
131287
|
return documents.get(uri) ?? documents.all().find((d) => isSameDocumentUri(d.uri, uri));
|
|
130919
131288
|
}
|
|
@@ -130938,6 +131307,16 @@ function parseWorkspaceFile(filePath, uri = (0, import_node_url2.pathToFileURL)(
|
|
|
130938
131307
|
documentManager.parse(doc);
|
|
130939
131308
|
return true;
|
|
130940
131309
|
}
|
|
131310
|
+
var runningScans = 0;
|
|
131311
|
+
async function scanWorkspaceFolders(roots) {
|
|
131312
|
+
runningScans++;
|
|
131313
|
+
documentManager.setWorkspaceScanComplete(false);
|
|
131314
|
+
try {
|
|
131315
|
+
return await scanWorkspaceFoldersAsync(roots);
|
|
131316
|
+
} finally {
|
|
131317
|
+
if (--runningScans === 0) documentManager.setWorkspaceScanComplete(true);
|
|
131318
|
+
}
|
|
131319
|
+
}
|
|
130941
131320
|
async function scanWorkspaceFoldersAsync(roots) {
|
|
130942
131321
|
const scanT0 = Date.now();
|
|
130943
131322
|
const fileArrays = await Promise.all(roots.map((r) => findSysMLFilesAsync(r, skipDirs)));
|
|
@@ -130949,6 +131328,7 @@ async function scanWorkspaceFoldersAsync(roots) {
|
|
|
130949
131328
|
const filePath = allFiles[i];
|
|
130950
131329
|
const uri = (0, import_node_url2.pathToFileURL)(filePath).toString();
|
|
130951
131330
|
if (openDocumentFor(uri)) continue;
|
|
131331
|
+
if (!isInWorkspace(uri)) continue;
|
|
130952
131332
|
const content = fileContents.get(filePath);
|
|
130953
131333
|
if (content === void 0) continue;
|
|
130954
131334
|
documentManager.parseBatch(uri, 0, content);
|
|
@@ -131161,14 +131541,16 @@ connection.onDocumentRangeFormatting(
|
|
|
131161
131541
|
return formattingProvider.provideRangeFormatting(params);
|
|
131162
131542
|
}
|
|
131163
131543
|
);
|
|
131164
|
-
connection.onRequest("sysml/model", (params) => {
|
|
131544
|
+
connection.onRequest("sysml/model", async (params) => {
|
|
131545
|
+
await initialization;
|
|
131165
131546
|
return modelProvider.getModel(
|
|
131166
131547
|
params.textDocument.uri,
|
|
131167
131548
|
documentManager.getVersion(params.textDocument.uri),
|
|
131168
131549
|
params.scope
|
|
131169
131550
|
);
|
|
131170
131551
|
});
|
|
131171
|
-
connection.onRequest("sysml/elementLookup", (params) => {
|
|
131552
|
+
connection.onRequest("sysml/elementLookup", async (params) => {
|
|
131553
|
+
await initialization;
|
|
131172
131554
|
return elementLookupProvider.elementLookup(params);
|
|
131173
131555
|
});
|
|
131174
131556
|
connection.onRequest("sysml/serverStats", () => {
|