@artel/artc 0.6.25211 → 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 +20 -18
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +748 -485
- package/build/{chunk-Y3KGPV3L.js → chunk-DYVLHEXS.js} +10754 -10037
- package/build/{chunk-5BGDYCRQ.js → chunk-MRSDFDBD.js} +9 -8
- package/build/{chunk-EYLAO2SF.js → chunk-XGS3PSIF.js} +3 -3
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +3 -1
- package/build/types/analysis/Analyzer.d.ts +33 -15
- 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 +1 -1
- package/build/types/common/LocalizationHelper.d.ts +5 -2
- 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/ir/Nodes.d.ts +24 -22
- package/build/types/entities/OperatorEntity.d.ts +7 -9
- package/build/types/entities/OperatorKind.d.ts +19 -26
- 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 +2 -2
- package/build/types/entities/index.d.ts +7 -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 +42 -50
- package/build/types/services/NodeSemanticInfo.d.ts +6 -11
- package/build/types/services/SemanticTokensService.d.ts +4 -3
- package/build/types/tree/NodeKind.d.ts +105 -104
- package/build/types/tree/OperatorKind.d.ts +24 -7
- package/build/types/tree/green/Nodes.d.ts +28 -5
- package/build/types/tree/green/SyntaxToCode.d.ts +1 -0
- package/build/types/tree/green/Token.d.ts +4 -3
- package/build/types/tree/red/Nodes.d.ts +26 -8
- package/build/types/tree/red/Token.d.ts +3 -2
- package/build/types/types/TypeMembers.d.ts +20 -29
- package/package.json +3 -3
- package/build/types/analysis/BuiltInOperators.d.ts +0 -14
- package/build/types/common/UriTree.d.ts +0 -41
- package/build/types/entities/BinaryOperatorEntity.d.ts +0 -54
- package/build/types/entities/UnaryOperatorEntity.d.ts +0 -37
- package/build/types/parser/OperatorDictionary.d.ts +0 -11
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";
|
@@ -301,7 +302,7 @@ var AddPropertyAssignmentService = class {
|
|
301
302
|
let result;
|
302
303
|
let leftValueText;
|
303
304
|
if (propertyName !== void 0) {
|
304
|
-
if (assignmentNode.left.kind !==
|
305
|
+
if (assignmentNode.left.kind !== 80 /* PropertyAccessExpression */) {
|
305
306
|
return void 0;
|
306
307
|
}
|
307
308
|
const propertyReceiver = assignmentNode.left.expression;
|
@@ -362,22 +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
|
369
|
-
case
|
366
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
367
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
368
|
+
case 58 /* NestedMethodDeclaration */:
|
369
|
+
case 67 /* MethodBlockLiteral */:
|
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
|
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 */:
|
381
383
|
return this.getContainingSubprogram(parent)?.body;
|
382
384
|
default:
|
383
385
|
Debug.never(parent);
|
@@ -408,11 +410,11 @@ function isSubprogramDeclaration(node) {
|
|
408
410
|
case 50 /* TypeDereferencedVariableGetterDeclaration */:
|
409
411
|
case 51 /* TypeDereferencedVariableSetterDeclaration */:
|
410
412
|
case 52 /* TypeMethodDeclaration */:
|
411
|
-
case
|
412
|
-
case
|
413
|
-
case
|
414
|
-
case
|
415
|
-
case
|
413
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
414
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
415
|
+
case 58 /* NestedMethodDeclaration */:
|
416
|
+
case 67 /* MethodBlockLiteral */:
|
417
|
+
case 76 /* MethodLiteral */:
|
416
418
|
return true;
|
417
419
|
default:
|
418
420
|
Debug.typeIsAssignableTo();
|
@@ -1034,7 +1036,7 @@ var SyntaxFactory = class {
|
|
1034
1036
|
return new Token(kind, value ?? "", [], flags, void 0);
|
1035
1037
|
}
|
1036
1038
|
static keyword(kind) {
|
1037
|
-
return new Keyword(
|
1039
|
+
return new Keyword([], kind, true);
|
1038
1040
|
}
|
1039
1041
|
static createTypeParameterClause(typeParameters) {
|
1040
1042
|
if (typeParameters === void 0) {
|
@@ -1383,6 +1385,20 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1383
1385
|
this.writeDeclarationBody(node.body);
|
1384
1386
|
}
|
1385
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
|
+
}
|
1386
1402
|
writeTypeConstructorDeclaration(node) {
|
1387
1403
|
this.writeDeclarationTags(node.tagList);
|
1388
1404
|
this.writeDeclarationModifiers(node.modifierList);
|
@@ -2012,22 +2028,23 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2012
2028
|
[50 /* TypeDereferencedVariableGetterDeclaration */]: this.prototype.writeTypeDereferencedVariableGetterDeclaration,
|
2013
2029
|
[51 /* TypeDereferencedVariableSetterDeclaration */]: this.prototype.writeTypeDereferencedVariableSetterDeclaration,
|
2014
2030
|
[52 /* TypeMethodDeclaration */]: this.prototype.writeTypeMethodDeclaration,
|
2015
|
-
[53 /*
|
2016
|
-
[54 /*
|
2017
|
-
[55 /*
|
2018
|
-
[
|
2019
|
-
[
|
2020
|
-
[
|
2021
|
-
[141 /*
|
2022
|
-
[142 /*
|
2023
|
-
[143 /*
|
2024
|
-
[
|
2025
|
-
[
|
2026
|
-
[148 /*
|
2027
|
-
[149 /*
|
2028
|
-
[150 /*
|
2029
|
-
[
|
2030
|
-
[
|
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,
|
2031
2048
|
[17 /* AnonymousMethodTypeDeclaration */]: this.prototype.writeAnonymousMethodTypeDeclaration,
|
2032
2049
|
[18 /* AnonymousStructuredTypeDeclaration */]: this.prototype.writeAnonymousStructuredTypeDeclaration,
|
2033
2050
|
[19 /* AnonymousVariantTypeDeclaration */]: this.prototype.writeAnonymousVariantTypeDeclaration,
|
@@ -2044,94 +2061,94 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2044
2061
|
[42 /* ExtendedTypeClause */]: this.prototype.writeNodeDefault,
|
2045
2062
|
[43 /* InvalidPackageMemberDeclaration */]: this.prototype.writeNodeDefault,
|
2046
2063
|
[49 /* TypeIndexerParameterClause */]: this.prototype.writeNodeDefault,
|
2047
|
-
[
|
2048
|
-
[
|
2049
|
-
[
|
2050
|
-
[
|
2051
|
-
[
|
2052
|
-
[
|
2053
|
-
[
|
2054
|
-
[
|
2055
|
-
[
|
2056
|
-
[
|
2057
|
-
[
|
2058
|
-
[
|
2059
|
-
[
|
2060
|
-
[
|
2061
|
-
[
|
2062
|
-
[
|
2063
|
-
[
|
2064
|
-
[
|
2065
|
-
[
|
2066
|
-
[
|
2067
|
-
[
|
2068
|
-
[
|
2069
|
-
[
|
2070
|
-
[
|
2071
|
-
[
|
2072
|
-
[
|
2073
|
-
[
|
2074
|
-
[
|
2075
|
-
[
|
2076
|
-
[
|
2077
|
-
[
|
2078
|
-
[
|
2079
|
-
[
|
2080
|
-
[
|
2081
|
-
[
|
2082
|
-
[
|
2083
|
-
[
|
2084
|
-
[
|
2085
|
-
[
|
2086
|
-
[
|
2087
|
-
[
|
2088
|
-
[
|
2089
|
-
[
|
2090
|
-
[
|
2091
|
-
[
|
2092
|
-
[
|
2093
|
-
[
|
2094
|
-
[
|
2095
|
-
[
|
2096
|
-
[
|
2097
|
-
[
|
2098
|
-
[
|
2099
|
-
[
|
2100
|
-
[
|
2101
|
-
[
|
2102
|
-
[
|
2103
|
-
[
|
2104
|
-
[
|
2105
|
-
[
|
2106
|
-
[
|
2107
|
-
[
|
2108
|
-
[
|
2109
|
-
[
|
2110
|
-
[
|
2111
|
-
[
|
2112
|
-
[
|
2113
|
-
[
|
2114
|
-
[
|
2115
|
-
[
|
2116
|
-
[
|
2117
|
-
[
|
2118
|
-
[
|
2119
|
-
[
|
2120
|
-
[
|
2121
|
-
[
|
2122
|
-
[
|
2123
|
-
[
|
2124
|
-
[
|
2125
|
-
[
|
2126
|
-
[
|
2127
|
-
[
|
2128
|
-
[
|
2129
|
-
[
|
2130
|
-
[
|
2131
|
-
[
|
2132
|
-
[
|
2133
|
-
[
|
2134
|
-
[
|
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,
|
2082
|
+
[75 /* NotExpression */]: this.prototype.writeNodeDefault,
|
2083
|
+
[76 /* MethodLiteral */]: this.prototype.writeNodeDefault,
|
2084
|
+
[77 /* ParenthesizedExpression */]: this.prototype.writeNodeDefault,
|
2085
|
+
[78 /* WhenTernaryExpression */]: this.prototype.writeNodeDefault,
|
2086
|
+
[79 /* PrefixUnaryExpression */]: this.prototype.writeNodeDefault,
|
2087
|
+
[80 /* PropertyAccessExpression */]: this.prototype.writeNodeDefault,
|
2088
|
+
[81 /* ReferenceExpression */]: this.prototype.writeNodeDefault,
|
2089
|
+
[82 /* DereferenceExpression */]: this.prototype.writeNodeDefault,
|
2090
|
+
[83 /* TextTemplateLiteral */]: this.prototype.writeNodeDefault,
|
2091
|
+
[84 /* TextTemplateSpanList */]: this.prototype.writeNodeDefault,
|
2092
|
+
[85 /* TextTemplateSpan */]: this.prototype.writeNodeDefault,
|
2093
|
+
[86 /* TokenExpression */]: this.prototype.writeNodeDefault,
|
2094
|
+
[87 /* KeywordExpression */]: this.prototype.writeNodeDefault,
|
2095
|
+
[88 /* ObjectExpression */]: this.prototype.writeNodeDefault,
|
2096
|
+
[89 /* BaseExpression */]: this.prototype.writeNodeDefault,
|
2097
|
+
[90 /* IdentifierExpression */]: 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
|
2135
2152
|
};
|
2136
2153
|
return writeFunctions;
|
2137
2154
|
}
|
@@ -2317,7 +2334,7 @@ var TranslationsGenerationService = class {
|
|
2317
2334
|
return void 0;
|
2318
2335
|
}
|
2319
2336
|
let result;
|
2320
|
-
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind ===
|
2337
|
+
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind === 138 /* TypeTranslation */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
|
2321
2338
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
2322
2339
|
if (translationPackage !== void 0) {
|
2323
2340
|
const generator = new TranslationsGenerator(
|
@@ -2363,16 +2380,19 @@ var TranslationsGenerationService = class {
|
|
2363
2380
|
return false;
|
2364
2381
|
}
|
2365
2382
|
const generator = new TranslationsGenerator(analyzer, sourceFile, translationPackage, sourceFile.package.dialect);
|
2366
|
-
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);
|
2367
2384
|
}
|
2368
2385
|
};
|
2369
|
-
var TranslationsGenerator = class {
|
2386
|
+
var TranslationsGenerator = class _TranslationsGenerator {
|
2370
2387
|
constructor(_analyzer, _sourceFile, _translationPackage, _dialect) {
|
2371
2388
|
this._analyzer = _analyzer;
|
2372
2389
|
this._sourceFile = _sourceFile;
|
2373
2390
|
this._translationPackage = _translationPackage;
|
2374
2391
|
this._dialect = _dialect;
|
2375
2392
|
}
|
2393
|
+
static {
|
2394
|
+
this._translationArrowRegExp = /-> /g;
|
2395
|
+
}
|
2376
2396
|
generateMissingPackageMemberAndTypeMemberTranslations(translationsDeclaration) {
|
2377
2397
|
const result = new Array();
|
2378
2398
|
const memberEntities = this.collectNotTranslatedPackageMembers();
|
@@ -2382,9 +2402,27 @@ var TranslationsGenerator = class {
|
|
2382
2402
|
keywordsLocale: this._translationPackage.getTranslatedPackage().getLocale(),
|
2383
2403
|
keywordsDialect: this._dialect,
|
2384
2404
|
initialIndentation: this.detectIndentationForPackageMemberTranslations(translationsDeclaration),
|
2385
|
-
indentationStep: this.detectIndentationStepForTypeMemberTranslations(translationsDeclaration)
|
2405
|
+
indentationStep: this.detectIndentationStepForTypeMemberTranslations(translationsDeclaration),
|
2406
|
+
newLine
|
2386
2407
|
};
|
2387
|
-
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}`);
|
2388
2426
|
const editRange = Range.empty(translationsDeclaration.openBraceToken.rangeWithoutTrivia.end);
|
2389
2427
|
let editText = newLine + memberTranslationsCode;
|
2390
2428
|
if (translationsDeclaration.translationList.translationDeclarations.count() > 0) {
|
@@ -2401,7 +2439,7 @@ var TranslationsGenerator = class {
|
|
2401
2439
|
generateMissingTranslationsForPartiallyTranslatedTypes(translationsDeclaration) {
|
2402
2440
|
const result = new Array();
|
2403
2441
|
for (const translation of translationsDeclaration.translationList.translationDeclarations) {
|
2404
|
-
if (translation.kind ===
|
2442
|
+
if (translation.kind === 138 /* TypeTranslation */) {
|
2405
2443
|
const edits = this.generateMissingTypeMemberTranslations(translation);
|
2406
2444
|
if (edits !== void 0) {
|
2407
2445
|
result.push(...edits);
|
@@ -2420,13 +2458,21 @@ var TranslationsGenerator = class {
|
|
2420
2458
|
return void 0;
|
2421
2459
|
}
|
2422
2460
|
const newLine = this.detectNewLine();
|
2423
|
-
const membersIndentation = this.detectIndentationForTypeMemberTranslations(typeTranslation);
|
2424
2461
|
const syntaxToCodeOptions = {
|
2425
2462
|
keywordsLocale: this._translationPackage.getTranslatedPackage().getLocale(),
|
2426
2463
|
keywordsDialect: this._dialect,
|
2427
|
-
initialIndentation:
|
2464
|
+
initialIndentation: this.detectIndentationForTypeMemberTranslations(typeTranslation),
|
2465
|
+
indentationStep: this.detectIndentationStepForTypeMemberTranslations(typeTranslation),
|
2466
|
+
newLine
|
2428
2467
|
};
|
2429
|
-
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}`);
|
2430
2476
|
let editText;
|
2431
2477
|
let editRange;
|
2432
2478
|
if (typeTranslation.openBraceToken !== void 0) {
|
@@ -2499,21 +2545,34 @@ var TranslationsGenerator = class {
|
|
2499
2545
|
}
|
2500
2546
|
return " ".repeat(indentationSize);
|
2501
2547
|
}
|
2502
|
-
detectIndentationStepForTypeMemberTranslations(
|
2548
|
+
detectIndentationStepForTypeMemberTranslations(node) {
|
2503
2549
|
let indentationStepSize;
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
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
|
+
}
|
2512
2561
|
}
|
2513
2562
|
}
|
2514
2563
|
}
|
2515
2564
|
indentationStepSize ??= 2;
|
2516
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
|
+
}
|
2517
2576
|
}
|
2518
2577
|
detectIndentationForTypeMemberTranslations(typeTranslation) {
|
2519
2578
|
let indentationSize;
|
@@ -2553,7 +2612,7 @@ var TranslationsGenerator = class {
|
|
2553
2612
|
return this.createPackageTypeWithMembersTranslation(entity);
|
2554
2613
|
case 11 /* MethodType */:
|
2555
2614
|
return this.createPackageMethodTypeTranslation(entity);
|
2556
|
-
case
|
2615
|
+
case 17 /* TypeExtension */:
|
2557
2616
|
return void 0;
|
2558
2617
|
default:
|
2559
2618
|
Debug.never(entity);
|
@@ -2595,8 +2654,7 @@ var TranslationsGenerator = class {
|
|
2595
2654
|
return this.createVariantTranslation(entity);
|
2596
2655
|
case 8 /* DereferenceOperator */:
|
2597
2656
|
case 10 /* Destructor */:
|
2598
|
-
case 15 /*
|
2599
|
-
case 16 /* BinaryOperator */:
|
2657
|
+
case 15 /* Operator */:
|
2600
2658
|
return void 0;
|
2601
2659
|
default:
|
2602
2660
|
Debug.never(entity);
|
@@ -2625,7 +2683,18 @@ var TranslationsGenerator = class {
|
|
2625
2683
|
return SyntaxFactory.typeVariableOrVariantTranslation(name, name);
|
2626
2684
|
}
|
2627
2685
|
getNameText(name) {
|
2628
|
-
|
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
|
+
}
|
2629
2698
|
}
|
2630
2699
|
detectNewLine() {
|
2631
2700
|
return this._sourceFile.getSourceText().includes("\r\n") ? "\r\n" : "\n";
|
@@ -2672,7 +2741,7 @@ var CodeActionsService = class {
|
|
2672
2741
|
}
|
2673
2742
|
const result = new Array();
|
2674
2743
|
const diagnosticCodeSet = new Set(diagnosticCodes);
|
2675
|
-
if (diagnosticCodeSet.has(
|
2744
|
+
if (diagnosticCodeSet.has(142 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(143 /* TheFollowingDeclarationAreNotTranslated0And1More */)) {
|
2676
2745
|
const data = { onlyTypeMembers: false };
|
2677
2746
|
result.push(CodeAction.unresolved(
|
2678
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.",
|
@@ -2789,13 +2858,13 @@ var ValueArgumentFactory = class _ValueArgumentFactory {
|
|
2789
2858
|
var SignatureForNode = class _SignatureForNode {
|
2790
2859
|
static getSignaturesForNode(analyzer, node) {
|
2791
2860
|
switch (node.kind) {
|
2792
|
-
case
|
2861
|
+
case 69 /* CallExpression */:
|
2793
2862
|
return _SignatureForNode.getSignaturesForCallExpression(analyzer, node);
|
2794
|
-
case
|
2863
|
+
case 70 /* AutotypeCallExpression */:
|
2795
2864
|
return _SignatureForNode.getSignaturesForAutotypeCallExpression(analyzer, node);
|
2796
|
-
case
|
2865
|
+
case 72 /* IndexedAccessExpression */:
|
2797
2866
|
return _SignatureForNode.getSignaturesForIndexedAccessExpression(analyzer, node);
|
2798
|
-
case
|
2867
|
+
case 146 /* Tag */:
|
2799
2868
|
return _SignatureForNode.getSignaturesForTag(analyzer, node);
|
2800
2869
|
default:
|
2801
2870
|
Debug.never(node);
|
@@ -2935,7 +3004,7 @@ var SimplifiedOverloadResolver = class _SimplifiedOverloadResolver {
|
|
2935
3004
|
result = false;
|
2936
3005
|
break;
|
2937
3006
|
}
|
2938
|
-
if (argument.expression === void 0 || argument.expression.kind ===
|
3007
|
+
if (argument.expression === void 0 || argument.expression.kind === 73 /* InvalidExpression */) {
|
2939
3008
|
continue;
|
2940
3009
|
}
|
2941
3010
|
const targetParameterType = targetParameter.getType();
|
@@ -3149,17 +3218,20 @@ var CompletionService = class {
|
|
3149
3218
|
);
|
3150
3219
|
completionItemInfos = this.mergeOverloadedMethods(completionItemInfos);
|
3151
3220
|
completionItemInfos = this.removeCompletionItemsWithDuplicateLabels(completionItemInfos);
|
3152
|
-
const cacheId = this._cache.add(completionItemInfos);
|
3221
|
+
const cacheId = this._cache.add(completionItemInfos, sourceFile).id;
|
3153
3222
|
const result = this.convertCompletionItemInfos(completionItemInfos, cacheId);
|
3154
3223
|
return result;
|
3155
3224
|
}
|
3156
3225
|
resolveCompletionItem(cacheId, indexInCache) {
|
3157
|
-
const
|
3158
|
-
if (
|
3226
|
+
const cacheEntry = this._cache.get(cacheId);
|
3227
|
+
if (cacheEntry === void 0 || indexInCache >= cacheEntry.items.length) {
|
3159
3228
|
return new ResolutionResult_notInCache();
|
3160
3229
|
}
|
3161
|
-
const completionItemInfo =
|
3162
|
-
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
|
+
);
|
3163
3235
|
}
|
3164
3236
|
createSemanticContextAtPosition(positionDescription) {
|
3165
3237
|
switch (positionDescription.kind) {
|
@@ -3208,6 +3280,9 @@ var CompletionService = class {
|
|
3208
3280
|
if (syntaxContext.isInComment || syntaxContext.isInStringOrChar) {
|
3209
3281
|
return { kind: "none" };
|
3210
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
|
+
}
|
3211
3286
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3212
3287
|
if (tokenOrKeyword.isKeyword(17 /* Import */) && tokenOrKeyword.parent.kind === 5 /* SinglePackageImportDirective */) {
|
3213
3288
|
return new PackageImportCompletionContext([], void 0);
|
@@ -3223,7 +3298,7 @@ var CompletionService = class {
|
|
3223
3298
|
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || this.tokenOrKeywordIsPackageImportListChild(tokenOrKeyword)) {
|
3224
3299
|
return new PackageImportCompletionContext([], void 0);
|
3225
3300
|
}
|
3226
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3301
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 80 /* PropertyAccessExpression */) {
|
3227
3302
|
const propertyAccess = tokenOrKeyword.parent;
|
3228
3303
|
{
|
3229
3304
|
const info = this._analyzer.checkExpressionDenotesPackageNameSegment(propertyAccess.expression);
|
@@ -3264,7 +3339,7 @@ var CompletionService = class {
|
|
3264
3339
|
typeExtensionLookup
|
3265
3340
|
);
|
3266
3341
|
}
|
3267
|
-
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 */) {
|
3268
3343
|
const namedTypeSpecifier = tokenOrKeyword.parent.parent;
|
3269
3344
|
const resolutionResult = this._analyzer.resolveNamedTypeSpecifier(namedTypeSpecifier);
|
3270
3345
|
const segmentIndex = Math.floor(
|
@@ -3272,7 +3347,7 @@ var CompletionService = class {
|
|
3272
3347
|
);
|
3273
3348
|
if (segmentIndex < resolutionResult.resolvedQualifiers.length) {
|
3274
3349
|
let completionInIsOrAsExpressionInfo;
|
3275
|
-
if (namedTypeSpecifier.parent.kind ===
|
3350
|
+
if (namedTypeSpecifier.parent.kind === 74 /* IsExpression */ || namedTypeSpecifier.parent.kind === 65 /* AsExpression */) {
|
3276
3351
|
completionInIsOrAsExpressionInfo = {
|
3277
3352
|
expressionType: this._analyzer.type.ofExpression(namedTypeSpecifier.parent.expression)
|
3278
3353
|
};
|
@@ -3308,7 +3383,7 @@ var CompletionService = class {
|
|
3308
3383
|
}
|
3309
3384
|
if (syntaxContext.isUnqualifiedTypeContext !== void 0) {
|
3310
3385
|
let completionInIsOrAsExpressionInfo;
|
3311
|
-
if (tokenOrKeyword.parent.kind ===
|
3386
|
+
if (tokenOrKeyword.parent.kind === 74 /* IsExpression */ || tokenOrKeyword.parent.kind === 65 /* AsExpression */) {
|
3312
3387
|
completionInIsOrAsExpressionInfo = {
|
3313
3388
|
expressionType: this._analyzer.type.ofExpression(tokenOrKeyword.parent.expression)
|
3314
3389
|
};
|
@@ -3358,17 +3433,17 @@ var CompletionService = class {
|
|
3358
3433
|
translationKind = 0 /* Any */;
|
3359
3434
|
hasPrecedingKeyword = false;
|
3360
3435
|
}
|
3361
|
-
if (tokenOrKeyword.isKeyword(17 /* Import */) && tokenOrKeyword.parent.kind ===
|
3436
|
+
if (tokenOrKeyword.isKeyword(17 /* Import */) && tokenOrKeyword.parent.kind === 133 /* PackageImportTranslation */) {
|
3362
3437
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3363
3438
|
translationKind = 1 /* PackageImport */;
|
3364
3439
|
hasPrecedingKeyword = true;
|
3365
3440
|
}
|
3366
|
-
if (tokenOrKeyword.isKeyword(15 /* Type */) && (tokenOrKeyword.parent.kind ===
|
3441
|
+
if (tokenOrKeyword.isKeyword(15 /* Type */) && (tokenOrKeyword.parent.kind === 138 /* TypeTranslation */ || tokenOrKeyword.parent.kind === 132 /* MethodTypeTranslation */)) {
|
3367
3442
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3368
3443
|
translationKind = 3 /* Type */;
|
3369
3444
|
hasPrecedingKeyword = true;
|
3370
3445
|
}
|
3371
|
-
if (tokenOrKeyword.isKeyword(11 /* Function */) && tokenOrKeyword.parent.kind ===
|
3446
|
+
if (tokenOrKeyword.isKeyword(11 /* Function */) && tokenOrKeyword.parent.kind === 130 /* PackageMethodTranslation */) {
|
3372
3447
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3373
3448
|
translationKind = 2 /* Method */;
|
3374
3449
|
hasPrecedingKeyword = true;
|
@@ -3388,9 +3463,9 @@ var CompletionService = class {
|
|
3388
3463
|
hasPrecedingKeyword
|
3389
3464
|
);
|
3390
3465
|
}
|
3391
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3466
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 134 /* QualifiedName */) {
|
3392
3467
|
const qualifiedName = tokenOrKeyword.parent;
|
3393
|
-
if (qualifiedName.parent.kind ===
|
3468
|
+
if (qualifiedName.parent.kind === 133 /* PackageImportTranslation */ && qualifiedName === qualifiedName.parent.sourceName) {
|
3394
3469
|
const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.rangeStart < tokenOrKeyword.value.rangeStart).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
3395
3470
|
const sourceLocale = translationPackage.getTranslatedPackage().getLocale();
|
3396
3471
|
return new PackageImportCompletionContext(precedingSegmentNames, { sourceLocale });
|
@@ -3415,12 +3490,12 @@ var CompletionService = class {
|
|
3415
3490
|
translationKind = 0 /* Any */;
|
3416
3491
|
hasPrecedingKeyword = false;
|
3417
3492
|
}
|
3418
|
-
if (tokenOrKeyword.isKeyword(11 /* Function */) && tokenOrKeyword.parent.kind ===
|
3493
|
+
if (tokenOrKeyword.isKeyword(11 /* Function */) && tokenOrKeyword.parent.kind === 131 /* TypeMethodTranslation */) {
|
3419
3494
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3420
3495
|
translationKind = 1 /* Method */;
|
3421
3496
|
hasPrecedingKeyword = true;
|
3422
3497
|
}
|
3423
|
-
if (tokenOrKeyword.isKeyword(28 /* Creation */) && tokenOrKeyword.parent.kind ===
|
3498
|
+
if (tokenOrKeyword.isKeyword(28 /* Creation */) && tokenOrKeyword.parent.kind === 125 /* ConstructorTranslation */) {
|
3424
3499
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3425
3500
|
translationKind = 3 /* Constructor */;
|
3426
3501
|
hasPrecedingKeyword = true;
|
@@ -3450,17 +3525,17 @@ var CompletionService = class {
|
|
3450
3525
|
let signatures;
|
3451
3526
|
let valueArguments;
|
3452
3527
|
switch (role.argumentList.parent.kind) {
|
3453
|
-
case
|
3528
|
+
case 69 /* CallExpression */:
|
3454
3529
|
signatures = SignatureForNode.getSignaturesForCallExpression(this._analyzer, role.argumentList.parent);
|
3455
3530
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfCallExpression(role.argumentList.parent);
|
3456
3531
|
break;
|
3457
|
-
case
|
3532
|
+
case 70 /* AutotypeCallExpression */:
|
3458
3533
|
signatures = SignatureForNode.getSignaturesForAutotypeCallExpression(this._analyzer, role.argumentList.parent);
|
3459
3534
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfAutotypeCallExpression(
|
3460
3535
|
role.argumentList.parent
|
3461
3536
|
);
|
3462
3537
|
break;
|
3463
|
-
case
|
3538
|
+
case 146 /* Tag */:
|
3464
3539
|
signatures = SignatureForNode.getSignaturesForTag(this._analyzer, role.argumentList.parent);
|
3465
3540
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(role.argumentList.parent);
|
3466
3541
|
break;
|
@@ -3574,6 +3649,9 @@ var CompletionService = class {
|
|
3574
3649
|
case "type-member-translation-list":
|
3575
3650
|
result = this.getTypeAliasMemberListItemInfos(completionContext);
|
3576
3651
|
break;
|
3652
|
+
case "operator-name":
|
3653
|
+
result = this.getOperatorNameItemInfos(completionContext);
|
3654
|
+
break;
|
3577
3655
|
case "none":
|
3578
3656
|
result = [];
|
3579
3657
|
break;
|
@@ -3647,7 +3725,7 @@ var CompletionService = class {
|
|
3647
3725
|
if (syntaxContext.isUnqualifiedTypeContext?.allowsAnonymousTypes === true) {
|
3648
3726
|
kinds.add(5 /* PlainObject */).add(4 /* Object */).add(6 /* Variant */).add(3 /* Aspect */).add(11 /* Function */).add(38 /* Async */);
|
3649
3727
|
}
|
3650
|
-
if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(38 /* Async */) && (positionDescription.tokenOrKeyword.parent.kind ===
|
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 */)) {
|
3651
3729
|
kinds.add(11 /* Function */);
|
3652
3730
|
}
|
3653
3731
|
return Query.from(kinds.values()).map(
|
@@ -3659,28 +3737,28 @@ var CompletionService = class {
|
|
3659
3737
|
return false;
|
3660
3738
|
}
|
3661
3739
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3662
|
-
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 */;
|
3663
3741
|
}
|
3664
3742
|
isModifierLevelContext(positionDescription) {
|
3665
3743
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3666
3744
|
return false;
|
3667
3745
|
}
|
3668
3746
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3669
|
-
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind ===
|
3747
|
+
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 148 /* Modifier */;
|
3670
3748
|
}
|
3671
3749
|
isElseOrElseIfKeywordContext(positionDescription) {
|
3672
3750
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3673
3751
|
return false;
|
3674
3752
|
}
|
3675
3753
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3676
|
-
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 */);
|
3677
3755
|
}
|
3678
3756
|
isRunStatementAccessorListContext(positionDescription) {
|
3679
3757
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3680
3758
|
return false;
|
3681
3759
|
}
|
3682
3760
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3683
|
-
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 */);
|
3684
3762
|
}
|
3685
3763
|
isTypeKindCompletionContext(positionDescription) {
|
3686
3764
|
return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(57 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
|
@@ -3690,17 +3768,17 @@ var CompletionService = class {
|
|
3690
3768
|
return false;
|
3691
3769
|
}
|
3692
3770
|
const token = positionDescription.tokenOrKeyword.value;
|
3693
|
-
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);
|
3694
3772
|
}
|
3695
3773
|
isCaseKeywordContext(positionDescription, syntaxContext) {
|
3696
3774
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3697
3775
|
return false;
|
3698
3776
|
}
|
3699
3777
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3700
|
-
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 */) {
|
3701
3779
|
return true;
|
3702
3780
|
}
|
3703
|
-
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind ===
|
3781
|
+
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 118 /* SwitchStatement */) {
|
3704
3782
|
return true;
|
3705
3783
|
}
|
3706
3784
|
return false;
|
@@ -3818,7 +3896,9 @@ var CompletionService = class {
|
|
3818
3896
|
default:
|
3819
3897
|
Debug.never(d.value);
|
3820
3898
|
}
|
3821
|
-
})
|
3899
|
+
}).chain(
|
3900
|
+
Query.from(lookup.getOperators()).map((o) => new OperatorCompletionItemInfo(this.completionItemInfoContext, o.value, o.localization))
|
3901
|
+
);
|
3822
3902
|
}
|
3823
3903
|
getTypeCompletionItemInfos(ctx) {
|
3824
3904
|
let result;
|
@@ -3989,7 +4069,7 @@ var CompletionService = class {
|
|
3989
4069
|
default:
|
3990
4070
|
Debug.never(m.value);
|
3991
4071
|
}
|
3992
|
-
}).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();
|
3993
4073
|
}
|
3994
4074
|
}
|
3995
4075
|
getPackageImportCompletionItemInfos(ctx) {
|
@@ -4181,13 +4261,25 @@ var CompletionService = class {
|
|
4181
4261
|
}
|
4182
4262
|
return result.toArray();
|
4183
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
|
+
}
|
4184
4275
|
mergeOverloadedMethods(completionItemInfos) {
|
4185
4276
|
const result = new Array();
|
4186
4277
|
const methodInfoByLabel = /* @__PURE__ */ new Map();
|
4187
4278
|
for (const itemInfo of completionItemInfos) {
|
4188
4279
|
switch (itemInfo.kind) {
|
4189
4280
|
case "type-method":
|
4190
|
-
case "method-entity":
|
4281
|
+
case "method-entity":
|
4282
|
+
case "operator": {
|
4191
4283
|
const label = itemInfo.getLabel();
|
4192
4284
|
const methodInfo = methodInfoByLabel.get(label);
|
4193
4285
|
if (methodInfo !== void 0) {
|
@@ -4241,6 +4333,7 @@ var CompletionService = class {
|
|
4241
4333
|
info.getCompletionItemKind(),
|
4242
4334
|
isForResolve ? info.getDetails() : void 0,
|
4243
4335
|
info.getInsertText(),
|
4336
|
+
info.getEditRange(),
|
4244
4337
|
info.getSortText(),
|
4245
4338
|
cacheId,
|
4246
4339
|
indexInCache
|
@@ -4248,19 +4341,21 @@ var CompletionService = class {
|
|
4248
4341
|
}
|
4249
4342
|
};
|
4250
4343
|
var CompletionItem = class {
|
4251
|
-
constructor(label, kind, details, insertText, sortText, cacheId, indexInCache) {
|
4344
|
+
constructor(label, kind, details, insertText, editRange, sortText, cacheId, indexInCache) {
|
4252
4345
|
this.label = label;
|
4253
4346
|
this.kind = kind;
|
4254
4347
|
this.details = details;
|
4255
4348
|
this.insertText = insertText;
|
4349
|
+
this.editRange = editRange;
|
4256
4350
|
this.sortText = sortText;
|
4257
4351
|
this.cacheId = cacheId;
|
4258
4352
|
this.indexInCache = indexInCache;
|
4259
4353
|
}
|
4260
4354
|
};
|
4261
4355
|
var ResolutionResult_item = class {
|
4262
|
-
constructor(value) {
|
4356
|
+
constructor(value, sourceFile) {
|
4263
4357
|
this.value = value;
|
4358
|
+
this.sourceFile = sourceFile;
|
4264
4359
|
this.kind = "item";
|
4265
4360
|
}
|
4266
4361
|
};
|
@@ -4317,10 +4412,10 @@ function getRightmostChildExcludingValidEmptyNodes(node) {
|
|
4317
4412
|
}
|
4318
4413
|
function isInvalidNode(node) {
|
4319
4414
|
switch (node.kind) {
|
4320
|
-
case
|
4415
|
+
case 73 /* InvalidExpression */:
|
4321
4416
|
case 43 /* InvalidPackageMemberDeclaration */:
|
4322
|
-
case
|
4323
|
-
case
|
4417
|
+
case 112 /* InvalidStatement */:
|
4418
|
+
case 57 /* InvalidTypeMemberDeclaration */:
|
4324
4419
|
case 16 /* InvalidTypeSpecifier */:
|
4325
4420
|
return true;
|
4326
4421
|
case 0 /* Token */:
|
@@ -4370,6 +4465,12 @@ var TypeCompletionContext = class {
|
|
4370
4465
|
this.kind = "type";
|
4371
4466
|
}
|
4372
4467
|
};
|
4468
|
+
var OperatorNameCompletionContext = class {
|
4469
|
+
constructor(nameToken) {
|
4470
|
+
this.nameToken = nameToken;
|
4471
|
+
this.kind = "operator-name";
|
4472
|
+
}
|
4473
|
+
};
|
4373
4474
|
var ScopeTypeSearchLocation = class {
|
4374
4475
|
constructor(lookup) {
|
4375
4476
|
this.lookup = lookup;
|
@@ -4466,6 +4567,9 @@ var PackageNameSegmentCompletionItemInfo = class {
|
|
4466
4567
|
getSortText() {
|
4467
4568
|
return void 0;
|
4468
4569
|
}
|
4570
|
+
getEditRange() {
|
4571
|
+
return void 0;
|
4572
|
+
}
|
4469
4573
|
};
|
4470
4574
|
var PackageAliasEntityCompletionItemInfo = class {
|
4471
4575
|
constructor(ctx, packageAlias) {
|
@@ -4488,6 +4592,9 @@ var PackageAliasEntityCompletionItemInfo = class {
|
|
4488
4592
|
getSortText() {
|
4489
4593
|
return void 0;
|
4490
4594
|
}
|
4595
|
+
getEditRange() {
|
4596
|
+
return void 0;
|
4597
|
+
}
|
4491
4598
|
};
|
4492
4599
|
var TypeVariableCompletionItemInfo = class {
|
4493
4600
|
constructor(ctx, variable, name, isNameExplicitlyOriginal) {
|
@@ -4514,6 +4621,9 @@ var TypeVariableCompletionItemInfo = class {
|
|
4514
4621
|
getSortText() {
|
4515
4622
|
return void 0;
|
4516
4623
|
}
|
4624
|
+
getEditRange() {
|
4625
|
+
return void 0;
|
4626
|
+
}
|
4517
4627
|
};
|
4518
4628
|
var TypeMethodCompletionItemInfo = class {
|
4519
4629
|
constructor(ctx, method, name, isNameExplicitlyOriginal) {
|
@@ -4540,6 +4650,37 @@ var TypeMethodCompletionItemInfo = class {
|
|
4540
4650
|
getSortText() {
|
4541
4651
|
return void 0;
|
4542
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
|
+
}
|
4543
4684
|
};
|
4544
4685
|
var VariantCompletionItemInfo = class {
|
4545
4686
|
constructor(ctx, variant, name, isNameExplicitlyOriginal) {
|
@@ -4553,7 +4694,7 @@ var VariantCompletionItemInfo = class {
|
|
4553
4694
|
return `${this.isNameExplicitlyOriginal ? "~" : ""}${this.ctx.getInsertTextForName(this.name.value)}`;
|
4554
4695
|
}
|
4555
4696
|
getCompletionItemKind() {
|
4556
|
-
return
|
4697
|
+
return 12 /* Variant */;
|
4557
4698
|
}
|
4558
4699
|
getDetails() {
|
4559
4700
|
return this.ctx.displayService.displayVariantEntity(this.variant, this.name.localization);
|
@@ -4564,6 +4705,9 @@ var VariantCompletionItemInfo = class {
|
|
4564
4705
|
getSortText() {
|
4565
4706
|
return void 0;
|
4566
4707
|
}
|
4708
|
+
getEditRange() {
|
4709
|
+
return void 0;
|
4710
|
+
}
|
4567
4711
|
};
|
4568
4712
|
var VariableEntityCompletionItemInfo = class {
|
4569
4713
|
constructor(ctx, entity, name, isNameExplicitlyOriginal) {
|
@@ -4579,13 +4723,13 @@ var VariableEntityCompletionItemInfo = class {
|
|
4579
4723
|
getCompletionItemKind() {
|
4580
4724
|
switch (this.entity.subkind) {
|
4581
4725
|
case "package":
|
4582
|
-
return
|
4726
|
+
return 7 /* PackageVariable */;
|
4583
4727
|
case "type":
|
4584
4728
|
return 2 /* TypeVariable */;
|
4585
4729
|
case "parameter":
|
4586
|
-
return
|
4730
|
+
return 10 /* ParameterVariable */;
|
4587
4731
|
case "local":
|
4588
|
-
return
|
4732
|
+
return 9 /* LocalVariable */;
|
4589
4733
|
default:
|
4590
4734
|
Debug.never(this.entity);
|
4591
4735
|
}
|
@@ -4601,6 +4745,9 @@ var VariableEntityCompletionItemInfo = class {
|
|
4601
4745
|
getSortText() {
|
4602
4746
|
return void 0;
|
4603
4747
|
}
|
4748
|
+
getEditRange() {
|
4749
|
+
return void 0;
|
4750
|
+
}
|
4604
4751
|
};
|
4605
4752
|
var MethodEntityCompletionItemInfo = class {
|
4606
4753
|
constructor(ctx, entity, name, isNameExplicitlyOriginal) {
|
@@ -4616,11 +4763,11 @@ var MethodEntityCompletionItemInfo = class {
|
|
4616
4763
|
getCompletionItemKind() {
|
4617
4764
|
switch (this.entity.subkind) {
|
4618
4765
|
case "package":
|
4619
|
-
return
|
4766
|
+
return 8 /* PackageMethod */;
|
4620
4767
|
case "type":
|
4621
4768
|
return 3 /* TypeMethod */;
|
4622
4769
|
case "nested":
|
4623
|
-
return
|
4770
|
+
return 11 /* NestedMethod */;
|
4624
4771
|
default:
|
4625
4772
|
Debug.never(this.entity);
|
4626
4773
|
}
|
@@ -4636,6 +4783,9 @@ var MethodEntityCompletionItemInfo = class {
|
|
4636
4783
|
getSortText() {
|
4637
4784
|
return void 0;
|
4638
4785
|
}
|
4786
|
+
getEditRange() {
|
4787
|
+
return void 0;
|
4788
|
+
}
|
4639
4789
|
};
|
4640
4790
|
var NamedTypeCompletionItemInfo = class {
|
4641
4791
|
constructor(ctx, entity, name, isNameExplicitlyOriginal, prefix = "", sortText) {
|
@@ -4653,23 +4803,23 @@ var NamedTypeCompletionItemInfo = class {
|
|
4653
4803
|
getCompletionItemKind() {
|
4654
4804
|
switch (this.entity.kind) {
|
4655
4805
|
case 2 /* VariantType */:
|
4656
|
-
return
|
4806
|
+
return 16 /* VariantType */;
|
4657
4807
|
case 6 /* TypeParameter */:
|
4658
|
-
return
|
4808
|
+
return 17 /* TypeParameter */;
|
4659
4809
|
case 11 /* MethodType */:
|
4660
|
-
return
|
4810
|
+
return 18 /* MethodType */;
|
4661
4811
|
case 12 /* StructuredType */:
|
4662
4812
|
if (this.entity.isRefObject()) {
|
4663
|
-
return
|
4813
|
+
return 13 /* RefObjectType */;
|
4664
4814
|
} else if (this.entity.isPlainObject()) {
|
4665
|
-
return
|
4815
|
+
return 14 /* PlainObjectType */;
|
4666
4816
|
} else if (this.entity.isAspect()) {
|
4667
|
-
return
|
4817
|
+
return 15 /* AspectType */;
|
4668
4818
|
} else {
|
4669
|
-
return
|
4819
|
+
return 20 /* InvalidType */;
|
4670
4820
|
}
|
4671
4821
|
case 14 /* AliasType */:
|
4672
|
-
return
|
4822
|
+
return 19 /* AliasType */;
|
4673
4823
|
default:
|
4674
4824
|
Debug.never(this.entity);
|
4675
4825
|
}
|
@@ -4683,6 +4833,9 @@ var NamedTypeCompletionItemInfo = class {
|
|
4683
4833
|
getSortText() {
|
4684
4834
|
return this.sortText;
|
4685
4835
|
}
|
4836
|
+
getEditRange() {
|
4837
|
+
return void 0;
|
4838
|
+
}
|
4686
4839
|
};
|
4687
4840
|
var KeywordCompletionItemInfo = class {
|
4688
4841
|
constructor(ctx, keywordKind, value) {
|
@@ -4695,7 +4848,7 @@ var KeywordCompletionItemInfo = class {
|
|
4695
4848
|
return this.value;
|
4696
4849
|
}
|
4697
4850
|
getCompletionItemKind() {
|
4698
|
-
return
|
4851
|
+
return 21 /* Keyword */;
|
4699
4852
|
}
|
4700
4853
|
getDetails() {
|
4701
4854
|
return void 0;
|
@@ -4706,6 +4859,9 @@ var KeywordCompletionItemInfo = class {
|
|
4706
4859
|
getSortText() {
|
4707
4860
|
return void 0;
|
4708
4861
|
}
|
4862
|
+
getEditRange() {
|
4863
|
+
return void 0;
|
4864
|
+
}
|
4709
4865
|
};
|
4710
4866
|
var MergedOverloadedMethodCompletionItemInfo = class {
|
4711
4867
|
constructor(ctx, firstOverloadInfo, overloadCount) {
|
@@ -4732,6 +4888,9 @@ var MergedOverloadedMethodCompletionItemInfo = class {
|
|
4732
4888
|
getSortText() {
|
4733
4889
|
return void 0;
|
4734
4890
|
}
|
4891
|
+
getEditRange() {
|
4892
|
+
return void 0;
|
4893
|
+
}
|
4735
4894
|
};
|
4736
4895
|
var TargetSignatureValueParameterCompletionItemInfo = class {
|
4737
4896
|
constructor(ctx, parameter) {
|
@@ -4743,7 +4902,7 @@ var TargetSignatureValueParameterCompletionItemInfo = class {
|
|
4743
4902
|
return `${this.ctx.getInsertTextForName(this.parameter.getName())} =`;
|
4744
4903
|
}
|
4745
4904
|
getCompletionItemKind() {
|
4746
|
-
return
|
4905
|
+
return 22 /* TargetSignatureParameter */;
|
4747
4906
|
}
|
4748
4907
|
getDetails() {
|
4749
4908
|
return this.ctx.displayService.displayValueParameterDeclaration(
|
@@ -4760,6 +4919,9 @@ var TargetSignatureValueParameterCompletionItemInfo = class {
|
|
4760
4919
|
getSortText() {
|
4761
4920
|
return void 0;
|
4762
4921
|
}
|
4922
|
+
getEditRange() {
|
4923
|
+
return void 0;
|
4924
|
+
}
|
4763
4925
|
};
|
4764
4926
|
var AliasesSourceVariableCompletionItemInfo = class {
|
4765
4927
|
constructor(ctx, variable, displayService) {
|
@@ -4774,13 +4936,13 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
4774
4936
|
getCompletionItemKind() {
|
4775
4937
|
switch (this.variable.subkind) {
|
4776
4938
|
case "package":
|
4777
|
-
return
|
4939
|
+
return 7 /* PackageVariable */;
|
4778
4940
|
case "type":
|
4779
4941
|
return 2 /* TypeVariable */;
|
4780
4942
|
case "parameter":
|
4781
|
-
return
|
4943
|
+
return 7 /* PackageVariable */;
|
4782
4944
|
case "local":
|
4783
|
-
return
|
4945
|
+
return 9 /* LocalVariable */;
|
4784
4946
|
default:
|
4785
4947
|
Debug.never(this.variable);
|
4786
4948
|
}
|
@@ -4796,6 +4958,9 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
4796
4958
|
getSortText() {
|
4797
4959
|
return void 0;
|
4798
4960
|
}
|
4961
|
+
getEditRange() {
|
4962
|
+
return void 0;
|
4963
|
+
}
|
4799
4964
|
};
|
4800
4965
|
var AliasesSourceMethodCompletionItemInfo = class {
|
4801
4966
|
constructor(ctx, method, includeMethodKeyword, displayService) {
|
@@ -4811,11 +4976,11 @@ var AliasesSourceMethodCompletionItemInfo = class {
|
|
4811
4976
|
getCompletionItemKind() {
|
4812
4977
|
switch (this.method.subkind) {
|
4813
4978
|
case "package":
|
4814
|
-
return
|
4979
|
+
return 8 /* PackageMethod */;
|
4815
4980
|
case "type":
|
4816
4981
|
return 3 /* TypeMethod */;
|
4817
4982
|
case "nested":
|
4818
|
-
return
|
4983
|
+
return 11 /* NestedMethod */;
|
4819
4984
|
default:
|
4820
4985
|
Debug.never(this.method);
|
4821
4986
|
}
|
@@ -4836,6 +5001,9 @@ var AliasesSourceMethodCompletionItemInfo = class {
|
|
4836
5001
|
getSortText() {
|
4837
5002
|
return void 0;
|
4838
5003
|
}
|
5004
|
+
getEditRange() {
|
5005
|
+
return void 0;
|
5006
|
+
}
|
4839
5007
|
};
|
4840
5008
|
var AliasesSourcePackageTypeCompletionItemInfo = class {
|
4841
5009
|
constructor(ctx, typeEntity, includeTypeKeyword, displayService) {
|
@@ -4851,21 +5019,21 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
4851
5019
|
getCompletionItemKind() {
|
4852
5020
|
switch (this.typeEntity.kind) {
|
4853
5021
|
case 2 /* VariantType */:
|
4854
|
-
return
|
5022
|
+
return 16 /* VariantType */;
|
4855
5023
|
case 11 /* MethodType */:
|
4856
|
-
return
|
5024
|
+
return 18 /* MethodType */;
|
4857
5025
|
case 12 /* StructuredType */: {
|
4858
5026
|
if (this.typeEntity.isRefObject()) {
|
4859
|
-
return
|
5027
|
+
return 13 /* RefObjectType */;
|
4860
5028
|
} else if (this.typeEntity.isPlainObject()) {
|
4861
|
-
return
|
5029
|
+
return 14 /* PlainObjectType */;
|
4862
5030
|
} else if (this.typeEntity.isAspect()) {
|
4863
|
-
return
|
5031
|
+
return 15 /* AspectType */;
|
4864
5032
|
}
|
4865
|
-
return
|
5033
|
+
return 20 /* InvalidType */;
|
4866
5034
|
}
|
4867
5035
|
case 14 /* AliasType */:
|
4868
|
-
return
|
5036
|
+
return 19 /* AliasType */;
|
4869
5037
|
}
|
4870
5038
|
}
|
4871
5039
|
getDetails() {
|
@@ -4904,6 +5072,9 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
4904
5072
|
Debug.never(this.typeEntity);
|
4905
5073
|
}
|
4906
5074
|
}
|
5075
|
+
getEditRange() {
|
5076
|
+
return void 0;
|
5077
|
+
}
|
4907
5078
|
};
|
4908
5079
|
var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
4909
5080
|
constructor(ctx, indexer, displayService) {
|
@@ -4924,7 +5095,7 @@ var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
|
4924
5095
|
return this.label;
|
4925
5096
|
}
|
4926
5097
|
getCompletionItemKind() {
|
4927
|
-
return
|
5098
|
+
return 5 /* TypeIndexer */;
|
4928
5099
|
}
|
4929
5100
|
getDetails() {
|
4930
5101
|
return this.label;
|
@@ -4936,6 +5107,9 @@ var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
|
4936
5107
|
getSortText() {
|
4937
5108
|
return void 0;
|
4938
5109
|
}
|
5110
|
+
getEditRange() {
|
5111
|
+
return void 0;
|
5112
|
+
}
|
4939
5113
|
};
|
4940
5114
|
var AliasesSourceTypeConstructorCompletionItemInfo = class {
|
4941
5115
|
constructor(ctx, constructor_, includeOnCreateKeyword, displayService) {
|
@@ -4961,7 +5135,7 @@ var AliasesSourceTypeConstructorCompletionItemInfo = class {
|
|
4961
5135
|
return this.label;
|
4962
5136
|
}
|
4963
5137
|
getCompletionItemKind() {
|
4964
|
-
return
|
5138
|
+
return 6 /* TypeConstructor */;
|
4965
5139
|
}
|
4966
5140
|
getDetails() {
|
4967
5141
|
return this.label;
|
@@ -4974,11 +5148,41 @@ var AliasesSourceTypeConstructorCompletionItemInfo = class {
|
|
4974
5148
|
getSortText() {
|
4975
5149
|
return void 0;
|
4976
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
|
+
}
|
4977
5180
|
};
|
4978
5181
|
var SyntaxContext = class {
|
4979
|
-
constructor(isInComment, isInStringOrChar, isPackageMemberDeclarationListContext, isTypeMemberDeclarationListContext, isStatementContext, isExpressionContext, precedingExpression, isUnqualifiedTypeContext, isTopLevelTranslationListContext, isTypeMemberTranslationListContext) {
|
5182
|
+
constructor(isInComment, isInStringOrChar, isInQuotedIdentifier, isPackageMemberDeclarationListContext, isTypeMemberDeclarationListContext, isStatementContext, isExpressionContext, precedingExpression, isUnqualifiedTypeContext, isTopLevelTranslationListContext, isTypeMemberTranslationListContext) {
|
4980
5183
|
this.isInComment = isInComment;
|
4981
5184
|
this.isInStringOrChar = isInStringOrChar;
|
5185
|
+
this.isInQuotedIdentifier = isInQuotedIdentifier;
|
4982
5186
|
this.isPackageMemberDeclarationListContext = isPackageMemberDeclarationListContext;
|
4983
5187
|
this.isTypeMemberDeclarationListContext = isTypeMemberDeclarationListContext;
|
4984
5188
|
this.isStatementContext = isStatementContext;
|
@@ -5031,6 +5235,7 @@ var SyntaxContextFactory = class {
|
|
5031
5235
|
static fromPositionDescription(sourceFile, positionDescription) {
|
5032
5236
|
const isInComment = this.isInComment(sourceFile, positionDescription.getOffset());
|
5033
5237
|
const isInStringOrChar = this.isInStringOrChar(sourceFile, positionDescription.getOffset());
|
5238
|
+
const isInQuotedIdentifier = this.isInQuotedIdentifier(sourceFile, positionDescription.getOffset());
|
5034
5239
|
let isPackageMemberDeclarationListContext = false;
|
5035
5240
|
if (positionDescription.kind === "at-file-start") {
|
5036
5241
|
isPackageMemberDeclarationListContext = true;
|
@@ -5067,6 +5272,7 @@ var SyntaxContextFactory = class {
|
|
5067
5272
|
return new SyntaxContext(
|
5068
5273
|
isInComment,
|
5069
5274
|
isInStringOrChar,
|
5275
|
+
isInQuotedIdentifier,
|
5070
5276
|
isPackageMemberDeclarationListContext,
|
5071
5277
|
isTypeMemberDeclarationListContext,
|
5072
5278
|
isStatementContext,
|
@@ -5079,11 +5285,11 @@ var SyntaxContextFactory = class {
|
|
5079
5285
|
}
|
5080
5286
|
static isExpressionOrStatementContext(tokenOrKeyword) {
|
5081
5287
|
if (tokenOrKeyword.isToken(57 /* Equals */)) {
|
5082
|
-
if (tokenOrKeyword.parent.kind ===
|
5288
|
+
if (tokenOrKeyword.parent.kind === 93 /* AssignmentStatement */) {
|
5083
5289
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5084
5290
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5085
5291
|
}
|
5086
|
-
if (tokenOrKeyword.parent.kind ===
|
5292
|
+
if (tokenOrKeyword.parent.kind === 59 /* LocalVariableDeclaration */) {
|
5087
5293
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5088
5294
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5089
5295
|
}
|
@@ -5091,40 +5297,40 @@ var SyntaxContextFactory = class {
|
|
5091
5297
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5092
5298
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5093
5299
|
}
|
5094
|
-
if (tokenOrKeyword.parent.kind ===
|
5300
|
+
if (tokenOrKeyword.parent.kind === 54 /* TypeVariableDeclaration */) {
|
5095
5301
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5096
5302
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5097
5303
|
}
|
5098
|
-
if (tokenOrKeyword.parent.kind ===
|
5304
|
+
if (tokenOrKeyword.parent.kind === 143 /* ParameterDeclaration */) {
|
5099
5305
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.defaultValue);
|
5100
5306
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5101
5307
|
}
|
5102
|
-
if (tokenOrKeyword.parent.kind ===
|
5308
|
+
if (tokenOrKeyword.parent.kind === 144 /* CallArgument */) {
|
5103
5309
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5104
5310
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5105
5311
|
}
|
5106
|
-
if (tokenOrKeyword.parent.kind ===
|
5312
|
+
if (tokenOrKeyword.parent.kind === 141 /* VariantDeclaration */) {
|
5107
5313
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5108
5314
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5109
5315
|
}
|
5110
5316
|
}
|
5111
|
-
if (tokenOrKeyword.parent.kind ===
|
5317
|
+
if (tokenOrKeyword.parent.kind === 93 /* AssignmentStatement */) {
|
5112
5318
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5113
5319
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5114
5320
|
}
|
5115
|
-
if (tokenOrKeyword.parent.kind ===
|
5321
|
+
if (tokenOrKeyword.parent.kind === 79 /* PrefixUnaryExpression */) {
|
5116
5322
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.operand);
|
5117
5323
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5118
5324
|
}
|
5119
|
-
if (tokenOrKeyword.parent.kind ===
|
5325
|
+
if (tokenOrKeyword.parent.kind === 66 /* BinaryExpression */) {
|
5120
5326
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5121
5327
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5122
5328
|
}
|
5123
|
-
if (tokenOrKeyword.isToken(7 /* TextTemplateHead */) && tokenOrKeyword.parent.kind ===
|
5329
|
+
if (tokenOrKeyword.isToken(7 /* TextTemplateHead */) && tokenOrKeyword.parent.kind === 83 /* TextTemplateLiteral */) {
|
5124
5330
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.spanList.spans.at(0)?.expression);
|
5125
5331
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5126
5332
|
}
|
5127
|
-
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind ===
|
5333
|
+
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind === 85 /* TextTemplateSpan */) {
|
5128
5334
|
let expressionForTargetType;
|
5129
5335
|
const spanList = tokenOrKeyword.parent.parent;
|
5130
5336
|
const spanIndex = spanList.spans.indexOf(tokenOrKeyword.parent);
|
@@ -5136,34 +5342,34 @@ var SyntaxContextFactory = class {
|
|
5136
5342
|
isStatementContext: false
|
5137
5343
|
};
|
5138
5344
|
}
|
5139
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5345
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* StatementBlock */) {
|
5140
5346
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5141
5347
|
}
|
5142
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5348
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 94 /* StatementList */) {
|
5143
5349
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5144
5350
|
}
|
5145
5351
|
if (tokenOrKeyword.isToken(44 /* OpenParenthesis */)) {
|
5146
|
-
if (tokenOrKeyword.parent.kind ===
|
5352
|
+
if (tokenOrKeyword.parent.kind === 77 /* ParenthesizedExpression */) {
|
5147
5353
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5148
5354
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5149
5355
|
}
|
5150
|
-
if (tokenOrKeyword.parent.kind ===
|
5356
|
+
if (tokenOrKeyword.parent.kind === 75 /* NotExpression */) {
|
5151
5357
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5152
5358
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5153
5359
|
}
|
5154
|
-
if (tokenOrKeyword.parent.kind ===
|
5360
|
+
if (tokenOrKeyword.parent.kind === 81 /* ReferenceExpression */) {
|
5155
5361
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5156
5362
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5157
5363
|
}
|
5158
|
-
if (tokenOrKeyword.parent.kind ===
|
5364
|
+
if (tokenOrKeyword.parent.kind === 69 /* CallExpression */) {
|
5159
5365
|
const expressionRole = new ExpressionRole_callArgument(tokenOrKeyword.parent.callArgumentList, 0);
|
5160
5366
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5161
5367
|
}
|
5162
|
-
if (tokenOrKeyword.parent.kind ===
|
5368
|
+
if (tokenOrKeyword.parent.kind === 70 /* AutotypeCallExpression */) {
|
5163
5369
|
const expressionRole = new ExpressionRole_callArgument(tokenOrKeyword.parent.callArgumentList, 0);
|
5164
5370
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5165
5371
|
}
|
5166
|
-
if (tokenOrKeyword.parent.kind ===
|
5372
|
+
if (tokenOrKeyword.parent.kind === 146 /* Tag */) {
|
5167
5373
|
const callArgumentList = tokenOrKeyword.parent.callArgumentList;
|
5168
5374
|
if (callArgumentList !== void 0) {
|
5169
5375
|
const expressionRole = new ExpressionRole_callArgument(callArgumentList, 0);
|
@@ -5171,16 +5377,16 @@ var SyntaxContextFactory = class {
|
|
5171
5377
|
}
|
5172
5378
|
}
|
5173
5379
|
}
|
5174
|
-
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind ===
|
5380
|
+
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 72 /* IndexedAccessExpression */) {
|
5175
5381
|
const expressionRole = new ExpressionRole_indexedAccessArgument(tokenOrKeyword.parent.argumentsList, 0);
|
5176
5382
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5177
5383
|
}
|
5178
|
-
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind ===
|
5384
|
+
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 61 /* ArrayLiteral */) {
|
5179
5385
|
const expressionRole = new ExpressionRole_arrayElement(tokenOrKeyword.parent);
|
5180
5386
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5181
5387
|
}
|
5182
5388
|
if (tokenOrKeyword.isToken(24 /* Comma */)) {
|
5183
|
-
if (tokenOrKeyword.parent.kind ===
|
5389
|
+
if (tokenOrKeyword.parent.kind === 68 /* CallArgumentList */) {
|
5184
5390
|
const argumentList = tokenOrKeyword.parent;
|
5185
5391
|
let index = 0;
|
5186
5392
|
for (const element of argumentList.elements) {
|
@@ -5194,7 +5400,7 @@ var SyntaxContextFactory = class {
|
|
5194
5400
|
const expressionRole = new ExpressionRole_callArgument(argumentList, index);
|
5195
5401
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5196
5402
|
}
|
5197
|
-
if (tokenOrKeyword.parent.kind ===
|
5403
|
+
if (tokenOrKeyword.parent.kind === 71 /* IndexedAccessArgumentList */) {
|
5198
5404
|
const argumentList = tokenOrKeyword.parent;
|
5199
5405
|
let index = 0;
|
5200
5406
|
for (const element of argumentList.elements) {
|
@@ -5208,56 +5414,56 @@ var SyntaxContextFactory = class {
|
|
5208
5414
|
const expressionRole = new ExpressionRole_indexedAccessArgument(argumentList, index);
|
5209
5415
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5210
5416
|
}
|
5211
|
-
if (tokenOrKeyword.parent.kind ===
|
5417
|
+
if (tokenOrKeyword.parent.kind === 119 /* MatchExpressionList */) {
|
5212
5418
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent.parent);
|
5213
5419
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5214
5420
|
}
|
5215
|
-
if (tokenOrKeyword.parent.kind ===
|
5421
|
+
if (tokenOrKeyword.parent.kind === 62 /* ArrayLiteralElementList */) {
|
5216
5422
|
const expressionRole = new ExpressionRole_arrayElement(tokenOrKeyword.parent.parent);
|
5217
5423
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5218
5424
|
}
|
5219
5425
|
}
|
5220
|
-
if (tokenOrKeyword.isKeyword(43 /* Case */) && tokenOrKeyword.parent.kind ===
|
5426
|
+
if (tokenOrKeyword.isKeyword(43 /* Case */) && tokenOrKeyword.parent.kind === 120 /* SwitchStatementCaseClause */) {
|
5221
5427
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent);
|
5222
5428
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5223
5429
|
}
|
5224
|
-
if (tokenOrKeyword.isKeyword(14 /* Return */) && tokenOrKeyword.parent.kind ===
|
5430
|
+
if (tokenOrKeyword.isKeyword(14 /* Return */) && tokenOrKeyword.parent.kind === 116 /* ReturnStatement */) {
|
5225
5431
|
const expressionRole = new ExpressionRole_returnedValue(tokenOrKeyword.parent);
|
5226
5432
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5227
5433
|
}
|
5228
|
-
if (tokenOrKeyword.isKeyword(42 /* Switch */) && tokenOrKeyword.parent.kind ===
|
5434
|
+
if (tokenOrKeyword.isKeyword(42 /* Switch */) && tokenOrKeyword.parent.kind === 118 /* SwitchStatement */) {
|
5229
5435
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5230
5436
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5231
5437
|
}
|
5232
|
-
if (tokenOrKeyword.isKeyword(12 /* If */) && tokenOrKeyword.parent.kind ===
|
5438
|
+
if (tokenOrKeyword.isKeyword(12 /* If */) && tokenOrKeyword.parent.kind === 109 /* IfStatement */) {
|
5233
5439
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5234
5440
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5235
5441
|
}
|
5236
|
-
if (tokenOrKeyword.isKeyword(10 /* ElseIf */) && tokenOrKeyword.parent.kind ===
|
5442
|
+
if (tokenOrKeyword.isKeyword(10 /* ElseIf */) && tokenOrKeyword.parent.kind === 111 /* ElseIfClause */) {
|
5237
5443
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5238
5444
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5239
5445
|
}
|
5240
|
-
if (tokenOrKeyword.isKeyword(8 /* From */) && tokenOrKeyword.parent.kind ===
|
5446
|
+
if (tokenOrKeyword.isKeyword(8 /* From */) && tokenOrKeyword.parent.kind === 108 /* ForStatement */) {
|
5241
5447
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.enumeratedExpression);
|
5242
5448
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5243
5449
|
}
|
5244
|
-
if (tokenOrKeyword.isKeyword(23 /* While */) && tokenOrKeyword.parent.kind ===
|
5450
|
+
if (tokenOrKeyword.isKeyword(23 /* While */) && tokenOrKeyword.parent.kind === 121 /* WhileStatement */) {
|
5245
5451
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5246
5452
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5247
5453
|
}
|
5248
|
-
if (tokenOrKeyword.isKeyword(25 /* RepeatWhile */) && tokenOrKeyword.parent.kind ===
|
5454
|
+
if (tokenOrKeyword.isKeyword(25 /* RepeatWhile */) && tokenOrKeyword.parent.kind === 115 /* LoopStatement */) {
|
5249
5455
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5250
5456
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5251
5457
|
}
|
5252
|
-
if (tokenOrKeyword.isKeyword(26 /* Yield */) && tokenOrKeyword.parent.kind ===
|
5458
|
+
if (tokenOrKeyword.isKeyword(26 /* Yield */) && tokenOrKeyword.parent.kind === 122 /* YieldStatement */) {
|
5253
5459
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5254
5460
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5255
5461
|
}
|
5256
|
-
if (tokenOrKeyword.isKeyword(27 /* When */) && tokenOrKeyword.parent.kind ===
|
5462
|
+
if (tokenOrKeyword.isKeyword(27 /* When */) && tokenOrKeyword.parent.kind === 78 /* WhenTernaryExpression */) {
|
5257
5463
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5258
5464
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5259
5465
|
}
|
5260
|
-
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind ===
|
5466
|
+
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 78 /* WhenTernaryExpression */) {
|
5261
5467
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.secondExpression);
|
5262
5468
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5263
5469
|
}
|
@@ -5279,7 +5485,7 @@ var SyntaxContextFactory = class {
|
|
5279
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 */)) {
|
5280
5486
|
return true;
|
5281
5487
|
}
|
5282
|
-
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 */))) {
|
5283
5489
|
return true;
|
5284
5490
|
}
|
5285
5491
|
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */) {
|
@@ -5291,10 +5497,10 @@ var SyntaxContextFactory = class {
|
|
5291
5497
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 37 /* PackageVariableSetterDeclaration */)) {
|
5292
5498
|
return true;
|
5293
5499
|
}
|
5294
|
-
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)) {
|
5295
5501
|
return true;
|
5296
5502
|
}
|
5297
|
-
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)) {
|
5298
5504
|
return true;
|
5299
5505
|
}
|
5300
5506
|
return false;
|
@@ -5309,19 +5515,19 @@ var SyntaxContextFactory = class {
|
|
5309
5515
|
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 44 /* TypeMemberGroupDeclaration */) {
|
5310
5516
|
return true;
|
5311
5517
|
}
|
5312
|
-
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(
|
5313
5519
|
tokenOrKeyword,
|
5314
5520
|
50 /* TypeDereferencedVariableGetterDeclaration */
|
5315
5521
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5316
5522
|
tokenOrKeyword,
|
5317
5523
|
51 /* TypeDereferencedVariableSetterDeclaration */
|
5318
|
-
) || 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 */)) {
|
5319
5525
|
return true;
|
5320
5526
|
}
|
5321
|
-
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)) {
|
5322
5528
|
return true;
|
5323
5529
|
}
|
5324
|
-
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)) {
|
5325
5531
|
return true;
|
5326
5532
|
}
|
5327
5533
|
return false;
|
@@ -5346,8 +5552,19 @@ var SyntaxContextFactory = class {
|
|
5346
5552
|
}
|
5347
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 */);
|
5348
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
|
+
}
|
5349
5566
|
static isUnqualifiedTypeContext(tokenOrKeyword) {
|
5350
|
-
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind ===
|
5567
|
+
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 157 /* TypeAnnotation */) {
|
5351
5568
|
return { allowsAnonymousTypes: true };
|
5352
5569
|
}
|
5353
5570
|
if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind === 34 /* StructuredTypeDeclarationBody */) {
|
@@ -5356,25 +5573,25 @@ var SyntaxContextFactory = class {
|
|
5356
5573
|
if (tokenOrKeyword.isKeyword(15 /* Type */) && (NodeTypeUtils.isPackageTypeDeclaration(tokenOrKeyword.parent) || tokenOrKeyword.parent.kind === 40 /* TypeExtensionDeclaration */)) {
|
5357
5574
|
return { allowsAnonymousTypes: false };
|
5358
5575
|
}
|
5359
|
-
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind ===
|
5576
|
+
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind === 153 /* TypeArgumentClause */) {
|
5360
5577
|
return { allowsAnonymousTypes: true };
|
5361
5578
|
}
|
5362
|
-
if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind ===
|
5363
|
-
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 */ };
|
5364
5581
|
}
|
5365
|
-
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind ===
|
5582
|
+
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind === 146 /* Tag */) {
|
5366
5583
|
return { allowsAnonymousTypes: false };
|
5367
5584
|
}
|
5368
|
-
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 */) {
|
5369
5586
|
return { allowsAnonymousTypes: false };
|
5370
5587
|
}
|
5371
5588
|
if (tokenOrKeyword.isToken(57 /* Equals */) && tokenOrKeyword.parent.kind === 22 /* PackageAliasTypeDeclaration */) {
|
5372
5589
|
return { allowsAnonymousTypes: false };
|
5373
5590
|
}
|
5374
|
-
if (tokenOrKeyword.isKeyword(13 /* Is */) && tokenOrKeyword.parent.kind ===
|
5591
|
+
if (tokenOrKeyword.isKeyword(13 /* Is */) && tokenOrKeyword.parent.kind === 74 /* IsExpression */) {
|
5375
5592
|
return { allowsAnonymousTypes: true };
|
5376
5593
|
}
|
5377
|
-
if (tokenOrKeyword.isKeyword(40 /* As */) && tokenOrKeyword.parent.kind ===
|
5594
|
+
if (tokenOrKeyword.isKeyword(40 /* As */) && tokenOrKeyword.parent.kind === 65 /* AsExpression */) {
|
5378
5595
|
return { allowsAnonymousTypes: true };
|
5379
5596
|
}
|
5380
5597
|
if (tokenOrKeyword.isToken(17 /* Bar */) && tokenOrKeyword.parent.kind === 12 /* UnionTypeSpecifierTypeList */) {
|
@@ -5391,32 +5608,32 @@ var SyntaxContextFactory = class {
|
|
5391
5608
|
}
|
5392
5609
|
const packageImport = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5393
5610
|
tokenOrKeyword,
|
5394
|
-
|
5611
|
+
133 /* PackageImportTranslation */
|
5395
5612
|
);
|
5396
5613
|
if (packageImport !== void 0) {
|
5397
5614
|
return { translationsDeclaration: packageImport.parent.parent };
|
5398
5615
|
}
|
5399
|
-
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5616
|
+
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 138 /* TypeTranslation */);
|
5400
5617
|
if (type !== void 0) {
|
5401
5618
|
return { translationsDeclaration: type.parent.parent };
|
5402
5619
|
}
|
5403
5620
|
const methodType = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5404
5621
|
tokenOrKeyword,
|
5405
|
-
|
5622
|
+
132 /* MethodTypeTranslation */
|
5406
5623
|
);
|
5407
5624
|
if (methodType !== void 0) {
|
5408
5625
|
return { translationsDeclaration: methodType.parent.parent };
|
5409
5626
|
}
|
5410
5627
|
const variable = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5411
5628
|
tokenOrKeyword,
|
5412
|
-
|
5629
|
+
135 /* PackageVariableTranslation */
|
5413
5630
|
);
|
5414
5631
|
if (variable !== void 0) {
|
5415
5632
|
return { translationsDeclaration: variable.parent.parent };
|
5416
5633
|
}
|
5417
5634
|
const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5418
5635
|
tokenOrKeyword,
|
5419
|
-
|
5636
|
+
130 /* PackageMethodTranslation */
|
5420
5637
|
);
|
5421
5638
|
if (method !== void 0) {
|
5422
5639
|
return { translationsDeclaration: method.parent.parent };
|
@@ -5424,33 +5641,33 @@ var SyntaxContextFactory = class {
|
|
5424
5641
|
return void 0;
|
5425
5642
|
}
|
5426
5643
|
static isTypeMemberTranslationListContext(tokenOrKeyword) {
|
5427
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5644
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 137 /* TypeMemberTranslationList */) {
|
5428
5645
|
return { typeTranslation: tokenOrKeyword.parent.parent };
|
5429
5646
|
}
|
5430
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5647
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 138 /* TypeTranslation */) {
|
5431
5648
|
return { typeTranslation: tokenOrKeyword.parent };
|
5432
5649
|
}
|
5433
|
-
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5650
|
+
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 127 /* IndexerTranslation */);
|
5434
5651
|
if (indexer !== void 0) {
|
5435
5652
|
return { typeTranslation: indexer.parent.parent };
|
5436
5653
|
}
|
5437
5654
|
const constructor = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5438
5655
|
tokenOrKeyword,
|
5439
|
-
|
5656
|
+
125 /* ConstructorTranslation */
|
5440
5657
|
);
|
5441
5658
|
if (constructor !== void 0) {
|
5442
5659
|
return { typeTranslation: constructor.parent.parent };
|
5443
5660
|
}
|
5444
5661
|
const variableOrVariant = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5445
5662
|
tokenOrKeyword,
|
5446
|
-
|
5663
|
+
136 /* TypeVariableOrVariantTranslation */
|
5447
5664
|
);
|
5448
5665
|
if (variableOrVariant !== void 0) {
|
5449
5666
|
return { typeTranslation: variableOrVariant.parent.parent };
|
5450
5667
|
}
|
5451
5668
|
const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5452
5669
|
tokenOrKeyword,
|
5453
|
-
|
5670
|
+
131 /* TypeMethodTranslation */
|
5454
5671
|
);
|
5455
5672
|
if (method !== void 0) {
|
5456
5673
|
return { typeTranslation: method.parent.parent };
|
@@ -5543,13 +5760,13 @@ var CompletionItemInfoCache = class {
|
|
5543
5760
|
constructor() {
|
5544
5761
|
this._id = 0;
|
5545
5762
|
}
|
5546
|
-
add(list) {
|
5547
|
-
this._entry = {
|
5548
|
-
return this._entry
|
5763
|
+
add(list, sourceFile) {
|
5764
|
+
this._entry = { id: this.getNextId(), items: list, sourceFile };
|
5765
|
+
return this._entry;
|
5549
5766
|
}
|
5550
5767
|
get(id) {
|
5551
|
-
if (id === this._entry?.
|
5552
|
-
return this._entry
|
5768
|
+
if (id === this._entry?.id) {
|
5769
|
+
return this._entry;
|
5553
5770
|
}
|
5554
5771
|
return void 0;
|
5555
5772
|
}
|
@@ -5563,31 +5780,31 @@ var NodeSemanticInfoService = class {
|
|
5563
5780
|
static ofTokenOrKeyword(analyzer, tokenOrKeyword, options6) {
|
5564
5781
|
if (isIdentifier(tokenOrKeyword.value)) {
|
5565
5782
|
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options6);
|
5566
|
-
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind ===
|
5783
|
+
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind === 70 /* AutotypeCallExpression */) {
|
5567
5784
|
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent, options6);
|
5568
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5785
|
+
} else if (tokenOrKeyword.parent.kind === 79 /* PrefixUnaryExpression */) {
|
5569
5786
|
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5570
|
-
} else if (tokenOrKeyword.isKeyword(41 /* Not */) && tokenOrKeyword.parent.kind ===
|
5787
|
+
} else if (tokenOrKeyword.isKeyword(41 /* Not */) && tokenOrKeyword.parent.kind === 75 /* NotExpression */) {
|
5571
5788
|
return this.ofNotExpressionNotKeyword(analyzer, tokenOrKeyword.parent, options6);
|
5572
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5789
|
+
} else if (tokenOrKeyword.parent.kind === 66 /* BinaryExpression */) {
|
5573
5790
|
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5574
5791
|
} else if (tokenOrKeyword.isToken(19 /* Caret */) && (tokenOrKeyword.parent.kind === 50 /* TypeDereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 51 /* TypeDereferencedVariableSetterDeclaration */)) {
|
5575
5792
|
return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
|
5576
|
-
} else if (tokenOrKeyword.isToken(19 /* Caret */) && tokenOrKeyword.parent.kind ===
|
5793
|
+
} else if (tokenOrKeyword.isToken(19 /* Caret */) && tokenOrKeyword.parent.kind === 82 /* DereferenceExpression */) {
|
5577
5794
|
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5578
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5795
|
+
} else if (tokenOrKeyword.parent.kind === 93 /* AssignmentStatement */) {
|
5579
5796
|
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options6);
|
5580
5797
|
} else if (tokenOrKeyword.isKeyword(28 /* Creation */) && tokenOrKeyword.parent.kind === 45 /* TypeConstructorDeclaration */) {
|
5581
5798
|
return this.ofTypeConstructorDeclaration(analyzer, tokenOrKeyword.parent);
|
5582
|
-
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind ===
|
5799
|
+
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind === 92 /* DefaultMatchExpression */) {
|
5583
5800
|
return this.ofDefaultMatchExpression(analyzer, tokenOrKeyword.parent);
|
5584
|
-
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind ===
|
5801
|
+
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 88 /* ObjectExpression */) {
|
5585
5802
|
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options6);
|
5586
|
-
} else if (tokenOrKeyword.isKeyword(55 /* Base */) && tokenOrKeyword.parent.kind ===
|
5803
|
+
} else if (tokenOrKeyword.isKeyword(55 /* Base */) && tokenOrKeyword.parent.kind === 89 /* BaseExpression */) {
|
5587
5804
|
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options6);
|
5588
5805
|
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 49 /* TypeIndexerParameterClause */) {
|
5589
5806
|
return this.ofTypeIndexerDeclaration(analyzer, tokenOrKeyword.parent.parent);
|
5590
|
-
} 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 */) {
|
5591
5808
|
return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5592
5809
|
}
|
5593
5810
|
return void 0;
|
@@ -5600,11 +5817,11 @@ var NodeSemanticInfoService = class {
|
|
5600
5817
|
let result;
|
5601
5818
|
const parent = node.parent;
|
5602
5819
|
switch (parent.kind) {
|
5603
|
-
case
|
5820
|
+
case 128 /* TranslationTypeParameterList */:
|
5604
5821
|
break;
|
5605
|
-
case
|
5822
|
+
case 123 /* TranslationParameterList */:
|
5606
5823
|
break;
|
5607
|
-
case
|
5824
|
+
case 144 /* CallArgument */: {
|
5608
5825
|
const respectiveParameter = analyzer.getRespectiveParameter(parent);
|
5609
5826
|
if (respectiveParameter !== void 0) {
|
5610
5827
|
const target = new SimpleWithLocalization(
|
@@ -5618,10 +5835,10 @@ var NodeSemanticInfoService = class {
|
|
5618
5835
|
}
|
5619
5836
|
break;
|
5620
5837
|
}
|
5621
|
-
case
|
5838
|
+
case 60 /* EnumerationVariableDeclaration */:
|
5622
5839
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofEnumerationVariableDeclaration(parent));
|
5623
5840
|
break;
|
5624
|
-
case
|
5841
|
+
case 102 /* ErrorVariableDeclaration */:
|
5625
5842
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofErrorVariableDeclaration(parent));
|
5626
5843
|
break;
|
5627
5844
|
case 22 /* PackageAliasTypeDeclaration */:
|
@@ -5642,19 +5859,19 @@ var NodeSemanticInfoService = class {
|
|
5642
5859
|
case 38 /* PackageVariantTypeDeclaration */:
|
5643
5860
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageVariantTypeDeclaration(parent));
|
5644
5861
|
break;
|
5645
|
-
case
|
5862
|
+
case 90 /* IdentifierExpression */:
|
5646
5863
|
result = this.ofIdentifierExpression(analyzer, parent, options6);
|
5647
5864
|
break;
|
5648
|
-
case
|
5865
|
+
case 58 /* NestedMethodDeclaration */:
|
5649
5866
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofNestedMethodDeclaration(parent));
|
5650
5867
|
break;
|
5651
|
-
case
|
5868
|
+
case 59 /* LocalVariableDeclaration */:
|
5652
5869
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
|
5653
5870
|
break;
|
5654
|
-
case
|
5871
|
+
case 134 /* QualifiedName */:
|
5655
5872
|
result = this.ofQualifiedNameQualifier(analyzer, parent, node, options6);
|
5656
5873
|
break;
|
5657
|
-
case
|
5874
|
+
case 135 /* PackageVariableTranslation */: {
|
5658
5875
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5659
5876
|
const getTargetResult = translationPackage?.getPackageVariableTranslationTarget(parent);
|
5660
5877
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5674,7 +5891,7 @@ var NodeSemanticInfoService = class {
|
|
5674
5891
|
}
|
5675
5892
|
break;
|
5676
5893
|
}
|
5677
|
-
case
|
5894
|
+
case 136 /* TypeVariableOrVariantTranslation */: {
|
5678
5895
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5679
5896
|
const getTargetsResult = translationPackage?.getTypeVariableOrVariantTranslationTargets(parent);
|
5680
5897
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5698,7 +5915,7 @@ var NodeSemanticInfoService = class {
|
|
5698
5915
|
}
|
5699
5916
|
break;
|
5700
5917
|
}
|
5701
|
-
case
|
5918
|
+
case 130 /* PackageMethodTranslation */: {
|
5702
5919
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5703
5920
|
const getTargetsResult = translationPackage?.getPackageMethodTranslationTargets(parent);
|
5704
5921
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5722,7 +5939,7 @@ var NodeSemanticInfoService = class {
|
|
5722
5939
|
}
|
5723
5940
|
break;
|
5724
5941
|
}
|
5725
|
-
case
|
5942
|
+
case 131 /* TypeMethodTranslation */: {
|
5726
5943
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5727
5944
|
const getTargetsResult = translationPackage?.getTypeMethodTranslationTargets(parent);
|
5728
5945
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5746,7 +5963,7 @@ var NodeSemanticInfoService = class {
|
|
5746
5963
|
}
|
5747
5964
|
break;
|
5748
5965
|
}
|
5749
|
-
case
|
5966
|
+
case 138 /* TypeTranslation */: {
|
5750
5967
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5751
5968
|
const getTargetResult = translationPackage?.getTypeTranslationTarget(parent);
|
5752
5969
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5766,7 +5983,7 @@ var NodeSemanticInfoService = class {
|
|
5766
5983
|
}
|
5767
5984
|
break;
|
5768
5985
|
}
|
5769
|
-
case
|
5986
|
+
case 132 /* MethodTypeTranslation */: {
|
5770
5987
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5771
5988
|
const getTargetResult = translationPackage?.getMethodTypeTranslationTarget(parent);
|
5772
5989
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5786,7 +6003,7 @@ var NodeSemanticInfoService = class {
|
|
5786
6003
|
}
|
5787
6004
|
break;
|
5788
6005
|
}
|
5789
|
-
case
|
6006
|
+
case 143 /* ParameterDeclaration */:
|
5790
6007
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofParameterDeclaration(parent));
|
5791
6008
|
break;
|
5792
6009
|
case 8 /* PackageImport */:
|
@@ -5795,30 +6012,33 @@ var NodeSemanticInfoService = class {
|
|
5795
6012
|
case 9 /* PackagePath */:
|
5796
6013
|
result = void 0;
|
5797
6014
|
break;
|
5798
|
-
case
|
6015
|
+
case 80 /* PropertyAccessExpression */:
|
5799
6016
|
result = this.ofProperty(analyzer, parent, options6);
|
5800
6017
|
break;
|
5801
6018
|
case 52 /* TypeMethodDeclaration */:
|
5802
6019
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeMethodDeclaration(parent));
|
5803
6020
|
break;
|
5804
|
-
case 53 /*
|
6021
|
+
case 53 /* OperatorDeclaration */:
|
6022
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofOperatorDeclaration(parent));
|
6023
|
+
break;
|
6024
|
+
case 54 /* TypeVariableDeclaration */:
|
5805
6025
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeVariableDeclaration(parent));
|
5806
6026
|
break;
|
5807
|
-
case
|
6027
|
+
case 142 /* TypeParameterDeclaration */:
|
5808
6028
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeParameterDeclaration(parent));
|
5809
6029
|
break;
|
5810
|
-
case
|
6030
|
+
case 141 /* VariantDeclaration */:
|
5811
6031
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantDeclaration(parent));
|
5812
6032
|
break;
|
5813
6033
|
case 36 /* PackageVariableGetterDeclaration */:
|
5814
6034
|
case 37 /* PackageVariableSetterDeclaration */:
|
5815
6035
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofComputedPackageVariableDeclaration(parent));
|
5816
6036
|
break;
|
5817
|
-
case
|
5818
|
-
case
|
6037
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
6038
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
5819
6039
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofComputedTypeVariableDeclaration(parent));
|
5820
6040
|
break;
|
5821
|
-
case
|
6041
|
+
case 152 /* SetterParameterDeclaration */:
|
5822
6042
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofSetterParameterDeclaration(parent));
|
5823
6043
|
break;
|
5824
6044
|
case 3 /* Keyword */:
|
@@ -5879,6 +6099,14 @@ var NodeSemanticInfoService = class {
|
|
5879
6099
|
result = createAccessedMethodsReference(meaning.candidates, true);
|
5880
6100
|
}
|
5881
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
|
+
}
|
5882
6110
|
case "package-method-access":
|
5883
6111
|
if (isNonEmptyArray(meaning.suitableMethods)) {
|
5884
6112
|
result = createAccessedMethodsReference(meaning.suitableMethods, meaning.suitableMethods.length > 1);
|
@@ -5909,9 +6137,11 @@ var NodeSemanticInfoService = class {
|
|
5909
6137
|
}
|
5910
6138
|
return result;
|
5911
6139
|
function createAccessedMethodsReference(methods, isAmbiguous) {
|
5912
|
-
const targets = methods.map(
|
5913
|
-
|
5914
|
-
|
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));
|
5915
6145
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
5916
6146
|
}
|
5917
6147
|
}
|
@@ -5962,7 +6192,7 @@ var NodeSemanticInfoService = class {
|
|
5962
6192
|
return result;
|
5963
6193
|
}
|
5964
6194
|
case 42 /* ExtendedTypeClause */:
|
5965
|
-
case
|
6195
|
+
case 133 /* PackageImportTranslation */:
|
5966
6196
|
return void 0;
|
5967
6197
|
default:
|
5968
6198
|
Debug.never(node.parent);
|
@@ -5995,6 +6225,14 @@ var NodeSemanticInfoService = class {
|
|
5995
6225
|
result = createAccessedMethodsReference(meaning.candidates, true);
|
5996
6226
|
}
|
5997
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
|
+
}
|
5998
6236
|
case "variable-access": {
|
5999
6237
|
const variable = meaning.variable;
|
6000
6238
|
if (variable.value.kind === "entity") {
|
@@ -6064,9 +6302,11 @@ var NodeSemanticInfoService = class {
|
|
6064
6302
|
}
|
6065
6303
|
return result;
|
6066
6304
|
function createAccessedMethodsReference(methods, isAmbiguous) {
|
6067
|
-
const targets = methods.map(
|
6068
|
-
|
6069
|
-
|
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));
|
6070
6310
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6071
6311
|
}
|
6072
6312
|
}
|
@@ -6099,7 +6339,7 @@ var NodeSemanticInfoService = class {
|
|
6099
6339
|
const operator = analyzer.resolveCompoundAssignmentStatementOperator(node, operatorKind);
|
6100
6340
|
if (operator.kind === "ok") {
|
6101
6341
|
const target = new SimpleWithLocalization(
|
6102
|
-
new
|
6342
|
+
new OperatorReferenceTarget(operator.value.value),
|
6103
6343
|
operator.value.localization
|
6104
6344
|
);
|
6105
6345
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6117,7 +6357,7 @@ var NodeSemanticInfoService = class {
|
|
6117
6357
|
const operator = analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
|
6118
6358
|
if (operator.kind === "ok") {
|
6119
6359
|
const target = new SimpleWithLocalization(
|
6120
|
-
new
|
6360
|
+
new OperatorReferenceTarget(operator.value.value),
|
6121
6361
|
operator.value.localization
|
6122
6362
|
);
|
6123
6363
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6133,7 +6373,7 @@ var NodeSemanticInfoService = class {
|
|
6133
6373
|
const operator = analyzer.resolveNotExpressionOperator(node);
|
6134
6374
|
if (operator.kind === "ok") {
|
6135
6375
|
const target = new SimpleWithLocalization(
|
6136
|
-
new
|
6376
|
+
new OperatorReferenceTarget(operator.value.value),
|
6137
6377
|
operator.value.localization
|
6138
6378
|
);
|
6139
6379
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6148,7 +6388,7 @@ var NodeSemanticInfoService = class {
|
|
6148
6388
|
const operator = analyzer.resolvePrefixUnaryExpressionOperator(node);
|
6149
6389
|
if (operator.kind === "ok") {
|
6150
6390
|
const target = new SimpleWithLocalization(
|
6151
|
-
new
|
6391
|
+
new OperatorReferenceTarget(operator.value.value),
|
6152
6392
|
operator.value.localization
|
6153
6393
|
);
|
6154
6394
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6260,6 +6500,15 @@ var NodeSemanticInfoService = class {
|
|
6260
6500
|
result = new ReferenceNodeSemanticInfo([target], false);
|
6261
6501
|
break;
|
6262
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
|
+
}
|
6263
6512
|
case "unresolved":
|
6264
6513
|
break;
|
6265
6514
|
default:
|
@@ -6272,7 +6521,7 @@ var NodeSemanticInfoService = class {
|
|
6272
6521
|
}
|
6273
6522
|
static ofPackageNameSegmentAccess(analyzer, packageTreeNode, node) {
|
6274
6523
|
let parent = getParentSkippingParenthesizedExpressions(node);
|
6275
|
-
while (parent.kind ===
|
6524
|
+
while (parent.kind === 80 /* PropertyAccessExpression */) {
|
6276
6525
|
const meaning = analyzer.resolvePropertyAccessExpression(parent).meaning;
|
6277
6526
|
if (meaning.kind === "package-name-segment-access") {
|
6278
6527
|
packageTreeNode = meaning.packageTreeNode;
|
@@ -6311,11 +6560,11 @@ var NodeSemanticInfoService = class {
|
|
6311
6560
|
}
|
6312
6561
|
const parent = getParentSkippingParenthesizedExpressions(typeAccessExpression);
|
6313
6562
|
let parentCallExpression;
|
6314
|
-
if (parent.kind ===
|
6563
|
+
if (parent.kind === 69 /* CallExpression */) {
|
6315
6564
|
parentCallExpression = parent;
|
6316
|
-
} else if (parent.kind ===
|
6565
|
+
} else if (parent.kind === 91 /* GenericSpecializationExpression */) {
|
6317
6566
|
const grandParent = getParentSkippingParenthesizedExpressions(parent);
|
6318
|
-
if (grandParent.kind ===
|
6567
|
+
if (grandParent.kind === 69 /* CallExpression */) {
|
6319
6568
|
parentCallExpression = grandParent;
|
6320
6569
|
}
|
6321
6570
|
}
|
@@ -6444,18 +6693,6 @@ var TypeConstructorReferenceTarget = class {
|
|
6444
6693
|
this.kind = "type-constructor";
|
6445
6694
|
}
|
6446
6695
|
};
|
6447
|
-
var TypeUnaryOperatorReferenceTarget = class {
|
6448
|
-
constructor(operator) {
|
6449
|
-
this.operator = operator;
|
6450
|
-
this.kind = "type-unary-operator";
|
6451
|
-
}
|
6452
|
-
};
|
6453
|
-
var TypeBinaryOperatorReferenceTarget = class {
|
6454
|
-
constructor(operator) {
|
6455
|
-
this.operator = operator;
|
6456
|
-
this.kind = "type-binary-operator";
|
6457
|
-
}
|
6458
|
-
};
|
6459
6696
|
var TypeDereferenceOperatorReferenceTarget = class {
|
6460
6697
|
constructor(operator, accessKind) {
|
6461
6698
|
this.operator = operator;
|
@@ -6469,6 +6706,12 @@ var AccessedMethodReferenceTarget = class {
|
|
6469
6706
|
this.kind = "accessed-method";
|
6470
6707
|
}
|
6471
6708
|
};
|
6709
|
+
var OperatorReferenceTarget = class {
|
6710
|
+
constructor(operator) {
|
6711
|
+
this.operator = operator;
|
6712
|
+
this.kind = "operator";
|
6713
|
+
}
|
6714
|
+
};
|
6472
6715
|
var MatchResultValueParameterReferenceTarget = class {
|
6473
6716
|
constructor(parameter, accessKind) {
|
6474
6717
|
this.parameter = parameter;
|
@@ -6522,7 +6765,7 @@ var SimpleWithLocalization = class {
|
|
6522
6765
|
|
6523
6766
|
// source/services/Utils.ts
|
6524
6767
|
function getEntitySourceLocations(analyzer, entity) {
|
6525
|
-
if (entity.kind ===
|
6768
|
+
if (entity.kind === 16 /* Package */) {
|
6526
6769
|
return void 0;
|
6527
6770
|
}
|
6528
6771
|
let result;
|
@@ -6570,8 +6813,8 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6570
6813
|
case 17 /* AnonymousMethodTypeDeclaration */:
|
6571
6814
|
case 18 /* AnonymousStructuredTypeDeclaration */:
|
6572
6815
|
case 19 /* AnonymousVariantTypeDeclaration */:
|
6573
|
-
case
|
6574
|
-
case
|
6816
|
+
case 67 /* MethodBlockLiteral */:
|
6817
|
+
case 76 /* MethodLiteral */:
|
6575
6818
|
range = node.rangeWithoutTrivia;
|
6576
6819
|
break;
|
6577
6820
|
case 22 /* PackageAliasTypeDeclaration */:
|
@@ -6579,10 +6822,11 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6579
6822
|
case 28 /* PackageMethodTypeDeclaration */:
|
6580
6823
|
case 33 /* PackageStructuredTypeDeclaration */:
|
6581
6824
|
case 38 /* PackageVariantTypeDeclaration */:
|
6582
|
-
case
|
6825
|
+
case 58 /* NestedMethodDeclaration */:
|
6583
6826
|
case 52 /* TypeMethodDeclaration */:
|
6584
|
-
case
|
6585
|
-
case
|
6827
|
+
case 142 /* TypeParameterDeclaration */:
|
6828
|
+
case 141 /* VariantDeclaration */:
|
6829
|
+
case 53 /* OperatorDeclaration */:
|
6586
6830
|
range = node.name.rangeWithoutTrivia;
|
6587
6831
|
break;
|
6588
6832
|
case 45 /* TypeConstructorDeclaration */:
|
@@ -6604,10 +6848,10 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6604
6848
|
case 37 /* PackageVariableSetterDeclaration */:
|
6605
6849
|
range = node.setKeyword.rangeWithoutTrivia;
|
6606
6850
|
break;
|
6607
|
-
case
|
6851
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
6608
6852
|
range = node.getKeyword.rangeWithoutTrivia;
|
6609
6853
|
break;
|
6610
|
-
case
|
6854
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
6611
6855
|
range = node.setKeyword.rangeWithoutTrivia;
|
6612
6856
|
break;
|
6613
6857
|
case 47 /* TypeIndexedGetterDeclaration */:
|
@@ -6733,9 +6977,7 @@ var DefinitionService = class {
|
|
6733
6977
|
return getEntitySourceLocations(analyzer, target.constructor_.getEntity());
|
6734
6978
|
case "accessed-method":
|
6735
6979
|
return getEntitySourceLocations(analyzer, target.method.getEntity());
|
6736
|
-
case "
|
6737
|
-
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
6738
|
-
case "type-binary-operator":
|
6980
|
+
case "operator":
|
6739
6981
|
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
6740
6982
|
case "type-dereference-operator":
|
6741
6983
|
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
@@ -6769,9 +7011,7 @@ var DefinitionService = class {
|
|
6769
7011
|
return target.parameter.getEntity();
|
6770
7012
|
case "type-constructor":
|
6771
7013
|
return target.constructor_.getEntity();
|
6772
|
-
case "
|
6773
|
-
return target.operator.getEntity();
|
6774
|
-
case "type-binary-operator":
|
7014
|
+
case "operator":
|
6775
7015
|
return target.operator.getEntity();
|
6776
7016
|
case "type-dereference-operator":
|
6777
7017
|
return target.operator.getEntity();
|
@@ -6862,7 +7102,7 @@ var ReferencesService = class {
|
|
6862
7102
|
}
|
6863
7103
|
}
|
6864
7104
|
if (!options6.onlyNamed) {
|
6865
|
-
if (node.kind ===
|
7105
|
+
if (node.kind === 70 /* AutotypeCallExpression */ && restrictions.canBeAutotypeCall) {
|
6866
7106
|
const semanticInfo = NodeSemanticInfoService.ofAutotypeCallExpression(analyzer, node, semanticInfoOptions);
|
6867
7107
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
6868
7108
|
definition,
|
@@ -6874,7 +7114,7 @@ var ReferencesService = class {
|
|
6874
7114
|
result.push(new Reference(sourceFile2, node.autotypeKeyword.rangeWithoutTrivia, referenceKind));
|
6875
7115
|
}
|
6876
7116
|
}
|
6877
|
-
if (node.kind ===
|
7117
|
+
if (node.kind === 79 /* PrefixUnaryExpression */ && restrictions.canBePrefixUnaryOperator) {
|
6878
7118
|
const semanticInfo = NodeSemanticInfoService.ofPrefixUnaryExpressionOperator(
|
6879
7119
|
analyzer,
|
6880
7120
|
node,
|
@@ -6890,7 +7130,7 @@ var ReferencesService = class {
|
|
6890
7130
|
result.push(new Reference(sourceFile2, node.operator.rangeWithoutTrivia, referenceKind));
|
6891
7131
|
}
|
6892
7132
|
}
|
6893
|
-
if (node.kind ===
|
7133
|
+
if (node.kind === 75 /* NotExpression */ && restrictions.canBeNotExpression) {
|
6894
7134
|
const semanticInfo = NodeSemanticInfoService.ofNotExpressionNotKeyword(
|
6895
7135
|
analyzer,
|
6896
7136
|
node,
|
@@ -6906,7 +7146,7 @@ var ReferencesService = class {
|
|
6906
7146
|
result.push(new Reference(sourceFile2, node.notKeyword.rangeWithoutTrivia, referenceKind));
|
6907
7147
|
}
|
6908
7148
|
}
|
6909
|
-
if (node.kind ===
|
7149
|
+
if (node.kind === 66 /* BinaryExpression */ && restrictions.canBeBinaryExpressionOperator) {
|
6910
7150
|
const semanticInfo = NodeSemanticInfoService.ofBinaryExpressionOperator(
|
6911
7151
|
analyzer,
|
6912
7152
|
node,
|
@@ -6934,7 +7174,7 @@ var ReferencesService = class {
|
|
6934
7174
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
6935
7175
|
}
|
6936
7176
|
}
|
6937
|
-
if (node.kind ===
|
7177
|
+
if (node.kind === 82 /* DereferenceExpression */ && restrictions.canBeDereferenceOperator) {
|
6938
7178
|
const semanticInfo = NodeSemanticInfoService.ofDereferenceExpressionOperator(
|
6939
7179
|
analyzer,
|
6940
7180
|
node,
|
@@ -6950,7 +7190,7 @@ var ReferencesService = class {
|
|
6950
7190
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
6951
7191
|
}
|
6952
7192
|
}
|
6953
|
-
if (node.kind ===
|
7193
|
+
if (node.kind === 93 /* AssignmentStatement */ && restrictions.canBeAssignmentStatementOperator) {
|
6954
7194
|
const semanticInfo = NodeSemanticInfoService.ofAssignmentStatementOperator(
|
6955
7195
|
analyzer,
|
6956
7196
|
node,
|
@@ -6978,7 +7218,7 @@ var ReferencesService = class {
|
|
6978
7218
|
result.push(new Reference(sourceFile2, node.creationKeyword.rangeWithoutTrivia, referenceKind));
|
6979
7219
|
}
|
6980
7220
|
}
|
6981
|
-
if (node.kind ===
|
7221
|
+
if (node.kind === 88 /* ObjectExpression */ && restrictions.canBeObjectExpression) {
|
6982
7222
|
const semanticInfo = NodeSemanticInfoService.ofObjectExpression(analyzer, node, semanticInfoOptions);
|
6983
7223
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
6984
7224
|
definition,
|
@@ -6990,7 +7230,7 @@ var ReferencesService = class {
|
|
6990
7230
|
result.push(new Reference(sourceFile2, node.keyword.rangeWithoutTrivia, referenceKind));
|
6991
7231
|
}
|
6992
7232
|
}
|
6993
|
-
if (node.kind ===
|
7233
|
+
if (node.kind === 89 /* BaseExpression */ && restrictions.canBeBaseExpression) {
|
6994
7234
|
const semanticInfo = NodeSemanticInfoService.ofBaseExpression(analyzer, node, semanticInfoOptions);
|
6995
7235
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
6996
7236
|
definition,
|
@@ -7014,7 +7254,7 @@ var ReferencesService = class {
|
|
7014
7254
|
result.push(new Reference(sourceFile2, node.parameterClause.rangeWithoutTrivia, referenceKind));
|
7015
7255
|
}
|
7016
7256
|
}
|
7017
|
-
if (node.kind ===
|
7257
|
+
if (node.kind === 72 /* IndexedAccessExpression */ && restrictions.canBeIndexer) {
|
7018
7258
|
const semanticInfo = NodeSemanticInfoService.ofIndexedAccessExpressionOperator(
|
7019
7259
|
analyzer,
|
7020
7260
|
node,
|
@@ -7133,9 +7373,7 @@ var ReferencesService = class {
|
|
7133
7373
|
);
|
7134
7374
|
case "type-constructor":
|
7135
7375
|
return new DefinitionInfo(target.value.constructor_.getEntity(), target.localization, 0 /* Read */);
|
7136
|
-
case "
|
7137
|
-
return new DefinitionInfo(target.value.operator.getEntity(), target.localization, 0 /* Read */);
|
7138
|
-
case "type-binary-operator":
|
7376
|
+
case "operator":
|
7139
7377
|
return new DefinitionInfo(target.value.operator.getEntity(), target.localization, 0 /* Read */);
|
7140
7378
|
case "type-dereference-operator":
|
7141
7379
|
return new DefinitionInfo(
|
@@ -7185,13 +7423,15 @@ var ReferencesService = class {
|
|
7185
7423
|
result.canBeAutotypeCall = true;
|
7186
7424
|
result.canBeConstructorDeclaration = true;
|
7187
7425
|
}
|
7188
|
-
if (definition.value.kind === 15 /*
|
7189
|
-
|
7190
|
-
|
7191
|
-
|
7192
|
-
|
7193
|
-
|
7194
|
-
|
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
|
+
}
|
7195
7435
|
}
|
7196
7436
|
if (definition.value.kind === 8 /* DereferenceOperator */) {
|
7197
7437
|
result.canBeDereferenceOperator = true;
|
@@ -7274,10 +7514,9 @@ var ReferencesService = class {
|
|
7274
7514
|
case 10 /* Destructor */:
|
7275
7515
|
case 7 /* Indexer */:
|
7276
7516
|
case 8 /* DereferenceOperator */:
|
7277
|
-
case
|
7278
|
-
case
|
7279
|
-
case
|
7280
|
-
case 19 /* TypeExtension */:
|
7517
|
+
case 16 /* Package */:
|
7518
|
+
case 17 /* TypeExtension */:
|
7519
|
+
case 15 /* Operator */:
|
7281
7520
|
return void 0;
|
7282
7521
|
default:
|
7283
7522
|
Debug.never(entity);
|
@@ -7390,9 +7629,9 @@ var EvaluatableExpressionService = class {
|
|
7390
7629
|
getEvaluatableExpressionForIdentifier(node) {
|
7391
7630
|
const parent = node.parent;
|
7392
7631
|
switch (parent.kind) {
|
7393
|
-
case
|
7632
|
+
case 90 /* IdentifierExpression */:
|
7394
7633
|
return parent;
|
7395
|
-
case
|
7634
|
+
case 80 /* PropertyAccessExpression */:
|
7396
7635
|
if (this.isEvaluatableReceiver(parent.expression)) {
|
7397
7636
|
return parent;
|
7398
7637
|
}
|
@@ -7413,9 +7652,9 @@ var EvaluatableExpressionService = class {
|
|
7413
7652
|
}
|
7414
7653
|
isEvaluatableReceiver(expression) {
|
7415
7654
|
switch (expression.kind) {
|
7416
|
-
case
|
7655
|
+
case 90 /* IdentifierExpression */:
|
7417
7656
|
return true;
|
7418
|
-
case
|
7657
|
+
case 80 /* PropertyAccessExpression */:
|
7419
7658
|
return this.isEvaluatableReceiver(expression.expression);
|
7420
7659
|
default:
|
7421
7660
|
return false;
|
@@ -7423,7 +7662,7 @@ var EvaluatableExpressionService = class {
|
|
7423
7662
|
}
|
7424
7663
|
isNamedDeclaration(node) {
|
7425
7664
|
switch (node.kind) {
|
7426
|
-
case
|
7665
|
+
case 60 /* EnumerationVariableDeclaration */:
|
7427
7666
|
return { nameIdentifier: node.name };
|
7428
7667
|
case 22 /* PackageAliasTypeDeclaration */:
|
7429
7668
|
return { nameIdentifier: node.name };
|
@@ -7437,21 +7676,21 @@ var EvaluatableExpressionService = class {
|
|
7437
7676
|
return { nameIdentifier: node.name };
|
7438
7677
|
case 38 /* PackageVariantTypeDeclaration */:
|
7439
7678
|
return { nameIdentifier: node.name };
|
7440
|
-
case
|
7679
|
+
case 58 /* NestedMethodDeclaration */:
|
7441
7680
|
return { nameIdentifier: node.name };
|
7442
|
-
case
|
7681
|
+
case 59 /* LocalVariableDeclaration */:
|
7443
7682
|
return { nameIdentifier: node.name };
|
7444
|
-
case
|
7683
|
+
case 143 /* ParameterDeclaration */:
|
7445
7684
|
return { nameIdentifier: node.name };
|
7446
7685
|
case 52 /* TypeMethodDeclaration */:
|
7447
7686
|
return { nameIdentifier: node.name };
|
7448
|
-
case
|
7687
|
+
case 54 /* TypeVariableDeclaration */:
|
7449
7688
|
return { nameIdentifier: node.name };
|
7450
|
-
case
|
7689
|
+
case 142 /* TypeParameterDeclaration */:
|
7451
7690
|
return { nameIdentifier: node.name };
|
7452
|
-
case
|
7691
|
+
case 141 /* VariantDeclaration */:
|
7453
7692
|
return { nameIdentifier: node.name };
|
7454
|
-
case
|
7693
|
+
case 102 /* ErrorVariableDeclaration */:
|
7455
7694
|
return { nameIdentifier: node.name };
|
7456
7695
|
default:
|
7457
7696
|
return void 0;
|
@@ -7572,13 +7811,12 @@ var HoverService = class {
|
|
7572
7811
|
);
|
7573
7812
|
return new Hover(this._displayService.displayConstructorDeclaration(declaration), range);
|
7574
7813
|
}
|
7575
|
-
case "
|
7576
|
-
const operator = new
|
7577
|
-
|
7578
|
-
|
7579
|
-
|
7580
|
-
|
7581
|
-
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);
|
7582
7820
|
}
|
7583
7821
|
case "type-dereference-operator": {
|
7584
7822
|
const operator = new DereferenceOperatorDeclaration_typeMember(firstTarget.value.operator);
|
@@ -7747,7 +7985,7 @@ var SourceFileItemsService = class {
|
|
7747
7985
|
);
|
7748
7986
|
break;
|
7749
7987
|
}
|
7750
|
-
case
|
7988
|
+
case 54 /* TypeVariableDeclaration */: {
|
7751
7989
|
result.push(
|
7752
7990
|
this.createItem(
|
7753
7991
|
12 /* TypeVariable */,
|
@@ -7759,7 +7997,7 @@ var SourceFileItemsService = class {
|
|
7759
7997
|
);
|
7760
7998
|
break;
|
7761
7999
|
}
|
7762
|
-
case
|
8000
|
+
case 55 /* TypeVariableGetterDeclaration */: {
|
7763
8001
|
result.push(
|
7764
8002
|
this.createItem(
|
7765
8003
|
13 /* TypeVariableGetter */,
|
@@ -7771,7 +8009,7 @@ var SourceFileItemsService = class {
|
|
7771
8009
|
);
|
7772
8010
|
break;
|
7773
8011
|
}
|
7774
|
-
case
|
8012
|
+
case 56 /* TypeVariableSetterDeclaration */: {
|
7775
8013
|
result.push(
|
7776
8014
|
this.createItem(
|
7777
8015
|
14 /* TypeVariableSetter */,
|
@@ -7865,7 +8103,7 @@ var SourceFileItemsService = class {
|
|
7865
8103
|
);
|
7866
8104
|
break;
|
7867
8105
|
}
|
7868
|
-
case
|
8106
|
+
case 141 /* VariantDeclaration */: {
|
7869
8107
|
result.push(
|
7870
8108
|
this.createItem(
|
7871
8109
|
9 /* Variant */,
|
@@ -7877,7 +8115,7 @@ var SourceFileItemsService = class {
|
|
7877
8115
|
);
|
7878
8116
|
break;
|
7879
8117
|
}
|
7880
|
-
case
|
8118
|
+
case 142 /* TypeParameterDeclaration */: {
|
7881
8119
|
result.push(
|
7882
8120
|
this.createItem(
|
7883
8121
|
18 /* TypeParameter */,
|
@@ -7889,7 +8127,7 @@ var SourceFileItemsService = class {
|
|
7889
8127
|
);
|
7890
8128
|
break;
|
7891
8129
|
}
|
7892
|
-
case
|
8130
|
+
case 58 /* NestedMethodDeclaration */: {
|
7893
8131
|
result.push(
|
7894
8132
|
this.createItem(
|
7895
8133
|
19 /* NestedMethod */,
|
@@ -8056,9 +8294,10 @@ var RenameService = class {
|
|
8056
8294
|
case "match-result-value-parameter":
|
8057
8295
|
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.parameter.entity);
|
8058
8296
|
break;
|
8297
|
+
case "operator":
|
8298
|
+
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.operator.getEntity());
|
8299
|
+
break;
|
8059
8300
|
case "type-constructor":
|
8060
|
-
case "type-unary-operator":
|
8061
|
-
case "type-binary-operator":
|
8062
8301
|
case "type-dereference-operator":
|
8063
8302
|
case "package":
|
8064
8303
|
case "type-context":
|
@@ -8108,7 +8347,7 @@ var SelectionRangeService = class {
|
|
8108
8347
|
if (!this.nodeShouldBeSkipped(child) && !child.rangeWithoutTrivia.equals(result.range)) {
|
8109
8348
|
result = new SelectionRange(child.rangeWithoutTrivia, result);
|
8110
8349
|
}
|
8111
|
-
if (child.kind === 0 /* Token */ && (child.tokenKind === 6 /* TextLiteral */ || child.tokenKind === 7 /* TextTemplateHead */ || child.tokenKind === 8 /* TextTemplatePart */ || child.tokenKind === 9 /* TextTemplateTail */ || child.tokenKind === 5 /* CharLiteral */) || child.kind ===
|
8350
|
+
if (child.kind === 0 /* Token */ && (child.tokenKind === 6 /* TextLiteral */ || child.tokenKind === 7 /* TextTemplateHead */ || child.tokenKind === 8 /* TextTemplatePart */ || child.tokenKind === 9 /* TextTemplateTail */ || child.tokenKind === 5 /* CharLiteral */) || child.kind === 83 /* TextTemplateLiteral */) {
|
8112
8351
|
const textContentStart = child.rangeWithoutTrivia.start + 1;
|
8113
8352
|
const textContentEnd = child.rangeWithoutTrivia.end - 1;
|
8114
8353
|
if (offset >= textContentStart && offset < textContentEnd) {
|
@@ -8139,13 +8378,13 @@ var SelectionRangeService = class {
|
|
8139
8378
|
}
|
8140
8379
|
}
|
8141
8380
|
switch (node.kind) {
|
8142
|
-
case
|
8381
|
+
case 157 /* TypeAnnotation */:
|
8143
8382
|
case 34 /* StructuredTypeDeclarationBody */:
|
8144
8383
|
case 39 /* VariantTypeDeclarationBody */:
|
8145
8384
|
case 23 /* AliasTypeDeclarationBody */:
|
8146
8385
|
case 29 /* MethodTypeDeclarationBody */:
|
8147
|
-
case
|
8148
|
-
case
|
8386
|
+
case 85 /* TextTemplateSpan */:
|
8387
|
+
case 84 /* TextTemplateSpanList */:
|
8149
8388
|
return true;
|
8150
8389
|
default:
|
8151
8390
|
return false;
|
@@ -8183,7 +8422,7 @@ var SemanticTokensService = class {
|
|
8183
8422
|
controller.stopChildrenTraverse();
|
8184
8423
|
return;
|
8185
8424
|
}
|
8186
|
-
if (node.kind ===
|
8425
|
+
if (node.kind === 90 /* IdentifierExpression */) {
|
8187
8426
|
const meaning = analyzer.resolveIdentifierExpression(node).meaning;
|
8188
8427
|
if (meaning.kind === "variable-access") {
|
8189
8428
|
const variable = meaning.variable.value.getEntity();
|
@@ -8233,7 +8472,7 @@ var SemanticTokensService = class {
|
|
8233
8472
|
);
|
8234
8473
|
}
|
8235
8474
|
}
|
8236
|
-
if (node.kind ===
|
8475
|
+
if (node.kind === 80 /* PropertyAccessExpression */) {
|
8237
8476
|
const meaning = analyzer.resolvePropertyAccessExpression(node).meaning;
|
8238
8477
|
if (meaning.kind === "variant-access") {
|
8239
8478
|
result.push(
|
@@ -8267,7 +8506,7 @@ var SemanticTokensService = class {
|
|
8267
8506
|
);
|
8268
8507
|
}
|
8269
8508
|
}
|
8270
|
-
if (node.kind ===
|
8509
|
+
if (node.kind === 141 /* VariantDeclaration */) {
|
8271
8510
|
result.push(
|
8272
8511
|
new SemanticToken(
|
8273
8512
|
node.name.rangeWithoutTrivia,
|
@@ -8285,7 +8524,7 @@ var SemanticTokensService = class {
|
|
8285
8524
|
)
|
8286
8525
|
);
|
8287
8526
|
}
|
8288
|
-
if (node.kind ===
|
8527
|
+
if (node.kind === 58 /* NestedMethodDeclaration */) {
|
8289
8528
|
result.push(
|
8290
8529
|
new SemanticToken(node.name.rangeWithoutTrivia, 5 /* NestedMethod */, new SemanticTokenModifiers().makeDeclaration().setCapitalized(this.isCapitalizedName(node.name.value)))
|
8291
8530
|
);
|
@@ -8295,6 +8534,11 @@ var SemanticTokensService = class {
|
|
8295
8534
|
new SemanticToken(node.name.rangeWithoutTrivia, 6 /* TypeMethod */, new SemanticTokenModifiers().makeDeclaration().setCapitalized(this.isCapitalizedName(node.name.value)))
|
8296
8535
|
);
|
8297
8536
|
}
|
8537
|
+
if (node.kind === 53 /* OperatorDeclaration */) {
|
8538
|
+
result.push(
|
8539
|
+
new SemanticToken(node.name.rangeWithoutTrivia, 7 /* Operator */, new SemanticTokenModifiers().makeDeclaration())
|
8540
|
+
);
|
8541
|
+
}
|
8298
8542
|
}
|
8299
8543
|
);
|
8300
8544
|
return result.sort((t1, t2) => t1.range.start - t2.range.end);
|
@@ -8371,7 +8615,8 @@ var supportedSemanticTokens = [
|
|
8371
8615
|
3 /* Variant */,
|
8372
8616
|
4 /* PackageMethod */,
|
8373
8617
|
5 /* NestedMethod */,
|
8374
|
-
6 /* TypeMethod
|
8618
|
+
6 /* TypeMethod */,
|
8619
|
+
7 /* Operator */
|
8375
8620
|
];
|
8376
8621
|
var supportedSemanticTokenModifiers = [
|
8377
8622
|
1 /* Const */,
|
@@ -8445,7 +8690,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8445
8690
|
}
|
8446
8691
|
let node = token.parent;
|
8447
8692
|
while (node !== void 0) {
|
8448
|
-
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)) {
|
8449
8694
|
const argumentIndex = this.getArgumentIndex(node.typeArgumentList, this._offset);
|
8450
8695
|
const argumentCount = this.countArguments(node.typeArgumentList);
|
8451
8696
|
return new NodeWithTypeArgumentsInfo(node.parent, argumentIndex, argumentCount);
|
@@ -8490,7 +8735,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8490
8735
|
switch (node.kind) {
|
8491
8736
|
case 10 /* NamedTypeSpecifier */:
|
8492
8737
|
return this.getSignaturesForNamedTypeSpecifier(node);
|
8493
|
-
case
|
8738
|
+
case 91 /* GenericSpecializationExpression */:
|
8494
8739
|
return this.getSignaturesForGenericSpecializationExpression(node);
|
8495
8740
|
default:
|
8496
8741
|
Debug.never(node);
|
@@ -8508,7 +8753,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8508
8753
|
}
|
8509
8754
|
getSignaturesForGenericSpecializationExpression(node) {
|
8510
8755
|
const expression = unwrapParenthesizedExpressions(node.expression);
|
8511
|
-
if (expression.kind ===
|
8756
|
+
if (expression.kind === 90 /* IdentifierExpression */) {
|
8512
8757
|
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
8513
8758
|
if (meaning.kind === "method-access") {
|
8514
8759
|
return Query.from(meaning.candidates).mapAndFilter((o) => {
|
@@ -8523,7 +8768,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8523
8768
|
}
|
8524
8769
|
return void 0;
|
8525
8770
|
}
|
8526
|
-
if (expression.kind ===
|
8771
|
+
if (expression.kind === 80 /* PropertyAccessExpression */) {
|
8527
8772
|
const meaning = this._analyzer.resolvePropertyAccessExpression(expression).meaning;
|
8528
8773
|
let accessedMethods;
|
8529
8774
|
if (meaning.kind === "instance-method-access") {
|
@@ -8776,7 +9021,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8776
9021
|
let node = token.parent;
|
8777
9022
|
while (node !== void 0) {
|
8778
9023
|
switch (node.kind) {
|
8779
|
-
case
|
9024
|
+
case 69 /* CallExpression */: {
|
8780
9025
|
if (this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && (node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
8781
9026
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfCallExpression(node);
|
8782
9027
|
const argumentIndex = this.getArgumentIndexInList(node.callArgumentList.elements, this._offset);
|
@@ -8784,7 +9029,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8784
9029
|
}
|
8785
9030
|
break;
|
8786
9031
|
}
|
8787
|
-
case
|
9032
|
+
case 70 /* AutotypeCallExpression */: {
|
8788
9033
|
if (this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && (node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
8789
9034
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfAutotypeCallExpression(node);
|
8790
9035
|
const argumentIndex = this.getArgumentIndexInList(node.callArgumentList.elements, this._offset);
|
@@ -8792,7 +9037,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8792
9037
|
}
|
8793
9038
|
break;
|
8794
9039
|
}
|
8795
|
-
case
|
9040
|
+
case 72 /* IndexedAccessExpression */: {
|
8796
9041
|
if (this._offset >= node.openSquareBracketToken.rangeWithoutTrivia.end && (node.closeSquareBracketToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeSquareBracketToken.rangeWithoutTrivia.start)) {
|
8797
9042
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfIndexedAccessExpression(node);
|
8798
9043
|
const argumentIndex = this.getArgumentIndexInList(node.argumentsList.elements, this._offset);
|
@@ -8800,7 +9045,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
8800
9045
|
}
|
8801
9046
|
break;
|
8802
9047
|
}
|
8803
|
-
case
|
9048
|
+
case 146 /* Tag */: {
|
8804
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)) {
|
8805
9050
|
const argumentIndex = this.getArgumentIndexInList(node.callArgumentList.elements, this._offset);
|
8806
9051
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(node);
|
@@ -11796,7 +12041,7 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
11796
12041
|
if (result === void 0) {
|
11797
12042
|
const node = new EntityToSyntax(analyzer, packageEntity, localizationContext).convert();
|
11798
12043
|
const code = new SyntaxToCode(node, { keywordsLocale: packageLocale }).convert();
|
11799
|
-
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, [key]);
|
12044
|
+
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, "", [key]);
|
11800
12045
|
const generatedFileUri = generatedPackageUri.append(`${packageEntity.getName().toString()}.art`);
|
11801
12046
|
const fileSystemTree = atomicRun2(() => new FileSystemTree());
|
11802
12047
|
const packageDirectory = fileSystemTree.addDirectory(generatedPackageUri);
|
@@ -11893,14 +12138,13 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
11893
12138
|
case 8 /* DereferenceOperator */:
|
11894
12139
|
case 9 /* Constructor */:
|
11895
12140
|
case 10 /* Destructor */:
|
11896
|
-
case 15 /*
|
11897
|
-
case 16 /* BinaryOperator */:
|
12141
|
+
case 15 /* Operator */:
|
11898
12142
|
return this.checkIfEntityOfKindIsPresentInGeneratedCode(entity.getContainer().getEntity());
|
11899
12143
|
case 13 /* PackageAlias */:
|
11900
12144
|
return false;
|
11901
|
-
case
|
12145
|
+
case 16 /* Package */:
|
11902
12146
|
return false;
|
11903
|
-
case
|
12147
|
+
case 17 /* TypeExtension */:
|
11904
12148
|
return true;
|
11905
12149
|
default:
|
11906
12150
|
Debug.never(entity);
|
@@ -11959,6 +12203,8 @@ var EntityFinder = class {
|
|
11959
12203
|
return this.findConstructorEntity(entity);
|
11960
12204
|
case 10 /* Destructor */:
|
11961
12205
|
return this.findDestructorEntity(entity);
|
12206
|
+
case 15 /* Operator */:
|
12207
|
+
return this.findOperatorEntity(entity);
|
11962
12208
|
case 7 /* Indexer */:
|
11963
12209
|
return this.findIndexerEntity(entity);
|
11964
12210
|
case 8 /* DereferenceOperator */:
|
@@ -11970,10 +12216,8 @@ var EntityFinder = class {
|
|
11970
12216
|
case 13 /* PackageAlias */:
|
11971
12217
|
case 3 /* Getter */:
|
11972
12218
|
case 4 /* Setter */:
|
11973
|
-
case
|
11974
|
-
case
|
11975
|
-
case 18 /* Package */:
|
11976
|
-
case 19 /* TypeExtension */:
|
12219
|
+
case 16 /* Package */:
|
12220
|
+
case 17 /* TypeExtension */:
|
11977
12221
|
return void 0;
|
11978
12222
|
default:
|
11979
12223
|
Debug.never(entity);
|
@@ -12077,6 +12321,23 @@ var EntityFinder = class {
|
|
12077
12321
|
return index >= 0 ? members[index] : void 0;
|
12078
12322
|
}
|
12079
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
|
+
}
|
12080
12341
|
findIndexerEntity(entity) {
|
12081
12342
|
const containingType = this.findEntity(entity.getContainer().getEntity());
|
12082
12343
|
if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
|
@@ -12139,6 +12400,8 @@ var EntityFinder = class {
|
|
12139
12400
|
return entity.getValueParameters();
|
12140
12401
|
case 11 /* MethodType */:
|
12141
12402
|
return entity.getValueParameters();
|
12403
|
+
case 15 /* Operator */:
|
12404
|
+
return entity.getValueParameters();
|
12142
12405
|
case 0 /* Variable */:
|
12143
12406
|
case 1 /* Variant */:
|
12144
12407
|
case 2 /* VariantType */:
|
@@ -12148,10 +12411,8 @@ var EntityFinder = class {
|
|
12148
12411
|
case 12 /* StructuredType */:
|
12149
12412
|
case 13 /* PackageAlias */:
|
12150
12413
|
case 14 /* AliasType */:
|
12151
|
-
case
|
12152
|
-
case
|
12153
|
-
case 18 /* Package */:
|
12154
|
-
case 19 /* TypeExtension */:
|
12414
|
+
case 16 /* Package */:
|
12415
|
+
case 17 /* TypeExtension */:
|
12155
12416
|
case 8 /* DereferenceOperator */:
|
12156
12417
|
return void 0;
|
12157
12418
|
default:
|
@@ -12180,10 +12441,9 @@ var EntityFinder = class {
|
|
12180
12441
|
case 4 /* Setter */:
|
12181
12442
|
case 6 /* TypeParameter */:
|
12182
12443
|
case 13 /* PackageAlias */:
|
12183
|
-
case
|
12184
|
-
case
|
12185
|
-
case
|
12186
|
-
case 19 /* TypeExtension */:
|
12444
|
+
case 16 /* Package */:
|
12445
|
+
case 17 /* TypeExtension */:
|
12446
|
+
case 15 /* Operator */:
|
12187
12447
|
return void 0;
|
12188
12448
|
default:
|
12189
12449
|
Debug.never(entity);
|
@@ -12867,7 +13127,7 @@ var LanguageServer = class {
|
|
12867
13127
|
const sourceFileContext = yield this.getSourceFileContext(uri, token);
|
12868
13128
|
if (sourceFileContext !== void 0) {
|
12869
13129
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
12870
|
-
if (node?.kind ===
|
13130
|
+
if (node?.kind === 93 /* AssignmentStatement */) {
|
12871
13131
|
const sourceFileEdit = this._addPropertyAssignmentService.createEditWithAssignment(
|
12872
13132
|
sourceFileContext.sourceFile,
|
12873
13133
|
node,
|
@@ -12904,7 +13164,7 @@ var LanguageServer = class {
|
|
12904
13164
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
12905
13165
|
if (node !== void 0) {
|
12906
13166
|
let nodeForRange = node;
|
12907
|
-
if (node.kind ===
|
13167
|
+
if (node.kind === 93 /* AssignmentStatement */) {
|
12908
13168
|
nodeForRange = node.right;
|
12909
13169
|
}
|
12910
13170
|
result = this.convertSourceFileRange(sourceFileContext.sourceFile, nodeForRange.rangeWithoutTrivia);
|
@@ -13051,7 +13311,7 @@ ${e}`);
|
|
13051
13311
|
const position = new Position(params.position.line, params.position.character);
|
13052
13312
|
const offset = sourceFile.getOffsetAtPosition(position);
|
13053
13313
|
const completions = this._completionService.getCompletions(analyzer, sourceFile, offset);
|
13054
|
-
result = completions.map((c) => this.convertCompletionItem(c));
|
13314
|
+
result = completions.map((c) => this.convertCompletionItem(c, sourceFile));
|
13055
13315
|
}
|
13056
13316
|
return result;
|
13057
13317
|
});
|
@@ -13064,22 +13324,31 @@ ${e}`);
|
|
13064
13324
|
const resolutionResult = this._completionService.resolveCompletionItem(cacheId, indexInCache);
|
13065
13325
|
let result;
|
13066
13326
|
if (resolutionResult.kind === "item") {
|
13067
|
-
result = this.convertCompletionItem(resolutionResult.value);
|
13327
|
+
result = this.convertCompletionItem(resolutionResult.value, resolutionResult.sourceFile);
|
13328
|
+
result.textEdit = item.textEdit;
|
13068
13329
|
} else {
|
13069
13330
|
result = item;
|
13070
13331
|
}
|
13071
13332
|
return result;
|
13072
13333
|
}
|
13073
|
-
convertCompletionItem(item) {
|
13334
|
+
convertCompletionItem(item, sourceFile) {
|
13074
13335
|
const data = {
|
13075
13336
|
cacheId: item.cacheId,
|
13076
13337
|
indexInCache: item.indexInCache
|
13077
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
|
+
}
|
13078
13346
|
return {
|
13079
13347
|
label: item.label,
|
13080
13348
|
kind: this.convertCompletionItemKind(item.kind),
|
13081
13349
|
detail: item.details,
|
13082
13350
|
insertText: item.insertText,
|
13351
|
+
textEdit,
|
13083
13352
|
sortText: item.sortText,
|
13084
13353
|
data
|
13085
13354
|
};
|
@@ -13094,42 +13363,46 @@ ${e}`);
|
|
13094
13363
|
return ls3.CompletionItemKind.Property;
|
13095
13364
|
case 3 /* TypeMethod */:
|
13096
13365
|
return ls3.CompletionItemKind.Method;
|
13097
|
-
case
|
13366
|
+
case 5 /* TypeIndexer */:
|
13098
13367
|
return ls3.CompletionItemKind.Property;
|
13099
|
-
case
|
13368
|
+
case 6 /* TypeConstructor */:
|
13100
13369
|
return ls3.CompletionItemKind.Constructor;
|
13101
|
-
case
|
13370
|
+
case 12 /* Variant */:
|
13102
13371
|
return ls3.CompletionItemKind.EnumMember;
|
13103
|
-
case
|
13372
|
+
case 7 /* PackageVariable */:
|
13104
13373
|
return ls3.CompletionItemKind.Variable;
|
13105
|
-
case
|
13374
|
+
case 8 /* PackageMethod */:
|
13106
13375
|
return ls3.CompletionItemKind.Function;
|
13107
|
-
case
|
13376
|
+
case 9 /* LocalVariable */:
|
13108
13377
|
return ls3.CompletionItemKind.Variable;
|
13109
|
-
case
|
13378
|
+
case 10 /* ParameterVariable */:
|
13110
13379
|
return ls3.CompletionItemKind.Variable;
|
13111
|
-
case
|
13380
|
+
case 11 /* NestedMethod */:
|
13112
13381
|
return ls3.CompletionItemKind.Function;
|
13113
|
-
case
|
13382
|
+
case 13 /* RefObjectType */:
|
13114
13383
|
return ls3.CompletionItemKind.Class;
|
13115
|
-
case
|
13384
|
+
case 14 /* PlainObjectType */:
|
13116
13385
|
return ls3.CompletionItemKind.Struct;
|
13117
|
-
case
|
13386
|
+
case 15 /* AspectType */:
|
13118
13387
|
return ls3.CompletionItemKind.Interface;
|
13119
|
-
case
|
13388
|
+
case 16 /* VariantType */:
|
13120
13389
|
return ls3.CompletionItemKind.Enum;
|
13121
|
-
case
|
13390
|
+
case 17 /* TypeParameter */:
|
13122
13391
|
return ls3.CompletionItemKind.TypeParameter;
|
13123
|
-
case
|
13392
|
+
case 18 /* MethodType */:
|
13124
13393
|
return ls3.CompletionItemKind.Function;
|
13125
|
-
case
|
13394
|
+
case 19 /* AliasType */:
|
13126
13395
|
return ls3.CompletionItemKind.Class;
|
13127
|
-
case
|
13396
|
+
case 20 /* InvalidType */:
|
13128
13397
|
return ls3.CompletionItemKind.Class;
|
13129
|
-
case
|
13398
|
+
case 21 /* Keyword */:
|
13130
13399
|
return ls3.CompletionItemKind.Keyword;
|
13131
|
-
case
|
13400
|
+
case 22 /* TargetSignatureParameter */:
|
13132
13401
|
return ls3.CompletionItemKind.Variable;
|
13402
|
+
case 4 /* Operator */:
|
13403
|
+
return ls3.CompletionItemKind.Operator;
|
13404
|
+
case 23 /* OperatorName */:
|
13405
|
+
return ls3.CompletionItemKind.Operator;
|
13133
13406
|
default:
|
13134
13407
|
Debug.never(kind);
|
13135
13408
|
}
|
@@ -13216,6 +13489,8 @@ ${e}`);
|
|
13216
13489
|
return ls3.SemanticTokenTypes.function;
|
13217
13490
|
case 6 /* TypeMethod */:
|
13218
13491
|
return ls3.SemanticTokenTypes.method;
|
13492
|
+
case 7 /* Operator */:
|
13493
|
+
return ls3.SemanticTokenTypes.operator;
|
13219
13494
|
default:
|
13220
13495
|
Debug.never(kind);
|
13221
13496
|
}
|
@@ -13409,22 +13684,10 @@ ${e}`);
|
|
13409
13684
|
});
|
13410
13685
|
}
|
13411
13686
|
convertUriToVscodeUri(uri) {
|
13412
|
-
return URI2.from({ scheme: uri.scheme, path:
|
13687
|
+
return URI2.from({ scheme: uri.scheme, authority: uri.authority, path: uri.path });
|
13413
13688
|
}
|
13414
13689
|
convertVscodeUriToUri(uri) {
|
13415
|
-
uri
|
13416
|
-
const scheme = uri.scheme;
|
13417
|
-
let path = uri.path;
|
13418
|
-
if (path.startsWith("/")) {
|
13419
|
-
path = path.slice(1);
|
13420
|
-
}
|
13421
|
-
let segments;
|
13422
|
-
if (path === "") {
|
13423
|
-
segments = [];
|
13424
|
-
} else {
|
13425
|
-
segments = path.split("/");
|
13426
|
-
}
|
13427
|
-
return new Uri(scheme, segments);
|
13690
|
+
return Uri.from(uri.scheme, uri.authority, uri.path);
|
13428
13691
|
}
|
13429
13692
|
createCancellationToken(cancellationToken) {
|
13430
13693
|
if (!this._enableRequestCancellation) {
|