sysml-v2-lsp 0.35.0 → 0.37.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.
@@ -118,28 +118,28 @@ var require_messages = __commonJS({
118
118
  Object.defineProperty(exports2, "__esModule", { value: true });
119
119
  exports2.Message = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0;
120
120
  var is = require_is2();
121
- var ErrorCodes;
122
- (function(ErrorCodes2) {
123
- ErrorCodes2.ParseError = -32700;
124
- ErrorCodes2.InvalidRequest = -32600;
125
- ErrorCodes2.MethodNotFound = -32601;
126
- ErrorCodes2.InvalidParams = -32602;
127
- ErrorCodes2.InternalError = -32603;
128
- ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099;
129
- ErrorCodes2.serverErrorStart = -32099;
130
- ErrorCodes2.MessageWriteError = -32099;
131
- ErrorCodes2.MessageReadError = -32098;
132
- ErrorCodes2.PendingResponseRejected = -32097;
133
- ErrorCodes2.ConnectionInactive = -32096;
134
- ErrorCodes2.ServerNotInitialized = -32002;
135
- ErrorCodes2.UnknownErrorCode = -32001;
136
- ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3;
137
- ErrorCodes2.serverErrorEnd = -32e3;
138
- })(ErrorCodes || (exports2.ErrorCodes = ErrorCodes = {}));
139
- var ResponseError = class _ResponseError extends Error {
121
+ var ErrorCodes2;
122
+ (function(ErrorCodes3) {
123
+ ErrorCodes3.ParseError = -32700;
124
+ ErrorCodes3.InvalidRequest = -32600;
125
+ ErrorCodes3.MethodNotFound = -32601;
126
+ ErrorCodes3.InvalidParams = -32602;
127
+ ErrorCodes3.InternalError = -32603;
128
+ ErrorCodes3.jsonrpcReservedErrorRangeStart = -32099;
129
+ ErrorCodes3.serverErrorStart = -32099;
130
+ ErrorCodes3.MessageWriteError = -32099;
131
+ ErrorCodes3.MessageReadError = -32098;
132
+ ErrorCodes3.PendingResponseRejected = -32097;
133
+ ErrorCodes3.ConnectionInactive = -32096;
134
+ ErrorCodes3.ServerNotInitialized = -32002;
135
+ ErrorCodes3.UnknownErrorCode = -32001;
136
+ ErrorCodes3.jsonrpcReservedErrorRangeEnd = -32e3;
137
+ ErrorCodes3.serverErrorEnd = -32e3;
138
+ })(ErrorCodes2 || (exports2.ErrorCodes = ErrorCodes2 = {}));
139
+ var ResponseError2 = class _ResponseError extends Error {
140
140
  constructor(code, message, data) {
141
141
  super(message);
142
- this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
142
+ this.code = is.number(code) ? code : ErrorCodes2.UnknownErrorCode;
143
143
  this.data = data;
144
144
  Object.setPrototypeOf(this, _ResponseError.prototype);
145
145
  }
@@ -154,7 +154,7 @@ var require_messages = __commonJS({
154
154
  return result;
155
155
  }
156
156
  };
157
- exports2.ResponseError = ResponseError;
157
+ exports2.ResponseError = ResponseError2;
158
158
  var ParameterStructures = class _ParameterStructures {
159
159
  constructor(kind) {
160
160
  this.kind = kind;
@@ -3375,8 +3375,8 @@ var require_main2 = __commonJS({
3375
3375
  }
3376
3376
  uinteger2.is = is;
3377
3377
  })(uinteger || (exports3.uinteger = uinteger = {}));
3378
- var Position2;
3379
- (function(Position3) {
3378
+ var Position4;
3379
+ (function(Position5) {
3380
3380
  function create(line, character) {
3381
3381
  if (line === Number.MAX_VALUE) {
3382
3382
  line = uinteger.MAX_VALUE;
@@ -3386,43 +3386,43 @@ var require_main2 = __commonJS({
3386
3386
  }
3387
3387
  return { line, character };
3388
3388
  }
3389
- Position3.create = create;
3389
+ Position5.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
- Position3.is = is;
3395
- })(Position2 || (exports3.Position = Position2 = {}));
3396
- var Range2;
3397
- (function(Range3) {
3394
+ Position5.is = is;
3395
+ })(Position4 || (exports3.Position = Position4 = {}));
3396
+ var Range6;
3397
+ (function(Range7) {
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: Position2.create(one, two), end: Position2.create(three, four) };
3401
- } else if (Position2.is(one) && Position2.is(two)) {
3400
+ return { start: Position4.create(one, two), end: Position4.create(three, four) };
3401
+ } else if (Position4.is(one) && Position4.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
- Range3.create = create;
3407
+ Range7.create = create;
3408
3408
  function is(value) {
3409
3409
  var candidate = value;
3410
- return Is.objectLiteral(candidate) && Position2.is(candidate.start) && Position2.is(candidate.end);
3410
+ return Is.objectLiteral(candidate) && Position4.is(candidate.start) && Position4.is(candidate.end);
3411
3411
  }
3412
- Range3.is = is;
3413
- })(Range2 || (exports3.Range = Range2 = {}));
3414
- var Location2;
3415
- (function(Location3) {
3412
+ Range7.is = is;
3413
+ })(Range6 || (exports3.Range = Range6 = {}));
3414
+ var Location3;
3415
+ (function(Location4) {
3416
3416
  function create(uri, range) {
3417
3417
  return { uri, range };
3418
3418
  }
3419
- Location3.create = create;
3419
+ Location4.create = create;
3420
3420
  function is(value) {
3421
3421
  var candidate = value;
3422
- return Is.objectLiteral(candidate) && Range2.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
3422
+ return Is.objectLiteral(candidate) && Range6.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
3423
3423
  }
3424
- Location3.is = is;
3425
- })(Location2 || (exports3.Location = Location2 = {}));
3424
+ Location4.is = is;
3425
+ })(Location3 || (exports3.Location = Location3 = {}));
3426
3426
  var LocationLink;
3427
3427
  (function(LocationLink2) {
3428
3428
  function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
@@ -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) && Range2.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range2.is(candidate.targetSelectionRange) && (Range2.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
3434
+ return Is.objectLiteral(candidate) && Range6.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range6.is(candidate.targetSelectionRange) && (Range6.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) && Range2.is(candidate.range) && Color.is(candidate.color);
3466
+ return Is.objectLiteral(candidate) && Range6.is(candidate.range) && Color.is(candidate.color);
3467
3467
  }
3468
3468
  ColorInformation2.is = is;
3469
3469
  })(ColorInformation || (exports3.ColorInformation = ColorInformation = {}));
@@ -3479,7 +3479,7 @@ var require_main2 = __commonJS({
3479
3479
  ColorPresentation2.create = create;
3480
3480
  function is(value) {
3481
3481
  var candidate = value;
3482
- return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit4.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit4.is));
3482
+ return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit5.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit5.is));
3483
3483
  }
3484
3484
  ColorPresentation2.is = is;
3485
3485
  })(ColorPresentation || (exports3.ColorPresentation = ColorPresentation = {}));
@@ -3528,7 +3528,7 @@ var require_main2 = __commonJS({
3528
3528
  DiagnosticRelatedInformation2.create = create;
3529
3529
  function is(value) {
3530
3530
  var candidate = value;
3531
- return Is.defined(candidate) && Location2.is(candidate.location) && Is.string(candidate.message);
3531
+ return Is.defined(candidate) && Location3.is(candidate.location) && Is.string(candidate.message);
3532
3532
  }
3533
3533
  DiagnosticRelatedInformation2.is = is;
3534
3534
  })(DiagnosticRelatedInformation || (exports3.DiagnosticRelatedInformation = DiagnosticRelatedInformation = {}));
@@ -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) && 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((_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));
3577
+ return Is.defined(candidate) && Range6.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 = {}));
@@ -3598,26 +3598,26 @@ var require_main2 = __commonJS({
3598
3598
  }
3599
3599
  Command2.is = is;
3600
3600
  })(Command || (exports3.Command = Command = {}));
3601
- var TextEdit4;
3602
- (function(TextEdit5) {
3601
+ var TextEdit5;
3602
+ (function(TextEdit6) {
3603
3603
  function replace(range, newText) {
3604
3604
  return { range, newText };
3605
3605
  }
3606
- TextEdit5.replace = replace;
3606
+ TextEdit6.replace = replace;
3607
3607
  function insert(position, newText) {
3608
3608
  return { range: { start: position, end: position }, newText };
3609
3609
  }
3610
- TextEdit5.insert = insert;
3610
+ TextEdit6.insert = insert;
3611
3611
  function del(range) {
3612
3612
  return { range, newText: "" };
3613
3613
  }
3614
- TextEdit5.del = del;
3614
+ TextEdit6.del = del;
3615
3615
  function is(value) {
3616
3616
  var candidate = value;
3617
- return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range2.is(candidate.range);
3617
+ return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range6.is(candidate.range);
3618
3618
  }
3619
- TextEdit5.is = is;
3620
- })(TextEdit4 || (exports3.TextEdit = TextEdit4 = {}));
3619
+ TextEdit6.is = is;
3620
+ })(TextEdit5 || (exports3.TextEdit = TextEdit5 = {}));
3621
3621
  var ChangeAnnotation;
3622
3622
  (function(ChangeAnnotation2) {
3623
3623
  function create(label, needsConfirmation, description) {
@@ -3661,7 +3661,7 @@ var require_main2 = __commonJS({
3661
3661
  AnnotatedTextEdit2.del = del;
3662
3662
  function is(value) {
3663
3663
  var candidate = value;
3664
- return TextEdit4.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
3664
+ return TextEdit5.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
3665
3665
  }
3666
3666
  AnnotatedTextEdit2.is = is;
3667
3667
  })(AnnotatedTextEdit || (exports3.AnnotatedTextEdit = AnnotatedTextEdit = {}));
@@ -3744,8 +3744,8 @@ var require_main2 = __commonJS({
3744
3744
  }
3745
3745
  DeleteFile2.is = is;
3746
3746
  })(DeleteFile || (exports3.DeleteFile = DeleteFile = {}));
3747
- var WorkspaceEdit3;
3748
- (function(WorkspaceEdit4) {
3747
+ var WorkspaceEdit4;
3748
+ (function(WorkspaceEdit5) {
3749
3749
  function is(value) {
3750
3750
  var candidate = value;
3751
3751
  return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) {
@@ -3756,8 +3756,8 @@ var require_main2 = __commonJS({
3756
3756
  }
3757
3757
  }));
3758
3758
  }
3759
- WorkspaceEdit4.is = is;
3760
- })(WorkspaceEdit3 || (exports3.WorkspaceEdit = WorkspaceEdit3 = {}));
3759
+ WorkspaceEdit5.is = is;
3760
+ })(WorkspaceEdit4 || (exports3.WorkspaceEdit = WorkspaceEdit4 = {}));
3761
3761
  var TextEditChangeImpl = (
3762
3762
  /** @class */
3763
3763
  (function() {
@@ -3769,7 +3769,7 @@ var require_main2 = __commonJS({
3769
3769
  var edit;
3770
3770
  var id;
3771
3771
  if (annotation === void 0) {
3772
- edit = TextEdit4.insert(position, newText);
3772
+ edit = TextEdit5.insert(position, newText);
3773
3773
  } else if (ChangeAnnotationIdentifier.is(annotation)) {
3774
3774
  id = annotation;
3775
3775
  edit = AnnotatedTextEdit.insert(position, newText, annotation);
@@ -3787,7 +3787,7 @@ var require_main2 = __commonJS({
3787
3787
  var edit;
3788
3788
  var id;
3789
3789
  if (annotation === void 0) {
3790
- edit = TextEdit4.replace(range, newText);
3790
+ edit = TextEdit5.replace(range, newText);
3791
3791
  } else if (ChangeAnnotationIdentifier.is(annotation)) {
3792
3792
  id = annotation;
3793
3793
  edit = AnnotatedTextEdit.replace(range, newText, annotation);
@@ -3805,7 +3805,7 @@ var require_main2 = __commonJS({
3805
3805
  var edit;
3806
3806
  var id;
3807
3807
  if (annotation === void 0) {
3808
- edit = TextEdit4.del(range);
3808
+ edit = TextEdit5.del(range);
3809
3809
  } else if (ChangeAnnotationIdentifier.is(annotation)) {
3810
3810
  id = annotation;
3811
3811
  edit = AnnotatedTextEdit.del(range, annotation);
@@ -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) && Range2.is(candidate.insert) && Range2.is(candidate.replace);
4161
+ return candidate && Is.string(candidate.newText) && Range6.is(candidate.insert) && Range6.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 || Range2.is(value.range));
4208
+ return !!candidate && Is.objectLiteral(candidate) && (MarkupContent2.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range6.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) && 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));
4329
+ return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range6.is(candidate.range) && Range6.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 = {}));
@@ -4387,7 +4387,7 @@ var require_main2 = __commonJS({
4387
4387
  CodeAction3.create = create;
4388
4388
  function is(value) {
4389
4389
  var candidate = value;
4390
- return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic6.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit3.is(candidate.edit));
4390
+ return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic6.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit4.is(candidate.edit));
4391
4391
  }
4392
4392
  CodeAction3.is = is;
4393
4393
  })(CodeAction2 || (exports3.CodeAction = CodeAction2 = {}));
@@ -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) && Range2.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
4406
+ return Is.defined(candidate) && Range6.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) && Range2.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
4430
+ return Is.defined(candidate) && Range6.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) && Range2.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
4442
+ return Is.objectLiteral(candidate) && Range6.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 && Range2.is(candidate.range) && Is.string(candidate.text);
4501
+ return candidate !== void 0 && candidate !== null && Range6.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 && Range2.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
4513
+ return candidate !== void 0 && candidate !== null && Range6.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 && Range2.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
4525
+ return candidate !== void 0 && candidate !== null && Range6.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) && Range2.is(value.stoppedLocation);
4537
+ return Is.defined(candidate) && Range6.is(value.stoppedLocation);
4538
4538
  }
4539
4539
  InlineValueContext2.is = is;
4540
4540
  })(InlineValueContext || (exports3.InlineValueContext = InlineValueContext = {}));
@@ -4555,7 +4555,7 @@ var require_main2 = __commonJS({
4555
4555
  InlayHintLabelPart2.create = create;
4556
4556
  function is(value) {
4557
4557
  var candidate = value;
4558
- return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent2.is(candidate.tooltip)) && (candidate.location === void 0 || Location2.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command));
4558
+ return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent2.is(candidate.tooltip)) && (candidate.location === void 0 || Location3.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command));
4559
4559
  }
4560
4560
  InlayHintLabelPart2.is = is;
4561
4561
  })(InlayHintLabelPart || (exports3.InlayHintLabelPart = InlayHintLabelPart = {}));
@@ -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) && 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, 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));
4574
+ return Is.objectLiteral(candidate) && Position4.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, TextEdit5.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 Position2.create(0, offset);
4763
+ return Position4.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 Position2.create(line, offset - lineOffsets[line]);
4774
+ return Position4.create(line, offset - lineOffsets[line]);
4775
4775
  };
4776
4776
  FullTextDocument3.prototype.offsetAt = function(position) {
4777
4777
  var lineOffsets = this.getLineOffsets();
@@ -8880,7 +8880,7 @@ var require_node3 = __commonJS({
8880
8880
  });
8881
8881
 
8882
8882
  // server/src/server.ts
8883
- var import_node12 = __toESM(require_node3());
8883
+ var import_node14 = __toESM(require_node3());
8884
8884
  var fs = __toESM(require("node:fs"));
8885
8885
  var path2 = __toESM(require("node:path"));
8886
8886
  var import_node_url2 = require("node:url");
@@ -121407,18 +121407,71 @@ var SysMLErrorListener = class extends BaseErrorListener {
121407
121407
  }
121408
121408
  };
121409
121409
 
121410
+ // server/src/parser/positionUtils.ts
121411
+ function normalizeUtf16Columns(text, tokens, errors) {
121412
+ if (!/[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(text)) return;
121413
+ const columns = /* @__PURE__ */ new Map();
121414
+ const lines = text.split("\n");
121415
+ for (let line = 0; line < lines.length; line++) {
121416
+ if (!/[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(lines[line])) continue;
121417
+ const offsets = [0];
121418
+ for (const character of lines[line]) offsets.push(offsets[offsets.length - 1] + character.length);
121419
+ columns.set(line, offsets);
121420
+ }
121421
+ for (const token of tokens) {
121422
+ token.column = columns.get(token.line - 1)?.[token.column] ?? token.column;
121423
+ }
121424
+ for (const error of errors) {
121425
+ error.column = columns.get(error.line)?.[error.column] ?? error.column;
121426
+ }
121427
+ }
121428
+ function tokenToPosition(token) {
121429
+ return {
121430
+ line: (token.line ?? 1) - 1,
121431
+ character: token.column ?? 0
121432
+ };
121433
+ }
121434
+ function tokenToRange(token) {
121435
+ const start = tokenToPosition(token);
121436
+ const length = token.text?.length ?? 1;
121437
+ return {
121438
+ start,
121439
+ end: { line: start.line, character: start.character + length }
121440
+ };
121441
+ }
121442
+ function contextToRange(ctx) {
121443
+ const startToken = ctx.start;
121444
+ const stopToken = ctx.stop ?? ctx.start;
121445
+ if (!startToken) {
121446
+ return { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } };
121447
+ }
121448
+ const start = {
121449
+ line: (startToken.line ?? 1) - 1,
121450
+ character: startToken.column ?? 0
121451
+ };
121452
+ const end = stopToken ? {
121453
+ line: (stopToken.line ?? 1) - 1,
121454
+ character: (stopToken.column ?? 0) + (stopToken.text?.length ?? 1)
121455
+ } : { line: start.line, character: start.character + 1 };
121456
+ return { start, end };
121457
+ }
121458
+
121410
121459
  // server/src/parser/parseDocument.ts
121460
+ function withUtf16Columns(text, result) {
121461
+ normalizeUtf16Columns(text, result.tokenStream.getTokens(), result.errors);
121462
+ return result;
121463
+ }
121411
121464
  function parseDocument(text) {
121412
121465
  const result = parseDocumentCore(text);
121413
121466
  if (result.errors.length > 0 && hasStaleDfaStates()) {
121414
121467
  markDfaNotPreSeeded();
121415
121468
  clearAllDFAStates();
121416
- return parseDocumentLL(text, result.lexer, result.tokenStream);
121469
+ return withUtf16Columns(text, parseDocumentLL(text, result.lexer, result.tokenStream));
121417
121470
  }
121418
121471
  if (isDfaPreSeeded()) {
121419
121472
  markDfaNotPreSeeded();
121420
121473
  }
121421
- return result;
121474
+ return withUtf16Columns(text, result);
121422
121475
  }
121423
121476
  function parseDocumentCore(text) {
121424
121477
  const inputStream = CharStream.fromString(text);
@@ -121560,19 +121613,19 @@ function parseDocumentBatch(text) {
121560
121613
  if (errors.length > 0 && hasStaleDfaStates()) {
121561
121614
  markDfaNotPreSeeded();
121562
121615
  clearAllDFAStates();
121563
- return parseDocumentBatchLL(text, lexer, tokenStream, lexMs);
121616
+ return withUtf16Columns(text, parseDocumentBatchLL(text, lexer, tokenStream, lexMs));
121564
121617
  }
121565
121618
  if (isDfaPreSeeded()) {
121566
121619
  markDfaNotPreSeeded();
121567
121620
  }
121568
- return {
121621
+ return withUtf16Columns(text, {
121569
121622
  tree,
121570
121623
  tokenStream,
121571
121624
  parser,
121572
121625
  lexer,
121573
121626
  errors,
121574
121627
  timing: { lexMs, parseMs }
121575
- };
121628
+ });
121576
121629
  }
121577
121630
  function parseDocumentBatchLL(_text, lexer, tokenStream, lexMs) {
121578
121631
  tokenStream.seek(0);
@@ -121598,41 +121651,162 @@ function parseDocumentBatchLL(_text, lexer, tokenStream, lexMs) {
121598
121651
  };
121599
121652
  }
121600
121653
 
121601
- // server/src/parser/positionUtils.ts
121602
- function tokenToPosition(token) {
121603
- return {
121604
- line: (token.line ?? 1) - 1,
121605
- character: token.column ?? 0
121606
- };
121654
+ // server/src/utils/sysmlKeywords.ts
121655
+ var SYSML_KEYWORDS_ARRAY = SysMLv2Lexer.literalNames.filter((n2) => n2 != null).map((n2) => n2.replace(/^'|'$/g, "")).filter((n2) => /^[a-z]+$/.test(n2)).sort();
121656
+ var SYSML_KEYWORDS = new Set(SYSML_KEYWORDS_ARRAY);
121657
+
121658
+ // server/src/utils/identUtils.ts
121659
+ function isIdentStart(c) {
121660
+ return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 95;
121607
121661
  }
121608
- function tokenToRange(token) {
121609
- const start = tokenToPosition(token);
121610
- const length = token.text?.length ?? 1;
121611
- return {
121612
- start,
121613
- end: { line: start.line, character: start.character + length }
121614
- };
121662
+ function isIdentPart(c) {
121663
+ return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c >= 48 && c <= 57 || c === 95;
121615
121664
  }
121616
- function contextToRange(ctx) {
121617
- const startToken = ctx.start;
121618
- const stopToken = ctx.stop ?? ctx.start;
121619
- if (!startToken) {
121620
- return { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } };
121665
+ var ESCAPES = {
121666
+ b: "\b",
121667
+ t: " ",
121668
+ n: "\n",
121669
+ f: "\f",
121670
+ r: "\r",
121671
+ "'": "'",
121672
+ '"': '"',
121673
+ "\\": "\\"
121674
+ };
121675
+ function unquoteName(text) {
121676
+ if (!text.startsWith("'") || !text.endsWith("'")) return text;
121677
+ return text.slice(1, -1).replace(/\\([btnfr'"\\])/g, (_, ch) => ESCAPES[ch]);
121678
+ }
121679
+ function quoteName(name) {
121680
+ if (/^[A-Za-z_][A-Za-z_0-9]*$/.test(name) && !SYSML_KEYWORDS.has(name)) return name;
121681
+ const escaped = name.replace(/[\\'\b\t\n\f\r]/g, (ch) => {
121682
+ const entry = Object.entries(ESCAPES).find(([, value]) => value === ch);
121683
+ return `\\${entry[0]}`;
121684
+ });
121685
+ return `'${escaped}'`;
121686
+ }
121687
+ function splitQualifiedName(text) {
121688
+ const parts = [];
121689
+ let start = 0;
121690
+ let quoted = false;
121691
+ for (let i = 0; i < text.length; i++) {
121692
+ if (quoted && text[i] === "\\") {
121693
+ i++;
121694
+ continue;
121695
+ }
121696
+ if (text[i] === "'" && (quoted || i === start)) quoted = !quoted;
121697
+ if (!quoted && text.startsWith("::", i)) {
121698
+ parts.push(unquoteName(text.slice(start, i).trim()));
121699
+ start = i + 2;
121700
+ i++;
121701
+ }
121621
121702
  }
121622
- const start = {
121623
- line: (startToken.line ?? 1) - 1,
121624
- character: startToken.column ?? 0
121625
- };
121626
- const end = stopToken ? {
121627
- line: (stopToken.line ?? 1) - 1,
121628
- character: (stopToken.column ?? 0) + (stopToken.text?.length ?? 1)
121629
- } : { line: start.line, character: start.character + 1 };
121630
- return { start, end };
121703
+ parts.push(unquoteName(text.slice(start).trim()));
121704
+ return parts;
121705
+ }
121706
+ function joinQualifiedName(parts) {
121707
+ return parts.map((part) => /::|['\\\r\n\t\b\f]/.test(part) ? quoteName(part) : part).join("::");
121708
+ }
121709
+ function readNameAt(text, start, allowIncomplete = false) {
121710
+ if (text[start] === "'") {
121711
+ let end2 = start + 1;
121712
+ while (end2 < text.length && text[end2] !== "'") {
121713
+ if (text[end2] === "\r" || text[end2] === "\n") return void 0;
121714
+ if (text[end2] === "\\") {
121715
+ if (!Object.hasOwn(ESCAPES, text[end2 + 1])) return void 0;
121716
+ end2++;
121717
+ }
121718
+ end2++;
121719
+ }
121720
+ if (end2 >= text.length) {
121721
+ return allowIncomplete ? { name: unquoteName(`${text.slice(start)}'`), start, end: text.length } : void 0;
121722
+ }
121723
+ if (end2 === start + 1 && !allowIncomplete) return void 0;
121724
+ return { name: unquoteName(text.slice(start, end2 + 1)), start, end: end2 + 1 };
121725
+ }
121726
+ if (!isIdentStart(text.charCodeAt(start))) return void 0;
121727
+ let end = start + 1;
121728
+ while (end < text.length && isIdentPart(text.charCodeAt(end))) end++;
121729
+ return { name: text.slice(start, end), start, end };
121730
+ }
121731
+ function readQualifiedNameAt(text, start, allowIncomplete = false) {
121732
+ const first = readNameAt(text, start, allowIncomplete);
121733
+ if (!first) return void 0;
121734
+ const segments = [first];
121735
+ let end = first.end;
121736
+ while (end < text.length) {
121737
+ let next = end;
121738
+ while (/\s/.test(text[next] ?? "") && next < text.length) next++;
121739
+ if (!text.startsWith("::", next)) break;
121740
+ next += 2;
121741
+ while (/\s/.test(text[next] ?? "") && next < text.length) next++;
121742
+ const segment = readNameAt(text, next, allowIncomplete);
121743
+ if (!segment) break;
121744
+ segments.push(segment);
121745
+ end = segment.end;
121746
+ }
121747
+ return { name: joinQualifiedName(segments.map((s) => s.name)), start, end, segments };
121748
+ }
121749
+ function* scanQualifiedNames(text, allowIncomplete = false) {
121750
+ let i = 0;
121751
+ while (i < text.length) {
121752
+ if (text.startsWith("//", i)) {
121753
+ const end = text.indexOf("\n", i + 2);
121754
+ i = end < 0 ? text.length : end + 1;
121755
+ } else if (text.startsWith("/*", i)) {
121756
+ const end = text.indexOf("*/", i + 2);
121757
+ i = end < 0 ? text.length : end + 2;
121758
+ } else if (text[i] === '"') {
121759
+ i++;
121760
+ while (i < text.length && text[i] !== '"') i += text[i] === "\\" ? 2 : 1;
121761
+ i++;
121762
+ } else if (/\d/.test(text[i]) || text[i] === "." && /\d/.test(text[i + 1] ?? "")) {
121763
+ const number = text.slice(i).match(/^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/);
121764
+ i += number[0].length;
121765
+ } else {
121766
+ const name = readQualifiedNameAt(text, i, allowIncomplete);
121767
+ if (name) {
121768
+ yield name;
121769
+ i = name.end;
121770
+ } else if (text[i] === "'") {
121771
+ i++;
121772
+ while (i < text.length && text[i] !== "'" && text[i] !== "\n") {
121773
+ i += text[i] === "\\" ? 2 : 1;
121774
+ }
121775
+ if (text[i] === "'") i++;
121776
+ } else {
121777
+ i++;
121778
+ }
121779
+ }
121780
+ }
121781
+ }
121782
+ function* scanFeaturePaths(text) {
121783
+ const names = [...scanQualifiedNames(text)];
121784
+ for (let i = 0; i < names.length; i++) {
121785
+ const first = names[i];
121786
+ const parts = [first.name];
121787
+ const qualifiedNames = [first];
121788
+ let end = first.end;
121789
+ while (i + 1 < names.length && /^\s*\.\s*$/.test(text.slice(end, names[i + 1].start))) {
121790
+ parts.push(names[++i].name);
121791
+ qualifiedNames.push(names[i]);
121792
+ end = names[i].end;
121793
+ }
121794
+ yield { name: parts.join("."), start: first.start, end, qualifiedNames, parts: parts.map((part) => {
121795
+ const segments = splitQualifiedName(part);
121796
+ return segments.length === 1 ? segments[0] : part;
121797
+ }) };
121798
+ }
121799
+ }
121800
+ function extractQualifiedNameAt(text, character) {
121801
+ for (const name of scanQualifiedNames(text)) {
121802
+ if (character >= name.start && character <= name.end) return name.name;
121803
+ if (name.start > character) break;
121804
+ }
121805
+ return void 0;
121806
+ }
121807
+ function stripComments(text) {
121808
+ return text.replace(/\/\*[\s\S]*?\*\//g, (m2) => m2.replace(/[^\n]/g, " ")).replace(/\/\/[^\n]*/g, (m2) => " ".repeat(m2.length));
121631
121809
  }
121632
-
121633
- // server/src/utils/sysmlKeywords.ts
121634
- var SYSML_KEYWORDS_ARRAY = SysMLv2Lexer.literalNames.filter((n2) => n2 != null).map((n2) => n2.replace(/^'|'$/g, "")).filter((n2) => /^[a-z]+$/.test(n2)).sort();
121635
- var SYSML_KEYWORDS = new Set(SYSML_KEYWORDS_ARRAY);
121636
121810
 
121637
121811
  // server/src/utils/documentUri.ts
121638
121812
  function canonicalUri(uri) {
@@ -122411,7 +122585,7 @@ var RE_SPEC_WITH_SUBSETS = /(?:specializes|subsets|:>|:>>)\s*('[^']+'|[A-Za-z_]\
122411
122585
  var RE_DEFINED_BY = /definedby\s*([A-Za-z_]\w*(?:::\w+)*(?:\s*,\s*[A-Za-z_]\w*(?:::\w+)*)*)/;
122412
122586
  var MAX_RULE_SEARCH_DEPTH = 6;
122413
122587
  var RE_TYPING = /:(?![:>])\s*('[^']+'|[A-Za-z_]\w*(?:::\w+)*)/;
122414
- var RE_QUOTED_NAME = /'([^']+)'/;
122588
+ var RE_QUOTED_NAME = /^\s*(?:\$::)?(?:(?:[A-Za-z_]\w*|'\d+')::)*'(\d+)'/;
122415
122589
  var RE_IDENT_START = /^([A-Za-z_]\w*(?:::\w+)*)/;
122416
122590
  var SymbolTable = class {
122417
122591
  /** All symbols indexed by qualified name */
@@ -122478,7 +122652,12 @@ var SymbolTable = class {
122478
122652
  * Find a symbol by name (simple name, not qualified).
122479
122653
  */
122480
122654
  findByName(name) {
122481
- return this.symbolsByName.get(name) ?? [];
122655
+ const exact = this.symbolsByName.get(name);
122656
+ if (exact) return exact;
122657
+ const segments = splitQualifiedName(name);
122658
+ if (segments.length === 1) return this.symbolsByName.get(segments[0]) ?? [];
122659
+ const qualified = this.getSymbol(joinQualifiedName(segments));
122660
+ return qualified ? [qualified] : [];
122482
122661
  }
122483
122662
  /**
122484
122663
  * Find all symbols in a given URI.
@@ -122985,10 +123164,11 @@ var SymbolTable = class {
122985
123164
  const anonymous = !declaredName;
122986
123165
  const name = declaredName ?? "";
122987
123166
  const shortName = transition || isFlowUsage(kind) && !declaredName ? void 0 : this.extractShortName(ctx);
122988
- const qualifiedName = anonymous || owner && owner.qualifiedName === void 0 ? void 0 : owner ? `${owner.qualifiedName}::${name}` : name;
123167
+ const qualifiedName = anonymous || owner && owner.qualifiedName === void 0 ? void 0 : owner ? `${owner.qualifiedName}::${joinQualifiedName([name])}` : joinQualifiedName([name]);
122989
123168
  const selectionRange = anonymous ? ctx.start ? tokenToRange(ctx.start) : range : this.extractNameRange(ctx) ?? range;
122990
123169
  const typeNames = isFlowUsage(kind) ? this.extractFlowTypeNames(ctx) : transition ? this.extractTransitionTypeNames(ctx) : this.extractTypeNames(ctx);
122991
123170
  const specializationNames = this.extractSpecializationNames(ctx);
123171
+ const redefinedFeatureTargets = this.extractRedefinedFeatureTargets(ctx);
122992
123172
  const typeName = typeNames[0];
122993
123173
  const documentation = this.extractDocumentation(ctx);
122994
123174
  const visibility = this.extractVisibility(ctx);
@@ -123019,6 +123199,7 @@ var SymbolTable = class {
123019
123199
  typeName,
123020
123200
  typeNames,
123021
123201
  specializationNames,
123202
+ redefinedFeatureTargets: redefinedFeatureTargets.length > 0 ? redefinedFeatureTargets : void 0,
123022
123203
  documentation,
123023
123204
  visibility,
123024
123205
  source: transition?.source,
@@ -123143,7 +123324,10 @@ var SymbolTable = class {
123143
123324
  }
123144
123325
  /** Remove SysML quoting while retaining qualified and dotted references. */
123145
123326
  cleanTransitionText(text) {
123146
- const cleaned = text.replace(/'([^']+)'/g, "$1").trim();
123327
+ const cleaned = text.replace(
123328
+ /'(?:\\.|[^'\\])*'/g,
123329
+ (name) => joinQualifiedName([unquoteName(name)])
123330
+ ).trim();
123147
123331
  return cleaned || void 0;
123148
123332
  }
123149
123333
  /** Extract explicit first/then successions owned by an action body. */
@@ -123270,15 +123454,28 @@ var SymbolTable = class {
123270
123454
  * such as `#metadata`.
123271
123455
  */
123272
123456
  findOwnHeaderRule(ctx, ruleIndex) {
123457
+ const matches = [];
123458
+ this.findOwnHeaderRules(ctx, ruleIndex, matches, true);
123459
+ return matches[0];
123460
+ }
123461
+ findOwnHeaderRules(ctx, ruleIndex, matches, firstOnly = false) {
123273
123462
  for (let i = 0; i < ctx.getChildCount(); i++) {
123274
123463
  const child = ctx.getChild(i);
123275
123464
  if (!(child instanceof ParserRuleContext)) continue;
123276
- if (child.ruleIndex === ruleIndex) return child;
123465
+ if (child.ruleIndex === ruleIndex) {
123466
+ matches.push(child);
123467
+ if (firstOnly) return;
123468
+ continue;
123469
+ }
123277
123470
  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;
123278
- const found = this.findOwnHeaderRule(child, ruleIndex);
123279
- if (found) return found;
123471
+ this.findOwnHeaderRules(child, ruleIndex, matches, firstOnly);
123472
+ if (firstOnly && matches.length > 0) return;
123280
123473
  }
123281
- return void 0;
123474
+ }
123475
+ extractRedefinedFeatureTargets(ctx) {
123476
+ const targets = [];
123477
+ this.findOwnHeaderRules(ctx, SysMLv2Parser.RULE_ownedRedefinition, targets);
123478
+ return targets.map((target) => target.getText());
123282
123479
  }
123283
123480
  /**
123284
123481
  * A connection, interface or allocation usage's end reference paths, in
@@ -123303,16 +123500,10 @@ var SymbolTable = class {
123303
123500
  }
123304
123501
  /** The name of the feature a reference such as `a.b` or `P::a` ends at (`b`, `a`). */
123305
123502
  lastNameSegment(reference) {
123306
- const segment = reference.getText().split(/::|\./).pop();
123307
- return segment ? this.unquoteName(segment) : void 0;
123503
+ const names = [...scanQualifiedNames(reference.getText())];
123504
+ return names.at(-1)?.segments.at(-1)?.name;
123308
123505
  }
123309
- /**
123310
- * An element's declaration as written, without its body: its tokens up to
123311
- * its body or closing `;`, each exactly as written (a quoted name keeps its
123312
- * spaces), with one space wherever the source has whitespace or a comment
123313
- * between two of them (`connect a.p to b.p`, `connection : Conn`).
123314
- */
123315
- declarationText(ctx) {
123506
+ declarationTokens(ctx) {
123316
123507
  const tokens = [];
123317
123508
  const visit = (node) => {
123318
123509
  for (let i = 0; i < node.getChildCount(); i++) {
@@ -123327,6 +123518,16 @@ var SymbolTable = class {
123327
123518
  return false;
123328
123519
  };
123329
123520
  visit(ctx);
123521
+ return tokens;
123522
+ }
123523
+ /**
123524
+ * An element's declaration as written, without its body: its tokens up to
123525
+ * its body or closing `;`, each exactly as written (a quoted name keeps its
123526
+ * spaces), with one space wherever the source has whitespace or a comment
123527
+ * between two of them (`connect a.p to b.p`, `connection : Conn`).
123528
+ */
123529
+ declarationText(ctx) {
123530
+ const tokens = this.declarationTokens(ctx);
123330
123531
  let text = "";
123331
123532
  tokens.forEach((token, i) => {
123332
123533
  if (i > 0 && token.start > tokens[i - 1].stop + 1) text += " ";
@@ -123436,6 +123637,16 @@ var SymbolTable = class {
123436
123637
  * Extract the range of just the name token.
123437
123638
  */
123438
123639
  extractNameRange(ctx) {
123640
+ if (ctx.ruleIndex === SysMLv2Parser.RULE_identification || ctx.ruleIndex === SysMLv2Parser.RULE_featureIdentification) {
123641
+ let name;
123642
+ for (let i = 0; i < ctx.getChildCount(); i++) {
123643
+ const child = ctx.getChild(i);
123644
+ if (child instanceof ParserRuleContext && child.ruleIndex === SysMLv2Parser.RULE_name) {
123645
+ name = child;
123646
+ }
123647
+ }
123648
+ if (name) return contextToRange(name);
123649
+ }
123439
123650
  for (let i = 0; i < ctx.getChildCount(); i++) {
123440
123651
  const child = ctx.getChild(i);
123441
123652
  if (child instanceof TerminalNode && this.isNameTerminal(child)) {
@@ -123467,17 +123678,16 @@ var SymbolTable = class {
123467
123678
  const names = [];
123468
123679
  this.collectTypeNamesFromTree(ctx, names, 0);
123469
123680
  if (names.length > 0) return names;
123470
- const fullText = ctx.getText();
123471
- const braceIdx = fullText.indexOf("{");
123472
- let text = braceIdx >= 0 ? fullText.substring(0, braceIdx) : fullText;
123681
+ const { text: declarationText, quotedName } = this.maskedDeclaration(ctx);
123682
+ let text = declarationText;
123473
123683
  text = text.replace(RE_KEYWORD_TRUNCATE, "");
123474
123684
  const specMatch = text.match(RE_SPEC);
123475
123685
  if (specMatch) {
123476
123686
  const specStr = text.substring(text.indexOf(specMatch[0]) + specMatch[0].indexOf(specMatch[1]));
123477
123687
  for (const part of specStr.split(",")) {
123478
- const qm = part.match(RE_QUOTED_NAME);
123479
- if (qm) {
123480
- names.push(qm[1]);
123688
+ const quoted = quotedName(part);
123689
+ if (quoted !== void 0) {
123690
+ names.push(joinQualifiedName([quoted]));
123481
123691
  continue;
123482
123692
  }
123483
123693
  const m2 = part.trim().match(RE_IDENT_START);
@@ -123498,9 +123708,9 @@ var SymbolTable = class {
123498
123708
  const fullMatchIdx = text.indexOf(typingMatch[0]);
123499
123709
  const afterColon = text.substring(fullMatchIdx + 1).trim();
123500
123710
  for (const part of afterColon.split(",")) {
123501
- const qm = part.match(RE_QUOTED_NAME);
123502
- if (qm) {
123503
- names.push(qm[1]);
123711
+ const quoted = quotedName(part);
123712
+ if (quoted !== void 0) {
123713
+ names.push(joinQualifiedName([quoted]));
123504
123714
  continue;
123505
123715
  }
123506
123716
  const m2 = part.trim().match(RE_IDENT_START);
@@ -123510,6 +123720,30 @@ var SymbolTable = class {
123510
123720
  }
123511
123721
  return names;
123512
123722
  }
123723
+ /**
123724
+ * The declaration tokens before the value or body, with each lexer STRING token
123725
+ * replaced by a numbered placeholder (`'0'`, `'1'`, ...), and
123726
+ * `quotedName`, which turns a placeholder in a part of that text back into
123727
+ * the name, when it ends the qualified name the part starts with. SysML
123728
+ * 2.0 section 7.2.2 permits punctuation in unrestricted names (the STRING
123729
+ * lexer production), so fallback regexes must never see their `:`, `:>`,
123730
+ * `{` or keywords. Documentation is not a name token.
123731
+ */
123732
+ maskedDeclaration(ctx) {
123733
+ const quoted = [];
123734
+ const valueStart = this.findOwnHeaderRule(ctx, SysMLv2Parser.RULE_valuePart)?.start?.tokenIndex;
123735
+ const masked = this.declarationTokens(ctx).filter((token) => valueStart === void 0 || token.tokenIndex < valueStart).map((token) => {
123736
+ const text = token.text ?? "";
123737
+ return token.type === SysMLv2Lexer.STRING ? `'${quoted.push(unquoteName(text)) - 1}'` : text;
123738
+ }).join("");
123739
+ return {
123740
+ text: masked,
123741
+ quotedName: (part) => {
123742
+ const qm = part.match(RE_QUOTED_NAME);
123743
+ return qm ? quoted[Number(qm[1])] : void 0;
123744
+ }
123745
+ };
123746
+ }
123513
123747
  /**
123514
123748
  * Extract only the specialization names (:> / specializes / subsets) from a context.
123515
123749
  * Uses the same tree-walk as extractTypeNames but restricted to
@@ -123520,17 +123754,15 @@ var SymbolTable = class {
123520
123754
  const names = [];
123521
123755
  this.collectNamesFromTree(ctx, names, 0, TYPE_SPECIALIZATION_RULE_INDICES);
123522
123756
  if (names.length > 0) return names;
123523
- const fullText = ctx.getText();
123524
- const braceIdx = fullText.indexOf("{");
123525
- let text = braceIdx >= 0 ? fullText.substring(0, braceIdx) : fullText;
123526
- text = text.replace(RE_KEYWORD_TRUNCATE_SPEC, "");
123757
+ const { text: declarationText, quotedName } = this.maskedDeclaration(ctx);
123758
+ const text = declarationText.replace(RE_KEYWORD_TRUNCATE_SPEC, "");
123527
123759
  const specMatch = text.match(RE_SPEC_WITH_SUBSETS);
123528
123760
  if (specMatch) {
123529
123761
  const specStr = text.substring(text.indexOf(specMatch[0]) + specMatch[0].indexOf(specMatch[1]));
123530
123762
  for (const part of specStr.split(",")) {
123531
- const qm = part.match(RE_QUOTED_NAME);
123532
- if (qm) {
123533
- names.push(qm[1]);
123763
+ const quoted = quotedName(part);
123764
+ if (quoted !== void 0) {
123765
+ names.push(joinQualifiedName([quoted]));
123534
123766
  continue;
123535
123767
  }
123536
123768
  const m2 = part.trim().match(RE_IDENT_START);
@@ -123559,17 +123791,7 @@ var SymbolTable = class {
123559
123791
  if (!(child instanceof ParserRuleContext)) continue;
123560
123792
  const ri = child.ruleIndex;
123561
123793
  if (extractionRules.has(ri)) {
123562
- const childText = child.getText();
123563
- const stripped = childText.replace(/^(specializes|:>>|:>|:|definedby|subsets|redefines|references|conjugates|disjoints)/i, "");
123564
- for (const part of stripped.split(",")) {
123565
- const qm = part.match(/'([^']+)'/);
123566
- if (qm) {
123567
- names.push(qm[1]);
123568
- } else {
123569
- const m2 = part.match(/([A-Za-z_]\w*(?:::\w+)*)/);
123570
- if (m2) names.push(m2[1]);
123571
- }
123572
- }
123794
+ this.collectQualifiedTypeNames(child, names);
123573
123795
  } else if (
123574
123796
  // Recurse into declaration / part / body wrappers that may
123575
123797
  // contain nested typing rules (but NOT into body rules that
@@ -123582,6 +123804,17 @@ var SymbolTable = class {
123582
123804
  }
123583
123805
  }
123584
123806
  }
123807
+ collectQualifiedTypeNames(ctx, names) {
123808
+ if (ctx.ruleIndex === SysMLv2Parser.RULE_qualifiedName) {
123809
+ const name = this.extractTextFromSubtree(ctx);
123810
+ if (name) names.push(name);
123811
+ return;
123812
+ }
123813
+ for (let i = 0; i < ctx.getChildCount(); i++) {
123814
+ const child = ctx.getChild(i);
123815
+ if (child instanceof ParserRuleContext) this.collectQualifiedTypeNames(child, names);
123816
+ }
123817
+ }
123585
123818
  /**
123586
123819
  * Extract documentation owned by this element.
123587
123820
  *
@@ -123742,10 +123975,7 @@ var SymbolTable = class {
123742
123975
  * Returns the text unchanged if not quoted.
123743
123976
  */
123744
123977
  unquoteName(text) {
123745
- if (this.isQuotedName(text)) {
123746
- return text.slice(1, -1);
123747
- }
123748
- return text;
123978
+ return unquoteName(text);
123749
123979
  }
123750
123980
  /**
123751
123981
  * Check if a text is a SysML keyword.
@@ -124033,7 +124263,7 @@ var SymbolTable = class {
124033
124263
  const child = ctx.getChild(i);
124034
124264
  if (child instanceof TerminalNode) {
124035
124265
  const text = child.symbol.text;
124036
- if (text) parts.push(text);
124266
+ if (text) parts.push(child.symbol.type === SysMLv2Lexer.STRING ? joinQualifiedName([unquoteName(text)]) : text);
124037
124267
  } else if (child instanceof ParserRuleContext) {
124038
124268
  this.collectExposeText(child, parts);
124039
124269
  }
@@ -124095,58 +124325,24 @@ var SymbolTable = class {
124095
124325
  * Extract all text content from a subtree (concatenate terminal nodes).
124096
124326
  */
124097
124327
  extractTextFromSubtree(ctx) {
124328
+ if (ctx.ruleIndex === SysMLv2Parser.RULE_name) return unquoteName(ctx.getText());
124098
124329
  const parts = [];
124099
124330
  for (let i = 0; i < ctx.getChildCount(); i++) {
124100
124331
  const child = ctx.getChild(i);
124101
124332
  if (child instanceof TerminalNode) {
124102
124333
  const text = child.symbol.text;
124103
124334
  if (text && this.isNameTerminal(child)) {
124104
- parts.push(this.unquoteName(text));
124335
+ parts.push(joinQualifiedName([this.unquoteName(text)]));
124105
124336
  }
124106
124337
  } else if (child instanceof ParserRuleContext) {
124107
124338
  const sub = this.extractTextFromSubtree(child);
124108
- if (sub) parts.push(sub);
124339
+ if (sub) parts.push(child.ruleIndex === SysMLv2Parser.RULE_name ? joinQualifiedName([sub]) : sub);
124109
124340
  }
124110
124341
  }
124111
124342
  return parts.length > 0 ? parts.join("::") : void 0;
124112
124343
  }
124113
124344
  };
124114
124345
 
124115
- // server/src/utils/identUtils.ts
124116
- function isIdentStart(c) {
124117
- return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 95;
124118
- }
124119
- function isIdentPart(c) {
124120
- return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c >= 48 && c <= 57 || c === 95;
124121
- }
124122
- function extractQualifiedNameAt(lineText, character) {
124123
- const len = lineText.length;
124124
- let i = 0;
124125
- while (i < len) {
124126
- if (!isIdentStart(lineText.charCodeAt(i))) {
124127
- i++;
124128
- continue;
124129
- }
124130
- const wordStart = i;
124131
- while (i < len) {
124132
- while (i < len && isIdentPart(lineText.charCodeAt(i))) i++;
124133
- if (i + 2 <= len && lineText[i] === ":" && lineText[i + 1] === ":" && i + 2 < len && isIdentStart(lineText.charCodeAt(i + 2))) {
124134
- i += 2;
124135
- } else {
124136
- break;
124137
- }
124138
- }
124139
- const wordEnd = i;
124140
- if (character >= wordStart && character <= wordEnd) {
124141
- return lineText.substring(wordStart, wordEnd);
124142
- }
124143
- }
124144
- return void 0;
124145
- }
124146
- function stripComments(text) {
124147
- return text.replace(/\/\*[\s\S]*?\*\//g, (m2) => m2.replace(/[^\n]/g, " ")).replace(/\/\/[^\n]*/g, (m2) => " ".repeat(m2.length));
124148
- }
124149
-
124150
124346
  // server/src/documentManager.ts
124151
124347
  var DocumentManager = class {
124152
124348
  cache = /* @__PURE__ */ new Map();
@@ -124441,55 +124637,30 @@ function readWord(line, pos) {
124441
124637
  while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124442
124638
  return pos > start ? [line.slice(start, pos), pos] : void 0;
124443
124639
  }
124640
+ function readSimpleName(line, pos) {
124641
+ const name = readNameAt(line, skipSpaces(line, pos));
124642
+ return name ? [name.name, name.end] : void 0;
124643
+ }
124444
124644
  function readName(line, pos) {
124445
124645
  pos = skipSpaces(line, pos);
124446
- if (pos < line.length && line[pos] === "'") {
124447
- pos++;
124448
- const start = pos;
124449
- while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124450
- const name = line.slice(start, pos);
124451
- if (pos < line.length && line[pos] === "'") pos++;
124452
- return name ? [name, pos] : void 0;
124453
- }
124454
124646
  if (pos < line.length && line[pos] === "<") {
124455
- pos++;
124456
- const start = pos;
124457
- while (pos < line.length && line[pos] !== ">") pos++;
124458
- const shortName = line.slice(start, pos).trim();
124459
- if (pos < line.length && line[pos] === ">") pos++;
124460
- pos = skipSpaces(line, pos);
124461
- if (pos < line.length && line[pos] === "'") {
124462
- pos++;
124463
- while (pos < line.length && line[pos] !== "'") pos++;
124464
- if (pos < line.length) pos++;
124465
- } else if (pos < line.length && isIdentPart(line.charCodeAt(pos))) {
124466
- while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124467
- }
124468
- return shortName ? [shortName, pos] : void 0;
124469
- }
124470
- return readWord(line, pos);
124647
+ const short = readSimpleName(line, pos + 1);
124648
+ if (!short) return void 0;
124649
+ pos = skipSpaces(line, short[1]);
124650
+ if (line[pos] !== ">") return void 0;
124651
+ const long = readSimpleName(line, pos + 1);
124652
+ return [short[0], long?.[1] ?? pos + 1];
124653
+ }
124654
+ return readSimpleName(line, pos);
124471
124655
  }
124472
124656
  function readLongName(line, pos) {
124473
124657
  pos = skipSpaces(line, pos);
124474
124658
  if (pos >= line.length || line[pos] !== "<") return void 0;
124475
- while (pos < line.length && line[pos] !== ">") pos++;
124476
- if (pos < line.length) pos++;
124477
- pos = skipSpaces(line, pos);
124478
- if (pos >= line.length) return void 0;
124479
- if (line[pos] === "'") {
124480
- pos++;
124481
- const start = pos;
124482
- while (pos < line.length && line[pos] !== "'") pos++;
124483
- const longName = line.slice(start, pos).trim();
124484
- if (longName && /^[A-Za-z_]\w*$/.test(longName)) return longName;
124485
- return void 0;
124486
- }
124487
- if (isIdentPart(line.charCodeAt(pos))) {
124488
- const start = pos;
124489
- while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124490
- return line.slice(start, pos);
124491
- }
124492
- return void 0;
124659
+ const short = readSimpleName(line, pos + 1);
124660
+ if (!short) return void 0;
124661
+ pos = skipSpaces(line, short[1]);
124662
+ if (line[pos] !== ">") return void 0;
124663
+ return readSimpleName(line, pos + 1)?.[0];
124493
124664
  }
124494
124665
  function matchWord(line, pos, keyword) {
124495
124666
  if (!line.startsWith(keyword, pos)) return false;
@@ -124561,7 +124732,7 @@ function extractPackageNameFromHead(head) {
124561
124732
  if (close < 0) continue;
124562
124733
  pos = skipSpaces(line, close + 1);
124563
124734
  }
124564
- const w = readWord(line, pos);
124735
+ const w = readName(line, pos);
124565
124736
  if (w) return w[0];
124566
124737
  }
124567
124738
  return void 0;
@@ -124686,7 +124857,7 @@ function indexLibraryFile(fileUri, content, packages, types) {
124686
124857
  types.set(usageName, { uri: fileUri, line: i });
124687
124858
  }
124688
124859
  if (pkgName) {
124689
- const qualName = `${pkgName}::${usageName}`;
124860
+ const qualName = joinQualifiedName([pkgName, usageName]);
124690
124861
  if (!types.has(qualName)) {
124691
124862
  types.set(qualName, { uri: fileUri, line: i });
124692
124863
  }
@@ -124697,7 +124868,7 @@ function indexLibraryFile(fileUri, content, packages, types) {
124697
124868
  types.set(longName, { uri: fileUri, line: i });
124698
124869
  }
124699
124870
  if (pkgName) {
124700
- const qualLong = `${pkgName}::${longName}`;
124871
+ const qualLong = joinQualifiedName([pkgName, longName]);
124701
124872
  if (!types.has(qualLong)) {
124702
124873
  types.set(qualLong, { uri: fileUri, line: i });
124703
124874
  }
@@ -124729,15 +124900,17 @@ function initLibraryIndex(serverDir, customPath) {
124729
124900
  }
124730
124901
  function resolveLibraryPackage(name) {
124731
124902
  if (!index) return void 0;
124732
- const pkg = name.split("::")[0];
124903
+ const pkg = splitQualifiedName(name)[0];
124733
124904
  return index.get(pkg);
124734
124905
  }
124735
124906
  function resolveLibraryType(name) {
124736
124907
  if (!typeIndex) return void 0;
124908
+ const segments = splitQualifiedName(name);
124909
+ name = segments.length === 1 ? segments[0] : joinQualifiedName(segments);
124737
124910
  const exact = typeIndex.get(name);
124738
124911
  if (exact) return exact;
124739
- if (name.includes("::")) {
124740
- const member = name.split("::").pop();
124912
+ if (segments.length > 1) {
124913
+ const member = segments[segments.length - 1];
124741
124914
  return typeIndex.get(member);
124742
124915
  }
124743
124916
  return void 0;
@@ -125376,20 +125549,31 @@ var NamespaceResolver = class {
125376
125549
  * namespace.
125377
125550
  */
125378
125551
  isLocallyVisible(symbol, name, indexes) {
125379
- return this.resolveQualifiedNameFrom(ownerKeyOf(symbol, indexes.byId), name, indexes) !== void 0;
125552
+ return this.resolveNameFrom(symbol, name, indexes) !== void 0;
125553
+ }
125554
+ /**
125555
+ * Resolve a (possibly qualified) name from the namespace containing
125556
+ * `symbol`, respecting namespace membership and visibility.
125557
+ */
125558
+ resolveNameFrom(symbol, name, indexes) {
125559
+ return this.resolveQualifiedNameFrom(ownerKeyOf(symbol, indexes.byId), name, indexes);
125560
+ }
125561
+ /** Resolve an editor reference within its enclosing namespace, including the root. */
125562
+ resolveNameIn(namespace, name, indexes) {
125563
+ return this.resolveQualifiedNameFrom(namespace ? namespaceKeyOf(namespace) : "", name, indexes);
125380
125564
  }
125381
125565
  /**
125382
125566
  * Resolve a (possibly qualified) name to its symbol per §7.5.1, searching
125383
125567
  * outward from namespace `start` and its enclosing namespaces (its own resolved
125384
125568
  * members first, then its parent's, ...). Shared by `isLocallyVisible` (an
125385
- * ordinary reference resolving relative to its own enclosing namespace) and
125386
- * import-target resolution (an `import` declaration's target is itself a
125569
+ * ordinary reference resolving relative to its own enclosing namespace),
125570
+ * `resolveNameFrom`, and import-target resolution (an `import` declaration's target is itself a
125387
125571
  * qualifiedName, resolved the same relative way -- not as an absolute/global
125388
125572
  * name -- so a bare `import C;` inside a nested package can pick up a `C`
125389
125573
  * its own enclosing package already imported, per §7.5.1/§7.5.3).
125390
125574
  */
125391
125575
  resolveQualifiedNameFrom(start, name, indexes) {
125392
- const [first, ...rest] = name.split("::");
125576
+ const [first, ...rest] = splitQualifiedName(name);
125393
125577
  let resolved;
125394
125578
  for (const ancestor of this.namespaceAncestorsOf(start, indexes)) {
125395
125579
  const candidates = this.getResolvedMembers(ancestor, indexes).get(first);
@@ -125556,6 +125740,9 @@ var NamespaceResolver = class {
125556
125740
  };
125557
125741
  for (const owned of indexes.byParent.get(namespace) ?? []) {
125558
125742
  addMember(owned.name, { symbol: owned, visibility: owned.visibility ?? "public" });
125743
+ if (owned.shortName) {
125744
+ addMember(owned.shortName, { symbol: owned, visibility: owned.visibility ?? "public" });
125745
+ }
125559
125746
  }
125560
125747
  perIndexesCache.set(namespace, members);
125561
125748
  const owner = typeof namespace === "string" ? indexes.byQualifiedName.get(namespace) : namespace;
@@ -125591,13 +125778,17 @@ var NamespaceResolver = class {
125591
125778
  switch (imp.kind) {
125592
125779
  case "membership": {
125593
125780
  const target = this.resolveQualifiedNameFrom(importingNamespace, imp.target, indexes);
125594
- if (target) addMember(target.name, { symbol: target, visibility: imp.visibility });
125781
+ if (target) {
125782
+ addMember(target.name, { symbol: target, visibility: imp.visibility });
125783
+ if (target.shortName) addMember(target.shortName, { symbol: target, visibility: imp.visibility });
125784
+ }
125595
125785
  break;
125596
125786
  }
125597
125787
  case "membership-deep": {
125598
125788
  const target = this.resolveQualifiedNameFrom(importingNamespace, imp.target, indexes);
125599
125789
  if (target) {
125600
125790
  addMember(target.name, { symbol: target, visibility: imp.visibility });
125791
+ if (target.shortName) addMember(target.shortName, { symbol: target, visibility: imp.visibility });
125601
125792
  this.importVisibleMembers(namespaceKeyOf(target), imp.visibility, indexes, addMember, true);
125602
125793
  }
125603
125794
  break;
@@ -125762,7 +125953,7 @@ function isISQValueType(name) {
125762
125953
  function resolveTypeName(typeName, symbol, resolver, indexes, libraryNames) {
125763
125954
  const kwMatch = typeName.match(/^([A-Z][A-Za-z_0-9]*?)(redefines|subsets|references|connect|bind|default|via|accept|send|flow|allocate|assign|decide|merge|join|fork)([A-Z])/);
125764
125955
  const strippedTypeName = kwMatch ? kwMatch[1] : typeName;
125765
- const rootSegment = strippedTypeName.split("::")[0];
125956
+ const rootSegment = splitQualifiedName(strippedTypeName)[0];
125766
125957
  const resolved = resolver.isLocallyVisible(symbol, strippedTypeName, indexes) || STANDARD_LIBRARY_TYPES.has(strippedTypeName) || STANDARD_LIBRARY_TYPES.has(rootSegment) || libraryNames.has(rootSegment) || isISQValueType(strippedTypeName) || resolveLibraryType(strippedTypeName) !== void 0 || resolveLibraryType(rootSegment) !== void 0 || // Names starting with lowercase are feature references (subsettings
125767
125958
  // via :>), not type references — don't flag them as unresolved types.
125768
125959
  strippedTypeName.charCodeAt(0) >= 97 && strippedTypeName.charCodeAt(0) <= 122;
@@ -127307,11 +127498,11 @@ var CodeActionProvider = class {
127307
127498
  const packageNames = /* @__PURE__ */ new Set();
127308
127499
  for (const s of allSymbols) {
127309
127500
  if (!isDefinition(s.kind)) continue;
127310
- if (s.name !== unresolvedType) continue;
127501
+ if (s.name !== unquoteName(unresolvedType)) continue;
127311
127502
  if (s.uri === uri) continue;
127312
- const pkg = (s.qualifiedName?.split("::")[0] ?? "").trim();
127503
+ const pkg = s.qualifiedName ? splitQualifiedName(s.qualifiedName)[0] : "";
127313
127504
  if (!pkg || pkg === unresolvedType) continue;
127314
- if (pkg) packageNames.add(pkg);
127505
+ packageNames.add(quoteName(pkg));
127315
127506
  }
127316
127507
  for (const pkg of packageNames) {
127317
127508
  if (this.hasImportForPackage(text, pkg)) {
@@ -127420,7 +127611,7 @@ var CodeActionProvider = class {
127420
127611
  const edit = {
127421
127612
  changes: {
127422
127613
  [uri]: [
127423
- import_node2.TextEdit.replace(diagnostic.range, newName)
127614
+ import_node2.TextEdit.replace(diagnostic.range, quoteName(newName))
127424
127615
  ]
127425
127616
  }
127426
127617
  };
@@ -127529,7 +127720,7 @@ ${childIndent}enum value2;`;
127529
127720
  const edit = {
127530
127721
  changes: {
127531
127722
  [uri]: [
127532
- import_node2.TextEdit.replace(diagnostic.range, newName)
127723
+ import_node2.TextEdit.replace(diagnostic.range, quoteName(newName))
127533
127724
  ]
127534
127725
  }
127535
127726
  };
@@ -127590,10 +127781,11 @@ ${childIndent}enum value2;`;
127590
127781
  if (diagnostic.code !== "incompatible-port-types") return void 0;
127591
127782
  const msg = diagnostic.message;
127592
127783
  const m2 = msg.match(/'([^']+)'\s+\(([^)]+)\)\s+is connected to\s+'([^']+)'\s+\(([^)]+)\)/);
127593
- if (!m2) return void 0;
127594
- const left = m2[1];
127595
- const leftType = m2[2];
127596
- const right = m2[3];
127784
+ const data = diagnostic.data;
127785
+ const left = data?.left ?? m2?.[1];
127786
+ const leftType = data?.leftType ?? m2?.[2];
127787
+ const right = data?.right ?? m2?.[3];
127788
+ if (!left || !leftType || !right) return void 0;
127597
127789
  const symbolTable = this.documentManager.getWorkspaceSymbolTable();
127598
127790
  const symbolsInUri = symbolTable.getSymbolsForUri(uri);
127599
127791
  const compatible = symbolsInUri.find(
@@ -127608,8 +127800,10 @@ ${childIndent}enum value2;`;
127608
127800
  if (start.line !== end.line) return void 0;
127609
127801
  const segment = (lines[start.line] ?? "").slice(start.character, end.character);
127610
127802
  if (!segment) return void 0;
127611
- const replaced = segment.replace(new RegExp(`\\b${right}\\b`), compatible.name);
127612
- if (replaced === segment) return void 0;
127803
+ const rightPath = [...scanFeaturePaths(segment)].reverse().find((path3) => path3.parts[path3.parts.length - 1] === right);
127804
+ const rightName = rightPath?.qualifiedNames.at(-1)?.segments.at(-1);
127805
+ if (!rightName) return void 0;
127806
+ const replaced = segment.slice(0, rightName.start) + quoteName(compatible.name) + segment.slice(rightName.end);
127613
127807
  const edit = {
127614
127808
  changes: {
127615
127809
  [uri]: [
@@ -127644,12 +127838,14 @@ ${childIndent}enum value2;`;
127644
127838
  diagnostic.range.end.character
127645
127839
  ) : "";
127646
127840
  const m2 = msg.match(/Unresolved constraint reference\s+'([^']+)'(?:\s+in scope\s+'([^']+)')?/);
127841
+ const data = diagnostic.data;
127647
127842
  const expr = rangeExpr && rangeExpr.includes(".") ? rangeExpr : tokenExpr && tokenExpr.includes(".") ? tokenExpr : m2?.[1] ?? "";
127648
- const scopeName = m2?.[2];
127843
+ const scopeName = data?.scopeName ?? m2?.[2];
127649
127844
  if (!expr) return void 0;
127650
127845
  if (!expr.includes(".")) return void 0;
127651
- const parts = expr.split(".");
127652
- if (parts.length < 2) return void 0;
127846
+ const path3 = [...scanFeaturePaths(expr)].find((path4) => path4.qualifiedNames.length > 1);
127847
+ if (!path3) return void 0;
127848
+ const parts = path3.parts;
127653
127849
  const root = parts[0];
127654
127850
  const unresolvedLeaf = parts[parts.length - 1];
127655
127851
  const symbolTable = this.documentManager.getWorkspaceSymbolTable();
@@ -127661,7 +127857,7 @@ ${childIndent}enum value2;`;
127661
127857
  const rootType = rootUsage ? rootUsage.typeNames[0] ?? rootUsage.typeName : void 0;
127662
127858
  let memberNames = [];
127663
127859
  if (rootType) {
127664
- const typeDef = allSymbols.find((s) => s.name === rootType && s.kind.endsWith(" def"));
127860
+ const typeDef = symbolTable.findByName(rootType).find((s) => isDefinition(s.kind));
127665
127861
  if (typeDef) {
127666
127862
  memberNames = allSymbols.filter((s) => s.parentId === typeDef.symbolId).map((s) => s.name);
127667
127863
  }
@@ -127683,7 +127879,8 @@ ${childIndent}enum value2;`;
127683
127879
  }
127684
127880
  }
127685
127881
  if (!best || best.dist > 4 || best.name === unresolvedLeaf) return void 0;
127686
- const fixedExpr = `${root}.${best.name}`;
127882
+ const leaf = path3.qualifiedNames.at(-1);
127883
+ const fixedExpr = expr.slice(0, leaf.start) + quoteName(best.name) + expr.slice(leaf.end);
127687
127884
  const edit = {
127688
127885
  changes: {
127689
127886
  [uri]: [
@@ -127759,6 +127956,13 @@ ${childIndent}enum value2;`;
127759
127956
  isAttributeTypeContext(text, diagnostic, unresolvedType) {
127760
127957
  const lines = text.split("\n");
127761
127958
  const line = lines[diagnostic.range.start.line] ?? "";
127959
+ const names = [...scanQualifiedNames(line)];
127960
+ const attribute = names.findIndex((name) => line.slice(name.start, name.end) === "attribute");
127961
+ const usage = names[attribute + 1];
127962
+ const type = names[attribute + 2];
127963
+ if (attribute >= 0 && usage && type && type.name === unresolvedType && /^\s*:\s*$/.test(line.slice(usage.end, type.start))) {
127964
+ return true;
127965
+ }
127762
127966
  const beforeRange = line.slice(0, diagnostic.range.start.character);
127763
127967
  const unresolvedInLine = line.slice(diagnostic.range.start.character, diagnostic.range.end.character);
127764
127968
  const escapedType = unresolvedType.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -127771,18 +127975,19 @@ ${childIndent}enum value2;`;
127771
127975
  return /\battribute\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*[A-Za-z_][A-Za-z0-9_]*\b/.test(beforeRange + unresolvedInLine);
127772
127976
  }
127773
127977
  buildLocalTypeStub(text, diagnostic, unresolvedType, childIndent) {
127978
+ const sourceName = quoteName(unquoteName(unresolvedType));
127774
127979
  if (this.isAttributeTypeContext(text, diagnostic, unresolvedType)) {
127775
127980
  return {
127776
- title: `Create local 'attribute def ${unresolvedType};'`,
127981
+ title: `Create local 'attribute def ${sourceName};'`,
127777
127982
  stubText: `
127778
- ${childIndent}attribute def ${unresolvedType};
127983
+ ${childIndent}attribute def ${sourceName};
127779
127984
  `
127780
127985
  };
127781
127986
  }
127782
127987
  return {
127783
- title: `Create local 'item def ${unresolvedType};'`,
127988
+ title: `Create local 'item def ${sourceName};'`,
127784
127989
  stubText: `
127785
- ${childIndent}item def ${unresolvedType};
127990
+ ${childIndent}item def ${sourceName};
127786
127991
  `
127787
127992
  };
127788
127993
  }
@@ -127818,13 +128023,12 @@ function extractQuotedString(text, prefixWithQuote) {
127818
128023
  }
127819
128024
  function extractDottedTokenAtRange(line, start, end) {
127820
128025
  if (!line || start < 0 || end < 0 || start > line.length || end > line.length) return "";
127821
- const isTokenChar = (ch) => ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch >= "0" && ch <= "9" || ch === "_" || ch === ".";
127822
- let left = Math.max(0, start);
127823
- while (left > 0 && isTokenChar(line[left - 1])) left--;
127824
- let right = Math.min(line.length, end);
127825
- while (right < line.length && isTokenChar(line[right])) right++;
127826
- const token = line.slice(left, right).trim();
127827
- return token.includes(".") ? token : "";
128026
+ for (const path3 of scanFeaturePaths(line)) {
128027
+ if (path3.qualifiedNames.length > 1 && path3.start <= start && path3.end >= end) {
128028
+ return line.slice(path3.start, path3.end);
128029
+ }
128030
+ }
128031
+ return "";
127828
128032
  }
127829
128033
  function extractLikelyMemberNames(text, excludeName) {
127830
128034
  const names = /* @__PURE__ */ new Set();
@@ -127936,6 +128140,7 @@ var CompletionProvider = class {
127936
128140
  seen.add(sym.name);
127937
128141
  defItems.push({
127938
128142
  label: sym.name,
128143
+ insertText: quoteName(sym.name),
127939
128144
  kind: this.mapSymbolKindToCompletionKind(sym.kind),
127940
128145
  detail: `${sym.kind}${sym.qualifiedName !== void 0 && sym.qualifiedName !== sym.name ? ` (${sym.qualifiedName})` : ""}`,
127941
128146
  documentation: sym.documentation,
@@ -127956,6 +128161,7 @@ var CompletionProvider = class {
127956
128161
  seenPorts.add(sym.name);
127957
128162
  items.push({
127958
128163
  label: sym.name,
128164
+ insertText: quoteName(sym.name),
127959
128165
  kind: import_node3.CompletionItemKind.Interface,
127960
128166
  detail: `${sym.kind}${sym.typeNames[0] ? ` : ${sym.typeNames[0]}` : ""}`,
127961
128167
  data: sym.qualifiedName,
@@ -127963,13 +128169,17 @@ var CompletionProvider = class {
127963
128169
  });
127964
128170
  }
127965
128171
  }
127966
- if (context === "type-annotation") {
127967
- return items.filter((i) => this.isTypeOrDefinitionCompletion(i));
127968
- }
127969
- if (context === "connect-endpoint") {
127970
- return items.filter((i) => this.isConnectContextCompletion(i));
127971
- }
127972
- return items;
128172
+ const filtered = context === "type-annotation" ? items.filter((i) => this.isTypeOrDefinitionCompletion(i)) : context === "connect-endpoint" ? items.filter((i) => this.isConnectContextCompletion(i)) : items;
128173
+ const line = this.documentManager.getText(uri)?.split("\n")[params.position.line] ?? "";
128174
+ const segment = [...scanQualifiedNames(line, true)].flatMap((name) => name.segments).find((name) => name.start <= params.position.character && name.end >= params.position.character);
128175
+ if (!segment) return filtered;
128176
+ return filtered.map((item) => item.insertTextFormat === import_node3.InsertTextFormat.Snippet ? item : {
128177
+ ...item,
128178
+ textEdit: {
128179
+ range: import_node3.Range.create(params.position.line, segment.start, params.position.line, segment.end),
128180
+ newText: item.insertText ?? item.label
128181
+ }
128182
+ });
127973
128183
  }
127974
128184
  resolveCompletion(item) {
127975
128185
  return item;
@@ -128042,6 +128252,108 @@ var CompletionProvider = class {
128042
128252
  }
128043
128253
  };
128044
128254
 
128255
+ // server/src/symbols/nameReferences.ts
128256
+ var import_node4 = __toESM(require_node3());
128257
+ var NameReferences = class {
128258
+ constructor(documents2) {
128259
+ this.documents = documents2;
128260
+ this.symbols = documents2.getWorkspaceSymbolTable().getAllSymbols();
128261
+ this.indexes = buildSymbolIndexes(this.symbols);
128262
+ }
128263
+ documents;
128264
+ symbols;
128265
+ indexes;
128266
+ resolver = new NamespaceResolver();
128267
+ at(uri, position) {
128268
+ return this.inDocument(uri, position).find((ref) => ref.range.start.line === position.line && ref.range.start.character <= position.character && ref.range.end.character >= position.character);
128269
+ }
128270
+ to(symbol, includeDeclaration = true) {
128271
+ return this.documents.getUris().flatMap((uri) => this.inDocument(uri, void 0, symbol)).filter((ref) => ref.symbol?.symbolId === symbol.symbolId && (includeDeclaration || !ref.isDeclaration));
128272
+ }
128273
+ inDocument(uri, position, target) {
128274
+ const text = this.documents.getText(uri);
128275
+ const parsed = this.documents.get(uri);
128276
+ if (text === void 0 || !parsed) return [];
128277
+ const doc = TextDocument.create(uri, "sysml", 0, text);
128278
+ const symbols = this.symbols.filter((symbol) => symbol.uri === uri);
128279
+ const braces = parsed.tokenStream.getTokens().filter((token) => token.type === SysMLv2Lexer.LBRACE).map((token) => doc.offsetAt({ line: token.line - 1, character: token.column }));
128280
+ const namespaces = symbols.flatMap((symbol) => {
128281
+ const start = doc.offsetAt(symbol.range.start);
128282
+ const end = doc.offsetAt(symbol.range.end);
128283
+ let lo = 0;
128284
+ let hi = braces.length;
128285
+ while (lo < hi) {
128286
+ const mid = lo + hi >>> 1;
128287
+ if (braces[mid] < start) lo = mid + 1;
128288
+ else hi = mid;
128289
+ }
128290
+ const body = braces[lo];
128291
+ return body === void 0 || body >= end ? [] : [{ symbol, body, end }];
128292
+ }).sort((a, b) => a.end - a.body - (b.end - b.body));
128293
+ const refs = [];
128294
+ const cursor = position ? doc.offsetAt(position) : void 0;
128295
+ for (const path3 of scanFeaturePaths(text)) {
128296
+ if (cursor !== void 0 && (cursor < path3.start || cursor > path3.end)) continue;
128297
+ if (target && !path3.qualifiedNames.some((name) => name.segments.some((segment) => segment.name === target.name || segment.name === target.shortName))) continue;
128298
+ const namespace = namespaces.find((ns) => ns.body < path3.start && path3.end <= ns.end);
128299
+ let receiver;
128300
+ for (let group = 0; group < path3.qualifiedNames.length; group++) {
128301
+ const qualified = path3.qualifiedNames[group];
128302
+ let resolved;
128303
+ for (let index2 = 0; index2 < qualified.segments.length; index2++) {
128304
+ const segment = qualified.segments[index2];
128305
+ const range = import_node4.Range.create(doc.positionAt(segment.start), doc.positionAt(segment.end));
128306
+ let before = segment.start - 1;
128307
+ let after = segment.end;
128308
+ while (before >= 0 && /\s/.test(text[before])) before--;
128309
+ while (after < text.length && /\s/.test(text[after])) after++;
128310
+ const declaration = symbols.find((symbol) => !isAnonymous(symbol) && (symbol.selectionRange.start.line === range.start.line && symbol.selectionRange.start.character === range.start.character && symbol.selectionRange.end.character === range.end.character || symbol.shortName === segment.name && text[before] === "<" && text[after] === ">" && doc.offsetAt(symbol.range.start) <= segment.start && segment.end < doc.offsetAt(symbol.selectionRange.start)));
128311
+ if (declaration) resolved = declaration;
128312
+ else if (index2 > 0) {
128313
+ resolved = resolved ? this.resolver.getResolvedMembers(namespaceKeyOf(resolved), this.indexes).get(segment.name)?.find((entry) => entry.visibility === "public")?.symbol : void 0;
128314
+ } else if (group > 0) {
128315
+ resolved = receiver ? this.resolveFeature(receiver, segment.name) : void 0;
128316
+ } else {
128317
+ resolved = this.resolver.resolveNameIn(
128318
+ namespace?.symbol,
128319
+ joinQualifiedName([segment.name]),
128320
+ this.indexes
128321
+ );
128322
+ }
128323
+ if (cursor !== void 0 && (cursor < segment.start || cursor > segment.end)) continue;
128324
+ if (target && segment.name !== target.name && segment.name !== target.shortName) continue;
128325
+ refs.push({
128326
+ uri,
128327
+ range,
128328
+ name: segment.name,
128329
+ qualifiedName: index2 === qualified.segments.length - 1 ? qualified.name : segment.name,
128330
+ symbol: resolved,
128331
+ isDeclaration: declaration !== void 0
128332
+ });
128333
+ }
128334
+ receiver = resolved;
128335
+ }
128336
+ }
128337
+ return refs;
128338
+ }
128339
+ resolveFeature(receiver, name) {
128340
+ const queue = [receiver];
128341
+ const visited = /* @__PURE__ */ new Set();
128342
+ for (let index2 = 0; index2 < queue.length; index2++) {
128343
+ const owner = queue[index2];
128344
+ if (visited.has(owner)) continue;
128345
+ visited.add(owner);
128346
+ const member = this.resolver.getResolvedMembers(namespaceKeyOf(owner), this.indexes).get(name)?.find((entry) => entry.visibility === "public")?.symbol;
128347
+ if (member) return member;
128348
+ for (const typeName of owner.typeNames) {
128349
+ const type = this.resolver.resolveNameFrom(owner, typeName, this.indexes);
128350
+ if (type && !visited.has(type)) queue.push(type);
128351
+ }
128352
+ }
128353
+ return void 0;
128354
+ }
128355
+ };
128356
+
128045
128357
  // server/src/providers/definitionProvider.ts
128046
128358
  var DefinitionProvider = class {
128047
128359
  constructor(documentManager2) {
@@ -128054,6 +128366,10 @@ var DefinitionProvider = class {
128054
128366
  return null;
128055
128367
  }
128056
128368
  const wsSymbolTable = this.documentManager.getWorkspaceSymbolTable();
128369
+ const reference = new NameReferences(this.documentManager).at(params.textDocument.uri, params.position);
128370
+ if (reference?.symbol && !reference.isDeclaration) {
128371
+ return { uri: reference.symbol.uri, range: reference.symbol.selectionRange };
128372
+ }
128057
128373
  const symbol = symbolTable.findSymbolAtPosition(
128058
128374
  params.textDocument.uri,
128059
128375
  params.position.line,
@@ -128161,7 +128477,7 @@ var DefinitionProvider = class {
128161
128477
  };
128162
128478
 
128163
128479
  // server/src/providers/diagnosticsProvider.ts
128164
- var import_node4 = __toESM(require_node3());
128480
+ var import_node5 = __toESM(require_node3());
128165
128481
  var EXPRESSION_OPERATOR_RE = /(\w\s*[+\-*/^]\s*\w)|(\w\s*\*\*\s*\w)|->|\.(?:\?)|:=|;\s*doc\b|#\w+\s+dependency/;
128166
128482
  var DiagnosticsProvider = class {
128167
128483
  constructor(documentManager2) {
@@ -128213,7 +128529,7 @@ var DiagnosticsProvider = class {
128213
128529
  message = `'${word}' is a reserved SysML keyword and cannot be used as a name. Consider renaming it (e.g., '${suggestion}').`;
128214
128530
  }
128215
128531
  return {
128216
- severity: import_node4.DiagnosticSeverity.Error,
128532
+ severity: import_node5.DiagnosticSeverity.Error,
128217
128533
  range: {
128218
128534
  start: { line: error.line, character: error.column },
128219
128535
  end: { line: error.line, character: error.column + error.length }
@@ -128282,51 +128598,51 @@ var DiagnosticsProvider = class {
128282
128598
  };
128283
128599
 
128284
128600
  // server/src/providers/symbolKindMapping.ts
128285
- var import_node5 = __toESM(require_node3());
128601
+ var import_node6 = __toESM(require_node3());
128286
128602
  function toSysMLSymbolKind(kind) {
128287
128603
  switch (kind) {
128288
128604
  // Structural definitions → Class (they *are* types)
128289
128605
  case "part def" /* PartDef */:
128290
128606
  case "occurrence def" /* OccurrenceDef */:
128291
- return import_node5.SymbolKind.Class;
128607
+ return import_node6.SymbolKind.Class;
128292
128608
  // Structural usages → Field (instances / typed features)
128293
128609
  case "part" /* PartUsage */:
128294
128610
  case "occurrence" /* OccurrenceUsage */:
128295
128611
  case "ref" /* RefUsage */:
128296
- return import_node5.SymbolKind.Field;
128612
+ return import_node6.SymbolKind.Field;
128297
128613
  // Attributes
128298
128614
  case "attribute def" /* AttributeDef */:
128299
128615
  case "attribute" /* AttributeUsage */:
128300
- return import_node5.SymbolKind.Property;
128616
+ return import_node6.SymbolKind.Property;
128301
128617
  // Ports & Interfaces → Interface
128302
128618
  case "port def" /* PortDef */:
128303
128619
  case "port" /* PortUsage */:
128304
128620
  case "interface def" /* InterfaceDef */:
128305
128621
  case "interface" /* InterfaceUsage */:
128306
- return import_node5.SymbolKind.Interface;
128622
+ return import_node6.SymbolKind.Interface;
128307
128623
  // Connections
128308
128624
  case "connection def" /* ConnectionDef */:
128309
128625
  case "connection" /* ConnectionUsage */:
128310
- return import_node5.SymbolKind.Interface;
128626
+ return import_node6.SymbolKind.Interface;
128311
128627
  // Behavioral: actions → Method
128312
128628
  case "action def" /* ActionDef */:
128313
128629
  case "action" /* ActionUsage */:
128314
128630
  case "perform action" /* PerformActionUsage */:
128315
- return import_node5.SymbolKind.Method;
128631
+ return import_node6.SymbolKind.Method;
128316
128632
  // Control-flow nodes (fork/join/merge/decide) → Event
128317
128633
  case "fork" /* ForkNode */:
128318
128634
  case "join" /* JoinNode */:
128319
128635
  case "merge" /* MergeNode */:
128320
128636
  case "decide" /* DecisionNode */:
128321
- return import_node5.SymbolKind.Event;
128637
+ return import_node6.SymbolKind.Event;
128322
128638
  // Behavioral: states → Event (better semantic fit than Enum)
128323
128639
  case "state def" /* StateDef */:
128324
128640
  case "state" /* StateUsage */:
128325
128641
  case "exhibit state" /* ExhibitStateUsage */:
128326
- return import_node5.SymbolKind.Event;
128642
+ return import_node6.SymbolKind.Event;
128327
128643
  // Transitions → Event
128328
128644
  case "transition" /* TransitionUsage */:
128329
- return import_node5.SymbolKind.Event;
128645
+ return import_node6.SymbolKind.Event;
128330
128646
  // Requirements → Object
128331
128647
  case "requirement def" /* RequirementDef */:
128332
128648
  case "requirement" /* RequirementUsage */:
@@ -128335,58 +128651,58 @@ function toSysMLSymbolKind(kind) {
128335
128651
  case "actor" /* ActorUsage */:
128336
128652
  case "subject" /* SubjectUsage */:
128337
128653
  case "stakeholder" /* StakeholderUsage */:
128338
- return import_node5.SymbolKind.Object;
128654
+ return import_node6.SymbolKind.Object;
128339
128655
  // Constraints → Constant (boolean-valued)
128340
128656
  case "constraint def" /* ConstraintDef */:
128341
128657
  case "constraint" /* ConstraintUsage */:
128342
- return import_node5.SymbolKind.Constant;
128658
+ return import_node6.SymbolKind.Constant;
128343
128659
  // Items → Struct (physical things, data)
128344
128660
  case "item def" /* ItemDef */:
128345
128661
  case "item" /* ItemUsage */:
128346
- return import_node5.SymbolKind.Struct;
128662
+ return import_node6.SymbolKind.Struct;
128347
128663
  // Allocations → TypeParameter (cross-concern mapping)
128348
128664
  case "allocation def" /* AllocationDef */:
128349
128665
  case "allocation" /* AllocationUsage */:
128350
- return import_node5.SymbolKind.TypeParameter;
128666
+ return import_node6.SymbolKind.TypeParameter;
128351
128667
  // Enumerations
128352
128668
  case "enum def" /* EnumDef */:
128353
- return import_node5.SymbolKind.Enum;
128669
+ return import_node6.SymbolKind.Enum;
128354
128670
  case "enum" /* EnumUsage */:
128355
- return import_node5.SymbolKind.EnumMember;
128671
+ return import_node6.SymbolKind.EnumMember;
128356
128672
  // Calculations → Function
128357
128673
  case "calc def" /* CalcDef */:
128358
128674
  case "calc" /* CalcUsage */:
128359
128675
  case "analysis case def" /* AnalysisCaseDef */:
128360
128676
  case "verification case def" /* VerificationCaseDef */:
128361
- return import_node5.SymbolKind.Function;
128677
+ return import_node6.SymbolKind.Function;
128362
128678
  // Use cases → Event
128363
128679
  case "use case def" /* UseCaseDef */:
128364
128680
  case "use case" /* UseCaseUsage */:
128365
128681
  case "include use case" /* IncludeUseCaseUsage */:
128366
- return import_node5.SymbolKind.Event;
128682
+ return import_node6.SymbolKind.Event;
128367
128683
  // Views → Namespace
128368
128684
  case "view def" /* ViewDef */:
128369
128685
  case "view" /* ViewUsage */:
128370
128686
  case "viewpoint def" /* ViewpointDef */:
128371
128687
  case "viewpoint" /* ViewpointUsage */:
128372
128688
  case "rendering def" /* RenderingDef */:
128373
- return import_node5.SymbolKind.Namespace;
128689
+ return import_node6.SymbolKind.Namespace;
128374
128690
  // Metadata → TypeParameter
128375
128691
  case "metadata def" /* MetadataDef */:
128376
- return import_node5.SymbolKind.TypeParameter;
128692
+ return import_node6.SymbolKind.TypeParameter;
128377
128693
  // Package
128378
128694
  case "package" /* Package */:
128379
- return import_node5.SymbolKind.Package;
128695
+ return import_node6.SymbolKind.Package;
128380
128696
  // Comments / docs
128381
128697
  case "comment" /* Comment */:
128382
128698
  case "doc" /* Doc */:
128383
- return import_node5.SymbolKind.String;
128699
+ return import_node6.SymbolKind.String;
128384
128700
  // Import / Alias
128385
128701
  case "import" /* Import */:
128386
128702
  case "alias" /* Alias */:
128387
- return import_node5.SymbolKind.Module;
128703
+ return import_node6.SymbolKind.Module;
128388
128704
  default:
128389
- return import_node5.SymbolKind.Variable;
128705
+ return import_node6.SymbolKind.Variable;
128390
128706
  }
128391
128707
  }
128392
128708
 
@@ -128433,7 +128749,7 @@ var DocumentSymbolProvider = class {
128433
128749
  };
128434
128750
 
128435
128751
  // server/src/providers/foldingRangeProvider.ts
128436
- var import_node6 = __toESM(require_node3());
128752
+ var import_node7 = __toESM(require_node3());
128437
128753
  var FoldingRangeProvider = class {
128438
128754
  constructor(documentManager2) {
128439
128755
  this.documentManager = documentManager2;
@@ -128456,7 +128772,7 @@ var FoldingRangeProvider = class {
128456
128772
  ranges.push({
128457
128773
  startLine: commentStart,
128458
128774
  endLine: i,
128459
- kind: import_node6.FoldingRangeKind.Comment
128775
+ kind: import_node7.FoldingRangeKind.Comment
128460
128776
  });
128461
128777
  commentStart = void 0;
128462
128778
  }
@@ -128469,7 +128785,7 @@ var FoldingRangeProvider = class {
128469
128785
  ranges.push({
128470
128786
  startLine,
128471
128787
  endLine: i,
128472
- kind: import_node6.FoldingRangeKind.Region
128788
+ kind: import_node7.FoldingRangeKind.Region
128473
128789
  });
128474
128790
  }
128475
128791
  }
@@ -128480,7 +128796,7 @@ var FoldingRangeProvider = class {
128480
128796
  };
128481
128797
 
128482
128798
  // server/src/providers/formattingProvider.ts
128483
- var import_node7 = __toESM(require_node3());
128799
+ var import_node8 = __toESM(require_node3());
128484
128800
  var FormattingProvider = class {
128485
128801
  constructor(documents2) {
128486
128802
  this.documents = documents2;
@@ -128496,8 +128812,8 @@ var FormattingProvider = class {
128496
128812
  const formatted = this.formatSysML(text, indent);
128497
128813
  if (formatted === text) return [];
128498
128814
  return [
128499
- import_node7.TextEdit.replace(
128500
- import_node7.Range.create(0, 0, doc.lineCount, 0),
128815
+ import_node8.TextEdit.replace(
128816
+ import_node8.Range.create(0, 0, doc.lineCount, 0),
128501
128817
  formatted
128502
128818
  )
128503
128819
  ];
@@ -128511,7 +128827,7 @@ var FormattingProvider = class {
128511
128827
  const rangeText = doc.getText(params.range);
128512
128828
  const formatted = this.formatSysML(rangeText, indent);
128513
128829
  if (formatted === rangeText) return [];
128514
- return [import_node7.TextEdit.replace(params.range, formatted)];
128830
+ return [import_node8.TextEdit.replace(params.range, formatted)];
128515
128831
  }
128516
128832
  formatSysML(text, indent) {
128517
128833
  const lines = text.split("\n");
@@ -128647,7 +128963,7 @@ var FormattingProvider = class {
128647
128963
  };
128648
128964
 
128649
128965
  // server/src/providers/hoverProvider.ts
128650
- var import_node8 = __toESM(require_node3());
128966
+ var import_node9 = __toESM(require_node3());
128651
128967
  var HoverProvider = class {
128652
128968
  constructor(documentManager2) {
128653
128969
  this.documentManager = documentManager2;
@@ -128664,12 +128980,13 @@ var HoverProvider = class {
128664
128980
  return null;
128665
128981
  }
128666
128982
  const text = this.documentManager.getText(params.textDocument.uri);
128667
- const word = text ? this.getWordAtPosition(text, params.position.line, params.position.character) : void 0;
128668
- if (word && word.includes("::")) {
128983
+ const reference = new NameReferences(this.documentManager).at(params.textDocument.uri, params.position);
128984
+ const word = reference?.qualifiedName ?? (text ? this.getWordAtPosition(text, params.position.line, params.position.character) : void 0);
128985
+ if (word && word.includes("::") && !reference?.symbol) {
128669
128986
  const libHover = this.buildLibraryHover(word);
128670
128987
  if (libHover) return libHover;
128671
128988
  }
128672
- const symbol = symbolTable.findSymbolAtPosition(
128989
+ const symbol = reference?.symbol ?? symbolTable.findSymbolAtPosition(
128673
128990
  params.textDocument.uri,
128674
128991
  params.position.line,
128675
128992
  params.position.character
@@ -128721,7 +129038,7 @@ ${symbol.documentation}`);
128721
129038
  if (hoverDiags.length > 0) {
128722
129039
  lines.push("\n---\n**Semantic Feedback**");
128723
129040
  for (const d of hoverDiags.slice(0, 3)) {
128724
- const sev = d.severity === import_node8.DiagnosticSeverity.Error ? "Error" : d.severity === import_node8.DiagnosticSeverity.Warning ? "Warning" : "Hint";
129041
+ const sev = d.severity === import_node9.DiagnosticSeverity.Error ? "Error" : d.severity === import_node9.DiagnosticSeverity.Warning ? "Warning" : "Hint";
128725
129042
  lines.push(`- **${sev}**: ${d.message}`);
128726
129043
  const hint = this.getRepairHint(String(d.code ?? ""));
128727
129044
  if (hint) {
@@ -128730,12 +129047,12 @@ ${symbol.documentation}`);
128730
129047
  }
128731
129048
  }
128732
129049
  const content = {
128733
- kind: import_node8.MarkupKind.Markdown,
129050
+ kind: import_node9.MarkupKind.Markdown,
128734
129051
  value: lines.join("\n")
128735
129052
  };
128736
129053
  return {
128737
129054
  contents: content,
128738
- range: symbol.selectionRange
129055
+ range: reference?.range ?? symbol.selectionRange
128739
129056
  };
128740
129057
  }
128741
129058
  /**
@@ -128762,7 +129079,7 @@ ${info.documentation}`);
128762
129079
  }
128763
129080
  return {
128764
129081
  contents: {
128765
- kind: import_node8.MarkupKind.Markdown,
129082
+ kind: import_node9.MarkupKind.Markdown,
128766
129083
  value: lines.join("\n")
128767
129084
  }
128768
129085
  };
@@ -128802,7 +129119,7 @@ ${info.documentation}`);
128802
129119
  };
128803
129120
 
128804
129121
  // server/src/providers/keywordValidator.ts
128805
- var import_node9 = __toESM(require_node3());
129122
+ var import_node10 = __toESM(require_node3());
128806
129123
 
128807
129124
  // server/src/utils/emptyNames.ts
128808
129125
  var EMPTY_NAME_MESSAGE = "Empty name '': a name in single quotes must contain at least one character";
@@ -129201,7 +129518,7 @@ function validateKeywords(result) {
129201
129518
  const line2 = (token.line ?? 1) - 1;
129202
129519
  const char2 = token.column ?? 0;
129203
129520
  diagnostics.push({
129204
- severity: import_node9.DiagnosticSeverity.Error,
129521
+ severity: import_node10.DiagnosticSeverity.Error,
129205
129522
  range: { start: { line: line2, character: char2 }, end: { line: line2, character: char2 + 2 } },
129206
129523
  message: EMPTY_NAME_MESSAGE,
129207
129524
  source: "sysml",
@@ -129219,7 +129536,7 @@ function validateKeywords(result) {
129219
129536
  const char = token.column ?? 0;
129220
129537
  const message = `Unknown keyword '${text}'. Did you mean '${suggestion}'?`;
129221
129538
  diagnostics.push({
129222
- severity: import_node9.DiagnosticSeverity.Error,
129539
+ severity: import_node10.DiagnosticSeverity.Error,
129223
129540
  range: {
129224
129541
  start: { line, character: char },
129225
129542
  end: { line, character: char + text.length }
@@ -129239,115 +129556,50 @@ var ReferencesProvider = class {
129239
129556
  }
129240
129557
  documentManager;
129241
129558
  provideReferences(params) {
129242
- const result = this.documentManager.get(params.textDocument.uri);
129243
- if (!result) {
129244
- return [];
129245
- }
129246
- const symbolTable = this.documentManager.getWorkspaceSymbolTable();
129247
- const symbol = symbolTable.findSymbolAtPosition(
129248
- params.textDocument.uri,
129249
- params.position.line,
129250
- params.position.character
129251
- );
129252
- if (!symbol || isAnonymous(symbol)) {
129253
- return [];
129254
- }
129255
- const references = symbolTable.findReferences(symbol.name);
129256
- const locations = [];
129257
- for (const ref of references) {
129258
- locations.push({
129259
- uri: ref.uri,
129260
- range: ref.selectionRange
129261
- });
129262
- }
129263
- if (params.context.includeDeclaration) {
129264
- }
129265
- return locations;
129559
+ const references = new NameReferences(this.documentManager);
129560
+ const ref = references.at(params.textDocument.uri, params.position);
129561
+ return ref?.symbol ? references.to(ref.symbol, params.context.includeDeclaration).map(({ uri, range }) => ({ uri, range })) : [];
129266
129562
  }
129267
129563
  };
129268
129564
 
129269
129565
  // server/src/providers/renameProvider.ts
129270
- function findWordOccurrences(line, word) {
129271
- const positions = [];
129272
- let from = 0;
129273
- while (from <= line.length - word.length) {
129274
- const idx = line.indexOf(word, from);
129275
- if (idx < 0) break;
129276
- if ((idx === 0 || !isIdentPart(line.charCodeAt(idx - 1))) && (idx + word.length >= line.length || !isIdentPart(line.charCodeAt(idx + word.length)))) {
129277
- positions.push(idx);
129278
- }
129279
- from = idx + 1;
129280
- }
129281
- return positions;
129282
- }
129566
+ var import_node11 = __toESM(require_node3());
129283
129567
  var RenameProvider = class {
129284
129568
  constructor(documentManager2) {
129285
129569
  this.documentManager = documentManager2;
129286
129570
  }
129287
129571
  documentManager;
129288
- /**
129289
- * Check if the token at position is renameable and return its range.
129290
- */
129291
129572
  prepareRename(params) {
129292
- const symbolTable = this.documentManager.getSymbolTable(params.textDocument.uri);
129293
- if (!symbolTable) return null;
129294
- const symbol = symbolTable.findSymbolAtPosition(
129295
- params.textDocument.uri,
129296
- params.position.line,
129297
- params.position.character
129298
- );
129299
- if (!symbol || isAnonymous(symbol)) return null;
129300
- return symbol.selectionRange;
129573
+ const ref = new NameReferences(this.documentManager).at(params.textDocument.uri, params.position);
129574
+ return ref?.symbol ? ref.range : null;
129301
129575
  }
129302
- /**
129303
- * Perform the rename — update the symbol and all references.
129304
- */
129305
129576
  provideRename(params) {
129306
- const symbolTable = this.documentManager.getSymbolTable(params.textDocument.uri);
129307
- if (!symbolTable) return null;
129308
- const symbol = symbolTable.findSymbolAtPosition(
129309
- params.textDocument.uri,
129310
- params.position.line,
129311
- params.position.character
129312
- );
129313
- if (!symbol || isAnonymous(symbol)) return null;
129314
- const text = this.documentManager.getText(params.textDocument.uri);
129315
- if (!text) return null;
129316
- const edits = [];
129317
- const oldName = symbol.name;
129318
- const newName = params.newName;
129319
- const references = symbolTable.findReferences(oldName);
129320
- for (const ref of references) {
129321
- if (ref.uri === params.textDocument.uri) {
129322
- edits.push({
129323
- range: ref.selectionRange,
129324
- newText: newName
129325
- });
129326
- }
129577
+ const references = new NameReferences(this.documentManager);
129578
+ const ref = references.at(params.textDocument.uri, params.position);
129579
+ if (!ref?.symbol) return null;
129580
+ const invalidControl = [...params.newName].some((ch) => {
129581
+ const code = ch.charCodeAt(0);
129582
+ return code < 32 && !" \n\r".includes(ch) || code === 127;
129583
+ });
129584
+ if (!params.newName || invalidControl) {
129585
+ throw new import_node11.ResponseError(import_node11.ErrorCodes.InvalidParams, "A SysML name must be non-empty and contain printable characters or escaped whitespace.");
129327
129586
  }
129328
- const lines = text.split("\n");
129329
- for (let i = 0; i < lines.length; i++) {
129330
- for (const col of findWordOccurrences(lines[i], oldName)) {
129331
- const range = {
129332
- start: { line: i, character: col },
129333
- end: { line: i, character: col + oldName.length }
129334
- };
129335
- if (!edits.some((e) => e.range.start.line === i && e.range.start.character === col)) {
129336
- edits.push({ range, newText: newName });
129337
- }
129338
- }
129587
+ const parsed = params.newName.startsWith("'") ? readNameAt(params.newName, 0) : void 0;
129588
+ if (params.newName.startsWith("'") && parsed?.end !== params.newName.length) {
129589
+ throw new import_node11.ResponseError(import_node11.ErrorCodes.InvalidParams, "The quoted SysML name is incomplete or contains an invalid escape sequence.");
129339
129590
  }
129340
- if (edits.length === 0) return null;
129341
- return {
129342
- changes: {
129343
- [params.textDocument.uri]: edits
129344
- }
129345
- };
129591
+ const newText = quoteName(parsed?.name ?? params.newName);
129592
+ const changes = {};
129593
+ for (const occurrence of references.to(ref.symbol)) {
129594
+ if (occurrence.name !== ref.name) continue;
129595
+ (changes[occurrence.uri] ??= []).push({ range: occurrence.range, newText });
129596
+ }
129597
+ return Object.keys(changes).length > 0 ? { changes } : null;
129346
129598
  }
129347
129599
  };
129348
129600
 
129349
129601
  // server/src/providers/semanticTokensProvider.ts
129350
- var import_node10 = __toESM(require_node3());
129602
+ var import_node12 = __toESM(require_node3());
129351
129603
  var OPERATOR_TOKENS = /* @__PURE__ */ new Set([
129352
129604
  SysMLv2Lexer.BANG_EQ_EQ,
129353
129605
  // !==
@@ -129488,7 +129740,7 @@ var SemanticTokensProvider = class {
129488
129740
  if (this.tokenCache && this.tokenCache.uri === uri && this.tokenCache.version === version) {
129489
129741
  return this.tokenCache.tokens;
129490
129742
  }
129491
- const builder = new import_node10.SemanticTokensBuilder();
129743
+ const builder = new import_node12.SemanticTokensBuilder();
129492
129744
  const result = this.documentManager.get(uri);
129493
129745
  if (!result) {
129494
129746
  return builder.build();
@@ -129568,7 +129820,7 @@ var SemanticTokensProvider = class {
129568
129820
  };
129569
129821
 
129570
129822
  // server/src/providers/semanticValidator.ts
129571
- var import_node11 = __toESM(require_node3());
129823
+ var import_node13 = __toESM(require_node3());
129572
129824
  var CONSTRAINT_KEYWORDS = /* @__PURE__ */ new Set([
129573
129825
  "and",
129574
129826
  "or",
@@ -129590,6 +129842,13 @@ var CONSTRAINT_KEYWORDS = /* @__PURE__ */ new Set([
129590
129842
  "assert",
129591
129843
  "assume"
129592
129844
  ]);
129845
+ var CONNECTOR_KINDS = /* @__PURE__ */ new Set([
129846
+ "connection" /* ConnectionUsage */,
129847
+ "interface" /* InterfaceUsage */,
129848
+ "allocation" /* AllocationUsage */,
129849
+ "flow" /* FlowUsage */,
129850
+ "succession flow" /* SuccessionFlowUsage */
129851
+ ]);
129593
129852
  var SemanticValidator = class _SemanticValidator {
129594
129853
  constructor(documentManager2) {
129595
129854
  this.documentManager = documentManager2;
@@ -129666,7 +129925,7 @@ var SemanticValidator = class _SemanticValidator {
129666
129925
  diagnostics.push(...this.checkAmbiguousNamespaceName(symbols, allSymbols));
129667
129926
  diagnostics.push(...this.checkUnusedDefinitions(allSymbols, uri));
129668
129927
  diagnostics.push(...this.checkRedefinitionMultiplicity(symbols, indexes, text));
129669
- diagnostics.push(...this.checkPortCompatibility(text, uri, indexes));
129928
+ diagnostics.push(...this.checkPortCompatibility(text, uri, symbols, indexes));
129670
129929
  diagnostics.push(...this.checkConstraintBodyReferences(text, uri, symbols, indexes));
129671
129930
  diagnostics.push(...this.checkCircularSpecialization(symbols, indexes));
129672
129931
  diagnostics.push(...this.checkUnsatisfiedRequirements(symbols, indexes));
@@ -129687,7 +129946,7 @@ var SemanticValidator = class _SemanticValidator {
129687
129946
  const { resolved, strippedTypeName: typeName } = resolveTypeName(symbol.typeName, symbol, this.namespaceResolver, indexes, libraryNames);
129688
129947
  if (resolved) return [];
129689
129948
  const isMandatory = symbol.multiplicityRange && symbol.multiplicityRange.lower >= 1;
129690
- const severity = isMandatory ? import_node11.DiagnosticSeverity.Error : import_node11.DiagnosticSeverity.Warning;
129949
+ const severity = isMandatory ? import_node13.DiagnosticSeverity.Error : import_node13.DiagnosticSeverity.Warning;
129691
129950
  let message = `Type '${typeName}' is not defined in the current document or standard library`;
129692
129951
  if (isMandatory) {
129693
129952
  const multStr = symbol.multiplicity ?? "1";
@@ -129713,7 +129972,7 @@ var SemanticValidator = class _SemanticValidator {
129713
129972
  const { lower, upper } = symbol.multiplicityRange;
129714
129973
  if (typeof upper === "number" && lower > upper) {
129715
129974
  return [{
129716
- severity: import_node11.DiagnosticSeverity.Error,
129975
+ severity: import_node13.DiagnosticSeverity.Error,
129717
129976
  range: symbol.selectionRange,
129718
129977
  message: `Invalid multiplicity [${symbol.multiplicity}]: lower bound (${lower}) exceeds upper bound (${upper})`,
129719
129978
  source: "sysml",
@@ -129722,7 +129981,7 @@ var SemanticValidator = class _SemanticValidator {
129722
129981
  }
129723
129982
  if (lower < 0) {
129724
129983
  return [{
129725
- severity: import_node11.DiagnosticSeverity.Error,
129984
+ severity: import_node13.DiagnosticSeverity.Error,
129726
129985
  range: symbol.selectionRange,
129727
129986
  message: `Invalid multiplicity [${symbol.multiplicity}]: lower bound cannot be negative`,
129728
129987
  source: "sysml",
@@ -129746,7 +130005,7 @@ var SemanticValidator = class _SemanticValidator {
129746
130005
  );
129747
130006
  if (!hasEnumValues) {
129748
130007
  return [{
129749
- severity: import_node11.DiagnosticSeverity.Information,
130008
+ severity: import_node13.DiagnosticSeverity.Information,
129750
130009
  range: symbol.selectionRange,
129751
130010
  message: `Enumeration '${displayName(symbol)}' has no enum values defined`,
129752
130011
  source: "sysml",
@@ -129766,7 +130025,7 @@ var SemanticValidator = class _SemanticValidator {
129766
130025
  const ch = symbol.name[0];
129767
130026
  if (ch === ch.toLowerCase() && ch !== ch.toUpperCase()) {
129768
130027
  return [{
129769
- severity: import_node11.DiagnosticSeverity.Hint,
130028
+ severity: import_node13.DiagnosticSeverity.Hint,
129770
130029
  range: symbol.selectionRange,
129771
130030
  message: `Definition '${symbol.name}' should use PascalCase`,
129772
130031
  source: "sysml",
@@ -129778,7 +130037,7 @@ var SemanticValidator = class _SemanticValidator {
129778
130037
  const ch = symbol.name[0];
129779
130038
  if (ch === ch.toUpperCase() && ch !== ch.toLowerCase()) {
129780
130039
  return [{
129781
- severity: import_node11.DiagnosticSeverity.Hint,
130040
+ severity: import_node13.DiagnosticSeverity.Hint,
129782
130041
  range: symbol.selectionRange,
129783
130042
  message: `Usage '${symbol.name}' should use camelCase`,
129784
130043
  source: "sysml",
@@ -129797,7 +130056,7 @@ var SemanticValidator = class _SemanticValidator {
129797
130056
  if (!isDefinition(symbol.kind)) return [];
129798
130057
  if (symbol.documentation) return [];
129799
130058
  return [{
129800
- severity: import_node11.DiagnosticSeverity.Information,
130059
+ severity: import_node13.DiagnosticSeverity.Information,
129801
130060
  range: symbol.selectionRange,
129802
130061
  message: `Definition '${displayName(symbol)}' has no documentation`,
129803
130062
  source: "sysml",
@@ -129816,23 +130075,23 @@ var SemanticValidator = class _SemanticValidator {
129816
130075
  );
129817
130076
  const defsInScope = targetUri ? defs.filter((def) => def.uri === targetUri) : defs;
129818
130077
  const referencedTypes = new Set(
129819
- symbols.filter((s) => s.kind !== "package" /* Package */).flatMap((s) => s.typeNames)
130078
+ symbols.filter((s) => s.kind !== "package" /* Package */).flatMap((s) => s.typeNames.flatMap((name) => [name, splitQualifiedName(name).at(-1)]))
129820
130079
  );
129821
130080
  for (const s of symbols) {
129822
130081
  if (s.exposeTargets) {
129823
130082
  for (const target of s.exposeTargets) {
129824
- const simpleName = target.replace(/::\*{1,2}$/, "").split("::").pop();
130083
+ const simpleName = splitQualifiedName(target.replace(/::\*{1,2}$/, "")).pop();
129825
130084
  if (simpleName) referencedTypes.add(simpleName);
129826
130085
  }
129827
130086
  }
129828
130087
  }
129829
130088
  const diagnostics = [];
129830
130089
  for (const def of defsInScope) {
129831
- const isReferenced = referencedTypes.has(def.name);
130090
+ const isReferenced = referencedTypes.has(def.name) || def.shortName !== void 0 && referencedTypes.has(def.shortName);
129832
130091
  const hasBaseType = (def.typeNames?.length ?? 0) > 0;
129833
130092
  if (!isReferenced && !hasBaseType) {
129834
130093
  diagnostics.push({
129835
- severity: import_node11.DiagnosticSeverity.Warning,
130094
+ severity: import_node13.DiagnosticSeverity.Warning,
129836
130095
  range: def.selectionRange,
129837
130096
  message: `Definition '${def.name}' is not referenced by any usage in the workspace`,
129838
130097
  source: "sysml",
@@ -129887,7 +130146,7 @@ var SemanticValidator = class _SemanticValidator {
129887
130146
  opts?.text ? [opts.text] : []
129888
130147
  ));
129889
130148
  if (opts?.text && opts.uri) {
129890
- diagnostics.push(...instance.checkPortCompatibility(opts.text, opts.uri, indexes));
130149
+ diagnostics.push(...instance.checkPortCompatibility(opts.text, opts.uri, symbolsInUri, indexes));
129891
130150
  diagnostics.push(...instance.checkConstraintBodyReferences(opts.text, opts.uri, symbolsInUri, indexes));
129892
130151
  }
129893
130152
  return instance.dedupeDiagnostics(diagnostics);
@@ -129907,7 +130166,7 @@ var SemanticValidator = class _SemanticValidator {
129907
130166
  const cycle = this.followSpecializationChain(def.name, def.typeNames, visited, indexes);
129908
130167
  if (cycle) {
129909
130168
  diagnostics.push({
129910
- severity: import_node11.DiagnosticSeverity.Error,
130169
+ severity: import_node13.DiagnosticSeverity.Error,
129911
130170
  range: def.selectionRange,
129912
130171
  message: `Circular specialization: ${cycle.join(" :> ")} :> ${cycle[0]}`,
129913
130172
  source: "sysml",
@@ -129995,7 +130254,7 @@ var SemanticValidator = class _SemanticValidator {
129995
130254
  const isSatisfied = satisfiedNames.has(req.name) || req.qualifiedName !== void 0 && satisfiedNames.has(req.qualifiedName);
129996
130255
  if (!isSatisfied) {
129997
130256
  diagnostics.push({
129998
- severity: import_node11.DiagnosticSeverity.Warning,
130257
+ severity: import_node13.DiagnosticSeverity.Warning,
129999
130258
  range: req.selectionRange,
130000
130259
  message: `Requirement '${req.name}' is not satisfied by any element`,
130001
130260
  source: "sysml",
@@ -130132,7 +130391,7 @@ var SemanticValidator = class _SemanticValidator {
130132
130391
  if (!isVerified) {
130133
130392
  const message = isSatisfied ? `Requirement '${req.name}' is satisfied but has no verification case \u2014 consider adding: verify ${req.name} by <VerificationCase>;` : `Requirement '${req.name}' has no verification case \u2014 consider adding: verify ${req.name} by <VerificationCase>;`;
130134
130393
  diagnostics.push({
130135
- severity: import_node11.DiagnosticSeverity.Warning,
130394
+ severity: import_node13.DiagnosticSeverity.Warning,
130136
130395
  range: req.selectionRange,
130137
130396
  message,
130138
130397
  source: "sysml",
@@ -130192,7 +130451,7 @@ var SemanticValidator = class _SemanticValidator {
130192
130451
  const hasFilter = view.viewFilters && view.viewFilters.length > 0;
130193
130452
  if (!hasExpose && !hasFilter) {
130194
130453
  diagnostics.push({
130195
- severity: import_node11.DiagnosticSeverity.Information,
130454
+ severity: import_node13.DiagnosticSeverity.Information,
130196
130455
  range: view.selectionRange,
130197
130456
  message: `View '${view.name}' has no expose or filter directives \u2014 it will show all elements`,
130198
130457
  source: "sysml",
@@ -130232,7 +130491,7 @@ var SemanticValidator = class _SemanticValidator {
130232
130491
  const upperOk = baseUpper === "*" || curUpper !== "*" && curUpper <= baseUpper;
130233
130492
  if (lowerOk && upperOk) continue;
130234
130493
  diagnostics.push({
130235
- severity: import_node11.DiagnosticSeverity.Error,
130494
+ severity: import_node13.DiagnosticSeverity.Error,
130236
130495
  range: s.selectionRange,
130237
130496
  message: `Redefinition multiplicity [${s.multiplicity ?? "?"}] is incompatible with base '${base.name}' multiplicity [${base.multiplicity ?? "?"}]`,
130238
130497
  source: "sysml",
@@ -130250,17 +130509,21 @@ var SemanticValidator = class _SemanticValidator {
130250
130509
  * - The connection is within an interface usage
130251
130510
  * - Both ports are untyped (empty port defs with no features)
130252
130511
  */
130253
- checkPortCompatibility(text, uri, indexes) {
130512
+ checkPortCompatibility(text, uri, symbolsInUri, indexes) {
130254
130513
  if (!text) return [];
130255
130514
  const diagnostics = [];
130256
130515
  const lines = text.split("\n");
130257
- const re = /\bconnect\s+([A-Za-z_][\w.]*)\s+to\s+([A-Za-z_][\w.]*)/g;
130258
- let m2;
130259
- while ((m2 = re.exec(text)) !== null) {
130260
- const left = m2[1].split(".").pop();
130261
- const right = m2[2].split(".").pop();
130262
- const lSym = (indexes.portsByName.get(left) ?? [])[0];
130263
- const rSym = (indexes.portsByName.get(right) ?? [])[0];
130516
+ const paths = [...scanFeaturePaths(text)];
130517
+ for (let i = 0; i + 3 < paths.length; i++) {
130518
+ const [connect, leftEnd, to, rightEnd] = paths.slice(i, i + 4);
130519
+ if (text.slice(connect.start, connect.end) !== "connect" || text.slice(to.start, to.end) !== "to" || !/^\s+$/.test(text.slice(connect.end, leftEnd.start)) || !/^\s+$/.test(text.slice(leftEnd.end, to.start)) || !/^\s+$/.test(text.slice(to.end, rightEnd.start))) continue;
130520
+ const leftPath = [...leftEnd.parts];
130521
+ const rightPath = [...rightEnd.parts];
130522
+ const left = leftPath[leftPath.length - 1];
130523
+ const right = rightPath[rightPath.length - 1];
130524
+ const scope = this.connectorScope(symbolsInUri, this.indexToRange(text, connect.start, 0).start, indexes);
130525
+ const lSym = this.resolveConnectorEnd(leftPath, scope, indexes);
130526
+ const rSym = this.resolveConnectorEnd(rightPath, scope, indexes);
130264
130527
  if (!lSym || !rSym) continue;
130265
130528
  const lType = lSym.typeNames[0] ?? lSym.typeName;
130266
130529
  const rType = rSym.typeNames[0] ?? rSym.typeName;
@@ -130268,10 +130531,10 @@ var SemanticValidator = class _SemanticValidator {
130268
130531
  if (lType === "~" + rType || rType === "~" + lType) continue;
130269
130532
  if (lType.startsWith("~") && lType.slice(1) === rType) continue;
130270
130533
  if (rType.startsWith("~") && rType.slice(1) === lType) continue;
130271
- const matchLine = text.substring(0, m2.index).split("\n").length - 1;
130534
+ const matchLine = text.substring(0, connect.start).split("\n").length - 1;
130272
130535
  let insideInterfaceDef = false;
130273
- for (let i = matchLine; i >= 0 && i >= matchLine - 30; i--) {
130274
- const line = (lines[i] || "").trim();
130536
+ for (let i2 = matchLine; i2 >= 0 && i2 >= matchLine - 30; i2--) {
130537
+ const line = (lines[i2] || "").trim();
130275
130538
  if (/\binterface\s+def\b/.test(line)) {
130276
130539
  insideInterfaceDef = true;
130277
130540
  break;
@@ -130279,7 +130542,7 @@ var SemanticValidator = class _SemanticValidator {
130279
130542
  if (/^\s*package\b/.test(line)) break;
130280
130543
  }
130281
130544
  if (insideInterfaceDef) continue;
130282
- const precedingText = text.substring(Math.max(0, m2.index - 300), m2.index);
130545
+ const precedingText = text.substring(Math.max(0, connect.start - 300), connect.start);
130283
130546
  if (/\binterface\s+\w[\w']*(:\w[\w']*)?\s*$/m.test(precedingText)) continue;
130284
130547
  const lDefSyms = indexes.byName.get(lType) ?? [];
130285
130548
  const rDefSyms = indexes.byName.get(rType) ?? [];
@@ -130298,18 +130561,67 @@ var SemanticValidator = class _SemanticValidator {
130298
130561
  const hasSharedFeature = rChildren.some((c) => lChildNames.has(c.name));
130299
130562
  if (hasSharedFeature) continue;
130300
130563
  }
130301
- const range = this.indexToRange(text, m2.index, m2[0].length);
130564
+ const range = this.indexToRange(text, connect.start, rightEnd.end - connect.start);
130302
130565
  diagnostics.push({
130303
- severity: import_node11.DiagnosticSeverity.Warning,
130566
+ severity: import_node13.DiagnosticSeverity.Warning,
130304
130567
  range,
130305
130568
  message: `Port compatibility issue: '${left}' (${lType}) is connected to '${right}' (${rType})`,
130306
130569
  source: "sysml",
130307
130570
  code: "incompatible-port-types",
130308
- data: { uri }
130571
+ data: { uri, left, right, leftType: lType }
130309
130572
  });
130310
130573
  }
130311
130574
  return diagnostics;
130312
130575
  }
130576
+ /**
130577
+ * The innermost element around `position` that owns a connector declared
130578
+ * there: the connector's own symbol, when it has one, is skipped.
130579
+ */
130580
+ connectorScope(symbols, position, indexes) {
130581
+ const before = (a, b) => a.line < b.line || a.line === b.line && a.character <= b.character;
130582
+ const size = (r) => (r.end.line - r.start.line) * 1e6 + (r.end.character - r.start.character);
130583
+ let scope;
130584
+ for (const s of symbols) {
130585
+ if (!before(s.range.start, position) || !before(position, s.range.end)) continue;
130586
+ if (!scope || size(s.range) < size(scope.range)) scope = s;
130587
+ }
130588
+ while (scope && CONNECTOR_KINDS.has(scope.kind)) scope = ownerOf(scope, indexes);
130589
+ return scope;
130590
+ }
130591
+ /**
130592
+ * The port that a connector end (`a.p`, `a.p.q`) names, resolved from
130593
+ * `scope` outward: its first segment is a feature of `scope` or of one of
130594
+ * its owners, each next one a feature of the one before. Two parts can each
130595
+ * have a port of the same name, so an end is never matched by its last
130596
+ * segment alone, except when the path does not resolve and the workspace
130597
+ * has only one port of that name.
130598
+ */
130599
+ resolveConnectorEnd(path3, scope, indexes) {
130600
+ let feature;
130601
+ for (let namespace = scope; namespace && !feature; namespace = ownerOf(namespace, indexes)) {
130602
+ feature = this.findFeature(namespace, path3[0], indexes);
130603
+ }
130604
+ for (const name of path3.slice(1)) {
130605
+ feature = feature && this.findFeature(feature, name, indexes);
130606
+ }
130607
+ if (feature) return feature.kind === "port" /* PortUsage */ ? feature : void 0;
130608
+ const sameName = indexes.portsByName.get(path3[path3.length - 1]) ?? [];
130609
+ return sameName.length === 1 ? sameName[0] : void 0;
130610
+ }
130611
+ /** The feature `name` of `owner`: its own member, else a member of one of its types or their supertypes. */
130612
+ findFeature(owner, name, indexes) {
130613
+ const own = (indexes.byParent.get(namespaceKeyOf(owner)) ?? []).find((s) => s.name === name);
130614
+ if (own) return own;
130615
+ for (const typeName of owner.typeNames) {
130616
+ const type = this.namespaceResolver.resolveNameFrom(owner, typeName, indexes);
130617
+ if (!type || !isDefinition(type.kind)) continue;
130618
+ for (const definition of this.getSpecializationHierarchy(type, indexes).flat()) {
130619
+ const member = (indexes.byParent.get(namespaceKeyOf(definition)) ?? []).find((s) => s.name === name);
130620
+ if (member) return member;
130621
+ }
130622
+ }
130623
+ return void 0;
130624
+ }
130313
130625
  /**
130314
130626
  * Resolve the full type hierarchy for a type name by following
130315
130627
  * specialization chains transitively (max depth 10).
@@ -130346,7 +130658,7 @@ var SemanticValidator = class _SemanticValidator {
130346
130658
  const startInBody = trimStart >= 0 ? trimStart : 0;
130347
130659
  const trimmedLen = Math.max(1, b.body.trim().length);
130348
130660
  diagnostics.push({
130349
- severity: import_node11.DiagnosticSeverity.Warning,
130661
+ severity: import_node13.DiagnosticSeverity.Warning,
130350
130662
  range: this.indexToRange(text, b.bodyOffset + startInBody, trimmedLen),
130351
130663
  message: "Invalid constraint body: expected expression, found documentation text",
130352
130664
  source: "sysml",
@@ -130357,17 +130669,13 @@ var SemanticValidator = class _SemanticValidator {
130357
130669
  }
130358
130670
  const parent = this.findConstraintScopeSymbol(symbolsInUri, indexes, b.startLine);
130359
130671
  if (!parent) continue;
130360
- const parentMembers = indexes.byParent.get(namespaceKeyOf(parent)) ?? [];
130672
+ const parentMembers = this.getConstraintScopeMembers(parent, indexes);
130361
130673
  if (parentMembers.length === 0) continue;
130362
- const ignoredRanges = this.getIgnoredBodyRanges(b.body);
130363
- const idRe = /\b([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*)\b/g;
130364
- let im;
130365
- while ((im = idRe.exec(b.body)) !== null) {
130366
- if (this.isIndexInRanges(im.index, ignoredRanges)) continue;
130367
- const expr = im[1];
130674
+ for (const reference of scanFeaturePaths(b.body)) {
130675
+ const expr = reference.name;
130368
130676
  if (this.isConstraintKeyword(expr)) continue;
130369
130677
  if (/^\d/.test(expr)) continue;
130370
- const path3 = expr.split(".");
130678
+ const path3 = [...reference.parts];
130371
130679
  const ok = this.resolvePathFromParent(path3, parentMembers, indexes);
130372
130680
  if (ok) continue;
130373
130681
  if (path3.length === 1) {
@@ -130376,14 +130684,14 @@ var SemanticValidator = class _SemanticValidator {
130376
130684
  continue;
130377
130685
  }
130378
130686
  }
130379
- const absoluteStart = b.bodyOffset + im.index;
130687
+ const absoluteStart = b.bodyOffset + reference.start;
130380
130688
  diagnostics.push({
130381
- severity: import_node11.DiagnosticSeverity.Warning,
130382
- range: this.indexToRange(text, absoluteStart, expr.length),
130689
+ severity: import_node13.DiagnosticSeverity.Warning,
130690
+ range: this.indexToRange(text, absoluteStart, reference.end - reference.start),
130383
130691
  message: `Unresolved constraint reference '${expr}' in scope '${displayName(parent)}'`,
130384
130692
  source: "sysml",
130385
130693
  code: "unresolved-constraint-reference",
130386
- data: { uri }
130694
+ data: { uri, scopeName: parent.name }
130387
130695
  });
130388
130696
  }
130389
130697
  }
@@ -130416,18 +130724,135 @@ var SemanticValidator = class _SemanticValidator {
130416
130724
  const root = parentMembers.find((s) => s.name === path3[0]);
130417
130725
  if (!root) return false;
130418
130726
  if (path3.length === 1) return true;
130419
- let typeName = root.typeNames[0] ?? root.typeName;
130727
+ let current = root;
130420
130728
  for (let i = 1; i < path3.length; i++) {
130729
+ const typeName = current.typeNames[0] ?? current.typeName;
130421
130730
  if (!typeName) return false;
130422
- const typeDefs = indexes.definitionsByName.get(typeName) ?? [];
130423
- const typeDef = typeDefs[0];
130424
- if (!typeDef) return false;
130425
- const member = (indexes.byParent.get(namespaceKeyOf(typeDef)) ?? []).find((s) => s.name === path3[i]);
130731
+ const typeDef = this.namespaceResolver.resolveNameFrom(current, typeName, indexes);
130732
+ if (!typeDef || !isDefinition(typeDef.kind)) return false;
130733
+ const member = this.getConstraintScopeMembers(typeDef, indexes, true).find((s) => s.name === path3[i]);
130426
130734
  if (!member) return false;
130427
- typeName = member.typeNames[0] ?? member.typeName;
130735
+ current = member;
130428
130736
  }
130429
130737
  return true;
130430
130738
  }
130739
+ getConstraintScopeMembers(scope, indexes, publicOnly = false) {
130740
+ const hierarchy = [[scope]];
130741
+ const visited = /* @__PURE__ */ new Set([scope]);
130742
+ let frontier = [scope];
130743
+ while (frontier.length > 0) {
130744
+ const next = [];
130745
+ for (const current of frontier) {
130746
+ for (const typeName of current.typeNames) {
130747
+ const supertype = this.namespaceResolver.resolveNameFrom(current, typeName, indexes);
130748
+ if (!supertype || !isDefinition(supertype.kind) || visited.has(supertype)) continue;
130749
+ visited.add(supertype);
130750
+ next.push(supertype);
130751
+ }
130752
+ }
130753
+ if (next.length > 0) hierarchy.push(next);
130754
+ frontier = next;
130755
+ }
130756
+ const membersByLevel = hierarchy.map((level) => level.flatMap((namespace) => indexes.byParent.get(namespaceKeyOf(namespace)) ?? []));
130757
+ const hiddenMembers = /* @__PURE__ */ new Set();
130758
+ for (let level = membersByLevel.length - 1; level >= 0; level--) {
130759
+ for (const redefining of membersByLevel[level]) {
130760
+ for (const target of redefining.redefinedFeatureTargets ?? []) {
130761
+ const owner = ownerOf(redefining, indexes);
130762
+ if (!owner) continue;
130763
+ for (const candidate of this.resolveInheritedRedefinitionTarget(owner, target, hiddenMembers, indexes)) {
130764
+ hiddenMembers.add(candidate.symbolId);
130765
+ }
130766
+ }
130767
+ if (redefining.kind === "subject" /* SubjectUsage */) {
130768
+ const owner = ownerOf(redefining, indexes);
130769
+ if (!owner) continue;
130770
+ for (const ancestor of this.getSpecializationHierarchy(owner, indexes).slice(1).flat()) {
130771
+ for (const candidate of indexes.byParent.get(namespaceKeyOf(ancestor)) ?? []) {
130772
+ if (candidate.kind === "subject" /* SubjectUsage */) hiddenMembers.add(candidate.symbolId);
130773
+ }
130774
+ }
130775
+ }
130776
+ }
130777
+ }
130778
+ const membersByName = /* @__PURE__ */ new Map();
130779
+ for (let level = 0; level < membersByLevel.length; level++) {
130780
+ for (const member of membersByLevel[level]) {
130781
+ if (level > 0 && member.visibility === "private") continue;
130782
+ if (publicOnly && member.visibility !== void 0 && member.visibility !== "public") continue;
130783
+ if (hiddenMembers.has(member.symbolId) || membersByName.has(member.name)) continue;
130784
+ membersByName.set(member.name, member);
130785
+ }
130786
+ }
130787
+ return [...membersByName.values()];
130788
+ }
130789
+ resolveInheritedRedefinitionTarget(owner, target, alreadyRedefined, indexes) {
130790
+ if (target.includes(".")) return [];
130791
+ const segments = target.split("::");
130792
+ const targetName = segments.pop()?.replace(/^'|'$/g, "");
130793
+ if (!targetName) return [];
130794
+ const qualifier = segments.join("::").replace(/^'|'$/g, "");
130795
+ const matches = /* @__PURE__ */ new Map();
130796
+ for (const supertype of this.resolveDirectSupertypes(owner, indexes)) {
130797
+ const branch = this.getSpecializationHierarchy(supertype, indexes);
130798
+ const anchors = qualifier ? branch.flat().filter((type) => this.matchesSpecializationQualifier(type, qualifier)) : [supertype];
130799
+ for (const anchor of anchors) {
130800
+ let frontier = [anchor];
130801
+ const visited = new Set(frontier);
130802
+ const candidates = [];
130803
+ while (frontier.length > 0 && candidates.length === 0) {
130804
+ for (const type of frontier) {
130805
+ for (const member of indexes.byParent.get(namespaceKeyOf(type)) ?? []) {
130806
+ if (member.name === targetName && member.visibility !== "private" && !alreadyRedefined.has(member.symbolId)) {
130807
+ candidates.push(member);
130808
+ }
130809
+ }
130810
+ }
130811
+ if (candidates.length > 0) break;
130812
+ const next = /* @__PURE__ */ new Map();
130813
+ for (const type of frontier) {
130814
+ for (const parent of this.resolveDirectSupertypes(type, indexes)) {
130815
+ if (visited.has(parent)) continue;
130816
+ visited.add(parent);
130817
+ next.set(parent.symbolId, parent);
130818
+ }
130819
+ }
130820
+ frontier = [...next.values()];
130821
+ }
130822
+ for (const candidate of candidates) matches.set(candidate.symbolId, candidate);
130823
+ }
130824
+ }
130825
+ return matches.size === 1 ? [...matches.values()] : [];
130826
+ }
130827
+ resolveDirectSupertypes(scope, indexes) {
130828
+ const supertypes = /* @__PURE__ */ new Map();
130829
+ for (const typeName of scope.typeNames) {
130830
+ const supertype = this.namespaceResolver.resolveNameFrom(scope, typeName, indexes);
130831
+ if (supertype && isDefinition(supertype.kind)) supertypes.set(supertype.symbolId, supertype);
130832
+ }
130833
+ return [...supertypes.values()];
130834
+ }
130835
+ getSpecializationHierarchy(scope, indexes) {
130836
+ const levels = [[scope]];
130837
+ const visited = /* @__PURE__ */ new Set([scope]);
130838
+ let frontier = [scope];
130839
+ while (frontier.length > 0) {
130840
+ const next = [];
130841
+ for (const type of frontier) {
130842
+ for (const parent of this.resolveDirectSupertypes(type, indexes)) {
130843
+ if (visited.has(parent)) continue;
130844
+ visited.add(parent);
130845
+ next.push(parent);
130846
+ }
130847
+ }
130848
+ if (next.length > 0) levels.push(next);
130849
+ frontier = next;
130850
+ }
130851
+ return levels;
130852
+ }
130853
+ matchesSpecializationQualifier(type, qualifier) {
130854
+ return type.name === qualifier || type.qualifiedName === qualifier || type.qualifiedName?.endsWith(`::${qualifier}`) === true;
130855
+ }
130431
130856
  findContainingSymbolByLine(symbols, line) {
130432
130857
  return symbols.filter((s) => s.range.start.line <= line && s.range.end.line >= line).sort((a, b) => {
130433
130858
  const ar = (a.range.end.line - a.range.start.line) * 1e3 + (a.range.end.character - a.range.start.character);
@@ -130438,7 +130863,7 @@ var SemanticValidator = class _SemanticValidator {
130438
130863
  findConstraintScopeSymbol(symbolsInUri, indexes, line) {
130439
130864
  let scope = this.findContainingSymbolByLine(symbolsInUri, line);
130440
130865
  while (scope) {
130441
- const members = indexes.byParent.get(namespaceKeyOf(scope)) ?? [];
130866
+ const members = this.getConstraintScopeMembers(scope, indexes);
130442
130867
  if (members.length > 0) return scope;
130443
130868
  if (!scope.parentId) return scope;
130444
130869
  scope = ownerOf(scope, indexes);
@@ -130460,25 +130885,6 @@ var SemanticValidator = class _SemanticValidator {
130460
130885
  isConstraintKeyword(value) {
130461
130886
  return CONSTRAINT_KEYWORDS.has(value);
130462
130887
  }
130463
- getIgnoredBodyRanges(body) {
130464
- const ranges = [];
130465
- const blockRe = /\/\*[\s\S]*?\*\//g;
130466
- let m2;
130467
- while ((m2 = blockRe.exec(body)) !== null) {
130468
- ranges.push({ start: m2.index, end: m2.index + m2[0].length });
130469
- }
130470
- const lineRe = /\/\/[^\n\r]*/g;
130471
- while ((m2 = lineRe.exec(body)) !== null) {
130472
- ranges.push({ start: m2.index, end: m2.index + m2[0].length });
130473
- }
130474
- return ranges;
130475
- }
130476
- isIndexInRanges(index2, ranges) {
130477
- for (const r of ranges) {
130478
- if (index2 >= r.start && index2 < r.end) return true;
130479
- }
130480
- return false;
130481
- }
130482
130888
  hasDocumentationOnlyConstraintBody(body) {
130483
130889
  const trimmed = body.trim();
130484
130890
  if (!trimmed) return false;
@@ -130576,7 +130982,7 @@ var SemanticValidator = class _SemanticValidator {
130576
130982
  if (defs.length > 1) {
130577
130983
  for (const def of defs) {
130578
130984
  diagnostics.push({
130579
- severity: import_node11.DiagnosticSeverity.Warning,
130985
+ severity: import_node13.DiagnosticSeverity.Warning,
130580
130986
  range: def.selectionRange,
130581
130987
  message: `Duplicate definition: '${name}' is defined ${defs.length} times in the same scope`,
130582
130988
  source: "sysml",
@@ -130618,7 +131024,7 @@ var SemanticValidator = class _SemanticValidator {
130618
131024
  if (!conflicting) continue;
130619
131025
  const others = otherDeclarations(conflicting, symbol);
130620
131026
  diagnostics.push({
130621
- severity: import_node11.DiagnosticSeverity.Error,
131027
+ severity: import_node13.DiagnosticSeverity.Error,
130622
131028
  range: symbol.selectionRange,
130623
131029
  message: `Ambiguous name '${symbol.name}': also declared as ${describeConflictingDeclarations(others, symbol.uri)}.`,
130624
131030
  source: "sysml",
@@ -130704,7 +131110,7 @@ function toFsPath(uri) {
130704
131110
  return void 0;
130705
131111
  }
130706
131112
  var connection = createServerConnection();
130707
- var documents = new import_node12.TextDocuments(TextDocument);
131113
+ var documents = new import_node14.TextDocuments(TextDocument);
130708
131114
  var serverStartTime = Date.now();
130709
131115
  var documentManager = new DocumentManager();
130710
131116
  var modelProvider = new SysMLModelProvider(documentManager);
@@ -130869,7 +131275,7 @@ connection.onInitialize((params) => {
130869
131275
  };
130870
131276
  const result = {
130871
131277
  capabilities: {
130872
- textDocumentSync: import_node12.TextDocumentSyncKind.Incremental,
131278
+ textDocumentSync: import_node14.TextDocumentSyncKind.Incremental,
130873
131279
  // Completion
130874
131280
  completionProvider: {
130875
131281
  resolveProvider: true,
@@ -130897,7 +131303,7 @@ connection.onInitialize((params) => {
130897
131303
  // Code actions (quick fixes)
130898
131304
  codeActionProvider: {
130899
131305
  codeActionKinds: [
130900
- import_node12.CodeActionKind.QuickFix
131306
+ import_node14.CodeActionKind.QuickFix
130901
131307
  ]
130902
131308
  },
130903
131309
  // Document formatting
@@ -130918,7 +131324,7 @@ connection.onInitialize((params) => {
130918
131324
  connection.onInitialized(async () => {
130919
131325
  if (hasConfigurationCapability) {
130920
131326
  connection.client.register(
130921
- import_node12.DidChangeConfigurationNotification.type,
131327
+ import_node14.DidChangeConfigurationNotification.type,
130922
131328
  void 0
130923
131329
  );
130924
131330
  }
@@ -131027,7 +131433,8 @@ function logFolderPrefixes(ownProjectIds) {
131027
131433
  if (loggedFolderPrefixes.get(folderUri) === prefix) continue;
131028
131434
  loggedFolderPrefixes.set(folderUri, prefix);
131029
131435
  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";
131030
- connection.console.info(`Folder ${folderUri}: top-level elements' URLs start with ${prefix} (${source})`);
131436
+ const folderPath = toFsPath(folderUri) ?? folderUri;
131437
+ connection.console.debug(`Folder ${folderPath}: element ID namespace ${prefix} (${source}; ID namespace only, no network access)`);
131031
131438
  }
131032
131439
  for (const folderUri of loggedFolderPrefixes.keys()) {
131033
131440
  if (!workspaceFolderUris.includes(folderUri)) loggedFolderPrefixes.delete(folderUri);