sysml-v2-lsp 0.36.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 Position3;
3379
- (function(Position4) {
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
- Position4.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
- Position4.is = is;
3395
- })(Position3 || (exports3.Position = Position3 = {}));
3396
- var Range3;
3397
- (function(Range4) {
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: Position3.create(one, two), end: Position3.create(three, four) };
3401
- } else if (Position3.is(one) && Position3.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
- Range4.create = create;
3407
+ Range7.create = create;
3408
3408
  function is(value) {
3409
3409
  var candidate = value;
3410
- return Is.objectLiteral(candidate) && Position3.is(candidate.start) && Position3.is(candidate.end);
3410
+ return Is.objectLiteral(candidate) && Position4.is(candidate.start) && Position4.is(candidate.end);
3411
3411
  }
3412
- Range4.is = is;
3413
- })(Range3 || (exports3.Range = Range3 = {}));
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) && Range3.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) && Range3.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range3.is(candidate.targetSelectionRange) && (Range3.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) && Range3.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) && Range3.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
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) && Range3.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) && Range3.is(candidate.insert) && Range3.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 || Range3.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) && Range3.is(candidate.range) && Range3.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
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) && Range3.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) && Range3.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) && Range3.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 && Range3.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 && Range3.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 && Range3.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) && Range3.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) && Position3.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit4.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent2.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
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 Position3.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 Position3.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,7 +123164,7 @@ 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);
@@ -123145,7 +123324,10 @@ var SymbolTable = class {
123145
123324
  }
123146
123325
  /** Remove SysML quoting while retaining qualified and dotted references. */
123147
123326
  cleanTransitionText(text) {
123148
- const cleaned = text.replace(/'([^']+)'/g, "$1").trim();
123327
+ const cleaned = text.replace(
123328
+ /'(?:\\.|[^'\\])*'/g,
123329
+ (name) => joinQualifiedName([unquoteName(name)])
123330
+ ).trim();
123149
123331
  return cleaned || void 0;
123150
123332
  }
123151
123333
  /** Extract explicit first/then successions owned by an action body. */
@@ -123318,8 +123500,8 @@ var SymbolTable = class {
123318
123500
  }
123319
123501
  /** The name of the feature a reference such as `a.b` or `P::a` ends at (`b`, `a`). */
123320
123502
  lastNameSegment(reference) {
123321
- const segment = reference.getText().split(/::|\./).pop();
123322
- return segment ? this.unquoteName(segment) : void 0;
123503
+ const names = [...scanQualifiedNames(reference.getText())];
123504
+ return names.at(-1)?.segments.at(-1)?.name;
123323
123505
  }
123324
123506
  declarationTokens(ctx) {
123325
123507
  const tokens = [];
@@ -123455,6 +123637,16 @@ var SymbolTable = class {
123455
123637
  * Extract the range of just the name token.
123456
123638
  */
123457
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
+ }
123458
123650
  for (let i = 0; i < ctx.getChildCount(); i++) {
123459
123651
  const child = ctx.getChild(i);
123460
123652
  if (child instanceof TerminalNode && this.isNameTerminal(child)) {
@@ -123495,7 +123687,7 @@ var SymbolTable = class {
123495
123687
  for (const part of specStr.split(",")) {
123496
123688
  const quoted = quotedName(part);
123497
123689
  if (quoted !== void 0) {
123498
- names.push(quoted);
123690
+ names.push(joinQualifiedName([quoted]));
123499
123691
  continue;
123500
123692
  }
123501
123693
  const m2 = part.trim().match(RE_IDENT_START);
@@ -123518,7 +123710,7 @@ var SymbolTable = class {
123518
123710
  for (const part of afterColon.split(",")) {
123519
123711
  const quoted = quotedName(part);
123520
123712
  if (quoted !== void 0) {
123521
- names.push(quoted);
123713
+ names.push(joinQualifiedName([quoted]));
123522
123714
  continue;
123523
123715
  }
123524
123716
  const m2 = part.trim().match(RE_IDENT_START);
@@ -123529,18 +123721,20 @@ var SymbolTable = class {
123529
123721
  return names;
123530
123722
  }
123531
123723
  /**
123532
- * The declaration tokens before the body, with each lexer STRING token
123724
+ * The declaration tokens before the value or body, with each lexer STRING token
123533
123725
  * replaced by a numbered placeholder (`'0'`, `'1'`, ...), and
123534
123726
  * `quotedName`, which turns a placeholder in a part of that text back into
123535
- * the name. SysML 2.0 section 7.2.2 permits punctuation in unrestricted
123536
- * names (the STRING lexer production), so fallback regexes must never see
123537
- * their `:`, `:>`, `{` or keywords. Documentation is not a name token.
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.
123538
123731
  */
123539
123732
  maskedDeclaration(ctx) {
123540
123733
  const quoted = [];
123541
- const masked = this.declarationTokens(ctx).map((token) => {
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) => {
123542
123736
  const text = token.text ?? "";
123543
- return token.type === SysMLv2Lexer.STRING ? `'${quoted.push(text.slice(1, -1)) - 1}'` : text;
123737
+ return token.type === SysMLv2Lexer.STRING ? `'${quoted.push(unquoteName(text)) - 1}'` : text;
123544
123738
  }).join("");
123545
123739
  return {
123546
123740
  text: masked,
@@ -123568,7 +123762,7 @@ var SymbolTable = class {
123568
123762
  for (const part of specStr.split(",")) {
123569
123763
  const quoted = quotedName(part);
123570
123764
  if (quoted !== void 0) {
123571
- names.push(quoted);
123765
+ names.push(joinQualifiedName([quoted]));
123572
123766
  continue;
123573
123767
  }
123574
123768
  const m2 = part.trim().match(RE_IDENT_START);
@@ -123597,17 +123791,7 @@ var SymbolTable = class {
123597
123791
  if (!(child instanceof ParserRuleContext)) continue;
123598
123792
  const ri = child.ruleIndex;
123599
123793
  if (extractionRules.has(ri)) {
123600
- const childText = child.getText();
123601
- const stripped = childText.replace(/^(specializes|:>>|:>|:|definedby|subsets|redefines|references|conjugates|disjoints)/i, "");
123602
- for (const part of stripped.split(",")) {
123603
- const qm = part.match(/'([^']+)'/);
123604
- if (qm) {
123605
- names.push(qm[1]);
123606
- } else {
123607
- const m2 = part.match(/([A-Za-z_]\w*(?:::\w+)*)/);
123608
- if (m2) names.push(m2[1]);
123609
- }
123610
- }
123794
+ this.collectQualifiedTypeNames(child, names);
123611
123795
  } else if (
123612
123796
  // Recurse into declaration / part / body wrappers that may
123613
123797
  // contain nested typing rules (but NOT into body rules that
@@ -123620,6 +123804,17 @@ var SymbolTable = class {
123620
123804
  }
123621
123805
  }
123622
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
+ }
123623
123818
  /**
123624
123819
  * Extract documentation owned by this element.
123625
123820
  *
@@ -123780,10 +123975,7 @@ var SymbolTable = class {
123780
123975
  * Returns the text unchanged if not quoted.
123781
123976
  */
123782
123977
  unquoteName(text) {
123783
- if (this.isQuotedName(text)) {
123784
- return text.slice(1, -1);
123785
- }
123786
- return text;
123978
+ return unquoteName(text);
123787
123979
  }
123788
123980
  /**
123789
123981
  * Check if a text is a SysML keyword.
@@ -124071,7 +124263,7 @@ var SymbolTable = class {
124071
124263
  const child = ctx.getChild(i);
124072
124264
  if (child instanceof TerminalNode) {
124073
124265
  const text = child.symbol.text;
124074
- if (text) parts.push(text);
124266
+ if (text) parts.push(child.symbol.type === SysMLv2Lexer.STRING ? joinQualifiedName([unquoteName(text)]) : text);
124075
124267
  } else if (child instanceof ParserRuleContext) {
124076
124268
  this.collectExposeText(child, parts);
124077
124269
  }
@@ -124133,58 +124325,24 @@ var SymbolTable = class {
124133
124325
  * Extract all text content from a subtree (concatenate terminal nodes).
124134
124326
  */
124135
124327
  extractTextFromSubtree(ctx) {
124328
+ if (ctx.ruleIndex === SysMLv2Parser.RULE_name) return unquoteName(ctx.getText());
124136
124329
  const parts = [];
124137
124330
  for (let i = 0; i < ctx.getChildCount(); i++) {
124138
124331
  const child = ctx.getChild(i);
124139
124332
  if (child instanceof TerminalNode) {
124140
124333
  const text = child.symbol.text;
124141
124334
  if (text && this.isNameTerminal(child)) {
124142
- parts.push(this.unquoteName(text));
124335
+ parts.push(joinQualifiedName([this.unquoteName(text)]));
124143
124336
  }
124144
124337
  } else if (child instanceof ParserRuleContext) {
124145
124338
  const sub = this.extractTextFromSubtree(child);
124146
- if (sub) parts.push(sub);
124339
+ if (sub) parts.push(child.ruleIndex === SysMLv2Parser.RULE_name ? joinQualifiedName([sub]) : sub);
124147
124340
  }
124148
124341
  }
124149
124342
  return parts.length > 0 ? parts.join("::") : void 0;
124150
124343
  }
124151
124344
  };
124152
124345
 
124153
- // server/src/utils/identUtils.ts
124154
- function isIdentStart(c) {
124155
- return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 95;
124156
- }
124157
- function isIdentPart(c) {
124158
- return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c >= 48 && c <= 57 || c === 95;
124159
- }
124160
- function extractQualifiedNameAt(lineText, character) {
124161
- const len = lineText.length;
124162
- let i = 0;
124163
- while (i < len) {
124164
- if (!isIdentStart(lineText.charCodeAt(i))) {
124165
- i++;
124166
- continue;
124167
- }
124168
- const wordStart = i;
124169
- while (i < len) {
124170
- while (i < len && isIdentPart(lineText.charCodeAt(i))) i++;
124171
- if (i + 2 <= len && lineText[i] === ":" && lineText[i + 1] === ":" && i + 2 < len && isIdentStart(lineText.charCodeAt(i + 2))) {
124172
- i += 2;
124173
- } else {
124174
- break;
124175
- }
124176
- }
124177
- const wordEnd = i;
124178
- if (character >= wordStart && character <= wordEnd) {
124179
- return lineText.substring(wordStart, wordEnd);
124180
- }
124181
- }
124182
- return void 0;
124183
- }
124184
- function stripComments(text) {
124185
- return text.replace(/\/\*[\s\S]*?\*\//g, (m2) => m2.replace(/[^\n]/g, " ")).replace(/\/\/[^\n]*/g, (m2) => " ".repeat(m2.length));
124186
- }
124187
-
124188
124346
  // server/src/documentManager.ts
124189
124347
  var DocumentManager = class {
124190
124348
  cache = /* @__PURE__ */ new Map();
@@ -124479,55 +124637,30 @@ function readWord(line, pos) {
124479
124637
  while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124480
124638
  return pos > start ? [line.slice(start, pos), pos] : void 0;
124481
124639
  }
124640
+ function readSimpleName(line, pos) {
124641
+ const name = readNameAt(line, skipSpaces(line, pos));
124642
+ return name ? [name.name, name.end] : void 0;
124643
+ }
124482
124644
  function readName(line, pos) {
124483
124645
  pos = skipSpaces(line, pos);
124484
- if (pos < line.length && line[pos] === "'") {
124485
- pos++;
124486
- const start = pos;
124487
- while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124488
- const name = line.slice(start, pos);
124489
- if (pos < line.length && line[pos] === "'") pos++;
124490
- return name ? [name, pos] : void 0;
124491
- }
124492
124646
  if (pos < line.length && line[pos] === "<") {
124493
- pos++;
124494
- const start = pos;
124495
- while (pos < line.length && line[pos] !== ">") pos++;
124496
- const shortName = line.slice(start, pos).trim();
124497
- if (pos < line.length && line[pos] === ">") pos++;
124498
- pos = skipSpaces(line, pos);
124499
- if (pos < line.length && line[pos] === "'") {
124500
- pos++;
124501
- while (pos < line.length && line[pos] !== "'") pos++;
124502
- if (pos < line.length) pos++;
124503
- } else if (pos < line.length && isIdentPart(line.charCodeAt(pos))) {
124504
- while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124505
- }
124506
- return shortName ? [shortName, pos] : void 0;
124507
- }
124508
- 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);
124509
124655
  }
124510
124656
  function readLongName(line, pos) {
124511
124657
  pos = skipSpaces(line, pos);
124512
124658
  if (pos >= line.length || line[pos] !== "<") return void 0;
124513
- while (pos < line.length && line[pos] !== ">") pos++;
124514
- if (pos < line.length) pos++;
124515
- pos = skipSpaces(line, pos);
124516
- if (pos >= line.length) return void 0;
124517
- if (line[pos] === "'") {
124518
- pos++;
124519
- const start = pos;
124520
- while (pos < line.length && line[pos] !== "'") pos++;
124521
- const longName = line.slice(start, pos).trim();
124522
- if (longName && /^[A-Za-z_]\w*$/.test(longName)) return longName;
124523
- return void 0;
124524
- }
124525
- if (isIdentPart(line.charCodeAt(pos))) {
124526
- const start = pos;
124527
- while (pos < line.length && isIdentPart(line.charCodeAt(pos))) pos++;
124528
- return line.slice(start, pos);
124529
- }
124530
- 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];
124531
124664
  }
124532
124665
  function matchWord(line, pos, keyword) {
124533
124666
  if (!line.startsWith(keyword, pos)) return false;
@@ -124599,7 +124732,7 @@ function extractPackageNameFromHead(head) {
124599
124732
  if (close < 0) continue;
124600
124733
  pos = skipSpaces(line, close + 1);
124601
124734
  }
124602
- const w = readWord(line, pos);
124735
+ const w = readName(line, pos);
124603
124736
  if (w) return w[0];
124604
124737
  }
124605
124738
  return void 0;
@@ -124724,7 +124857,7 @@ function indexLibraryFile(fileUri, content, packages, types) {
124724
124857
  types.set(usageName, { uri: fileUri, line: i });
124725
124858
  }
124726
124859
  if (pkgName) {
124727
- const qualName = `${pkgName}::${usageName}`;
124860
+ const qualName = joinQualifiedName([pkgName, usageName]);
124728
124861
  if (!types.has(qualName)) {
124729
124862
  types.set(qualName, { uri: fileUri, line: i });
124730
124863
  }
@@ -124735,7 +124868,7 @@ function indexLibraryFile(fileUri, content, packages, types) {
124735
124868
  types.set(longName, { uri: fileUri, line: i });
124736
124869
  }
124737
124870
  if (pkgName) {
124738
- const qualLong = `${pkgName}::${longName}`;
124871
+ const qualLong = joinQualifiedName([pkgName, longName]);
124739
124872
  if (!types.has(qualLong)) {
124740
124873
  types.set(qualLong, { uri: fileUri, line: i });
124741
124874
  }
@@ -124767,15 +124900,17 @@ function initLibraryIndex(serverDir, customPath) {
124767
124900
  }
124768
124901
  function resolveLibraryPackage(name) {
124769
124902
  if (!index) return void 0;
124770
- const pkg = name.split("::")[0];
124903
+ const pkg = splitQualifiedName(name)[0];
124771
124904
  return index.get(pkg);
124772
124905
  }
124773
124906
  function resolveLibraryType(name) {
124774
124907
  if (!typeIndex) return void 0;
124908
+ const segments = splitQualifiedName(name);
124909
+ name = segments.length === 1 ? segments[0] : joinQualifiedName(segments);
124775
124910
  const exact = typeIndex.get(name);
124776
124911
  if (exact) return exact;
124777
- if (name.includes("::")) {
124778
- const member = name.split("::").pop();
124912
+ if (segments.length > 1) {
124913
+ const member = segments[segments.length - 1];
124779
124914
  return typeIndex.get(member);
124780
124915
  }
124781
124916
  return void 0;
@@ -125423,6 +125558,10 @@ var NamespaceResolver = class {
125423
125558
  resolveNameFrom(symbol, name, indexes) {
125424
125559
  return this.resolveQualifiedNameFrom(ownerKeyOf(symbol, indexes.byId), name, indexes);
125425
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);
125564
+ }
125426
125565
  /**
125427
125566
  * Resolve a (possibly qualified) name to its symbol per §7.5.1, searching
125428
125567
  * outward from namespace `start` and its enclosing namespaces (its own resolved
@@ -125434,7 +125573,7 @@ var NamespaceResolver = class {
125434
125573
  * its own enclosing package already imported, per §7.5.1/§7.5.3).
125435
125574
  */
125436
125575
  resolveQualifiedNameFrom(start, name, indexes) {
125437
- const [first, ...rest] = name.split("::");
125576
+ const [first, ...rest] = splitQualifiedName(name);
125438
125577
  let resolved;
125439
125578
  for (const ancestor of this.namespaceAncestorsOf(start, indexes)) {
125440
125579
  const candidates = this.getResolvedMembers(ancestor, indexes).get(first);
@@ -125601,6 +125740,9 @@ var NamespaceResolver = class {
125601
125740
  };
125602
125741
  for (const owned of indexes.byParent.get(namespace) ?? []) {
125603
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
+ }
125604
125746
  }
125605
125747
  perIndexesCache.set(namespace, members);
125606
125748
  const owner = typeof namespace === "string" ? indexes.byQualifiedName.get(namespace) : namespace;
@@ -125636,13 +125778,17 @@ var NamespaceResolver = class {
125636
125778
  switch (imp.kind) {
125637
125779
  case "membership": {
125638
125780
  const target = this.resolveQualifiedNameFrom(importingNamespace, imp.target, indexes);
125639
- 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
+ }
125640
125785
  break;
125641
125786
  }
125642
125787
  case "membership-deep": {
125643
125788
  const target = this.resolveQualifiedNameFrom(importingNamespace, imp.target, indexes);
125644
125789
  if (target) {
125645
125790
  addMember(target.name, { symbol: target, visibility: imp.visibility });
125791
+ if (target.shortName) addMember(target.shortName, { symbol: target, visibility: imp.visibility });
125646
125792
  this.importVisibleMembers(namespaceKeyOf(target), imp.visibility, indexes, addMember, true);
125647
125793
  }
125648
125794
  break;
@@ -125807,7 +125953,7 @@ function isISQValueType(name) {
125807
125953
  function resolveTypeName(typeName, symbol, resolver, indexes, libraryNames) {
125808
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])/);
125809
125955
  const strippedTypeName = kwMatch ? kwMatch[1] : typeName;
125810
- const rootSegment = strippedTypeName.split("::")[0];
125956
+ const rootSegment = splitQualifiedName(strippedTypeName)[0];
125811
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
125812
125958
  // via :>), not type references — don't flag them as unresolved types.
125813
125959
  strippedTypeName.charCodeAt(0) >= 97 && strippedTypeName.charCodeAt(0) <= 122;
@@ -127352,11 +127498,11 @@ var CodeActionProvider = class {
127352
127498
  const packageNames = /* @__PURE__ */ new Set();
127353
127499
  for (const s of allSymbols) {
127354
127500
  if (!isDefinition(s.kind)) continue;
127355
- if (s.name !== unresolvedType) continue;
127501
+ if (s.name !== unquoteName(unresolvedType)) continue;
127356
127502
  if (s.uri === uri) continue;
127357
- const pkg = (s.qualifiedName?.split("::")[0] ?? "").trim();
127503
+ const pkg = s.qualifiedName ? splitQualifiedName(s.qualifiedName)[0] : "";
127358
127504
  if (!pkg || pkg === unresolvedType) continue;
127359
- if (pkg) packageNames.add(pkg);
127505
+ packageNames.add(quoteName(pkg));
127360
127506
  }
127361
127507
  for (const pkg of packageNames) {
127362
127508
  if (this.hasImportForPackage(text, pkg)) {
@@ -127465,7 +127611,7 @@ var CodeActionProvider = class {
127465
127611
  const edit = {
127466
127612
  changes: {
127467
127613
  [uri]: [
127468
- import_node2.TextEdit.replace(diagnostic.range, newName)
127614
+ import_node2.TextEdit.replace(diagnostic.range, quoteName(newName))
127469
127615
  ]
127470
127616
  }
127471
127617
  };
@@ -127574,7 +127720,7 @@ ${childIndent}enum value2;`;
127574
127720
  const edit = {
127575
127721
  changes: {
127576
127722
  [uri]: [
127577
- import_node2.TextEdit.replace(diagnostic.range, newName)
127723
+ import_node2.TextEdit.replace(diagnostic.range, quoteName(newName))
127578
127724
  ]
127579
127725
  }
127580
127726
  };
@@ -127635,10 +127781,11 @@ ${childIndent}enum value2;`;
127635
127781
  if (diagnostic.code !== "incompatible-port-types") return void 0;
127636
127782
  const msg = diagnostic.message;
127637
127783
  const m2 = msg.match(/'([^']+)'\s+\(([^)]+)\)\s+is connected to\s+'([^']+)'\s+\(([^)]+)\)/);
127638
- if (!m2) return void 0;
127639
- const left = m2[1];
127640
- const leftType = m2[2];
127641
- 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;
127642
127789
  const symbolTable = this.documentManager.getWorkspaceSymbolTable();
127643
127790
  const symbolsInUri = symbolTable.getSymbolsForUri(uri);
127644
127791
  const compatible = symbolsInUri.find(
@@ -127653,8 +127800,10 @@ ${childIndent}enum value2;`;
127653
127800
  if (start.line !== end.line) return void 0;
127654
127801
  const segment = (lines[start.line] ?? "").slice(start.character, end.character);
127655
127802
  if (!segment) return void 0;
127656
- const replaced = segment.replace(new RegExp(`\\b${right}\\b`), compatible.name);
127657
- 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);
127658
127807
  const edit = {
127659
127808
  changes: {
127660
127809
  [uri]: [
@@ -127689,12 +127838,14 @@ ${childIndent}enum value2;`;
127689
127838
  diagnostic.range.end.character
127690
127839
  ) : "";
127691
127840
  const m2 = msg.match(/Unresolved constraint reference\s+'([^']+)'(?:\s+in scope\s+'([^']+)')?/);
127841
+ const data = diagnostic.data;
127692
127842
  const expr = rangeExpr && rangeExpr.includes(".") ? rangeExpr : tokenExpr && tokenExpr.includes(".") ? tokenExpr : m2?.[1] ?? "";
127693
- const scopeName = m2?.[2];
127843
+ const scopeName = data?.scopeName ?? m2?.[2];
127694
127844
  if (!expr) return void 0;
127695
127845
  if (!expr.includes(".")) return void 0;
127696
- const parts = expr.split(".");
127697
- 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;
127698
127849
  const root = parts[0];
127699
127850
  const unresolvedLeaf = parts[parts.length - 1];
127700
127851
  const symbolTable = this.documentManager.getWorkspaceSymbolTable();
@@ -127706,7 +127857,7 @@ ${childIndent}enum value2;`;
127706
127857
  const rootType = rootUsage ? rootUsage.typeNames[0] ?? rootUsage.typeName : void 0;
127707
127858
  let memberNames = [];
127708
127859
  if (rootType) {
127709
- const typeDef = allSymbols.find((s) => s.name === rootType && s.kind.endsWith(" def"));
127860
+ const typeDef = symbolTable.findByName(rootType).find((s) => isDefinition(s.kind));
127710
127861
  if (typeDef) {
127711
127862
  memberNames = allSymbols.filter((s) => s.parentId === typeDef.symbolId).map((s) => s.name);
127712
127863
  }
@@ -127728,7 +127879,8 @@ ${childIndent}enum value2;`;
127728
127879
  }
127729
127880
  }
127730
127881
  if (!best || best.dist > 4 || best.name === unresolvedLeaf) return void 0;
127731
- 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);
127732
127884
  const edit = {
127733
127885
  changes: {
127734
127886
  [uri]: [
@@ -127804,6 +127956,13 @@ ${childIndent}enum value2;`;
127804
127956
  isAttributeTypeContext(text, diagnostic, unresolvedType) {
127805
127957
  const lines = text.split("\n");
127806
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
+ }
127807
127966
  const beforeRange = line.slice(0, diagnostic.range.start.character);
127808
127967
  const unresolvedInLine = line.slice(diagnostic.range.start.character, diagnostic.range.end.character);
127809
127968
  const escapedType = unresolvedType.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -127816,18 +127975,19 @@ ${childIndent}enum value2;`;
127816
127975
  return /\battribute\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*[A-Za-z_][A-Za-z0-9_]*\b/.test(beforeRange + unresolvedInLine);
127817
127976
  }
127818
127977
  buildLocalTypeStub(text, diagnostic, unresolvedType, childIndent) {
127978
+ const sourceName = quoteName(unquoteName(unresolvedType));
127819
127979
  if (this.isAttributeTypeContext(text, diagnostic, unresolvedType)) {
127820
127980
  return {
127821
- title: `Create local 'attribute def ${unresolvedType};'`,
127981
+ title: `Create local 'attribute def ${sourceName};'`,
127822
127982
  stubText: `
127823
- ${childIndent}attribute def ${unresolvedType};
127983
+ ${childIndent}attribute def ${sourceName};
127824
127984
  `
127825
127985
  };
127826
127986
  }
127827
127987
  return {
127828
- title: `Create local 'item def ${unresolvedType};'`,
127988
+ title: `Create local 'item def ${sourceName};'`,
127829
127989
  stubText: `
127830
- ${childIndent}item def ${unresolvedType};
127990
+ ${childIndent}item def ${sourceName};
127831
127991
  `
127832
127992
  };
127833
127993
  }
@@ -127863,13 +128023,12 @@ function extractQuotedString(text, prefixWithQuote) {
127863
128023
  }
127864
128024
  function extractDottedTokenAtRange(line, start, end) {
127865
128025
  if (!line || start < 0 || end < 0 || start > line.length || end > line.length) return "";
127866
- const isTokenChar = (ch) => ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch >= "0" && ch <= "9" || ch === "_" || ch === ".";
127867
- let left = Math.max(0, start);
127868
- while (left > 0 && isTokenChar(line[left - 1])) left--;
127869
- let right = Math.min(line.length, end);
127870
- while (right < line.length && isTokenChar(line[right])) right++;
127871
- const token = line.slice(left, right).trim();
127872
- 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 "";
127873
128032
  }
127874
128033
  function extractLikelyMemberNames(text, excludeName) {
127875
128034
  const names = /* @__PURE__ */ new Set();
@@ -127981,6 +128140,7 @@ var CompletionProvider = class {
127981
128140
  seen.add(sym.name);
127982
128141
  defItems.push({
127983
128142
  label: sym.name,
128143
+ insertText: quoteName(sym.name),
127984
128144
  kind: this.mapSymbolKindToCompletionKind(sym.kind),
127985
128145
  detail: `${sym.kind}${sym.qualifiedName !== void 0 && sym.qualifiedName !== sym.name ? ` (${sym.qualifiedName})` : ""}`,
127986
128146
  documentation: sym.documentation,
@@ -128001,6 +128161,7 @@ var CompletionProvider = class {
128001
128161
  seenPorts.add(sym.name);
128002
128162
  items.push({
128003
128163
  label: sym.name,
128164
+ insertText: quoteName(sym.name),
128004
128165
  kind: import_node3.CompletionItemKind.Interface,
128005
128166
  detail: `${sym.kind}${sym.typeNames[0] ? ` : ${sym.typeNames[0]}` : ""}`,
128006
128167
  data: sym.qualifiedName,
@@ -128008,13 +128169,17 @@ var CompletionProvider = class {
128008
128169
  });
128009
128170
  }
128010
128171
  }
128011
- if (context === "type-annotation") {
128012
- return items.filter((i) => this.isTypeOrDefinitionCompletion(i));
128013
- }
128014
- if (context === "connect-endpoint") {
128015
- return items.filter((i) => this.isConnectContextCompletion(i));
128016
- }
128017
- 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
+ });
128018
128183
  }
128019
128184
  resolveCompletion(item) {
128020
128185
  return item;
@@ -128087,6 +128252,108 @@ var CompletionProvider = class {
128087
128252
  }
128088
128253
  };
128089
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
+
128090
128357
  // server/src/providers/definitionProvider.ts
128091
128358
  var DefinitionProvider = class {
128092
128359
  constructor(documentManager2) {
@@ -128099,6 +128366,10 @@ var DefinitionProvider = class {
128099
128366
  return null;
128100
128367
  }
128101
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
+ }
128102
128373
  const symbol = symbolTable.findSymbolAtPosition(
128103
128374
  params.textDocument.uri,
128104
128375
  params.position.line,
@@ -128206,7 +128477,7 @@ var DefinitionProvider = class {
128206
128477
  };
128207
128478
 
128208
128479
  // server/src/providers/diagnosticsProvider.ts
128209
- var import_node4 = __toESM(require_node3());
128480
+ var import_node5 = __toESM(require_node3());
128210
128481
  var EXPRESSION_OPERATOR_RE = /(\w\s*[+\-*/^]\s*\w)|(\w\s*\*\*\s*\w)|->|\.(?:\?)|:=|;\s*doc\b|#\w+\s+dependency/;
128211
128482
  var DiagnosticsProvider = class {
128212
128483
  constructor(documentManager2) {
@@ -128258,7 +128529,7 @@ var DiagnosticsProvider = class {
128258
128529
  message = `'${word}' is a reserved SysML keyword and cannot be used as a name. Consider renaming it (e.g., '${suggestion}').`;
128259
128530
  }
128260
128531
  return {
128261
- severity: import_node4.DiagnosticSeverity.Error,
128532
+ severity: import_node5.DiagnosticSeverity.Error,
128262
128533
  range: {
128263
128534
  start: { line: error.line, character: error.column },
128264
128535
  end: { line: error.line, character: error.column + error.length }
@@ -128327,51 +128598,51 @@ var DiagnosticsProvider = class {
128327
128598
  };
128328
128599
 
128329
128600
  // server/src/providers/symbolKindMapping.ts
128330
- var import_node5 = __toESM(require_node3());
128601
+ var import_node6 = __toESM(require_node3());
128331
128602
  function toSysMLSymbolKind(kind) {
128332
128603
  switch (kind) {
128333
128604
  // Structural definitions → Class (they *are* types)
128334
128605
  case "part def" /* PartDef */:
128335
128606
  case "occurrence def" /* OccurrenceDef */:
128336
- return import_node5.SymbolKind.Class;
128607
+ return import_node6.SymbolKind.Class;
128337
128608
  // Structural usages → Field (instances / typed features)
128338
128609
  case "part" /* PartUsage */:
128339
128610
  case "occurrence" /* OccurrenceUsage */:
128340
128611
  case "ref" /* RefUsage */:
128341
- return import_node5.SymbolKind.Field;
128612
+ return import_node6.SymbolKind.Field;
128342
128613
  // Attributes
128343
128614
  case "attribute def" /* AttributeDef */:
128344
128615
  case "attribute" /* AttributeUsage */:
128345
- return import_node5.SymbolKind.Property;
128616
+ return import_node6.SymbolKind.Property;
128346
128617
  // Ports & Interfaces → Interface
128347
128618
  case "port def" /* PortDef */:
128348
128619
  case "port" /* PortUsage */:
128349
128620
  case "interface def" /* InterfaceDef */:
128350
128621
  case "interface" /* InterfaceUsage */:
128351
- return import_node5.SymbolKind.Interface;
128622
+ return import_node6.SymbolKind.Interface;
128352
128623
  // Connections
128353
128624
  case "connection def" /* ConnectionDef */:
128354
128625
  case "connection" /* ConnectionUsage */:
128355
- return import_node5.SymbolKind.Interface;
128626
+ return import_node6.SymbolKind.Interface;
128356
128627
  // Behavioral: actions → Method
128357
128628
  case "action def" /* ActionDef */:
128358
128629
  case "action" /* ActionUsage */:
128359
128630
  case "perform action" /* PerformActionUsage */:
128360
- return import_node5.SymbolKind.Method;
128631
+ return import_node6.SymbolKind.Method;
128361
128632
  // Control-flow nodes (fork/join/merge/decide) → Event
128362
128633
  case "fork" /* ForkNode */:
128363
128634
  case "join" /* JoinNode */:
128364
128635
  case "merge" /* MergeNode */:
128365
128636
  case "decide" /* DecisionNode */:
128366
- return import_node5.SymbolKind.Event;
128637
+ return import_node6.SymbolKind.Event;
128367
128638
  // Behavioral: states → Event (better semantic fit than Enum)
128368
128639
  case "state def" /* StateDef */:
128369
128640
  case "state" /* StateUsage */:
128370
128641
  case "exhibit state" /* ExhibitStateUsage */:
128371
- return import_node5.SymbolKind.Event;
128642
+ return import_node6.SymbolKind.Event;
128372
128643
  // Transitions → Event
128373
128644
  case "transition" /* TransitionUsage */:
128374
- return import_node5.SymbolKind.Event;
128645
+ return import_node6.SymbolKind.Event;
128375
128646
  // Requirements → Object
128376
128647
  case "requirement def" /* RequirementDef */:
128377
128648
  case "requirement" /* RequirementUsage */:
@@ -128380,58 +128651,58 @@ function toSysMLSymbolKind(kind) {
128380
128651
  case "actor" /* ActorUsage */:
128381
128652
  case "subject" /* SubjectUsage */:
128382
128653
  case "stakeholder" /* StakeholderUsage */:
128383
- return import_node5.SymbolKind.Object;
128654
+ return import_node6.SymbolKind.Object;
128384
128655
  // Constraints → Constant (boolean-valued)
128385
128656
  case "constraint def" /* ConstraintDef */:
128386
128657
  case "constraint" /* ConstraintUsage */:
128387
- return import_node5.SymbolKind.Constant;
128658
+ return import_node6.SymbolKind.Constant;
128388
128659
  // Items → Struct (physical things, data)
128389
128660
  case "item def" /* ItemDef */:
128390
128661
  case "item" /* ItemUsage */:
128391
- return import_node5.SymbolKind.Struct;
128662
+ return import_node6.SymbolKind.Struct;
128392
128663
  // Allocations → TypeParameter (cross-concern mapping)
128393
128664
  case "allocation def" /* AllocationDef */:
128394
128665
  case "allocation" /* AllocationUsage */:
128395
- return import_node5.SymbolKind.TypeParameter;
128666
+ return import_node6.SymbolKind.TypeParameter;
128396
128667
  // Enumerations
128397
128668
  case "enum def" /* EnumDef */:
128398
- return import_node5.SymbolKind.Enum;
128669
+ return import_node6.SymbolKind.Enum;
128399
128670
  case "enum" /* EnumUsage */:
128400
- return import_node5.SymbolKind.EnumMember;
128671
+ return import_node6.SymbolKind.EnumMember;
128401
128672
  // Calculations → Function
128402
128673
  case "calc def" /* CalcDef */:
128403
128674
  case "calc" /* CalcUsage */:
128404
128675
  case "analysis case def" /* AnalysisCaseDef */:
128405
128676
  case "verification case def" /* VerificationCaseDef */:
128406
- return import_node5.SymbolKind.Function;
128677
+ return import_node6.SymbolKind.Function;
128407
128678
  // Use cases → Event
128408
128679
  case "use case def" /* UseCaseDef */:
128409
128680
  case "use case" /* UseCaseUsage */:
128410
128681
  case "include use case" /* IncludeUseCaseUsage */:
128411
- return import_node5.SymbolKind.Event;
128682
+ return import_node6.SymbolKind.Event;
128412
128683
  // Views → Namespace
128413
128684
  case "view def" /* ViewDef */:
128414
128685
  case "view" /* ViewUsage */:
128415
128686
  case "viewpoint def" /* ViewpointDef */:
128416
128687
  case "viewpoint" /* ViewpointUsage */:
128417
128688
  case "rendering def" /* RenderingDef */:
128418
- return import_node5.SymbolKind.Namespace;
128689
+ return import_node6.SymbolKind.Namespace;
128419
128690
  // Metadata → TypeParameter
128420
128691
  case "metadata def" /* MetadataDef */:
128421
- return import_node5.SymbolKind.TypeParameter;
128692
+ return import_node6.SymbolKind.TypeParameter;
128422
128693
  // Package
128423
128694
  case "package" /* Package */:
128424
- return import_node5.SymbolKind.Package;
128695
+ return import_node6.SymbolKind.Package;
128425
128696
  // Comments / docs
128426
128697
  case "comment" /* Comment */:
128427
128698
  case "doc" /* Doc */:
128428
- return import_node5.SymbolKind.String;
128699
+ return import_node6.SymbolKind.String;
128429
128700
  // Import / Alias
128430
128701
  case "import" /* Import */:
128431
128702
  case "alias" /* Alias */:
128432
- return import_node5.SymbolKind.Module;
128703
+ return import_node6.SymbolKind.Module;
128433
128704
  default:
128434
- return import_node5.SymbolKind.Variable;
128705
+ return import_node6.SymbolKind.Variable;
128435
128706
  }
128436
128707
  }
128437
128708
 
@@ -128478,7 +128749,7 @@ var DocumentSymbolProvider = class {
128478
128749
  };
128479
128750
 
128480
128751
  // server/src/providers/foldingRangeProvider.ts
128481
- var import_node6 = __toESM(require_node3());
128752
+ var import_node7 = __toESM(require_node3());
128482
128753
  var FoldingRangeProvider = class {
128483
128754
  constructor(documentManager2) {
128484
128755
  this.documentManager = documentManager2;
@@ -128501,7 +128772,7 @@ var FoldingRangeProvider = class {
128501
128772
  ranges.push({
128502
128773
  startLine: commentStart,
128503
128774
  endLine: i,
128504
- kind: import_node6.FoldingRangeKind.Comment
128775
+ kind: import_node7.FoldingRangeKind.Comment
128505
128776
  });
128506
128777
  commentStart = void 0;
128507
128778
  }
@@ -128514,7 +128785,7 @@ var FoldingRangeProvider = class {
128514
128785
  ranges.push({
128515
128786
  startLine,
128516
128787
  endLine: i,
128517
- kind: import_node6.FoldingRangeKind.Region
128788
+ kind: import_node7.FoldingRangeKind.Region
128518
128789
  });
128519
128790
  }
128520
128791
  }
@@ -128525,7 +128796,7 @@ var FoldingRangeProvider = class {
128525
128796
  };
128526
128797
 
128527
128798
  // server/src/providers/formattingProvider.ts
128528
- var import_node7 = __toESM(require_node3());
128799
+ var import_node8 = __toESM(require_node3());
128529
128800
  var FormattingProvider = class {
128530
128801
  constructor(documents2) {
128531
128802
  this.documents = documents2;
@@ -128541,8 +128812,8 @@ var FormattingProvider = class {
128541
128812
  const formatted = this.formatSysML(text, indent);
128542
128813
  if (formatted === text) return [];
128543
128814
  return [
128544
- import_node7.TextEdit.replace(
128545
- import_node7.Range.create(0, 0, doc.lineCount, 0),
128815
+ import_node8.TextEdit.replace(
128816
+ import_node8.Range.create(0, 0, doc.lineCount, 0),
128546
128817
  formatted
128547
128818
  )
128548
128819
  ];
@@ -128556,7 +128827,7 @@ var FormattingProvider = class {
128556
128827
  const rangeText = doc.getText(params.range);
128557
128828
  const formatted = this.formatSysML(rangeText, indent);
128558
128829
  if (formatted === rangeText) return [];
128559
- return [import_node7.TextEdit.replace(params.range, formatted)];
128830
+ return [import_node8.TextEdit.replace(params.range, formatted)];
128560
128831
  }
128561
128832
  formatSysML(text, indent) {
128562
128833
  const lines = text.split("\n");
@@ -128692,7 +128963,7 @@ var FormattingProvider = class {
128692
128963
  };
128693
128964
 
128694
128965
  // server/src/providers/hoverProvider.ts
128695
- var import_node8 = __toESM(require_node3());
128966
+ var import_node9 = __toESM(require_node3());
128696
128967
  var HoverProvider = class {
128697
128968
  constructor(documentManager2) {
128698
128969
  this.documentManager = documentManager2;
@@ -128709,12 +128980,13 @@ var HoverProvider = class {
128709
128980
  return null;
128710
128981
  }
128711
128982
  const text = this.documentManager.getText(params.textDocument.uri);
128712
- const word = text ? this.getWordAtPosition(text, params.position.line, params.position.character) : void 0;
128713
- 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) {
128714
128986
  const libHover = this.buildLibraryHover(word);
128715
128987
  if (libHover) return libHover;
128716
128988
  }
128717
- const symbol = symbolTable.findSymbolAtPosition(
128989
+ const symbol = reference?.symbol ?? symbolTable.findSymbolAtPosition(
128718
128990
  params.textDocument.uri,
128719
128991
  params.position.line,
128720
128992
  params.position.character
@@ -128766,7 +129038,7 @@ ${symbol.documentation}`);
128766
129038
  if (hoverDiags.length > 0) {
128767
129039
  lines.push("\n---\n**Semantic Feedback**");
128768
129040
  for (const d of hoverDiags.slice(0, 3)) {
128769
- 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";
128770
129042
  lines.push(`- **${sev}**: ${d.message}`);
128771
129043
  const hint = this.getRepairHint(String(d.code ?? ""));
128772
129044
  if (hint) {
@@ -128775,12 +129047,12 @@ ${symbol.documentation}`);
128775
129047
  }
128776
129048
  }
128777
129049
  const content = {
128778
- kind: import_node8.MarkupKind.Markdown,
129050
+ kind: import_node9.MarkupKind.Markdown,
128779
129051
  value: lines.join("\n")
128780
129052
  };
128781
129053
  return {
128782
129054
  contents: content,
128783
- range: symbol.selectionRange
129055
+ range: reference?.range ?? symbol.selectionRange
128784
129056
  };
128785
129057
  }
128786
129058
  /**
@@ -128807,7 +129079,7 @@ ${info.documentation}`);
128807
129079
  }
128808
129080
  return {
128809
129081
  contents: {
128810
- kind: import_node8.MarkupKind.Markdown,
129082
+ kind: import_node9.MarkupKind.Markdown,
128811
129083
  value: lines.join("\n")
128812
129084
  }
128813
129085
  };
@@ -128847,7 +129119,7 @@ ${info.documentation}`);
128847
129119
  };
128848
129120
 
128849
129121
  // server/src/providers/keywordValidator.ts
128850
- var import_node9 = __toESM(require_node3());
129122
+ var import_node10 = __toESM(require_node3());
128851
129123
 
128852
129124
  // server/src/utils/emptyNames.ts
128853
129125
  var EMPTY_NAME_MESSAGE = "Empty name '': a name in single quotes must contain at least one character";
@@ -129246,7 +129518,7 @@ function validateKeywords(result) {
129246
129518
  const line2 = (token.line ?? 1) - 1;
129247
129519
  const char2 = token.column ?? 0;
129248
129520
  diagnostics.push({
129249
- severity: import_node9.DiagnosticSeverity.Error,
129521
+ severity: import_node10.DiagnosticSeverity.Error,
129250
129522
  range: { start: { line: line2, character: char2 }, end: { line: line2, character: char2 + 2 } },
129251
129523
  message: EMPTY_NAME_MESSAGE,
129252
129524
  source: "sysml",
@@ -129264,7 +129536,7 @@ function validateKeywords(result) {
129264
129536
  const char = token.column ?? 0;
129265
129537
  const message = `Unknown keyword '${text}'. Did you mean '${suggestion}'?`;
129266
129538
  diagnostics.push({
129267
- severity: import_node9.DiagnosticSeverity.Error,
129539
+ severity: import_node10.DiagnosticSeverity.Error,
129268
129540
  range: {
129269
129541
  start: { line, character: char },
129270
129542
  end: { line, character: char + text.length }
@@ -129284,115 +129556,50 @@ var ReferencesProvider = class {
129284
129556
  }
129285
129557
  documentManager;
129286
129558
  provideReferences(params) {
129287
- const result = this.documentManager.get(params.textDocument.uri);
129288
- if (!result) {
129289
- return [];
129290
- }
129291
- const symbolTable = this.documentManager.getWorkspaceSymbolTable();
129292
- const symbol = symbolTable.findSymbolAtPosition(
129293
- params.textDocument.uri,
129294
- params.position.line,
129295
- params.position.character
129296
- );
129297
- if (!symbol || isAnonymous(symbol)) {
129298
- return [];
129299
- }
129300
- const references = symbolTable.findReferences(symbol.name);
129301
- const locations = [];
129302
- for (const ref of references) {
129303
- locations.push({
129304
- uri: ref.uri,
129305
- range: ref.selectionRange
129306
- });
129307
- }
129308
- if (params.context.includeDeclaration) {
129309
- }
129310
- 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 })) : [];
129311
129562
  }
129312
129563
  };
129313
129564
 
129314
129565
  // server/src/providers/renameProvider.ts
129315
- function findWordOccurrences(line, word) {
129316
- const positions = [];
129317
- let from = 0;
129318
- while (from <= line.length - word.length) {
129319
- const idx = line.indexOf(word, from);
129320
- if (idx < 0) break;
129321
- if ((idx === 0 || !isIdentPart(line.charCodeAt(idx - 1))) && (idx + word.length >= line.length || !isIdentPart(line.charCodeAt(idx + word.length)))) {
129322
- positions.push(idx);
129323
- }
129324
- from = idx + 1;
129325
- }
129326
- return positions;
129327
- }
129566
+ var import_node11 = __toESM(require_node3());
129328
129567
  var RenameProvider = class {
129329
129568
  constructor(documentManager2) {
129330
129569
  this.documentManager = documentManager2;
129331
129570
  }
129332
129571
  documentManager;
129333
- /**
129334
- * Check if the token at position is renameable and return its range.
129335
- */
129336
129572
  prepareRename(params) {
129337
- const symbolTable = this.documentManager.getSymbolTable(params.textDocument.uri);
129338
- if (!symbolTable) return null;
129339
- const symbol = symbolTable.findSymbolAtPosition(
129340
- params.textDocument.uri,
129341
- params.position.line,
129342
- params.position.character
129343
- );
129344
- if (!symbol || isAnonymous(symbol)) return null;
129345
- return symbol.selectionRange;
129573
+ const ref = new NameReferences(this.documentManager).at(params.textDocument.uri, params.position);
129574
+ return ref?.symbol ? ref.range : null;
129346
129575
  }
129347
- /**
129348
- * Perform the rename — update the symbol and all references.
129349
- */
129350
129576
  provideRename(params) {
129351
- const symbolTable = this.documentManager.getSymbolTable(params.textDocument.uri);
129352
- if (!symbolTable) return null;
129353
- const symbol = symbolTable.findSymbolAtPosition(
129354
- params.textDocument.uri,
129355
- params.position.line,
129356
- params.position.character
129357
- );
129358
- if (!symbol || isAnonymous(symbol)) return null;
129359
- const text = this.documentManager.getText(params.textDocument.uri);
129360
- if (!text) return null;
129361
- const edits = [];
129362
- const oldName = symbol.name;
129363
- const newName = params.newName;
129364
- const references = symbolTable.findReferences(oldName);
129365
- for (const ref of references) {
129366
- if (ref.uri === params.textDocument.uri) {
129367
- edits.push({
129368
- range: ref.selectionRange,
129369
- newText: newName
129370
- });
129371
- }
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.");
129372
129586
  }
129373
- const lines = text.split("\n");
129374
- for (let i = 0; i < lines.length; i++) {
129375
- for (const col of findWordOccurrences(lines[i], oldName)) {
129376
- const range = {
129377
- start: { line: i, character: col },
129378
- end: { line: i, character: col + oldName.length }
129379
- };
129380
- if (!edits.some((e) => e.range.start.line === i && e.range.start.character === col)) {
129381
- edits.push({ range, newText: newName });
129382
- }
129383
- }
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.");
129384
129590
  }
129385
- if (edits.length === 0) return null;
129386
- return {
129387
- changes: {
129388
- [params.textDocument.uri]: edits
129389
- }
129390
- };
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;
129391
129598
  }
129392
129599
  };
129393
129600
 
129394
129601
  // server/src/providers/semanticTokensProvider.ts
129395
- var import_node10 = __toESM(require_node3());
129602
+ var import_node12 = __toESM(require_node3());
129396
129603
  var OPERATOR_TOKENS = /* @__PURE__ */ new Set([
129397
129604
  SysMLv2Lexer.BANG_EQ_EQ,
129398
129605
  // !==
@@ -129533,7 +129740,7 @@ var SemanticTokensProvider = class {
129533
129740
  if (this.tokenCache && this.tokenCache.uri === uri && this.tokenCache.version === version) {
129534
129741
  return this.tokenCache.tokens;
129535
129742
  }
129536
- const builder = new import_node10.SemanticTokensBuilder();
129743
+ const builder = new import_node12.SemanticTokensBuilder();
129537
129744
  const result = this.documentManager.get(uri);
129538
129745
  if (!result) {
129539
129746
  return builder.build();
@@ -129613,7 +129820,7 @@ var SemanticTokensProvider = class {
129613
129820
  };
129614
129821
 
129615
129822
  // server/src/providers/semanticValidator.ts
129616
- var import_node11 = __toESM(require_node3());
129823
+ var import_node13 = __toESM(require_node3());
129617
129824
  var CONSTRAINT_KEYWORDS = /* @__PURE__ */ new Set([
129618
129825
  "and",
129619
129826
  "or",
@@ -129739,7 +129946,7 @@ var SemanticValidator = class _SemanticValidator {
129739
129946
  const { resolved, strippedTypeName: typeName } = resolveTypeName(symbol.typeName, symbol, this.namespaceResolver, indexes, libraryNames);
129740
129947
  if (resolved) return [];
129741
129948
  const isMandatory = symbol.multiplicityRange && symbol.multiplicityRange.lower >= 1;
129742
- const severity = isMandatory ? import_node11.DiagnosticSeverity.Error : import_node11.DiagnosticSeverity.Warning;
129949
+ const severity = isMandatory ? import_node13.DiagnosticSeverity.Error : import_node13.DiagnosticSeverity.Warning;
129743
129950
  let message = `Type '${typeName}' is not defined in the current document or standard library`;
129744
129951
  if (isMandatory) {
129745
129952
  const multStr = symbol.multiplicity ?? "1";
@@ -129765,7 +129972,7 @@ var SemanticValidator = class _SemanticValidator {
129765
129972
  const { lower, upper } = symbol.multiplicityRange;
129766
129973
  if (typeof upper === "number" && lower > upper) {
129767
129974
  return [{
129768
- severity: import_node11.DiagnosticSeverity.Error,
129975
+ severity: import_node13.DiagnosticSeverity.Error,
129769
129976
  range: symbol.selectionRange,
129770
129977
  message: `Invalid multiplicity [${symbol.multiplicity}]: lower bound (${lower}) exceeds upper bound (${upper})`,
129771
129978
  source: "sysml",
@@ -129774,7 +129981,7 @@ var SemanticValidator = class _SemanticValidator {
129774
129981
  }
129775
129982
  if (lower < 0) {
129776
129983
  return [{
129777
- severity: import_node11.DiagnosticSeverity.Error,
129984
+ severity: import_node13.DiagnosticSeverity.Error,
129778
129985
  range: symbol.selectionRange,
129779
129986
  message: `Invalid multiplicity [${symbol.multiplicity}]: lower bound cannot be negative`,
129780
129987
  source: "sysml",
@@ -129798,7 +130005,7 @@ var SemanticValidator = class _SemanticValidator {
129798
130005
  );
129799
130006
  if (!hasEnumValues) {
129800
130007
  return [{
129801
- severity: import_node11.DiagnosticSeverity.Information,
130008
+ severity: import_node13.DiagnosticSeverity.Information,
129802
130009
  range: symbol.selectionRange,
129803
130010
  message: `Enumeration '${displayName(symbol)}' has no enum values defined`,
129804
130011
  source: "sysml",
@@ -129818,7 +130025,7 @@ var SemanticValidator = class _SemanticValidator {
129818
130025
  const ch = symbol.name[0];
129819
130026
  if (ch === ch.toLowerCase() && ch !== ch.toUpperCase()) {
129820
130027
  return [{
129821
- severity: import_node11.DiagnosticSeverity.Hint,
130028
+ severity: import_node13.DiagnosticSeverity.Hint,
129822
130029
  range: symbol.selectionRange,
129823
130030
  message: `Definition '${symbol.name}' should use PascalCase`,
129824
130031
  source: "sysml",
@@ -129830,7 +130037,7 @@ var SemanticValidator = class _SemanticValidator {
129830
130037
  const ch = symbol.name[0];
129831
130038
  if (ch === ch.toUpperCase() && ch !== ch.toLowerCase()) {
129832
130039
  return [{
129833
- severity: import_node11.DiagnosticSeverity.Hint,
130040
+ severity: import_node13.DiagnosticSeverity.Hint,
129834
130041
  range: symbol.selectionRange,
129835
130042
  message: `Usage '${symbol.name}' should use camelCase`,
129836
130043
  source: "sysml",
@@ -129849,7 +130056,7 @@ var SemanticValidator = class _SemanticValidator {
129849
130056
  if (!isDefinition(symbol.kind)) return [];
129850
130057
  if (symbol.documentation) return [];
129851
130058
  return [{
129852
- severity: import_node11.DiagnosticSeverity.Information,
130059
+ severity: import_node13.DiagnosticSeverity.Information,
129853
130060
  range: symbol.selectionRange,
129854
130061
  message: `Definition '${displayName(symbol)}' has no documentation`,
129855
130062
  source: "sysml",
@@ -129868,23 +130075,23 @@ var SemanticValidator = class _SemanticValidator {
129868
130075
  );
129869
130076
  const defsInScope = targetUri ? defs.filter((def) => def.uri === targetUri) : defs;
129870
130077
  const referencedTypes = new Set(
129871
- 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)]))
129872
130079
  );
129873
130080
  for (const s of symbols) {
129874
130081
  if (s.exposeTargets) {
129875
130082
  for (const target of s.exposeTargets) {
129876
- const simpleName = target.replace(/::\*{1,2}$/, "").split("::").pop();
130083
+ const simpleName = splitQualifiedName(target.replace(/::\*{1,2}$/, "")).pop();
129877
130084
  if (simpleName) referencedTypes.add(simpleName);
129878
130085
  }
129879
130086
  }
129880
130087
  }
129881
130088
  const diagnostics = [];
129882
130089
  for (const def of defsInScope) {
129883
- const isReferenced = referencedTypes.has(def.name);
130090
+ const isReferenced = referencedTypes.has(def.name) || def.shortName !== void 0 && referencedTypes.has(def.shortName);
129884
130091
  const hasBaseType = (def.typeNames?.length ?? 0) > 0;
129885
130092
  if (!isReferenced && !hasBaseType) {
129886
130093
  diagnostics.push({
129887
- severity: import_node11.DiagnosticSeverity.Warning,
130094
+ severity: import_node13.DiagnosticSeverity.Warning,
129888
130095
  range: def.selectionRange,
129889
130096
  message: `Definition '${def.name}' is not referenced by any usage in the workspace`,
129890
130097
  source: "sysml",
@@ -129959,7 +130166,7 @@ var SemanticValidator = class _SemanticValidator {
129959
130166
  const cycle = this.followSpecializationChain(def.name, def.typeNames, visited, indexes);
129960
130167
  if (cycle) {
129961
130168
  diagnostics.push({
129962
- severity: import_node11.DiagnosticSeverity.Error,
130169
+ severity: import_node13.DiagnosticSeverity.Error,
129963
130170
  range: def.selectionRange,
129964
130171
  message: `Circular specialization: ${cycle.join(" :> ")} :> ${cycle[0]}`,
129965
130172
  source: "sysml",
@@ -130047,7 +130254,7 @@ var SemanticValidator = class _SemanticValidator {
130047
130254
  const isSatisfied = satisfiedNames.has(req.name) || req.qualifiedName !== void 0 && satisfiedNames.has(req.qualifiedName);
130048
130255
  if (!isSatisfied) {
130049
130256
  diagnostics.push({
130050
- severity: import_node11.DiagnosticSeverity.Warning,
130257
+ severity: import_node13.DiagnosticSeverity.Warning,
130051
130258
  range: req.selectionRange,
130052
130259
  message: `Requirement '${req.name}' is not satisfied by any element`,
130053
130260
  source: "sysml",
@@ -130184,7 +130391,7 @@ var SemanticValidator = class _SemanticValidator {
130184
130391
  if (!isVerified) {
130185
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>;`;
130186
130393
  diagnostics.push({
130187
- severity: import_node11.DiagnosticSeverity.Warning,
130394
+ severity: import_node13.DiagnosticSeverity.Warning,
130188
130395
  range: req.selectionRange,
130189
130396
  message,
130190
130397
  source: "sysml",
@@ -130244,7 +130451,7 @@ var SemanticValidator = class _SemanticValidator {
130244
130451
  const hasFilter = view.viewFilters && view.viewFilters.length > 0;
130245
130452
  if (!hasExpose && !hasFilter) {
130246
130453
  diagnostics.push({
130247
- severity: import_node11.DiagnosticSeverity.Information,
130454
+ severity: import_node13.DiagnosticSeverity.Information,
130248
130455
  range: view.selectionRange,
130249
130456
  message: `View '${view.name}' has no expose or filter directives \u2014 it will show all elements`,
130250
130457
  source: "sysml",
@@ -130284,7 +130491,7 @@ var SemanticValidator = class _SemanticValidator {
130284
130491
  const upperOk = baseUpper === "*" || curUpper !== "*" && curUpper <= baseUpper;
130285
130492
  if (lowerOk && upperOk) continue;
130286
130493
  diagnostics.push({
130287
- severity: import_node11.DiagnosticSeverity.Error,
130494
+ severity: import_node13.DiagnosticSeverity.Error,
130288
130495
  range: s.selectionRange,
130289
130496
  message: `Redefinition multiplicity [${s.multiplicity ?? "?"}] is incompatible with base '${base.name}' multiplicity [${base.multiplicity ?? "?"}]`,
130290
130497
  source: "sysml",
@@ -130306,14 +130513,15 @@ var SemanticValidator = class _SemanticValidator {
130306
130513
  if (!text) return [];
130307
130514
  const diagnostics = [];
130308
130515
  const lines = text.split("\n");
130309
- const re = /\bconnect\s+([A-Za-z_][\w.]*)\s+to\s+([A-Za-z_][\w.]*)/g;
130310
- let m2;
130311
- while ((m2 = re.exec(text)) !== null) {
130312
- const leftPath = m2[1].split(".");
130313
- const rightPath = m2[2].split(".");
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];
130314
130522
  const left = leftPath[leftPath.length - 1];
130315
130523
  const right = rightPath[rightPath.length - 1];
130316
- const scope = this.connectorScope(symbolsInUri, this.indexToRange(text, m2.index, 0).start, indexes);
130524
+ const scope = this.connectorScope(symbolsInUri, this.indexToRange(text, connect.start, 0).start, indexes);
130317
130525
  const lSym = this.resolveConnectorEnd(leftPath, scope, indexes);
130318
130526
  const rSym = this.resolveConnectorEnd(rightPath, scope, indexes);
130319
130527
  if (!lSym || !rSym) continue;
@@ -130323,10 +130531,10 @@ var SemanticValidator = class _SemanticValidator {
130323
130531
  if (lType === "~" + rType || rType === "~" + lType) continue;
130324
130532
  if (lType.startsWith("~") && lType.slice(1) === rType) continue;
130325
130533
  if (rType.startsWith("~") && rType.slice(1) === lType) continue;
130326
- const matchLine = text.substring(0, m2.index).split("\n").length - 1;
130534
+ const matchLine = text.substring(0, connect.start).split("\n").length - 1;
130327
130535
  let insideInterfaceDef = false;
130328
- for (let i = matchLine; i >= 0 && i >= matchLine - 30; i--) {
130329
- const line = (lines[i] || "").trim();
130536
+ for (let i2 = matchLine; i2 >= 0 && i2 >= matchLine - 30; i2--) {
130537
+ const line = (lines[i2] || "").trim();
130330
130538
  if (/\binterface\s+def\b/.test(line)) {
130331
130539
  insideInterfaceDef = true;
130332
130540
  break;
@@ -130334,7 +130542,7 @@ var SemanticValidator = class _SemanticValidator {
130334
130542
  if (/^\s*package\b/.test(line)) break;
130335
130543
  }
130336
130544
  if (insideInterfaceDef) continue;
130337
- 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);
130338
130546
  if (/\binterface\s+\w[\w']*(:\w[\w']*)?\s*$/m.test(precedingText)) continue;
130339
130547
  const lDefSyms = indexes.byName.get(lType) ?? [];
130340
130548
  const rDefSyms = indexes.byName.get(rType) ?? [];
@@ -130353,14 +130561,14 @@ var SemanticValidator = class _SemanticValidator {
130353
130561
  const hasSharedFeature = rChildren.some((c) => lChildNames.has(c.name));
130354
130562
  if (hasSharedFeature) continue;
130355
130563
  }
130356
- const range = this.indexToRange(text, m2.index, m2[0].length);
130564
+ const range = this.indexToRange(text, connect.start, rightEnd.end - connect.start);
130357
130565
  diagnostics.push({
130358
- severity: import_node11.DiagnosticSeverity.Warning,
130566
+ severity: import_node13.DiagnosticSeverity.Warning,
130359
130567
  range,
130360
130568
  message: `Port compatibility issue: '${left}' (${lType}) is connected to '${right}' (${rType})`,
130361
130569
  source: "sysml",
130362
130570
  code: "incompatible-port-types",
130363
- data: { uri }
130571
+ data: { uri, left, right, leftType: lType }
130364
130572
  });
130365
130573
  }
130366
130574
  return diagnostics;
@@ -130450,7 +130658,7 @@ var SemanticValidator = class _SemanticValidator {
130450
130658
  const startInBody = trimStart >= 0 ? trimStart : 0;
130451
130659
  const trimmedLen = Math.max(1, b.body.trim().length);
130452
130660
  diagnostics.push({
130453
- severity: import_node11.DiagnosticSeverity.Warning,
130661
+ severity: import_node13.DiagnosticSeverity.Warning,
130454
130662
  range: this.indexToRange(text, b.bodyOffset + startInBody, trimmedLen),
130455
130663
  message: "Invalid constraint body: expected expression, found documentation text",
130456
130664
  source: "sysml",
@@ -130463,15 +130671,11 @@ var SemanticValidator = class _SemanticValidator {
130463
130671
  if (!parent) continue;
130464
130672
  const parentMembers = this.getConstraintScopeMembers(parent, indexes);
130465
130673
  if (parentMembers.length === 0) continue;
130466
- const ignoredRanges = this.getIgnoredBodyRanges(b.body);
130467
- const idRe = /\b([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*)\b/g;
130468
- let im;
130469
- while ((im = idRe.exec(b.body)) !== null) {
130470
- if (this.isIndexInRanges(im.index, ignoredRanges)) continue;
130471
- const expr = im[1];
130674
+ for (const reference of scanFeaturePaths(b.body)) {
130675
+ const expr = reference.name;
130472
130676
  if (this.isConstraintKeyword(expr)) continue;
130473
130677
  if (/^\d/.test(expr)) continue;
130474
- const path3 = expr.split(".");
130678
+ const path3 = [...reference.parts];
130475
130679
  const ok = this.resolvePathFromParent(path3, parentMembers, indexes);
130476
130680
  if (ok) continue;
130477
130681
  if (path3.length === 1) {
@@ -130480,14 +130684,14 @@ var SemanticValidator = class _SemanticValidator {
130480
130684
  continue;
130481
130685
  }
130482
130686
  }
130483
- const absoluteStart = b.bodyOffset + im.index;
130687
+ const absoluteStart = b.bodyOffset + reference.start;
130484
130688
  diagnostics.push({
130485
- severity: import_node11.DiagnosticSeverity.Warning,
130486
- range: this.indexToRange(text, absoluteStart, expr.length),
130689
+ severity: import_node13.DiagnosticSeverity.Warning,
130690
+ range: this.indexToRange(text, absoluteStart, reference.end - reference.start),
130487
130691
  message: `Unresolved constraint reference '${expr}' in scope '${displayName(parent)}'`,
130488
130692
  source: "sysml",
130489
130693
  code: "unresolved-constraint-reference",
130490
- data: { uri }
130694
+ data: { uri, scopeName: parent.name }
130491
130695
  });
130492
130696
  }
130493
130697
  }
@@ -130681,25 +130885,6 @@ var SemanticValidator = class _SemanticValidator {
130681
130885
  isConstraintKeyword(value) {
130682
130886
  return CONSTRAINT_KEYWORDS.has(value);
130683
130887
  }
130684
- getIgnoredBodyRanges(body) {
130685
- const ranges = [];
130686
- const blockRe = /\/\*[\s\S]*?\*\//g;
130687
- let m2;
130688
- while ((m2 = blockRe.exec(body)) !== null) {
130689
- ranges.push({ start: m2.index, end: m2.index + m2[0].length });
130690
- }
130691
- const lineRe = /\/\/[^\n\r]*/g;
130692
- while ((m2 = lineRe.exec(body)) !== null) {
130693
- ranges.push({ start: m2.index, end: m2.index + m2[0].length });
130694
- }
130695
- return ranges;
130696
- }
130697
- isIndexInRanges(index2, ranges) {
130698
- for (const r of ranges) {
130699
- if (index2 >= r.start && index2 < r.end) return true;
130700
- }
130701
- return false;
130702
- }
130703
130888
  hasDocumentationOnlyConstraintBody(body) {
130704
130889
  const trimmed = body.trim();
130705
130890
  if (!trimmed) return false;
@@ -130797,7 +130982,7 @@ var SemanticValidator = class _SemanticValidator {
130797
130982
  if (defs.length > 1) {
130798
130983
  for (const def of defs) {
130799
130984
  diagnostics.push({
130800
- severity: import_node11.DiagnosticSeverity.Warning,
130985
+ severity: import_node13.DiagnosticSeverity.Warning,
130801
130986
  range: def.selectionRange,
130802
130987
  message: `Duplicate definition: '${name}' is defined ${defs.length} times in the same scope`,
130803
130988
  source: "sysml",
@@ -130839,7 +131024,7 @@ var SemanticValidator = class _SemanticValidator {
130839
131024
  if (!conflicting) continue;
130840
131025
  const others = otherDeclarations(conflicting, symbol);
130841
131026
  diagnostics.push({
130842
- severity: import_node11.DiagnosticSeverity.Error,
131027
+ severity: import_node13.DiagnosticSeverity.Error,
130843
131028
  range: symbol.selectionRange,
130844
131029
  message: `Ambiguous name '${symbol.name}': also declared as ${describeConflictingDeclarations(others, symbol.uri)}.`,
130845
131030
  source: "sysml",
@@ -130925,7 +131110,7 @@ function toFsPath(uri) {
130925
131110
  return void 0;
130926
131111
  }
130927
131112
  var connection = createServerConnection();
130928
- var documents = new import_node12.TextDocuments(TextDocument);
131113
+ var documents = new import_node14.TextDocuments(TextDocument);
130929
131114
  var serverStartTime = Date.now();
130930
131115
  var documentManager = new DocumentManager();
130931
131116
  var modelProvider = new SysMLModelProvider(documentManager);
@@ -131090,7 +131275,7 @@ connection.onInitialize((params) => {
131090
131275
  };
131091
131276
  const result = {
131092
131277
  capabilities: {
131093
- textDocumentSync: import_node12.TextDocumentSyncKind.Incremental,
131278
+ textDocumentSync: import_node14.TextDocumentSyncKind.Incremental,
131094
131279
  // Completion
131095
131280
  completionProvider: {
131096
131281
  resolveProvider: true,
@@ -131118,7 +131303,7 @@ connection.onInitialize((params) => {
131118
131303
  // Code actions (quick fixes)
131119
131304
  codeActionProvider: {
131120
131305
  codeActionKinds: [
131121
- import_node12.CodeActionKind.QuickFix
131306
+ import_node14.CodeActionKind.QuickFix
131122
131307
  ]
131123
131308
  },
131124
131309
  // Document formatting
@@ -131139,7 +131324,7 @@ connection.onInitialize((params) => {
131139
131324
  connection.onInitialized(async () => {
131140
131325
  if (hasConfigurationCapability) {
131141
131326
  connection.client.register(
131142
- import_node12.DidChangeConfigurationNotification.type,
131327
+ import_node14.DidChangeConfigurationNotification.type,
131143
131328
  void 0
131144
131329
  );
131145
131330
  }