@artel/artc 0.6.25210 → 0.6.25212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Cli.js +3 -3
- package/build/api/Api.js +26 -14
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +774 -526
- package/build/{chunk-3ORG7RXI.js → chunk-DYVLHEXS.js} +11186 -10587
- package/build/{chunk-CAQIZO5K.js → chunk-MRSDFDBD.js} +9 -8
- package/build/{chunk-HRQLSHI7.js → chunk-XGS3PSIF.js} +3 -3
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +3 -1
- package/build/types/analysis/Analyzer.d.ts +33 -16
- package/build/types/analysis/BaseExpressionMeaning.d.ts +8 -2
- package/build/types/analysis/CallExpressionMeaning.d.ts +6 -1
- package/build/types/analysis/DiagnosticCollector.d.ts +1 -0
- package/build/types/analysis/EntityLocalizationHelper.d.ts +3 -1
- package/build/types/analysis/IdentifierExpressionMeaning.d.ts +12 -4
- package/build/types/analysis/Lookup.d.ts +6 -2
- package/build/types/analysis/PrefixUnaryOperatorResolver.d.ts +1 -3
- package/build/types/analysis/PropertyAccessExpressionMeaning.d.ts +13 -4
- package/build/types/analysis/Scope.d.ts +17 -3
- package/build/types/analysis/SemanticContext.d.ts +18 -1
- package/build/types/analysis/SemanticContextBuilder.d.ts +2 -0
- package/build/types/analysis/StatementBlockScopeBuilder.d.ts +1 -0
- package/build/types/analysis/TypeMemberLookup.d.ts +3 -3
- package/build/types/analysis/UserDefinableBinaryOperatorResolver.d.ts +2 -2
- package/build/types/common/Cached.d.ts +1 -0
- package/build/types/common/Debug.d.ts +3 -0
- package/build/types/common/LocalizationHelper.d.ts +5 -2
- package/build/types/common/Logger.d.ts +1 -1
- package/build/types/common/Uri.d.ts +11 -2
- package/build/types/common/index.d.ts +0 -1
- package/build/types/diagnostic/DiagnosticCode.d.ts +126 -115
- package/build/types/emitter/EmitterGeneratedDeclarationKind.d.ts +7 -0
- package/build/types/emitter/Entities.d.ts +1 -0
- package/build/types/emitter/EntityMap.d.ts +1 -2
- package/build/types/emitter/IrBuilder.d.ts +2 -0
- package/build/types/emitter/StatementTransformationResult.d.ts +3 -1
- package/build/types/emitter/Transformer.d.ts +1 -1
- package/build/types/emitter/ir/Nodes.d.ts +38 -34
- package/build/types/entities/EntityHiding.d.ts +2 -2
- package/build/types/entities/OperatorEntity.d.ts +43 -0
- package/build/types/entities/OperatorKind.d.ts +56 -0
- package/build/types/entities/StructuredTypeEntity.d.ts +3 -3
- package/build/types/entities/TypeEntityMembers.d.ts +9 -14
- package/build/types/entities/TypeExtensionEntity.d.ts +0 -1
- package/build/types/entities/VariableEntity.d.ts +3 -13
- package/build/types/entities/index.d.ts +10 -12
- package/build/types/parser/Parser.d.ts +2 -2
- package/build/types/project/FileSystemTree.d.ts +1 -1
- package/build/types/services/CompletionService.d.ts +26 -20
- package/build/types/services/DisplayService.d.ts +47 -55
- package/build/types/services/NodeSemanticInfo.d.ts +6 -11
- package/build/types/services/SemanticTokensService.d.ts +4 -3
- package/build/types/tree/KeywordKind.d.ts +25 -29
- package/build/types/tree/NodeKind.d.ts +89 -92
- package/build/types/tree/OperatorKind.d.ts +40 -0
- package/build/types/tree/green/Nodes.d.ts +52 -85
- package/build/types/tree/green/SyntaxToCode.d.ts +1 -0
- package/build/types/tree/green/Token.d.ts +7 -5
- package/build/types/tree/green/index.d.ts +1 -0
- package/build/types/tree/index.d.ts +0 -3
- package/build/types/tree/red/Nodes.d.ts +44 -78
- package/build/types/tree/red/Token.d.ts +3 -2
- package/build/types/tree/red/index.d.ts +4 -0
- package/build/types/ts-interop/Entities.d.ts +0 -4
- package/build/types/types/TypeMembers.d.ts +20 -29
- package/package.json +6 -6
- package/build/types/analysis/BuiltInOperators.d.ts +0 -14
- package/build/types/common/UriTree.d.ts +0 -41
- package/build/types/emitter/IntrinsicEntities.d.ts +0 -118
- package/build/types/entities/BinaryOperatorEntity.d.ts +0 -51
- package/build/types/entities/UnaryOperatorEntity.d.ts +0 -36
- /package/build/types/emitter/{error-boundary.d.ts → ErrorBoundary.d.ts} +0 -0
package/build/api/ApiServices.js
CHANGED
@@ -7,7 +7,6 @@ import {
|
|
7
7
|
AnonymousTypeSpecifier,
|
8
8
|
AnonymousVariantTypeDeclaration,
|
9
9
|
BaseTypeList,
|
10
|
-
BinaryOperatorDeclaration_typeMember,
|
11
10
|
Cached,
|
12
11
|
CallArgumentList,
|
13
12
|
CancelledError,
|
@@ -62,6 +61,7 @@ import {
|
|
62
61
|
NodePath,
|
63
62
|
NodeTypeUtils,
|
64
63
|
NullableTypeSpecifier,
|
64
|
+
OperatorDeclaration_typeMember,
|
65
65
|
PackageAliasTypeDeclaration,
|
66
66
|
PackageImport,
|
67
67
|
PackageImportDirectiveList,
|
@@ -144,7 +144,6 @@ import {
|
|
144
144
|
TypeVariableGetterDeclaration,
|
145
145
|
TypeVariableOrVariantTranslation,
|
146
146
|
TypeVariableSetterDeclaration,
|
147
|
-
UnaryOperatorDeclaration_typeMember,
|
148
147
|
UnionTypeSpecifier,
|
149
148
|
UnionTypeSpecifierTypeList,
|
150
149
|
Uri,
|
@@ -172,8 +171,10 @@ import {
|
|
172
171
|
isSourceOrConfigurationFileName,
|
173
172
|
isTypeEntity,
|
174
173
|
isTypeEntityWithMembers,
|
174
|
+
isUnaryOperator,
|
175
175
|
kebabCaseToCamelCase,
|
176
176
|
localeToString,
|
177
|
+
operatorKinds,
|
177
178
|
setUserLocale,
|
178
179
|
tokenKindValues,
|
179
180
|
traverseTreeWithCancellationToken,
|
@@ -181,7 +182,7 @@ import {
|
|
181
182
|
unwrapParenthesizedExpressions,
|
182
183
|
visitChildren,
|
183
184
|
yieldExecution
|
184
|
-
} from "../chunk-
|
185
|
+
} from "../chunk-DYVLHEXS.js";
|
185
186
|
|
186
187
|
// source/services/CustomCommand.ts
|
187
188
|
import * as ls from "vscode-languageserver";
|
@@ -269,7 +270,7 @@ function cast(value) {
|
|
269
270
|
import { atomic as atomic6, atomicRun as atomicRun3 } from "reactronic";
|
270
271
|
import * as ls3 from "vscode-languageserver";
|
271
272
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
272
|
-
import { URI as URI2
|
273
|
+
import { URI as URI2 } from "vscode-uri";
|
273
274
|
|
274
275
|
// source/services/Types.ts
|
275
276
|
import * as ls2 from "vscode-languageserver";
|
@@ -362,24 +363,23 @@ var AddPropertyAssignmentService = class {
|
|
362
363
|
case 50 /* TypeDereferencedVariableGetterDeclaration */:
|
363
364
|
case 51 /* TypeDereferencedVariableSetterDeclaration */:
|
364
365
|
case 52 /* TypeMethodDeclaration */:
|
365
|
-
case
|
366
|
-
case
|
367
|
-
case
|
368
|
-
case
|
366
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
367
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
368
|
+
case 58 /* NestedMethodDeclaration */:
|
369
|
+
case 67 /* MethodBlockLiteral */:
|
369
370
|
case 76 /* MethodLiteral */:
|
371
|
+
case 53 /* OperatorDeclaration */:
|
370
372
|
return void 0;
|
371
|
-
case
|
373
|
+
case 100 /* RunStatement */:
|
372
374
|
return this.ifShouldBeAssignedAtTheEndOfSubprogramThenBody(parent);
|
373
|
-
case
|
374
|
-
case
|
375
|
-
case
|
376
|
-
case
|
377
|
-
case
|
378
|
-
case
|
379
|
-
case
|
380
|
-
case
|
381
|
-
case 123 /* TransactionalStatement */:
|
382
|
-
case 124 /* WhileStatement */:
|
375
|
+
case 101 /* OnErrorClause */:
|
376
|
+
case 103 /* FinallyClause */:
|
377
|
+
case 108 /* ForStatement */:
|
378
|
+
case 109 /* IfStatement */:
|
379
|
+
case 111 /* ElseIfClause */:
|
380
|
+
case 115 /* LoopStatement */:
|
381
|
+
case 120 /* SwitchStatementCaseClause */:
|
382
|
+
case 121 /* WhileStatement */:
|
383
383
|
return this.getContainingSubprogram(parent)?.body;
|
384
384
|
default:
|
385
385
|
Debug.never(parent);
|
@@ -410,10 +410,10 @@ function isSubprogramDeclaration(node) {
|
|
410
410
|
case 50 /* TypeDereferencedVariableGetterDeclaration */:
|
411
411
|
case 51 /* TypeDereferencedVariableSetterDeclaration */:
|
412
412
|
case 52 /* TypeMethodDeclaration */:
|
413
|
-
case
|
414
|
-
case
|
415
|
-
case
|
416
|
-
case
|
413
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
414
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
415
|
+
case 58 /* NestedMethodDeclaration */:
|
416
|
+
case 67 /* MethodBlockLiteral */:
|
417
417
|
case 76 /* MethodLiteral */:
|
418
418
|
return true;
|
419
419
|
default:
|
@@ -484,7 +484,7 @@ var SyntaxFactory = class {
|
|
484
484
|
static packageMethodDeclaration(tags, modifiers, name, typeParameters, parameters, returnTypeSpecifier, body) {
|
485
485
|
const tagList = new TagList(tags);
|
486
486
|
const modifierList = new ModifierList(modifiers);
|
487
|
-
const
|
487
|
+
const functionKeyword = this.keyword(11 /* Function */);
|
488
488
|
const nameIdentifier = this.createIdentifier(name);
|
489
489
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
490
490
|
const parameterClause = this.parameterClause(parameters);
|
@@ -492,7 +492,7 @@ var SyntaxFactory = class {
|
|
492
492
|
return new PackageMethodDeclaration(
|
493
493
|
tagList,
|
494
494
|
modifierList,
|
495
|
-
|
495
|
+
functionKeyword,
|
496
496
|
nameIdentifier,
|
497
497
|
typeParameterClause,
|
498
498
|
parameterClause,
|
@@ -518,10 +518,10 @@ var SyntaxFactory = class {
|
|
518
518
|
);
|
519
519
|
}
|
520
520
|
static methodTypeDeclarationBody(parameters, returnTypeSpecifier) {
|
521
|
-
const
|
521
|
+
const functionKeyword = this.keyword(11 /* Function */);
|
522
522
|
const parameterClause = this.parameterClause(parameters);
|
523
523
|
const returnTypeAnnotation = this.createTypeAnnotation(returnTypeSpecifier);
|
524
|
-
return new MethodTypeDeclarationBody(void 0,
|
524
|
+
return new MethodTypeDeclarationBody(void 0, functionKeyword, parameterClause, returnTypeAnnotation);
|
525
525
|
}
|
526
526
|
static packageStructuredTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
527
527
|
const tagList = new TagList(tags);
|
@@ -571,7 +571,7 @@ var SyntaxFactory = class {
|
|
571
571
|
static packageVariableGetterDeclaration(tags, modifiers, name, typeSpecifier, body) {
|
572
572
|
const tagList = new TagList(tags);
|
573
573
|
const modifierList = new ModifierList(modifiers);
|
574
|
-
const getKeyword = this.keyword(
|
574
|
+
const getKeyword = this.keyword(57 /* Get */);
|
575
575
|
const nameIdentifier = this.createIdentifier(name);
|
576
576
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
577
577
|
return new PackageVariableGetterDeclaration(
|
@@ -586,7 +586,7 @@ var SyntaxFactory = class {
|
|
586
586
|
static packageVariableSetterDeclaration(tags, modifiers, name, setterParameterClause, body) {
|
587
587
|
const tagList = new TagList(tags);
|
588
588
|
const modifierList = new ModifierList(modifiers);
|
589
|
-
const setKeyword = this.keyword(
|
589
|
+
const setKeyword = this.keyword(58 /* Set */);
|
590
590
|
const nameIdentifier = this.createIdentifier(name);
|
591
591
|
return new PackageVariableSetterDeclaration(
|
592
592
|
tagList,
|
@@ -640,7 +640,7 @@ var SyntaxFactory = class {
|
|
640
640
|
static typeVariableGetterDeclaration(tags, modifiers, name, typeSpecifier, body) {
|
641
641
|
const tagList = new TagList(tags);
|
642
642
|
const modifierList = new ModifierList(modifiers);
|
643
|
-
const getKeyword = this.keyword(
|
643
|
+
const getKeyword = this.keyword(57 /* Get */);
|
644
644
|
const nameIdentifier = this.createIdentifier(name);
|
645
645
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
646
646
|
return new TypeVariableGetterDeclaration(
|
@@ -655,7 +655,7 @@ var SyntaxFactory = class {
|
|
655
655
|
static typeVariableSetterDeclaration(tags, modifiers, name, setterParameterClause, body) {
|
656
656
|
const tagList = new TagList(tags);
|
657
657
|
const modifierList = new ModifierList(modifiers);
|
658
|
-
const setKeyword = this.keyword(
|
658
|
+
const setKeyword = this.keyword(58 /* Set */);
|
659
659
|
const nameIdentifier = this.createIdentifier(name);
|
660
660
|
return new TypeVariableSetterDeclaration(
|
661
661
|
tagList,
|
@@ -669,7 +669,7 @@ var SyntaxFactory = class {
|
|
669
669
|
static typeMethodDeclaration(tags, modifiers, name, typeParameters, parameters, returnTypeSpecifier, body) {
|
670
670
|
const tagList = new TagList(tags);
|
671
671
|
const modifierList = new ModifierList(modifiers);
|
672
|
-
const
|
672
|
+
const functionKeyword = this.keyword(11 /* Function */);
|
673
673
|
const nameIdentifier = this.createIdentifier(name);
|
674
674
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
675
675
|
const parameterClause = this.parameterClause(parameters);
|
@@ -677,7 +677,7 @@ var SyntaxFactory = class {
|
|
677
677
|
return new TypeMethodDeclaration(
|
678
678
|
tagList,
|
679
679
|
modifierList,
|
680
|
-
|
680
|
+
functionKeyword,
|
681
681
|
nameIdentifier,
|
682
682
|
typeParameterClause,
|
683
683
|
parameterClause,
|
@@ -695,14 +695,14 @@ var SyntaxFactory = class {
|
|
695
695
|
static typeDestructorDeclaration(tags, modifiers, parameters, body) {
|
696
696
|
const tagList = new TagList(tags);
|
697
697
|
const modifierList = new ModifierList(modifiers);
|
698
|
-
const destructionKeyword = this.keyword(
|
698
|
+
const destructionKeyword = this.keyword(46 /* Destruction */);
|
699
699
|
const parameterClause = this.parameterClause(parameters);
|
700
700
|
return new TypeDestructorDeclaration(tagList, modifierList, destructionKeyword, parameterClause, body);
|
701
701
|
}
|
702
702
|
static typeIndexedGetterDeclaration(tags, modifiers, parameters, typeSpecifier, body) {
|
703
703
|
const tagList = new TagList(tags);
|
704
704
|
const modifierList = new ModifierList(modifiers);
|
705
|
-
const getKeyword = this.keyword(
|
705
|
+
const getKeyword = this.keyword(57 /* Get */);
|
706
706
|
const parameterClause = this.indexerParameterClause(parameters);
|
707
707
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
708
708
|
return new TypeIndexedGetterDeclaration(
|
@@ -717,7 +717,7 @@ var SyntaxFactory = class {
|
|
717
717
|
static typeIndexedSetterDeclaration(tags, modifiers, parameters, setterParameterClause, body) {
|
718
718
|
const tagList = new TagList(tags);
|
719
719
|
const modifierList = new ModifierList(modifiers);
|
720
|
-
const getKeyword = this.keyword(
|
720
|
+
const getKeyword = this.keyword(58 /* Set */);
|
721
721
|
const parameterClause = this.indexerParameterClause(parameters);
|
722
722
|
return new TypeIndexedSetterDeclaration(
|
723
723
|
tagList,
|
@@ -873,7 +873,7 @@ var SyntaxFactory = class {
|
|
873
873
|
return new StatementBlock(openBraceToken, statementList, closeBraceToken);
|
874
874
|
}
|
875
875
|
static noneLiteral() {
|
876
|
-
return new KeywordExpression(this.keyword(
|
876
|
+
return new KeywordExpression(this.keyword(56 /* None */));
|
877
877
|
}
|
878
878
|
static integerLiteral(value) {
|
879
879
|
return new TokenExpression(this.token(2 /* IntegerLiteral */, value.toString()));
|
@@ -881,7 +881,7 @@ var SyntaxFactory = class {
|
|
881
881
|
static translationsDeclaration(translations) {
|
882
882
|
const tagList = new TagList([]);
|
883
883
|
const modifierList = new ModifierList([]);
|
884
|
-
const translationsKeyword = this.keyword(
|
884
|
+
const translationsKeyword = this.keyword(54 /* Translations */);
|
885
885
|
const openBraceToken = this.token(43 /* OpenBrace */);
|
886
886
|
const translationList = new TopLevelTranslationList(translations);
|
887
887
|
const closeBraceToken = this.token(20 /* CloseBrace */);
|
@@ -901,7 +901,7 @@ var SyntaxFactory = class {
|
|
901
901
|
return new PackageVariableTranslation(sourceNameIdentifier, minusGreaterThanToken, translatedNameIdentifier);
|
902
902
|
}
|
903
903
|
static packageMethodTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
904
|
-
const
|
904
|
+
const functionKeyword = this.keyword(11 /* Function */);
|
905
905
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
906
906
|
const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
|
907
907
|
const sourceParameterClause = this.translationParameterClause(sourceParameters);
|
@@ -910,7 +910,7 @@ var SyntaxFactory = class {
|
|
910
910
|
const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
|
911
911
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
912
912
|
return new PackageMethodTranslation(
|
913
|
-
|
913
|
+
functionKeyword,
|
914
914
|
sourceNameIdentifier,
|
915
915
|
sourceTypeParameterClause,
|
916
916
|
sourceParameterClause,
|
@@ -978,7 +978,7 @@ var SyntaxFactory = class {
|
|
978
978
|
);
|
979
979
|
}
|
980
980
|
static typeMethodTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
981
|
-
const
|
981
|
+
const functionKeyword = this.keyword(11 /* Function */);
|
982
982
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
983
983
|
const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
|
984
984
|
const sourceParameterClause = this.translationParameterClause(sourceParameters);
|
@@ -987,7 +987,7 @@ var SyntaxFactory = class {
|
|
987
987
|
const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
|
988
988
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
989
989
|
return new TypeMethodTranslation(
|
990
|
-
|
990
|
+
functionKeyword,
|
991
991
|
sourceNameIdentifier,
|
992
992
|
sourceTypeParameterClause,
|
993
993
|
sourceParameterClause,
|
@@ -1033,10 +1033,10 @@ var SyntaxFactory = class {
|
|
1033
1033
|
}
|
1034
1034
|
static token(kind, value) {
|
1035
1035
|
const flags = value === void 0 ? 1 /* Missing */ : 0 /* None */;
|
1036
|
-
return new Token(kind, value ?? "", [], flags);
|
1036
|
+
return new Token(kind, value ?? "", [], flags, void 0);
|
1037
1037
|
}
|
1038
1038
|
static keyword(kind) {
|
1039
|
-
return new Keyword(
|
1039
|
+
return new Keyword([], kind, true);
|
1040
1040
|
}
|
1041
1041
|
static createTypeParameterClause(typeParameters) {
|
1042
1042
|
if (typeParameters === void 0) {
|
@@ -1068,7 +1068,7 @@ var SyntaxFactory = class {
|
|
1068
1068
|
}
|
1069
1069
|
static createIdentifier(value) {
|
1070
1070
|
if (typeof value === "string") {
|
1071
|
-
return new Token(63 /* Identifier */, value, [], 0 /* None
|
1071
|
+
return new Token(63 /* Identifier */, value, [], 0 /* None */, void 0);
|
1072
1072
|
}
|
1073
1073
|
return value;
|
1074
1074
|
}
|
@@ -1190,7 +1190,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1190
1190
|
writePackageMethodDeclaration(node) {
|
1191
1191
|
this.writeDeclarationTags(node.tagList);
|
1192
1192
|
this.writeDeclarationModifiers(node.modifierList);
|
1193
|
-
this.writeKeyword(node.
|
1193
|
+
this.writeKeyword(node.functionKeyword);
|
1194
1194
|
this.writeWhitespace();
|
1195
1195
|
this.writeToken(node.name);
|
1196
1196
|
if (node.typeParameterClause !== void 0) {
|
@@ -1305,7 +1305,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1305
1305
|
this.writeTypeMemberDeclarationBlock(node.memberBlock);
|
1306
1306
|
}
|
1307
1307
|
writeMethodTypeDeclarationBody(node) {
|
1308
|
-
this.writeKeyword(node.
|
1308
|
+
this.writeKeyword(node.functionKeyword);
|
1309
1309
|
this.writeParameterClause(node.parameterClause);
|
1310
1310
|
if (node.returnTypeAnnotation !== void 0) {
|
1311
1311
|
this.writeTypeAnnotation(node.returnTypeAnnotation, true);
|
@@ -1371,7 +1371,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1371
1371
|
writeTypeMethodDeclaration(node) {
|
1372
1372
|
this.writeDeclarationTags(node.tagList);
|
1373
1373
|
this.writeDeclarationModifiers(node.modifierList);
|
1374
|
-
this.writeKeyword(node.
|
1374
|
+
this.writeKeyword(node.functionKeyword);
|
1375
1375
|
this.writeWhitespace();
|
1376
1376
|
this.writeToken(node.name);
|
1377
1377
|
if (node.typeParameterClause !== void 0) {
|
@@ -1385,6 +1385,20 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1385
1385
|
this.writeDeclarationBody(node.body);
|
1386
1386
|
}
|
1387
1387
|
}
|
1388
|
+
writeOperatorDeclaration(node) {
|
1389
|
+
this.writeDeclarationTags(node.tagList);
|
1390
|
+
this.writeDeclarationModifiers(node.modifierList);
|
1391
|
+
this.writeKeyword(node.functionKeyword);
|
1392
|
+
this.writeWhitespace();
|
1393
|
+
this.writeToken(node.name);
|
1394
|
+
this.writeParameterClause(node.parameterClause);
|
1395
|
+
if (node.returnTypeAnnotation !== void 0) {
|
1396
|
+
this.writeTypeAnnotation(node.returnTypeAnnotation, true);
|
1397
|
+
}
|
1398
|
+
if (node.body !== void 0) {
|
1399
|
+
this.writeDeclarationBody(node.body);
|
1400
|
+
}
|
1401
|
+
}
|
1388
1402
|
writeTypeConstructorDeclaration(node) {
|
1389
1403
|
this.writeDeclarationTags(node.tagList);
|
1390
1404
|
this.writeDeclarationModifiers(node.modifierList);
|
@@ -1727,7 +1741,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1727
1741
|
this.writeToken(node.translatedName);
|
1728
1742
|
}
|
1729
1743
|
writePackageMethodTranslation(node) {
|
1730
|
-
this.writeKeyword(node.
|
1744
|
+
this.writeKeyword(node.functionKeyword);
|
1731
1745
|
this.writeWhitespace();
|
1732
1746
|
this.writeToken(node.sourceName);
|
1733
1747
|
if (node.sourceTypeParameterClause !== void 0) {
|
@@ -1796,7 +1810,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1796
1810
|
this.writeToken(node.translatedName);
|
1797
1811
|
}
|
1798
1812
|
writeTypeMethodTranslation(node) {
|
1799
|
-
this.writeKeyword(node.
|
1813
|
+
this.writeKeyword(node.functionKeyword);
|
1800
1814
|
this.writeWhitespace();
|
1801
1815
|
this.writeToken(node.sourceName);
|
1802
1816
|
if (node.sourceTypeParameterClause !== void 0) {
|
@@ -2014,22 +2028,23 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2014
2028
|
[50 /* TypeDereferencedVariableGetterDeclaration */]: this.prototype.writeTypeDereferencedVariableGetterDeclaration,
|
2015
2029
|
[51 /* TypeDereferencedVariableSetterDeclaration */]: this.prototype.writeTypeDereferencedVariableSetterDeclaration,
|
2016
2030
|
[52 /* TypeMethodDeclaration */]: this.prototype.writeTypeMethodDeclaration,
|
2017
|
-
[53 /*
|
2018
|
-
[54 /*
|
2019
|
-
[55 /*
|
2020
|
-
[
|
2021
|
-
[
|
2022
|
-
[
|
2023
|
-
[
|
2024
|
-
[
|
2025
|
-
[
|
2026
|
-
[
|
2027
|
-
[
|
2028
|
-
[
|
2029
|
-
[
|
2030
|
-
[
|
2031
|
-
[
|
2032
|
-
[
|
2031
|
+
[53 /* OperatorDeclaration */]: this.prototype.writeOperatorDeclaration,
|
2032
|
+
[54 /* TypeVariableDeclaration */]: this.prototype.writeTypeVariableDeclaration,
|
2033
|
+
[55 /* TypeVariableGetterDeclaration */]: this.prototype.writeTypeVariableGetterDeclaration,
|
2034
|
+
[56 /* TypeVariableSetterDeclaration */]: this.prototype.writeTypeVariableSetterDeclaration,
|
2035
|
+
[95 /* StatementBlock */]: this.prototype.writeStatementBlock,
|
2036
|
+
[134 /* QualifiedName */]: this.prototype.writeQualifiedName,
|
2037
|
+
[141 /* VariantDeclaration */]: this.prototype.writeVariantDeclaration,
|
2038
|
+
[142 /* TypeParameterDeclaration */]: this.prototype.writeTypeParameterDeclaration,
|
2039
|
+
[143 /* ParameterDeclaration */]: this.prototype.writeParameterDeclaration,
|
2040
|
+
[144 /* CallArgument */]: this.prototype.writeCallArgument,
|
2041
|
+
[146 /* Tag */]: this.prototype.writeTag,
|
2042
|
+
[148 /* Modifier */]: this.prototype.writeModifier,
|
2043
|
+
[149 /* ParameterClause */]: this.prototype.writeParameterClause,
|
2044
|
+
[150 /* ParameterList */]: this.prototype.writeParameterList,
|
2045
|
+
[151 /* SetterParameterClause */]: this.prototype.writeSetterParameterClause,
|
2046
|
+
[153 /* TypeArgumentClause */]: this.prototype.writeTypeArgumentClause,
|
2047
|
+
[155 /* TypeParameterClause */]: this.prototype.writeTypeParameterClause,
|
2033
2048
|
[17 /* AnonymousMethodTypeDeclaration */]: this.prototype.writeAnonymousMethodTypeDeclaration,
|
2034
2049
|
[18 /* AnonymousStructuredTypeDeclaration */]: this.prototype.writeAnonymousStructuredTypeDeclaration,
|
2035
2050
|
[19 /* AnonymousVariantTypeDeclaration */]: this.prototype.writeAnonymousVariantTypeDeclaration,
|
@@ -2046,25 +2061,24 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2046
2061
|
[42 /* ExtendedTypeClause */]: this.prototype.writeNodeDefault,
|
2047
2062
|
[43 /* InvalidPackageMemberDeclaration */]: this.prototype.writeNodeDefault,
|
2048
2063
|
[49 /* TypeIndexerParameterClause */]: this.prototype.writeNodeDefault,
|
2049
|
-
[
|
2050
|
-
[
|
2051
|
-
[
|
2052
|
-
[
|
2053
|
-
[
|
2054
|
-
[
|
2055
|
-
[
|
2056
|
-
[
|
2057
|
-
[
|
2058
|
-
[
|
2059
|
-
[
|
2060
|
-
[
|
2061
|
-
[
|
2062
|
-
[
|
2063
|
-
[
|
2064
|
-
[
|
2065
|
-
[
|
2066
|
-
[
|
2067
|
-
[74 /* UnobservableExpression */]: this.prototype.writeNodeDefault,
|
2064
|
+
[57 /* InvalidTypeMemberDeclaration */]: this.prototype.writeNodeDefault,
|
2065
|
+
[58 /* NestedMethodDeclaration */]: this.prototype.writeNodeDefault,
|
2066
|
+
[59 /* LocalVariableDeclaration */]: this.prototype.writeNodeDefault,
|
2067
|
+
[60 /* EnumerationVariableDeclaration */]: this.prototype.writeNodeDefault,
|
2068
|
+
[61 /* ArrayLiteral */]: this.prototype.writeNodeDefault,
|
2069
|
+
[62 /* ArrayLiteralElementList */]: this.prototype.writeNodeDefault,
|
2070
|
+
[63 /* AssertionExpression */]: this.prototype.writeNodeDefault,
|
2071
|
+
[64 /* AssumptionExpression */]: this.prototype.writeNodeDefault,
|
2072
|
+
[65 /* AsExpression */]: this.prototype.writeNodeDefault,
|
2073
|
+
[66 /* BinaryExpression */]: this.prototype.writeNodeDefault,
|
2074
|
+
[67 /* MethodBlockLiteral */]: this.prototype.writeNodeDefault,
|
2075
|
+
[68 /* CallArgumentList */]: this.prototype.writeNodeDefault,
|
2076
|
+
[69 /* CallExpression */]: this.prototype.writeNodeDefault,
|
2077
|
+
[70 /* AutotypeCallExpression */]: this.prototype.writeNodeDefault,
|
2078
|
+
[71 /* IndexedAccessArgumentList */]: this.prototype.writeNodeDefault,
|
2079
|
+
[72 /* IndexedAccessExpression */]: this.prototype.writeNodeDefault,
|
2080
|
+
[73 /* InvalidExpression */]: this.prototype.writeNodeDefault,
|
2081
|
+
[74 /* IsExpression */]: this.prototype.writeNodeDefault,
|
2068
2082
|
[75 /* NotExpression */]: this.prototype.writeNodeDefault,
|
2069
2083
|
[76 /* MethodLiteral */]: this.prototype.writeNodeDefault,
|
2070
2084
|
[77 /* ParenthesizedExpression */]: this.prototype.writeNodeDefault,
|
@@ -2081,63 +2095,60 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2081
2095
|
[88 /* ObjectExpression */]: this.prototype.writeNodeDefault,
|
2082
2096
|
[89 /* BaseExpression */]: this.prototype.writeNodeDefault,
|
2083
2097
|
[90 /* IdentifierExpression */]: this.prototype.writeNodeDefault,
|
2084
|
-
[91 /*
|
2085
|
-
[92 /*
|
2086
|
-
[93 /*
|
2087
|
-
[94 /*
|
2088
|
-
[
|
2089
|
-
[97 /*
|
2090
|
-
[98 /*
|
2091
|
-
[99 /*
|
2092
|
-
[100 /*
|
2093
|
-
[101 /*
|
2094
|
-
[102 /*
|
2095
|
-
[103 /*
|
2096
|
-
[104 /*
|
2097
|
-
[105 /*
|
2098
|
-
[106 /*
|
2099
|
-
[107 /*
|
2100
|
-
[108 /*
|
2101
|
-
[109 /*
|
2102
|
-
[110 /*
|
2103
|
-
[111 /*
|
2104
|
-
[112 /*
|
2105
|
-
[113 /*
|
2106
|
-
[114 /*
|
2107
|
-
[115 /*
|
2108
|
-
[116 /*
|
2109
|
-
[117 /*
|
2110
|
-
[118 /*
|
2111
|
-
[119 /*
|
2112
|
-
[120 /*
|
2113
|
-
[121 /*
|
2114
|
-
[122 /*
|
2115
|
-
[123 /*
|
2116
|
-
[124 /*
|
2117
|
-
[125 /*
|
2118
|
-
[126 /*
|
2119
|
-
[127 /*
|
2120
|
-
[128 /*
|
2121
|
-
[129 /*
|
2122
|
-
[130 /*
|
2123
|
-
[131 /*
|
2124
|
-
[132 /*
|
2125
|
-
[133 /*
|
2126
|
-
[
|
2127
|
-
[
|
2128
|
-
[
|
2129
|
-
[138 /*
|
2130
|
-
[139 /*
|
2131
|
-
[140 /*
|
2132
|
-
[
|
2133
|
-
[
|
2134
|
-
[
|
2135
|
-
[
|
2136
|
-
[
|
2137
|
-
[
|
2138
|
-
[157 /* TypeArgumentList */]: this.prototype.writeNodeDefault,
|
2139
|
-
[159 /* TypeParameterList */]: this.prototype.writeNodeDefault,
|
2140
|
-
[160 /* TypeAnnotation */]: this.prototype.writeNodeDefault
|
2098
|
+
[91 /* GenericSpecializationExpression */]: this.prototype.writeNodeDefault,
|
2099
|
+
[92 /* DefaultMatchExpression */]: this.prototype.writeNodeDefault,
|
2100
|
+
[93 /* AssignmentStatement */]: this.prototype.writeNodeDefault,
|
2101
|
+
[94 /* StatementList */]: this.prototype.writeNodeDefault,
|
2102
|
+
[96 /* BreakLoopStatement */]: this.prototype.writeNodeDefault,
|
2103
|
+
[97 /* ContinueLoopStatement */]: this.prototype.writeNodeDefault,
|
2104
|
+
[98 /* DisposeStatement */]: this.prototype.writeNodeDefault,
|
2105
|
+
[99 /* RunStatementClauseList */]: this.prototype.writeNodeDefault,
|
2106
|
+
[100 /* RunStatement */]: this.prototype.writeNodeDefault,
|
2107
|
+
[101 /* OnErrorClause */]: this.prototype.writeNodeDefault,
|
2108
|
+
[102 /* ErrorVariableDeclaration */]: this.prototype.writeNodeDefault,
|
2109
|
+
[103 /* FinallyClause */]: this.prototype.writeNodeDefault,
|
2110
|
+
[104 /* EmptyStatement */]: this.prototype.writeNodeDefault,
|
2111
|
+
[105 /* ErrorStatement */]: this.prototype.writeNodeDefault,
|
2112
|
+
[106 /* ExpressionStatement */]: this.prototype.writeNodeDefault,
|
2113
|
+
[107 /* EnumerationVariableList */]: this.prototype.writeNodeDefault,
|
2114
|
+
[108 /* ForStatement */]: this.prototype.writeNodeDefault,
|
2115
|
+
[109 /* IfStatement */]: this.prototype.writeNodeDefault,
|
2116
|
+
[110 /* ElseIfClauseList */]: this.prototype.writeNodeDefault,
|
2117
|
+
[111 /* ElseIfClause */]: this.prototype.writeNodeDefault,
|
2118
|
+
[112 /* InvalidStatement */]: this.prototype.writeNodeDefault,
|
2119
|
+
[113 /* NestedMethodDeclarationStatement */]: this.prototype.writeNodeDefault,
|
2120
|
+
[114 /* LocalVariableDeclarationStatement */]: this.prototype.writeNodeDefault,
|
2121
|
+
[115 /* LoopStatement */]: this.prototype.writeNodeDefault,
|
2122
|
+
[116 /* ReturnStatement */]: this.prototype.writeNodeDefault,
|
2123
|
+
[117 /* CaseClauseList */]: this.prototype.writeNodeDefault,
|
2124
|
+
[118 /* SwitchStatement */]: this.prototype.writeNodeDefault,
|
2125
|
+
[119 /* MatchExpressionList */]: this.prototype.writeNodeDefault,
|
2126
|
+
[120 /* SwitchStatementCaseClause */]: this.prototype.writeNodeDefault,
|
2127
|
+
[121 /* WhileStatement */]: this.prototype.writeNodeDefault,
|
2128
|
+
[122 /* YieldStatement */]: this.prototype.writeNodeDefault,
|
2129
|
+
[123 /* TranslationParameterList */]: this.prototype.writeNodeDefault,
|
2130
|
+
[124 /* TranslationParameterClause */]: this.prototype.writeTranslationParameterClause,
|
2131
|
+
[125 /* ConstructorTranslation */]: this.prototype.writeConstructorTranslation,
|
2132
|
+
[126 /* IndexerTranslationParameterClause */]: this.prototype.writeIndexerTranslationParameterClause,
|
2133
|
+
[127 /* IndexerTranslation */]: this.prototype.writeIndexerTranslation,
|
2134
|
+
[128 /* TranslationTypeParameterList */]: this.prototype.writeNodeDefault,
|
2135
|
+
[129 /* TranslationTypeParameterClause */]: this.prototype.writeTranslationTypeParameterClause,
|
2136
|
+
[130 /* PackageMethodTranslation */]: this.prototype.writePackageMethodTranslation,
|
2137
|
+
[131 /* TypeMethodTranslation */]: this.prototype.writeTypeMethodTranslation,
|
2138
|
+
[132 /* MethodTypeTranslation */]: this.prototype.writeMethodTypeTranslation,
|
2139
|
+
[133 /* PackageImportTranslation */]: this.prototype.writePackageImportTranslation,
|
2140
|
+
[135 /* PackageVariableTranslation */]: this.prototype.writePackageVariableTranslation,
|
2141
|
+
[136 /* TypeVariableOrVariantTranslation */]: this.prototype.writeTypeVariableOrVariantTranslation,
|
2142
|
+
[137 /* TypeMemberTranslationList */]: this.prototype.writeNodeDefault,
|
2143
|
+
[138 /* TypeTranslation */]: this.prototype.writeTypeTranslation,
|
2144
|
+
[139 /* TextLiteralTranslation */]: this.prototype.writeNodeDefault,
|
2145
|
+
[140 /* TextTemplateLiteralTranslation */]: this.prototype.writeNodeDefault,
|
2146
|
+
[145 /* TagList */]: this.prototype.writeNodeDefault,
|
2147
|
+
[147 /* ModifierList */]: this.prototype.writeNodeDefault,
|
2148
|
+
[152 /* SetterParameterDeclaration */]: this.prototype.writeNodeDefault,
|
2149
|
+
[154 /* TypeArgumentList */]: this.prototype.writeNodeDefault,
|
2150
|
+
[156 /* TypeParameterList */]: this.prototype.writeNodeDefault,
|
2151
|
+
[157 /* TypeAnnotation */]: this.prototype.writeNodeDefault
|
2141
2152
|
};
|
2142
2153
|
return writeFunctions;
|
2143
2154
|
}
|
@@ -2149,14 +2160,13 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2149
2160
|
};
|
2150
2161
|
var modifierSortOrder = {
|
2151
2162
|
[34 /* Hidden */]: 0,
|
2152
|
-
[
|
2153
|
-
[
|
2154
|
-
[
|
2155
|
-
[
|
2156
|
-
[
|
2157
|
-
[
|
2158
|
-
[
|
2159
|
-
[33 /* Const */]: 8
|
2163
|
+
[39 /* Static */]: 1,
|
2164
|
+
[16 /* Basic */]: 2,
|
2165
|
+
[36 /* Redefinable */]: 3,
|
2166
|
+
[35 /* Abstract */]: 4,
|
2167
|
+
[37 /* Redefined */]: 5,
|
2168
|
+
[38 /* Async */]: 6,
|
2169
|
+
[33 /* Const */]: 7
|
2160
2170
|
};
|
2161
2171
|
|
2162
2172
|
// source/services/TreeUtils.ts
|
@@ -2324,7 +2334,7 @@ var TranslationsGenerationService = class {
|
|
2324
2334
|
return void 0;
|
2325
2335
|
}
|
2326
2336
|
let result;
|
2327
|
-
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind ===
|
2337
|
+
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind === 138 /* TypeTranslation */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
|
2328
2338
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
2329
2339
|
if (translationPackage !== void 0) {
|
2330
2340
|
const generator = new TranslationsGenerator(
|
@@ -2336,7 +2346,7 @@ var TranslationsGenerationService = class {
|
|
2336
2346
|
result = generator.generateMissingTypeMemberTranslations(tokenOrKeyword.parent);
|
2337
2347
|
}
|
2338
2348
|
}
|
2339
|
-
if (result === void 0 && tokenOrKeyword.isKeyword(
|
2349
|
+
if (result === void 0 && tokenOrKeyword.isKeyword(54 /* Translations */) && tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */) {
|
2340
2350
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
2341
2351
|
if (translationPackage !== void 0) {
|
2342
2352
|
const generator = new TranslationsGenerator(
|
@@ -2362,7 +2372,7 @@ var TranslationsGenerationService = class {
|
|
2362
2372
|
if (tokenOrKeyword === void 0) {
|
2363
2373
|
return false;
|
2364
2374
|
}
|
2365
|
-
if (!(tokenOrKeyword.isKeyword(
|
2375
|
+
if (!(tokenOrKeyword.isKeyword(54 /* Translations */) && tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */)) {
|
2366
2376
|
return false;
|
2367
2377
|
}
|
2368
2378
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
@@ -2370,16 +2380,19 @@ var TranslationsGenerationService = class {
|
|
2370
2380
|
return false;
|
2371
2381
|
}
|
2372
2382
|
const generator = new TranslationsGenerator(analyzer, sourceFile, translationPackage, sourceFile.package.dialect);
|
2373
|
-
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind ===
|
2383
|
+
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind === 138 /* TypeTranslation */).mapAndFilter((t) => translationPackage.getTypeTranslationTarget(t).target).any((t) => generator.collectNotTranslatedTypeMembers(t).length > 0);
|
2374
2384
|
}
|
2375
2385
|
};
|
2376
|
-
var TranslationsGenerator = class {
|
2386
|
+
var TranslationsGenerator = class _TranslationsGenerator {
|
2377
2387
|
constructor(_analyzer, _sourceFile, _translationPackage, _dialect) {
|
2378
2388
|
this._analyzer = _analyzer;
|
2379
2389
|
this._sourceFile = _sourceFile;
|
2380
2390
|
this._translationPackage = _translationPackage;
|
2381
2391
|
this._dialect = _dialect;
|
2382
2392
|
}
|
2393
|
+
static {
|
2394
|
+
this._translationArrowRegExp = /-> /g;
|
2395
|
+
}
|
2383
2396
|
generateMissingPackageMemberAndTypeMemberTranslations(translationsDeclaration) {
|
2384
2397
|
const result = new Array();
|
2385
2398
|
const memberEntities = this.collectNotTranslatedPackageMembers();
|
@@ -2389,9 +2402,27 @@ var TranslationsGenerator = class {
|
|
2389
2402
|
keywordsLocale: this._translationPackage.getTranslatedPackage().getLocale(),
|
2390
2403
|
keywordsDialect: this._dialect,
|
2391
2404
|
initialIndentation: this.detectIndentationForPackageMemberTranslations(translationsDeclaration),
|
2392
|
-
indentationStep: this.detectIndentationStepForTypeMemberTranslations(translationsDeclaration)
|
2405
|
+
indentationStep: this.detectIndentationStepForTypeMemberTranslations(translationsDeclaration),
|
2406
|
+
newLine
|
2393
2407
|
};
|
2394
|
-
const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createPackageMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) =>
|
2408
|
+
const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createPackageMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) => {
|
2409
|
+
const code = new SyntaxToCode(n, syntaxToCodeOptions).convert();
|
2410
|
+
if (n.kind === 138 /* TypeTranslation */) {
|
2411
|
+
const startOffset = Math.max(code.indexOf(newLine), 0);
|
2412
|
+
return this.addNewLineBeforeArrowsInTranslation(
|
2413
|
+
code,
|
2414
|
+
syntaxToCodeOptions.initialIndentation + syntaxToCodeOptions.indentationStep.repeat(2),
|
2415
|
+
newLine,
|
2416
|
+
startOffset
|
2417
|
+
);
|
2418
|
+
} else {
|
2419
|
+
return this.addNewLineBeforeArrowsInTranslation(
|
2420
|
+
code,
|
2421
|
+
syntaxToCodeOptions.initialIndentation + syntaxToCodeOptions.indentationStep,
|
2422
|
+
newLine
|
2423
|
+
);
|
2424
|
+
}
|
2425
|
+
}).join(`${newLine}${newLine}`);
|
2395
2426
|
const editRange = Range.empty(translationsDeclaration.openBraceToken.rangeWithoutTrivia.end);
|
2396
2427
|
let editText = newLine + memberTranslationsCode;
|
2397
2428
|
if (translationsDeclaration.translationList.translationDeclarations.count() > 0) {
|
@@ -2408,7 +2439,7 @@ var TranslationsGenerator = class {
|
|
2408
2439
|
generateMissingTranslationsForPartiallyTranslatedTypes(translationsDeclaration) {
|
2409
2440
|
const result = new Array();
|
2410
2441
|
for (const translation of translationsDeclaration.translationList.translationDeclarations) {
|
2411
|
-
if (translation.kind ===
|
2442
|
+
if (translation.kind === 138 /* TypeTranslation */) {
|
2412
2443
|
const edits = this.generateMissingTypeMemberTranslations(translation);
|
2413
2444
|
if (edits !== void 0) {
|
2414
2445
|
result.push(...edits);
|
@@ -2427,13 +2458,21 @@ var TranslationsGenerator = class {
|
|
2427
2458
|
return void 0;
|
2428
2459
|
}
|
2429
2460
|
const newLine = this.detectNewLine();
|
2430
|
-
const membersIndentation = this.detectIndentationForTypeMemberTranslations(typeTranslation);
|
2431
2461
|
const syntaxToCodeOptions = {
|
2432
2462
|
keywordsLocale: this._translationPackage.getTranslatedPackage().getLocale(),
|
2433
2463
|
keywordsDialect: this._dialect,
|
2434
|
-
initialIndentation:
|
2464
|
+
initialIndentation: this.detectIndentationForTypeMemberTranslations(typeTranslation),
|
2465
|
+
indentationStep: this.detectIndentationStepForTypeMemberTranslations(typeTranslation),
|
2466
|
+
newLine
|
2435
2467
|
};
|
2436
|
-
const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createTypeMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) =>
|
2468
|
+
const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createTypeMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) => {
|
2469
|
+
const code = new SyntaxToCode(n, syntaxToCodeOptions).convert();
|
2470
|
+
return this.addNewLineBeforeArrowsInTranslation(
|
2471
|
+
code,
|
2472
|
+
syntaxToCodeOptions.initialIndentation + syntaxToCodeOptions.indentationStep,
|
2473
|
+
newLine
|
2474
|
+
);
|
2475
|
+
}).join(`${newLine}${newLine}`);
|
2437
2476
|
let editText;
|
2438
2477
|
let editRange;
|
2439
2478
|
if (typeTranslation.openBraceToken !== void 0) {
|
@@ -2506,21 +2545,34 @@ var TranslationsGenerator = class {
|
|
2506
2545
|
}
|
2507
2546
|
return " ".repeat(indentationSize);
|
2508
2547
|
}
|
2509
|
-
detectIndentationStepForTypeMemberTranslations(
|
2548
|
+
detectIndentationStepForTypeMemberTranslations(node) {
|
2510
2549
|
let indentationStepSize;
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2550
|
+
if (node.kind === 138 /* TypeTranslation */) {
|
2551
|
+
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(node, this._sourceFile);
|
2552
|
+
}
|
2553
|
+
if (indentationStepSize === void 0) {
|
2554
|
+
const translationsDeclarations = node.kind === 21 /* TranslationsDeclaration */ ? node : node.parent.parent;
|
2555
|
+
for (const member of translationsDeclarations.translationList.translationDeclarations) {
|
2556
|
+
if (member.kind === 138 /* TypeTranslation */) {
|
2557
|
+
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(member, this._sourceFile);
|
2558
|
+
if (indentationStepSize !== void 0) {
|
2559
|
+
break;
|
2560
|
+
}
|
2519
2561
|
}
|
2520
2562
|
}
|
2521
2563
|
}
|
2522
2564
|
indentationStepSize ??= 2;
|
2523
2565
|
return " ".repeat(indentationStepSize);
|
2566
|
+
function tryDetectIndentationStepSizeUsingTypeTranslation(node2, sourceFile) {
|
2567
|
+
let result;
|
2568
|
+
const member = node2.memberList?.members.first();
|
2569
|
+
if (member !== void 0) {
|
2570
|
+
const typeTranslationIndentation = sourceFile.getPositionAt(node2.typeKeyword.rangeWithoutTrivia.start).character;
|
2571
|
+
const typeMemberTranslationIndentation = sourceFile.getPositionAt(member.rangeWithoutTrivia.start).character;
|
2572
|
+
result = Math.max(typeMemberTranslationIndentation - typeTranslationIndentation, 0);
|
2573
|
+
}
|
2574
|
+
return result;
|
2575
|
+
}
|
2524
2576
|
}
|
2525
2577
|
detectIndentationForTypeMemberTranslations(typeTranslation) {
|
2526
2578
|
let indentationSize;
|
@@ -2560,7 +2612,7 @@ var TranslationsGenerator = class {
|
|
2560
2612
|
return this.createPackageTypeWithMembersTranslation(entity);
|
2561
2613
|
case 11 /* MethodType */:
|
2562
2614
|
return this.createPackageMethodTypeTranslation(entity);
|
2563
|
-
case
|
2615
|
+
case 17 /* TypeExtension */:
|
2564
2616
|
return void 0;
|
2565
2617
|
default:
|
2566
2618
|
Debug.never(entity);
|
@@ -2602,8 +2654,7 @@ var TranslationsGenerator = class {
|
|
2602
2654
|
return this.createVariantTranslation(entity);
|
2603
2655
|
case 8 /* DereferenceOperator */:
|
2604
2656
|
case 10 /* Destructor */:
|
2605
|
-
case 15 /*
|
2606
|
-
case 16 /* BinaryOperator */:
|
2657
|
+
case 15 /* Operator */:
|
2607
2658
|
return void 0;
|
2608
2659
|
default:
|
2609
2660
|
Debug.never(entity);
|
@@ -2632,7 +2683,18 @@ var TranslationsGenerator = class {
|
|
2632
2683
|
return SyntaxFactory.typeVariableOrVariantTranslation(name, name);
|
2633
2684
|
}
|
2634
2685
|
getNameText(name) {
|
2635
|
-
|
2686
|
+
const flags = name.flags & ~16 /* ConflictResolvingParameterName */;
|
2687
|
+
return name.getPreferredUnescapedOriginal(flags);
|
2688
|
+
}
|
2689
|
+
// TODO: Работать с синтаксическим деревом и использовать Trivia для добавления перевода строки. Требуется доработка
|
2690
|
+
// SyntaxToCode и возможность добавлять Trivia в узлы, создаваемые через SyntaxFactory.
|
2691
|
+
addNewLineBeforeArrowsInTranslation(code, indentationAfterNewLine, newLine, startOffset = 0) {
|
2692
|
+
const replacementString = "->" + newLine + indentationAfterNewLine;
|
2693
|
+
if (startOffset === 0) {
|
2694
|
+
return code.replace(_TranslationsGenerator._translationArrowRegExp, replacementString);
|
2695
|
+
} else {
|
2696
|
+
return code.substring(0, startOffset) + code.substring(startOffset).replace(_TranslationsGenerator._translationArrowRegExp, replacementString);
|
2697
|
+
}
|
2636
2698
|
}
|
2637
2699
|
detectNewLine() {
|
2638
2700
|
return this._sourceFile.getSourceText().includes("\r\n") ? "\r\n" : "\n";
|
@@ -2679,7 +2741,7 @@ var CodeActionsService = class {
|
|
2679
2741
|
}
|
2680
2742
|
const result = new Array();
|
2681
2743
|
const diagnosticCodeSet = new Set(diagnosticCodes);
|
2682
|
-
if (diagnosticCodeSet.has(
|
2744
|
+
if (diagnosticCodeSet.has(142 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(143 /* TheFollowingDeclarationAreNotTranslated0And1More */)) {
|
2683
2745
|
const data = { onlyTypeMembers: false };
|
2684
2746
|
result.push(CodeAction.unresolved(
|
2685
2747
|
"\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.",
|
@@ -2796,13 +2858,13 @@ var ValueArgumentFactory = class _ValueArgumentFactory {
|
|
2796
2858
|
var SignatureForNode = class _SignatureForNode {
|
2797
2859
|
static getSignaturesForNode(analyzer, node) {
|
2798
2860
|
switch (node.kind) {
|
2799
|
-
case
|
2861
|
+
case 69 /* CallExpression */:
|
2800
2862
|
return _SignatureForNode.getSignaturesForCallExpression(analyzer, node);
|
2801
|
-
case
|
2863
|
+
case 70 /* AutotypeCallExpression */:
|
2802
2864
|
return _SignatureForNode.getSignaturesForAutotypeCallExpression(analyzer, node);
|
2803
|
-
case
|
2865
|
+
case 72 /* IndexedAccessExpression */:
|
2804
2866
|
return _SignatureForNode.getSignaturesForIndexedAccessExpression(analyzer, node);
|
2805
|
-
case
|
2867
|
+
case 146 /* Tag */:
|
2806
2868
|
return _SignatureForNode.getSignaturesForTag(analyzer, node);
|
2807
2869
|
default:
|
2808
2870
|
Debug.never(node);
|
@@ -2942,7 +3004,7 @@ var SimplifiedOverloadResolver = class _SimplifiedOverloadResolver {
|
|
2942
3004
|
result = false;
|
2943
3005
|
break;
|
2944
3006
|
}
|
2945
|
-
if (argument.expression === void 0 || argument.expression.kind ===
|
3007
|
+
if (argument.expression === void 0 || argument.expression.kind === 73 /* InvalidExpression */) {
|
2946
3008
|
continue;
|
2947
3009
|
}
|
2948
3010
|
const targetParameterType = targetParameter.getType();
|
@@ -3156,17 +3218,20 @@ var CompletionService = class {
|
|
3156
3218
|
);
|
3157
3219
|
completionItemInfos = this.mergeOverloadedMethods(completionItemInfos);
|
3158
3220
|
completionItemInfos = this.removeCompletionItemsWithDuplicateLabels(completionItemInfos);
|
3159
|
-
const cacheId = this._cache.add(completionItemInfos);
|
3221
|
+
const cacheId = this._cache.add(completionItemInfos, sourceFile).id;
|
3160
3222
|
const result = this.convertCompletionItemInfos(completionItemInfos, cacheId);
|
3161
3223
|
return result;
|
3162
3224
|
}
|
3163
3225
|
resolveCompletionItem(cacheId, indexInCache) {
|
3164
|
-
const
|
3165
|
-
if (
|
3226
|
+
const cacheEntry = this._cache.get(cacheId);
|
3227
|
+
if (cacheEntry === void 0 || indexInCache >= cacheEntry.items.length) {
|
3166
3228
|
return new ResolutionResult_notInCache();
|
3167
3229
|
}
|
3168
|
-
const completionItemInfo =
|
3169
|
-
return new ResolutionResult_item(
|
3230
|
+
const completionItemInfo = cacheEntry.items[indexInCache];
|
3231
|
+
return new ResolutionResult_item(
|
3232
|
+
this.convertCompletionItemInfo(completionItemInfo, cacheId, indexInCache, true),
|
3233
|
+
cacheEntry.sourceFile
|
3234
|
+
);
|
3170
3235
|
}
|
3171
3236
|
createSemanticContextAtPosition(positionDescription) {
|
3172
3237
|
switch (positionDescription.kind) {
|
@@ -3215,6 +3280,9 @@ var CompletionService = class {
|
|
3215
3280
|
if (syntaxContext.isInComment || syntaxContext.isInStringOrChar) {
|
3216
3281
|
return { kind: "none" };
|
3217
3282
|
}
|
3283
|
+
if (syntaxContext.isInQuotedIdentifier !== void 0 && (syntaxContext.isInQuotedIdentifier.parent.kind === 53 /* OperatorDeclaration */ || syntaxContext.isInQuotedIdentifier.parent.kind === 52 /* TypeMethodDeclaration */)) {
|
3284
|
+
return new OperatorNameCompletionContext(syntaxContext.isInQuotedIdentifier);
|
3285
|
+
}
|
3218
3286
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3219
3287
|
if (tokenOrKeyword.isKeyword(17 /* Import */) && tokenOrKeyword.parent.kind === 5 /* SinglePackageImportDirective */) {
|
3220
3288
|
return new PackageImportCompletionContext([], void 0);
|
@@ -3271,7 +3339,7 @@ var CompletionService = class {
|
|
3271
3339
|
typeExtensionLookup
|
3272
3340
|
);
|
3273
3341
|
}
|
3274
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3342
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 134 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
|
3275
3343
|
const namedTypeSpecifier = tokenOrKeyword.parent.parent;
|
3276
3344
|
const resolutionResult = this._analyzer.resolveNamedTypeSpecifier(namedTypeSpecifier);
|
3277
3345
|
const segmentIndex = Math.floor(
|
@@ -3279,7 +3347,7 @@ var CompletionService = class {
|
|
3279
3347
|
);
|
3280
3348
|
if (segmentIndex < resolutionResult.resolvedQualifiers.length) {
|
3281
3349
|
let completionInIsOrAsExpressionInfo;
|
3282
|
-
if (namedTypeSpecifier.parent.kind ===
|
3350
|
+
if (namedTypeSpecifier.parent.kind === 74 /* IsExpression */ || namedTypeSpecifier.parent.kind === 65 /* AsExpression */) {
|
3283
3351
|
completionInIsOrAsExpressionInfo = {
|
3284
3352
|
expressionType: this._analyzer.type.ofExpression(namedTypeSpecifier.parent.expression)
|
3285
3353
|
};
|
@@ -3315,7 +3383,7 @@ var CompletionService = class {
|
|
3315
3383
|
}
|
3316
3384
|
if (syntaxContext.isUnqualifiedTypeContext !== void 0) {
|
3317
3385
|
let completionInIsOrAsExpressionInfo;
|
3318
|
-
if (tokenOrKeyword.parent.kind ===
|
3386
|
+
if (tokenOrKeyword.parent.kind === 74 /* IsExpression */ || tokenOrKeyword.parent.kind === 65 /* AsExpression */) {
|
3319
3387
|
completionInIsOrAsExpressionInfo = {
|
3320
3388
|
expressionType: this._analyzer.type.ofExpression(tokenOrKeyword.parent.expression)
|
3321
3389
|
};
|
@@ -3365,17 +3433,17 @@ var CompletionService = class {
|
|
3365
3433
|
translationKind = 0 /* Any */;
|
3366
3434
|
hasPrecedingKeyword = false;
|
3367
3435
|
}
|
3368
|
-
if (tokenOrKeyword.isKeyword(17 /* Import */) && tokenOrKeyword.parent.kind ===
|
3436
|
+
if (tokenOrKeyword.isKeyword(17 /* Import */) && tokenOrKeyword.parent.kind === 133 /* PackageImportTranslation */) {
|
3369
3437
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3370
3438
|
translationKind = 1 /* PackageImport */;
|
3371
3439
|
hasPrecedingKeyword = true;
|
3372
3440
|
}
|
3373
|
-
if (tokenOrKeyword.isKeyword(15 /* Type */) && (tokenOrKeyword.parent.kind ===
|
3441
|
+
if (tokenOrKeyword.isKeyword(15 /* Type */) && (tokenOrKeyword.parent.kind === 138 /* TypeTranslation */ || tokenOrKeyword.parent.kind === 132 /* MethodTypeTranslation */)) {
|
3374
3442
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3375
3443
|
translationKind = 3 /* Type */;
|
3376
3444
|
hasPrecedingKeyword = true;
|
3377
3445
|
}
|
3378
|
-
if (tokenOrKeyword.isKeyword(11 /*
|
3446
|
+
if (tokenOrKeyword.isKeyword(11 /* Function */) && tokenOrKeyword.parent.kind === 130 /* PackageMethodTranslation */) {
|
3379
3447
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3380
3448
|
translationKind = 2 /* Method */;
|
3381
3449
|
hasPrecedingKeyword = true;
|
@@ -3395,9 +3463,9 @@ var CompletionService = class {
|
|
3395
3463
|
hasPrecedingKeyword
|
3396
3464
|
);
|
3397
3465
|
}
|
3398
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3466
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 134 /* QualifiedName */) {
|
3399
3467
|
const qualifiedName = tokenOrKeyword.parent;
|
3400
|
-
if (qualifiedName.parent.kind ===
|
3468
|
+
if (qualifiedName.parent.kind === 133 /* PackageImportTranslation */ && qualifiedName === qualifiedName.parent.sourceName) {
|
3401
3469
|
const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.rangeStart < tokenOrKeyword.value.rangeStart).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
3402
3470
|
const sourceLocale = translationPackage.getTranslatedPackage().getLocale();
|
3403
3471
|
return new PackageImportCompletionContext(precedingSegmentNames, { sourceLocale });
|
@@ -3422,12 +3490,12 @@ var CompletionService = class {
|
|
3422
3490
|
translationKind = 0 /* Any */;
|
3423
3491
|
hasPrecedingKeyword = false;
|
3424
3492
|
}
|
3425
|
-
if (tokenOrKeyword.isKeyword(11 /*
|
3493
|
+
if (tokenOrKeyword.isKeyword(11 /* Function */) && tokenOrKeyword.parent.kind === 131 /* TypeMethodTranslation */) {
|
3426
3494
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3427
3495
|
translationKind = 1 /* Method */;
|
3428
3496
|
hasPrecedingKeyword = true;
|
3429
3497
|
}
|
3430
|
-
if (tokenOrKeyword.isKeyword(28 /* Creation */) && tokenOrKeyword.parent.kind ===
|
3498
|
+
if (tokenOrKeyword.isKeyword(28 /* Creation */) && tokenOrKeyword.parent.kind === 125 /* ConstructorTranslation */) {
|
3431
3499
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3432
3500
|
translationKind = 3 /* Constructor */;
|
3433
3501
|
hasPrecedingKeyword = true;
|
@@ -3457,17 +3525,17 @@ var CompletionService = class {
|
|
3457
3525
|
let signatures;
|
3458
3526
|
let valueArguments;
|
3459
3527
|
switch (role.argumentList.parent.kind) {
|
3460
|
-
case
|
3528
|
+
case 69 /* CallExpression */:
|
3461
3529
|
signatures = SignatureForNode.getSignaturesForCallExpression(this._analyzer, role.argumentList.parent);
|
3462
3530
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfCallExpression(role.argumentList.parent);
|
3463
3531
|
break;
|
3464
|
-
case
|
3532
|
+
case 70 /* AutotypeCallExpression */:
|
3465
3533
|
signatures = SignatureForNode.getSignaturesForAutotypeCallExpression(this._analyzer, role.argumentList.parent);
|
3466
3534
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfAutotypeCallExpression(
|
3467
3535
|
role.argumentList.parent
|
3468
3536
|
);
|
3469
3537
|
break;
|
3470
|
-
case
|
3538
|
+
case 146 /* Tag */:
|
3471
3539
|
signatures = SignatureForNode.getSignaturesForTag(this._analyzer, role.argumentList.parent);
|
3472
3540
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(role.argumentList.parent);
|
3473
3541
|
break;
|
@@ -3581,6 +3649,9 @@ var CompletionService = class {
|
|
3581
3649
|
case "type-member-translation-list":
|
3582
3650
|
result = this.getTypeAliasMemberListItemInfos(completionContext);
|
3583
3651
|
break;
|
3652
|
+
case "operator-name":
|
3653
|
+
result = this.getOperatorNameItemInfos(completionContext);
|
3654
|
+
break;
|
3584
3655
|
case "none":
|
3585
3656
|
result = [];
|
3586
3657
|
break;
|
@@ -3601,22 +3672,22 @@ var CompletionService = class {
|
|
3601
3672
|
}
|
3602
3673
|
const kinds = /* @__PURE__ */ new Set();
|
3603
3674
|
if (syntaxContext.isPackageMemberDeclarationListContext) {
|
3604
|
-
kinds.add(17 /* Import */).add(7 /* Run */).add(28 /* Creation */).add(11 /*
|
3675
|
+
kinds.add(17 /* Import */).add(7 /* Run */).add(28 /* Creation */).add(11 /* Function */).add(15 /* Type */).add(57 /* Get */).add(58 /* Set */).add(54 /* Translations */);
|
3605
3676
|
}
|
3606
3677
|
if (syntaxContext.isPackageMemberDeclarationListContext || syntaxContext.isTypeMemberDeclarationListContext) {
|
3607
|
-
kinds.add(
|
3678
|
+
kinds.add(34 /* Hidden */).add(39 /* Static */).add(16 /* Basic */).add(36 /* Redefinable */).add(35 /* Abstract */).add(37 /* Redefined */).add(38 /* Async */).add(33 /* Const */);
|
3608
3679
|
}
|
3609
3680
|
if (syntaxContext.isTypeMemberDeclarationListContext) {
|
3610
|
-
kinds.add(28 /* Creation */).add(11 /*
|
3681
|
+
kinds.add(28 /* Creation */).add(11 /* Function */).add(46 /* Destruction */).add(57 /* Get */).add(58 /* Set */);
|
3611
3682
|
}
|
3612
3683
|
if (syntaxContext.isStatementContext) {
|
3613
|
-
kinds.add(7 /* Run */).add(32 /* For */).add(23 /* While */).add(24 /* Loop */).add(14 /* Return */).add(18 /* Error */).add(26 /* Yield */).add(
|
3684
|
+
kinds.add(7 /* Run */).add(32 /* For */).add(23 /* While */).add(24 /* Loop */).add(14 /* Return */).add(18 /* Error */).add(26 /* Yield */).add(44 /* Await */).add(30 /* BreakLoop */).add(31 /* ContinueLoop */).add(12 /* If */).add(42 /* Switch */).add(1 /* Let */).add(33 /* Const */).add(45 /* Dispose */).add(11 /* Function */).add(38 /* Async */);
|
3614
3685
|
}
|
3615
3686
|
if (this.isFromKeywordContext(positionDescription)) {
|
3616
3687
|
kinds.add(8 /* From */);
|
3617
3688
|
}
|
3618
3689
|
if (syntaxContext.isExpressionContext !== void 0) {
|
3619
|
-
kinds.add(
|
3690
|
+
kinds.add(41 /* Not */).add(51 /* Yes */).add(52 /* No */).add(56 /* None */).add(38 /* Async */).add(11 /* Function */).add(53 /* Reference */).add(2 /* Autotype */);
|
3620
3691
|
if (positionDescription.kind === "after-token-or-keyword") {
|
3621
3692
|
const container = semanticContext.getContainingTypeOrTypeExtension();
|
3622
3693
|
if (container !== void 0) {
|
@@ -3624,17 +3695,17 @@ var CompletionService = class {
|
|
3624
3695
|
if (container.kind === "type") {
|
3625
3696
|
const typeEntity = container.value;
|
3626
3697
|
if (typeEntity?.kind === 12 /* StructuredType */ && typeEntity.getBaseObjectType() !== void 0 || typeEntity?.kind === 2 /* VariantType */ || typeEntity?.kind === 14 /* AliasType */) {
|
3627
|
-
kinds.add(
|
3698
|
+
kinds.add(55 /* Base */);
|
3628
3699
|
}
|
3629
3700
|
}
|
3630
3701
|
}
|
3631
3702
|
}
|
3632
3703
|
}
|
3633
3704
|
if (this.isTypeKindCompletionContext(positionDescription)) {
|
3634
|
-
kinds.add(4 /* Object */).add(5 /* PlainObject */).add(3 /* Aspect */).add(6 /* Variant */).add(11 /*
|
3705
|
+
kinds.add(4 /* Object */).add(5 /* PlainObject */).add(3 /* Aspect */).add(6 /* Variant */).add(11 /* Function */).add(38 /* Async */);
|
3635
3706
|
}
|
3636
3707
|
if (this.isCaseKeywordContext(positionDescription, syntaxContext)) {
|
3637
|
-
kinds.add(
|
3708
|
+
kinds.add(43 /* Case */);
|
3638
3709
|
}
|
3639
3710
|
if (this.isRunStatementAccessorListContext(positionDescription)) {
|
3640
3711
|
kinds.add(29 /* OnError */).add(19 /* Finally */);
|
@@ -3643,19 +3714,19 @@ var CompletionService = class {
|
|
3643
3714
|
kinds.add(9 /* Else */).add(10 /* ElseIf */);
|
3644
3715
|
}
|
3645
3716
|
if (syntaxContext.precedingExpression !== void 0) {
|
3646
|
-
kinds.add(
|
3717
|
+
kinds.add(40 /* As */).add(13 /* Is */).add(20 /* And */).add(21 /* Or */).add(22 /* Xor */).add(27 /* When */);
|
3647
3718
|
}
|
3648
3719
|
if (this.isModifierLevelContext(positionDescription)) {
|
3649
|
-
kinds.add(
|
3720
|
+
kinds.add(50 /* InType */).add(47 /* InHierarchy */).add(48 /* InFile */).add(49 /* InPackage */);
|
3650
3721
|
}
|
3651
3722
|
if (this.isRepeatWhileKeywordContext(positionDescription)) {
|
3652
3723
|
kinds.add(25 /* RepeatWhile */);
|
3653
3724
|
}
|
3654
3725
|
if (syntaxContext.isUnqualifiedTypeContext?.allowsAnonymousTypes === true) {
|
3655
|
-
kinds.add(5 /* PlainObject */).add(4 /* Object */).add(6 /* Variant */).add(3 /* Aspect */).add(11 /*
|
3726
|
+
kinds.add(5 /* PlainObject */).add(4 /* Object */).add(6 /* Variant */).add(3 /* Aspect */).add(11 /* Function */).add(38 /* Async */);
|
3656
3727
|
}
|
3657
|
-
if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(
|
3658
|
-
kinds.add(11 /*
|
3728
|
+
if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(38 /* Async */) && (positionDescription.tokenOrKeyword.parent.kind === 58 /* NestedMethodDeclaration */ || positionDescription.tokenOrKeyword.parent.kind === 76 /* MethodLiteral */ || positionDescription.tokenOrKeyword.parent.kind === 29 /* MethodTypeDeclarationBody */)) {
|
3729
|
+
kinds.add(11 /* Function */);
|
3659
3730
|
}
|
3660
3731
|
return Query.from(kinds.values()).map(
|
3661
3732
|
(k) => LocalizationHelper.localizeKeyword(k, this._locale, this._dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))
|
@@ -3666,28 +3737,28 @@ var CompletionService = class {
|
|
3666
3737
|
return false;
|
3667
3738
|
}
|
3668
3739
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3669
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3740
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 95 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 115 /* LoopStatement */;
|
3670
3741
|
}
|
3671
3742
|
isModifierLevelContext(positionDescription) {
|
3672
3743
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3673
3744
|
return false;
|
3674
3745
|
}
|
3675
3746
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3676
|
-
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind ===
|
3747
|
+
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 148 /* Modifier */;
|
3677
3748
|
}
|
3678
3749
|
isElseOrElseIfKeywordContext(positionDescription) {
|
3679
3750
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3680
3751
|
return false;
|
3681
3752
|
}
|
3682
3753
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3683
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3754
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 95 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 109 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.thenBlock || tokenOrKeyword.parent.parent.kind === 111 /* ElseIfClause */);
|
3684
3755
|
}
|
3685
3756
|
isRunStatementAccessorListContext(positionDescription) {
|
3686
3757
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3687
3758
|
return false;
|
3688
3759
|
}
|
3689
3760
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3690
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3761
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 95 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 100 /* RunStatement */ || tokenOrKeyword.parent.parent.kind === 101 /* OnErrorClause */ || tokenOrKeyword.parent.parent.kind === 103 /* FinallyClause */);
|
3691
3762
|
}
|
3692
3763
|
isTypeKindCompletionContext(positionDescription) {
|
3693
3764
|
return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(57 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
|
@@ -3697,17 +3768,17 @@ var CompletionService = class {
|
|
3697
3768
|
return false;
|
3698
3769
|
}
|
3699
3770
|
const token = positionDescription.tokenOrKeyword.value;
|
3700
|
-
return token.parent.kind ===
|
3771
|
+
return token.parent.kind === 60 /* EnumerationVariableDeclaration */ && (token.parent.parent.elements.length > 0 && token.parent.parent.elements[token.parent.parent.elements.length - 1] === token.parent || token.parent.parent.elements.length > 1 && token.parent.parent.elements[token.parent.parent.elements.length - 2] === token.parent);
|
3701
3772
|
}
|
3702
3773
|
isCaseKeywordContext(positionDescription, syntaxContext) {
|
3703
3774
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3704
3775
|
return false;
|
3705
3776
|
}
|
3706
3777
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3707
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3778
|
+
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 95 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 120 /* SwitchStatementCaseClause */) {
|
3708
3779
|
return true;
|
3709
3780
|
}
|
3710
|
-
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind ===
|
3781
|
+
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 118 /* SwitchStatement */) {
|
3711
3782
|
return true;
|
3712
3783
|
}
|
3713
3784
|
return false;
|
@@ -3825,7 +3896,9 @@ var CompletionService = class {
|
|
3825
3896
|
default:
|
3826
3897
|
Debug.never(d.value);
|
3827
3898
|
}
|
3828
|
-
})
|
3899
|
+
}).chain(
|
3900
|
+
Query.from(lookup.getOperators()).map((o) => new OperatorCompletionItemInfo(this.completionItemInfoContext, o.value, o.localization))
|
3901
|
+
);
|
3829
3902
|
}
|
3830
3903
|
getTypeCompletionItemInfos(ctx) {
|
3831
3904
|
let result;
|
@@ -3996,7 +4069,7 @@ var CompletionService = class {
|
|
3996
4069
|
default:
|
3997
4070
|
Debug.never(m.value);
|
3998
4071
|
}
|
3999
|
-
}).toArray();
|
4072
|
+
}).chain(Query.from(memberLookup.getOperators(ctx.hidingMatcher, ctx.typeExtensionsLookup)).filter((m) => m.value.isStatic() === ctx.isStaticAccess).map((o) => new OperatorCompletionItemInfo(this.completionItemInfoContext, o.value, o.localization))).toArray();
|
4000
4073
|
}
|
4001
4074
|
}
|
4002
4075
|
getPackageImportCompletionItemInfos(ctx) {
|
@@ -4103,7 +4176,7 @@ var CompletionService = class {
|
|
4103
4176
|
const keywords = [
|
4104
4177
|
17 /* Import */,
|
4105
4178
|
15 /* Type */,
|
4106
|
-
11 /*
|
4179
|
+
11 /* Function */
|
4107
4180
|
];
|
4108
4181
|
result = result.chain(
|
4109
4182
|
Query.from(keywords).map(
|
@@ -4177,7 +4250,7 @@ var CompletionService = class {
|
|
4177
4250
|
}
|
4178
4251
|
if (!ctx.hasPrecedingKeyword) {
|
4179
4252
|
const keywords = [
|
4180
|
-
11 /*
|
4253
|
+
11 /* Function */,
|
4181
4254
|
28 /* Creation */
|
4182
4255
|
];
|
4183
4256
|
result = result.chain(
|
@@ -4188,13 +4261,25 @@ var CompletionService = class {
|
|
4188
4261
|
}
|
4189
4262
|
return result.toArray();
|
4190
4263
|
}
|
4264
|
+
getOperatorNameItemInfos(ctx) {
|
4265
|
+
let editRange;
|
4266
|
+
const identifierRange = ctx.nameToken.rangeWithoutTrivia;
|
4267
|
+
if (identifierRange.length > 2) {
|
4268
|
+
editRange = new Range(identifierRange.start + 1, identifierRange.end - 1);
|
4269
|
+
}
|
4270
|
+
return operatorKinds.map((k) => {
|
4271
|
+
const value = LocalizationHelper.localizeSyntacticalOperatorKind(k, this._locale, this._dialect);
|
4272
|
+
return new OperatorNameCompletionItemInfo(this.completionItemInfoContext, value, editRange);
|
4273
|
+
});
|
4274
|
+
}
|
4191
4275
|
mergeOverloadedMethods(completionItemInfos) {
|
4192
4276
|
const result = new Array();
|
4193
4277
|
const methodInfoByLabel = /* @__PURE__ */ new Map();
|
4194
4278
|
for (const itemInfo of completionItemInfos) {
|
4195
4279
|
switch (itemInfo.kind) {
|
4196
4280
|
case "type-method":
|
4197
|
-
case "method-entity":
|
4281
|
+
case "method-entity":
|
4282
|
+
case "operator": {
|
4198
4283
|
const label = itemInfo.getLabel();
|
4199
4284
|
const methodInfo = methodInfoByLabel.get(label);
|
4200
4285
|
if (methodInfo !== void 0) {
|
@@ -4248,6 +4333,7 @@ var CompletionService = class {
|
|
4248
4333
|
info.getCompletionItemKind(),
|
4249
4334
|
isForResolve ? info.getDetails() : void 0,
|
4250
4335
|
info.getInsertText(),
|
4336
|
+
info.getEditRange(),
|
4251
4337
|
info.getSortText(),
|
4252
4338
|
cacheId,
|
4253
4339
|
indexInCache
|
@@ -4255,19 +4341,21 @@ var CompletionService = class {
|
|
4255
4341
|
}
|
4256
4342
|
};
|
4257
4343
|
var CompletionItem = class {
|
4258
|
-
constructor(label, kind, details, insertText, sortText, cacheId, indexInCache) {
|
4344
|
+
constructor(label, kind, details, insertText, editRange, sortText, cacheId, indexInCache) {
|
4259
4345
|
this.label = label;
|
4260
4346
|
this.kind = kind;
|
4261
4347
|
this.details = details;
|
4262
4348
|
this.insertText = insertText;
|
4349
|
+
this.editRange = editRange;
|
4263
4350
|
this.sortText = sortText;
|
4264
4351
|
this.cacheId = cacheId;
|
4265
4352
|
this.indexInCache = indexInCache;
|
4266
4353
|
}
|
4267
4354
|
};
|
4268
4355
|
var ResolutionResult_item = class {
|
4269
|
-
constructor(value) {
|
4356
|
+
constructor(value, sourceFile) {
|
4270
4357
|
this.value = value;
|
4358
|
+
this.sourceFile = sourceFile;
|
4271
4359
|
this.kind = "item";
|
4272
4360
|
}
|
4273
4361
|
};
|
@@ -4324,10 +4412,10 @@ function getRightmostChildExcludingValidEmptyNodes(node) {
|
|
4324
4412
|
}
|
4325
4413
|
function isInvalidNode(node) {
|
4326
4414
|
switch (node.kind) {
|
4327
|
-
case
|
4415
|
+
case 73 /* InvalidExpression */:
|
4328
4416
|
case 43 /* InvalidPackageMemberDeclaration */:
|
4329
|
-
case
|
4330
|
-
case
|
4417
|
+
case 112 /* InvalidStatement */:
|
4418
|
+
case 57 /* InvalidTypeMemberDeclaration */:
|
4331
4419
|
case 16 /* InvalidTypeSpecifier */:
|
4332
4420
|
return true;
|
4333
4421
|
case 0 /* Token */:
|
@@ -4377,6 +4465,12 @@ var TypeCompletionContext = class {
|
|
4377
4465
|
this.kind = "type";
|
4378
4466
|
}
|
4379
4467
|
};
|
4468
|
+
var OperatorNameCompletionContext = class {
|
4469
|
+
constructor(nameToken) {
|
4470
|
+
this.nameToken = nameToken;
|
4471
|
+
this.kind = "operator-name";
|
4472
|
+
}
|
4473
|
+
};
|
4380
4474
|
var ScopeTypeSearchLocation = class {
|
4381
4475
|
constructor(lookup) {
|
4382
4476
|
this.lookup = lookup;
|
@@ -4473,6 +4567,9 @@ var PackageNameSegmentCompletionItemInfo = class {
|
|
4473
4567
|
getSortText() {
|
4474
4568
|
return void 0;
|
4475
4569
|
}
|
4570
|
+
getEditRange() {
|
4571
|
+
return void 0;
|
4572
|
+
}
|
4476
4573
|
};
|
4477
4574
|
var PackageAliasEntityCompletionItemInfo = class {
|
4478
4575
|
constructor(ctx, packageAlias) {
|
@@ -4495,6 +4592,9 @@ var PackageAliasEntityCompletionItemInfo = class {
|
|
4495
4592
|
getSortText() {
|
4496
4593
|
return void 0;
|
4497
4594
|
}
|
4595
|
+
getEditRange() {
|
4596
|
+
return void 0;
|
4597
|
+
}
|
4498
4598
|
};
|
4499
4599
|
var TypeVariableCompletionItemInfo = class {
|
4500
4600
|
constructor(ctx, variable, name, isNameExplicitlyOriginal) {
|
@@ -4521,6 +4621,9 @@ var TypeVariableCompletionItemInfo = class {
|
|
4521
4621
|
getSortText() {
|
4522
4622
|
return void 0;
|
4523
4623
|
}
|
4624
|
+
getEditRange() {
|
4625
|
+
return void 0;
|
4626
|
+
}
|
4524
4627
|
};
|
4525
4628
|
var TypeMethodCompletionItemInfo = class {
|
4526
4629
|
constructor(ctx, method, name, isNameExplicitlyOriginal) {
|
@@ -4547,6 +4650,37 @@ var TypeMethodCompletionItemInfo = class {
|
|
4547
4650
|
getSortText() {
|
4548
4651
|
return void 0;
|
4549
4652
|
}
|
4653
|
+
getEditRange() {
|
4654
|
+
return void 0;
|
4655
|
+
}
|
4656
|
+
};
|
4657
|
+
var OperatorCompletionItemInfo = class {
|
4658
|
+
constructor(ctx, operator, localization) {
|
4659
|
+
this.ctx = ctx;
|
4660
|
+
this.operator = operator;
|
4661
|
+
this.localization = localization;
|
4662
|
+
this.kind = "operator";
|
4663
|
+
}
|
4664
|
+
getLabel() {
|
4665
|
+
return `'${this.ctx.displayService.displayOperatorKind(this.operator.getOperatorKind(), this.localization.locale)}'`;
|
4666
|
+
}
|
4667
|
+
getCompletionItemKind() {
|
4668
|
+
return 4 /* Operator */;
|
4669
|
+
}
|
4670
|
+
getDetails() {
|
4671
|
+
return this.ctx.displayService.displayOperatorDeclaration(
|
4672
|
+
new OperatorDeclaration_typeMember(this.operator, this.localization)
|
4673
|
+
);
|
4674
|
+
}
|
4675
|
+
getInsertText() {
|
4676
|
+
return void 0;
|
4677
|
+
}
|
4678
|
+
getSortText() {
|
4679
|
+
return void 0;
|
4680
|
+
}
|
4681
|
+
getEditRange() {
|
4682
|
+
return void 0;
|
4683
|
+
}
|
4550
4684
|
};
|
4551
4685
|
var VariantCompletionItemInfo = class {
|
4552
4686
|
constructor(ctx, variant, name, isNameExplicitlyOriginal) {
|
@@ -4560,7 +4694,7 @@ var VariantCompletionItemInfo = class {
|
|
4560
4694
|
return `${this.isNameExplicitlyOriginal ? "~" : ""}${this.ctx.getInsertTextForName(this.name.value)}`;
|
4561
4695
|
}
|
4562
4696
|
getCompletionItemKind() {
|
4563
|
-
return
|
4697
|
+
return 12 /* Variant */;
|
4564
4698
|
}
|
4565
4699
|
getDetails() {
|
4566
4700
|
return this.ctx.displayService.displayVariantEntity(this.variant, this.name.localization);
|
@@ -4571,6 +4705,9 @@ var VariantCompletionItemInfo = class {
|
|
4571
4705
|
getSortText() {
|
4572
4706
|
return void 0;
|
4573
4707
|
}
|
4708
|
+
getEditRange() {
|
4709
|
+
return void 0;
|
4710
|
+
}
|
4574
4711
|
};
|
4575
4712
|
var VariableEntityCompletionItemInfo = class {
|
4576
4713
|
constructor(ctx, entity, name, isNameExplicitlyOriginal) {
|
@@ -4586,13 +4723,13 @@ var VariableEntityCompletionItemInfo = class {
|
|
4586
4723
|
getCompletionItemKind() {
|
4587
4724
|
switch (this.entity.subkind) {
|
4588
4725
|
case "package":
|
4589
|
-
return
|
4726
|
+
return 7 /* PackageVariable */;
|
4590
4727
|
case "type":
|
4591
4728
|
return 2 /* TypeVariable */;
|
4592
4729
|
case "parameter":
|
4593
|
-
return
|
4730
|
+
return 10 /* ParameterVariable */;
|
4594
4731
|
case "local":
|
4595
|
-
return
|
4732
|
+
return 9 /* LocalVariable */;
|
4596
4733
|
default:
|
4597
4734
|
Debug.never(this.entity);
|
4598
4735
|
}
|
@@ -4608,6 +4745,9 @@ var VariableEntityCompletionItemInfo = class {
|
|
4608
4745
|
getSortText() {
|
4609
4746
|
return void 0;
|
4610
4747
|
}
|
4748
|
+
getEditRange() {
|
4749
|
+
return void 0;
|
4750
|
+
}
|
4611
4751
|
};
|
4612
4752
|
var MethodEntityCompletionItemInfo = class {
|
4613
4753
|
constructor(ctx, entity, name, isNameExplicitlyOriginal) {
|
@@ -4623,11 +4763,11 @@ var MethodEntityCompletionItemInfo = class {
|
|
4623
4763
|
getCompletionItemKind() {
|
4624
4764
|
switch (this.entity.subkind) {
|
4625
4765
|
case "package":
|
4626
|
-
return
|
4766
|
+
return 8 /* PackageMethod */;
|
4627
4767
|
case "type":
|
4628
4768
|
return 3 /* TypeMethod */;
|
4629
4769
|
case "nested":
|
4630
|
-
return
|
4770
|
+
return 11 /* NestedMethod */;
|
4631
4771
|
default:
|
4632
4772
|
Debug.never(this.entity);
|
4633
4773
|
}
|
@@ -4643,6 +4783,9 @@ var MethodEntityCompletionItemInfo = class {
|
|
4643
4783
|
getSortText() {
|
4644
4784
|
return void 0;
|
4645
4785
|
}
|
4786
|
+
getEditRange() {
|
4787
|
+
return void 0;
|
4788
|
+
}
|
4646
4789
|
};
|
4647
4790
|
var NamedTypeCompletionItemInfo = class {
|
4648
4791
|
constructor(ctx, entity, name, isNameExplicitlyOriginal, prefix = "", sortText) {
|
@@ -4660,23 +4803,23 @@ var NamedTypeCompletionItemInfo = class {
|
|
4660
4803
|
getCompletionItemKind() {
|
4661
4804
|
switch (this.entity.kind) {
|
4662
4805
|
case 2 /* VariantType */:
|
4663
|
-
return
|
4806
|
+
return 16 /* VariantType */;
|
4664
4807
|
case 6 /* TypeParameter */:
|
4665
|
-
return
|
4808
|
+
return 17 /* TypeParameter */;
|
4666
4809
|
case 11 /* MethodType */:
|
4667
|
-
return
|
4810
|
+
return 18 /* MethodType */;
|
4668
4811
|
case 12 /* StructuredType */:
|
4669
4812
|
if (this.entity.isRefObject()) {
|
4670
|
-
return
|
4813
|
+
return 13 /* RefObjectType */;
|
4671
4814
|
} else if (this.entity.isPlainObject()) {
|
4672
|
-
return
|
4815
|
+
return 14 /* PlainObjectType */;
|
4673
4816
|
} else if (this.entity.isAspect()) {
|
4674
|
-
return
|
4817
|
+
return 15 /* AspectType */;
|
4675
4818
|
} else {
|
4676
|
-
return
|
4819
|
+
return 20 /* InvalidType */;
|
4677
4820
|
}
|
4678
4821
|
case 14 /* AliasType */:
|
4679
|
-
return
|
4822
|
+
return 19 /* AliasType */;
|
4680
4823
|
default:
|
4681
4824
|
Debug.never(this.entity);
|
4682
4825
|
}
|
@@ -4690,6 +4833,9 @@ var NamedTypeCompletionItemInfo = class {
|
|
4690
4833
|
getSortText() {
|
4691
4834
|
return this.sortText;
|
4692
4835
|
}
|
4836
|
+
getEditRange() {
|
4837
|
+
return void 0;
|
4838
|
+
}
|
4693
4839
|
};
|
4694
4840
|
var KeywordCompletionItemInfo = class {
|
4695
4841
|
constructor(ctx, keywordKind, value) {
|
@@ -4702,7 +4848,7 @@ var KeywordCompletionItemInfo = class {
|
|
4702
4848
|
return this.value;
|
4703
4849
|
}
|
4704
4850
|
getCompletionItemKind() {
|
4705
|
-
return
|
4851
|
+
return 21 /* Keyword */;
|
4706
4852
|
}
|
4707
4853
|
getDetails() {
|
4708
4854
|
return void 0;
|
@@ -4713,6 +4859,9 @@ var KeywordCompletionItemInfo = class {
|
|
4713
4859
|
getSortText() {
|
4714
4860
|
return void 0;
|
4715
4861
|
}
|
4862
|
+
getEditRange() {
|
4863
|
+
return void 0;
|
4864
|
+
}
|
4716
4865
|
};
|
4717
4866
|
var MergedOverloadedMethodCompletionItemInfo = class {
|
4718
4867
|
constructor(ctx, firstOverloadInfo, overloadCount) {
|
@@ -4739,6 +4888,9 @@ var MergedOverloadedMethodCompletionItemInfo = class {
|
|
4739
4888
|
getSortText() {
|
4740
4889
|
return void 0;
|
4741
4890
|
}
|
4891
|
+
getEditRange() {
|
4892
|
+
return void 0;
|
4893
|
+
}
|
4742
4894
|
};
|
4743
4895
|
var TargetSignatureValueParameterCompletionItemInfo = class {
|
4744
4896
|
constructor(ctx, parameter) {
|
@@ -4750,7 +4902,7 @@ var TargetSignatureValueParameterCompletionItemInfo = class {
|
|
4750
4902
|
return `${this.ctx.getInsertTextForName(this.parameter.getName())} =`;
|
4751
4903
|
}
|
4752
4904
|
getCompletionItemKind() {
|
4753
|
-
return
|
4905
|
+
return 22 /* TargetSignatureParameter */;
|
4754
4906
|
}
|
4755
4907
|
getDetails() {
|
4756
4908
|
return this.ctx.displayService.displayValueParameterDeclaration(
|
@@ -4767,6 +4919,9 @@ var TargetSignatureValueParameterCompletionItemInfo = class {
|
|
4767
4919
|
getSortText() {
|
4768
4920
|
return void 0;
|
4769
4921
|
}
|
4922
|
+
getEditRange() {
|
4923
|
+
return void 0;
|
4924
|
+
}
|
4770
4925
|
};
|
4771
4926
|
var AliasesSourceVariableCompletionItemInfo = class {
|
4772
4927
|
constructor(ctx, variable, displayService) {
|
@@ -4781,13 +4936,13 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
4781
4936
|
getCompletionItemKind() {
|
4782
4937
|
switch (this.variable.subkind) {
|
4783
4938
|
case "package":
|
4784
|
-
return
|
4939
|
+
return 7 /* PackageVariable */;
|
4785
4940
|
case "type":
|
4786
4941
|
return 2 /* TypeVariable */;
|
4787
4942
|
case "parameter":
|
4788
|
-
return
|
4943
|
+
return 7 /* PackageVariable */;
|
4789
4944
|
case "local":
|
4790
|
-
return
|
4945
|
+
return 9 /* LocalVariable */;
|
4791
4946
|
default:
|
4792
4947
|
Debug.never(this.variable);
|
4793
4948
|
}
|
@@ -4803,6 +4958,9 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
4803
4958
|
getSortText() {
|
4804
4959
|
return void 0;
|
4805
4960
|
}
|
4961
|
+
getEditRange() {
|
4962
|
+
return void 0;
|
4963
|
+
}
|
4806
4964
|
};
|
4807
4965
|
var AliasesSourceMethodCompletionItemInfo = class {
|
4808
4966
|
constructor(ctx, method, includeMethodKeyword, displayService) {
|
@@ -4818,11 +4976,11 @@ var AliasesSourceMethodCompletionItemInfo = class {
|
|
4818
4976
|
getCompletionItemKind() {
|
4819
4977
|
switch (this.method.subkind) {
|
4820
4978
|
case "package":
|
4821
|
-
return
|
4979
|
+
return 8 /* PackageMethod */;
|
4822
4980
|
case "type":
|
4823
4981
|
return 3 /* TypeMethod */;
|
4824
4982
|
case "nested":
|
4825
|
-
return
|
4983
|
+
return 11 /* NestedMethod */;
|
4826
4984
|
default:
|
4827
4985
|
Debug.never(this.method);
|
4828
4986
|
}
|
@@ -4836,13 +4994,16 @@ var AliasesSourceMethodCompletionItemInfo = class {
|
|
4836
4994
|
const displayParts = this.displayService.getMethodDeclarationDisplayParts(
|
4837
4995
|
new MethodDeclaration_entity(this.method, Localization.Original.ofEntity(this.method))
|
4838
4996
|
);
|
4839
|
-
const keywordWithWhitespace = this.includeMethodKeyword ? displayParts.
|
4997
|
+
const keywordWithWhitespace = this.includeMethodKeyword ? displayParts.functionKeyword + displayParts.whitespaceAfterFunctionKeyword : "";
|
4840
4998
|
const valueParameters = displayParts.valueParameters.map((p) => p.name).join(displayParts.typeParameterSeparator);
|
4841
4999
|
return keywordWithWhitespace + displayParts.name + displayParts.typeParametersStart + displayParts.typeParameters.join(displayParts.typeParameterSeparator) + displayParts.typeParametersEnd + displayParts.valueParametersStart + valueParameters + displayParts.valueParametersEnd;
|
4842
5000
|
}
|
4843
5001
|
getSortText() {
|
4844
5002
|
return void 0;
|
4845
5003
|
}
|
5004
|
+
getEditRange() {
|
5005
|
+
return void 0;
|
5006
|
+
}
|
4846
5007
|
};
|
4847
5008
|
var AliasesSourcePackageTypeCompletionItemInfo = class {
|
4848
5009
|
constructor(ctx, typeEntity, includeTypeKeyword, displayService) {
|
@@ -4858,21 +5019,21 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
4858
5019
|
getCompletionItemKind() {
|
4859
5020
|
switch (this.typeEntity.kind) {
|
4860
5021
|
case 2 /* VariantType */:
|
4861
|
-
return
|
5022
|
+
return 16 /* VariantType */;
|
4862
5023
|
case 11 /* MethodType */:
|
4863
|
-
return
|
5024
|
+
return 18 /* MethodType */;
|
4864
5025
|
case 12 /* StructuredType */: {
|
4865
5026
|
if (this.typeEntity.isRefObject()) {
|
4866
|
-
return
|
5027
|
+
return 13 /* RefObjectType */;
|
4867
5028
|
} else if (this.typeEntity.isPlainObject()) {
|
4868
|
-
return
|
5029
|
+
return 14 /* PlainObjectType */;
|
4869
5030
|
} else if (this.typeEntity.isAspect()) {
|
4870
|
-
return
|
5031
|
+
return 15 /* AspectType */;
|
4871
5032
|
}
|
4872
|
-
return
|
5033
|
+
return 20 /* InvalidType */;
|
4873
5034
|
}
|
4874
5035
|
case 14 /* AliasType */:
|
4875
|
-
return
|
5036
|
+
return 19 /* AliasType */;
|
4876
5037
|
}
|
4877
5038
|
}
|
4878
5039
|
getDetails() {
|
@@ -4911,6 +5072,9 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
4911
5072
|
Debug.never(this.typeEntity);
|
4912
5073
|
}
|
4913
5074
|
}
|
5075
|
+
getEditRange() {
|
5076
|
+
return void 0;
|
5077
|
+
}
|
4914
5078
|
};
|
4915
5079
|
var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
4916
5080
|
constructor(ctx, indexer, displayService) {
|
@@ -4931,7 +5095,7 @@ var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
|
4931
5095
|
return this.label;
|
4932
5096
|
}
|
4933
5097
|
getCompletionItemKind() {
|
4934
|
-
return
|
5098
|
+
return 5 /* TypeIndexer */;
|
4935
5099
|
}
|
4936
5100
|
getDetails() {
|
4937
5101
|
return this.label;
|
@@ -4943,6 +5107,9 @@ var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
|
4943
5107
|
getSortText() {
|
4944
5108
|
return void 0;
|
4945
5109
|
}
|
5110
|
+
getEditRange() {
|
5111
|
+
return void 0;
|
5112
|
+
}
|
4946
5113
|
};
|
4947
5114
|
var AliasesSourceTypeConstructorCompletionItemInfo = class {
|
4948
5115
|
constructor(ctx, constructor_, includeOnCreateKeyword, displayService) {
|
@@ -4968,7 +5135,7 @@ var AliasesSourceTypeConstructorCompletionItemInfo = class {
|
|
4968
5135
|
return this.label;
|
4969
5136
|
}
|
4970
5137
|
getCompletionItemKind() {
|
4971
|
-
return
|
5138
|
+
return 6 /* TypeConstructor */;
|
4972
5139
|
}
|
4973
5140
|
getDetails() {
|
4974
5141
|
return this.label;
|
@@ -4981,11 +5148,41 @@ var AliasesSourceTypeConstructorCompletionItemInfo = class {
|
|
4981
5148
|
getSortText() {
|
4982
5149
|
return void 0;
|
4983
5150
|
}
|
5151
|
+
getEditRange() {
|
5152
|
+
return void 0;
|
5153
|
+
}
|
5154
|
+
};
|
5155
|
+
var OperatorNameCompletionItemInfo = class {
|
5156
|
+
constructor(ctx, value, editRange) {
|
5157
|
+
this.ctx = ctx;
|
5158
|
+
this.value = value;
|
5159
|
+
this.editRange = editRange;
|
5160
|
+
this.kind = "operator-name";
|
5161
|
+
}
|
5162
|
+
getLabel() {
|
5163
|
+
return this.value;
|
5164
|
+
}
|
5165
|
+
getCompletionItemKind() {
|
5166
|
+
return 23 /* OperatorName */;
|
5167
|
+
}
|
5168
|
+
getDetails() {
|
5169
|
+
return void 0;
|
5170
|
+
}
|
5171
|
+
getInsertText() {
|
5172
|
+
return void 0;
|
5173
|
+
}
|
5174
|
+
getSortText() {
|
5175
|
+
return void 0;
|
5176
|
+
}
|
5177
|
+
getEditRange() {
|
5178
|
+
return this.editRange;
|
5179
|
+
}
|
4984
5180
|
};
|
4985
5181
|
var SyntaxContext = class {
|
4986
|
-
constructor(isInComment, isInStringOrChar, isPackageMemberDeclarationListContext, isTypeMemberDeclarationListContext, isStatementContext, isExpressionContext, precedingExpression, isUnqualifiedTypeContext, isTopLevelTranslationListContext, isTypeMemberTranslationListContext) {
|
5182
|
+
constructor(isInComment, isInStringOrChar, isInQuotedIdentifier, isPackageMemberDeclarationListContext, isTypeMemberDeclarationListContext, isStatementContext, isExpressionContext, precedingExpression, isUnqualifiedTypeContext, isTopLevelTranslationListContext, isTypeMemberTranslationListContext) {
|
4987
5183
|
this.isInComment = isInComment;
|
4988
5184
|
this.isInStringOrChar = isInStringOrChar;
|
5185
|
+
this.isInQuotedIdentifier = isInQuotedIdentifier;
|
4989
5186
|
this.isPackageMemberDeclarationListContext = isPackageMemberDeclarationListContext;
|
4990
5187
|
this.isTypeMemberDeclarationListContext = isTypeMemberDeclarationListContext;
|
4991
5188
|
this.isStatementContext = isStatementContext;
|
@@ -5038,6 +5235,7 @@ var SyntaxContextFactory = class {
|
|
5038
5235
|
static fromPositionDescription(sourceFile, positionDescription) {
|
5039
5236
|
const isInComment = this.isInComment(sourceFile, positionDescription.getOffset());
|
5040
5237
|
const isInStringOrChar = this.isInStringOrChar(sourceFile, positionDescription.getOffset());
|
5238
|
+
const isInQuotedIdentifier = this.isInQuotedIdentifier(sourceFile, positionDescription.getOffset());
|
5041
5239
|
let isPackageMemberDeclarationListContext = false;
|
5042
5240
|
if (positionDescription.kind === "at-file-start") {
|
5043
5241
|
isPackageMemberDeclarationListContext = true;
|
@@ -5074,6 +5272,7 @@ var SyntaxContextFactory = class {
|
|
5074
5272
|
return new SyntaxContext(
|
5075
5273
|
isInComment,
|
5076
5274
|
isInStringOrChar,
|
5275
|
+
isInQuotedIdentifier,
|
5077
5276
|
isPackageMemberDeclarationListContext,
|
5078
5277
|
isTypeMemberDeclarationListContext,
|
5079
5278
|
isStatementContext,
|
@@ -5086,11 +5285,11 @@ var SyntaxContextFactory = class {
|
|
5086
5285
|
}
|
5087
5286
|
static isExpressionOrStatementContext(tokenOrKeyword) {
|
5088
5287
|
if (tokenOrKeyword.isToken(57 /* Equals */)) {
|
5089
|
-
if (tokenOrKeyword.parent.kind ===
|
5288
|
+
if (tokenOrKeyword.parent.kind === 93 /* AssignmentStatement */) {
|
5090
5289
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5091
5290
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5092
5291
|
}
|
5093
|
-
if (tokenOrKeyword.parent.kind ===
|
5292
|
+
if (tokenOrKeyword.parent.kind === 59 /* LocalVariableDeclaration */) {
|
5094
5293
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5095
5294
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5096
5295
|
}
|
@@ -5098,24 +5297,24 @@ var SyntaxContextFactory = class {
|
|
5098
5297
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5099
5298
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5100
5299
|
}
|
5101
|
-
if (tokenOrKeyword.parent.kind ===
|
5300
|
+
if (tokenOrKeyword.parent.kind === 54 /* TypeVariableDeclaration */) {
|
5102
5301
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5103
5302
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5104
5303
|
}
|
5105
|
-
if (tokenOrKeyword.parent.kind ===
|
5304
|
+
if (tokenOrKeyword.parent.kind === 143 /* ParameterDeclaration */) {
|
5106
5305
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.defaultValue);
|
5107
5306
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5108
5307
|
}
|
5109
|
-
if (tokenOrKeyword.parent.kind ===
|
5308
|
+
if (tokenOrKeyword.parent.kind === 144 /* CallArgument */) {
|
5110
5309
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5111
5310
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5112
5311
|
}
|
5113
|
-
if (tokenOrKeyword.parent.kind ===
|
5312
|
+
if (tokenOrKeyword.parent.kind === 141 /* VariantDeclaration */) {
|
5114
5313
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5115
5314
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5116
5315
|
}
|
5117
5316
|
}
|
5118
|
-
if (tokenOrKeyword.parent.kind ===
|
5317
|
+
if (tokenOrKeyword.parent.kind === 93 /* AssignmentStatement */) {
|
5119
5318
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5120
5319
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5121
5320
|
}
|
@@ -5123,7 +5322,7 @@ var SyntaxContextFactory = class {
|
|
5123
5322
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.operand);
|
5124
5323
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5125
5324
|
}
|
5126
|
-
if (tokenOrKeyword.parent.kind ===
|
5325
|
+
if (tokenOrKeyword.parent.kind === 66 /* BinaryExpression */) {
|
5127
5326
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5128
5327
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5129
5328
|
}
|
@@ -5143,10 +5342,10 @@ var SyntaxContextFactory = class {
|
|
5143
5342
|
isStatementContext: false
|
5144
5343
|
};
|
5145
5344
|
}
|
5146
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5345
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* StatementBlock */) {
|
5147
5346
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5148
5347
|
}
|
5149
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5348
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 94 /* StatementList */) {
|
5150
5349
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5151
5350
|
}
|
5152
5351
|
if (tokenOrKeyword.isToken(44 /* OpenParenthesis */)) {
|
@@ -5158,27 +5357,19 @@ var SyntaxContextFactory = class {
|
|
5158
5357
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5159
5358
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5160
5359
|
}
|
5161
|
-
if (tokenOrKeyword.parent.kind === 91 /* TransactionalExpression */) {
|
5162
|
-
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5163
|
-
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5164
|
-
}
|
5165
|
-
if (tokenOrKeyword.parent.kind === 74 /* UnobservableExpression */) {
|
5166
|
-
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5167
|
-
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5168
|
-
}
|
5169
5360
|
if (tokenOrKeyword.parent.kind === 81 /* ReferenceExpression */) {
|
5170
5361
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5171
5362
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5172
5363
|
}
|
5173
|
-
if (tokenOrKeyword.parent.kind ===
|
5364
|
+
if (tokenOrKeyword.parent.kind === 69 /* CallExpression */) {
|
5174
5365
|
const expressionRole = new ExpressionRole_callArgument(tokenOrKeyword.parent.callArgumentList, 0);
|
5175
5366
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5176
5367
|
}
|
5177
|
-
if (tokenOrKeyword.parent.kind ===
|
5368
|
+
if (tokenOrKeyword.parent.kind === 70 /* AutotypeCallExpression */) {
|
5178
5369
|
const expressionRole = new ExpressionRole_callArgument(tokenOrKeyword.parent.callArgumentList, 0);
|
5179
5370
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5180
5371
|
}
|
5181
|
-
if (tokenOrKeyword.parent.kind ===
|
5372
|
+
if (tokenOrKeyword.parent.kind === 146 /* Tag */) {
|
5182
5373
|
const callArgumentList = tokenOrKeyword.parent.callArgumentList;
|
5183
5374
|
if (callArgumentList !== void 0) {
|
5184
5375
|
const expressionRole = new ExpressionRole_callArgument(callArgumentList, 0);
|
@@ -5186,16 +5377,16 @@ var SyntaxContextFactory = class {
|
|
5186
5377
|
}
|
5187
5378
|
}
|
5188
5379
|
}
|
5189
|
-
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind ===
|
5380
|
+
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 72 /* IndexedAccessExpression */) {
|
5190
5381
|
const expressionRole = new ExpressionRole_indexedAccessArgument(tokenOrKeyword.parent.argumentsList, 0);
|
5191
5382
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5192
5383
|
}
|
5193
|
-
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind ===
|
5384
|
+
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 61 /* ArrayLiteral */) {
|
5194
5385
|
const expressionRole = new ExpressionRole_arrayElement(tokenOrKeyword.parent);
|
5195
5386
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5196
5387
|
}
|
5197
5388
|
if (tokenOrKeyword.isToken(24 /* Comma */)) {
|
5198
|
-
if (tokenOrKeyword.parent.kind ===
|
5389
|
+
if (tokenOrKeyword.parent.kind === 68 /* CallArgumentList */) {
|
5199
5390
|
const argumentList = tokenOrKeyword.parent;
|
5200
5391
|
let index = 0;
|
5201
5392
|
for (const element of argumentList.elements) {
|
@@ -5209,7 +5400,7 @@ var SyntaxContextFactory = class {
|
|
5209
5400
|
const expressionRole = new ExpressionRole_callArgument(argumentList, index);
|
5210
5401
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5211
5402
|
}
|
5212
|
-
if (tokenOrKeyword.parent.kind ===
|
5403
|
+
if (tokenOrKeyword.parent.kind === 71 /* IndexedAccessArgumentList */) {
|
5213
5404
|
const argumentList = tokenOrKeyword.parent;
|
5214
5405
|
let index = 0;
|
5215
5406
|
for (const element of argumentList.elements) {
|
@@ -5223,48 +5414,48 @@ var SyntaxContextFactory = class {
|
|
5223
5414
|
const expressionRole = new ExpressionRole_indexedAccessArgument(argumentList, index);
|
5224
5415
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5225
5416
|
}
|
5226
|
-
if (tokenOrKeyword.parent.kind ===
|
5417
|
+
if (tokenOrKeyword.parent.kind === 119 /* MatchExpressionList */) {
|
5227
5418
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent.parent);
|
5228
5419
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5229
5420
|
}
|
5230
|
-
if (tokenOrKeyword.parent.kind ===
|
5421
|
+
if (tokenOrKeyword.parent.kind === 62 /* ArrayLiteralElementList */) {
|
5231
5422
|
const expressionRole = new ExpressionRole_arrayElement(tokenOrKeyword.parent.parent);
|
5232
5423
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5233
5424
|
}
|
5234
5425
|
}
|
5235
|
-
if (tokenOrKeyword.isKeyword(
|
5426
|
+
if (tokenOrKeyword.isKeyword(43 /* Case */) && tokenOrKeyword.parent.kind === 120 /* SwitchStatementCaseClause */) {
|
5236
5427
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent);
|
5237
5428
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5238
5429
|
}
|
5239
|
-
if (tokenOrKeyword.isKeyword(14 /* Return */) && tokenOrKeyword.parent.kind ===
|
5430
|
+
if (tokenOrKeyword.isKeyword(14 /* Return */) && tokenOrKeyword.parent.kind === 116 /* ReturnStatement */) {
|
5240
5431
|
const expressionRole = new ExpressionRole_returnedValue(tokenOrKeyword.parent);
|
5241
5432
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5242
5433
|
}
|
5243
|
-
if (tokenOrKeyword.isKeyword(
|
5434
|
+
if (tokenOrKeyword.isKeyword(42 /* Switch */) && tokenOrKeyword.parent.kind === 118 /* SwitchStatement */) {
|
5244
5435
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5245
5436
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5246
5437
|
}
|
5247
|
-
if (tokenOrKeyword.isKeyword(12 /* If */) && tokenOrKeyword.parent.kind ===
|
5438
|
+
if (tokenOrKeyword.isKeyword(12 /* If */) && tokenOrKeyword.parent.kind === 109 /* IfStatement */) {
|
5248
5439
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5249
5440
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5250
5441
|
}
|
5251
|
-
if (tokenOrKeyword.isKeyword(10 /* ElseIf */) && tokenOrKeyword.parent.kind ===
|
5442
|
+
if (tokenOrKeyword.isKeyword(10 /* ElseIf */) && tokenOrKeyword.parent.kind === 111 /* ElseIfClause */) {
|
5252
5443
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5253
5444
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5254
5445
|
}
|
5255
|
-
if (tokenOrKeyword.isKeyword(8 /* From */) && tokenOrKeyword.parent.kind ===
|
5446
|
+
if (tokenOrKeyword.isKeyword(8 /* From */) && tokenOrKeyword.parent.kind === 108 /* ForStatement */) {
|
5256
5447
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.enumeratedExpression);
|
5257
5448
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5258
5449
|
}
|
5259
|
-
if (tokenOrKeyword.isKeyword(23 /* While */) && tokenOrKeyword.parent.kind ===
|
5450
|
+
if (tokenOrKeyword.isKeyword(23 /* While */) && tokenOrKeyword.parent.kind === 121 /* WhileStatement */) {
|
5260
5451
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5261
5452
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5262
5453
|
}
|
5263
|
-
if (tokenOrKeyword.isKeyword(25 /* RepeatWhile */) && tokenOrKeyword.parent.kind ===
|
5454
|
+
if (tokenOrKeyword.isKeyword(25 /* RepeatWhile */) && tokenOrKeyword.parent.kind === 115 /* LoopStatement */) {
|
5264
5455
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5265
5456
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5266
5457
|
}
|
5267
|
-
if (tokenOrKeyword.isKeyword(26 /* Yield */) && tokenOrKeyword.parent.kind ===
|
5458
|
+
if (tokenOrKeyword.isKeyword(26 /* Yield */) && tokenOrKeyword.parent.kind === 122 /* YieldStatement */) {
|
5268
5459
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5269
5460
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5270
5461
|
}
|
@@ -5294,7 +5485,7 @@ var SyntaxContextFactory = class {
|
|
5294
5485
|
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 32 /* TypeMemberDeclarationBlock */ && (tokenOrKeyword.parent.parent.kind === 40 /* TypeExtensionDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 33 /* PackageStructuredTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 38 /* PackageVariantTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 22 /* PackageAliasTypeDeclaration */)) {
|
5295
5486
|
return true;
|
5296
5487
|
}
|
5297
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind ===
|
5488
|
+
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind === 95 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 25 /* PackageConstructorDeclaration */ || tokenOrKeyword.parent.parent.kind === 26 /* PackageEntryPointDeclaration */ || tokenOrKeyword.parent.parent.kind === 27 /* PackageMethodDeclaration */))) {
|
5298
5489
|
return true;
|
5299
5490
|
}
|
5300
5491
|
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */) {
|
@@ -5306,10 +5497,10 @@ var SyntaxContextFactory = class {
|
|
5306
5497
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 37 /* PackageVariableSetterDeclaration */)) {
|
5307
5498
|
return true;
|
5308
5499
|
}
|
5309
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
5500
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 148 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5310
5501
|
return true;
|
5311
5502
|
}
|
5312
|
-
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
5503
|
+
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 148 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5313
5504
|
return true;
|
5314
5505
|
}
|
5315
5506
|
return false;
|
@@ -5324,19 +5515,19 @@ var SyntaxContextFactory = class {
|
|
5324
5515
|
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 44 /* TypeMemberGroupDeclaration */) {
|
5325
5516
|
return true;
|
5326
5517
|
}
|
5327
|
-
if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword,
|
5518
|
+
if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 54 /* TypeVariableDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 55 /* TypeVariableGetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 56 /* TypeVariableSetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 47 /* TypeIndexedGetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 48 /* TypeIndexedSetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5328
5519
|
tokenOrKeyword,
|
5329
5520
|
50 /* TypeDereferencedVariableGetterDeclaration */
|
5330
5521
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5331
5522
|
tokenOrKeyword,
|
5332
5523
|
51 /* TypeDereferencedVariableSetterDeclaration */
|
5333
|
-
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 52 /* TypeMethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 45 /* TypeConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 46 /* TypeDestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword,
|
5524
|
+
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 52 /* TypeMethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 53 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 45 /* TypeConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 46 /* TypeDestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 141 /* VariantDeclaration */)) {
|
5334
5525
|
return true;
|
5335
5526
|
}
|
5336
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
5527
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 148 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5337
5528
|
return true;
|
5338
5529
|
}
|
5339
|
-
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
5530
|
+
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 148 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5340
5531
|
return true;
|
5341
5532
|
}
|
5342
5533
|
return false;
|
@@ -5361,8 +5552,19 @@ var SyntaxContextFactory = class {
|
|
5361
5552
|
}
|
5362
5553
|
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 */);
|
5363
5554
|
}
|
5555
|
+
static isInQuotedIdentifier(sourceFile, offset) {
|
5556
|
+
let result;
|
5557
|
+
const tokenArOffset = getTokenAtOffset(sourceFile.getSyntaxNode(), offset, false);
|
5558
|
+
if (tokenArOffset !== void 0 && isIdentifier(tokenArOffset)) {
|
5559
|
+
const range = tokenArOffset.rangeWithoutTrivia;
|
5560
|
+
if (offset >= range.start + 1 && offset < range.end) {
|
5561
|
+
result = tokenArOffset;
|
5562
|
+
}
|
5563
|
+
}
|
5564
|
+
return result;
|
5565
|
+
}
|
5364
5566
|
static isUnqualifiedTypeContext(tokenOrKeyword) {
|
5365
|
-
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind ===
|
5567
|
+
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 157 /* TypeAnnotation */) {
|
5366
5568
|
return { allowsAnonymousTypes: true };
|
5367
5569
|
}
|
5368
5570
|
if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind === 34 /* StructuredTypeDeclarationBody */) {
|
@@ -5371,25 +5573,25 @@ var SyntaxContextFactory = class {
|
|
5371
5573
|
if (tokenOrKeyword.isKeyword(15 /* Type */) && (NodeTypeUtils.isPackageTypeDeclaration(tokenOrKeyword.parent) || tokenOrKeyword.parent.kind === 40 /* TypeExtensionDeclaration */)) {
|
5372
5574
|
return { allowsAnonymousTypes: false };
|
5373
5575
|
}
|
5374
|
-
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind ===
|
5576
|
+
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind === 153 /* TypeArgumentClause */) {
|
5375
5577
|
return { allowsAnonymousTypes: true };
|
5376
5578
|
}
|
5377
|
-
if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind ===
|
5378
|
-
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind ===
|
5579
|
+
if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 154 /* TypeArgumentList */)) {
|
5580
|
+
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind === 154 /* TypeArgumentList */ };
|
5379
5581
|
}
|
5380
|
-
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind ===
|
5582
|
+
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind === 146 /* Tag */) {
|
5381
5583
|
return { allowsAnonymousTypes: false };
|
5382
5584
|
}
|
5383
|
-
if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind ===
|
5585
|
+
if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind === 142 /* TypeParameterDeclaration */) {
|
5384
5586
|
return { allowsAnonymousTypes: false };
|
5385
5587
|
}
|
5386
5588
|
if (tokenOrKeyword.isToken(57 /* Equals */) && tokenOrKeyword.parent.kind === 22 /* PackageAliasTypeDeclaration */) {
|
5387
5589
|
return { allowsAnonymousTypes: false };
|
5388
5590
|
}
|
5389
|
-
if (tokenOrKeyword.isKeyword(13 /* Is */) && tokenOrKeyword.parent.kind ===
|
5591
|
+
if (tokenOrKeyword.isKeyword(13 /* Is */) && tokenOrKeyword.parent.kind === 74 /* IsExpression */) {
|
5390
5592
|
return { allowsAnonymousTypes: true };
|
5391
5593
|
}
|
5392
|
-
if (tokenOrKeyword.isKeyword(
|
5594
|
+
if (tokenOrKeyword.isKeyword(40 /* As */) && tokenOrKeyword.parent.kind === 65 /* AsExpression */) {
|
5393
5595
|
return { allowsAnonymousTypes: true };
|
5394
5596
|
}
|
5395
5597
|
if (tokenOrKeyword.isToken(17 /* Bar */) && tokenOrKeyword.parent.kind === 12 /* UnionTypeSpecifierTypeList */) {
|
@@ -5406,32 +5608,32 @@ var SyntaxContextFactory = class {
|
|
5406
5608
|
}
|
5407
5609
|
const packageImport = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5408
5610
|
tokenOrKeyword,
|
5409
|
-
|
5611
|
+
133 /* PackageImportTranslation */
|
5410
5612
|
);
|
5411
5613
|
if (packageImport !== void 0) {
|
5412
5614
|
return { translationsDeclaration: packageImport.parent.parent };
|
5413
5615
|
}
|
5414
|
-
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5616
|
+
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 138 /* TypeTranslation */);
|
5415
5617
|
if (type !== void 0) {
|
5416
5618
|
return { translationsDeclaration: type.parent.parent };
|
5417
5619
|
}
|
5418
5620
|
const methodType = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5419
5621
|
tokenOrKeyword,
|
5420
|
-
|
5622
|
+
132 /* MethodTypeTranslation */
|
5421
5623
|
);
|
5422
5624
|
if (methodType !== void 0) {
|
5423
5625
|
return { translationsDeclaration: methodType.parent.parent };
|
5424
5626
|
}
|
5425
5627
|
const variable = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5426
5628
|
tokenOrKeyword,
|
5427
|
-
|
5629
|
+
135 /* PackageVariableTranslation */
|
5428
5630
|
);
|
5429
5631
|
if (variable !== void 0) {
|
5430
5632
|
return { translationsDeclaration: variable.parent.parent };
|
5431
5633
|
}
|
5432
5634
|
const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5433
5635
|
tokenOrKeyword,
|
5434
|
-
|
5636
|
+
130 /* PackageMethodTranslation */
|
5435
5637
|
);
|
5436
5638
|
if (method !== void 0) {
|
5437
5639
|
return { translationsDeclaration: method.parent.parent };
|
@@ -5439,33 +5641,33 @@ var SyntaxContextFactory = class {
|
|
5439
5641
|
return void 0;
|
5440
5642
|
}
|
5441
5643
|
static isTypeMemberTranslationListContext(tokenOrKeyword) {
|
5442
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5644
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 137 /* TypeMemberTranslationList */) {
|
5443
5645
|
return { typeTranslation: tokenOrKeyword.parent.parent };
|
5444
5646
|
}
|
5445
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5647
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 138 /* TypeTranslation */) {
|
5446
5648
|
return { typeTranslation: tokenOrKeyword.parent };
|
5447
5649
|
}
|
5448
|
-
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5650
|
+
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 127 /* IndexerTranslation */);
|
5449
5651
|
if (indexer !== void 0) {
|
5450
5652
|
return { typeTranslation: indexer.parent.parent };
|
5451
5653
|
}
|
5452
5654
|
const constructor = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5453
5655
|
tokenOrKeyword,
|
5454
|
-
|
5656
|
+
125 /* ConstructorTranslation */
|
5455
5657
|
);
|
5456
5658
|
if (constructor !== void 0) {
|
5457
5659
|
return { typeTranslation: constructor.parent.parent };
|
5458
5660
|
}
|
5459
5661
|
const variableOrVariant = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5460
5662
|
tokenOrKeyword,
|
5461
|
-
|
5663
|
+
136 /* TypeVariableOrVariantTranslation */
|
5462
5664
|
);
|
5463
5665
|
if (variableOrVariant !== void 0) {
|
5464
5666
|
return { typeTranslation: variableOrVariant.parent.parent };
|
5465
5667
|
}
|
5466
5668
|
const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5467
5669
|
tokenOrKeyword,
|
5468
|
-
|
5670
|
+
131 /* TypeMethodTranslation */
|
5469
5671
|
);
|
5470
5672
|
if (method !== void 0) {
|
5471
5673
|
return { typeTranslation: method.parent.parent };
|
@@ -5558,13 +5760,13 @@ var CompletionItemInfoCache = class {
|
|
5558
5760
|
constructor() {
|
5559
5761
|
this._id = 0;
|
5560
5762
|
}
|
5561
|
-
add(list) {
|
5562
|
-
this._entry = {
|
5563
|
-
return this._entry
|
5763
|
+
add(list, sourceFile) {
|
5764
|
+
this._entry = { id: this.getNextId(), items: list, sourceFile };
|
5765
|
+
return this._entry;
|
5564
5766
|
}
|
5565
5767
|
get(id) {
|
5566
|
-
if (id === this._entry?.
|
5567
|
-
return this._entry
|
5768
|
+
if (id === this._entry?.id) {
|
5769
|
+
return this._entry;
|
5568
5770
|
}
|
5569
5771
|
return void 0;
|
5570
5772
|
}
|
@@ -5578,31 +5780,31 @@ var NodeSemanticInfoService = class {
|
|
5578
5780
|
static ofTokenOrKeyword(analyzer, tokenOrKeyword, options6) {
|
5579
5781
|
if (isIdentifier(tokenOrKeyword.value)) {
|
5580
5782
|
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options6);
|
5581
|
-
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind ===
|
5783
|
+
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind === 70 /* AutotypeCallExpression */) {
|
5582
5784
|
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent, options6);
|
5583
5785
|
} else if (tokenOrKeyword.parent.kind === 79 /* PrefixUnaryExpression */) {
|
5584
5786
|
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5585
|
-
} else if (tokenOrKeyword.isKeyword(
|
5787
|
+
} else if (tokenOrKeyword.isKeyword(41 /* Not */) && tokenOrKeyword.parent.kind === 75 /* NotExpression */) {
|
5586
5788
|
return this.ofNotExpressionNotKeyword(analyzer, tokenOrKeyword.parent, options6);
|
5587
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5789
|
+
} else if (tokenOrKeyword.parent.kind === 66 /* BinaryExpression */) {
|
5588
5790
|
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5589
5791
|
} else if (tokenOrKeyword.isToken(19 /* Caret */) && (tokenOrKeyword.parent.kind === 50 /* TypeDereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 51 /* TypeDereferencedVariableSetterDeclaration */)) {
|
5590
5792
|
return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
|
5591
5793
|
} else if (tokenOrKeyword.isToken(19 /* Caret */) && tokenOrKeyword.parent.kind === 82 /* DereferenceExpression */) {
|
5592
5794
|
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5593
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5795
|
+
} else if (tokenOrKeyword.parent.kind === 93 /* AssignmentStatement */) {
|
5594
5796
|
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options6);
|
5595
5797
|
} else if (tokenOrKeyword.isKeyword(28 /* Creation */) && tokenOrKeyword.parent.kind === 45 /* TypeConstructorDeclaration */) {
|
5596
5798
|
return this.ofTypeConstructorDeclaration(analyzer, tokenOrKeyword.parent);
|
5597
|
-
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind ===
|
5799
|
+
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind === 92 /* DefaultMatchExpression */) {
|
5598
5800
|
return this.ofDefaultMatchExpression(analyzer, tokenOrKeyword.parent);
|
5599
5801
|
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 88 /* ObjectExpression */) {
|
5600
5802
|
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options6);
|
5601
|
-
} else if (tokenOrKeyword.isKeyword(
|
5803
|
+
} else if (tokenOrKeyword.isKeyword(55 /* Base */) && tokenOrKeyword.parent.kind === 89 /* BaseExpression */) {
|
5602
5804
|
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options6);
|
5603
5805
|
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 49 /* TypeIndexerParameterClause */) {
|
5604
5806
|
return this.ofTypeIndexerDeclaration(analyzer, tokenOrKeyword.parent.parent);
|
5605
|
-
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind ===
|
5807
|
+
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 72 /* IndexedAccessExpression */) {
|
5606
5808
|
return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5607
5809
|
}
|
5608
5810
|
return void 0;
|
@@ -5615,11 +5817,11 @@ var NodeSemanticInfoService = class {
|
|
5615
5817
|
let result;
|
5616
5818
|
const parent = node.parent;
|
5617
5819
|
switch (parent.kind) {
|
5618
|
-
case
|
5820
|
+
case 128 /* TranslationTypeParameterList */:
|
5619
5821
|
break;
|
5620
|
-
case
|
5822
|
+
case 123 /* TranslationParameterList */:
|
5621
5823
|
break;
|
5622
|
-
case
|
5824
|
+
case 144 /* CallArgument */: {
|
5623
5825
|
const respectiveParameter = analyzer.getRespectiveParameter(parent);
|
5624
5826
|
if (respectiveParameter !== void 0) {
|
5625
5827
|
const target = new SimpleWithLocalization(
|
@@ -5633,10 +5835,10 @@ var NodeSemanticInfoService = class {
|
|
5633
5835
|
}
|
5634
5836
|
break;
|
5635
5837
|
}
|
5636
|
-
case
|
5838
|
+
case 60 /* EnumerationVariableDeclaration */:
|
5637
5839
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofEnumerationVariableDeclaration(parent));
|
5638
5840
|
break;
|
5639
|
-
case
|
5841
|
+
case 102 /* ErrorVariableDeclaration */:
|
5640
5842
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofErrorVariableDeclaration(parent));
|
5641
5843
|
break;
|
5642
5844
|
case 22 /* PackageAliasTypeDeclaration */:
|
@@ -5660,16 +5862,16 @@ var NodeSemanticInfoService = class {
|
|
5660
5862
|
case 90 /* IdentifierExpression */:
|
5661
5863
|
result = this.ofIdentifierExpression(analyzer, parent, options6);
|
5662
5864
|
break;
|
5663
|
-
case
|
5865
|
+
case 58 /* NestedMethodDeclaration */:
|
5664
5866
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofNestedMethodDeclaration(parent));
|
5665
5867
|
break;
|
5666
|
-
case
|
5868
|
+
case 59 /* LocalVariableDeclaration */:
|
5667
5869
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
|
5668
5870
|
break;
|
5669
|
-
case
|
5871
|
+
case 134 /* QualifiedName */:
|
5670
5872
|
result = this.ofQualifiedNameQualifier(analyzer, parent, node, options6);
|
5671
5873
|
break;
|
5672
|
-
case
|
5874
|
+
case 135 /* PackageVariableTranslation */: {
|
5673
5875
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5674
5876
|
const getTargetResult = translationPackage?.getPackageVariableTranslationTarget(parent);
|
5675
5877
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5689,7 +5891,7 @@ var NodeSemanticInfoService = class {
|
|
5689
5891
|
}
|
5690
5892
|
break;
|
5691
5893
|
}
|
5692
|
-
case
|
5894
|
+
case 136 /* TypeVariableOrVariantTranslation */: {
|
5693
5895
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5694
5896
|
const getTargetsResult = translationPackage?.getTypeVariableOrVariantTranslationTargets(parent);
|
5695
5897
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5713,7 +5915,7 @@ var NodeSemanticInfoService = class {
|
|
5713
5915
|
}
|
5714
5916
|
break;
|
5715
5917
|
}
|
5716
|
-
case
|
5918
|
+
case 130 /* PackageMethodTranslation */: {
|
5717
5919
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5718
5920
|
const getTargetsResult = translationPackage?.getPackageMethodTranslationTargets(parent);
|
5719
5921
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5737,7 +5939,7 @@ var NodeSemanticInfoService = class {
|
|
5737
5939
|
}
|
5738
5940
|
break;
|
5739
5941
|
}
|
5740
|
-
case
|
5942
|
+
case 131 /* TypeMethodTranslation */: {
|
5741
5943
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5742
5944
|
const getTargetsResult = translationPackage?.getTypeMethodTranslationTargets(parent);
|
5743
5945
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5761,7 +5963,7 @@ var NodeSemanticInfoService = class {
|
|
5761
5963
|
}
|
5762
5964
|
break;
|
5763
5965
|
}
|
5764
|
-
case
|
5966
|
+
case 138 /* TypeTranslation */: {
|
5765
5967
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5766
5968
|
const getTargetResult = translationPackage?.getTypeTranslationTarget(parent);
|
5767
5969
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5781,7 +5983,7 @@ var NodeSemanticInfoService = class {
|
|
5781
5983
|
}
|
5782
5984
|
break;
|
5783
5985
|
}
|
5784
|
-
case
|
5986
|
+
case 132 /* MethodTypeTranslation */: {
|
5785
5987
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5786
5988
|
const getTargetResult = translationPackage?.getMethodTypeTranslationTarget(parent);
|
5787
5989
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5801,7 +6003,7 @@ var NodeSemanticInfoService = class {
|
|
5801
6003
|
}
|
5802
6004
|
break;
|
5803
6005
|
}
|
5804
|
-
case
|
6006
|
+
case 143 /* ParameterDeclaration */:
|
5805
6007
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofParameterDeclaration(parent));
|
5806
6008
|
break;
|
5807
6009
|
case 8 /* PackageImport */:
|
@@ -5816,24 +6018,27 @@ var NodeSemanticInfoService = class {
|
|
5816
6018
|
case 52 /* TypeMethodDeclaration */:
|
5817
6019
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeMethodDeclaration(parent));
|
5818
6020
|
break;
|
5819
|
-
case 53 /*
|
6021
|
+
case 53 /* OperatorDeclaration */:
|
6022
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofOperatorDeclaration(parent));
|
6023
|
+
break;
|
6024
|
+
case 54 /* TypeVariableDeclaration */:
|
5820
6025
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeVariableDeclaration(parent));
|
5821
6026
|
break;
|
5822
|
-
case
|
6027
|
+
case 142 /* TypeParameterDeclaration */:
|
5823
6028
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeParameterDeclaration(parent));
|
5824
6029
|
break;
|
5825
|
-
case
|
6030
|
+
case 141 /* VariantDeclaration */:
|
5826
6031
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantDeclaration(parent));
|
5827
6032
|
break;
|
5828
6033
|
case 36 /* PackageVariableGetterDeclaration */:
|
5829
6034
|
case 37 /* PackageVariableSetterDeclaration */:
|
5830
6035
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofComputedPackageVariableDeclaration(parent));
|
5831
6036
|
break;
|
5832
|
-
case
|
5833
|
-
case
|
6037
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
6038
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
5834
6039
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofComputedTypeVariableDeclaration(parent));
|
5835
6040
|
break;
|
5836
|
-
case
|
6041
|
+
case 152 /* SetterParameterDeclaration */:
|
5837
6042
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofSetterParameterDeclaration(parent));
|
5838
6043
|
break;
|
5839
6044
|
case 3 /* Keyword */:
|
@@ -5894,6 +6099,14 @@ var NodeSemanticInfoService = class {
|
|
5894
6099
|
result = createAccessedMethodsReference(meaning.candidates, true);
|
5895
6100
|
}
|
5896
6101
|
break;
|
6102
|
+
case "operator-access": {
|
6103
|
+
if (isNonEmptyArray(meaning.suitableOperators)) {
|
6104
|
+
result = createOperatorsReference(meaning.suitableOperators, meaning.suitableOperators.length > 1);
|
6105
|
+
} else if (isNonEmptyArray(meaning.candidates)) {
|
6106
|
+
result = createOperatorsReference(meaning.candidates, true);
|
6107
|
+
}
|
6108
|
+
break;
|
6109
|
+
}
|
5897
6110
|
case "package-method-access":
|
5898
6111
|
if (isNonEmptyArray(meaning.suitableMethods)) {
|
5899
6112
|
result = createAccessedMethodsReference(meaning.suitableMethods, meaning.suitableMethods.length > 1);
|
@@ -5924,9 +6137,11 @@ var NodeSemanticInfoService = class {
|
|
5924
6137
|
}
|
5925
6138
|
return result;
|
5926
6139
|
function createAccessedMethodsReference(methods, isAmbiguous) {
|
5927
|
-
const targets = methods.map(
|
5928
|
-
|
5929
|
-
|
6140
|
+
const targets = methods.map((o) => new SimpleWithLocalization(new AccessedMethodReferenceTarget(o.value), o.localization));
|
6141
|
+
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6142
|
+
}
|
6143
|
+
function createOperatorsReference(operators, isAmbiguous) {
|
6144
|
+
const targets = operators.map((o) => new SimpleWithLocalization(new OperatorReferenceTarget(o.value), o.localization));
|
5930
6145
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
5931
6146
|
}
|
5932
6147
|
}
|
@@ -5977,7 +6192,7 @@ var NodeSemanticInfoService = class {
|
|
5977
6192
|
return result;
|
5978
6193
|
}
|
5979
6194
|
case 42 /* ExtendedTypeClause */:
|
5980
|
-
case
|
6195
|
+
case 133 /* PackageImportTranslation */:
|
5981
6196
|
return void 0;
|
5982
6197
|
default:
|
5983
6198
|
Debug.never(node.parent);
|
@@ -6010,6 +6225,14 @@ var NodeSemanticInfoService = class {
|
|
6010
6225
|
result = createAccessedMethodsReference(meaning.candidates, true);
|
6011
6226
|
}
|
6012
6227
|
break;
|
6228
|
+
case "operator-access": {
|
6229
|
+
if (isNonEmptyArray(meaning.suitableOperators)) {
|
6230
|
+
result = createOperatorsReference(meaning.suitableOperators, meaning.suitableOperators.length > 1);
|
6231
|
+
} else if (isNonEmptyArray(meaning.candidates)) {
|
6232
|
+
result = createOperatorsReference(meaning.candidates, true);
|
6233
|
+
}
|
6234
|
+
break;
|
6235
|
+
}
|
6013
6236
|
case "variable-access": {
|
6014
6237
|
const variable = meaning.variable;
|
6015
6238
|
if (variable.value.kind === "entity") {
|
@@ -6079,9 +6302,11 @@ var NodeSemanticInfoService = class {
|
|
6079
6302
|
}
|
6080
6303
|
return result;
|
6081
6304
|
function createAccessedMethodsReference(methods, isAmbiguous) {
|
6082
|
-
const targets = methods.map(
|
6083
|
-
|
6084
|
-
|
6305
|
+
const targets = methods.map((o) => new SimpleWithLocalization(new AccessedMethodReferenceTarget(o.value), o.localization));
|
6306
|
+
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6307
|
+
}
|
6308
|
+
function createOperatorsReference(operators, isAmbiguous) {
|
6309
|
+
const targets = operators.map((o) => new SimpleWithLocalization(new OperatorReferenceTarget(o.value), o.localization));
|
6085
6310
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6086
6311
|
}
|
6087
6312
|
}
|
@@ -6114,7 +6339,7 @@ var NodeSemanticInfoService = class {
|
|
6114
6339
|
const operator = analyzer.resolveCompoundAssignmentStatementOperator(node, operatorKind);
|
6115
6340
|
if (operator.kind === "ok") {
|
6116
6341
|
const target = new SimpleWithLocalization(
|
6117
|
-
new
|
6342
|
+
new OperatorReferenceTarget(operator.value.value),
|
6118
6343
|
operator.value.localization
|
6119
6344
|
);
|
6120
6345
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6132,7 +6357,7 @@ var NodeSemanticInfoService = class {
|
|
6132
6357
|
const operator = analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
|
6133
6358
|
if (operator.kind === "ok") {
|
6134
6359
|
const target = new SimpleWithLocalization(
|
6135
|
-
new
|
6360
|
+
new OperatorReferenceTarget(operator.value.value),
|
6136
6361
|
operator.value.localization
|
6137
6362
|
);
|
6138
6363
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6148,7 +6373,7 @@ var NodeSemanticInfoService = class {
|
|
6148
6373
|
const operator = analyzer.resolveNotExpressionOperator(node);
|
6149
6374
|
if (operator.kind === "ok") {
|
6150
6375
|
const target = new SimpleWithLocalization(
|
6151
|
-
new
|
6376
|
+
new OperatorReferenceTarget(operator.value.value),
|
6152
6377
|
operator.value.localization
|
6153
6378
|
);
|
6154
6379
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6163,7 +6388,7 @@ var NodeSemanticInfoService = class {
|
|
6163
6388
|
const operator = analyzer.resolvePrefixUnaryExpressionOperator(node);
|
6164
6389
|
if (operator.kind === "ok") {
|
6165
6390
|
const target = new SimpleWithLocalization(
|
6166
|
-
new
|
6391
|
+
new OperatorReferenceTarget(operator.value.value),
|
6167
6392
|
operator.value.localization
|
6168
6393
|
);
|
6169
6394
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6275,6 +6500,15 @@ var NodeSemanticInfoService = class {
|
|
6275
6500
|
result = new ReferenceNodeSemanticInfo([target], false);
|
6276
6501
|
break;
|
6277
6502
|
}
|
6503
|
+
case "overridden-operator-access": {
|
6504
|
+
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
6505
|
+
const target = new SimpleWithLocalization(
|
6506
|
+
new OperatorReferenceTarget(meaning.operator),
|
6507
|
+
new Localization.Original(locale)
|
6508
|
+
);
|
6509
|
+
result = new ReferenceNodeSemanticInfo([target], false);
|
6510
|
+
break;
|
6511
|
+
}
|
6278
6512
|
case "unresolved":
|
6279
6513
|
break;
|
6280
6514
|
default:
|
@@ -6326,11 +6560,11 @@ var NodeSemanticInfoService = class {
|
|
6326
6560
|
}
|
6327
6561
|
const parent = getParentSkippingParenthesizedExpressions(typeAccessExpression);
|
6328
6562
|
let parentCallExpression;
|
6329
|
-
if (parent.kind ===
|
6563
|
+
if (parent.kind === 69 /* CallExpression */) {
|
6330
6564
|
parentCallExpression = parent;
|
6331
|
-
} else if (parent.kind ===
|
6565
|
+
} else if (parent.kind === 91 /* GenericSpecializationExpression */) {
|
6332
6566
|
const grandParent = getParentSkippingParenthesizedExpressions(parent);
|
6333
|
-
if (grandParent.kind ===
|
6567
|
+
if (grandParent.kind === 69 /* CallExpression */) {
|
6334
6568
|
parentCallExpression = grandParent;
|
6335
6569
|
}
|
6336
6570
|
}
|
@@ -6459,18 +6693,6 @@ var TypeConstructorReferenceTarget = class {
|
|
6459
6693
|
this.kind = "type-constructor";
|
6460
6694
|
}
|
6461
6695
|
};
|
6462
|
-
var TypeUnaryOperatorReferenceTarget = class {
|
6463
|
-
constructor(operator) {
|
6464
|
-
this.operator = operator;
|
6465
|
-
this.kind = "type-unary-operator";
|
6466
|
-
}
|
6467
|
-
};
|
6468
|
-
var TypeBinaryOperatorReferenceTarget = class {
|
6469
|
-
constructor(operator) {
|
6470
|
-
this.operator = operator;
|
6471
|
-
this.kind = "type-binary-operator";
|
6472
|
-
}
|
6473
|
-
};
|
6474
6696
|
var TypeDereferenceOperatorReferenceTarget = class {
|
6475
6697
|
constructor(operator, accessKind) {
|
6476
6698
|
this.operator = operator;
|
@@ -6484,6 +6706,12 @@ var AccessedMethodReferenceTarget = class {
|
|
6484
6706
|
this.kind = "accessed-method";
|
6485
6707
|
}
|
6486
6708
|
};
|
6709
|
+
var OperatorReferenceTarget = class {
|
6710
|
+
constructor(operator) {
|
6711
|
+
this.operator = operator;
|
6712
|
+
this.kind = "operator";
|
6713
|
+
}
|
6714
|
+
};
|
6487
6715
|
var MatchResultValueParameterReferenceTarget = class {
|
6488
6716
|
constructor(parameter, accessKind) {
|
6489
6717
|
this.parameter = parameter;
|
@@ -6537,7 +6765,7 @@ var SimpleWithLocalization = class {
|
|
6537
6765
|
|
6538
6766
|
// source/services/Utils.ts
|
6539
6767
|
function getEntitySourceLocations(analyzer, entity) {
|
6540
|
-
if (entity.kind ===
|
6768
|
+
if (entity.kind === 16 /* Package */) {
|
6541
6769
|
return void 0;
|
6542
6770
|
}
|
6543
6771
|
let result;
|
@@ -6585,7 +6813,7 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6585
6813
|
case 17 /* AnonymousMethodTypeDeclaration */:
|
6586
6814
|
case 18 /* AnonymousStructuredTypeDeclaration */:
|
6587
6815
|
case 19 /* AnonymousVariantTypeDeclaration */:
|
6588
|
-
case
|
6816
|
+
case 67 /* MethodBlockLiteral */:
|
6589
6817
|
case 76 /* MethodLiteral */:
|
6590
6818
|
range = node.rangeWithoutTrivia;
|
6591
6819
|
break;
|
@@ -6594,10 +6822,11 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6594
6822
|
case 28 /* PackageMethodTypeDeclaration */:
|
6595
6823
|
case 33 /* PackageStructuredTypeDeclaration */:
|
6596
6824
|
case 38 /* PackageVariantTypeDeclaration */:
|
6597
|
-
case
|
6825
|
+
case 58 /* NestedMethodDeclaration */:
|
6598
6826
|
case 52 /* TypeMethodDeclaration */:
|
6599
|
-
case
|
6600
|
-
case
|
6827
|
+
case 142 /* TypeParameterDeclaration */:
|
6828
|
+
case 141 /* VariantDeclaration */:
|
6829
|
+
case 53 /* OperatorDeclaration */:
|
6601
6830
|
range = node.name.rangeWithoutTrivia;
|
6602
6831
|
break;
|
6603
6832
|
case 45 /* TypeConstructorDeclaration */:
|
@@ -6619,10 +6848,10 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6619
6848
|
case 37 /* PackageVariableSetterDeclaration */:
|
6620
6849
|
range = node.setKeyword.rangeWithoutTrivia;
|
6621
6850
|
break;
|
6622
|
-
case
|
6851
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
6623
6852
|
range = node.getKeyword.rangeWithoutTrivia;
|
6624
6853
|
break;
|
6625
|
-
case
|
6854
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
6626
6855
|
range = node.setKeyword.rangeWithoutTrivia;
|
6627
6856
|
break;
|
6628
6857
|
case 47 /* TypeIndexedGetterDeclaration */:
|
@@ -6748,9 +6977,7 @@ var DefinitionService = class {
|
|
6748
6977
|
return getEntitySourceLocations(analyzer, target.constructor_.getEntity());
|
6749
6978
|
case "accessed-method":
|
6750
6979
|
return getEntitySourceLocations(analyzer, target.method.getEntity());
|
6751
|
-
case "
|
6752
|
-
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
6753
|
-
case "type-binary-operator":
|
6980
|
+
case "operator":
|
6754
6981
|
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
6755
6982
|
case "type-dereference-operator":
|
6756
6983
|
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
@@ -6784,9 +7011,7 @@ var DefinitionService = class {
|
|
6784
7011
|
return target.parameter.getEntity();
|
6785
7012
|
case "type-constructor":
|
6786
7013
|
return target.constructor_.getEntity();
|
6787
|
-
case "
|
6788
|
-
return target.operator.getEntity();
|
6789
|
-
case "type-binary-operator":
|
7014
|
+
case "operator":
|
6790
7015
|
return target.operator.getEntity();
|
6791
7016
|
case "type-dereference-operator":
|
6792
7017
|
return target.operator.getEntity();
|
@@ -6877,7 +7102,7 @@ var ReferencesService = class {
|
|
6877
7102
|
}
|
6878
7103
|
}
|
6879
7104
|
if (!options6.onlyNamed) {
|
6880
|
-
if (node.kind ===
|
7105
|
+
if (node.kind === 70 /* AutotypeCallExpression */ && restrictions.canBeAutotypeCall) {
|
6881
7106
|
const semanticInfo = NodeSemanticInfoService.ofAutotypeCallExpression(analyzer, node, semanticInfoOptions);
|
6882
7107
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
6883
7108
|
definition,
|
@@ -6921,7 +7146,7 @@ var ReferencesService = class {
|
|
6921
7146
|
result.push(new Reference(sourceFile2, node.notKeyword.rangeWithoutTrivia, referenceKind));
|
6922
7147
|
}
|
6923
7148
|
}
|
6924
|
-
if (node.kind ===
|
7149
|
+
if (node.kind === 66 /* BinaryExpression */ && restrictions.canBeBinaryExpressionOperator) {
|
6925
7150
|
const semanticInfo = NodeSemanticInfoService.ofBinaryExpressionOperator(
|
6926
7151
|
analyzer,
|
6927
7152
|
node,
|
@@ -6965,7 +7190,7 @@ var ReferencesService = class {
|
|
6965
7190
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
6966
7191
|
}
|
6967
7192
|
}
|
6968
|
-
if (node.kind ===
|
7193
|
+
if (node.kind === 93 /* AssignmentStatement */ && restrictions.canBeAssignmentStatementOperator) {
|
6969
7194
|
const semanticInfo = NodeSemanticInfoService.ofAssignmentStatementOperator(
|
6970
7195
|
analyzer,
|
6971
7196
|
node,
|
@@ -7029,7 +7254,7 @@ var ReferencesService = class {
|
|
7029
7254
|
result.push(new Reference(sourceFile2, node.parameterClause.rangeWithoutTrivia, referenceKind));
|
7030
7255
|
}
|
7031
7256
|
}
|
7032
|
-
if (node.kind ===
|
7257
|
+
if (node.kind === 72 /* IndexedAccessExpression */ && restrictions.canBeIndexer) {
|
7033
7258
|
const semanticInfo = NodeSemanticInfoService.ofIndexedAccessExpressionOperator(
|
7034
7259
|
analyzer,
|
7035
7260
|
node,
|
@@ -7148,9 +7373,7 @@ var ReferencesService = class {
|
|
7148
7373
|
);
|
7149
7374
|
case "type-constructor":
|
7150
7375
|
return new DefinitionInfo(target.value.constructor_.getEntity(), target.localization, 0 /* Read */);
|
7151
|
-
case "
|
7152
|
-
return new DefinitionInfo(target.value.operator.getEntity(), target.localization, 0 /* Read */);
|
7153
|
-
case "type-binary-operator":
|
7376
|
+
case "operator":
|
7154
7377
|
return new DefinitionInfo(target.value.operator.getEntity(), target.localization, 0 /* Read */);
|
7155
7378
|
case "type-dereference-operator":
|
7156
7379
|
return new DefinitionInfo(
|
@@ -7200,13 +7423,15 @@ var ReferencesService = class {
|
|
7200
7423
|
result.canBeAutotypeCall = true;
|
7201
7424
|
result.canBeConstructorDeclaration = true;
|
7202
7425
|
}
|
7203
|
-
if (definition.value.kind === 15 /*
|
7204
|
-
|
7205
|
-
|
7206
|
-
|
7207
|
-
|
7208
|
-
|
7209
|
-
|
7426
|
+
if (definition.value.kind === 15 /* Operator */) {
|
7427
|
+
const operatorKind = definition.value.getOperatorKind();
|
7428
|
+
if (isUnaryOperator(operatorKind)) {
|
7429
|
+
result.canBePrefixUnaryOperator = true;
|
7430
|
+
result.canBeNotExpression = true;
|
7431
|
+
} else {
|
7432
|
+
result.canBeBinaryExpressionOperator = true;
|
7433
|
+
result.canBeAssignmentStatementOperator = true;
|
7434
|
+
}
|
7210
7435
|
}
|
7211
7436
|
if (definition.value.kind === 8 /* DereferenceOperator */) {
|
7212
7437
|
result.canBeDereferenceOperator = true;
|
@@ -7289,10 +7514,9 @@ var ReferencesService = class {
|
|
7289
7514
|
case 10 /* Destructor */:
|
7290
7515
|
case 7 /* Indexer */:
|
7291
7516
|
case 8 /* DereferenceOperator */:
|
7292
|
-
case
|
7293
|
-
case
|
7294
|
-
case
|
7295
|
-
case 18 /* TypeExtension */:
|
7517
|
+
case 16 /* Package */:
|
7518
|
+
case 17 /* TypeExtension */:
|
7519
|
+
case 15 /* Operator */:
|
7296
7520
|
return void 0;
|
7297
7521
|
default:
|
7298
7522
|
Debug.never(entity);
|
@@ -7438,7 +7662,7 @@ var EvaluatableExpressionService = class {
|
|
7438
7662
|
}
|
7439
7663
|
isNamedDeclaration(node) {
|
7440
7664
|
switch (node.kind) {
|
7441
|
-
case
|
7665
|
+
case 60 /* EnumerationVariableDeclaration */:
|
7442
7666
|
return { nameIdentifier: node.name };
|
7443
7667
|
case 22 /* PackageAliasTypeDeclaration */:
|
7444
7668
|
return { nameIdentifier: node.name };
|
@@ -7452,21 +7676,21 @@ var EvaluatableExpressionService = class {
|
|
7452
7676
|
return { nameIdentifier: node.name };
|
7453
7677
|
case 38 /* PackageVariantTypeDeclaration */:
|
7454
7678
|
return { nameIdentifier: node.name };
|
7455
|
-
case
|
7679
|
+
case 58 /* NestedMethodDeclaration */:
|
7456
7680
|
return { nameIdentifier: node.name };
|
7457
|
-
case
|
7681
|
+
case 59 /* LocalVariableDeclaration */:
|
7458
7682
|
return { nameIdentifier: node.name };
|
7459
|
-
case
|
7683
|
+
case 143 /* ParameterDeclaration */:
|
7460
7684
|
return { nameIdentifier: node.name };
|
7461
7685
|
case 52 /* TypeMethodDeclaration */:
|
7462
7686
|
return { nameIdentifier: node.name };
|
7463
|
-
case
|
7687
|
+
case 54 /* TypeVariableDeclaration */:
|
7464
7688
|
return { nameIdentifier: node.name };
|
7465
|
-
case
|
7689
|
+
case 142 /* TypeParameterDeclaration */:
|
7466
7690
|
return { nameIdentifier: node.name };
|
7467
|
-
case
|
7691
|
+
case 141 /* VariantDeclaration */:
|
7468
7692
|
return { nameIdentifier: node.name };
|
7469
|
-
case
|
7693
|
+
case 102 /* ErrorVariableDeclaration */:
|
7470
7694
|
return { nameIdentifier: node.name };
|
7471
7695
|
default:
|
7472
7696
|
return void 0;
|
@@ -7587,13 +7811,12 @@ var HoverService = class {
|
|
7587
7811
|
);
|
7588
7812
|
return new Hover(this._displayService.displayConstructorDeclaration(declaration), range);
|
7589
7813
|
}
|
7590
|
-
case "
|
7591
|
-
const operator = new
|
7592
|
-
|
7593
|
-
|
7594
|
-
|
7595
|
-
|
7596
|
-
return new Hover(this._displayService.displayBinaryOperatorDeclaration(operator), range);
|
7814
|
+
case "operator": {
|
7815
|
+
const operator = new OperatorDeclaration_typeMember(
|
7816
|
+
firstTarget.value.operator,
|
7817
|
+
firstTarget.localization
|
7818
|
+
);
|
7819
|
+
return new Hover(this._displayService.displayOperatorDeclaration(operator), range);
|
7597
7820
|
}
|
7598
7821
|
case "type-dereference-operator": {
|
7599
7822
|
const operator = new DereferenceOperatorDeclaration_typeMember(firstTarget.value.operator);
|
@@ -7623,7 +7846,7 @@ var HoverService = class {
|
|
7623
7846
|
const typeText = this._displayService.displayType(firstTarget.value.type);
|
7624
7847
|
return new Hover(`${keywordText}: ${typeText}`, range);
|
7625
7848
|
} else if (firstTarget.value.typeContextKind === "base") {
|
7626
|
-
const keywordText = this._displayService.displayKeyword(
|
7849
|
+
const keywordText = this._displayService.displayKeyword(55 /* Base */);
|
7627
7850
|
const typeText = this._displayService.displayType(firstTarget.value.type);
|
7628
7851
|
return new Hover(`${keywordText}: ${typeText}`, range);
|
7629
7852
|
} else {
|
@@ -7762,7 +7985,7 @@ var SourceFileItemsService = class {
|
|
7762
7985
|
);
|
7763
7986
|
break;
|
7764
7987
|
}
|
7765
|
-
case
|
7988
|
+
case 54 /* TypeVariableDeclaration */: {
|
7766
7989
|
result.push(
|
7767
7990
|
this.createItem(
|
7768
7991
|
12 /* TypeVariable */,
|
@@ -7774,7 +7997,7 @@ var SourceFileItemsService = class {
|
|
7774
7997
|
);
|
7775
7998
|
break;
|
7776
7999
|
}
|
7777
|
-
case
|
8000
|
+
case 55 /* TypeVariableGetterDeclaration */: {
|
7778
8001
|
result.push(
|
7779
8002
|
this.createItem(
|
7780
8003
|
13 /* TypeVariableGetter */,
|
@@ -7786,7 +8009,7 @@ var SourceFileItemsService = class {
|
|
7786
8009
|
);
|
7787
8010
|
break;
|
7788
8011
|
}
|
7789
|
-
case
|
8012
|
+
case 56 /* TypeVariableSetterDeclaration */: {
|
7790
8013
|
result.push(
|
7791
8014
|
this.createItem(
|
7792
8015
|
14 /* TypeVariableSetter */,
|
@@ -7880,7 +8103,7 @@ var SourceFileItemsService = class {
|
|
7880
8103
|
);
|
7881
8104
|
break;
|
7882
8105
|
}
|
7883
|
-
case
|
8106
|
+
case 141 /* VariantDeclaration */: {
|
7884
8107
|
result.push(
|
7885
8108
|
this.createItem(
|
7886
8109
|
9 /* Variant */,
|
@@ -7892,7 +8115,7 @@ var SourceFileItemsService = class {
|
|
7892
8115
|
);
|
7893
8116
|
break;
|
7894
8117
|
}
|
7895
|
-
case
|
8118
|
+
case 142 /* TypeParameterDeclaration */: {
|
7896
8119
|
result.push(
|
7897
8120
|
this.createItem(
|
7898
8121
|
18 /* TypeParameter */,
|
@@ -7904,7 +8127,7 @@ var SourceFileItemsService = class {
|
|
7904
8127
|
);
|
7905
8128
|
break;
|
7906
8129
|
}
|
7907
|
-
case
|
8130
|
+
case 58 /* NestedMethodDeclaration */: {
|
7908
8131
|
result.push(
|
7909
8132
|
this.createItem(
|
7910
8133
|
19 /* NestedMethod */,
|
@@ -7941,7 +8164,7 @@ var SourceFileItemsService = class {
|
|
7941
8164
|
case 4 /* PackageMethod */:
|
7942
8165
|
case 15 /* TypeMethod */:
|
7943
8166
|
case 19 /* NestedMethod */:
|
7944
|
-
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(11 /*
|
8167
|
+
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(11 /* Function */, this.locale, this.dialect)}>`;
|
7945
8168
|
case 5 /* StructuredType */:
|
7946
8169
|
case 6 /* MethodType */:
|
7947
8170
|
case 7 /* VariantType */:
|
@@ -7950,21 +8173,21 @@ var SourceFileItemsService = class {
|
|
7950
8173
|
case 10 /* TypeConstructor */:
|
7951
8174
|
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(28 /* Creation */, this.locale, this.dialect);
|
7952
8175
|
case 11 /* TypeDestructor */:
|
7953
|
-
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(
|
8176
|
+
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(46 /* Destruction */, this.locale, this.dialect);
|
7954
8177
|
case 9 /* Variant */:
|
7955
8178
|
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(6 /* Variant */, this.locale, this.dialect)}>`;
|
7956
8179
|
case 18 /* TypeParameter */:
|
7957
8180
|
return name ?? `<${LocalizationHelper.localizeHelperPhrase(2 /* TypeParameter */, this.locale)}>`;
|
7958
8181
|
case 2 /* PackageVariableGetter */:
|
7959
8182
|
case 13 /* TypeVariableGetter */:
|
7960
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8183
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(57 /* Get */, this.locale, this.dialect)} ${name ?? ""}`;
|
7961
8184
|
case 3 /* PackageVariableSetter */:
|
7962
8185
|
case 14 /* TypeVariableSetter */:
|
7963
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8186
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Set */, this.locale, this.dialect)} ${name ?? ""}`;
|
7964
8187
|
case 16 /* TypeIndexedGetter */:
|
7965
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8188
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(57 /* Get */, this.locale, this.dialect)} []`;
|
7966
8189
|
case 17 /* TypeIndexedSetter */:
|
7967
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8190
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Set */, this.locale, this.dialect)} []`;
|
7968
8191
|
default:
|
7969
8192
|
Debug.never(kind);
|
7970
8193
|
}
|
@@ -8071,9 +8294,10 @@ var RenameService = class {
|
|
8071
8294
|
case "match-result-value-parameter":
|
8072
8295
|
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.parameter.entity);
|
8073
8296
|
break;
|
8297
|
+
case "operator":
|
8298
|
+
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.operator.getEntity());
|
8299
|
+
break;
|
8074
8300
|
case "type-constructor":
|
8075
|
-
case "type-unary-operator":
|
8076
|
-
case "type-binary-operator":
|
8077
8301
|
case "type-dereference-operator":
|
8078
8302
|
case "package":
|
8079
8303
|
case "type-context":
|
@@ -8154,7 +8378,7 @@ var SelectionRangeService = class {
|
|
8154
8378
|
}
|
8155
8379
|
}
|
8156
8380
|
switch (node.kind) {
|
8157
|
-
case
|
8381
|
+
case 157 /* TypeAnnotation */:
|
8158
8382
|
case 34 /* StructuredTypeDeclarationBody */:
|
8159
8383
|
case 39 /* VariantTypeDeclarationBody */:
|
8160
8384
|
case 23 /* AliasTypeDeclarationBody */:
|
@@ -8282,7 +8506,7 @@ var SemanticTokensService = class {
|
|
8282
8506
|
);
|
8283
8507
|
}
|
8284
8508
|
}
|
8285
|
-
if (node.kind ===
|
8509
|
+
if (node.kind === 141 /* VariantDeclaration */) {
|
8286
8510
|
result.push(
|
8287
8511
|
new SemanticToken(
|
8288
8512
|
node.name.rangeWithoutTrivia,
|
@@ -8300,7 +8524,7 @@ var SemanticTokensService = class {
|
|
8300
8524
|
)
|
8301
8525
|
);
|
8302
8526
|
}
|
8303
|
-
if (node.kind ===
|
8527
|
+
if (node.kind === 58 /* NestedMethodDeclaration */) {
|
8304
8528
|
result.push(
|
8305
8529
|
new SemanticToken(node.name.rangeWithoutTrivia, 5 /* NestedMethod */, new SemanticTokenModifiers().makeDeclaration().setCapitalized(this.isCapitalizedName(node.name.value)))
|
8306
8530
|
);
|
@@ -8310,6 +8534,11 @@ var SemanticTokensService = class {
|
|
8310
8534
|
new SemanticToken(node.name.rangeWithoutTrivia, 6 /* TypeMethod */, new SemanticTokenModifiers().makeDeclaration().setCapitalized(this.isCapitalizedName(node.name.value)))
|
8311
8535
|
);
|
8312
8536
|
}
|
8537
|
+
if (node.kind === 53 /* OperatorDeclaration */) {
|
8538
|
+
result.push(
|
8539
|
+
new SemanticToken(node.name.rangeWithoutTrivia, 7 /* Operator */, new SemanticTokenModifiers().makeDeclaration())
|
8540
|
+
);
|
8541
|
+
}
|
8313
8542
|
}
|
8314
8543
|
);
|
8315
8544
|
return result.sort((t1, t2) => t1.range.start - t2.range.end);
|
@@ -8386,7 +8615,8 @@ var supportedSemanticTokens = [
|
|
8386
8615
|
3 /* Variant */,
|
8387
8616
|
4 /* PackageMethod */,
|
8388
8617
|
5 /* NestedMethod */,
|
8389
|
-
6 /* TypeMethod
|
8618
|
+
6 /* TypeMethod */,
|
8619
|
+
7 /* Operator */
|
8390
8620
|
];
|
8391
8621
|
var supportedSemanticTokenModifiers = [
|
8392
8622
|
1 /* Const */,
|
@@ -8460,7 +8690,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8460
8690
|
}
|
8461
8691
|
let node = token.parent;
|
8462
8692
|
while (node !== void 0) {
|
8463
|
-
if (node.kind ===
|
8693
|
+
if (node.kind === 153 /* TypeArgumentClause */ && this._offset >= node.lessThanToken.rangeWithoutTrivia.end && (node.greaterThanToken.rangeWithoutTrivia.isEmpty || this._offset <= node.greaterThanToken.rangeWithoutTrivia.start)) {
|
8464
8694
|
const argumentIndex = this.getArgumentIndex(node.typeArgumentList, this._offset);
|
8465
8695
|
const argumentCount = this.countArguments(node.typeArgumentList);
|
8466
8696
|
return new NodeWithTypeArgumentsInfo(node.parent, argumentIndex, argumentCount);
|
@@ -8505,7 +8735,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8505
8735
|
switch (node.kind) {
|
8506
8736
|
case 10 /* NamedTypeSpecifier */:
|
8507
8737
|
return this.getSignaturesForNamedTypeSpecifier(node);
|
8508
|
-
case
|
8738
|
+
case 91 /* GenericSpecializationExpression */:
|
8509
8739
|
return this.getSignaturesForGenericSpecializationExpression(node);
|
8510
8740
|
default:
|
8511
8741
|
Debug.never(node);
|
@@ -8716,7 +8946,7 @@ var SignatureContext = class {
|
|
8716
8946
|
this.displayService = displayService;
|
8717
8947
|
}
|
8718
8948
|
convertMethodDisplayParts(parts) {
|
8719
|
-
const prefix = parts.asyncKeywordWithWhitespace + parts.
|
8949
|
+
const prefix = parts.asyncKeywordWithWhitespace + parts.functionKeyword + parts.whitespaceAfterFunctionKeyword + parts.container + parts.name + parts.typeParametersStart;
|
8720
8950
|
const postfix = parts.typeParametersEnd + parts.valueParametersStart + parts.valueParameters.map((p) => p.toString()).join(parts.valueParameterSeparator) + parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
8721
8951
|
return new SignatureDisplayParts(prefix, parts.typeParameters, parts.typeParameterSeparator, postfix);
|
8722
8952
|
}
|
@@ -8791,7 +9021,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8791
9021
|
let node = token.parent;
|
8792
9022
|
while (node !== void 0) {
|
8793
9023
|
switch (node.kind) {
|
8794
|
-
case
|
9024
|
+
case 69 /* CallExpression */: {
|
8795
9025
|
if (this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && (node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
8796
9026
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfCallExpression(node);
|
8797
9027
|
const argumentIndex = this.getArgumentIndexInList(node.callArgumentList.elements, this._offset);
|
@@ -8799,7 +9029,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8799
9029
|
}
|
8800
9030
|
break;
|
8801
9031
|
}
|
8802
|
-
case
|
9032
|
+
case 70 /* AutotypeCallExpression */: {
|
8803
9033
|
if (this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && (node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
8804
9034
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfAutotypeCallExpression(node);
|
8805
9035
|
const argumentIndex = this.getArgumentIndexInList(node.callArgumentList.elements, this._offset);
|
@@ -8807,7 +9037,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8807
9037
|
}
|
8808
9038
|
break;
|
8809
9039
|
}
|
8810
|
-
case
|
9040
|
+
case 72 /* IndexedAccessExpression */: {
|
8811
9041
|
if (this._offset >= node.openSquareBracketToken.rangeWithoutTrivia.end && (node.closeSquareBracketToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeSquareBracketToken.rangeWithoutTrivia.start)) {
|
8812
9042
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfIndexedAccessExpression(node);
|
8813
9043
|
const argumentIndex = this.getArgumentIndexInList(node.argumentsList.elements, this._offset);
|
@@ -8815,7 +9045,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8815
9045
|
}
|
8816
9046
|
break;
|
8817
9047
|
}
|
8818
|
-
case
|
9048
|
+
case 146 /* Tag */: {
|
8819
9049
|
if (node.openParenthesisToken !== void 0 && this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && node.callArgumentList !== void 0 && (node.closeParenthesisToken === void 0 || node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
8820
9050
|
const argumentIndex = this.getArgumentIndexInList(node.callArgumentList.elements, this._offset);
|
8821
9051
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(node);
|
@@ -8902,13 +9132,13 @@ var SignatureContext2 = class {
|
|
8902
9132
|
this.displayService = displayService;
|
8903
9133
|
}
|
8904
9134
|
convertMethodDisplayParts(parts) {
|
8905
|
-
const prefix = parts.asyncKeywordWithWhitespace + parts.
|
9135
|
+
const prefix = parts.asyncKeywordWithWhitespace + parts.functionKeyword + parts.whitespaceAfterFunctionKeyword + parts.container + parts.name + parts.typeParametersStart + parts.typeParameters.join(parts.typeParameterSeparator) + parts.typeParametersEnd + parts.valueParametersStart;
|
8906
9136
|
const valueParameters = parts.valueParameters.map((p) => p.toString());
|
8907
9137
|
const postfix = parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
8908
9138
|
return new SignatureDisplayParts(prefix, valueParameters, parts.valueParameterSeparator, postfix);
|
8909
9139
|
}
|
8910
9140
|
convertMethodTypeBodyDisplayParts(parts) {
|
8911
|
-
const prefix = parts.asyncKeywordWithWhitespace + parts.
|
9141
|
+
const prefix = parts.asyncKeywordWithWhitespace + parts.functionKeyword + parts.valueParametersStart;
|
8912
9142
|
const valueParameters = parts.valueParameters.map((p) => p.toString());
|
8913
9143
|
const postfix = parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
8914
9144
|
return new SignatureDisplayParts(prefix, valueParameters, parts.valueParameterSeparator, postfix);
|
@@ -11313,7 +11543,7 @@ var EntityToSyntax = class {
|
|
11313
11543
|
const tags = this.convertTags(entity.getTags());
|
11314
11544
|
const modifiers = new Array();
|
11315
11545
|
if (entity.isAsync()) {
|
11316
|
-
modifiers.push(SyntaxFactory.modifier(
|
11546
|
+
modifiers.push(SyntaxFactory.modifier(38 /* Async */));
|
11317
11547
|
}
|
11318
11548
|
const isHidden = entity.isHidden();
|
11319
11549
|
if (isHidden !== void 0) {
|
@@ -11395,16 +11625,16 @@ var EntityToSyntax = class {
|
|
11395
11625
|
commonModifiers.push(SyntaxFactory.modifier(33 /* Const */));
|
11396
11626
|
}
|
11397
11627
|
if (entity.isStatic()) {
|
11398
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11628
|
+
commonModifiers.push(SyntaxFactory.modifier(39 /* Static */));
|
11399
11629
|
}
|
11400
11630
|
if (entity.isAbstract()) {
|
11401
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11631
|
+
commonModifiers.push(SyntaxFactory.modifier(35 /* Abstract */));
|
11402
11632
|
}
|
11403
11633
|
if (entity.isRedefinable()) {
|
11404
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11634
|
+
commonModifiers.push(SyntaxFactory.modifier(36 /* Redefinable */));
|
11405
11635
|
}
|
11406
11636
|
if (entity.isRedefined()) {
|
11407
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11637
|
+
commonModifiers.push(SyntaxFactory.modifier(37 /* Redefined */));
|
11408
11638
|
}
|
11409
11639
|
const name = this.getEntityName(entity);
|
11410
11640
|
const type = this.convertType(entity.getType());
|
@@ -11450,16 +11680,16 @@ var EntityToSyntax = class {
|
|
11450
11680
|
modifiers.push(this.createHidingModifier(isHidden));
|
11451
11681
|
}
|
11452
11682
|
if (entity.isStatic()) {
|
11453
|
-
modifiers.push(SyntaxFactory.modifier(
|
11683
|
+
modifiers.push(SyntaxFactory.modifier(39 /* Static */));
|
11454
11684
|
}
|
11455
11685
|
if (entity.isAbstract()) {
|
11456
|
-
modifiers.push(SyntaxFactory.modifier(
|
11686
|
+
modifiers.push(SyntaxFactory.modifier(35 /* Abstract */));
|
11457
11687
|
}
|
11458
11688
|
if (entity.isRedefinable()) {
|
11459
|
-
modifiers.push(SyntaxFactory.modifier(
|
11689
|
+
modifiers.push(SyntaxFactory.modifier(36 /* Redefinable */));
|
11460
11690
|
}
|
11461
11691
|
if (entity.isRedefined()) {
|
11462
|
-
modifiers.push(SyntaxFactory.modifier(
|
11692
|
+
modifiers.push(SyntaxFactory.modifier(37 /* Redefined */));
|
11463
11693
|
}
|
11464
11694
|
const name = this.getEntityName(entity);
|
11465
11695
|
const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
|
@@ -11475,7 +11705,7 @@ var EntityToSyntax = class {
|
|
11475
11705
|
modifiers.push(this.createHidingModifier(isHidden));
|
11476
11706
|
}
|
11477
11707
|
if (entity.isAbstract()) {
|
11478
|
-
modifiers.push(SyntaxFactory.modifier(
|
11708
|
+
modifiers.push(SyntaxFactory.modifier(35 /* Abstract */));
|
11479
11709
|
}
|
11480
11710
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11481
11711
|
return SyntaxFactory.typeConstructorDeclaration(tags, modifiers, parameters, void 0);
|
@@ -11488,7 +11718,7 @@ var EntityToSyntax = class {
|
|
11488
11718
|
modifiers.push(this.createHidingModifier(isHidden));
|
11489
11719
|
}
|
11490
11720
|
if (entity.isAbstract()) {
|
11491
|
-
modifiers.push(SyntaxFactory.modifier(
|
11721
|
+
modifiers.push(SyntaxFactory.modifier(35 /* Abstract */));
|
11492
11722
|
}
|
11493
11723
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11494
11724
|
return SyntaxFactory.typeDestructorDeclaration(tags, modifiers, parameters, void 0);
|
@@ -11496,10 +11726,10 @@ var EntityToSyntax = class {
|
|
11496
11726
|
convertTypeIndexer(entity) {
|
11497
11727
|
const commonModifiers = new Array();
|
11498
11728
|
if (entity.isStatic()) {
|
11499
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11729
|
+
commonModifiers.push(SyntaxFactory.modifier(39 /* Static */));
|
11500
11730
|
}
|
11501
11731
|
if (entity.isAbstract()) {
|
11502
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11732
|
+
commonModifiers.push(SyntaxFactory.modifier(35 /* Abstract */));
|
11503
11733
|
}
|
11504
11734
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11505
11735
|
const result = new Array();
|
@@ -11616,16 +11846,16 @@ var EntityToSyntax = class {
|
|
11616
11846
|
let levelKeyword;
|
11617
11847
|
switch (hiding.kind) {
|
11618
11848
|
case "type":
|
11619
|
-
levelKeyword =
|
11849
|
+
levelKeyword = 50 /* InType */;
|
11620
11850
|
break;
|
11621
11851
|
case "type-hierarchy":
|
11622
|
-
levelKeyword =
|
11852
|
+
levelKeyword = 47 /* InHierarchy */;
|
11623
11853
|
break;
|
11624
11854
|
case "file":
|
11625
|
-
levelKeyword =
|
11855
|
+
levelKeyword = 48 /* InFile */;
|
11626
11856
|
break;
|
11627
11857
|
case "package":
|
11628
|
-
levelKeyword =
|
11858
|
+
levelKeyword = 49 /* InPackage */;
|
11629
11859
|
break;
|
11630
11860
|
default:
|
11631
11861
|
Debug.never(hiding);
|
@@ -11811,7 +12041,7 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
11811
12041
|
if (result === void 0) {
|
11812
12042
|
const node = new EntityToSyntax(analyzer, packageEntity, localizationContext).convert();
|
11813
12043
|
const code = new SyntaxToCode(node, { keywordsLocale: packageLocale }).convert();
|
11814
|
-
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, [key]);
|
12044
|
+
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, "", [key]);
|
11815
12045
|
const generatedFileUri = generatedPackageUri.append(`${packageEntity.getName().toString()}.art`);
|
11816
12046
|
const fileSystemTree = atomicRun2(() => new FileSystemTree());
|
11817
12047
|
const packageDirectory = fileSystemTree.addDirectory(generatedPackageUri);
|
@@ -11908,14 +12138,13 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
11908
12138
|
case 8 /* DereferenceOperator */:
|
11909
12139
|
case 9 /* Constructor */:
|
11910
12140
|
case 10 /* Destructor */:
|
11911
|
-
case 15 /*
|
11912
|
-
case 16 /* BinaryOperator */:
|
12141
|
+
case 15 /* Operator */:
|
11913
12142
|
return this.checkIfEntityOfKindIsPresentInGeneratedCode(entity.getContainer().getEntity());
|
11914
12143
|
case 13 /* PackageAlias */:
|
11915
12144
|
return false;
|
11916
|
-
case
|
12145
|
+
case 16 /* Package */:
|
11917
12146
|
return false;
|
11918
|
-
case
|
12147
|
+
case 17 /* TypeExtension */:
|
11919
12148
|
return true;
|
11920
12149
|
default:
|
11921
12150
|
Debug.never(entity);
|
@@ -11974,6 +12203,8 @@ var EntityFinder = class {
|
|
11974
12203
|
return this.findConstructorEntity(entity);
|
11975
12204
|
case 10 /* Destructor */:
|
11976
12205
|
return this.findDestructorEntity(entity);
|
12206
|
+
case 15 /* Operator */:
|
12207
|
+
return this.findOperatorEntity(entity);
|
11977
12208
|
case 7 /* Indexer */:
|
11978
12209
|
return this.findIndexerEntity(entity);
|
11979
12210
|
case 8 /* DereferenceOperator */:
|
@@ -11985,10 +12216,8 @@ var EntityFinder = class {
|
|
11985
12216
|
case 13 /* PackageAlias */:
|
11986
12217
|
case 3 /* Getter */:
|
11987
12218
|
case 4 /* Setter */:
|
11988
|
-
case
|
11989
|
-
case
|
11990
|
-
case 17 /* Package */:
|
11991
|
-
case 18 /* TypeExtension */:
|
12219
|
+
case 16 /* Package */:
|
12220
|
+
case 17 /* TypeExtension */:
|
11992
12221
|
return void 0;
|
11993
12222
|
default:
|
11994
12223
|
Debug.never(entity);
|
@@ -12092,6 +12321,23 @@ var EntityFinder = class {
|
|
12092
12321
|
return index >= 0 ? members[index] : void 0;
|
12093
12322
|
}
|
12094
12323
|
}
|
12324
|
+
findOperatorEntity(entity) {
|
12325
|
+
const containingType = this.findEntity(entity.getContainer().getEntity());
|
12326
|
+
if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
|
12327
|
+
return void 0;
|
12328
|
+
}
|
12329
|
+
const members = containingType.getMembers().getOperators();
|
12330
|
+
if (members.length === 0) {
|
12331
|
+
return void 0;
|
12332
|
+
} else if (members.length === 1) {
|
12333
|
+
return members[0];
|
12334
|
+
} else {
|
12335
|
+
const referenceData = new DataForFindingOverloadedMember([], entity.getValueParameters());
|
12336
|
+
const membersData = members.map((m) => new DataForFindingOverloadedMember([], m.getValueParameters()));
|
12337
|
+
const index = this.findOverloadedMemberIndex(referenceData, membersData);
|
12338
|
+
return index >= 0 ? members[index] : void 0;
|
12339
|
+
}
|
12340
|
+
}
|
12095
12341
|
findIndexerEntity(entity) {
|
12096
12342
|
const containingType = this.findEntity(entity.getContainer().getEntity());
|
12097
12343
|
if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
|
@@ -12154,6 +12400,8 @@ var EntityFinder = class {
|
|
12154
12400
|
return entity.getValueParameters();
|
12155
12401
|
case 11 /* MethodType */:
|
12156
12402
|
return entity.getValueParameters();
|
12403
|
+
case 15 /* Operator */:
|
12404
|
+
return entity.getValueParameters();
|
12157
12405
|
case 0 /* Variable */:
|
12158
12406
|
case 1 /* Variant */:
|
12159
12407
|
case 2 /* VariantType */:
|
@@ -12163,10 +12411,8 @@ var EntityFinder = class {
|
|
12163
12411
|
case 12 /* StructuredType */:
|
12164
12412
|
case 13 /* PackageAlias */:
|
12165
12413
|
case 14 /* AliasType */:
|
12166
|
-
case
|
12167
|
-
case
|
12168
|
-
case 17 /* Package */:
|
12169
|
-
case 18 /* TypeExtension */:
|
12414
|
+
case 16 /* Package */:
|
12415
|
+
case 17 /* TypeExtension */:
|
12170
12416
|
case 8 /* DereferenceOperator */:
|
12171
12417
|
return void 0;
|
12172
12418
|
default:
|
@@ -12195,10 +12441,9 @@ var EntityFinder = class {
|
|
12195
12441
|
case 4 /* Setter */:
|
12196
12442
|
case 6 /* TypeParameter */:
|
12197
12443
|
case 13 /* PackageAlias */:
|
12198
|
-
case
|
12199
|
-
case
|
12200
|
-
case
|
12201
|
-
case 18 /* TypeExtension */:
|
12444
|
+
case 16 /* Package */:
|
12445
|
+
case 17 /* TypeExtension */:
|
12446
|
+
case 15 /* Operator */:
|
12202
12447
|
return void 0;
|
12203
12448
|
default:
|
12204
12449
|
Debug.never(entity);
|
@@ -12882,7 +13127,7 @@ var LanguageServer = class {
|
|
12882
13127
|
const sourceFileContext = yield this.getSourceFileContext(uri, token);
|
12883
13128
|
if (sourceFileContext !== void 0) {
|
12884
13129
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
12885
|
-
if (node?.kind ===
|
13130
|
+
if (node?.kind === 93 /* AssignmentStatement */) {
|
12886
13131
|
const sourceFileEdit = this._addPropertyAssignmentService.createEditWithAssignment(
|
12887
13132
|
sourceFileContext.sourceFile,
|
12888
13133
|
node,
|
@@ -12919,7 +13164,7 @@ var LanguageServer = class {
|
|
12919
13164
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
12920
13165
|
if (node !== void 0) {
|
12921
13166
|
let nodeForRange = node;
|
12922
|
-
if (node.kind ===
|
13167
|
+
if (node.kind === 93 /* AssignmentStatement */) {
|
12923
13168
|
nodeForRange = node.right;
|
12924
13169
|
}
|
12925
13170
|
result = this.convertSourceFileRange(sourceFileContext.sourceFile, nodeForRange.rangeWithoutTrivia);
|
@@ -13066,7 +13311,7 @@ ${e}`);
|
|
13066
13311
|
const position = new Position(params.position.line, params.position.character);
|
13067
13312
|
const offset = sourceFile.getOffsetAtPosition(position);
|
13068
13313
|
const completions = this._completionService.getCompletions(analyzer, sourceFile, offset);
|
13069
|
-
result = completions.map((c) => this.convertCompletionItem(c));
|
13314
|
+
result = completions.map((c) => this.convertCompletionItem(c, sourceFile));
|
13070
13315
|
}
|
13071
13316
|
return result;
|
13072
13317
|
});
|
@@ -13079,22 +13324,31 @@ ${e}`);
|
|
13079
13324
|
const resolutionResult = this._completionService.resolveCompletionItem(cacheId, indexInCache);
|
13080
13325
|
let result;
|
13081
13326
|
if (resolutionResult.kind === "item") {
|
13082
|
-
result = this.convertCompletionItem(resolutionResult.value);
|
13327
|
+
result = this.convertCompletionItem(resolutionResult.value, resolutionResult.sourceFile);
|
13328
|
+
result.textEdit = item.textEdit;
|
13083
13329
|
} else {
|
13084
13330
|
result = item;
|
13085
13331
|
}
|
13086
13332
|
return result;
|
13087
13333
|
}
|
13088
|
-
convertCompletionItem(item) {
|
13334
|
+
convertCompletionItem(item, sourceFile) {
|
13089
13335
|
const data = {
|
13090
13336
|
cacheId: item.cacheId,
|
13091
13337
|
indexInCache: item.indexInCache
|
13092
13338
|
};
|
13339
|
+
let textEdit;
|
13340
|
+
if (item.editRange !== void 0) {
|
13341
|
+
textEdit = ls3.TextEdit.replace(
|
13342
|
+
this.convertSourceFileRange(sourceFile, item.editRange),
|
13343
|
+
item.insertText ?? item.label
|
13344
|
+
);
|
13345
|
+
}
|
13093
13346
|
return {
|
13094
13347
|
label: item.label,
|
13095
13348
|
kind: this.convertCompletionItemKind(item.kind),
|
13096
13349
|
detail: item.details,
|
13097
13350
|
insertText: item.insertText,
|
13351
|
+
textEdit,
|
13098
13352
|
sortText: item.sortText,
|
13099
13353
|
data
|
13100
13354
|
};
|
@@ -13109,42 +13363,46 @@ ${e}`);
|
|
13109
13363
|
return ls3.CompletionItemKind.Property;
|
13110
13364
|
case 3 /* TypeMethod */:
|
13111
13365
|
return ls3.CompletionItemKind.Method;
|
13112
|
-
case
|
13366
|
+
case 5 /* TypeIndexer */:
|
13113
13367
|
return ls3.CompletionItemKind.Property;
|
13114
|
-
case
|
13368
|
+
case 6 /* TypeConstructor */:
|
13115
13369
|
return ls3.CompletionItemKind.Constructor;
|
13116
|
-
case
|
13370
|
+
case 12 /* Variant */:
|
13117
13371
|
return ls3.CompletionItemKind.EnumMember;
|
13118
|
-
case
|
13372
|
+
case 7 /* PackageVariable */:
|
13119
13373
|
return ls3.CompletionItemKind.Variable;
|
13120
|
-
case
|
13374
|
+
case 8 /* PackageMethod */:
|
13121
13375
|
return ls3.CompletionItemKind.Function;
|
13122
|
-
case
|
13376
|
+
case 9 /* LocalVariable */:
|
13123
13377
|
return ls3.CompletionItemKind.Variable;
|
13124
|
-
case
|
13378
|
+
case 10 /* ParameterVariable */:
|
13125
13379
|
return ls3.CompletionItemKind.Variable;
|
13126
|
-
case
|
13380
|
+
case 11 /* NestedMethod */:
|
13127
13381
|
return ls3.CompletionItemKind.Function;
|
13128
|
-
case
|
13382
|
+
case 13 /* RefObjectType */:
|
13129
13383
|
return ls3.CompletionItemKind.Class;
|
13130
|
-
case
|
13384
|
+
case 14 /* PlainObjectType */:
|
13131
13385
|
return ls3.CompletionItemKind.Struct;
|
13132
|
-
case
|
13386
|
+
case 15 /* AspectType */:
|
13133
13387
|
return ls3.CompletionItemKind.Interface;
|
13134
|
-
case
|
13388
|
+
case 16 /* VariantType */:
|
13135
13389
|
return ls3.CompletionItemKind.Enum;
|
13136
|
-
case
|
13390
|
+
case 17 /* TypeParameter */:
|
13137
13391
|
return ls3.CompletionItemKind.TypeParameter;
|
13138
|
-
case
|
13392
|
+
case 18 /* MethodType */:
|
13139
13393
|
return ls3.CompletionItemKind.Function;
|
13140
|
-
case
|
13394
|
+
case 19 /* AliasType */:
|
13141
13395
|
return ls3.CompletionItemKind.Class;
|
13142
|
-
case
|
13396
|
+
case 20 /* InvalidType */:
|
13143
13397
|
return ls3.CompletionItemKind.Class;
|
13144
|
-
case
|
13398
|
+
case 21 /* Keyword */:
|
13145
13399
|
return ls3.CompletionItemKind.Keyword;
|
13146
|
-
case
|
13400
|
+
case 22 /* TargetSignatureParameter */:
|
13147
13401
|
return ls3.CompletionItemKind.Variable;
|
13402
|
+
case 4 /* Operator */:
|
13403
|
+
return ls3.CompletionItemKind.Operator;
|
13404
|
+
case 23 /* OperatorName */:
|
13405
|
+
return ls3.CompletionItemKind.Operator;
|
13148
13406
|
default:
|
13149
13407
|
Debug.never(kind);
|
13150
13408
|
}
|
@@ -13231,6 +13489,8 @@ ${e}`);
|
|
13231
13489
|
return ls3.SemanticTokenTypes.function;
|
13232
13490
|
case 6 /* TypeMethod */:
|
13233
13491
|
return ls3.SemanticTokenTypes.method;
|
13492
|
+
case 7 /* Operator */:
|
13493
|
+
return ls3.SemanticTokenTypes.operator;
|
13234
13494
|
default:
|
13235
13495
|
Debug.never(kind);
|
13236
13496
|
}
|
@@ -13424,22 +13684,10 @@ ${e}`);
|
|
13424
13684
|
});
|
13425
13685
|
}
|
13426
13686
|
convertUriToVscodeUri(uri) {
|
13427
|
-
return URI2.from({ scheme: uri.scheme, path:
|
13687
|
+
return URI2.from({ scheme: uri.scheme, authority: uri.authority, path: uri.path });
|
13428
13688
|
}
|
13429
13689
|
convertVscodeUriToUri(uri) {
|
13430
|
-
uri
|
13431
|
-
const scheme = uri.scheme;
|
13432
|
-
let path = uri.path;
|
13433
|
-
if (path.startsWith("/")) {
|
13434
|
-
path = path.slice(1);
|
13435
|
-
}
|
13436
|
-
let segments;
|
13437
|
-
if (path === "") {
|
13438
|
-
segments = [];
|
13439
|
-
} else {
|
13440
|
-
segments = path.split("/");
|
13441
|
-
}
|
13442
|
-
return new Uri(scheme, segments);
|
13690
|
+
return Uri.from(uri.scheme, uri.authority, uri.path);
|
13443
13691
|
}
|
13444
13692
|
createCancellationToken(cancellationToken) {
|
13445
13693
|
if (!this._enableRequestCancellation) {
|