sysml-v2-lsp 0.35.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.
@@ -10545,8 +10545,8 @@ var require_main2 = __commonJS({
10545
10545
  }
10546
10546
  uinteger2.is = is;
10547
10547
  })(uinteger || (exports3.uinteger = uinteger = {}));
10548
- var Position;
10549
- (function(Position2) {
10548
+ var Position2;
10549
+ (function(Position3) {
10550
10550
  function create(line, character) {
10551
10551
  if (line === Number.MAX_VALUE) {
10552
10552
  line = uinteger.MAX_VALUE;
@@ -10556,31 +10556,31 @@ var require_main2 = __commonJS({
10556
10556
  }
10557
10557
  return { line, character };
10558
10558
  }
10559
- Position2.create = create;
10559
+ Position3.create = create;
10560
10560
  function is(value) {
10561
10561
  var candidate = value;
10562
10562
  return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
10563
10563
  }
10564
- Position2.is = is;
10565
- })(Position || (exports3.Position = Position = {}));
10566
- var Range;
10567
- (function(Range2) {
10564
+ Position3.is = is;
10565
+ })(Position2 || (exports3.Position = Position2 = {}));
10566
+ var Range2;
10567
+ (function(Range3) {
10568
10568
  function create(one, two, three, four) {
10569
10569
  if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
10570
- return { start: Position.create(one, two), end: Position.create(three, four) };
10571
- } else if (Position.is(one) && Position.is(two)) {
10570
+ return { start: Position2.create(one, two), end: Position2.create(three, four) };
10571
+ } else if (Position2.is(one) && Position2.is(two)) {
10572
10572
  return { start: one, end: two };
10573
10573
  } else {
10574
10574
  throw new Error("Range#create called with invalid arguments[".concat(one, ", ").concat(two, ", ").concat(three, ", ").concat(four, "]"));
10575
10575
  }
10576
10576
  }
10577
- Range2.create = create;
10577
+ Range3.create = create;
10578
10578
  function is(value) {
10579
10579
  var candidate = value;
10580
- return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
10580
+ return Is.objectLiteral(candidate) && Position2.is(candidate.start) && Position2.is(candidate.end);
10581
10581
  }
10582
- Range2.is = is;
10583
- })(Range || (exports3.Range = Range = {}));
10582
+ Range3.is = is;
10583
+ })(Range2 || (exports3.Range = Range2 = {}));
10584
10584
  var Location;
10585
10585
  (function(Location2) {
10586
10586
  function create(uri, range) {
@@ -10589,7 +10589,7 @@ var require_main2 = __commonJS({
10589
10589
  Location2.create = create;
10590
10590
  function is(value) {
10591
10591
  var candidate = value;
10592
- return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
10592
+ return Is.objectLiteral(candidate) && Range2.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
10593
10593
  }
10594
10594
  Location2.is = is;
10595
10595
  })(Location || (exports3.Location = Location = {}));
@@ -10601,7 +10601,7 @@ var require_main2 = __commonJS({
10601
10601
  LocationLink2.create = create;
10602
10602
  function is(value) {
10603
10603
  var candidate = value;
10604
- return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
10604
+ return Is.objectLiteral(candidate) && Range2.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range2.is(candidate.targetSelectionRange) && (Range2.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
10605
10605
  }
10606
10606
  LocationLink2.is = is;
10607
10607
  })(LocationLink || (exports3.LocationLink = LocationLink = {}));
@@ -10633,7 +10633,7 @@ var require_main2 = __commonJS({
10633
10633
  ColorInformation2.create = create;
10634
10634
  function is(value) {
10635
10635
  var candidate = value;
10636
- return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);
10636
+ return Is.objectLiteral(candidate) && Range2.is(candidate.range) && Color.is(candidate.color);
10637
10637
  }
10638
10638
  ColorInformation2.is = is;
10639
10639
  })(ColorInformation || (exports3.ColorInformation = ColorInformation = {}));
@@ -10744,7 +10744,7 @@ var require_main2 = __commonJS({
10744
10744
  function is(value) {
10745
10745
  var _a3;
10746
10746
  var candidate = value;
10747
- return Is.defined(candidate) && Range.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((_a3 = candidate.codeDescription) === null || _a3 === void 0 ? void 0 : _a3.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
10747
+ return Is.defined(candidate) && Range2.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((_a3 = candidate.codeDescription) === null || _a3 === void 0 ? void 0 : _a3.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
10748
10748
  }
10749
10749
  Diagnostic3.is = is;
10750
10750
  })(Diagnostic2 || (exports3.Diagnostic = Diagnostic2 = {}));
@@ -10784,7 +10784,7 @@ var require_main2 = __commonJS({
10784
10784
  TextEdit2.del = del;
10785
10785
  function is(value) {
10786
10786
  var candidate = value;
10787
- return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range);
10787
+ return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range2.is(candidate.range);
10788
10788
  }
10789
10789
  TextEdit2.is = is;
10790
10790
  })(TextEdit || (exports3.TextEdit = TextEdit = {}));
@@ -11328,7 +11328,7 @@ var require_main2 = __commonJS({
11328
11328
  InsertReplaceEdit2.create = create;
11329
11329
  function is(value) {
11330
11330
  var candidate = value;
11331
- return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
11331
+ return candidate && Is.string(candidate.newText) && Range2.is(candidate.insert) && Range2.is(candidate.replace);
11332
11332
  }
11333
11333
  InsertReplaceEdit2.is = is;
11334
11334
  })(InsertReplaceEdit || (exports3.InsertReplaceEdit = InsertReplaceEdit = {}));
@@ -11375,7 +11375,7 @@ var require_main2 = __commonJS({
11375
11375
  (function(Hover2) {
11376
11376
  function is(value) {
11377
11377
  var candidate = value;
11378
- return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
11378
+ return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range2.is(value.range));
11379
11379
  }
11380
11380
  Hover2.is = is;
11381
11381
  })(Hover || (exports3.Hover = Hover = {}));
@@ -11496,7 +11496,7 @@ var require_main2 = __commonJS({
11496
11496
  DocumentSymbol2.create = create;
11497
11497
  function is(value) {
11498
11498
  var candidate = value;
11499
- return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.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));
11499
+ return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range2.is(candidate.range) && Range2.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));
11500
11500
  }
11501
11501
  DocumentSymbol2.is = is;
11502
11502
  })(DocumentSymbol || (exports3.DocumentSymbol = DocumentSymbol = {}));
@@ -11573,7 +11573,7 @@ var require_main2 = __commonJS({
11573
11573
  CodeLens2.create = create;
11574
11574
  function is(value) {
11575
11575
  var candidate = value;
11576
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
11576
+ return Is.defined(candidate) && Range2.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
11577
11577
  }
11578
11578
  CodeLens2.is = is;
11579
11579
  })(CodeLens || (exports3.CodeLens = CodeLens = {}));
@@ -11597,7 +11597,7 @@ var require_main2 = __commonJS({
11597
11597
  DocumentLink2.create = create;
11598
11598
  function is(value) {
11599
11599
  var candidate = value;
11600
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
11600
+ return Is.defined(candidate) && Range2.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
11601
11601
  }
11602
11602
  DocumentLink2.is = is;
11603
11603
  })(DocumentLink || (exports3.DocumentLink = DocumentLink = {}));
@@ -11609,7 +11609,7 @@ var require_main2 = __commonJS({
11609
11609
  SelectionRange2.create = create;
11610
11610
  function is(value) {
11611
11611
  var candidate = value;
11612
- return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
11612
+ return Is.objectLiteral(candidate) && Range2.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
11613
11613
  }
11614
11614
  SelectionRange2.is = is;
11615
11615
  })(SelectionRange || (exports3.SelectionRange = SelectionRange = {}));
@@ -11668,7 +11668,7 @@ var require_main2 = __commonJS({
11668
11668
  InlineValueText2.create = create;
11669
11669
  function is(value) {
11670
11670
  var candidate = value;
11671
- return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);
11671
+ return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is.string(candidate.text);
11672
11672
  }
11673
11673
  InlineValueText2.is = is;
11674
11674
  })(InlineValueText || (exports3.InlineValueText = InlineValueText = {}));
@@ -11680,7 +11680,7 @@ var require_main2 = __commonJS({
11680
11680
  InlineValueVariableLookup2.create = create;
11681
11681
  function is(value) {
11682
11682
  var candidate = value;
11683
- return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
11683
+ return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
11684
11684
  }
11685
11685
  InlineValueVariableLookup2.is = is;
11686
11686
  })(InlineValueVariableLookup || (exports3.InlineValueVariableLookup = InlineValueVariableLookup = {}));
@@ -11692,7 +11692,7 @@ var require_main2 = __commonJS({
11692
11692
  InlineValueEvaluatableExpression2.create = create;
11693
11693
  function is(value) {
11694
11694
  var candidate = value;
11695
- return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
11695
+ return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
11696
11696
  }
11697
11697
  InlineValueEvaluatableExpression2.is = is;
11698
11698
  })(InlineValueEvaluatableExpression || (exports3.InlineValueEvaluatableExpression = InlineValueEvaluatableExpression = {}));
@@ -11704,7 +11704,7 @@ var require_main2 = __commonJS({
11704
11704
  InlineValueContext2.create = create;
11705
11705
  function is(value) {
11706
11706
  var candidate = value;
11707
- return Is.defined(candidate) && Range.is(value.stoppedLocation);
11707
+ return Is.defined(candidate) && Range2.is(value.stoppedLocation);
11708
11708
  }
11709
11709
  InlineValueContext2.is = is;
11710
11710
  })(InlineValueContext || (exports3.InlineValueContext = InlineValueContext = {}));
@@ -11741,7 +11741,7 @@ var require_main2 = __commonJS({
11741
11741
  InlayHint2.create = create;
11742
11742
  function is(value) {
11743
11743
  var candidate = value;
11744
- return Is.objectLiteral(candidate) && Position.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, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
11744
+ return Is.objectLiteral(candidate) && Position2.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, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
11745
11745
  }
11746
11746
  InlayHint2.is = is;
11747
11747
  })(InlayHint || (exports3.InlayHint = InlayHint = {}));
@@ -11930,7 +11930,7 @@ var require_main2 = __commonJS({
11930
11930
  var lineOffsets = this.getLineOffsets();
11931
11931
  var low = 0, high = lineOffsets.length;
11932
11932
  if (high === 0) {
11933
- return Position.create(0, offset);
11933
+ return Position2.create(0, offset);
11934
11934
  }
11935
11935
  while (low < high) {
11936
11936
  var mid = Math.floor((low + high) / 2);
@@ -11941,7 +11941,7 @@ var require_main2 = __commonJS({
11941
11941
  }
11942
11942
  }
11943
11943
  var line = low - 1;
11944
- return Position.create(line, offset - lineOffsets[line]);
11944
+ return Position2.create(line, offset - lineOffsets[line]);
11945
11945
  };
11946
11946
  FullTextDocument2.prototype.offsetAt = function(position) {
11947
11947
  var lineOffsets = this.getLineOffsets();
@@ -159135,14 +159135,21 @@ var NamespaceResolver = class {
159135
159135
  * namespace.
159136
159136
  */
159137
159137
  isLocallyVisible(symbol2, name, indexes) {
159138
- return this.resolveQualifiedNameFrom(ownerKeyOf(symbol2, indexes.byId), name, indexes) !== void 0;
159138
+ return this.resolveNameFrom(symbol2, name, indexes) !== void 0;
159139
+ }
159140
+ /**
159141
+ * Resolve a (possibly qualified) name from the namespace containing
159142
+ * `symbol`, respecting namespace membership and visibility.
159143
+ */
159144
+ resolveNameFrom(symbol2, name, indexes) {
159145
+ return this.resolveQualifiedNameFrom(ownerKeyOf(symbol2, indexes.byId), name, indexes);
159139
159146
  }
159140
159147
  /**
159141
159148
  * Resolve a (possibly qualified) name to its symbol per §7.5.1, searching
159142
159149
  * outward from namespace `start` and its enclosing namespaces (its own resolved
159143
159150
  * members first, then its parent's, ...). Shared by `isLocallyVisible` (an
159144
- * ordinary reference resolving relative to its own enclosing namespace) and
159145
- * import-target resolution (an `import` declaration's target is itself a
159151
+ * ordinary reference resolving relative to its own enclosing namespace),
159152
+ * `resolveNameFrom`, and import-target resolution (an `import` declaration's target is itself a
159146
159153
  * qualifiedName, resolved the same relative way -- not as an absolute/global
159147
159154
  * name -- so a bare `import C;` inside a nested package can pick up a `C`
159148
159155
  * its own enclosing package already imported, per §7.5.1/§7.5.3).
@@ -160639,6 +160646,7 @@ var SymbolTable = class {
160639
160646
  const selectionRange = anonymous ? ctx2.start ? tokenToRange(ctx2.start) : range : this.extractNameRange(ctx2) ?? range;
160640
160647
  const typeNames = isFlowUsage(kind) ? this.extractFlowTypeNames(ctx2) : transition ? this.extractTransitionTypeNames(ctx2) : this.extractTypeNames(ctx2);
160641
160648
  const specializationNames = this.extractSpecializationNames(ctx2);
160649
+ const redefinedFeatureTargets = this.extractRedefinedFeatureTargets(ctx2);
160642
160650
  const typeName = typeNames[0];
160643
160651
  const documentation = this.extractDocumentation(ctx2);
160644
160652
  const visibility = this.extractVisibility(ctx2);
@@ -160669,6 +160677,7 @@ var SymbolTable = class {
160669
160677
  typeName,
160670
160678
  typeNames,
160671
160679
  specializationNames,
160680
+ redefinedFeatureTargets: redefinedFeatureTargets.length > 0 ? redefinedFeatureTargets : void 0,
160672
160681
  documentation,
160673
160682
  visibility,
160674
160683
  source: transition?.source,
@@ -160920,15 +160929,28 @@ var SymbolTable = class {
160920
160929
  * such as `#metadata`.
160921
160930
  */
160922
160931
  findOwnHeaderRule(ctx2, ruleIndex) {
160932
+ const matches = [];
160933
+ this.findOwnHeaderRules(ctx2, ruleIndex, matches, true);
160934
+ return matches[0];
160935
+ }
160936
+ findOwnHeaderRules(ctx2, ruleIndex, matches, firstOnly = false) {
160923
160937
  for (let i = 0; i < ctx2.getChildCount(); i++) {
160924
160938
  const child = ctx2.getChild(i);
160925
160939
  if (!(child instanceof ParserRuleContext)) continue;
160926
- if (child.ruleIndex === ruleIndex) return child;
160940
+ if (child.ruleIndex === ruleIndex) {
160941
+ matches.push(child);
160942
+ if (firstOnly) return;
160943
+ continue;
160944
+ }
160927
160945
  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;
160928
- const found = this.findOwnHeaderRule(child, ruleIndex);
160929
- if (found) return found;
160946
+ this.findOwnHeaderRules(child, ruleIndex, matches, firstOnly);
160947
+ if (firstOnly && matches.length > 0) return;
160930
160948
  }
160931
- return void 0;
160949
+ }
160950
+ extractRedefinedFeatureTargets(ctx2) {
160951
+ const targets = [];
160952
+ this.findOwnHeaderRules(ctx2, SysMLv2Parser.RULE_ownedRedefinition, targets);
160953
+ return targets.map((target) => target.getText());
160932
160954
  }
160933
160955
  /**
160934
160956
  * A connection, interface or allocation usage's end reference paths, in
@@ -160956,13 +160978,7 @@ var SymbolTable = class {
160956
160978
  const segment = reference.getText().split(/::|\./).pop();
160957
160979
  return segment ? this.unquoteName(segment) : void 0;
160958
160980
  }
160959
- /**
160960
- * An element's declaration as written, without its body: its tokens up to
160961
- * its body or closing `;`, each exactly as written (a quoted name keeps its
160962
- * spaces), with one space wherever the source has whitespace or a comment
160963
- * between two of them (`connect a.p to b.p`, `connection : Conn`).
160964
- */
160965
- declarationText(ctx2) {
160981
+ declarationTokens(ctx2) {
160966
160982
  const tokens = [];
160967
160983
  const visit2 = (node2) => {
160968
160984
  for (let i = 0; i < node2.getChildCount(); i++) {
@@ -160977,6 +160993,16 @@ var SymbolTable = class {
160977
160993
  return false;
160978
160994
  };
160979
160995
  visit2(ctx2);
160996
+ return tokens;
160997
+ }
160998
+ /**
160999
+ * An element's declaration as written, without its body: its tokens up to
161000
+ * its body or closing `;`, each exactly as written (a quoted name keeps its
161001
+ * spaces), with one space wherever the source has whitespace or a comment
161002
+ * between two of them (`connect a.p to b.p`, `connection : Conn`).
161003
+ */
161004
+ declarationText(ctx2) {
161005
+ const tokens = this.declarationTokens(ctx2);
160980
161006
  let text = "";
160981
161007
  tokens.forEach((token, i) => {
160982
161008
  if (i > 0 && token.start > tokens[i - 1].stop + 1) text += " ";
@@ -161117,17 +161143,16 @@ var SymbolTable = class {
161117
161143
  const names = [];
161118
161144
  this.collectTypeNamesFromTree(ctx2, names, 0);
161119
161145
  if (names.length > 0) return names;
161120
- const fullText = ctx2.getText();
161121
- const braceIdx = fullText.indexOf("{");
161122
- let text = braceIdx >= 0 ? fullText.substring(0, braceIdx) : fullText;
161146
+ const { text: declarationText, quotedName } = this.maskedDeclaration(ctx2);
161147
+ let text = declarationText;
161123
161148
  text = text.replace(RE_KEYWORD_TRUNCATE, "");
161124
161149
  const specMatch = text.match(RE_SPEC);
161125
161150
  if (specMatch) {
161126
161151
  const specStr = text.substring(text.indexOf(specMatch[0]) + specMatch[0].indexOf(specMatch[1]));
161127
161152
  for (const part of specStr.split(",")) {
161128
- const qm = part.match(RE_QUOTED_NAME);
161129
- if (qm) {
161130
- names.push(qm[1]);
161153
+ const quoted = quotedName(part);
161154
+ if (quoted !== void 0) {
161155
+ names.push(quoted);
161131
161156
  continue;
161132
161157
  }
161133
161158
  const m2 = part.trim().match(RE_IDENT_START);
@@ -161148,9 +161173,9 @@ var SymbolTable = class {
161148
161173
  const fullMatchIdx = text.indexOf(typingMatch[0]);
161149
161174
  const afterColon = text.substring(fullMatchIdx + 1).trim();
161150
161175
  for (const part of afterColon.split(",")) {
161151
- const qm = part.match(RE_QUOTED_NAME);
161152
- if (qm) {
161153
- names.push(qm[1]);
161176
+ const quoted = quotedName(part);
161177
+ if (quoted !== void 0) {
161178
+ names.push(quoted);
161154
161179
  continue;
161155
161180
  }
161156
161181
  const m2 = part.trim().match(RE_IDENT_START);
@@ -161160,6 +161185,28 @@ var SymbolTable = class {
161160
161185
  }
161161
161186
  return names;
161162
161187
  }
161188
+ /**
161189
+ * The declaration tokens before the body, with each lexer STRING token
161190
+ * replaced by a numbered placeholder (`'0'`, `'1'`, ...), and
161191
+ * `quotedName`, which turns a placeholder in a part of that text back into
161192
+ * the name. SysML 2.0 section 7.2.2 permits punctuation in unrestricted
161193
+ * names (the STRING lexer production), so fallback regexes must never see
161194
+ * their `:`, `:>`, `{` or keywords. Documentation is not a name token.
161195
+ */
161196
+ maskedDeclaration(ctx2) {
161197
+ const quoted = [];
161198
+ const masked = this.declarationTokens(ctx2).map((token) => {
161199
+ const text = token.text ?? "";
161200
+ return token.type === SysMLv2Lexer.STRING ? `'${quoted.push(text.slice(1, -1)) - 1}'` : text;
161201
+ }).join("");
161202
+ return {
161203
+ text: masked,
161204
+ quotedName: (part) => {
161205
+ const qm = part.match(RE_QUOTED_NAME);
161206
+ return qm ? quoted[Number(qm[1])] : void 0;
161207
+ }
161208
+ };
161209
+ }
161163
161210
  /**
161164
161211
  * Extract only the specialization names (:> / specializes / subsets) from a context.
161165
161212
  * Uses the same tree-walk as extractTypeNames but restricted to
@@ -161170,17 +161217,15 @@ var SymbolTable = class {
161170
161217
  const names = [];
161171
161218
  this.collectNamesFromTree(ctx2, names, 0, TYPE_SPECIALIZATION_RULE_INDICES);
161172
161219
  if (names.length > 0) return names;
161173
- const fullText = ctx2.getText();
161174
- const braceIdx = fullText.indexOf("{");
161175
- let text = braceIdx >= 0 ? fullText.substring(0, braceIdx) : fullText;
161176
- text = text.replace(RE_KEYWORD_TRUNCATE_SPEC, "");
161220
+ const { text: declarationText, quotedName } = this.maskedDeclaration(ctx2);
161221
+ const text = declarationText.replace(RE_KEYWORD_TRUNCATE_SPEC, "");
161177
161222
  const specMatch = text.match(RE_SPEC_WITH_SUBSETS);
161178
161223
  if (specMatch) {
161179
161224
  const specStr = text.substring(text.indexOf(specMatch[0]) + specMatch[0].indexOf(specMatch[1]));
161180
161225
  for (const part of specStr.split(",")) {
161181
- const qm = part.match(RE_QUOTED_NAME);
161182
- if (qm) {
161183
- names.push(qm[1]);
161226
+ const quoted = quotedName(part);
161227
+ if (quoted !== void 0) {
161228
+ names.push(quoted);
161184
161229
  continue;
161185
161230
  }
161186
161231
  const m2 = part.trim().match(RE_IDENT_START);
@@ -163359,6 +163404,13 @@ var CONSTRAINT_KEYWORDS = /* @__PURE__ */ new Set([
163359
163404
  "assert",
163360
163405
  "assume"
163361
163406
  ]);
163407
+ var CONNECTOR_KINDS = /* @__PURE__ */ new Set([
163408
+ "connection" /* ConnectionUsage */,
163409
+ "interface" /* InterfaceUsage */,
163410
+ "allocation" /* AllocationUsage */,
163411
+ "flow" /* FlowUsage */,
163412
+ "succession flow" /* SuccessionFlowUsage */
163413
+ ]);
163362
163414
  var SemanticValidator = class _SemanticValidator {
163363
163415
  constructor(documentManager) {
163364
163416
  this.documentManager = documentManager;
@@ -163435,7 +163487,7 @@ var SemanticValidator = class _SemanticValidator {
163435
163487
  diagnostics.push(...this.checkAmbiguousNamespaceName(symbols, allSymbols));
163436
163488
  diagnostics.push(...this.checkUnusedDefinitions(allSymbols, uri));
163437
163489
  diagnostics.push(...this.checkRedefinitionMultiplicity(symbols, indexes, text));
163438
- diagnostics.push(...this.checkPortCompatibility(text, uri, indexes));
163490
+ diagnostics.push(...this.checkPortCompatibility(text, uri, symbols, indexes));
163439
163491
  diagnostics.push(...this.checkConstraintBodyReferences(text, uri, symbols, indexes));
163440
163492
  diagnostics.push(...this.checkCircularSpecialization(symbols, indexes));
163441
163493
  diagnostics.push(...this.checkUnsatisfiedRequirements(symbols, indexes));
@@ -163656,7 +163708,7 @@ var SemanticValidator = class _SemanticValidator {
163656
163708
  opts?.text ? [opts.text] : []
163657
163709
  ));
163658
163710
  if (opts?.text && opts.uri) {
163659
- diagnostics.push(...instance.checkPortCompatibility(opts.text, opts.uri, indexes));
163711
+ diagnostics.push(...instance.checkPortCompatibility(opts.text, opts.uri, symbolsInUri, indexes));
163660
163712
  diagnostics.push(...instance.checkConstraintBodyReferences(opts.text, opts.uri, symbolsInUri, indexes));
163661
163713
  }
163662
163714
  return instance.dedupeDiagnostics(diagnostics);
@@ -164019,17 +164071,20 @@ var SemanticValidator = class _SemanticValidator {
164019
164071
  * - The connection is within an interface usage
164020
164072
  * - Both ports are untyped (empty port defs with no features)
164021
164073
  */
164022
- checkPortCompatibility(text, uri, indexes) {
164074
+ checkPortCompatibility(text, uri, symbolsInUri, indexes) {
164023
164075
  if (!text) return [];
164024
164076
  const diagnostics = [];
164025
164077
  const lines = text.split("\n");
164026
164078
  const re = /\bconnect\s+([A-Za-z_][\w.]*)\s+to\s+([A-Za-z_][\w.]*)/g;
164027
164079
  let m2;
164028
164080
  while ((m2 = re.exec(text)) !== null) {
164029
- const left = m2[1].split(".").pop();
164030
- const right = m2[2].split(".").pop();
164031
- const lSym = (indexes.portsByName.get(left) ?? [])[0];
164032
- const rSym = (indexes.portsByName.get(right) ?? [])[0];
164081
+ const leftPath = m2[1].split(".");
164082
+ const rightPath = m2[2].split(".");
164083
+ const left = leftPath[leftPath.length - 1];
164084
+ const right = rightPath[rightPath.length - 1];
164085
+ const scope = this.connectorScope(symbolsInUri, this.indexToRange(text, m2.index, 0).start, indexes);
164086
+ const lSym = this.resolveConnectorEnd(leftPath, scope, indexes);
164087
+ const rSym = this.resolveConnectorEnd(rightPath, scope, indexes);
164033
164088
  if (!lSym || !rSym) continue;
164034
164089
  const lType = lSym.typeNames[0] ?? lSym.typeName;
164035
164090
  const rType = rSym.typeNames[0] ?? rSym.typeName;
@@ -164079,6 +164134,55 @@ var SemanticValidator = class _SemanticValidator {
164079
164134
  }
164080
164135
  return diagnostics;
164081
164136
  }
164137
+ /**
164138
+ * The innermost element around `position` that owns a connector declared
164139
+ * there: the connector's own symbol, when it has one, is skipped.
164140
+ */
164141
+ connectorScope(symbols, position, indexes) {
164142
+ const before = (a, b) => a.line < b.line || a.line === b.line && a.character <= b.character;
164143
+ const size = (r) => (r.end.line - r.start.line) * 1e6 + (r.end.character - r.start.character);
164144
+ let scope;
164145
+ for (const s of symbols) {
164146
+ if (!before(s.range.start, position) || !before(position, s.range.end)) continue;
164147
+ if (!scope || size(s.range) < size(scope.range)) scope = s;
164148
+ }
164149
+ while (scope && CONNECTOR_KINDS.has(scope.kind)) scope = ownerOf2(scope, indexes);
164150
+ return scope;
164151
+ }
164152
+ /**
164153
+ * The port that a connector end (`a.p`, `a.p.q`) names, resolved from
164154
+ * `scope` outward: its first segment is a feature of `scope` or of one of
164155
+ * its owners, each next one a feature of the one before. Two parts can each
164156
+ * have a port of the same name, so an end is never matched by its last
164157
+ * segment alone, except when the path does not resolve and the workspace
164158
+ * has only one port of that name.
164159
+ */
164160
+ resolveConnectorEnd(path, scope, indexes) {
164161
+ let feature;
164162
+ for (let namespace = scope; namespace && !feature; namespace = ownerOf2(namespace, indexes)) {
164163
+ feature = this.findFeature(namespace, path[0], indexes);
164164
+ }
164165
+ for (const name of path.slice(1)) {
164166
+ feature = feature && this.findFeature(feature, name, indexes);
164167
+ }
164168
+ if (feature) return feature.kind === "port" /* PortUsage */ ? feature : void 0;
164169
+ const sameName = indexes.portsByName.get(path[path.length - 1]) ?? [];
164170
+ return sameName.length === 1 ? sameName[0] : void 0;
164171
+ }
164172
+ /** The feature `name` of `owner`: its own member, else a member of one of its types or their supertypes. */
164173
+ findFeature(owner, name, indexes) {
164174
+ const own2 = (indexes.byParent.get(namespaceKeyOf(owner)) ?? []).find((s) => s.name === name);
164175
+ if (own2) return own2;
164176
+ for (const typeName of owner.typeNames) {
164177
+ const type = this.namespaceResolver.resolveNameFrom(owner, typeName, indexes);
164178
+ if (!type || !isDefinition(type.kind)) continue;
164179
+ for (const definition of this.getSpecializationHierarchy(type, indexes).flat()) {
164180
+ const member = (indexes.byParent.get(namespaceKeyOf(definition)) ?? []).find((s) => s.name === name);
164181
+ if (member) return member;
164182
+ }
164183
+ }
164184
+ return void 0;
164185
+ }
164082
164186
  /**
164083
164187
  * Resolve the full type hierarchy for a type name by following
164084
164188
  * specialization chains transitively (max depth 10).
@@ -164126,7 +164230,7 @@ var SemanticValidator = class _SemanticValidator {
164126
164230
  }
164127
164231
  const parent = this.findConstraintScopeSymbol(symbolsInUri, indexes, b.startLine);
164128
164232
  if (!parent) continue;
164129
- const parentMembers = indexes.byParent.get(namespaceKeyOf(parent)) ?? [];
164233
+ const parentMembers = this.getConstraintScopeMembers(parent, indexes);
164130
164234
  if (parentMembers.length === 0) continue;
164131
164235
  const ignoredRanges = this.getIgnoredBodyRanges(b.body);
164132
164236
  const idRe = /\b([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*)\b/g;
@@ -164185,18 +164289,135 @@ var SemanticValidator = class _SemanticValidator {
164185
164289
  const root = parentMembers.find((s) => s.name === path[0]);
164186
164290
  if (!root) return false;
164187
164291
  if (path.length === 1) return true;
164188
- let typeName = root.typeNames[0] ?? root.typeName;
164292
+ let current = root;
164189
164293
  for (let i = 1; i < path.length; i++) {
164294
+ const typeName = current.typeNames[0] ?? current.typeName;
164190
164295
  if (!typeName) return false;
164191
- const typeDefs = indexes.definitionsByName.get(typeName) ?? [];
164192
- const typeDef = typeDefs[0];
164193
- if (!typeDef) return false;
164194
- const member = (indexes.byParent.get(namespaceKeyOf(typeDef)) ?? []).find((s) => s.name === path[i]);
164296
+ const typeDef = this.namespaceResolver.resolveNameFrom(current, typeName, indexes);
164297
+ if (!typeDef || !isDefinition(typeDef.kind)) return false;
164298
+ const member = this.getConstraintScopeMembers(typeDef, indexes, true).find((s) => s.name === path[i]);
164195
164299
  if (!member) return false;
164196
- typeName = member.typeNames[0] ?? member.typeName;
164300
+ current = member;
164197
164301
  }
164198
164302
  return true;
164199
164303
  }
164304
+ getConstraintScopeMembers(scope, indexes, publicOnly = false) {
164305
+ const hierarchy = [[scope]];
164306
+ const visited = /* @__PURE__ */ new Set([scope]);
164307
+ let frontier = [scope];
164308
+ while (frontier.length > 0) {
164309
+ const next = [];
164310
+ for (const current of frontier) {
164311
+ for (const typeName of current.typeNames) {
164312
+ const supertype = this.namespaceResolver.resolveNameFrom(current, typeName, indexes);
164313
+ if (!supertype || !isDefinition(supertype.kind) || visited.has(supertype)) continue;
164314
+ visited.add(supertype);
164315
+ next.push(supertype);
164316
+ }
164317
+ }
164318
+ if (next.length > 0) hierarchy.push(next);
164319
+ frontier = next;
164320
+ }
164321
+ const membersByLevel = hierarchy.map((level) => level.flatMap((namespace) => indexes.byParent.get(namespaceKeyOf(namespace)) ?? []));
164322
+ const hiddenMembers = /* @__PURE__ */ new Set();
164323
+ for (let level = membersByLevel.length - 1; level >= 0; level--) {
164324
+ for (const redefining of membersByLevel[level]) {
164325
+ for (const target of redefining.redefinedFeatureTargets ?? []) {
164326
+ const owner = ownerOf2(redefining, indexes);
164327
+ if (!owner) continue;
164328
+ for (const candidate of this.resolveInheritedRedefinitionTarget(owner, target, hiddenMembers, indexes)) {
164329
+ hiddenMembers.add(candidate.symbolId);
164330
+ }
164331
+ }
164332
+ if (redefining.kind === "subject" /* SubjectUsage */) {
164333
+ const owner = ownerOf2(redefining, indexes);
164334
+ if (!owner) continue;
164335
+ for (const ancestor of this.getSpecializationHierarchy(owner, indexes).slice(1).flat()) {
164336
+ for (const candidate of indexes.byParent.get(namespaceKeyOf(ancestor)) ?? []) {
164337
+ if (candidate.kind === "subject" /* SubjectUsage */) hiddenMembers.add(candidate.symbolId);
164338
+ }
164339
+ }
164340
+ }
164341
+ }
164342
+ }
164343
+ const membersByName = /* @__PURE__ */ new Map();
164344
+ for (let level = 0; level < membersByLevel.length; level++) {
164345
+ for (const member of membersByLevel[level]) {
164346
+ if (level > 0 && member.visibility === "private") continue;
164347
+ if (publicOnly && member.visibility !== void 0 && member.visibility !== "public") continue;
164348
+ if (hiddenMembers.has(member.symbolId) || membersByName.has(member.name)) continue;
164349
+ membersByName.set(member.name, member);
164350
+ }
164351
+ }
164352
+ return [...membersByName.values()];
164353
+ }
164354
+ resolveInheritedRedefinitionTarget(owner, target, alreadyRedefined, indexes) {
164355
+ if (target.includes(".")) return [];
164356
+ const segments = target.split("::");
164357
+ const targetName = segments.pop()?.replace(/^'|'$/g, "");
164358
+ if (!targetName) return [];
164359
+ const qualifier = segments.join("::").replace(/^'|'$/g, "");
164360
+ const matches = /* @__PURE__ */ new Map();
164361
+ for (const supertype of this.resolveDirectSupertypes(owner, indexes)) {
164362
+ const branch = this.getSpecializationHierarchy(supertype, indexes);
164363
+ const anchors = qualifier ? branch.flat().filter((type) => this.matchesSpecializationQualifier(type, qualifier)) : [supertype];
164364
+ for (const anchor2 of anchors) {
164365
+ let frontier = [anchor2];
164366
+ const visited = new Set(frontier);
164367
+ const candidates = [];
164368
+ while (frontier.length > 0 && candidates.length === 0) {
164369
+ for (const type of frontier) {
164370
+ for (const member of indexes.byParent.get(namespaceKeyOf(type)) ?? []) {
164371
+ if (member.name === targetName && member.visibility !== "private" && !alreadyRedefined.has(member.symbolId)) {
164372
+ candidates.push(member);
164373
+ }
164374
+ }
164375
+ }
164376
+ if (candidates.length > 0) break;
164377
+ const next = /* @__PURE__ */ new Map();
164378
+ for (const type of frontier) {
164379
+ for (const parent of this.resolveDirectSupertypes(type, indexes)) {
164380
+ if (visited.has(parent)) continue;
164381
+ visited.add(parent);
164382
+ next.set(parent.symbolId, parent);
164383
+ }
164384
+ }
164385
+ frontier = [...next.values()];
164386
+ }
164387
+ for (const candidate of candidates) matches.set(candidate.symbolId, candidate);
164388
+ }
164389
+ }
164390
+ return matches.size === 1 ? [...matches.values()] : [];
164391
+ }
164392
+ resolveDirectSupertypes(scope, indexes) {
164393
+ const supertypes = /* @__PURE__ */ new Map();
164394
+ for (const typeName of scope.typeNames) {
164395
+ const supertype = this.namespaceResolver.resolveNameFrom(scope, typeName, indexes);
164396
+ if (supertype && isDefinition(supertype.kind)) supertypes.set(supertype.symbolId, supertype);
164397
+ }
164398
+ return [...supertypes.values()];
164399
+ }
164400
+ getSpecializationHierarchy(scope, indexes) {
164401
+ const levels = [[scope]];
164402
+ const visited = /* @__PURE__ */ new Set([scope]);
164403
+ let frontier = [scope];
164404
+ while (frontier.length > 0) {
164405
+ const next = [];
164406
+ for (const type of frontier) {
164407
+ for (const parent of this.resolveDirectSupertypes(type, indexes)) {
164408
+ if (visited.has(parent)) continue;
164409
+ visited.add(parent);
164410
+ next.push(parent);
164411
+ }
164412
+ }
164413
+ if (next.length > 0) levels.push(next);
164414
+ frontier = next;
164415
+ }
164416
+ return levels;
164417
+ }
164418
+ matchesSpecializationQualifier(type, qualifier) {
164419
+ return type.name === qualifier || type.qualifiedName === qualifier || type.qualifiedName?.endsWith(`::${qualifier}`) === true;
164420
+ }
164200
164421
  findContainingSymbolByLine(symbols, line) {
164201
164422
  return symbols.filter((s) => s.range.start.line <= line && s.range.end.line >= line).sort((a, b) => {
164202
164423
  const ar = (a.range.end.line - a.range.start.line) * 1e3 + (a.range.end.character - a.range.start.character);
@@ -164207,7 +164428,7 @@ var SemanticValidator = class _SemanticValidator {
164207
164428
  findConstraintScopeSymbol(symbolsInUri, indexes, line) {
164208
164429
  let scope = this.findContainingSymbolByLine(symbolsInUri, line);
164209
164430
  while (scope) {
164210
- const members2 = indexes.byParent.get(namespaceKeyOf(scope)) ?? [];
164431
+ const members2 = this.getConstraintScopeMembers(scope, indexes);
164211
164432
  if (members2.length > 0) return scope;
164212
164433
  if (!scope.parentId) return scope;
164213
164434
  scope = ownerOf2(scope, indexes);