@artel/artc 0.6.25281 → 0.6.25283

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.
Files changed (137) hide show
  1. package/build/Cli.js +3 -3
  2. package/build/api/Api.js +18 -16
  3. package/build/api/ApiNodeJS.js +3 -3
  4. package/build/api/ApiServices.js +1182 -979
  5. package/build/{chunk-TIWNEKIS.js → chunk-2Q4QKW7T.js} +9266 -8683
  6. package/build/{chunk-7OXU5662.js → chunk-7RAZAZE6.js} +3 -3
  7. package/build/{chunk-NVHCHE3R.js → chunk-MJ2ZVHII.js} +3 -3
  8. package/build/types/analysis/AccessedFunction.d.ts +4 -0
  9. package/build/types/analysis/Analyzer.d.ts +68 -109
  10. package/build/types/analysis/AutotypeCallExpressionMeaning.d.ts +5 -5
  11. package/build/types/analysis/BaseExpressionMeaning.d.ts +8 -18
  12. package/build/types/analysis/CallExpressionMeaning.d.ts +4 -9
  13. package/build/types/analysis/DereferenceExpressionMeaning.d.ts +3 -4
  14. package/build/types/analysis/IdentifierExpressionMeaning.d.ts +8 -16
  15. package/build/types/analysis/IndexedAccessExpressionMeaning.d.ts +4 -8
  16. package/build/types/analysis/MemberAccessExpressionMeaning.d.ts +8 -16
  17. package/build/types/analysis/NamedTypeResolver.d.ts +4 -4
  18. package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +4 -4
  19. package/build/types/analysis/NodeTypeUtils.d.ts +1 -1
  20. package/build/types/analysis/ObjectExpressionMeaning.d.ts +4 -9
  21. package/build/types/analysis/PackageMemberConflictsValidator.d.ts +1 -1
  22. package/build/types/analysis/ResolvedImplementationPackage.d.ts +48 -0
  23. package/build/types/analysis/SourceFileAnalyzer.d.ts +1 -0
  24. package/build/types/analysis/SubstitutedFunction.d.ts +3 -0
  25. package/build/types/analysis/TagMeaning.d.ts +4 -4
  26. package/build/types/analysis/UserDefinableBinaryOperatorResolver.d.ts +4 -3
  27. package/build/types/analysis/UserDefinableUnaryOperatorResolver.d.ts +4 -3
  28. package/build/types/analysis/Utils.d.ts +1 -0
  29. package/build/types/analysis/semantic-context/FieldWithInitializerSemanticContext.d.ts +4 -5
  30. package/build/types/analysis/semantic-context/SemanticContextBase.d.ts +4 -4
  31. package/build/types/analysis/semantic-context/SemanticContextValidatingNameConflicts.d.ts +4 -5
  32. package/build/types/analysis/semantic-context/SourceFileSemanticContext.d.ts +11 -7
  33. package/build/types/analysis/semantic-context/SubprogramSemanticContext.d.ts +4 -5
  34. package/build/types/analysis/semantic-context/TypeSemanticContext.d.ts +8 -8
  35. package/build/types/api/Api.d.ts +4 -5
  36. package/build/types/common/ArrayUtils.d.ts +3 -1
  37. package/build/types/common/Displayable.d.ts +4 -4
  38. package/build/types/common/FormatString.d.ts +1 -1
  39. package/build/types/common/HelperPhrases.d.ts +2 -1
  40. package/build/types/common/LocalizationHelper.d.ts +6 -4
  41. package/build/types/common/index.d.ts +3 -0
  42. package/build/types/diagnostic/DiagnosticCode.d.ts +248 -238
  43. package/build/types/diagnostic/DiagnosticData.d.ts +2 -2
  44. package/build/types/emitter/EntityMap.d.ts +1 -1
  45. package/build/types/emitter/IrBuilder.d.ts +3 -1
  46. package/build/types/emitter/IrFactory.d.ts +2 -2
  47. package/build/types/emitter/Transformer.d.ts +3 -3
  48. package/build/types/emitter/ir/Nodes.d.ts +17 -8
  49. package/build/types/emitter/ir/types.d.ts +2 -2
  50. package/build/types/entities/Entity.d.ts +0 -12
  51. package/build/types/entities/EntityLocalizationContext.d.ts +1 -2
  52. package/build/types/entities/IEntity.d.ts +2 -1
  53. package/build/types/entities/OperatorKind.d.ts +6 -3
  54. package/build/types/entities/{PackageMembers.d.ts → PackageEntityMembers.d.ts} +1 -1
  55. package/build/types/entities/TypeEntity.d.ts +4 -4
  56. package/build/types/entities/index.d.ts +1 -1
  57. package/build/types/entities/interfaces/AliasTypeEntity.d.ts +3 -8
  58. package/build/types/entities/interfaces/ConstructorEntity.d.ts +0 -4
  59. package/build/types/entities/interfaces/DereferenceOperatorEntity.d.ts +0 -4
  60. package/build/types/entities/interfaces/DestructorEntity.d.ts +0 -4
  61. package/build/types/entities/interfaces/FunctionEntity.d.ts +1 -8
  62. package/build/types/entities/interfaces/FunctionTypeEntity.d.ts +0 -8
  63. package/build/types/entities/interfaces/GetterEntity.d.ts +0 -4
  64. package/build/types/entities/interfaces/IndexerEntity.d.ts +0 -4
  65. package/build/types/entities/interfaces/OperatorEntity.d.ts +0 -4
  66. package/build/types/entities/interfaces/PackageAliasEntity.d.ts +0 -5
  67. package/build/types/entities/interfaces/PackageEntity.d.ts +2 -11
  68. package/build/types/entities/interfaces/SetterEntity.d.ts +0 -4
  69. package/build/types/entities/interfaces/StructuredTypeEntity.d.ts +0 -8
  70. package/build/types/entities/interfaces/TextTranslationEntity.d.ts +1 -0
  71. package/build/types/entities/interfaces/TypeExtensionEntity.d.ts +1 -7
  72. package/build/types/entities/interfaces/TypeParameterEntity.d.ts +0 -2
  73. package/build/types/entities/interfaces/VariableEntity.d.ts +2 -12
  74. package/build/types/entities/interfaces/VariantTypeEntity.d.ts +1 -8
  75. package/build/types/entities/intrinsic/IntrinsicFunctionTypeEntity.d.ts +3 -3
  76. package/build/types/entities/intrinsic/IntrinsicStructuredTypeEntity.d.ts +3 -3
  77. package/build/types/entities/intrinsic/IntrinsicTypeParameterEntity.d.ts +2 -4
  78. package/build/types/entities/source/SourceAliasTypeEntity.d.ts +1 -2
  79. package/build/types/entities/source/SourceFunctionTypeEntity.d.ts +1 -3
  80. package/build/types/entities/source/SourcePackageEntity.d.ts +1 -2
  81. package/build/types/entities/source/SourceStructuredTypeEntity.d.ts +1 -3
  82. package/build/types/entities/source/SourceTextTranslationEntity.d.ts +1 -0
  83. package/build/types/entities/source/SourceTypeExtensionEntity.d.ts +1 -2
  84. package/build/types/entities/source/SourceTypeParameterEntity.d.ts +1 -2
  85. package/build/types/entities/source/SourceVariableEntity.d.ts +2 -2
  86. package/build/types/entities/source/SourceVariantTypeEntity.d.ts +1 -3
  87. package/build/types/entities/translated/TranslatedAliasTypeEntity.d.ts +1 -3
  88. package/build/types/entities/translated/TranslatedFunctionTypeEntity.d.ts +1 -5
  89. package/build/types/entities/translated/TranslatedPackageEntity.d.ts +2 -3
  90. package/build/types/entities/translated/TranslatedStructuredTypeEntity.d.ts +1 -5
  91. package/build/types/entities/translated/TranslatedTypeExtensionEntity.d.ts +1 -3
  92. package/build/types/entities/translated/TranslatedTypeParameterEntity.d.ts +1 -3
  93. package/build/types/entities/translated/TranslatedVariantTypeEntity.d.ts +1 -5
  94. package/build/types/parser/KeywordDictionary.d.ts +10 -2
  95. package/build/types/parser/TokenKind.d.ts +46 -44
  96. package/build/types/services/CustomRequests.d.ts +24 -4
  97. package/build/types/services/DisplayService.d.ts +10 -3
  98. package/build/types/services/LanguageServer.d.ts +4 -3
  99. package/build/types/services/ScriptEditingService.d.ts +25 -0
  100. package/build/types/services/SourceFileItemsService.d.ts +1 -1
  101. package/build/types/services/Types.d.ts +6 -0
  102. package/build/types/services/source-generation/EntityToSyntax.d.ts +12 -0
  103. package/build/types/tree/BaseNode.d.ts +56 -2
  104. package/build/types/tree/KeywordFlags.d.ts +28 -0
  105. package/build/types/tree/KeywordKind.d.ts +3 -1
  106. package/build/types/tree/NodeKind.d.ts +1 -1
  107. package/build/types/tree/Nodes.d.ts +10 -24
  108. package/build/types/tree/NodesDebug.d.ts +9 -0
  109. package/build/types/tree/OperatorKind.d.ts +6 -3
  110. package/build/types/tree/SyntaxFactory.d.ts +31 -29
  111. package/build/types/tree/SyntaxToCode.d.ts +4 -1
  112. package/build/types/tree/TokenFlags.d.ts +15 -0
  113. package/build/types/tree/TokenKind.d.ts +63 -51
  114. package/build/types/tree/Utils.d.ts +2 -2
  115. package/build/types/tree/index.d.ts +2 -1
  116. package/build/types/ts-interop/Entities.d.ts +1 -11
  117. package/build/types/ts-interop/TsInteropContext.d.ts +1 -2
  118. package/build/types/types/AliasType.d.ts +1 -2
  119. package/build/types/types/FunctionType.d.ts +2 -3
  120. package/build/types/types/IntersectionType.d.ts +1 -2
  121. package/build/types/types/ParameterType.d.ts +1 -2
  122. package/build/types/types/StructuredType.d.ts +1 -2
  123. package/build/types/types/SubstitutionStubType.d.ts +21 -0
  124. package/build/types/types/Substitutions.d.ts +1 -1
  125. package/build/types/types/Type.d.ts +5 -7
  126. package/build/types/types/TypeFactory.d.ts +2 -1
  127. package/build/types/types/TypeMembers.d.ts +8 -8
  128. package/build/types/types/UnionType.d.ts +1 -2
  129. package/build/types/types/UnresolvedType.d.ts +0 -1
  130. package/build/types/types/VariantType.d.ts +1 -2
  131. package/build/types/types/index.d.ts +2 -1
  132. package/package.json +1 -1
  133. package/build/types/analysis/SourceFileMembers.d.ts +0 -29
  134. package/build/types/services/AssignFieldService.d.ts +0 -10
  135. package/build/types/services/DeleteBlockFromScriptService.d.ts +0 -6
  136. package/build/types/tree/Token.d.ts +0 -57
  137. /package/build/types/services/{ProjectItemsService.d.ts → WorkspaceItemsService.d.ts} +0 -0
@@ -155,8 +155,8 @@ import {
155
155
  Uri,
156
156
  VariableDeclaration_entity,
157
157
  VariableDeclaration_typeMember,
158
- VariantDeclaration,
159
158
  VariantTypeDeclarationBody,
159
+ VariantValueDeclaration,
160
160
  WellKnownDeclarationsLoadError,
161
161
  __async,
162
162
  __decorateClass,
@@ -188,7 +188,7 @@ import {
188
188
  unwrapParenthesizedExpressions,
189
189
  visitChildren,
190
190
  yieldTask
191
- } from "../chunk-TIWNEKIS.js";
191
+ } from "../chunk-2Q4QKW7T.js";
192
192
 
193
193
  // source/services/CustomRequests.ts
194
194
  import * as ls from "vscode-languageserver";
@@ -205,7 +205,9 @@ var customRequests = {
205
205
  deleteSourceFile: new CustomRequestType("artel/fs.deleteSourceFile"),
206
206
  getNodeRange: new CustomRequestType("artel/getNodeRange"),
207
207
  assignField: new CustomRequestType("artel/assignField"),
208
- deleteBlockFromScript: new CustomRequestType("artel/deleteBlockFromScript")
208
+ addBlocksToScript: new CustomRequestType("artel/addBlocksToScript"),
209
+ canDeleteBlocksFromScript: new CustomRequestType("artel/canDeleteBlocksFromScript"),
210
+ deleteBlocksFromScript: new CustomRequestType("artel/deleteBlocksFromScript")
209
211
  };
210
212
 
211
213
  // source/services/LanguageServer.ts
@@ -214,108 +216,6 @@ import * as ls3 from "vscode-languageserver";
214
216
  import { TextDocument } from "vscode-languageserver-textdocument";
215
217
  import { URI } from "vscode-uri";
216
218
 
217
- // source/services/Types.ts
218
- import * as ls2 from "vscode-languageserver";
219
- var SourceLocation = class {
220
- constructor(sourceFile, range) {
221
- this.sourceFile = sourceFile;
222
- this.range = range;
223
- }
224
- };
225
- function isCompletionItemData(value) {
226
- Debug.cast(value);
227
- return value instanceof Object && typeof value.cacheId === "number" && typeof value.indexInCache === "number";
228
- }
229
- function isCodeActionData(value) {
230
- Debug.cast(value);
231
- return value instanceof Object && typeof value.name === "string" && value.location instanceof Object && ls2.DocumentUri.is(value.location.uri) && ls2.Position.is(value.location.position) && "data" in value;
232
- }
233
- var SourceFileEdit = class {
234
- constructor(sourceFile, range, text) {
235
- this.sourceFile = sourceFile;
236
- this.range = range;
237
- this.text = text;
238
- }
239
- };
240
-
241
- // source/services/AssignFieldService.ts
242
- var AssignFieldService = class _AssignFieldService {
243
- static {
244
- this.receiverVariableName = new Name("el");
245
- }
246
- createEditWithAssignment(analyzer, sourceFile, subprogramDeclaration, fieldName, value) {
247
- const subprogramBlock = subprogramDeclaration.block;
248
- if (subprogramBlock === void 0) {
249
- return void 0;
250
- }
251
- const lastAssignmentStatement = this.findLastAssignmentToField(analyzer, subprogramBlock, fieldName);
252
- let result;
253
- if (lastAssignmentStatement !== void 0) {
254
- result = new SourceFileEdit(sourceFile, lastAssignmentStatement.right.rangeWithoutTrivia, value);
255
- } else {
256
- const assignmentText = `${_AssignFieldService.receiverVariableName.unescapedOriginal}.${fieldName} = ${value}`;
257
- if (subprogramBlock.expressionOrStatementList.kind === 93 /* StatementList */) {
258
- const lastStatement = subprogramBlock.expressionOrStatementList?.statements.last();
259
- let editRange;
260
- let indentationText;
261
- if (lastStatement !== void 0) {
262
- editRange = Range.empty(lastStatement.rangeWithoutTrivia.end);
263
- const statementStartCharacter = sourceFile.getPositionAt(lastStatement.rangeWithoutTrivia.start).character;
264
- indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(statementStartCharacter)}`;
265
- } else {
266
- const openBraceRange = subprogramBlock.openBraceToken.rangeWithoutTrivia;
267
- const closeBraceRange = subprogramBlock.closeBraceToken.rangeWithoutTrivia;
268
- const openBracePosition = sourceFile.getPositionAt(openBraceRange.start);
269
- const closeBracePosition = sourceFile.getPositionAt(closeBraceRange.start);
270
- if (openBracePosition.line !== closeBracePosition.line) {
271
- editRange = Range.empty(openBraceRange.end);
272
- indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(closeBracePosition.character + 2)}`;
273
- } else {
274
- editRange = Range.empty(openBraceRange.end);
275
- indentationText = " ";
276
- }
277
- }
278
- result = new SourceFileEdit(sourceFile, editRange, `${indentationText}${assignmentText}`);
279
- } else {
280
- const expressionStartCharacter = sourceFile.getPositionAt(subprogramBlock.expressionOrStatementList.rangeWithoutTrivia.start).character;
281
- const indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(expressionStartCharacter)}`;
282
- const editRange = Range.empty(subprogramBlock.expressionOrStatementList.rangeWithoutTrivia.end);
283
- result = new SourceFileEdit(sourceFile, editRange, `${indentationText}${assignmentText}`);
284
- }
285
- }
286
- return result;
287
- }
288
- findLastAssignmentToField(analyzer, block, fieldNameText) {
289
- if (block.expressionOrStatementList.kind !== 93 /* StatementList */) {
290
- return void 0;
291
- }
292
- const fieldName = new Name(fieldNameText);
293
- const statements = block.expressionOrStatementList.statements.toArray();
294
- for (let i = statements.length - 1; i >= 0; i--) {
295
- const statement = statements[i];
296
- if (statement.kind === 92 /* AssignmentStatement */) {
297
- const left = unwrapParenthesizedExpressions(statement.left);
298
- if (left.kind === 76 /* MemberAccessExpression */) {
299
- const memberAccessMeaning = analyzer.resolveMemberAccessExpression(left).meaning;
300
- if (memberAccessMeaning.kind === "instance-field-access" && memberAccessMeaning.field.getName().considerEqual(fieldName)) {
301
- const receiver = unwrapParenthesizedExpressions(left.expression);
302
- if (receiver.kind === 89 /* IdentifierExpression */) {
303
- const receiverMeaning = analyzer.resolveIdentifierExpression(receiver).meaning;
304
- if (receiverMeaning.kind === "variable-access" && receiverMeaning.variable.getName().considerEqual(_AssignFieldService.receiverVariableName)) {
305
- return statement;
306
- }
307
- }
308
- }
309
- }
310
- }
311
- }
312
- return void 0;
313
- }
314
- detectNewLine(text) {
315
- return text.includes("\r\n") ? "\r\n" : "\n";
316
- }
317
- };
318
-
319
219
  // source/tree/SyntaxFactory.ts
320
220
  var SyntaxFactory = class {
321
221
  static sourceFile(packageImportDirectives, declarations) {
@@ -336,8 +236,8 @@ var SyntaxFactory = class {
336
236
  let aliasIdentifier;
337
237
  let equalsToken;
338
238
  if (alias !== void 0) {
339
- aliasIdentifier = this.createIdentifier(alias);
340
- equalsToken = this.token(58 /* Equals */);
239
+ aliasIdentifier = this.identifier(alias);
240
+ equalsToken = this.token(64 /* Equals */);
341
241
  }
342
242
  const packageName = this.packageName(pathSegments);
343
243
  const packageImport = new PackageImport(aliasIdentifier, equalsToken, packageName, void 0);
@@ -345,17 +245,17 @@ var SyntaxFactory = class {
345
245
  return new SinglePackageImportDirective(importKeyword, packageImport, void 0);
346
246
  }
347
247
  static packageName(segments) {
348
- const segmentIdentifiers = segments.map((s) => this.createIdentifier(s));
349
- const packageNameParts = this.createTokenSeparatedElements(segmentIdentifiers, 27 /* Dot */);
248
+ const segmentIdentifiers = segments.map((s) => this.identifier(s));
249
+ const packageNameParts = this.createSeparatedElements(segmentIdentifiers, 28 /* Dot */);
350
250
  return new PackageName(packageNameParts, void 0);
351
251
  }
352
252
  static packageAliasTypeDeclaration(tags, modifiers, name, typeParameters, body) {
353
253
  const tagList = new TagList(tags, void 0);
354
254
  const modifierList = new ModifierList(modifiers, void 0);
355
255
  const typeKeyword = this.keyword(16 /* Type */);
356
- const nameIdentifier = this.createIdentifier(name);
256
+ const nameIdentifier = this.identifier(name);
357
257
  const typeParameterClause = this.createTypeParameterClause(typeParameters);
358
- const equalsToken = this.token(58 /* Equals */);
258
+ const equalsToken = this.token(64 /* Equals */);
359
259
  return new PackageAliasTypeDeclaration(
360
260
  tagList,
361
261
  modifierList,
@@ -378,9 +278,9 @@ var SyntaxFactory = class {
378
278
  return new PackageMemberGroupDeclaration(
379
279
  tagList,
380
280
  modifierList,
381
- this.token(44 /* OpenBrace */),
281
+ this.token(46 /* OpenBrace */),
382
282
  declarationList,
383
- this.token(21 /* CloseBrace */),
283
+ this.token(22 /* CloseBrace */),
384
284
  void 0
385
285
  );
386
286
  }
@@ -388,7 +288,7 @@ var SyntaxFactory = class {
388
288
  const tagList = new TagList(tags, void 0);
389
289
  const modifierList = new ModifierList(modifiers, void 0);
390
290
  const functionKeyword = this.keyword(12 /* Function */);
391
- const nameIdentifier = this.createIdentifier(name);
291
+ const nameIdentifier = this.identifier(name);
392
292
  const typeParameterClause = this.createTypeParameterClause(typeParameters);
393
293
  const parameterClause = this.parameterClause(parameters);
394
294
  const returnTypeAnnotation = this.createTypeAnnotation(returnTypeSpecifier);
@@ -408,9 +308,9 @@ var SyntaxFactory = class {
408
308
  const tagList = new TagList(tags, void 0);
409
309
  const modifierList = new ModifierList(modifiers, void 0);
410
310
  const typeKeyword = this.keyword(16 /* Type */);
411
- const nameIdentifier = this.createIdentifier(name);
311
+ const nameIdentifier = this.identifier(name);
412
312
  const typeParameterClause = this.createTypeParameterClause(typeParameters);
413
- const equalsToken = this.token(58 /* Equals */);
313
+ const equalsToken = this.token(64 /* Equals */);
414
314
  return new PackageFunctionTypeDeclaration(
415
315
  tagList,
416
316
  modifierList,
@@ -438,9 +338,9 @@ var SyntaxFactory = class {
438
338
  const tagList = new TagList(tags, void 0);
439
339
  const modifierList = new ModifierList(modifiers, void 0);
440
340
  const typeKeyword = this.keyword(16 /* Type */);
441
- const nameIdentifier = this.createIdentifier(name);
341
+ const nameIdentifier = this.identifier(name);
442
342
  const typeParameterClause = this.createTypeParameterClause(typeParameters);
443
- const equalsToken = this.token(58 /* Equals */);
343
+ const equalsToken = this.token(64 /* Equals */);
444
344
  return new PackageStructuredTypeDeclaration(
445
345
  tagList,
446
346
  modifierList,
@@ -454,7 +354,7 @@ var SyntaxFactory = class {
454
354
  }
455
355
  static structuredTypeDeclarationBody(structuredTypeKind, baseTypes, members) {
456
356
  const structuredTypeKindKeyword = this.keyword(structuredTypeKind);
457
- const baseTypeList = baseTypes !== void 0 && baseTypes.length > 0 ? new BaseTypeList(this.createTokenSeparatedElements(baseTypes, 25 /* Comma */), void 0) : void 0;
357
+ const baseTypeList = baseTypes !== void 0 && baseTypes.length > 0 ? new BaseTypeList(this.createSeparatedElements(baseTypes, 26 /* Comma */), void 0) : void 0;
458
358
  const memberBlock = this.typeMemberDeclarationBlock(members);
459
359
  return new StructuredTypeDeclarationBody(
460
360
  structuredTypeKindKeyword,
@@ -466,11 +366,11 @@ var SyntaxFactory = class {
466
366
  static packageVariableDeclaration(tags, modifiers, name, typeSpecifier, initializer) {
467
367
  const tagList = new TagList(tags, void 0);
468
368
  const modifierList = new ModifierList(modifiers, void 0);
469
- const nameIdentifier = this.createIdentifier(name);
369
+ const nameIdentifier = this.identifier(name);
470
370
  const typeAnnotation = this.createTypeAnnotation(typeSpecifier);
471
371
  let equalsToken;
472
372
  if (initializer !== void 0) {
473
- equalsToken = this.token(58 /* Equals */);
373
+ equalsToken = this.token(64 /* Equals */);
474
374
  }
475
375
  return new PackageVariableDeclaration(
476
376
  tagList,
@@ -486,7 +386,7 @@ var SyntaxFactory = class {
486
386
  const tagList = new TagList(tags, void 0);
487
387
  const modifierList = new ModifierList(modifiers, void 0);
488
388
  const getKeyword = this.keyword(58 /* Get */);
489
- const nameIdentifier = this.createIdentifier(name);
389
+ const nameIdentifier = this.identifier(name);
490
390
  const typeAnnotation = this.typeAnnotation(typeSpecifier);
491
391
  return new PackageVariableGetterDeclaration(
492
392
  tagList,
@@ -502,16 +402,16 @@ var SyntaxFactory = class {
502
402
  const tagList = new TagList(tags, void 0);
503
403
  const modifierList = new ModifierList(modifiers, void 0);
504
404
  const setKeyword = this.keyword(59 /* Set */);
505
- const nameIdentifier = this.createIdentifier(name);
405
+ const nameIdentifier = this.identifier(name);
506
406
  return new PackageVariableSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body, void 0);
507
407
  }
508
408
  static packageVariantTypeDeclaration(tags, modifiers, name, typeParameters, body) {
509
409
  const tagList = new TagList(tags, void 0);
510
410
  const modifierList = new ModifierList(modifiers, void 0);
511
411
  const typeKeyword = this.keyword(16 /* Type */);
512
- const nameIdentifier = this.createIdentifier(name);
412
+ const nameIdentifier = this.identifier(name);
513
413
  const typeParameterClause = this.createTypeParameterClause(typeParameters);
514
- const equalsToken = this.token(58 /* Equals */);
414
+ const equalsToken = this.token(64 /* Equals */);
515
415
  return new PackageVariantTypeDeclaration(
516
416
  tagList,
517
417
  modifierList,
@@ -531,11 +431,11 @@ var SyntaxFactory = class {
531
431
  static fieldDeclaration(tags, modifiers, name, typeSpecifier, initializer) {
532
432
  const tagList = new TagList(tags, void 0);
533
433
  const modifierList = new ModifierList(modifiers, void 0);
534
- const nameIdentifier = this.createIdentifier(name);
434
+ const nameIdentifier = this.identifier(name);
535
435
  const typeAnnotation = this.createTypeAnnotation(typeSpecifier);
536
436
  let equalsToken;
537
437
  if (initializer !== void 0) {
538
- equalsToken = this.token(58 /* Equals */);
438
+ equalsToken = this.token(64 /* Equals */);
539
439
  }
540
440
  return new FieldDeclaration(
541
441
  tagList,
@@ -551,7 +451,7 @@ var SyntaxFactory = class {
551
451
  const tagList = new TagList(tags, void 0);
552
452
  const modifierList = new ModifierList(modifiers, void 0);
553
453
  const getKeyword = this.keyword(58 /* Get */);
554
- const nameIdentifier = this.createIdentifier(name);
454
+ const nameIdentifier = this.identifier(name);
555
455
  const typeAnnotation = this.typeAnnotation(typeSpecifier);
556
456
  return new FieldGetterDeclaration(
557
457
  tagList,
@@ -567,14 +467,14 @@ var SyntaxFactory = class {
567
467
  const tagList = new TagList(tags, void 0);
568
468
  const modifierList = new ModifierList(modifiers, void 0);
569
469
  const setKeyword = this.keyword(59 /* Set */);
570
- const nameIdentifier = this.createIdentifier(name);
470
+ const nameIdentifier = this.identifier(name);
571
471
  return new FieldSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body, void 0);
572
472
  }
573
473
  static methodDeclaration(tags, modifiers, name, typeParameters, parameters, returnTypeSpecifier, body) {
574
474
  const tagList = new TagList(tags, void 0);
575
475
  const modifierList = new ModifierList(modifiers, void 0);
576
476
  const functionKeyword = this.keyword(12 /* Function */);
577
- const nameIdentifier = this.createIdentifier(name);
477
+ const nameIdentifier = this.identifier(name);
578
478
  const typeParameterClause = this.createTypeParameterClause(typeParameters);
579
479
  const parameterClause = this.parameterClause(parameters);
580
480
  const returnTypeAnnotation = this.createTypeAnnotation(returnTypeSpecifier);
@@ -635,42 +535,42 @@ var SyntaxFactory = class {
635
535
  }
636
536
  static typeMemberDeclarationBlock(members) {
637
537
  return new TypeMemberDeclarationBlock(
638
- this.token(44 /* OpenBrace */),
538
+ this.token(46 /* OpenBrace */),
639
539
  new TypeMemberDeclarationList(members, void 0),
640
- this.token(21 /* CloseBrace */),
540
+ this.token(22 /* CloseBrace */),
641
541
  void 0
642
542
  );
643
543
  }
644
- static variantDeclaration(tags, modifiers, name, value) {
544
+ static variantValueDeclaration(tags, modifiers, name, value) {
645
545
  const tagList = new TagList(tags, void 0);
646
546
  const modifierList = new ModifierList(modifiers, void 0);
647
- const nameIdentifier = this.createIdentifier(name);
547
+ const nameIdentifier = this.identifier(name);
648
548
  let equalsToken;
649
549
  if (value !== void 0) {
650
- equalsToken = this.token(58 /* Equals */);
550
+ equalsToken = this.token(64 /* Equals */);
651
551
  }
652
- return new VariantDeclaration(tagList, modifierList, nameIdentifier, equalsToken, value, void 0);
552
+ return new VariantValueDeclaration(tagList, modifierList, nameIdentifier, equalsToken, value, void 0);
653
553
  }
654
554
  static parameterClause(parameters) {
655
555
  return new ParameterClause(
656
- this.token(45 /* OpenParenthesis */),
657
- new ParameterList(this.createTokenSeparatedElements(parameters, 25 /* Comma */), void 0),
658
- this.token(22 /* CloseParenthesis */),
556
+ this.token(47 /* OpenParenthesis */),
557
+ new ParameterList(this.createSeparatedElements(parameters, 26 /* Comma */), void 0),
558
+ this.token(23 /* CloseParenthesis */),
659
559
  void 0
660
560
  );
661
561
  }
662
562
  static indexParameterClause(indexParameters) {
663
563
  return new IndexParameterClause(
664
- this.token(46 /* OpenSquareBracket */),
665
- new ParameterList(this.createTokenSeparatedElements(indexParameters, 25 /* Comma */), void 0),
666
- this.token(23 /* CloseSquareBracket */),
564
+ this.token(48 /* OpenSquareBracket */),
565
+ new ParameterList(this.createSeparatedElements(indexParameters, 26 /* Comma */), void 0),
566
+ this.token(24 /* CloseSquareBracket */),
667
567
  void 0
668
568
  );
669
569
  }
670
570
  static namedTypeSpecifier(name, typeArguments) {
671
- const qualifiedNameIdentifiers = typeof name === "string" ? [this.createIdentifier(name)] : name.map((s) => this.createIdentifier(s));
571
+ const qualifiedNameIdentifiers = typeof name === "string" || name instanceof Token ? [this.identifier(name)] : name.map((s) => this.identifier(s));
672
572
  const qualifiedName = new QualifiedName(
673
- this.createTokenSeparatedElements(qualifiedNameIdentifiers, 27 /* Dot */),
573
+ this.createSeparatedElements(qualifiedNameIdentifiers, 28 /* Dot */),
674
574
  void 0
675
575
  );
676
576
  let typeArgumentClause;
@@ -680,21 +580,21 @@ var SyntaxFactory = class {
680
580
  return new NamedTypeSpecifier(qualifiedName, typeArgumentClause, void 0);
681
581
  }
682
582
  static unionTypeSpecifier(typeSpecifiers) {
683
- return new UnionTypeSpecifier(this.createTokenSeparatedElements(typeSpecifiers, 18 /* Bar */), void 0);
583
+ return new UnionTypeSpecifier(this.createSeparatedElements(typeSpecifiers, 17 /* Bar */), void 0);
684
584
  }
685
585
  static intersectionTypeSpecifier(typeSpecifiers) {
686
- return new IntersectionTypeSpecifier(this.createTokenSeparatedElements(
586
+ return new IntersectionTypeSpecifier(this.createSeparatedElements(
687
587
  typeSpecifiers,
688
- 11 /* Ampersand */
588
+ 10 /* Ampersand */
689
589
  ), void 0);
690
590
  }
691
591
  static nullableTypeSpecifier(typeSpecifier) {
692
- const questionToken = this.token(50 /* Question */);
592
+ const questionToken = this.token(52 /* Question */);
693
593
  return new NullableTypeSpecifier(typeSpecifier, questionToken, void 0);
694
594
  }
695
595
  static parenthesizedTypeSpecifier(typeSpecifier) {
696
- const openParenthesisToken = this.token(45 /* OpenParenthesis */);
697
- const closeParenthesisToken = this.token(22 /* CloseParenthesis */);
596
+ const openParenthesisToken = this.token(47 /* OpenParenthesis */);
597
+ const closeParenthesisToken = this.token(23 /* CloseParenthesis */);
698
598
  return new ParenthesizedTypeSpecifier(openParenthesisToken, typeSpecifier, closeParenthesisToken, void 0);
699
599
  }
700
600
  static anonymousStructuredTypeSpecifier(body) {
@@ -707,14 +607,14 @@ var SyntaxFactory = class {
707
607
  return new AnonymousTypeSpecifier(new AnonymousVariantTypeDeclaration(body, void 0), void 0);
708
608
  }
709
609
  static typeParameterDeclaration(name, constraint, defaultType) {
710
- const nameIdentifier = this.createIdentifier(name);
610
+ const nameIdentifier = this.identifier(name);
711
611
  let colonToken;
712
612
  if (constraint !== void 0) {
713
- colonToken = this.token(24 /* Colon */);
613
+ colonToken = this.token(25 /* Colon */);
714
614
  }
715
615
  let equalsToken;
716
616
  if (defaultType !== void 0) {
717
- equalsToken = this.token(58 /* Equals */);
617
+ equalsToken = this.token(64 /* Equals */);
718
618
  }
719
619
  return new TypeParameterDeclaration(
720
620
  nameIdentifier,
@@ -727,19 +627,19 @@ var SyntaxFactory = class {
727
627
  }
728
628
  static parameterDeclaration(tags, name, typeSpecifier, defaultValue) {
729
629
  const tagList = new TagList(tags, void 0);
730
- const nameIdentifier = this.createIdentifier(name);
630
+ const nameIdentifier = this.identifier(name);
731
631
  const typeAnnotation = this.createTypeAnnotation(typeSpecifier);
732
632
  let equalsToken;
733
633
  if (defaultValue !== void 0) {
734
- equalsToken = this.token(58 /* Equals */);
634
+ equalsToken = this.token(64 /* Equals */);
735
635
  }
736
636
  return new ParameterDeclaration(tagList, nameIdentifier, typeAnnotation, equalsToken, defaultValue, void 0);
737
637
  }
738
638
  static tag(name, typeArguments, args) {
739
639
  const hashSignToken = this.token(36 /* HashSign */);
740
- const qualifiedNameIdentifiers = typeof name === "string" ? [this.createIdentifier(name)] : name.map((s) => this.createIdentifier(s));
640
+ const qualifiedNameIdentifiers = typeof name === "string" || name instanceof Token ? [this.identifier(name)] : name.map((s) => this.identifier(s));
741
641
  const qualifiedName = new QualifiedName(
742
- this.createTokenSeparatedElements(qualifiedNameIdentifiers, 27 /* Dot */),
642
+ this.createSeparatedElements(qualifiedNameIdentifiers, 28 /* Dot */),
743
643
  void 0
744
644
  );
745
645
  const typeArgumentClause = typeArguments !== void 0 ? this.typeArgumentClause(typeArguments) : void 0;
@@ -747,12 +647,12 @@ var SyntaxFactory = class {
747
647
  let argumentList;
748
648
  let closeParenthesisToken;
749
649
  if (args !== void 0) {
750
- openParenthesisToken = this.token(45 /* OpenParenthesis */);
650
+ openParenthesisToken = this.token(47 /* OpenParenthesis */);
751
651
  argumentList = new ArgumentList(
752
- this.createTokenSeparatedElements(args, 25 /* Comma */),
652
+ this.createSeparatedElements(args, 26 /* Comma */),
753
653
  void 0
754
654
  );
755
- closeParenthesisToken = this.token(22 /* CloseParenthesis */);
655
+ closeParenthesisToken = this.token(23 /* CloseParenthesis */);
756
656
  }
757
657
  return new Tag(
758
658
  hashSignToken,
@@ -765,44 +665,44 @@ var SyntaxFactory = class {
765
665
  );
766
666
  }
767
667
  static modifier(value, level) {
768
- const valueKeyword = this.keyword(value);
668
+ const valueKeyword = this.createKeyword(value, 1 /* Missing */ | 12296 /* SingularNeuAdjective */);
769
669
  let openParenthesisToken;
770
670
  let levelKeyword;
771
671
  let closeParenthesisToken;
772
672
  if (level !== void 0) {
773
- openParenthesisToken = this.token(45 /* OpenParenthesis */);
673
+ openParenthesisToken = this.token(47 /* OpenParenthesis */);
774
674
  levelKeyword = this.keyword(level);
775
- closeParenthesisToken = this.token(22 /* CloseParenthesis */);
675
+ closeParenthesisToken = this.token(23 /* CloseParenthesis */);
776
676
  }
777
677
  return new Modifier(valueKeyword, openParenthesisToken, levelKeyword, closeParenthesisToken, void 0);
778
678
  }
779
679
  static typeArgumentClause(typeArguments) {
780
680
  const lessThanToken = this.token(37 /* LessThan */);
781
681
  const typeArgumentList = new TypeArgumentList(
782
- this.createTokenSeparatedElements(typeArguments, 25 /* Comma */),
682
+ this.createSeparatedElements(typeArguments, 26 /* Comma */),
783
683
  void 0
784
684
  );
785
685
  const greaterThanToken = this.token(34 /* GreaterThan */);
786
686
  return new TypeArgumentClause(lessThanToken, typeArgumentList, greaterThanToken, void 0);
787
687
  }
788
688
  static typeAnnotation(typeSpecifier) {
789
- return new TypeAnnotation(this.token(24 /* Colon */), typeSpecifier, void 0);
689
+ return new TypeAnnotation(this.token(25 /* Colon */), typeSpecifier, void 0);
790
690
  }
791
691
  static statementBlock(statements) {
792
- const openBraceToken = this.token(44 /* OpenBrace */);
692
+ const openBraceToken = this.token(46 /* OpenBrace */);
793
693
  const statementList = new StatementList(statements, void 0);
794
- const closeBraceToken = this.token(21 /* CloseBrace */);
694
+ const closeBraceToken = this.token(22 /* CloseBrace */);
795
695
  return new StatementBlock(openBraceToken, statementList, closeBraceToken, void 0);
796
696
  }
797
697
  static functionExpressionBlock(expression) {
798
- const openBraceToken = this.token(44 /* OpenBrace */);
799
- const closeBraceToken = this.token(21 /* CloseBrace */);
698
+ const openBraceToken = this.token(46 /* OpenBrace */);
699
+ const closeBraceToken = this.token(22 /* CloseBrace */);
800
700
  return new FunctionBlock(openBraceToken, expression, closeBraceToken, void 0);
801
701
  }
802
702
  static functionStatementBlock(statements) {
803
- const openBraceToken = this.token(44 /* OpenBrace */);
703
+ const openBraceToken = this.token(46 /* OpenBrace */);
804
704
  const statementList = new StatementList(statements, void 0);
805
- const closeBraceToken = this.token(21 /* CloseBrace */);
705
+ const closeBraceToken = this.token(22 /* CloseBrace */);
806
706
  return new FunctionBlock(openBraceToken, statementList, closeBraceToken, void 0);
807
707
  }
808
708
  static nullLiteral() {
@@ -815,9 +715,9 @@ var SyntaxFactory = class {
815
715
  const tagList = new TagList([], void 0);
816
716
  const modifierList = new ModifierList([], void 0);
817
717
  const translationsKeyword = this.keyword(55 /* Translations */);
818
- const openBraceToken = this.token(44 /* OpenBrace */);
718
+ const openBraceToken = this.token(46 /* OpenBrace */);
819
719
  const translationList = new TopLevelTranslationList(translations, void 0);
820
- const closeBraceToken = this.token(21 /* CloseBrace */);
720
+ const closeBraceToken = this.token(22 /* CloseBrace */);
821
721
  return new TranslationsDeclaration(
822
722
  tagList,
823
723
  modifierList,
@@ -829,9 +729,9 @@ var SyntaxFactory = class {
829
729
  );
830
730
  }
831
731
  static packageVariableTranslation(sourceName, translatedName) {
832
- const sourceNameIdentifier = this.createIdentifier(sourceName);
833
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
834
- const translatedNameIdentifier = this.createIdentifier(translatedName);
732
+ const sourceNameIdentifier = this.identifier(sourceName);
733
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
734
+ const translatedNameIdentifier = this.identifier(translatedName);
835
735
  return new PackageVariableTranslationDeclaration(
836
736
  sourceNameIdentifier,
837
737
  minusGreaterThanToken,
@@ -841,11 +741,11 @@ var SyntaxFactory = class {
841
741
  }
842
742
  static packageFunctionTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
843
743
  const functionKeyword = this.keyword(12 /* Function */);
844
- const sourceNameIdentifier = this.createIdentifier(sourceName);
744
+ const sourceNameIdentifier = this.identifier(sourceName);
845
745
  const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
846
746
  const sourceParameterClause = this.translationParameterClause(sourceParameters);
847
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
848
- const translatedNameIdentifier = this.createIdentifier(translatedName);
747
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
748
+ const translatedNameIdentifier = this.identifier(translatedName);
849
749
  const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
850
750
  const translatedParameterClause = this.translationParameterClause(translatedParameters);
851
751
  return new PackageFunctionTranslationDeclaration(
@@ -862,18 +762,18 @@ var SyntaxFactory = class {
862
762
  }
863
763
  static typeTranslation(sourceName, sourceTypeParameters, translatedName, translatedTypeParameters, members) {
864
764
  const typeKeyword = this.keyword(16 /* Type */);
865
- const sourceNameIdentifier = this.createIdentifier(sourceName);
765
+ const sourceNameIdentifier = this.identifier(sourceName);
866
766
  const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
867
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
868
- const translatedNameIdentifier = this.createIdentifier(translatedName);
767
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
768
+ const translatedNameIdentifier = this.identifier(translatedName);
869
769
  const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
870
770
  let openBraceToken;
871
771
  let memberList;
872
772
  let closeBraceToken;
873
773
  if (members !== void 0) {
874
- openBraceToken = this.token(44 /* OpenBrace */);
774
+ openBraceToken = this.token(46 /* OpenBrace */);
875
775
  memberList = new TypeMemberTranslationList(members, void 0);
876
- closeBraceToken = this.token(21 /* CloseBrace */);
776
+ closeBraceToken = this.token(22 /* CloseBrace */);
877
777
  }
878
778
  return new TypeTranslationDeclaration(
879
779
  typeKeyword,
@@ -890,11 +790,11 @@ var SyntaxFactory = class {
890
790
  }
891
791
  static functionTypeTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
892
792
  const typeKeyword = this.keyword(16 /* Type */);
893
- const sourceNameIdentifier = this.createIdentifier(sourceName);
793
+ const sourceNameIdentifier = this.identifier(sourceName);
894
794
  const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
895
795
  const sourceParameterClause = this.translationParameterClause(sourceParameters);
896
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
897
- const translatedNameIdentifier = this.createIdentifier(translatedName);
796
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
797
+ const translatedNameIdentifier = this.identifier(translatedName);
898
798
  const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
899
799
  const translatedParameterClause = this.translationParameterClause(translatedParameters);
900
800
  return new FunctionTypeTranslationDeclaration(
@@ -910,9 +810,9 @@ var SyntaxFactory = class {
910
810
  );
911
811
  }
912
812
  static fieldOrVariantTranslation(sourceName, translatedName) {
913
- const sourceNameIdentifier = this.createIdentifier(sourceName);
914
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
915
- const translatedNameIdentifier = this.createIdentifier(translatedName);
813
+ const sourceNameIdentifier = this.identifier(sourceName);
814
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
815
+ const translatedNameIdentifier = this.identifier(translatedName);
916
816
  return new FieldOrVariantTranslation(
917
817
  sourceNameIdentifier,
918
818
  minusGreaterThanToken,
@@ -922,11 +822,11 @@ var SyntaxFactory = class {
922
822
  }
923
823
  static methodTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
924
824
  const functionKeyword = this.keyword(12 /* Function */);
925
- const sourceNameIdentifier = this.createIdentifier(sourceName);
825
+ const sourceNameIdentifier = this.identifier(sourceName);
926
826
  const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
927
827
  const sourceParameterClause = this.translationParameterClause(sourceParameters);
928
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
929
- const translatedNameIdentifier = this.createIdentifier(translatedName);
828
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
829
+ const translatedNameIdentifier = this.identifier(translatedName);
930
830
  const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
931
831
  const translatedParameterClause = this.translationParameterClause(translatedParameters);
932
832
  return new MethodTranslation(
@@ -944,7 +844,7 @@ var SyntaxFactory = class {
944
844
  static constructorTranslation(sourceParameters, translatedParameters) {
945
845
  const creationKeyword = this.keyword(31 /* Creation */);
946
846
  const sourceParameterClause = this.translationParameterClause(sourceParameters);
947
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
847
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
948
848
  const translatedParameterClause = this.translationParameterClause(translatedParameters);
949
849
  return new ConstructorTranslation(
950
850
  creationKeyword,
@@ -956,7 +856,7 @@ var SyntaxFactory = class {
956
856
  }
957
857
  static indexerTranslation(sourceParameters, translatedParameters) {
958
858
  const sourceParameterClause = this.indexParameterTranslationClause(sourceParameters);
959
- const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
859
+ const minusGreaterThanToken = this.token(45 /* MinusGreaterThan */);
960
860
  const translatedParameterClause = this.indexParameterTranslationClause(translatedParameters);
961
861
  return new IndexerTranslation(
962
862
  sourceParameterClause,
@@ -966,21 +866,21 @@ var SyntaxFactory = class {
966
866
  );
967
867
  }
968
868
  static translationParameterClause(parameters) {
969
- const openParenthesisToken = this.token(45 /* OpenParenthesis */);
869
+ const openParenthesisToken = this.token(47 /* OpenParenthesis */);
970
870
  const parameterList = new TranslationParameterList(
971
- this.createTokenSeparatedElements(parameters.map((p) => this.createIdentifier(p)), 25 /* Comma */),
871
+ this.createSeparatedElements(parameters.map((p) => this.identifier(p)), 26 /* Comma */),
972
872
  void 0
973
873
  );
974
- const closeParenthesisToken = this.token(22 /* CloseParenthesis */);
874
+ const closeParenthesisToken = this.token(23 /* CloseParenthesis */);
975
875
  return new TranslationParameterClause(openParenthesisToken, parameterList, closeParenthesisToken, void 0);
976
876
  }
977
877
  static indexParameterTranslationClause(parameters) {
978
- const openSquareBracketToken = this.token(46 /* OpenSquareBracket */);
878
+ const openSquareBracketToken = this.token(48 /* OpenSquareBracket */);
979
879
  const parameterList = new TranslationParameterList(
980
- this.createTokenSeparatedElements(parameters.map((p) => this.createIdentifier(p)), 25 /* Comma */),
880
+ this.createSeparatedElements(parameters.map((p) => this.identifier(p)), 26 /* Comma */),
981
881
  void 0
982
882
  );
983
- const closeSquareBracketToken = this.token(23 /* CloseSquareBracket */);
883
+ const closeSquareBracketToken = this.token(24 /* CloseSquareBracket */);
984
884
  return new IndexParameterTranslationClause(
985
885
  openSquareBracketToken,
986
886
  parameterList,
@@ -988,12 +888,24 @@ var SyntaxFactory = class {
988
888
  void 0
989
889
  );
990
890
  }
891
+ static identifier(value) {
892
+ if (typeof value === "string") {
893
+ return this.createToken(9 /* Identifier */, value, 0 /* None */);
894
+ }
895
+ return value;
896
+ }
991
897
  static token(kind, value) {
992
898
  const flags = value === void 0 ? 1 /* Missing */ : 0 /* None */;
993
- return new Token(kind, value ?? "", [], [], flags, void 0, void 0);
899
+ return this.createToken(kind, value ?? "", flags);
994
900
  }
995
901
  static keyword(kind) {
996
- return new Keyword([], kind, true, void 0);
902
+ return this.createKeyword(kind, 1 /* Missing */);
903
+ }
904
+ static createToken(kind, value, flags) {
905
+ return new Token(kind, value, [], [], flags, void 0, void 0);
906
+ }
907
+ static createKeyword(kind, flags) {
908
+ return new Keyword([], kind, flags, void 0);
997
909
  }
998
910
  static createTypeParameterClause(typeParameters) {
999
911
  if (typeParameters === void 0) {
@@ -1001,7 +913,7 @@ var SyntaxFactory = class {
1001
913
  }
1002
914
  return new TypeParameterClause(
1003
915
  this.token(37 /* LessThan */),
1004
- new TypeParameterList(this.createTokenSeparatedElements(typeParameters, 25 /* Comma */), void 0),
916
+ new TypeParameterList(this.createSeparatedElements(typeParameters, 26 /* Comma */), void 0),
1005
917
  this.token(34 /* GreaterThan */),
1006
918
  void 0
1007
919
  );
@@ -1013,7 +925,7 @@ var SyntaxFactory = class {
1013
925
  return new TranslationTypeParameterClause(
1014
926
  this.token(37 /* LessThan */),
1015
927
  new TranslationTypeParameterList(
1016
- this.createTokenSeparatedElements(typeParameters.map((p) => this.createIdentifier(p)), 25 /* Comma */),
928
+ this.createSeparatedElements(typeParameters.map((p) => this.identifier(p)), 26 /* Comma */),
1017
929
  void 0
1018
930
  ),
1019
931
  this.token(34 /* GreaterThan */),
@@ -1024,19 +936,13 @@ var SyntaxFactory = class {
1024
936
  if (typeSpecifier === void 0) {
1025
937
  return void 0;
1026
938
  }
1027
- return new TypeAnnotation(this.token(24 /* Colon */), typeSpecifier, void 0);
1028
- }
1029
- static createIdentifier(value) {
1030
- if (typeof value === "string") {
1031
- return new Token(10 /* Identifier */, value, [], [], 0 /* None */, void 0, void 0);
1032
- }
1033
- return value;
939
+ return new TypeAnnotation(this.token(25 /* Colon */), typeSpecifier, void 0);
1034
940
  }
1035
- static createTokenSeparatedElements(elements, tokenKind) {
941
+ static createSeparatedElements(elements, separator) {
1036
942
  const result = new Array();
1037
943
  for (let i = 0; i < elements.length; i++) {
1038
944
  if (i > 0) {
1039
- const token = this.token(tokenKind);
945
+ const token = this.token(separator);
1040
946
  result.push(token);
1041
947
  }
1042
948
  result.push(elements[i]);
@@ -1054,6 +960,7 @@ var SyntaxToCode = class _SyntaxToCode {
1054
960
  this.node = node;
1055
961
  this.newLine = options7?.newLine ?? "\n";
1056
962
  this.indentationStep = options7?.indentationStep ?? " ";
963
+ this.modifiersOnSeparateLine = options7?.modifiersOnSeparateLine ?? false;
1057
964
  this.keywordsLocale = options7?.keywordsLocale ?? 1 /* Ru */;
1058
965
  this.keywordsDialect = options7?.keywordsDialect ?? DefaultDialect;
1059
966
  this.singleWordKeywordValues = Query.from(getOrCreateKeywordDictionary(this.keywordsLocale, this.keywordsDialect).values()).mapAndFilter((k) => k.keywordKind !== 0 /* Unknown */ ? k.value : void 0).uniqueToSet();
@@ -1220,7 +1127,7 @@ var SyntaxToCode = class _SyntaxToCode {
1220
1127
  }
1221
1128
  writePackageMemberGroupDeclaration(node) {
1222
1129
  this.writeDeclarationTags(node.tagList);
1223
- this.writeDeclarationModifiers(node.modifierList);
1130
+ this.writeDeclarationModifiers(node.modifierList, true);
1224
1131
  this.writeToken(node.openBraceToken);
1225
1132
  this.writeNewLineOrWhitespace();
1226
1133
  if (node.declarationList.elements.length > 0) {
@@ -1414,7 +1321,7 @@ var SyntaxToCode = class _SyntaxToCode {
1414
1321
  this.writeDeclarationBody(node.block);
1415
1322
  }
1416
1323
  }
1417
- writeVariantDeclaration(node) {
1324
+ writeVariantValueDeclaration(node) {
1418
1325
  this.writeDeclarationTags(node.tagList);
1419
1326
  this.writeDeclarationModifiers(node.modifierList);
1420
1327
  this.writeToken(node.name);
@@ -1427,7 +1334,7 @@ var SyntaxToCode = class _SyntaxToCode {
1427
1334
  }
1428
1335
  writeTypeMemberGroupDeclaration(node) {
1429
1336
  this.writeDeclarationTags(node.tagList);
1430
- this.writeDeclarationModifiers(node.modifierList);
1337
+ this.writeDeclarationModifiers(node.modifierList, true);
1431
1338
  this.writeTypeMemberDeclarationBlock(node.memberBlock, false);
1432
1339
  }
1433
1340
  writeTypeParameterClause(node) {
@@ -1493,12 +1400,16 @@ var SyntaxToCode = class _SyntaxToCode {
1493
1400
  this.writeToken(node.closeParenthesisToken);
1494
1401
  }
1495
1402
  }
1496
- writeDeclarationModifiers(modifierList) {
1403
+ writeDeclarationModifiers(modifierList, isGroupDeclarationModifiers = false) {
1497
1404
  if (modifierList.modifiers.length > 0) {
1498
1405
  const modifiers = Array.from(modifierList.modifiers);
1499
1406
  modifiers.sort((m1, m2) => modifierSortOrder[m1.value.keywordKind] - modifierSortOrder[m2.value.keywordKind]);
1500
1407
  this.writeWhitespaceSeparatedList(modifiers, (n) => this.writeModifier(n));
1501
- this.writeNewLineOrWhitespace();
1408
+ if (isGroupDeclarationModifiers === true || this.modifiersOnSeparateLine) {
1409
+ this.writeNewLineOrWhitespace();
1410
+ } else {
1411
+ this.writeWhitespace();
1412
+ }
1502
1413
  }
1503
1414
  }
1504
1415
  writeModifier(node) {
@@ -1875,7 +1786,7 @@ var SyntaxToCode = class _SyntaxToCode {
1875
1786
  let isPreviousElementSemicolon = false;
1876
1787
  for (let i = 0; i < elements.length; i++) {
1877
1788
  const element = elements[i];
1878
- if (element.kind === 0 /* Token */ && element.tokenKind === 52 /* Semicolon */) {
1789
+ if (element.kind === 0 /* Token */ && element.tokenKind === 58 /* Semicolon */) {
1879
1790
  this.writeToken(element);
1880
1791
  isPreviousElementSemicolon = true;
1881
1792
  } else {
@@ -1893,7 +1804,7 @@ var SyntaxToCode = class _SyntaxToCode {
1893
1804
  writeCommaSeparatedList(elements, writeNonCommaElement) {
1894
1805
  for (let i = 0; i < elements.length; i++) {
1895
1806
  const element = elements[i];
1896
- if (element.kind === 0 /* Token */ && element.tokenKind === 25 /* Comma */) {
1807
+ if (element.kind === 0 /* Token */ && element.tokenKind === 26 /* Comma */) {
1897
1808
  this.writeToken(element);
1898
1809
  } else {
1899
1810
  if (i > 0) {
@@ -1905,10 +1816,17 @@ var SyntaxToCode = class _SyntaxToCode {
1905
1816
  }
1906
1817
  writeKeyword(keyword) {
1907
1818
  if (keyword.isMissing) {
1908
- this.writeCode(LocalizationHelper.localizeKeywordAndTakeFirst(
1819
+ let preferredFlags;
1820
+ if (keyword.parent.kind === 154 /* Modifier */) {
1821
+ preferredFlags = this.getModifierPreferredFlags(keyword.parent);
1822
+ } else {
1823
+ preferredFlags = 12290 /* SingularNeuNoun */;
1824
+ }
1825
+ this.writeCode(LocalizationHelper.localizeKeywordAndTakeBest(
1909
1826
  keyword.keywordKind,
1910
1827
  this.keywordsLocale,
1911
- this.keywordsDialect
1828
+ this.keywordsDialect,
1829
+ preferredFlags
1912
1830
  ));
1913
1831
  } else {
1914
1832
  for (let i = 0; i < keyword.tokens.length; i++) {
@@ -1919,12 +1837,51 @@ var SyntaxToCode = class _SyntaxToCode {
1919
1837
  }
1920
1838
  }
1921
1839
  }
1840
+ getModifierPreferredFlags(modifier) {
1841
+ const modifierTarget = modifier.parent.parent;
1842
+ switch (modifierTarget.kind) {
1843
+ case 25 /* PackageFunctionDeclaration */:
1844
+ case 35 /* PackageVariableSetterDeclaration */:
1845
+ case 54 /* FieldSetterDeclaration */:
1846
+ case 46 /* IndexedElementSetterDeclaration */:
1847
+ case 49 /* DereferencedVariableSetterDeclaration */:
1848
+ case 50 /* MethodDeclaration */:
1849
+ case 51 /* OperatorDeclaration */:
1850
+ case 24 /* PackageEntryPointDeclaration */:
1851
+ return 10242 /* SingularFemNoun */;
1852
+ case 20 /* PackageAliasTypeDeclaration */:
1853
+ case 31 /* PackageStructuredTypeDeclaration */:
1854
+ case 36 /* PackageVariantTypeDeclaration */:
1855
+ case 26 /* PackageFunctionTypeDeclaration */:
1856
+ return 9218 /* SingularMasNoun */;
1857
+ case 33 /* PackageVariableDeclaration */:
1858
+ case 34 /* PackageVariableGetterDeclaration */:
1859
+ case 38 /* TypeExtensionDeclaration */:
1860
+ case 23 /* PackageConstructorDeclaration */:
1861
+ case 43 /* ConstructorDeclaration */:
1862
+ case 44 /* DestructorDeclaration */:
1863
+ case 45 /* IndexedElementGetterDeclaration */:
1864
+ case 48 /* DereferencedVariableGetterDeclaration */:
1865
+ case 52 /* FieldDeclaration */:
1866
+ case 53 /* FieldGetterDeclaration */:
1867
+ case 147 /* VariantValueDeclaration */:
1868
+ case 41 /* MissingPackageMemberDeclaration */:
1869
+ case 55 /* MissingTypeMemberDeclaration */:
1870
+ return 12290 /* SingularNeuNoun */;
1871
+ case 42 /* TypeMemberGroupDeclaration */:
1872
+ case 22 /* PackageMemberGroupDeclaration */:
1873
+ case 123 /* TranslationsDeclaration */:
1874
+ return 16386 /* PluralNoun */;
1875
+ default:
1876
+ Debug.never(modifierTarget);
1877
+ }
1878
+ }
1922
1879
  writeToken(token) {
1923
1880
  if ((token.flags & 1 /* Missing */) !== 0) {
1924
1881
  this.writeCode(tokenKindValues[token.tokenKind]);
1925
1882
  } else {
1926
1883
  let value = token.value;
1927
- if (token.tokenKind === 10 /* Identifier */) {
1884
+ if (token.tokenKind === 9 /* Identifier */) {
1928
1885
  if (value.startsWith("'") && value.endsWith("'")) {
1929
1886
  value = `'${this.escapeLiteralIdentifier(value.substring(1, value.length - 1))}'`;
1930
1887
  } else if (this.singleWordKeywordValues.has(value)) {
@@ -2022,7 +1979,7 @@ var SyntaxToCode = class _SyntaxToCode {
2022
1979
  [94 /* StatementBlock */]: this.prototype.writeStatementBlock,
2023
1980
  [95 /* FunctionBlock */]: this.prototype.writeFunctionBlock,
2024
1981
  [135 /* QualifiedName */]: this.prototype.writeQualifiedName,
2025
- [147 /* VariantDeclaration */]: this.prototype.writeVariantDeclaration,
1982
+ [147 /* VariantValueDeclaration */]: this.prototype.writeVariantValueDeclaration,
2026
1983
  [148 /* TypeParameterDeclaration */]: this.prototype.writeTypeParameterDeclaration,
2027
1984
  [149 /* ParameterDeclaration */]: this.prototype.writeParameterDeclaration,
2028
1985
  [150 /* Argument */]: this.prototype.writeArgument,
@@ -2287,7 +2244,7 @@ var TokenOrKeywordsTouchingOffset_two = class {
2287
2244
  this.kind = "two";
2288
2245
  }
2289
2246
  getSinglePrioritizingNamed() {
2290
- if (this.left.isToken(10 /* Identifier */) || this.left.isKeyword()) {
2247
+ if (this.left.isToken(9 /* Identifier */) || this.left.isKeyword()) {
2291
2248
  return this.left;
2292
2249
  }
2293
2250
  return this.right;
@@ -2306,6 +2263,36 @@ function getTriviaAtOffset(sourceFile, offset) {
2306
2263
  return token?.getTriviaAt(offset);
2307
2264
  }
2308
2265
 
2266
+ // source/services/Types.ts
2267
+ import * as ls2 from "vscode-languageserver";
2268
+ var SourceLocation = class {
2269
+ constructor(sourceFile, range) {
2270
+ this.sourceFile = sourceFile;
2271
+ this.range = range;
2272
+ }
2273
+ };
2274
+ function isCompletionItemData(value) {
2275
+ Debug.cast(value);
2276
+ return value instanceof Object && typeof value.cacheId === "number" && typeof value.indexInCache === "number";
2277
+ }
2278
+ function isCodeActionData(value) {
2279
+ Debug.cast(value);
2280
+ return value instanceof Object && typeof value.name === "string" && value.location instanceof Object && ls2.DocumentUri.is(value.location.uri) && ls2.Position.is(value.location.position) && "data" in value;
2281
+ }
2282
+ var SourceFileEdit = class {
2283
+ constructor(sourceFile, range, text) {
2284
+ this.sourceFile = sourceFile;
2285
+ this.range = range;
2286
+ this.text = text;
2287
+ }
2288
+ };
2289
+ var NodeLocation = class {
2290
+ constructor(sourceFile, path) {
2291
+ this.sourceFile = sourceFile;
2292
+ this.path = path;
2293
+ }
2294
+ };
2295
+
2309
2296
  // source/services/TranslationsGenerationService.ts
2310
2297
  var TranslationsGenerationService = class {
2311
2298
  generateMissingTranslations(analyzer, sourceFile, offset, onlyTypeMembers) {
@@ -2317,7 +2304,7 @@ var TranslationsGenerationService = class {
2317
2304
  return void 0;
2318
2305
  }
2319
2306
  let result;
2320
- if (tokenOrKeyword.isToken(10 /* Identifier */) && tokenOrKeyword.parent.kind === 139 /* TypeTranslationDeclaration */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
2307
+ if (tokenOrKeyword.isToken(9 /* Identifier */) && tokenOrKeyword.parent.kind === 139 /* TypeTranslationDeclaration */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
2321
2308
  const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
2322
2309
  if (translationPackage !== void 0) {
2323
2310
  const generator = new TranslationsGenerator(
@@ -2687,7 +2674,7 @@ var CodeActionsService = class {
2687
2674
  }
2688
2675
  const result = new Array();
2689
2676
  const diagnosticCodeSet = new Set(diagnosticCodes);
2690
- if (diagnosticCodeSet.has(288 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(289 /* TheFollowingDeclarationsAreNotTranslated0And1More */)) {
2677
+ if (diagnosticCodeSet.has(2087 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(2088 /* TheFollowingDeclarationsAreNotTranslated0And1More */)) {
2691
2678
  const data = { onlyTypeMembers: false };
2692
2679
  result.push(CodeAction.unresolved(
2693
2680
  "\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043D\u0435\u0434\u043E\u0441\u0442\u0430\u044E\u0449\u0438\u0435 \u043F\u0435\u0440\u0435\u0432\u043E\u0434\u044B.",
@@ -2799,7 +2786,7 @@ var SignatureForNode = class _SignatureForNode {
2799
2786
  }
2800
2787
  }
2801
2788
  static getSignaturesForCallExpression(analyzer, node) {
2802
- const meaning = analyzer.resolveCallExpression(node).meaning;
2789
+ const meaning = analyzer.resolveCallExpression(node);
2803
2790
  switch (meaning.kind) {
2804
2791
  case "function-call": {
2805
2792
  let suitableSignatureIndex;
@@ -2890,7 +2877,7 @@ var SignatureForNode = class _SignatureForNode {
2890
2877
  return void 0;
2891
2878
  }
2892
2879
  static getSignaturesForIndexedAccessExpression(analyzer, node) {
2893
- const meaning = analyzer.resolveIndexedAccessExpression(node).meaning;
2880
+ const meaning = analyzer.resolveIndexedAccessExpression(node);
2894
2881
  switch (meaning.kind) {
2895
2882
  case "resolved": {
2896
2883
  let suitableSignatureIndex;
@@ -3179,7 +3166,7 @@ var CompletionService = class {
3179
3166
  }
3180
3167
  createPositionDescription(sourceFile, offset) {
3181
3168
  let token = getPrecedingToken(sourceFile, offset);
3182
- if (token?.tokenKind === 10 /* Identifier */ && offset === token.rangeWithoutTrivia.end) {
3169
+ if (token?.tokenKind === 9 /* Identifier */ && offset === token.rangeWithoutTrivia.end) {
3183
3170
  token = getPrecedingToken(sourceFile, offset - 1);
3184
3171
  }
3185
3172
  let result;
@@ -3203,7 +3190,7 @@ var CompletionService = class {
3203
3190
  if (positionDescription.kind !== "after-token-or-keyword") {
3204
3191
  return { kind: "none" };
3205
3192
  }
3206
- if (syntaxContext.isInComment || syntaxContext.isInStringOrChar) {
3193
+ if (syntaxContext.isInComment || syntaxContext.isInText) {
3207
3194
  return { kind: "none" };
3208
3195
  }
3209
3196
  if (syntaxContext.isInQuotedIdentifier !== void 0 && (syntaxContext.isInQuotedIdentifier.parent.kind === 51 /* OperatorDeclaration */ || syntaxContext.isInQuotedIdentifier.parent.kind === 50 /* MethodDeclaration */)) {
@@ -3213,18 +3200,18 @@ var CompletionService = class {
3213
3200
  if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind === 5 /* SinglePackageImportDirective */) {
3214
3201
  return new PackageImportCompletionContext([], void 0);
3215
3202
  }
3216
- if (tokenOrKeyword.isToken(58 /* Equals */) && tokenOrKeyword.parent.kind === 8 /* PackageImport */) {
3203
+ if (tokenOrKeyword.isToken(64 /* Equals */) && tokenOrKeyword.parent.kind === 8 /* PackageImport */) {
3217
3204
  return new PackageImportCompletionContext([], void 0);
3218
3205
  }
3219
- if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 9 /* PackageName */) {
3206
+ if (tokenOrKeyword.isToken(28 /* Dot */) && tokenOrKeyword.parent.kind === 9 /* PackageName */) {
3220
3207
  const packageImport = tokenOrKeyword.parent.parent;
3221
3208
  const precedingSegmentNames = packageImport.packageName.segments.takeWhile((s) => s.rangeWithTrivia.start < tokenOrKeyword.value.rangeWithTrivia.start).map((p) => this.analyzer.createNameFromIdentifier(p)).toArray();
3222
3209
  return new PackageImportCompletionContext(precedingSegmentNames, void 0);
3223
3210
  }
3224
- if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || this.tokenOrKeywordIsPackageImportListChild(tokenOrKeyword)) {
3211
+ if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || this.tokenOrKeywordIsPackageImportListChild(tokenOrKeyword)) {
3225
3212
  return new PackageImportCompletionContext([], void 0);
3226
3213
  }
3227
- if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 76 /* MemberAccessExpression */) {
3214
+ if (tokenOrKeyword.isToken(28 /* Dot */) && tokenOrKeyword.parent.kind === 76 /* MemberAccessExpression */) {
3228
3215
  const memberAccess = tokenOrKeyword.parent;
3229
3216
  {
3230
3217
  const packageTreeNode = this.analyzer.getDenotedPackageNameTreeNode(memberAccess.expression);
@@ -3254,7 +3241,7 @@ var CompletionService = class {
3254
3241
  const hidingMatcher = semanticContext.getHidingMatcher();
3255
3242
  return new TypeMemberCompletionContext(type, isStaticAccess, hidingMatcher, semanticContext);
3256
3243
  }
3257
- if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 135 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
3244
+ if (tokenOrKeyword.isToken(28 /* Dot */) && tokenOrKeyword.parent.kind === 135 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
3258
3245
  const namedTypeSpecifier = tokenOrKeyword.parent.parent;
3259
3246
  const resolutionResult = this.analyzer.resolveNamedTypeSpecifier(namedTypeSpecifier);
3260
3247
  const segmentIndex = Math.floor(
@@ -3293,7 +3280,7 @@ var CompletionService = class {
3293
3280
  }
3294
3281
  return { kind: "none" };
3295
3282
  }
3296
- if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 135 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 152 /* Tag */) {
3283
+ if (tokenOrKeyword.isToken(28 /* Dot */) && tokenOrKeyword.parent.kind === 135 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 152 /* Tag */) {
3297
3284
  const tag = tokenOrKeyword.parent.parent;
3298
3285
  const resolutionResult = this.analyzer.resolveTag(tag);
3299
3286
  const segmentIndex = Math.floor(
@@ -3590,7 +3577,7 @@ var CompletionService = class {
3590
3577
  return result;
3591
3578
  }
3592
3579
  getKeywordCompletionItemInfos(syntaxContext, semanticContext, positionDescription) {
3593
- if (syntaxContext.isInComment || syntaxContext.isInStringOrChar) {
3580
+ if (syntaxContext.isInComment || syntaxContext.isInText) {
3594
3581
  return [];
3595
3582
  }
3596
3583
  const kinds = /* @__PURE__ */ new Set();
@@ -3654,48 +3641,48 @@ var CompletionService = class {
3654
3641
  if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(40 /* Async */) && (positionDescription.tokenOrKeyword.parent.kind === 56 /* NestedFunctionDeclaration */ || positionDescription.tokenOrKeyword.parent.kind === 65 /* FunctionLiteral */ || positionDescription.tokenOrKeyword.parent.kind === 27 /* FunctionTypeDeclarationBody */)) {
3655
3642
  kinds.add(12 /* Function */);
3656
3643
  }
3657
- return Query.from(kinds.values()).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))).flatMap((i) => i).toArray();
3644
+ return Query.from(kinds.values()).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v.value))).flatMap((i) => i).toArray();
3658
3645
  }
3659
3646
  isRepeatWhileKeywordContext(positionDescription) {
3660
3647
  if (positionDescription.kind !== "after-token-or-keyword") {
3661
3648
  return false;
3662
3649
  }
3663
3650
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3664
- return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 115 /* LoopStatement */;
3651
+ return tokenOrKeyword.isToken(22 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 115 /* LoopStatement */;
3665
3652
  }
3666
3653
  isModifierLevelContext(positionDescription) {
3667
3654
  if (positionDescription.kind !== "after-token-or-keyword") {
3668
3655
  return false;
3669
3656
  }
3670
3657
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3671
- return tokenOrKeyword.isToken(45 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 154 /* Modifier */;
3658
+ return tokenOrKeyword.isToken(47 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 154 /* Modifier */;
3672
3659
  }
3673
3660
  isElseOrElseIfKeywordContext(positionDescription) {
3674
3661
  if (positionDescription.kind !== "after-token-or-keyword") {
3675
3662
  return false;
3676
3663
  }
3677
3664
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3678
- return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 108 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.block || tokenOrKeyword.parent.parent.kind === 110 /* ElseIfClause */);
3665
+ return tokenOrKeyword.isToken(22 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 108 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.block || tokenOrKeyword.parent.parent.kind === 110 /* ElseIfClause */);
3679
3666
  }
3680
3667
  isCatchKeywordContext(positionDescription) {
3681
3668
  if (positionDescription.kind !== "after-token-or-keyword") {
3682
3669
  return false;
3683
3670
  }
3684
3671
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3685
- return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */;
3672
+ return tokenOrKeyword.isToken(22 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */;
3686
3673
  }
3687
3674
  isFinallyKeywordContext(positionDescription) {
3688
3675
  if (positionDescription.kind !== "after-token-or-keyword") {
3689
3676
  return false;
3690
3677
  }
3691
3678
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3692
- return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */ || tokenOrKeyword.parent.parent.kind === 101 /* CatchClause */);
3679
+ return tokenOrKeyword.isToken(22 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */ || tokenOrKeyword.parent.parent.kind === 101 /* CatchClause */);
3693
3680
  }
3694
3681
  isTypeKindCompletionContext(positionDescription) {
3695
- return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(58 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
3682
+ return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(64 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
3696
3683
  }
3697
3684
  isFromKeywordContext(positionDescription) {
3698
- if (!(positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(10 /* Identifier */))) {
3685
+ if (!(positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(9 /* Identifier */))) {
3699
3686
  return false;
3700
3687
  }
3701
3688
  const token = positionDescription.tokenOrKeyword.value;
@@ -3706,7 +3693,7 @@ var CompletionService = class {
3706
3693
  return false;
3707
3694
  }
3708
3695
  const tokenOrKeyword = positionDescription.tokenOrKeyword;
3709
- if (tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 120 /* CaseClause */) {
3696
+ if (tokenOrKeyword.isToken(22 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 120 /* CaseClause */) {
3710
3697
  return true;
3711
3698
  }
3712
3699
  if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 118 /* SwitchStatement */) {
@@ -4000,7 +3987,7 @@ var CompletionService = class {
4000
3987
  12 /* Function */
4001
3988
  ];
4002
3989
  result = result.chain(
4003
- Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))).flatMap((i) => i)
3990
+ Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v.value))).flatMap((i) => i)
4004
3991
  );
4005
3992
  }
4006
3993
  return result.toArray();
@@ -4058,7 +4045,7 @@ var CompletionService = class {
4058
4045
  31 /* Creation */
4059
4046
  ];
4060
4047
  result = result.chain(
4061
- Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))).flatMap((i) => i)
4048
+ Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v.value))).flatMap((i) => i)
4062
4049
  );
4063
4050
  }
4064
4051
  return result.toArray();
@@ -4922,9 +4909,9 @@ var OperatorNameCompletionItemInfo = class {
4922
4909
  }
4923
4910
  };
4924
4911
  var SyntaxContext = class {
4925
- constructor(isInComment, isInStringOrChar, isInQuotedIdentifier, isPackageMemberDeclarationListContext, isTypeMemberDeclarationListContext, isStatementContext, isExpressionContext, precedingExpression, isUnqualifiedTypeContext, isUnqualifiedTagNameCompletionContext, isTopLevelTranslationListContext, isTypeMemberTranslationListContext) {
4912
+ constructor(isInComment, isInText, isInQuotedIdentifier, isPackageMemberDeclarationListContext, isTypeMemberDeclarationListContext, isStatementContext, isExpressionContext, precedingExpression, isUnqualifiedTypeContext, isUnqualifiedTagNameCompletionContext, isTopLevelTranslationListContext, isTypeMemberTranslationListContext) {
4926
4913
  this.isInComment = isInComment;
4927
- this.isInStringOrChar = isInStringOrChar;
4914
+ this.isInText = isInText;
4928
4915
  this.isInQuotedIdentifier = isInQuotedIdentifier;
4929
4916
  this.isPackageMemberDeclarationListContext = isPackageMemberDeclarationListContext;
4930
4917
  this.isTypeMemberDeclarationListContext = isTypeMemberDeclarationListContext;
@@ -4983,7 +4970,7 @@ var ExpressionRole_other = class {
4983
4970
  var SyntaxContextFactory = class {
4984
4971
  static fromPositionDescription(sourceFile, positionDescription) {
4985
4972
  const isInComment = this.isInComment(sourceFile, positionDescription.getOffset());
4986
- const isInStringOrChar = this.isInStringOrChar(sourceFile, positionDescription.getOffset());
4973
+ const isInText = this.isInText(sourceFile, positionDescription.getOffset());
4987
4974
  const isInQuotedIdentifier = this.isInQuotedIdentifier(sourceFile, positionDescription.getOffset());
4988
4975
  let isPackageMemberDeclarationListContext = false;
4989
4976
  if (positionDescription.kind === "at-file-start") {
@@ -5021,7 +5008,7 @@ var SyntaxContextFactory = class {
5021
5008
  }
5022
5009
  return new SyntaxContext(
5023
5010
  isInComment,
5024
- isInStringOrChar,
5011
+ isInText,
5025
5012
  isInQuotedIdentifier,
5026
5013
  isPackageMemberDeclarationListContext,
5027
5014
  isTypeMemberDeclarationListContext,
@@ -5035,7 +5022,7 @@ var SyntaxContextFactory = class {
5035
5022
  );
5036
5023
  }
5037
5024
  static isExpressionOrStatementContext(tokenOrKeyword) {
5038
- if (tokenOrKeyword.isToken(58 /* Equals */)) {
5025
+ if (tokenOrKeyword.isToken(64 /* Equals */)) {
5039
5026
  if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
5040
5027
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
5041
5028
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
@@ -5060,7 +5047,7 @@ var SyntaxContextFactory = class {
5060
5047
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
5061
5048
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5062
5049
  }
5063
- if (tokenOrKeyword.parent.kind === 147 /* VariantDeclaration */) {
5050
+ if (tokenOrKeyword.parent.kind === 147 /* VariantValueDeclaration */) {
5064
5051
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
5065
5052
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5066
5053
  }
@@ -5077,11 +5064,11 @@ var SyntaxContextFactory = class {
5077
5064
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
5078
5065
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5079
5066
  }
5080
- if (tokenOrKeyword.isToken(7 /* TextTemplateHead */) && (tokenOrKeyword.parent.kind === 79 /* TextTemplateLiteral */ || tokenOrKeyword.parent.kind === 80 /* LocalizableTextTemplateLiteral */)) {
5067
+ if (tokenOrKeyword.isToken(6 /* TextTemplateHead */) && (tokenOrKeyword.parent.kind === 79 /* TextTemplateLiteral */ || tokenOrKeyword.parent.kind === 80 /* LocalizableTextTemplateLiteral */)) {
5081
5068
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.spanList.spans.at(0)?.expression);
5082
5069
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5083
5070
  }
5084
- if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind === 82 /* TextTemplateSpan */) {
5071
+ if (tokenOrKeyword.isToken(7 /* TextTemplatePart */) && tokenOrKeyword.parent.kind === 82 /* TextTemplateSpan */) {
5085
5072
  let expressionForTargetType;
5086
5073
  const spanList = tokenOrKeyword.parent.parent;
5087
5074
  const spanIndex = spanList.spans.indexOf(tokenOrKeyword.parent);
@@ -5093,10 +5080,10 @@ var SyntaxContextFactory = class {
5093
5080
  isStatementContext: false
5094
5081
  };
5095
5082
  }
5096
- if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */) {
5083
+ if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */) {
5097
5084
  return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
5098
5085
  }
5099
- if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */) {
5086
+ if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */) {
5100
5087
  const block = tokenOrKeyword.parent;
5101
5088
  if (block.expressionOrStatementList.kind !== 93 /* StatementList */ || block.expressionOrStatementList.statements.count() === 0) {
5102
5089
  return {
@@ -5110,10 +5097,10 @@ var SyntaxContextFactory = class {
5110
5097
  };
5111
5098
  }
5112
5099
  }
5113
- if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind === 93 /* StatementList */) {
5100
+ if (tokenOrKeyword.isToken(58 /* Semicolon */) && tokenOrKeyword.parent.kind === 93 /* StatementList */) {
5114
5101
  return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
5115
5102
  }
5116
- if (tokenOrKeyword.isToken(45 /* OpenParenthesis */)) {
5103
+ if (tokenOrKeyword.isToken(47 /* OpenParenthesis */)) {
5117
5104
  if (tokenOrKeyword.parent.kind === 73 /* ParenthesizedExpression */) {
5118
5105
  const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
5119
5106
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
@@ -5142,15 +5129,15 @@ var SyntaxContextFactory = class {
5142
5129
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5143
5130
  }
5144
5131
  }
5145
- if (tokenOrKeyword.isToken(46 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 70 /* IndexedAccessExpression */) {
5132
+ if (tokenOrKeyword.isToken(48 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 70 /* IndexedAccessExpression */) {
5146
5133
  const expressionRole = new ExpressionRole_argument(tokenOrKeyword.parent.argumentList, 0);
5147
5134
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5148
5135
  }
5149
- if (tokenOrKeyword.isToken(46 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 59 /* ArrayLiteral */) {
5136
+ if (tokenOrKeyword.isToken(48 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 59 /* ArrayLiteral */) {
5150
5137
  const expressionRole = new ExpressionRole_arrayElement(tokenOrKeyword.parent);
5151
5138
  return { isExpressionContext: { expressionRole }, isStatementContext: false };
5152
5139
  }
5153
- if (tokenOrKeyword.isToken(25 /* Comma */)) {
5140
+ if (tokenOrKeyword.isToken(26 /* Comma */)) {
5154
5141
  if (tokenOrKeyword.parent.kind === 67 /* ArgumentList */) {
5155
5142
  const argumentList = tokenOrKeyword.parent;
5156
5143
  let index = 0;
@@ -5245,16 +5232,16 @@ var SyntaxContextFactory = class {
5245
5232
  return { isExpressionContext: void 0, isStatementContext: false };
5246
5233
  }
5247
5234
  static isPackageMemberDeclarationListContext(tokenOrKeyword) {
5248
- if (tokenOrKeyword.isToken(52 /* Semicolon */) && (tokenOrKeyword.parent.kind === 2 /* PackageMemberDeclarationList */ || tokenOrKeyword.parent.kind === 4 /* PackageImportDirectiveList */)) {
5235
+ if (tokenOrKeyword.isToken(58 /* Semicolon */) && (tokenOrKeyword.parent.kind === 2 /* PackageMemberDeclarationList */ || tokenOrKeyword.parent.kind === 4 /* PackageImportDirectiveList */)) {
5249
5236
  return true;
5250
5237
  }
5251
- if (tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 30 /* TypeMemberDeclarationBlock */ && (tokenOrKeyword.parent.parent.kind === 38 /* TypeExtensionDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 31 /* PackageStructuredTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 36 /* PackageVariantTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 20 /* PackageAliasTypeDeclaration */)) {
5238
+ if (tokenOrKeyword.isToken(22 /* CloseBrace */) && tokenOrKeyword.parent.kind === 30 /* TypeMemberDeclarationBlock */ && (tokenOrKeyword.parent.parent.kind === 38 /* TypeExtensionDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 31 /* PackageStructuredTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 36 /* PackageVariantTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 20 /* PackageAliasTypeDeclaration */)) {
5252
5239
  return true;
5253
5240
  }
5254
- if (tokenOrKeyword.isToken(21 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 123 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 22 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && (tokenOrKeyword.parent.parent.kind === 23 /* PackageConstructorDeclaration */ || tokenOrKeyword.parent.parent.kind === 24 /* PackageEntryPointDeclaration */ || tokenOrKeyword.parent.parent.kind === 25 /* PackageFunctionDeclaration */))) {
5241
+ if (tokenOrKeyword.isToken(22 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 123 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 22 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && (tokenOrKeyword.parent.parent.kind === 23 /* PackageConstructorDeclaration */ || tokenOrKeyword.parent.parent.kind === 24 /* PackageEntryPointDeclaration */ || tokenOrKeyword.parent.parent.kind === 25 /* PackageFunctionDeclaration */))) {
5255
5242
  return true;
5256
5243
  }
5257
- if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 22 /* PackageMemberGroupDeclaration */) {
5244
+ if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 22 /* PackageMemberGroupDeclaration */) {
5258
5245
  return true;
5259
5246
  }
5260
5247
  if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 5 /* SinglePackageImportDirective */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 25 /* PackageFunctionDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 26 /* PackageFunctionTypeDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 20 /* PackageAliasTypeDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 33 /* PackageVariableDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
@@ -5266,7 +5253,7 @@ var SyntaxContextFactory = class {
5266
5253
  if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 154 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5267
5254
  return true;
5268
5255
  }
5269
- if (tokenOrKeyword.isToken(22 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 154 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5256
+ if (tokenOrKeyword.isToken(23 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 154 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5270
5257
  return true;
5271
5258
  }
5272
5259
  const tag = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 152 /* Tag */);
@@ -5276,13 +5263,13 @@ var SyntaxContextFactory = class {
5276
5263
  return false;
5277
5264
  }
5278
5265
  static isTypeMemberDeclarationListContext(tokenOrKeyword) {
5279
- if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind === 29 /* TypeMemberDeclarationList */) {
5266
+ if (tokenOrKeyword.isToken(58 /* Semicolon */) && tokenOrKeyword.parent.kind === 29 /* TypeMemberDeclarationList */) {
5280
5267
  return true;
5281
5268
  }
5282
- if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 30 /* TypeMemberDeclarationBlock */) {
5269
+ if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 30 /* TypeMemberDeclarationBlock */) {
5283
5270
  return true;
5284
5271
  }
5285
- if (tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 30 /* TypeMemberDeclarationBlock */ && tokenOrKeyword.parent.parent.kind === 42 /* TypeMemberGroupDeclaration */) {
5272
+ if (tokenOrKeyword.isToken(22 /* CloseBrace */) && tokenOrKeyword.parent.kind === 30 /* TypeMemberDeclarationBlock */ && tokenOrKeyword.parent.parent.kind === 42 /* TypeMemberGroupDeclaration */) {
5286
5273
  return true;
5287
5274
  }
5288
5275
  if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 52 /* FieldDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 53 /* FieldGetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 54 /* FieldSetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
@@ -5297,13 +5284,13 @@ var SyntaxContextFactory = class {
5297
5284
  ) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
5298
5285
  tokenOrKeyword,
5299
5286
  49 /* DereferencedVariableSetterDeclaration */
5300
- ) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 50 /* MethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 51 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 43 /* ConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 44 /* DestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 147 /* VariantDeclaration */)) {
5287
+ ) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 50 /* MethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 51 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 43 /* ConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 44 /* DestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 147 /* VariantValueDeclaration */)) {
5301
5288
  return true;
5302
5289
  }
5303
5290
  if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 154 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5304
5291
  return true;
5305
5292
  }
5306
- if (tokenOrKeyword.isToken(22 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 154 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5293
+ if (tokenOrKeyword.isToken(23 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 154 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
5307
5294
  return true;
5308
5295
  }
5309
5296
  const tag = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 152 /* Tag */);
@@ -5325,12 +5312,12 @@ var SyntaxContextFactory = class {
5325
5312
  }
5326
5313
  return trivia !== void 0 && offset > trivia.range.start && (trivia.kind === 2 /* SingleLineComment */ || trivia.kind === 3 /* MultiLineComment */);
5327
5314
  }
5328
- static isInStringOrChar(sourceFile, offset) {
5315
+ static isInText(sourceFile, offset) {
5329
5316
  let token = getTokenAtOffset(sourceFile.getSyntaxNode(), offset, false);
5330
5317
  if (token?.tokenKind === 1 /* EndOfFile */ && token.rangeWithTrivia.isEmpty) {
5331
5318
  token = getTokenAtOffset(sourceFile.getSyntaxNode(), offset - 1, false);
5332
5319
  }
5333
- return token !== void 0 && offset > token.rangeWithoutTrivia.start && (token.tokenKind === 6 /* TextLiteral */ || token.tokenKind === 5 /* CharLiteral */ || token.tokenKind === 7 /* TextTemplateHead */ || token.tokenKind === 8 /* TextTemplatePart */ || token.tokenKind === 9 /* TextTemplateTail */);
5320
+ return token !== void 0 && offset > token.rangeWithoutTrivia.start && (token.tokenKind === 5 /* TextLiteral */ || token.tokenKind === 6 /* TextTemplateHead */ || token.tokenKind === 7 /* TextTemplatePart */ || token.tokenKind === 8 /* TextTemplateTail */);
5334
5321
  }
5335
5322
  static isInQuotedIdentifier(sourceFile, offset) {
5336
5323
  let result;
@@ -5344,7 +5331,7 @@ var SyntaxContextFactory = class {
5344
5331
  return result;
5345
5332
  }
5346
5333
  static isUnqualifiedTypeContext(tokenOrKeyword) {
5347
- if (tokenOrKeyword.isToken(24 /* Colon */) && tokenOrKeyword.parent.kind === 161 /* TypeAnnotation */) {
5334
+ if (tokenOrKeyword.isToken(25 /* Colon */) && tokenOrKeyword.parent.kind === 161 /* TypeAnnotation */) {
5348
5335
  return { allowsAnonymousTypes: true };
5349
5336
  }
5350
5337
  if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind === 32 /* StructuredTypeDeclarationBody */) {
@@ -5356,16 +5343,16 @@ var SyntaxContextFactory = class {
5356
5343
  if (tokenOrKeyword.isToken(37 /* LessThan */) && tokenOrKeyword.parent.kind === 157 /* TypeArgumentClause */) {
5357
5344
  return { allowsAnonymousTypes: true };
5358
5345
  }
5359
- if (tokenOrKeyword.isToken(25 /* Comma */) && (tokenOrKeyword.parent.kind === 28 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 158 /* TypeArgumentList */)) {
5346
+ if (tokenOrKeyword.isToken(26 /* Comma */) && (tokenOrKeyword.parent.kind === 28 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 158 /* TypeArgumentList */)) {
5360
5347
  return { allowsAnonymousTypes: tokenOrKeyword.parent.kind === 158 /* TypeArgumentList */ };
5361
5348
  }
5362
5349
  if (tokenOrKeyword.isToken(36 /* HashSign */) && tokenOrKeyword.parent.kind === 152 /* Tag */) {
5363
5350
  return { allowsAnonymousTypes: false };
5364
5351
  }
5365
- if ((tokenOrKeyword.isToken(24 /* Colon */) || tokenOrKeyword.isToken(58 /* Equals */)) && tokenOrKeyword.parent.kind === 148 /* TypeParameterDeclaration */) {
5352
+ if ((tokenOrKeyword.isToken(25 /* Colon */) || tokenOrKeyword.isToken(64 /* Equals */)) && tokenOrKeyword.parent.kind === 148 /* TypeParameterDeclaration */) {
5366
5353
  return { allowsAnonymousTypes: false };
5367
5354
  }
5368
- if (tokenOrKeyword.isToken(58 /* Equals */) && tokenOrKeyword.parent.kind === 20 /* PackageAliasTypeDeclaration */) {
5355
+ if (tokenOrKeyword.isToken(64 /* Equals */) && tokenOrKeyword.parent.kind === 20 /* PackageAliasTypeDeclaration */) {
5369
5356
  return { allowsAnonymousTypes: false };
5370
5357
  }
5371
5358
  if (tokenOrKeyword.isKeyword(14 /* Is */) && tokenOrKeyword.parent.kind === 72 /* IsExpression */) {
@@ -5374,22 +5361,22 @@ var SyntaxContextFactory = class {
5374
5361
  if (tokenOrKeyword.isKeyword(42 /* As */) && tokenOrKeyword.parent.kind === 63 /* AsExpression */) {
5375
5362
  return { allowsAnonymousTypes: true };
5376
5363
  }
5377
- if (tokenOrKeyword.isToken(18 /* Bar */) && tokenOrKeyword.parent.kind === 11 /* UnionTypeSpecifier */) {
5364
+ if (tokenOrKeyword.isToken(17 /* Bar */) && tokenOrKeyword.parent.kind === 11 /* UnionTypeSpecifier */) {
5378
5365
  return { allowsAnonymousTypes: false };
5379
5366
  }
5380
- if (tokenOrKeyword.isToken(11 /* Ampersand */) && tokenOrKeyword.parent.kind === 12 /* IntersectionTypeSpecifier */) {
5367
+ if (tokenOrKeyword.isToken(10 /* Ampersand */) && tokenOrKeyword.parent.kind === 12 /* IntersectionTypeSpecifier */) {
5381
5368
  return { allowsAnonymousTypes: false };
5382
5369
  }
5383
- if (tokenOrKeyword.isToken(45 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 13 /* ParenthesizedTypeSpecifier */) {
5370
+ if (tokenOrKeyword.isToken(47 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 13 /* ParenthesizedTypeSpecifier */) {
5384
5371
  return { allowsAnonymousTypes: true };
5385
5372
  }
5386
5373
  return void 0;
5387
5374
  }
5388
5375
  static isTopLevelTranslationListContext(tokenOrKeyword) {
5389
- if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind === 124 /* TopLevelTranslationList */) {
5376
+ if (tokenOrKeyword.isToken(58 /* Semicolon */) && tokenOrKeyword.parent.kind === 124 /* TopLevelTranslationList */) {
5390
5377
  return { translationsDeclaration: tokenOrKeyword.parent.parent };
5391
5378
  }
5392
- if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 123 /* TranslationsDeclaration */) {
5379
+ if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 123 /* TranslationsDeclaration */) {
5393
5380
  return { translationsDeclaration: tokenOrKeyword.parent };
5394
5381
  }
5395
5382
  const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
@@ -5423,10 +5410,10 @@ var SyntaxContextFactory = class {
5423
5410
  return void 0;
5424
5411
  }
5425
5412
  static isTypeMemberTranslationListContext(tokenOrKeyword) {
5426
- if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind === 138 /* TypeMemberTranslationList */) {
5413
+ if (tokenOrKeyword.isToken(58 /* Semicolon */) && tokenOrKeyword.parent.kind === 138 /* TypeMemberTranslationList */) {
5427
5414
  return { typeTranslation: tokenOrKeyword.parent.parent };
5428
5415
  }
5429
- if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 139 /* TypeTranslationDeclaration */) {
5416
+ if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 139 /* TypeTranslationDeclaration */) {
5430
5417
  return { typeTranslation: tokenOrKeyword.parent };
5431
5418
  }
5432
5419
  const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 129 /* IndexerTranslation */);
@@ -5568,35 +5555,35 @@ var NodeSemanticInfoService = class {
5568
5555
  return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
5569
5556
  } else if (tokenOrKeyword.parent.kind === 64 /* BinaryExpression */) {
5570
5557
  return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
5571
- } else if (tokenOrKeyword.isToken(20 /* Caret */) && (tokenOrKeyword.parent.kind === 48 /* DereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 49 /* DereferencedVariableSetterDeclaration */)) {
5558
+ } else if (tokenOrKeyword.isToken(21 /* Caret */) && (tokenOrKeyword.parent.kind === 48 /* DereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 49 /* DereferencedVariableSetterDeclaration */)) {
5572
5559
  return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
5573
- } else if (tokenOrKeyword.isToken(20 /* Caret */) && tokenOrKeyword.parent.kind === 78 /* DereferenceExpression */) {
5560
+ } else if (tokenOrKeyword.isToken(21 /* Caret */) && tokenOrKeyword.parent.kind === 78 /* DereferenceExpression */) {
5574
5561
  return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
5575
5562
  } else if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
5576
5563
  return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options7);
5577
5564
  } else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 43 /* ConstructorDeclaration */) {
5578
5565
  return this.ofConstructorDeclaration(analyzer, tokenOrKeyword.parent);
5579
- } else if (tokenOrKeyword.isToken(14 /* Asterisk */) && tokenOrKeyword.parent.kind === 91 /* DefaultMatchExpression */) {
5566
+ } else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind === 91 /* DefaultMatchExpression */) {
5580
5567
  return this.ofDefaultMatchExpression(analyzer, tokenOrKeyword.parent);
5581
5568
  } else if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 65 /* FunctionLiteral */) {
5582
5569
  return this.ofRegularOrBlockFunctionLiteral(analyzer, tokenOrKeyword.parent);
5583
- } else if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && tokenOrKeyword.parent.parent.kind === 66 /* FunctionBlockLiteral */) {
5570
+ } else if (tokenOrKeyword.isToken(46 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && tokenOrKeyword.parent.parent.kind === 66 /* FunctionBlockLiteral */) {
5584
5571
  return this.ofRegularOrBlockFunctionLiteral(analyzer, tokenOrKeyword.parent.parent);
5585
5572
  } else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 87 /* ObjectExpression */) {
5586
5573
  return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options7);
5587
5574
  } else if (tokenOrKeyword.isKeyword(56 /* Base */) && tokenOrKeyword.parent.kind === 88 /* BaseExpression */) {
5588
5575
  return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options7);
5589
- } else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 47 /* IndexParameterClause */) {
5576
+ } else if ((tokenOrKeyword.isToken(48 /* OpenSquareBracket */) || tokenOrKeyword.isToken(24 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 47 /* IndexParameterClause */) {
5590
5577
  return this.ofIndexedElementAccessorDeclaration(analyzer, tokenOrKeyword.parent.parent);
5591
- } else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 70 /* IndexedAccessExpression */) {
5578
+ } else if ((tokenOrKeyword.isToken(48 /* OpenSquareBracket */) || tokenOrKeyword.isToken(24 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 70 /* IndexedAccessExpression */) {
5592
5579
  return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
5593
5580
  } else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 127 /* ConstructorTranslation */) {
5594
5581
  return this.ofConstructorTranslationSourceConstructor(analyzer, tokenOrKeyword.parent, options7);
5595
- } else if ((tokenOrKeyword.isToken(45 /* OpenParenthesis */) || tokenOrKeyword.isToken(22 /* CloseParenthesis */)) && tokenOrKeyword.parent.kind === 126 /* TranslationParameterClause */ && tokenOrKeyword.parent.parent.kind === 127 /* ConstructorTranslation */ && tokenOrKeyword.parent.parent.translatedParameterClause === tokenOrKeyword.parent) {
5582
+ } else if ((tokenOrKeyword.isToken(47 /* OpenParenthesis */) || tokenOrKeyword.isToken(23 /* CloseParenthesis */)) && tokenOrKeyword.parent.kind === 126 /* TranslationParameterClause */ && tokenOrKeyword.parent.parent.kind === 127 /* ConstructorTranslation */ && tokenOrKeyword.parent.parent.translatedParameterClause === tokenOrKeyword.parent) {
5596
5583
  return this.ofConstructorTranslationTranslatedConstructor(analyzer, tokenOrKeyword.parent.parent, options7);
5597
- } else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 128 /* IndexParameterTranslationClause */ && tokenOrKeyword.parent.parent.kind === 129 /* IndexerTranslation */ && tokenOrKeyword.parent.parent.sourceParameterClause === tokenOrKeyword.parent) {
5584
+ } else if ((tokenOrKeyword.isToken(48 /* OpenSquareBracket */) || tokenOrKeyword.isToken(24 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 128 /* IndexParameterTranslationClause */ && tokenOrKeyword.parent.parent.kind === 129 /* IndexerTranslation */ && tokenOrKeyword.parent.parent.sourceParameterClause === tokenOrKeyword.parent) {
5598
5585
  return this.ofIndexerTranslationSourceIndexer(analyzer, tokenOrKeyword.parent.parent, options7);
5599
- } else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 128 /* IndexParameterTranslationClause */ && tokenOrKeyword.parent.parent.kind === 129 /* IndexerTranslation */ && tokenOrKeyword.parent.parent.translatedParameterClause === tokenOrKeyword.parent) {
5586
+ } else if ((tokenOrKeyword.isToken(48 /* OpenSquareBracket */) || tokenOrKeyword.isToken(24 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 128 /* IndexParameterTranslationClause */ && tokenOrKeyword.parent.parent.kind === 129 /* IndexerTranslation */ && tokenOrKeyword.parent.parent.translatedParameterClause === tokenOrKeyword.parent) {
5600
5587
  return this.ofIndexerTranslationTranslatedIndexer(analyzer, tokenOrKeyword.parent.parent, options7);
5601
5588
  }
5602
5589
  return void 0;
@@ -5738,8 +5725,8 @@ var NodeSemanticInfoService = class {
5738
5725
  case 148 /* TypeParameterDeclaration */:
5739
5726
  result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeParameterDeclaration(parent));
5740
5727
  break;
5741
- case 147 /* VariantDeclaration */:
5742
- result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantDeclaration(parent));
5728
+ case 147 /* VariantValueDeclaration */:
5729
+ result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantValueDeclaration(parent));
5743
5730
  break;
5744
5731
  case 34 /* PackageVariableGetterDeclaration */:
5745
5732
  case 35 /* PackageVariableSetterDeclaration */:
@@ -5762,7 +5749,7 @@ var NodeSemanticInfoService = class {
5762
5749
  }
5763
5750
  static ofMember(analyzer, node, options7) {
5764
5751
  let result;
5765
- const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
5752
+ const meaning = analyzer.resolveMemberAccessExpression(node);
5766
5753
  switch (meaning.kind) {
5767
5754
  case "instance-field-access": {
5768
5755
  let narrowedType;
@@ -6044,7 +6031,7 @@ var NodeSemanticInfoService = class {
6044
6031
  }
6045
6032
  static ofIdentifierExpression(analyzer, node, options7) {
6046
6033
  let result;
6047
- const meaning = analyzer.resolveIdentifierExpression(node).meaning;
6034
+ const meaning = analyzer.resolveIdentifierExpression(node);
6048
6035
  switch (meaning.kind) {
6049
6036
  case "type-access":
6050
6037
  if (meaning.suitableTypes.length > 0) {
@@ -6168,7 +6155,7 @@ var NodeSemanticInfoService = class {
6168
6155
  return new DefinitionNodeSemanticInfo(entity);
6169
6156
  }
6170
6157
  static ofIndexedAccessExpressionOperator(analyzer, node, options7) {
6171
- const meaning = analyzer.resolveIndexedAccessExpression(node).meaning;
6158
+ const meaning = analyzer.resolveIndexedAccessExpression(node);
6172
6159
  if (meaning.kind === "resolved") {
6173
6160
  let result;
6174
6161
  if (isNonEmptyArray(meaning.suitableIndexers)) {
@@ -6195,8 +6182,8 @@ var NodeSemanticInfoService = class {
6195
6182
  const operatorKind = analyzer.getBinaryOperatorKindIfCompoundAssignmentOperator(node.operator);
6196
6183
  if (operatorKind !== void 0) {
6197
6184
  const operator = analyzer.resolveCompoundAssignmentStatementOperator(node, operatorKind);
6198
- if (operator.kind === "ok") {
6199
- const target = new OperatorReferenceTarget(operator.value);
6185
+ if (operator !== void 0) {
6186
+ const target = new OperatorReferenceTarget(operator);
6200
6187
  let result = new ReferenceNodeSemanticInfo([target], false);
6201
6188
  if (options7.includeBetterReferenceTargets) {
6202
6189
  result = this.getBetterReferenceTargetsOrPreserve(result);
@@ -6210,8 +6197,8 @@ var NodeSemanticInfoService = class {
6210
6197
  const classificationResult = analyzer.classifyBinaryExpressionOperator(node.operator);
6211
6198
  if (classificationResult.kind === "user-definable") {
6212
6199
  const operator = analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
6213
- if (operator.kind === "ok") {
6214
- const target = new OperatorReferenceTarget(operator.value);
6200
+ if (operator !== void 0) {
6201
+ const target = new OperatorReferenceTarget(operator);
6215
6202
  let result = new ReferenceNodeSemanticInfo([target], false);
6216
6203
  if (options7.includeBetterReferenceTargets) {
6217
6204
  result = this.getBetterReferenceTargetsOrPreserve(result);
@@ -6223,8 +6210,8 @@ var NodeSemanticInfoService = class {
6223
6210
  }
6224
6211
  static ofPrefixUnaryExpressionOperator(analyzer, node, options7) {
6225
6212
  const operator = analyzer.resolvePrefixUnaryExpressionUserDefinableOperator(node);
6226
- if (operator.kind === "ok") {
6227
- const target = new OperatorReferenceTarget(operator.value);
6213
+ if (operator !== void 0) {
6214
+ const target = new OperatorReferenceTarget(operator);
6228
6215
  let result = new ReferenceNodeSemanticInfo([target], false);
6229
6216
  if (options7.includeBetterReferenceTargets) {
6230
6217
  result = this.getBetterReferenceTargetsOrPreserve(result);
@@ -6269,7 +6256,7 @@ var NodeSemanticInfoService = class {
6269
6256
  return result;
6270
6257
  }
6271
6258
  static ofObjectExpression(analyzer, node, options7) {
6272
- const meaning = analyzer.resolveObjectExpression(node).meaning;
6259
+ const meaning = analyzer.resolveObjectExpression(node);
6273
6260
  let result;
6274
6261
  switch (meaning.kind) {
6275
6262
  case "own-constructor-access": {
@@ -6301,7 +6288,7 @@ var NodeSemanticInfoService = class {
6301
6288
  return result;
6302
6289
  }
6303
6290
  static ofBaseExpression(analyzer, node, options7) {
6304
- const meaning = analyzer.resolveBaseExpression(node).meaning;
6291
+ const meaning = analyzer.resolveBaseExpression(node);
6305
6292
  let result;
6306
6293
  switch (meaning.kind) {
6307
6294
  case "base-constructor-access": {
@@ -6400,7 +6387,7 @@ var NodeSemanticInfoService = class {
6400
6387
  static ofPackageNameSegmentAccess(analyzer, packageTreeNode, node) {
6401
6388
  let parent = getParentSkippingParenthesizedExpressions(node);
6402
6389
  while (parent.kind === 76 /* MemberAccessExpression */) {
6403
- const meaning = analyzer.resolveMemberAccessExpression(parent).meaning;
6390
+ const meaning = analyzer.resolveMemberAccessExpression(parent);
6404
6391
  if (meaning.kind === "package-name-segment-access") {
6405
6392
  packageTreeNode = meaning.packageTreeNode;
6406
6393
  parent = getParentSkippingParenthesizedExpressions(parent);
@@ -6854,9 +6841,9 @@ var DefinitionService = class {
6854
6841
  getDefinition(analyzer, sourceFile, offset, taskController) {
6855
6842
  return __async(this, null, function* () {
6856
6843
  const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSingleWithHighestPriority((t) => {
6857
- if (t.isToken(10 /* Identifier */) || t.isKeyword()) {
6844
+ if (t.isToken(9 /* Identifier */) || t.isKeyword()) {
6858
6845
  return 2;
6859
- } else if (t.isToken(20 /* Caret */) || t.isToken(46 /* OpenSquareBracket */) || t.isToken(23 /* CloseSquareBracket */)) {
6846
+ } else if (t.isToken(21 /* Caret */) || t.isToken(48 /* OpenSquareBracket */) || t.isToken(24 /* CloseSquareBracket */)) {
6860
6847
  return 1;
6861
6848
  } else {
6862
6849
  return 0;
@@ -7081,38 +7068,6 @@ var DefinitionsAndReferenceInfo = class {
7081
7068
  }
7082
7069
  };
7083
7070
 
7084
- // source/services/DeleteBlockFromScriptService.ts
7085
- var DeleteBlockFromScriptService = class {
7086
- createEditDeletingBlock(sourceFile, subprogramDeclaration) {
7087
- let result;
7088
- if (NodeTypeUtils.isRegularOrBlockFunctionLiteral(subprogramDeclaration) && subprogramDeclaration.parent.kind === 150 /* Argument */ && subprogramDeclaration.parent.parent.parent.kind === 68 /* CallExpression */) {
7089
- const callExpression = subprogramDeclaration.parent.parent.parent;
7090
- let rangeStart = callExpression.rangeWithoutTrivia.start;
7091
- let rangeEnd = callExpression.rangeWithoutTrivia.end;
7092
- const leadingTrivia = callExpression.findLeftmostToken()?.selectLeadingTrivia(() => true);
7093
- const lastLeadingTrivia = leadingTrivia !== void 0 && leadingTrivia.length > 0 ? leadingTrivia[leadingTrivia.length - 1] : void 0;
7094
- if (lastLeadingTrivia?.kind === 0 /* Whitespace */) {
7095
- rangeStart = lastLeadingTrivia.range.start;
7096
- }
7097
- const trailingTrivia = callExpression.findRightmostToken()?.selectTrailingTrivia(() => true);
7098
- if (trailingTrivia !== void 0) {
7099
- let trailingTriviaIndex = -1;
7100
- if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 0 /* Whitespace */) {
7101
- trailingTriviaIndex++;
7102
- }
7103
- if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 1 /* NewLine */) {
7104
- trailingTriviaIndex++;
7105
- }
7106
- if (trailingTriviaIndex >= 0) {
7107
- rangeEnd = trailingTrivia[trailingTriviaIndex].range.end;
7108
- }
7109
- }
7110
- result = new SourceFileEdit(sourceFile, new Range(rangeStart, rangeEnd), "");
7111
- }
7112
- return result;
7113
- }
7114
- };
7115
-
7116
7071
  // source/services/ReferencesService.ts
7117
7072
  var ReferencesService = class {
7118
7073
  getReferencesInCompilation(analyzer, sourceFile, offset, options7, taskController) {
@@ -7411,9 +7366,9 @@ var ReferencesService = class {
7411
7366
  }
7412
7367
  getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset, options7) {
7413
7368
  const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSingleWithHighestPriority((t) => {
7414
- if (t.isToken(10 /* Identifier */) || t.isKeyword()) {
7369
+ if (t.isToken(9 /* Identifier */) || t.isKeyword()) {
7415
7370
  return 2;
7416
- } else if (t.isToken(20 /* Caret */) || t.isToken(46 /* OpenSquareBracket */) || t.isToken(23 /* CloseSquareBracket */)) {
7371
+ } else if (t.isToken(21 /* Caret */) || t.isToken(48 /* OpenSquareBracket */) || t.isToken(24 /* CloseSquareBracket */)) {
7417
7372
  return 1;
7418
7373
  } else {
7419
7374
  return 0;
@@ -7755,7 +7710,7 @@ var EvaluatableExpressionService = class {
7755
7710
  if (isIdentifier(node)) {
7756
7711
  let originalName;
7757
7712
  if (node.parent.kind === 76 /* MemberAccessExpression */) {
7758
- const meaning = analyzer.resolveMemberAccessExpression(node.parent).meaning;
7713
+ const meaning = analyzer.resolveMemberAccessExpression(node.parent);
7759
7714
  let entity;
7760
7715
  switch (meaning.kind) {
7761
7716
  case "static-field-access":
@@ -7773,7 +7728,7 @@ var EvaluatableExpressionService = class {
7773
7728
  }
7774
7729
  originalName = entity?.getOriginalEntity().getName().keyWithoutBackQuotes;
7775
7730
  } else if (node.parent.kind === 89 /* IdentifierExpression */) {
7776
- const meaning = analyzer.resolveIdentifierExpression(node.parent).meaning;
7731
+ const meaning = analyzer.resolveIdentifierExpression(node.parent);
7777
7732
  let entity;
7778
7733
  switch (meaning.kind) {
7779
7734
  case "variable-access":
@@ -7846,7 +7801,7 @@ var EvaluatableExpressionService = class {
7846
7801
  case 50 /* MethodDeclaration */:
7847
7802
  case 52 /* FieldDeclaration */:
7848
7803
  case 148 /* TypeParameterDeclaration */:
7849
- case 147 /* VariantDeclaration */:
7804
+ case 147 /* VariantValueDeclaration */:
7850
7805
  case 102 /* ErrorVariableDeclaration */:
7851
7806
  case 34 /* PackageVariableGetterDeclaration */:
7852
7807
  case 35 /* PackageVariableSetterDeclaration */:
@@ -7924,11 +7879,11 @@ var FileSystemTreeDisplayService = class _FileSystemTreeDisplayService {
7924
7879
  var HoverService = class {
7925
7880
  getHover(analyzer, sourceFile, offset) {
7926
7881
  const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSingleWithHighestPriority((t) => {
7927
- if (t.isToken(10 /* Identifier */) || t.isKeyword()) {
7882
+ if (t.isToken(9 /* Identifier */) || t.isKeyword()) {
7928
7883
  return 2;
7929
- } else if (t.isToken(14 /* Asterisk */)) {
7884
+ } else if (t.isToken(13 /* Asterisk */)) {
7930
7885
  return 1;
7931
- } else if (t.isToken(20 /* Caret */) || t.isToken(46 /* OpenSquareBracket */) || t.isToken(23 /* CloseSquareBracket */) || t.isToken(44 /* OpenBrace */)) {
7886
+ } else if (t.isToken(21 /* Caret */) || t.isToken(48 /* OpenSquareBracket */) || t.isToken(24 /* CloseSquareBracket */) || t.isToken(46 /* OpenBrace */)) {
7932
7887
  return 1;
7933
7888
  } else {
7934
7889
  return 0;
@@ -8064,337 +8019,40 @@ var Hover = class {
8064
8019
  }
8065
8020
  };
8066
8021
 
8067
- // source/services/SourceFileItemsService.ts
8068
- var SourceFileItemsService = class {
8069
- getItems(sourceFile) {
8070
- this.sourceFile = sourceFile;
8071
- return this.getChildItems(sourceFile.getSyntaxNode());
8022
+ // source/services/RenameService.ts
8023
+ var RenameService = class {
8024
+ constructor() {
8025
+ this.referencesService = new ReferencesService();
8072
8026
  }
8073
- get locale() {
8074
- return this.sourceFile.package.locale;
8027
+ prepareRename(analyzer, sourceFile, offset) {
8028
+ const checkResult = this.canRename(analyzer, sourceFile, offset);
8029
+ return checkResult?.renameRange;
8075
8030
  }
8076
- get dialect() {
8077
- return this.sourceFile.package.dialect;
8078
- }
8079
- getChildItems(node) {
8080
- const result = new Array();
8081
- visitChildren(node, false, (node2) => {
8082
- const items = this.getChildItems(node2);
8083
- switch (node2.kind) {
8084
- case 8 /* PackageImport */: {
8085
- if (node2.alias !== void 0) {
8086
- result.push(this.createItem(
8087
- 0 /* PackageAlias */,
8088
- node2.alias.value,
8089
- node2.rangeWithoutTrivia,
8090
- node2.alias.rangeWithoutTrivia,
8091
- items
8092
- ));
8093
- }
8094
- break;
8095
- }
8096
- case 33 /* PackageVariableDeclaration */: {
8097
- result.push(this.createItem(
8098
- 1 /* PackageVariable */,
8099
- node2.name.value,
8100
- node2.rangeWithoutTrivia,
8101
- node2.name.rangeWithoutTrivia,
8102
- items
8103
- ));
8104
- break;
8105
- }
8106
- case 34 /* PackageVariableGetterDeclaration */: {
8107
- result.push(this.createItem(
8108
- 2 /* PackageVariableGetter */,
8109
- node2.name.value,
8110
- node2.rangeWithoutTrivia,
8111
- node2.name.rangeWithoutTrivia,
8112
- items
8113
- ));
8114
- break;
8115
- }
8116
- case 35 /* PackageVariableSetterDeclaration */: {
8117
- result.push(this.createItem(
8118
- 3 /* PackageVariableSetter */,
8119
- node2.name.value,
8120
- node2.rangeWithoutTrivia,
8121
- node2.name.rangeWithoutTrivia,
8122
- items
8123
- ));
8124
- break;
8125
- }
8126
- case 25 /* PackageFunctionDeclaration */: {
8127
- result.push(this.createItem(
8128
- 4 /* PackageFunction */,
8129
- node2.name.value,
8130
- node2.rangeWithoutTrivia,
8131
- node2.name.rangeWithoutTrivia,
8132
- items
8133
- ));
8134
- break;
8135
- }
8136
- case 31 /* PackageStructuredTypeDeclaration */: {
8137
- result.push(this.createItem(
8138
- 5 /* StructuredType */,
8139
- node2.name.value,
8140
- node2.rangeWithoutTrivia,
8141
- node2.name.rangeWithoutTrivia,
8142
- items
8143
- ));
8144
- break;
8145
- }
8146
- case 52 /* FieldDeclaration */: {
8147
- result.push(this.createItem(
8148
- 12 /* Field */,
8149
- node2.name.value,
8150
- node2.rangeWithoutTrivia,
8151
- node2.name.rangeWithoutTrivia,
8152
- items
8153
- ));
8154
- break;
8155
- }
8156
- case 53 /* FieldGetterDeclaration */: {
8157
- result.push(this.createItem(
8158
- 13 /* FieldGetter */,
8159
- node2.name.value,
8160
- node2.rangeWithoutTrivia,
8161
- node2.name.rangeWithoutTrivia,
8162
- items
8163
- ));
8164
- break;
8165
- }
8166
- case 54 /* FieldSetterDeclaration */: {
8167
- result.push(this.createItem(
8168
- 14 /* FieldSetter */,
8169
- node2.name.value,
8170
- node2.rangeWithoutTrivia,
8171
- node2.name.rangeWithoutTrivia,
8172
- items
8173
- ));
8174
- break;
8175
- }
8176
- case 50 /* MethodDeclaration */: {
8177
- result.push(this.createItem(
8178
- 15 /* Method */,
8179
- node2.name.value,
8180
- node2.rangeWithoutTrivia,
8181
- node2.name.rangeWithoutTrivia,
8182
- items
8183
- ));
8184
- break;
8185
- }
8186
- case 43 /* ConstructorDeclaration */: {
8187
- result.push(this.createItem(
8188
- 10 /* Constructor */,
8189
- void 0,
8190
- node2.rangeWithoutTrivia,
8191
- node2.rangeWithoutTrivia,
8192
- items
8193
- ));
8194
- break;
8195
- }
8196
- case 44 /* DestructorDeclaration */: {
8197
- result.push(this.createItem(
8198
- 11 /* Destructor */,
8199
- void 0,
8200
- node2.rangeWithoutTrivia,
8201
- node2.rangeWithoutTrivia,
8202
- items
8203
- ));
8204
- break;
8205
- }
8206
- case 45 /* IndexedElementGetterDeclaration */: {
8207
- result.push(this.createItem(
8208
- 16 /* IndexedElementGetter */,
8209
- void 0,
8210
- node2.rangeWithoutTrivia,
8211
- node2.rangeWithoutTrivia,
8212
- items
8213
- ));
8214
- break;
8215
- }
8216
- case 46 /* IndexedElementSetterDeclaration */: {
8217
- result.push(this.createItem(
8218
- 17 /* IndexedElementSetter */,
8219
- void 0,
8220
- node2.rangeWithoutTrivia,
8221
- node2.rangeWithoutTrivia,
8222
- items
8223
- ));
8224
- break;
8225
- }
8226
- case 26 /* PackageFunctionTypeDeclaration */: {
8227
- result.push(this.createItem(
8228
- 6 /* FunctionType */,
8229
- node2.name.value,
8230
- node2.rangeWithoutTrivia,
8231
- node2.name.rangeWithoutTrivia,
8232
- items
8233
- ));
8234
- break;
8235
- }
8236
- case 36 /* PackageVariantTypeDeclaration */: {
8237
- result.push(this.createItem(
8238
- 7 /* VariantType */,
8239
- node2.name.value,
8240
- node2.rangeWithoutTrivia,
8241
- node2.name.rangeWithoutTrivia,
8242
- items
8243
- ));
8244
- break;
8245
- }
8246
- case 147 /* VariantDeclaration */: {
8247
- result.push(this.createItem(
8248
- 9 /* Variant */,
8249
- node2.name.value,
8250
- node2.rangeWithoutTrivia,
8251
- node2.name.rangeWithoutTrivia,
8252
- items
8253
- ));
8254
- break;
8255
- }
8256
- case 148 /* TypeParameterDeclaration */: {
8257
- result.push(this.createItem(
8258
- 18 /* TypeParameter */,
8259
- node2.name.value,
8260
- node2.rangeWithoutTrivia,
8261
- node2.name.rangeWithoutTrivia,
8262
- items
8263
- ));
8264
- break;
8265
- }
8266
- case 56 /* NestedFunctionDeclaration */: {
8267
- result.push(this.createItem(
8268
- 19 /* NestedFunction */,
8269
- node2.name.value,
8270
- node2.rangeWithoutTrivia,
8271
- node2.name.rangeWithoutTrivia,
8272
- items
8273
- ));
8274
- break;
8275
- }
8276
- default: {
8277
- result.push(...items);
8278
- break;
8279
- }
8280
- }
8281
- });
8282
- return result;
8283
- }
8284
- createItem(kind, name, range, selectionRange, items) {
8285
- const itemName = this.getNameOrStubIfEmpty(name, kind);
8286
- return new Item(kind, itemName, range, selectionRange, items, this.sourceFile);
8287
- }
8288
- getNameOrStubIfEmpty(name, kind) {
8289
- if (name !== void 0 && name.trim().length === 0) {
8290
- name = void 0;
8291
- }
8292
- switch (kind) {
8293
- case 0 /* PackageAlias */:
8294
- return name ?? `<${LocalizationHelper.localizeHelperPhrase(4 /* PackageAlias */, this.locale)}>`;
8295
- case 1 /* PackageVariable */:
8296
- case 12 /* Field */:
8297
- return name ?? `<${LocalizationHelper.localizeHelperPhrase(6 /* Variable */, this.locale)}>`;
8298
- case 4 /* PackageFunction */:
8299
- case 15 /* Method */:
8300
- case 19 /* NestedFunction */:
8301
- return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(12 /* Function */, this.locale, this.dialect)}>`;
8302
- case 5 /* StructuredType */:
8303
- case 6 /* FunctionType */:
8304
- case 7 /* VariantType */:
8305
- case 8 /* InvalidType */:
8306
- return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(16 /* Type */, this.locale, this.dialect)}>`;
8307
- case 10 /* Constructor */:
8308
- return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(31 /* Creation */, this.locale, this.dialect);
8309
- case 11 /* Destructor */:
8310
- return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(47 /* Destruction */, this.locale, this.dialect);
8311
- case 9 /* Variant */:
8312
- return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(6 /* Variant */, this.locale, this.dialect)}>`;
8313
- case 18 /* TypeParameter */:
8314
- return name ?? `<${LocalizationHelper.localizeHelperPhrase(2 /* TypeParameter */, this.locale)}>`;
8315
- case 2 /* PackageVariableGetter */:
8316
- case 13 /* FieldGetter */:
8317
- return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Get */, this.locale, this.dialect)} ${name ?? ""}`;
8318
- case 3 /* PackageVariableSetter */:
8319
- case 14 /* FieldSetter */:
8320
- return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Set */, this.locale, this.dialect)} ${name ?? ""}`;
8321
- case 16 /* IndexedElementGetter */:
8322
- return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Get */, this.locale, this.dialect)} []`;
8323
- case 17 /* IndexedElementSetter */:
8324
- return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Set */, this.locale, this.dialect)} []`;
8325
- default:
8326
- Debug.never(kind);
8327
- }
8328
- }
8329
- };
8330
- var Item = class {
8331
- constructor(kind, name, range, selectionRange, items, sourceFile) {
8332
- this.kind = kind;
8333
- this.name = name;
8334
- this.range = range;
8335
- this.selectionRange = selectionRange;
8336
- this.items = items;
8337
- this.sourceFile = sourceFile;
8338
- }
8339
- };
8340
-
8341
- // source/services/ProjectItemsService.ts
8342
- var WorkspaceItemsService = class {
8343
- constructor() {
8344
- this.sourceFileItemsService = new SourceFileItemsService();
8345
- }
8346
- getItems(compilations) {
8347
- const result = new Array();
8348
- const packageUris = /* @__PURE__ */ new Set();
8349
- for (const compilation of compilations) {
8350
- for (const pkg of compilation.allPackages) {
8351
- if (packageUris.has(pkg.uri.toString())) {
8352
- continue;
8353
- }
8354
- packageUris.add(pkg.uri.toString());
8355
- for (const sourceFile of pkg.sourceFiles) {
8356
- result.push(...this.sourceFileItemsService.getItems(sourceFile));
8357
- }
8358
- }
8359
- }
8360
- return result;
8361
- }
8362
- };
8363
-
8364
- // source/services/RenameService.ts
8365
- var RenameService = class {
8366
- constructor() {
8367
- this.referencesService = new ReferencesService();
8368
- }
8369
- prepareRename(analyzer, sourceFile, offset) {
8370
- const checkResult = this.canRename(analyzer, sourceFile, offset);
8371
- return checkResult?.renameRange;
8372
- }
8373
- rename(analyzer, sourceFile, offset, newText, taskController) {
8374
- return __async(this, null, function* () {
8375
- let result;
8376
- if (this.canRename(analyzer, sourceFile, offset) !== void 0) {
8377
- const options7 = {
8378
- onlyWithSameAlias: true,
8379
- onlyNamed: true,
8380
- allowAmbiguous: false,
8381
- isForRename: true
8382
- };
8383
- const sourceFiles = Query.from(analyzer.compilation.enumerateSourceFiles()).filter((f) => f.uri.scheme !== InMemoryPackageScheme);
8384
- const references = yield this.referencesService.getReferencesInFiles(
8385
- analyzer,
8386
- sourceFile,
8387
- offset,
8388
- sourceFiles,
8389
- options7,
8390
- taskController
8391
- );
8392
- result = references.map((r) => new Rename(r.sourceFile, r.range, newText));
8393
- } else {
8394
- result = [];
8395
- }
8396
- return result;
8397
- });
8031
+ rename(analyzer, sourceFile, offset, newText, taskController) {
8032
+ return __async(this, null, function* () {
8033
+ let result;
8034
+ if (this.canRename(analyzer, sourceFile, offset) !== void 0) {
8035
+ const options7 = {
8036
+ onlyWithSameAlias: true,
8037
+ onlyNamed: true,
8038
+ allowAmbiguous: false,
8039
+ isForRename: true
8040
+ };
8041
+ const sourceFiles = Query.from(analyzer.compilation.enumerateSourceFiles()).filter((f) => f.uri.scheme !== InMemoryPackageScheme);
8042
+ const references = yield this.referencesService.getReferencesInFiles(
8043
+ analyzer,
8044
+ sourceFile,
8045
+ offset,
8046
+ sourceFiles,
8047
+ options7,
8048
+ taskController
8049
+ );
8050
+ result = references.map((r) => new Rename(r.sourceFile, r.range, newText));
8051
+ } else {
8052
+ result = [];
8053
+ }
8054
+ return result;
8055
+ });
8398
8056
  }
8399
8057
  canRename(analyzer, sourceFile, offset) {
8400
8058
  const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSinglePrioritizingNamed();
@@ -8470,6 +8128,167 @@ var Rename = class {
8470
8128
  }
8471
8129
  };
8472
8130
 
8131
+ // source/services/ScriptEditingService.ts
8132
+ var ScriptEditingService = class _ScriptEditingService {
8133
+ static {
8134
+ this.indentationStep = " ";
8135
+ }
8136
+ static {
8137
+ this.elementParameterNameText = "el";
8138
+ }
8139
+ static {
8140
+ this.elementParameterName = new Name(_ScriptEditingService.elementParameterNameText);
8141
+ }
8142
+ createEditWithFieldAssignment(analyzer, sourceFile, scriptDeclaration, fieldName, value) {
8143
+ const subprogramBlock = scriptDeclaration.block;
8144
+ if (subprogramBlock === void 0) {
8145
+ return void 0;
8146
+ }
8147
+ const lastAssignmentStatement = this.findLastAssignmentToField(analyzer, subprogramBlock, fieldName);
8148
+ let result;
8149
+ if (lastAssignmentStatement !== void 0) {
8150
+ result = new SourceFileEdit(sourceFile, lastAssignmentStatement.right.rangeWithoutTrivia, value);
8151
+ } else {
8152
+ const assignmentText = `${_ScriptEditingService.elementParameterNameText}.${fieldName} = ${value}`;
8153
+ if (subprogramBlock.expressionOrStatementList.kind === 93 /* StatementList */) {
8154
+ const lastStatement = subprogramBlock.expressionOrStatementList?.statements.last();
8155
+ let editRange;
8156
+ let indentationText;
8157
+ if (lastStatement !== void 0) {
8158
+ editRange = Range.empty(lastStatement.rangeWithoutTrivia.end);
8159
+ const statementStartCharacter = sourceFile.getPositionAt(lastStatement.rangeWithoutTrivia.start).character;
8160
+ indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(statementStartCharacter)}`;
8161
+ } else {
8162
+ const openBraceRange = subprogramBlock.openBraceToken.rangeWithoutTrivia;
8163
+ const closeBraceRange = subprogramBlock.closeBraceToken.rangeWithoutTrivia;
8164
+ const openBracePosition = sourceFile.getPositionAt(openBraceRange.start);
8165
+ const closeBracePosition = sourceFile.getPositionAt(closeBraceRange.start);
8166
+ if (openBracePosition.line !== closeBracePosition.line) {
8167
+ editRange = Range.empty(openBraceRange.end);
8168
+ indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(closeBracePosition.character + 2)}`;
8169
+ } else {
8170
+ editRange = Range.empty(openBraceRange.end);
8171
+ indentationText = " ";
8172
+ }
8173
+ }
8174
+ result = new SourceFileEdit(sourceFile, editRange, `${indentationText}${assignmentText}`);
8175
+ } else {
8176
+ const expressionStartCharacter = sourceFile.getPositionAt(subprogramBlock.expressionOrStatementList.rangeWithoutTrivia.start).character;
8177
+ const indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(expressionStartCharacter)}`;
8178
+ const editRange = Range.empty(subprogramBlock.expressionOrStatementList.rangeWithoutTrivia.end);
8179
+ result = new SourceFileEdit(sourceFile, editRange, `${indentationText}${assignmentText}`);
8180
+ }
8181
+ }
8182
+ return result;
8183
+ }
8184
+ createEditAddingBlocks(sourceFile, scriptDeclaration, addedBlockInfos) {
8185
+ const subprogramBlock = scriptDeclaration.block;
8186
+ if (subprogramBlock === void 0) {
8187
+ return void 0;
8188
+ }
8189
+ let scriptBlockIndentation;
8190
+ let editStart;
8191
+ if (subprogramBlock.expressionOrStatementList.kind === 93 /* StatementList */) {
8192
+ const lastStatement = subprogramBlock.expressionOrStatementList.statements.last();
8193
+ if (lastStatement !== void 0) {
8194
+ const lastStatementStartCharacter = sourceFile.getPositionAt(lastStatement.rangeWithoutTrivia.start).character;
8195
+ scriptBlockIndentation = " ".repeat(lastStatementStartCharacter);
8196
+ editStart = lastStatement.rangeWithoutTrivia.end;
8197
+ } else {
8198
+ const openBraceStartCharacter = sourceFile.getPositionAt(subprogramBlock.openBraceToken.rangeWithoutTrivia.start).character;
8199
+ scriptBlockIndentation = " ".repeat(openBraceStartCharacter) + _ScriptEditingService.indentationStep;
8200
+ editStart = subprogramBlock.openBraceToken.rangeWithoutTrivia.end;
8201
+ }
8202
+ } else {
8203
+ const expressionStartCharacter = sourceFile.getPositionAt(subprogramBlock.expressionOrStatementList.rangeWithoutTrivia.start).character;
8204
+ scriptBlockIndentation = " ".repeat(expressionStartCharacter);
8205
+ editStart = subprogramBlock.expressionOrStatementList.rangeWithoutTrivia.end;
8206
+ }
8207
+ const newLine = this.detectNewLine(sourceFile.getSourceText());
8208
+ const scriptBlocksText = addedBlockInfos.map((i) => this.createScriptBlockText(i, scriptBlockIndentation, newLine)).join(newLine);
8209
+ const editText = `${newLine}${scriptBlocksText}`;
8210
+ const result = new SourceFileEdit(sourceFile, Range.empty(editStart), editText);
8211
+ return result;
8212
+ }
8213
+ canDeleteBlocks(outerScriptFunctionLocation, scriptFunctionLocations) {
8214
+ const outerScriptPathText = outerScriptFunctionLocation.path.toString();
8215
+ return scriptFunctionLocations.every((l) => l.sourceFile === outerScriptFunctionLocation.sourceFile && l.path.toString().startsWith(outerScriptPathText));
8216
+ }
8217
+ createEditDeletingBlock(sourceFile, scriptDeclaration) {
8218
+ let result;
8219
+ if (NodeTypeUtils.isRegularOrBlockFunctionLiteral(scriptDeclaration) && scriptDeclaration.parent.kind === 150 /* Argument */ && scriptDeclaration.parent.parent.parent.kind === 68 /* CallExpression */) {
8220
+ const callExpression = scriptDeclaration.parent.parent.parent;
8221
+ let rangeStart = callExpression.rangeWithoutTrivia.start;
8222
+ let rangeEnd = callExpression.rangeWithoutTrivia.end;
8223
+ const leadingTrivia = callExpression.findLeftmostToken()?.selectLeadingTrivia(() => true);
8224
+ const lastLeadingTrivia = leadingTrivia !== void 0 && leadingTrivia.length > 0 ? leadingTrivia[leadingTrivia.length - 1] : void 0;
8225
+ if (lastLeadingTrivia?.kind === 0 /* Whitespace */) {
8226
+ rangeStart = lastLeadingTrivia.range.start;
8227
+ }
8228
+ const trailingTrivia = callExpression.findRightmostToken()?.selectTrailingTrivia(() => true);
8229
+ if (trailingTrivia !== void 0) {
8230
+ let trailingTriviaIndex = -1;
8231
+ if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 0 /* Whitespace */) {
8232
+ trailingTriviaIndex++;
8233
+ }
8234
+ if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 1 /* NewLine */) {
8235
+ trailingTriviaIndex++;
8236
+ }
8237
+ if (trailingTriviaIndex >= 0) {
8238
+ rangeEnd = trailingTrivia[trailingTriviaIndex].range.end;
8239
+ }
8240
+ }
8241
+ result = new SourceFileEdit(sourceFile, new Range(rangeStart, rangeEnd), "");
8242
+ }
8243
+ return result;
8244
+ }
8245
+ findLastAssignmentToField(analyzer, block, fieldNameText) {
8246
+ if (block.expressionOrStatementList.kind !== 93 /* StatementList */) {
8247
+ return void 0;
8248
+ }
8249
+ const fieldName = new Name(fieldNameText);
8250
+ const statements = block.expressionOrStatementList.statements.toArray();
8251
+ for (let i = statements.length - 1; i >= 0; i--) {
8252
+ const statement = statements[i];
8253
+ if (statement.kind === 92 /* AssignmentStatement */) {
8254
+ const left = unwrapParenthesizedExpressions(statement.left);
8255
+ if (left.kind === 76 /* MemberAccessExpression */) {
8256
+ const memberAccessMeaning = analyzer.resolveMemberAccessExpression(left);
8257
+ if (memberAccessMeaning.kind === "instance-field-access" && memberAccessMeaning.field.getName().considerEqual(fieldName)) {
8258
+ const receiver = unwrapParenthesizedExpressions(left.expression);
8259
+ if (receiver.kind === 89 /* IdentifierExpression */) {
8260
+ const receiverMeaning = analyzer.resolveIdentifierExpression(receiver);
8261
+ if (receiverMeaning.kind === "variable-access" && receiverMeaning.variable.getName().considerEqual(_ScriptEditingService.elementParameterName)) {
8262
+ return statement;
8263
+ }
8264
+ }
8265
+ }
8266
+ }
8267
+ }
8268
+ }
8269
+ return void 0;
8270
+ }
8271
+ createScriptBlockText(blockInfo, indentation, newLine) {
8272
+ const i = indentation;
8273
+ const s = _ScriptEditingService.indentationStep;
8274
+ const nl = newLine;
8275
+ const el = _ScriptEditingService.elementParameterNameText;
8276
+ let result = `${i}${blockInfo.name}(${nl}${i}${s}key = ${blockInfo.key},${nl}`;
8277
+ if (blockInfo.areaIndex !== void 0) {
8278
+ result += `${i}${s}areaIndex = ${blockInfo.areaIndex},${nl}`;
8279
+ }
8280
+ result += `${i}${s}script =${nl}${i}${s}{${nl}` + Object.entries(blockInfo.elementProperties).map(([p, v]) => `${i}${s}${s}${el}.${p} = ${v}${nl}`).join("");
8281
+ if (blockInfo.nestedBlocks.length > 0) {
8282
+ result += blockInfo.nestedBlocks.map((b) => this.createScriptBlockText(b, `${i}${s}${s}`, nl) + nl).join("");
8283
+ }
8284
+ result += `${i}${s}})`;
8285
+ return result;
8286
+ }
8287
+ detectNewLine(text) {
8288
+ return text.includes("\r\n") ? "\r\n" : "\n";
8289
+ }
8290
+ };
8291
+
8473
8292
  // source/services/SelectionRangeService.ts
8474
8293
  var SelectionRangeService = class {
8475
8294
  getSelectionRange(sourceFile, offset) {
@@ -8489,13 +8308,13 @@ var SelectionRangeService = class {
8489
8308
  if (!this.nodeShouldBeSkipped(child) && !child.rangeWithoutTrivia.equals(result.range)) {
8490
8309
  result = new SelectionRange(child.rangeWithoutTrivia, result);
8491
8310
  }
8492
- if (child.kind === 0 /* Token */ && (child.tokenKind === 6 /* TextLiteral */ || child.tokenKind === 7 /* TextTemplateHead */ || child.tokenKind === 8 /* TextTemplatePart */ || child.tokenKind === 9 /* TextTemplateTail */ || child.tokenKind === 5 /* CharLiteral */)) {
8311
+ if (child.kind === 0 /* Token */ && (child.tokenKind === 5 /* TextLiteral */ || child.tokenKind === 6 /* TextTemplateHead */ || child.tokenKind === 7 /* TextTemplatePart */ || child.tokenKind === 8 /* TextTemplateTail */)) {
8493
8312
  let textContentStart = child.rangeWithoutTrivia.start + 1;
8494
8313
  let textContentEnd = child.rangeWithoutTrivia.end - 1;
8495
- if ((child.flags & 128 /* StartsWithTilde */) !== 0) {
8314
+ if ((child.flags & 512 /* StartsWithTilde */) !== 0) {
8496
8315
  textContentStart += 1;
8497
8316
  }
8498
- if ((child.flags & 256 /* EndsWithTilde */) !== 0) {
8317
+ if ((child.flags & 1024 /* EndsWithTilde */) !== 0) {
8499
8318
  textContentEnd -= 1;
8500
8319
  }
8501
8320
  if (offset >= textContentStart && offset < textContentEnd) {
@@ -8508,7 +8327,7 @@ var SelectionRangeService = class {
8508
8327
  }
8509
8328
  nodeContainsOffset(node, offset, searchInTrivia) {
8510
8329
  const range = searchInTrivia ? node.rangeWithTrivia : node.rangeWithoutTrivia;
8511
- if (node.kind === 0 /* Token */ && node.tokenKind === 10 /* Identifier */ || node.kind === 3 /* Keyword */) {
8330
+ if (node.kind === 0 /* Token */ && node.tokenKind === 9 /* Identifier */ || node.kind === 3 /* Keyword */) {
8512
8331
  return offset >= range.start && offset <= range.end;
8513
8332
  } else {
8514
8333
  return offset >= range.start && offset < range.end;
@@ -8517,9 +8336,9 @@ var SelectionRangeService = class {
8517
8336
  nodeShouldBeSkipped(node) {
8518
8337
  if (node.kind === 0 /* Token */) {
8519
8338
  switch (node.tokenKind) {
8520
- case 7 /* TextTemplateHead */:
8521
- case 8 /* TextTemplatePart */:
8522
- case 9 /* TextTemplateTail */:
8339
+ case 6 /* TextTemplateHead */:
8340
+ case 7 /* TextTemplatePart */:
8341
+ case 8 /* TextTemplateTail */:
8523
8342
  return true;
8524
8343
  default:
8525
8344
  return false;
@@ -8571,7 +8390,7 @@ var SemanticTokensService = class {
8571
8390
  return;
8572
8391
  }
8573
8392
  if (node.kind === 89 /* IdentifierExpression */) {
8574
- const meaning = analyzer.resolveIdentifierExpression(node).meaning;
8393
+ const meaning = analyzer.resolveIdentifierExpression(node);
8575
8394
  if (meaning.kind === "variable-access") {
8576
8395
  const variable = meaning.variable.getEntity();
8577
8396
  if (variable.subkind === "field" && variable.isVariant()) {
@@ -8625,7 +8444,7 @@ var SemanticTokensService = class {
8625
8444
  }
8626
8445
  }
8627
8446
  if (node.kind === 76 /* MemberAccessExpression */) {
8628
- const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
8447
+ const meaning = analyzer.resolveMemberAccessExpression(node);
8629
8448
  if (meaning.kind === "static-field-access") {
8630
8449
  const entity = meaning.field.getEntity();
8631
8450
  if (entity.subkind === "field" && entity.isVariant()) {
@@ -8668,7 +8487,7 @@ var SemanticTokensService = class {
8668
8487
  ));
8669
8488
  }
8670
8489
  }
8671
- if (node.kind === 147 /* VariantDeclaration */) {
8490
+ if (node.kind === 147 /* VariantValueDeclaration */) {
8672
8491
  result.push(
8673
8492
  new SemanticToken(
8674
8493
  node.name.rangeWithoutTrivia,
@@ -8932,7 +8751,7 @@ var TypeParameterSignatureHelpProvider = class {
8932
8751
  getSignaturesForGenericSpecializationExpression(node) {
8933
8752
  const expression = unwrapParenthesizedExpressions(node.expression);
8934
8753
  if (expression.kind === 89 /* IdentifierExpression */) {
8935
- const meaning = this.analyzer.resolveIdentifierExpression(expression).meaning;
8754
+ const meaning = this.analyzer.resolveIdentifierExpression(expression);
8936
8755
  if (meaning.kind === "function-access") {
8937
8756
  return Query.from(meaning.candidates).mapAndFilter((f) => this.getSignatureForAccessedFunction(f)).toArray();
8938
8757
  }
@@ -8945,7 +8764,7 @@ var TypeParameterSignatureHelpProvider = class {
8945
8764
  return void 0;
8946
8765
  }
8947
8766
  if (expression.kind === 76 /* MemberAccessExpression */) {
8948
- const meaning = this.analyzer.resolveMemberAccessExpression(expression).meaning;
8767
+ const meaning = this.analyzer.resolveMemberAccessExpression(expression);
8949
8768
  let accessedFunctions;
8950
8769
  if (meaning.kind === "instance-method-access") {
8951
8770
  accessedFunctions = meaning.candidates;
@@ -11786,56 +11605,40 @@ var EntityToSyntax = class {
11786
11605
  }
11787
11606
  }
11788
11607
  convertPackageVariable(entity) {
11789
- const commonModifiers = new Array();
11790
- if (entity.isConstant()) {
11791
- commonModifiers.push(SyntaxFactory.modifier(36 /* Const */));
11792
- }
11793
11608
  const name = this.getEntityName(entity);
11794
11609
  const type = this.convertType(entity.getType());
11610
+ const tags = this.convertTags(entity.getTags());
11611
+ const modifiers = this.convertPackageVariableModifiers(entity);
11795
11612
  let result;
11796
11613
  if (isComputedVariableEntity(entity)) {
11797
11614
  result = [];
11798
11615
  const getterEntity = entity.getGetter();
11799
11616
  if (getterEntity !== void 0) {
11800
- const tags = this.convertTags(getterEntity.getTags());
11801
- const modifiers = Array.from(commonModifiers);
11802
- const isHidden = getterEntity.isHidden();
11803
- if (isHidden !== void 0) {
11804
- modifiers.push(this.createHidingModifier(isHidden));
11805
- }
11806
11617
  result.push(SyntaxFactory.packageVariableGetterDeclaration(tags, modifiers, name, type, void 0));
11807
11618
  }
11808
11619
  const setterEntity = entity.getSetter();
11809
11620
  if (setterEntity !== void 0) {
11810
- const tags = this.convertTags(setterEntity.getTags());
11811
- const modifiers = Array.from(commonModifiers);
11812
- const isHidden = setterEntity.isHidden();
11813
- if (isHidden !== void 0) {
11814
- modifiers.push(this.createHidingModifier(isHidden));
11815
- }
11816
11621
  result.push(SyntaxFactory.packageVariableSetterDeclaration(tags, modifiers, name, void 0));
11817
11622
  }
11818
11623
  } else {
11819
- const tags = this.convertTags(entity.getTags());
11820
- const modifiers = Array.from(commonModifiers);
11821
- const isHidden = entity.isHidden();
11822
- if (isHidden !== void 0) {
11823
- modifiers.push(this.createHidingModifier(isHidden));
11824
- }
11825
11624
  result = SyntaxFactory.packageVariableDeclaration(tags, modifiers, name, type);
11826
11625
  }
11827
11626
  return result;
11828
11627
  }
11829
- convertPackageFunction(entity) {
11830
- const tags = this.convertTags(entity.getTags());
11628
+ convertPackageVariableModifiers(entity) {
11831
11629
  const modifiers = new Array();
11832
- if (entity.isAsync()) {
11833
- modifiers.push(SyntaxFactory.modifier(40 /* Async */));
11834
- }
11835
11630
  const isHidden = entity.isHidden();
11836
11631
  if (isHidden !== void 0) {
11837
11632
  modifiers.push(this.createHidingModifier(isHidden));
11838
11633
  }
11634
+ if (entity.isConstant()) {
11635
+ modifiers.push(SyntaxFactory.modifier(36 /* Const */));
11636
+ }
11637
+ return modifiers;
11638
+ }
11639
+ convertPackageFunction(entity) {
11640
+ const tags = this.convertTags(entity.getTags());
11641
+ const modifiers = this.convertPackageFunctionModifiers(entity);
11839
11642
  const name = this.getEntityName(entity);
11840
11643
  const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
11841
11644
  const parameters = this.convertParameters(entity.getParameters());
@@ -11850,60 +11653,87 @@ var EntityToSyntax = class {
11850
11653
  void 0
11851
11654
  );
11852
11655
  }
11853
- convertPackageStructuredType(entity) {
11854
- const tags = this.convertTags(entity.getTags());
11656
+ convertPackageFunctionModifiers(entity) {
11855
11657
  const modifiers = new Array();
11856
11658
  const isHidden = entity.isHidden();
11857
11659
  if (isHidden !== void 0) {
11858
11660
  modifiers.push(this.createHidingModifier(isHidden));
11859
11661
  }
11860
- if (entity.markedBasic()) {
11861
- modifiers.push(SyntaxFactory.modifier(17 /* Basic */));
11862
- }
11863
- if (entity.isAbstract()) {
11864
- modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
11662
+ if (entity.isAsync()) {
11663
+ modifiers.push(SyntaxFactory.modifier(40 /* Async */));
11865
11664
  }
11665
+ return modifiers;
11666
+ }
11667
+ convertPackageStructuredType(entity) {
11668
+ const tags = this.convertTags(entity.getTags());
11669
+ const modifiers = this.convertPackageStructuredTypeModifiers(entity);
11866
11670
  const name = this.getEntityName(entity);
11867
11671
  const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
11868
11672
  const body = this.createStructuredTypeDeclarationBody(entity);
11869
11673
  return SyntaxFactory.packageStructuredTypeDeclaration(tags, modifiers, name, typeParameters, body);
11870
11674
  }
11871
- convertPackageAliasType(entity) {
11872
- const tags = this.convertTags(entity.getTags());
11675
+ convertPackageStructuredTypeModifiers(entity) {
11873
11676
  const modifiers = new Array();
11874
11677
  const isHidden = entity.isHidden();
11875
11678
  if (isHidden !== void 0) {
11876
11679
  modifiers.push(this.createHidingModifier(isHidden));
11877
11680
  }
11681
+ if (entity.markedBasic()) {
11682
+ modifiers.push(SyntaxFactory.modifier(17 /* Basic */));
11683
+ }
11684
+ if (entity.isAbstract()) {
11685
+ modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
11686
+ }
11687
+ return modifiers;
11688
+ }
11689
+ convertPackageAliasType(entity) {
11690
+ const tags = this.convertTags(entity.getTags());
11691
+ const modifiers = this.convertPackageAliasTypeModifiers(entity);
11878
11692
  const name = this.getEntityName(entity);
11879
11693
  const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
11880
11694
  const body = this.createAliasTypeDeclarationBody(entity);
11881
11695
  return SyntaxFactory.packageAliasTypeDeclaration(tags, modifiers, name, typeParameters, body);
11882
11696
  }
11883
- convertPackageVariantType(entity) {
11884
- const tags = this.convertTags(entity.getTags());
11697
+ convertPackageAliasTypeModifiers(entity) {
11885
11698
  const modifiers = new Array();
11886
11699
  const isHidden = entity.isHidden();
11887
11700
  if (isHidden !== void 0) {
11888
11701
  modifiers.push(this.createHidingModifier(isHidden));
11889
11702
  }
11703
+ return modifiers;
11704
+ }
11705
+ convertPackageVariantType(entity) {
11706
+ const tags = this.convertTags(entity.getTags());
11707
+ const modifiers = this.convertPackageVariantTypeModifiers(entity);
11890
11708
  const name = this.getEntityName(entity);
11891
11709
  const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
11892
11710
  const body = this.createVariantTypeDeclarationBody(entity);
11893
11711
  return SyntaxFactory.packageVariantTypeDeclaration(tags, modifiers, name, typeParameters, body);
11894
11712
  }
11895
- convertPackageFunctionType(entity) {
11896
- const tags = this.convertTags(entity.getTags());
11713
+ convertPackageVariantTypeModifiers(entity) {
11897
11714
  const modifiers = new Array();
11898
11715
  const isHidden = entity.isHidden();
11899
11716
  if (isHidden !== void 0) {
11900
11717
  modifiers.push(this.createHidingModifier(isHidden));
11901
11718
  }
11719
+ return modifiers;
11720
+ }
11721
+ convertPackageFunctionType(entity) {
11722
+ const tags = this.convertTags(entity.getTags());
11723
+ const modifiers = this.convertPackageFunctionTypeModifiers(entity);
11902
11724
  const name = this.getEntityName(entity);
11903
11725
  const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
11904
11726
  const body = this.createFunctionTypeDeclarationBody(entity);
11905
11727
  return SyntaxFactory.packageFunctionTypeDeclaration(tags, modifiers, name, typeParameters, body);
11906
11728
  }
11729
+ convertPackageFunctionTypeModifiers(entity) {
11730
+ const modifiers = new Array();
11731
+ const isHidden = entity.isHidden();
11732
+ if (isHidden !== void 0) {
11733
+ modifiers.push(this.createHidingModifier(isHidden));
11734
+ }
11735
+ return modifiers;
11736
+ }
11907
11737
  convertTypeEntityMembers(members) {
11908
11738
  const variables = members.getNamedMembers().filter((m) => m.kind === 0 /* Variable */).flatMap((m) => this.convertField(m));
11909
11739
  const methods = members.getNamedMembers().filter((m) => m.kind !== 0 /* Variable */).map((m) => this.convertMethod(m));
@@ -11916,60 +11746,27 @@ var EntityToSyntax = class {
11916
11746
  if (entity.isVariant()) {
11917
11747
  return this.convertVariant(entity);
11918
11748
  }
11919
- const commonModifiers = new Array();
11920
- if (entity.isConstant()) {
11921
- commonModifiers.push(SyntaxFactory.modifier(36 /* Const */));
11922
- }
11923
- if (entity.isStatic()) {
11924
- commonModifiers.push(SyntaxFactory.modifier(41 /* Static */));
11925
- }
11926
- if (entity.markedAbstract()) {
11927
- commonModifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
11928
- }
11929
- if (entity.markedBasic()) {
11930
- commonModifiers.push(SyntaxFactory.modifier(17 /* Basic */));
11931
- }
11932
- if (entity.isOverride()) {
11933
- commonModifiers.push(SyntaxFactory.modifier(39 /* Override */));
11934
- }
11935
11749
  const name = this.getEntityName(entity);
11936
11750
  const type = this.convertType(entity.getType());
11751
+ const tags = this.convertTags(entity.getTags());
11752
+ const modifiers = this.convertFieldModifiers(entity);
11937
11753
  let result;
11938
11754
  if (isComputedVariableEntity(entity)) {
11939
11755
  result = [];
11940
11756
  const getterEntity = entity.getGetter();
11941
11757
  if (getterEntity !== void 0) {
11942
- const tags = this.convertTags(getterEntity.getTags());
11943
- const modifiers = Array.from(commonModifiers);
11944
- const isHidden = getterEntity.isHidden();
11945
- if (isHidden !== void 0) {
11946
- modifiers.push(this.createHidingModifier(isHidden));
11947
- }
11948
11758
  result.push(SyntaxFactory.fieldGetterDeclaration(tags, modifiers, name, type, void 0));
11949
11759
  }
11950
11760
  const setterEntity = entity.getSetter();
11951
11761
  if (setterEntity !== void 0) {
11952
- const tags = this.convertTags(setterEntity.getTags());
11953
- const modifiers = Array.from(commonModifiers);
11954
- const isHidden = setterEntity.isHidden();
11955
- if (isHidden !== void 0) {
11956
- modifiers.push(this.createHidingModifier(isHidden));
11957
- }
11958
11762
  result.push(SyntaxFactory.fieldSetterDeclaration(tags, modifiers, name, void 0));
11959
11763
  }
11960
11764
  } else {
11961
- const tags = this.convertTags(entity.getTags());
11962
- const modifiers = Array.from(commonModifiers);
11963
- const isHidden = entity.isHidden();
11964
- if (isHidden !== void 0) {
11965
- modifiers.push(this.createHidingModifier(isHidden));
11966
- }
11967
- result = SyntaxFactory.fieldDeclaration(tags, commonModifiers, name, type);
11765
+ result = SyntaxFactory.fieldDeclaration(tags, modifiers, name, type);
11968
11766
  }
11969
11767
  return result;
11970
11768
  }
11971
- convertMethod(entity) {
11972
- const tags = this.convertTags(entity.getTags());
11769
+ convertFieldModifiers(entity) {
11973
11770
  const modifiers = new Array();
11974
11771
  const isHidden = entity.isHidden();
11975
11772
  if (isHidden !== void 0) {
@@ -11978,36 +11775,56 @@ var EntityToSyntax = class {
11978
11775
  if (entity.isStatic()) {
11979
11776
  modifiers.push(SyntaxFactory.modifier(41 /* Static */));
11980
11777
  }
11981
- if (entity.markedAbstract()) {
11982
- modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
11983
- }
11984
11778
  if (entity.markedBasic()) {
11985
11779
  modifiers.push(SyntaxFactory.modifier(17 /* Basic */));
11986
11780
  }
11781
+ if (entity.markedAbstract()) {
11782
+ modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
11783
+ }
11987
11784
  if (entity.isOverride()) {
11988
11785
  modifiers.push(SyntaxFactory.modifier(39 /* Override */));
11989
11786
  }
11787
+ if (entity.isConstant()) {
11788
+ modifiers.push(SyntaxFactory.modifier(36 /* Const */));
11789
+ }
11790
+ return modifiers;
11791
+ }
11792
+ convertMethod(entity) {
11793
+ const tags = this.convertTags(entity.getTags());
11794
+ const modifiers = this.convertMethodModifiers(entity);
11990
11795
  const name = this.getEntityName(entity);
11991
11796
  const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
11992
11797
  const parameters = this.convertParameters(entity.getParameters());
11993
11798
  const returnType = this.convertType(entity.getReturnType());
11994
11799
  return SyntaxFactory.methodDeclaration(tags, modifiers, name, typeParameters, parameters, returnType, void 0);
11995
11800
  }
11996
- convertConstructor(entity) {
11997
- const tags = this.convertTags(entity.getTags());
11801
+ convertMethodModifiers(entity) {
11998
11802
  const modifiers = new Array();
11999
11803
  const isHidden = entity.isHidden();
12000
11804
  if (isHidden !== void 0) {
12001
11805
  modifiers.push(this.createHidingModifier(isHidden));
12002
11806
  }
11807
+ if (entity.isStatic()) {
11808
+ modifiers.push(SyntaxFactory.modifier(41 /* Static */));
11809
+ }
11810
+ if (entity.markedBasic()) {
11811
+ modifiers.push(SyntaxFactory.modifier(17 /* Basic */));
11812
+ }
12003
11813
  if (entity.markedAbstract()) {
12004
11814
  modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
12005
11815
  }
11816
+ if (entity.isOverride()) {
11817
+ modifiers.push(SyntaxFactory.modifier(39 /* Override */));
11818
+ }
11819
+ return modifiers;
11820
+ }
11821
+ convertConstructor(entity) {
11822
+ const tags = this.convertTags(entity.getTags());
11823
+ const modifiers = this.convertConstructorModifiers(entity);
12006
11824
  const parameters = this.convertParameters(entity.getParameters());
12007
11825
  return SyntaxFactory.constructorDeclaration(tags, modifiers, parameters, void 0);
12008
11826
  }
12009
- convertDestructor(entity) {
12010
- const tags = this.convertTags(entity.getTags());
11827
+ convertConstructorModifiers(entity) {
12011
11828
  const modifiers = new Array();
12012
11829
  const isHidden = entity.isHidden();
12013
11830
  if (isHidden !== void 0) {
@@ -12016,44 +11833,61 @@ var EntityToSyntax = class {
12016
11833
  if (entity.markedAbstract()) {
12017
11834
  modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
12018
11835
  }
11836
+ return modifiers;
11837
+ }
11838
+ convertDestructor(entity) {
11839
+ const tags = this.convertTags(entity.getTags());
11840
+ const modifiers = this.convertDestructorModifiers(entity);
12019
11841
  const parameters = this.convertParameters(entity.getParameters());
12020
11842
  return SyntaxFactory.destructorDeclaration(tags, modifiers, parameters, void 0);
12021
11843
  }
12022
- convertIndexer(entity) {
12023
- const commonModifiers = new Array();
12024
- if (entity.isStatic()) {
12025
- commonModifiers.push(SyntaxFactory.modifier(41 /* Static */));
11844
+ convertDestructorModifiers(entity) {
11845
+ const modifiers = new Array();
11846
+ const isHidden = entity.isHidden();
11847
+ if (isHidden !== void 0) {
11848
+ modifiers.push(this.createHidingModifier(isHidden));
12026
11849
  }
12027
11850
  if (entity.markedAbstract()) {
12028
- commonModifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
11851
+ modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
12029
11852
  }
11853
+ return modifiers;
11854
+ }
11855
+ convertIndexer(entity) {
11856
+ const tags = this.convertTags(entity.getTags());
11857
+ const modifiers = this.convertIndexerModifiers(entity);
12030
11858
  const parameters = this.convertParameters(entity.getParameters());
12031
11859
  const result = new Array();
12032
11860
  const getterEntity = entity.getGetter();
12033
11861
  if (getterEntity !== void 0) {
12034
- const tags = this.convertTags(getterEntity.getTags());
12035
- const modifiers = Array.from(commonModifiers);
12036
- const isHidden = entity.isHidden();
12037
- if (isHidden !== void 0) {
12038
- modifiers.push(this.createHidingModifier(isHidden));
12039
- }
12040
11862
  const type = this.convertType(entity.getType());
12041
11863
  const declaration = SyntaxFactory.indexedElementGetterDeclaration(tags, modifiers, parameters, type, void 0);
12042
11864
  result.push(declaration);
12043
11865
  }
12044
11866
  const setterEntity = entity.getSetter();
12045
11867
  if (setterEntity !== void 0) {
12046
- const tags = this.convertTags(setterEntity.getTags());
12047
- const modifiers = Array.from(commonModifiers);
12048
11868
  const declaration = SyntaxFactory.indexedElementSetterDeclaration(tags, modifiers, parameters, void 0);
12049
11869
  result.push(declaration);
12050
11870
  }
12051
11871
  return result;
12052
11872
  }
11873
+ convertIndexerModifiers(entity) {
11874
+ const modifiers = new Array();
11875
+ const isHidden = entity.isHidden();
11876
+ if (isHidden !== void 0) {
11877
+ modifiers.push(this.createHidingModifier(isHidden));
11878
+ }
11879
+ if (entity.isStatic()) {
11880
+ modifiers.push(SyntaxFactory.modifier(41 /* Static */));
11881
+ }
11882
+ if (entity.markedAbstract()) {
11883
+ modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
11884
+ }
11885
+ return modifiers;
11886
+ }
12053
11887
  convertVariant(entity) {
12054
11888
  const tags = this.convertTags(entity.getTags());
12055
11889
  const name = this.getEntityName(entity);
12056
- return SyntaxFactory.variantDeclaration(tags, [], name);
11890
+ return SyntaxFactory.variantValueDeclaration(tags, [], name);
12057
11891
  }
12058
11892
  createStructuredTypeDeclarationBody(entity) {
12059
11893
  let structuredTypeKindKeyword;
@@ -12184,6 +12018,8 @@ var EntityToSyntax = class {
12184
12018
  return this.convertIntersectionType(type);
12185
12019
  case "unresolved":
12186
12020
  return this.convertUnresolvedType(type);
12021
+ case "substitution-stub":
12022
+ return this.convertSubstitutionStubType(type);
12187
12023
  default:
12188
12024
  Debug.never(type);
12189
12025
  }
@@ -12245,6 +12081,9 @@ var EntityToSyntax = class {
12245
12081
  convertUnresolvedType(_type) {
12246
12082
  return SyntaxFactory.namedTypeSpecifier("\u041E\u0431\u044A\u0435\u043A\u0442");
12247
12083
  }
12084
+ convertSubstitutionStubType(_type) {
12085
+ return SyntaxFactory.namedTypeSpecifier("\u041E\u0431\u044A\u0435\u043A\u0442");
12086
+ }
12248
12087
  createNamedTypeSpecifier(name, substitutions) {
12249
12088
  const typeArguments = Query.from(substitutions.getTypes()).map((t) => this.convertType(t)).toArray();
12250
12089
  return SyntaxFactory.namedTypeSpecifier(name, typeArguments);
@@ -12656,184 +12495,481 @@ var EntityFinder = class {
12656
12495
  Debug.never(entity);
12657
12496
  }
12658
12497
  }
12659
- findConstructorEntity(entity) {
12660
- const containingType = this.findEntity(entity.getContainingEntity());
12661
- if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12662
- return void 0;
12663
- }
12664
- const members = containingType.getMembers().getConstructors();
12665
- if (members.length === 0) {
12666
- return void 0;
12667
- } else if (members.length === 1) {
12668
- return members[0];
12669
- } else {
12670
- const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12671
- const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12672
- const index = this.findOverloadedMemberIndex(referenceData, membersData);
12673
- return index >= 0 ? members[index] : void 0;
12498
+ findConstructorEntity(entity) {
12499
+ const containingType = this.findEntity(entity.getContainingEntity());
12500
+ if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12501
+ return void 0;
12502
+ }
12503
+ const members = containingType.getMembers().getConstructors();
12504
+ if (members.length === 0) {
12505
+ return void 0;
12506
+ } else if (members.length === 1) {
12507
+ return members[0];
12508
+ } else {
12509
+ const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12510
+ const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12511
+ const index = this.findOverloadedMemberIndex(referenceData, membersData);
12512
+ return index >= 0 ? members[index] : void 0;
12513
+ }
12514
+ }
12515
+ findDestructorEntity(entity) {
12516
+ const containingType = this.findEntity(entity.getContainingEntity());
12517
+ if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12518
+ return void 0;
12519
+ }
12520
+ const members = containingType.getMembers().getDestructors();
12521
+ if (members.length === 0) {
12522
+ return void 0;
12523
+ } else if (members.length === 1) {
12524
+ return members[0];
12525
+ } else {
12526
+ const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12527
+ const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12528
+ const index = this.findOverloadedMemberIndex(referenceData, membersData);
12529
+ return index >= 0 ? members[index] : void 0;
12530
+ }
12531
+ }
12532
+ findOperatorEntity(entity) {
12533
+ const containingType = this.findEntity(entity.getContainingEntity());
12534
+ if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12535
+ return void 0;
12536
+ }
12537
+ const members = containingType.getMembers().getOperators();
12538
+ if (members.length === 0) {
12539
+ return void 0;
12540
+ } else if (members.length === 1) {
12541
+ return members[0];
12542
+ } else {
12543
+ const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12544
+ const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12545
+ const index = this.findOverloadedMemberIndex(referenceData, membersData);
12546
+ return index >= 0 ? members[index] : void 0;
12547
+ }
12548
+ }
12549
+ findIndexerEntity(entity) {
12550
+ const containingType = this.findEntity(entity.getContainingEntity());
12551
+ if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12552
+ return void 0;
12553
+ }
12554
+ const members = containingType.getMembers().getIndexers();
12555
+ if (members.length === 0) {
12556
+ return void 0;
12557
+ } else if (members.length === 1) {
12558
+ return members[0];
12559
+ } else {
12560
+ const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12561
+ const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12562
+ const index = this.findOverloadedMemberIndex(referenceData, membersData);
12563
+ return index >= 0 ? members[index] : void 0;
12564
+ }
12565
+ }
12566
+ findDereferenceOperatorEntity(entity) {
12567
+ const containingType = this.findEntity(entity.getContainingEntity());
12568
+ if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12569
+ return void 0;
12570
+ }
12571
+ const members = containingType.getMembers().getDereferenceOperators();
12572
+ if (members.length === 0) {
12573
+ return void 0;
12574
+ } else if (members.length === 1) {
12575
+ return members[0];
12576
+ } else {
12577
+ return void 0;
12578
+ }
12579
+ }
12580
+ findTypeParameterEntity(entity) {
12581
+ const containingEntity = this.findEntity(entity.getContainingEntity());
12582
+ const index = entity.getContainingEntity().getTypeParameters().indexOf(entity);
12583
+ if (containingEntity !== void 0 && index >= 0) {
12584
+ return this.ifEntityWithTypeParametersThenParameters(containingEntity)?.[index];
12585
+ } else {
12586
+ return void 0;
12587
+ }
12588
+ }
12589
+ findPackageTypeEntityByNameAndArity(name, arity) {
12590
+ return this.packageEntity.getMembers().getNamedMembersByName(name).filter((m) => m.kind === 2 /* Type */).find((m) => m.getArity() === arity);
12591
+ }
12592
+ ifEntityWithParametersThenParameters(entity) {
12593
+ switch (entity.kind) {
12594
+ case 1 /* Function */:
12595
+ return entity.getParameters();
12596
+ case 5 /* Indexer */:
12597
+ return entity.getParameters();
12598
+ case 7 /* Constructor */:
12599
+ return entity.getParameters();
12600
+ case 8 /* Destructor */:
12601
+ return entity.getParameters();
12602
+ case 2 /* Type */: {
12603
+ if (entity.typeEntityKind === 0 /* Function */) {
12604
+ return entity.getParameters();
12605
+ }
12606
+ return void 0;
12607
+ }
12608
+ case 9 /* Operator */:
12609
+ return entity.getParameters();
12610
+ case 0 /* Variable */:
12611
+ case 3 /* Getter */:
12612
+ case 4 /* Setter */:
12613
+ case 10 /* PackageAlias */:
12614
+ case 12 /* Package */:
12615
+ case 11 /* TypeExtension */:
12616
+ case 6 /* DereferenceOperator */:
12617
+ return void 0;
12618
+ case 13 /* TextTranslation */:
12619
+ return void 0;
12620
+ default:
12621
+ Debug.never(entity);
12622
+ }
12623
+ }
12624
+ ifEntityWithTypeParametersThenParameters(entity) {
12625
+ switch (entity.kind) {
12626
+ case 1 /* Function */:
12627
+ return entity.getTypeParameters();
12628
+ case 2 /* Type */: {
12629
+ if (entity.typeEntityKind !== 2 /* Parameter */) {
12630
+ return entity.getTypeParameters();
12631
+ }
12632
+ return void 0;
12633
+ }
12634
+ case 8 /* Destructor */:
12635
+ case 7 /* Constructor */:
12636
+ case 5 /* Indexer */:
12637
+ case 6 /* DereferenceOperator */:
12638
+ case 0 /* Variable */:
12639
+ case 3 /* Getter */:
12640
+ case 4 /* Setter */:
12641
+ case 10 /* PackageAlias */:
12642
+ case 12 /* Package */:
12643
+ case 11 /* TypeExtension */:
12644
+ case 9 /* Operator */:
12645
+ case 13 /* TextTranslation */:
12646
+ return void 0;
12647
+ default:
12648
+ Debug.never(entity);
12649
+ }
12650
+ }
12651
+ findOverloadedMemberIndex(referenceData, membersData) {
12652
+ for (let i = 0; i < membersData.length; i++) {
12653
+ const memberData = membersData[i];
12654
+ if (memberData.typeParameters.length !== referenceData.typeParameters.length || memberData.parameters.length !== referenceData.parameters.length) {
12655
+ continue;
12656
+ }
12657
+ const parametersAreEqual = Query.zip(
12658
+ memberData.parameters,
12659
+ referenceData.parameters,
12660
+ (r, m) => this.getEntityName(r).considerEqual(this.getEntityName(m))
12661
+ ).all((v) => v);
12662
+ if (parametersAreEqual) {
12663
+ return i;
12664
+ }
12674
12665
  }
12666
+ return -1;
12675
12667
  }
12676
- findDestructorEntity(entity) {
12677
- const containingType = this.findEntity(entity.getContainingEntity());
12678
- if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12679
- return void 0;
12680
- }
12681
- const members = containingType.getMembers().getDestructors();
12682
- if (members.length === 0) {
12683
- return void 0;
12684
- } else if (members.length === 1) {
12685
- return members[0];
12686
- } else {
12687
- const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12688
- const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12689
- const index = this.findOverloadedMemberIndex(referenceData, membersData);
12690
- return index >= 0 ? members[index] : void 0;
12691
- }
12668
+ getEntityName(entity) {
12669
+ return entity.getName();
12692
12670
  }
12693
- findOperatorEntity(entity) {
12694
- const containingType = this.findEntity(entity.getContainingEntity());
12695
- if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12696
- return void 0;
12697
- }
12698
- const members = containingType.getMembers().getOperators();
12699
- if (members.length === 0) {
12700
- return void 0;
12701
- } else if (members.length === 1) {
12702
- return members[0];
12703
- } else {
12704
- const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12705
- const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12706
- const index = this.findOverloadedMemberIndex(referenceData, membersData);
12707
- return index >= 0 ? members[index] : void 0;
12708
- }
12671
+ };
12672
+ var DataForFindingOverloadedMember = class {
12673
+ constructor(typeParameters, parameters) {
12674
+ this.typeParameters = typeParameters;
12675
+ this.parameters = parameters;
12676
+ }
12677
+ };
12678
+
12679
+ // source/services/SourceFileItemsService.ts
12680
+ var SourceFileItemsService = class {
12681
+ getItems(sourceFile) {
12682
+ this.sourceFile = sourceFile;
12683
+ return this.getChildItems(sourceFile.getSyntaxNode());
12684
+ }
12685
+ get locale() {
12686
+ return this.sourceFile.package.locale;
12687
+ }
12688
+ get dialect() {
12689
+ return this.sourceFile.package.dialect;
12690
+ }
12691
+ getChildItems(node) {
12692
+ const result = new Array();
12693
+ visitChildren(node, false, (node2) => {
12694
+ const items = this.getChildItems(node2);
12695
+ switch (node2.kind) {
12696
+ case 8 /* PackageImport */: {
12697
+ if (node2.alias !== void 0) {
12698
+ result.push(this.createItem(
12699
+ 0 /* PackageAlias */,
12700
+ node2.alias.value,
12701
+ node2.rangeWithoutTrivia,
12702
+ node2.alias.rangeWithoutTrivia,
12703
+ items
12704
+ ));
12705
+ }
12706
+ break;
12707
+ }
12708
+ case 33 /* PackageVariableDeclaration */: {
12709
+ result.push(this.createItem(
12710
+ 1 /* PackageVariable */,
12711
+ node2.name.value,
12712
+ node2.rangeWithoutTrivia,
12713
+ node2.name.rangeWithoutTrivia,
12714
+ items
12715
+ ));
12716
+ break;
12717
+ }
12718
+ case 34 /* PackageVariableGetterDeclaration */: {
12719
+ result.push(this.createItem(
12720
+ 2 /* PackageVariableGetter */,
12721
+ node2.name.value,
12722
+ node2.rangeWithoutTrivia,
12723
+ node2.name.rangeWithoutTrivia,
12724
+ items
12725
+ ));
12726
+ break;
12727
+ }
12728
+ case 35 /* PackageVariableSetterDeclaration */: {
12729
+ result.push(this.createItem(
12730
+ 3 /* PackageVariableSetter */,
12731
+ node2.name.value,
12732
+ node2.rangeWithoutTrivia,
12733
+ node2.name.rangeWithoutTrivia,
12734
+ items
12735
+ ));
12736
+ break;
12737
+ }
12738
+ case 25 /* PackageFunctionDeclaration */: {
12739
+ result.push(this.createItem(
12740
+ 4 /* PackageFunction */,
12741
+ node2.name.value,
12742
+ node2.rangeWithoutTrivia,
12743
+ node2.name.rangeWithoutTrivia,
12744
+ items
12745
+ ));
12746
+ break;
12747
+ }
12748
+ case 31 /* PackageStructuredTypeDeclaration */: {
12749
+ result.push(this.createItem(
12750
+ 5 /* StructuredType */,
12751
+ node2.name.value,
12752
+ node2.rangeWithoutTrivia,
12753
+ node2.name.rangeWithoutTrivia,
12754
+ items
12755
+ ));
12756
+ break;
12757
+ }
12758
+ case 52 /* FieldDeclaration */: {
12759
+ result.push(this.createItem(
12760
+ 12 /* Field */,
12761
+ node2.name.value,
12762
+ node2.rangeWithoutTrivia,
12763
+ node2.name.rangeWithoutTrivia,
12764
+ items
12765
+ ));
12766
+ break;
12767
+ }
12768
+ case 53 /* FieldGetterDeclaration */: {
12769
+ result.push(this.createItem(
12770
+ 13 /* FieldGetter */,
12771
+ node2.name.value,
12772
+ node2.rangeWithoutTrivia,
12773
+ node2.name.rangeWithoutTrivia,
12774
+ items
12775
+ ));
12776
+ break;
12777
+ }
12778
+ case 54 /* FieldSetterDeclaration */: {
12779
+ result.push(this.createItem(
12780
+ 14 /* FieldSetter */,
12781
+ node2.name.value,
12782
+ node2.rangeWithoutTrivia,
12783
+ node2.name.rangeWithoutTrivia,
12784
+ items
12785
+ ));
12786
+ break;
12787
+ }
12788
+ case 50 /* MethodDeclaration */: {
12789
+ result.push(this.createItem(
12790
+ 15 /* Method */,
12791
+ node2.name.value,
12792
+ node2.rangeWithoutTrivia,
12793
+ node2.name.rangeWithoutTrivia,
12794
+ items
12795
+ ));
12796
+ break;
12797
+ }
12798
+ case 43 /* ConstructorDeclaration */: {
12799
+ result.push(this.createItem(
12800
+ 10 /* Constructor */,
12801
+ void 0,
12802
+ node2.rangeWithoutTrivia,
12803
+ node2.rangeWithoutTrivia,
12804
+ items
12805
+ ));
12806
+ break;
12807
+ }
12808
+ case 44 /* DestructorDeclaration */: {
12809
+ result.push(this.createItem(
12810
+ 11 /* Destructor */,
12811
+ void 0,
12812
+ node2.rangeWithoutTrivia,
12813
+ node2.rangeWithoutTrivia,
12814
+ items
12815
+ ));
12816
+ break;
12817
+ }
12818
+ case 45 /* IndexedElementGetterDeclaration */: {
12819
+ result.push(this.createItem(
12820
+ 16 /* IndexedElementGetter */,
12821
+ void 0,
12822
+ node2.rangeWithoutTrivia,
12823
+ node2.rangeWithoutTrivia,
12824
+ items
12825
+ ));
12826
+ break;
12827
+ }
12828
+ case 46 /* IndexedElementSetterDeclaration */: {
12829
+ result.push(this.createItem(
12830
+ 17 /* IndexedElementSetter */,
12831
+ void 0,
12832
+ node2.rangeWithoutTrivia,
12833
+ node2.rangeWithoutTrivia,
12834
+ items
12835
+ ));
12836
+ break;
12837
+ }
12838
+ case 26 /* PackageFunctionTypeDeclaration */: {
12839
+ result.push(this.createItem(
12840
+ 6 /* FunctionType */,
12841
+ node2.name.value,
12842
+ node2.rangeWithoutTrivia,
12843
+ node2.name.rangeWithoutTrivia,
12844
+ items
12845
+ ));
12846
+ break;
12847
+ }
12848
+ case 36 /* PackageVariantTypeDeclaration */: {
12849
+ result.push(this.createItem(
12850
+ 7 /* VariantType */,
12851
+ node2.name.value,
12852
+ node2.rangeWithoutTrivia,
12853
+ node2.name.rangeWithoutTrivia,
12854
+ items
12855
+ ));
12856
+ break;
12857
+ }
12858
+ case 147 /* VariantValueDeclaration */: {
12859
+ result.push(this.createItem(
12860
+ 9 /* VariantValue */,
12861
+ node2.name.value,
12862
+ node2.rangeWithoutTrivia,
12863
+ node2.name.rangeWithoutTrivia,
12864
+ items
12865
+ ));
12866
+ break;
12867
+ }
12868
+ case 148 /* TypeParameterDeclaration */: {
12869
+ result.push(this.createItem(
12870
+ 18 /* TypeParameter */,
12871
+ node2.name.value,
12872
+ node2.rangeWithoutTrivia,
12873
+ node2.name.rangeWithoutTrivia,
12874
+ items
12875
+ ));
12876
+ break;
12877
+ }
12878
+ case 56 /* NestedFunctionDeclaration */: {
12879
+ result.push(this.createItem(
12880
+ 19 /* NestedFunction */,
12881
+ node2.name.value,
12882
+ node2.rangeWithoutTrivia,
12883
+ node2.name.rangeWithoutTrivia,
12884
+ items
12885
+ ));
12886
+ break;
12887
+ }
12888
+ default: {
12889
+ result.push(...items);
12890
+ break;
12891
+ }
12892
+ }
12893
+ });
12894
+ return result;
12709
12895
  }
12710
- findIndexerEntity(entity) {
12711
- const containingType = this.findEntity(entity.getContainingEntity());
12712
- if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12713
- return void 0;
12714
- }
12715
- const members = containingType.getMembers().getIndexers();
12716
- if (members.length === 0) {
12717
- return void 0;
12718
- } else if (members.length === 1) {
12719
- return members[0];
12720
- } else {
12721
- const referenceData = new DataForFindingOverloadedMember([], entity.getParameters());
12722
- const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getParameters()));
12723
- const index = this.findOverloadedMemberIndex(referenceData, membersData);
12724
- return index >= 0 ? members[index] : void 0;
12725
- }
12896
+ createItem(kind, name, range, selectionRange, items) {
12897
+ const itemName = this.getNameOrStubIfEmpty(name, kind);
12898
+ return new Item(kind, itemName, range, selectionRange, items, this.sourceFile);
12726
12899
  }
12727
- findDereferenceOperatorEntity(entity) {
12728
- const containingType = this.findEntity(entity.getContainingEntity());
12729
- if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
12730
- return void 0;
12900
+ getNameOrStubIfEmpty(name, kind) {
12901
+ if (name !== void 0 && name.trim().length === 0) {
12902
+ name = void 0;
12731
12903
  }
12732
- const members = containingType.getMembers().getDereferenceOperators();
12733
- if (members.length === 0) {
12734
- return void 0;
12735
- } else if (members.length === 1) {
12736
- return members[0];
12737
- } else {
12738
- return void 0;
12904
+ switch (kind) {
12905
+ case 0 /* PackageAlias */:
12906
+ return name ?? `<${LocalizationHelper.localizeHelperPhrase(4 /* PackageAlias */, this.locale)}>`;
12907
+ case 1 /* PackageVariable */:
12908
+ case 12 /* Field */:
12909
+ return name ?? `<${LocalizationHelper.localizeHelperPhrase(6 /* Variable */, this.locale)}>`;
12910
+ case 4 /* PackageFunction */:
12911
+ case 15 /* Method */:
12912
+ case 19 /* NestedFunction */:
12913
+ return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(12 /* Function */, this.locale, this.dialect)}>`;
12914
+ case 5 /* StructuredType */:
12915
+ case 6 /* FunctionType */:
12916
+ case 7 /* VariantType */:
12917
+ case 8 /* InvalidType */:
12918
+ return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(16 /* Type */, this.locale, this.dialect)}>`;
12919
+ case 10 /* Constructor */:
12920
+ return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(31 /* Creation */, this.locale, this.dialect);
12921
+ case 11 /* Destructor */:
12922
+ return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(47 /* Destruction */, this.locale, this.dialect);
12923
+ case 9 /* VariantValue */:
12924
+ return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(6 /* Variant */, this.locale, this.dialect)}>`;
12925
+ case 18 /* TypeParameter */:
12926
+ return name ?? `<${LocalizationHelper.localizeHelperPhrase(2 /* TypeParameter */, this.locale)}>`;
12927
+ case 2 /* PackageVariableGetter */:
12928
+ case 13 /* FieldGetter */:
12929
+ return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Get */, this.locale, this.dialect)} ${name ?? ""}`;
12930
+ case 3 /* PackageVariableSetter */:
12931
+ case 14 /* FieldSetter */:
12932
+ return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Set */, this.locale, this.dialect)} ${name ?? ""}`;
12933
+ case 16 /* IndexedElementGetter */:
12934
+ return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Get */, this.locale, this.dialect)} []`;
12935
+ case 17 /* IndexedElementSetter */:
12936
+ return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Set */, this.locale, this.dialect)} []`;
12937
+ default:
12938
+ Debug.never(kind);
12739
12939
  }
12740
12940
  }
12741
- findTypeParameterEntity(entity) {
12742
- const containingEntity = this.findEntity(entity.getContainingEntity());
12743
- const index = entity.getContainingEntity().getTypeParameters().indexOf(entity);
12744
- if (containingEntity !== void 0 && index >= 0) {
12745
- return this.ifEntityWithTypeParametersThenParameters(containingEntity)?.[index];
12746
- } else {
12747
- return void 0;
12748
- }
12941
+ };
12942
+ var Item = class {
12943
+ constructor(kind, name, range, selectionRange, items, sourceFile) {
12944
+ this.kind = kind;
12945
+ this.name = name;
12946
+ this.range = range;
12947
+ this.selectionRange = selectionRange;
12948
+ this.items = items;
12949
+ this.sourceFile = sourceFile;
12749
12950
  }
12750
- findPackageTypeEntityByNameAndArity(name, arity) {
12751
- return this.packageEntity.getMembers().getNamedMembersByName(name).filter((m) => m.kind === 2 /* Type */).find((m) => m.getArity() === arity);
12951
+ };
12952
+
12953
+ // source/services/WorkspaceItemsService.ts
12954
+ var WorkspaceItemsService = class {
12955
+ constructor() {
12956
+ this.sourceFileItemsService = new SourceFileItemsService();
12752
12957
  }
12753
- ifEntityWithParametersThenParameters(entity) {
12754
- switch (entity.kind) {
12755
- case 1 /* Function */:
12756
- return entity.getParameters();
12757
- case 5 /* Indexer */:
12758
- return entity.getParameters();
12759
- case 7 /* Constructor */:
12760
- return entity.getParameters();
12761
- case 8 /* Destructor */:
12762
- return entity.getParameters();
12763
- case 2 /* Type */: {
12764
- if (entity.typeEntityKind === 0 /* Function */) {
12765
- return entity.getParameters();
12958
+ getItems(compilations) {
12959
+ const result = new Array();
12960
+ const packageUris = /* @__PURE__ */ new Set();
12961
+ for (const compilation of compilations) {
12962
+ for (const pkg of compilation.allPackages) {
12963
+ if (packageUris.has(pkg.uri.toString())) {
12964
+ continue;
12766
12965
  }
12767
- return void 0;
12768
- }
12769
- case 9 /* Operator */:
12770
- return entity.getParameters();
12771
- case 0 /* Variable */:
12772
- case 3 /* Getter */:
12773
- case 4 /* Setter */:
12774
- case 10 /* PackageAlias */:
12775
- case 12 /* Package */:
12776
- case 11 /* TypeExtension */:
12777
- case 6 /* DereferenceOperator */:
12778
- return void 0;
12779
- case 13 /* TextTranslation */:
12780
- return void 0;
12781
- default:
12782
- Debug.never(entity);
12783
- }
12784
- }
12785
- ifEntityWithTypeParametersThenParameters(entity) {
12786
- switch (entity.kind) {
12787
- case 1 /* Function */:
12788
- return entity.getTypeParameters();
12789
- case 2 /* Type */: {
12790
- if (entity.typeEntityKind !== 2 /* Parameter */) {
12791
- return entity.getTypeParameters();
12966
+ packageUris.add(pkg.uri.toString());
12967
+ for (const sourceFile of pkg.sourceFiles) {
12968
+ result.push(...this.sourceFileItemsService.getItems(sourceFile));
12792
12969
  }
12793
- return void 0;
12794
- }
12795
- case 8 /* Destructor */:
12796
- case 7 /* Constructor */:
12797
- case 5 /* Indexer */:
12798
- case 6 /* DereferenceOperator */:
12799
- case 0 /* Variable */:
12800
- case 3 /* Getter */:
12801
- case 4 /* Setter */:
12802
- case 10 /* PackageAlias */:
12803
- case 12 /* Package */:
12804
- case 11 /* TypeExtension */:
12805
- case 9 /* Operator */:
12806
- case 13 /* TextTranslation */:
12807
- return void 0;
12808
- default:
12809
- Debug.never(entity);
12810
- }
12811
- }
12812
- findOverloadedMemberIndex(referenceData, membersData) {
12813
- for (let i = 0; i < membersData.length; i++) {
12814
- const memberData = membersData[i];
12815
- if (memberData.typeParameters.length !== referenceData.typeParameters.length || memberData.parameters.length !== referenceData.parameters.length) {
12816
- continue;
12817
- }
12818
- const parametersAreEqual = Query.zip(
12819
- memberData.parameters,
12820
- referenceData.parameters,
12821
- (r, m) => this.getEntityName(r).considerEqual(this.getEntityName(m))
12822
- ).all((v) => v);
12823
- if (parametersAreEqual) {
12824
- return i;
12825
12970
  }
12826
12971
  }
12827
- return -1;
12828
- }
12829
- getEntityName(entity) {
12830
- return entity.getName();
12831
- }
12832
- };
12833
- var DataForFindingOverloadedMember = class {
12834
- constructor(typeParameters, parameters) {
12835
- this.typeParameters = typeParameters;
12836
- this.parameters = parameters;
12972
+ return result;
12837
12973
  }
12838
12974
  };
12839
12975
 
@@ -12855,8 +12991,7 @@ var _LanguageServer = class _LanguageServer {
12855
12991
  this.signatureHelpService = new SignatureHelpService();
12856
12992
  this.fileSystemTreeDisplayService = new FileSystemTreeDisplayService();
12857
12993
  this.selectionRangeService = new SelectionRangeService();
12858
- this.assignFieldService = new AssignFieldService();
12859
- this.deleteBlockFromScriptService = new DeleteBlockFromScriptService();
12994
+ this.scriptEditingService = new ScriptEditingService();
12860
12995
  this.codeActionsService = new CodeActionsService();
12861
12996
  this.connection = config.connection;
12862
12997
  this.config = config;
@@ -12953,7 +13088,11 @@ var _LanguageServer = class _LanguageServer {
12953
13088
  this.disposables.push(disposable);
12954
13089
  disposable = this.connection.onRequest(customRequests.assignField, (params, token) => this.withTaskController(token, (taskController) => this.onAssignField(params, taskController)));
12955
13090
  this.disposables.push(disposable);
12956
- disposable = this.connection.onRequest(customRequests.deleteBlockFromScript, (params, token) => this.withTaskController(token, (taskController) => this.onDeleteBlockFromScript(params, taskController)));
13091
+ disposable = this.connection.onRequest(customRequests.addBlocksToScript, (params, token) => this.withTaskController(token, (taskController) => this.onAddBlocksToScript(params, taskController)));
13092
+ this.disposables.push(disposable);
13093
+ disposable = this.connection.onRequest(customRequests.canDeleteBlocksFromScript, (params, token) => this.withTaskController(token, (taskController) => this.onCanDeleteBlocksFromScript(params, taskController)));
13094
+ this.disposables.push(disposable);
13095
+ disposable = this.connection.onRequest(customRequests.deleteBlocksFromScript, (params, token) => this.withTaskController(token, (taskController) => this.onDeleteBlocksFromScript(params, taskController)));
12957
13096
  this.disposables.push(disposable);
12958
13097
  this.connection.listen();
12959
13098
  }
@@ -13458,7 +13597,7 @@ var _LanguageServer = class _LanguageServer {
13458
13597
  return ls3.SymbolKind.Function;
13459
13598
  case 7 /* VariantType */:
13460
13599
  return ls3.SymbolKind.Enum;
13461
- case 9 /* Variant */:
13600
+ case 9 /* VariantValue */:
13462
13601
  return ls3.SymbolKind.EnumMember;
13463
13602
  case 8 /* InvalidType */:
13464
13603
  return ls3.SymbolKind.Class;
@@ -13504,15 +13643,15 @@ var _LanguageServer = class _LanguageServer {
13504
13643
  }
13505
13644
  onAssignField(params, taskController) {
13506
13645
  return __async(this, null, function* () {
13507
- const functionNodeUri = URI.parse(params.functionNodeUri);
13508
- const sourceFileContext = yield this.getSourceFileContext(functionNodeUri, taskController);
13646
+ const scriptFunctionUri = URI.parse(params.scriptFunctionUri);
13647
+ const sourceFileContext = yield this.getSourceFileContext(scriptFunctionUri, taskController);
13509
13648
  if (sourceFileContext !== void 0) {
13510
- const functionDeclaration = NodePath.parse(functionNodeUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
13511
- if (functionDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(functionDeclaration)) {
13512
- const sourceFileEdit = this.assignFieldService.createEditWithAssignment(
13649
+ const scriptDeclaration = NodePath.parse(scriptFunctionUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
13650
+ if (scriptDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(scriptDeclaration)) {
13651
+ const sourceFileEdit = this.scriptEditingService.createEditWithFieldAssignment(
13513
13652
  sourceFileContext.analyzer,
13514
13653
  sourceFileContext.sourceFile,
13515
- functionDeclaration,
13654
+ scriptDeclaration,
13516
13655
  params.fieldName,
13517
13656
  params.value
13518
13657
  );
@@ -13525,24 +13664,88 @@ var _LanguageServer = class _LanguageServer {
13525
13664
  }
13526
13665
  });
13527
13666
  }
13528
- onDeleteBlockFromScript(params, taskController) {
13667
+ onAddBlocksToScript(params, taskController) {
13668
+ return __async(this, null, function* () {
13669
+ const sourceFileEdits = new Array();
13670
+ const convertAddedScriptBlock = (block) => {
13671
+ return {
13672
+ name: block.name,
13673
+ key: block.key,
13674
+ areaIndex: block.areaIndex,
13675
+ elementProperties: block.elementProperties ?? {},
13676
+ nestedBlocks: block.nestedBlocks?.map(convertAddedScriptBlock) ?? []
13677
+ };
13678
+ };
13679
+ for (const scriptBlockAddedToOuterScript of params) {
13680
+ const scriptFunctionUri = URI.parse(scriptBlockAddedToOuterScript.outerScriptFunctionUri);
13681
+ const sourceFileContext = yield this.getSourceFileContext(scriptFunctionUri, taskController);
13682
+ if (sourceFileContext !== void 0) {
13683
+ const scriptDeclaration = NodePath.parse(scriptFunctionUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
13684
+ if (scriptDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(scriptDeclaration)) {
13685
+ const addedBlockInfos = scriptBlockAddedToOuterScript.values.map(convertAddedScriptBlock);
13686
+ const sourceFileEdit = this.scriptEditingService.createEditAddingBlocks(
13687
+ sourceFileContext.sourceFile,
13688
+ scriptDeclaration,
13689
+ addedBlockInfos
13690
+ );
13691
+ if (sourceFileEdit !== void 0) {
13692
+ sourceFileEdits.push(sourceFileEdit);
13693
+ }
13694
+ }
13695
+ }
13696
+ }
13697
+ if (sourceFileEdits.length > 0) {
13698
+ const workspaceEdit = this.convertSourceFileEditsToWorkspaceEdit(sourceFileEdits);
13699
+ yield this.connection.workspace.applyEdit(workspaceEdit);
13700
+ }
13701
+ });
13702
+ }
13703
+ onCanDeleteBlocksFromScript(params, taskController) {
13529
13704
  return __async(this, null, function* () {
13530
- const functionNodeUri = URI.parse(params.functionNodeUri);
13531
- const sourceFileContext = yield this.getSourceFileContext(functionNodeUri, taskController);
13705
+ let result = false;
13706
+ const outerScriptFunctionUri = URI.parse(params.outerScriptFunctionUri);
13707
+ const sourceFileContext = yield this.getSourceFileContext(outerScriptFunctionUri, taskController);
13532
13708
  if (sourceFileContext !== void 0) {
13533
- const functionDeclaration = NodePath.parse(functionNodeUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
13534
- if (functionDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(functionDeclaration)) {
13535
- const sourceFileEdit = this.deleteBlockFromScriptService.createEditDeletingBlock(
13536
- sourceFileContext.sourceFile,
13537
- functionDeclaration
13538
- );
13539
- if (sourceFileEdit !== void 0) {
13540
- const textDocumentEdit = this.convertSourceFileEdit(sourceFileEdit);
13541
- const workspaceEdit = { documentChanges: [textDocumentEdit] };
13542
- yield this.connection.workspace.applyEdit(workspaceEdit);
13709
+ const outerScriptFunctionLocation = new NodeLocation(
13710
+ sourceFileContext.sourceFile,
13711
+ NodePath.parse(outerScriptFunctionUri.fragment)
13712
+ );
13713
+ const scriptFunctionLocations = Query.from(params.scriptFunctionUris).map((u) => {
13714
+ const parsedVscodeUri = URI.parse(u);
13715
+ const uri = this.convertVscodeUriToUri(parsedVscodeUri);
13716
+ const sourceFile = sourceFileContext.analyzer.compilation.getSourceFileByUri(uri);
13717
+ return sourceFile !== void 0 ? new NodeLocation(sourceFile, NodePath.parse(parsedVscodeUri.fragment)) : void 0;
13718
+ }).toNullable();
13719
+ if (scriptFunctionLocations !== void 0) {
13720
+ result = this.scriptEditingService.canDeleteBlocks(outerScriptFunctionLocation, scriptFunctionLocations);
13721
+ }
13722
+ }
13723
+ return result;
13724
+ });
13725
+ }
13726
+ onDeleteBlocksFromScript(params, taskController) {
13727
+ return __async(this, null, function* () {
13728
+ const sourceFileEdits = new Array();
13729
+ for (const scriptFunctionUri of params.scriptFunctionUris) {
13730
+ const parsedScriptFunctionUri = URI.parse(scriptFunctionUri);
13731
+ const sourceFileContext = yield this.getSourceFileContext(parsedScriptFunctionUri, taskController);
13732
+ if (sourceFileContext !== void 0) {
13733
+ const scriptDeclaration = NodePath.parse(parsedScriptFunctionUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
13734
+ if (scriptDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(scriptDeclaration)) {
13735
+ const sourceFileEdit = this.scriptEditingService.createEditDeletingBlock(
13736
+ sourceFileContext.sourceFile,
13737
+ scriptDeclaration
13738
+ );
13739
+ if (sourceFileEdit !== void 0) {
13740
+ sourceFileEdits.push(sourceFileEdit);
13741
+ }
13543
13742
  }
13544
13743
  }
13545
13744
  }
13745
+ if (sourceFileEdits.length > 0) {
13746
+ const workspaceEdit = this.convertSourceFileEditsToWorkspaceEdit(sourceFileEdits);
13747
+ yield this.connection.workspace.applyEdit(workspaceEdit);
13748
+ }
13546
13749
  });
13547
13750
  }
13548
13751
  convertSourceFileEdit(edit) {