@artel/artc 0.6.25277 → 0.6.25278
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 +14 -10
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +286 -293
- package/build/{chunk-QK3TWMY2.js → chunk-4C7CEJJF.js} +20 -24
- package/build/{chunk-EVYL6VFM.js → chunk-A2QTLTGI.js} +1935 -1176
- package/build/{chunk-DKZTCPRN.js → chunk-L44WWCT7.js} +15 -15
- package/build/types/analysis/AccessedFunction.d.ts +3 -3
- package/build/types/analysis/AnalyzedTextTranslationPackage.d.ts +2 -2
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +11 -8
- package/build/types/analysis/Analyzer.d.ts +21 -19
- package/build/types/analysis/DeclarationsUsageCounter.d.ts +2 -2
- package/build/types/analysis/{DiagnosticCollector.d.ts → SourceFileAnalyzer.d.ts} +4 -5
- package/build/types/analysis/SourcePackageDependencyGraph.d.ts +2 -2
- package/build/types/analysis/SubstitutedFunction.d.ts +3 -3
- package/build/types/analysis/TranslatedEntityNameConflictsValidator.d.ts +28 -0
- package/build/types/analysis/Translation.d.ts +1 -2
- package/build/types/analysis/index.d.ts +1 -1
- package/build/types/analysis/semantic-context/Declarations.d.ts +3 -3
- package/build/types/analysis/semantic-context/SemanticContextBase.d.ts +2 -2
- package/build/types/api/Api.d.ts +1 -1
- package/build/types/common/TaskController.d.ts +14 -0
- package/build/types/common/TreeTraversal.d.ts +10 -9
- package/build/types/common/index.d.ts +1 -2
- package/build/types/diagnostic/DiagnosticCode.d.ts +5 -1
- package/build/types/emitter/Emitter.d.ts +3 -3
- package/build/types/emitter/EmitterContext.d.ts +1 -1
- package/build/types/emitter/EntityMap.d.ts +1 -1
- package/build/types/entities/Entity.d.ts +3 -1
- package/build/types/entities/EntityNaming.d.ts +2 -0
- package/build/types/entities/interfaces/FunctionEntity.d.ts +19 -6
- package/build/types/entities/interfaces/TypeParameterEntity.d.ts +2 -2
- package/build/types/entities/intrinsic/IntrinsicFunctionEntity.d.ts +3 -1
- package/build/types/entities/source/SourceFunctionEntity.d.ts +86 -5
- package/build/types/entities/source/SourceVariableEntity.d.ts +3 -1
- package/build/types/entities/translated/TranslatedAliasTypeEntity.d.ts +0 -1
- package/build/types/entities/translated/TranslatedConstructorEntity.d.ts +1 -1
- package/build/types/entities/translated/TranslatedFunctionEntity.d.ts +29 -14
- package/build/types/entities/translated/TranslatedFunctionTypeEntity.d.ts +0 -1
- package/build/types/entities/translated/TranslatedIndexerEntity.d.ts +19 -9
- package/build/types/entities/translated/TranslatedOperatorEntity.d.ts +21 -10
- package/build/types/entities/translated/TranslatedPackageEntity.d.ts +0 -2
- package/build/types/entities/translated/TranslatedStructuredTypeEntity.d.ts +0 -1
- package/build/types/entities/translated/TranslatedVariantTypeEntity.d.ts +0 -1
- package/build/types/executor/Compiler.d.ts +6 -6
- package/build/types/executor/NodeCompiler.d.ts +6 -6
- package/build/types/project/CompilationLoader.d.ts +5 -5
- package/build/types/project/FileSystemTree.d.ts +1 -1
- package/build/types/project/PackageContentCreator.d.ts +2 -1
- package/build/types/services/DefinitionService.d.ts +2 -2
- package/build/types/services/DisplayService.d.ts +22 -7
- package/build/types/services/DocumentHighlightsService.d.ts +2 -2
- package/build/types/services/LanguageServer.d.ts +1 -1
- package/build/types/services/NodeSemanticInfo.d.ts +1 -6
- package/build/types/services/ReferencesService.d.ts +3 -3
- package/build/types/services/RenameService.d.ts +2 -2
- package/build/types/services/SemanticTokensService.d.ts +4 -4
- package/build/types/services/source-generation/SourceGenerationService.d.ts +3 -3
- package/build/types/services/workspace/CompilationController.d.ts +7 -5
- package/build/types/services/workspace/FileSystemTreeProviderBasedOnWatchedFileSystem.d.ts +2 -2
- package/build/types/services/workspace/ManuallyUpdatedFileSystemTreeProvider.d.ts +2 -2
- package/build/types/services/workspace/Workspace.d.ts +3 -5
- package/build/types/services/workspace/WorkspaceFiles.d.ts +3 -3
- package/build/types/ts-interop/Entities.d.ts +3 -0
- package/package.json +1 -1
- package/build/types/common/ThrottledCancellationToken.d.ts +0 -17
- package/build/types/common/YieldExecution.d.ts +0 -1
package/build/api/ApiServices.js
CHANGED
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
DefaultNamesOfDirectoriesToIgnore,
|
|
28
28
|
DereferenceOperatorDeclaration_typeMember,
|
|
29
29
|
DestructorDeclaration,
|
|
30
|
-
DiagnosticCollector,
|
|
31
30
|
DisplayService,
|
|
32
31
|
Emitter,
|
|
33
32
|
ExpressionAnalysisOptions,
|
|
@@ -109,6 +108,7 @@ import {
|
|
|
109
108
|
Scanner,
|
|
110
109
|
SinglePackageImportDirective,
|
|
111
110
|
SourceFile,
|
|
111
|
+
SourceFileAnalyzer,
|
|
112
112
|
SourcePackageDependencyGraph,
|
|
113
113
|
StatementBlock,
|
|
114
114
|
StatementList,
|
|
@@ -117,6 +117,7 @@ import {
|
|
|
117
117
|
Tag,
|
|
118
118
|
TagList,
|
|
119
119
|
TargetPlatformConfig,
|
|
120
|
+
TaskController,
|
|
120
121
|
Token,
|
|
121
122
|
TokenExpression,
|
|
122
123
|
TopLevelTranslationList,
|
|
@@ -182,12 +183,12 @@ import {
|
|
|
182
183
|
operatorKinds,
|
|
183
184
|
setUserLocale,
|
|
184
185
|
tokenKindValues,
|
|
185
|
-
|
|
186
|
+
traverseTree,
|
|
186
187
|
unaliasType,
|
|
187
188
|
unwrapParenthesizedExpressions,
|
|
188
189
|
visitChildren,
|
|
189
|
-
|
|
190
|
-
} from "../chunk-
|
|
190
|
+
yieldTask
|
|
191
|
+
} from "../chunk-A2QTLTGI.js";
|
|
191
192
|
|
|
192
193
|
// source/services/CustomCommand.ts
|
|
193
194
|
import * as ls from "vscode-languageserver";
|
|
@@ -517,7 +518,7 @@ var SyntaxFactory = class {
|
|
|
517
518
|
}
|
|
518
519
|
static structuredTypeDeclarationBody(structuredTypeKind, baseTypes, members) {
|
|
519
520
|
const structuredTypeKindKeyword = this.keyword(structuredTypeKind);
|
|
520
|
-
const baseTypeList = baseTypes !== void 0 ? new BaseTypeList(this.createTokenSeparatedElements(baseTypes, 25 /* Comma */), void 0) : void 0;
|
|
521
|
+
const baseTypeList = baseTypes !== void 0 && baseTypes.length > 0 ? new BaseTypeList(this.createTokenSeparatedElements(baseTypes, 25 /* Comma */), void 0) : void 0;
|
|
521
522
|
const memberBlock = this.typeMemberDeclarationBlock(members);
|
|
522
523
|
return new StructuredTypeDeclarationBody(
|
|
523
524
|
structuredTypeKindKeyword,
|
|
@@ -2606,7 +2607,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
|
2606
2607
|
}
|
|
2607
2608
|
isNotTranslatedEntity(entity) {
|
|
2608
2609
|
const translation = entity.getTranslation();
|
|
2609
|
-
return translation === void 0 || translation.definition.kind === "intrinsic"
|
|
2610
|
+
return translation === void 0 || translation.definition.kind === "intrinsic";
|
|
2610
2611
|
}
|
|
2611
2612
|
createPackageMemberTranslationNode(entity) {
|
|
2612
2613
|
switch (entity.kind) {
|
|
@@ -3452,11 +3453,9 @@ var CompletionService = class {
|
|
|
3452
3453
|
hasPrecedingKeyword = true;
|
|
3453
3454
|
}
|
|
3454
3455
|
if (translationsDeclaration !== void 0) {
|
|
3455
|
-
const sourceLocale = translationPackage.getTargetPackage().getLocale();
|
|
3456
3456
|
const translatedPackageMemberLookup = new PackageMemberLookup(translationPackage.getTargetPackage());
|
|
3457
3457
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
|
3458
3458
|
return new TopLevelTranslationListCompletionContext(
|
|
3459
|
-
sourceLocale,
|
|
3460
3459
|
translatedPackageMemberLookup,
|
|
3461
3460
|
hidingMatcher,
|
|
3462
3461
|
translationKind,
|
|
@@ -3493,7 +3492,6 @@ var CompletionService = class {
|
|
|
3493
3492
|
hasPrecedingKeyword = true;
|
|
3494
3493
|
}
|
|
3495
3494
|
if (typeTranslation !== void 0) {
|
|
3496
|
-
const sourceLocale = translationPackage.getTargetPackage().getLocale();
|
|
3497
3495
|
let type;
|
|
3498
3496
|
if (this.sourceFile.package.kind === "translation") {
|
|
3499
3497
|
const translationPackage2 = this.analyzer.getAnalyzedTranslationPackageIfTargetResolved(this.sourceFile.package);
|
|
@@ -3503,13 +3501,7 @@ var CompletionService = class {
|
|
|
3503
3501
|
}
|
|
3504
3502
|
}
|
|
3505
3503
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
|
3506
|
-
return new TypeMemberTranslationListCompletionContext(
|
|
3507
|
-
sourceLocale,
|
|
3508
|
-
type,
|
|
3509
|
-
hidingMatcher,
|
|
3510
|
-
translationKind,
|
|
3511
|
-
hasPrecedingKeyword
|
|
3512
|
-
);
|
|
3504
|
+
return new TypeMemberTranslationListCompletionContext(type, hidingMatcher, translationKind, hasPrecedingKeyword);
|
|
3513
3505
|
}
|
|
3514
3506
|
return void 0;
|
|
3515
3507
|
}
|
|
@@ -4019,20 +4011,13 @@ var CompletionService = class {
|
|
|
4019
4011
|
}
|
|
4020
4012
|
getTopLevelAliasListCompletionItemInfos(ctx) {
|
|
4021
4013
|
let result;
|
|
4022
|
-
const displayService_ = new DisplayService(
|
|
4023
|
-
this.analyzer,
|
|
4024
|
-
ctx.sourceLocale,
|
|
4025
|
-
this.dialect,
|
|
4026
|
-
this.sourceFile
|
|
4027
|
-
);
|
|
4028
4014
|
if (ctx.translationKind === 1 /* Method */) {
|
|
4029
4015
|
result = Query.from(ctx.packageMemberLookup.getNamedMembers(ctx.hidingMatcher)).mapAndFilter((d) => {
|
|
4030
4016
|
if (d.kind === 1 /* Function */) {
|
|
4031
|
-
return new
|
|
4017
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4032
4018
|
this.completionItemInfoContext,
|
|
4033
4019
|
d,
|
|
4034
|
-
!ctx.hasPrecedingKeyword
|
|
4035
|
-
displayService_
|
|
4020
|
+
!ctx.hasPrecedingKeyword
|
|
4036
4021
|
);
|
|
4037
4022
|
}
|
|
4038
4023
|
return void 0;
|
|
@@ -4040,11 +4025,10 @@ var CompletionService = class {
|
|
|
4040
4025
|
} else if (ctx.translationKind === 2 /* Type */) {
|
|
4041
4026
|
result = Query.from(ctx.packageMemberLookup.getNamedMembers(ctx.hidingMatcher)).mapAndFilter((d) => {
|
|
4042
4027
|
if (d.kind === 2 /* Type */) {
|
|
4043
|
-
return new
|
|
4028
|
+
return new TranslationsSourcePackageTypeCompletionItemInfo(
|
|
4044
4029
|
this.completionItemInfoContext,
|
|
4045
4030
|
d,
|
|
4046
|
-
!ctx.hasPrecedingKeyword
|
|
4047
|
-
displayService_
|
|
4031
|
+
!ctx.hasPrecedingKeyword
|
|
4048
4032
|
);
|
|
4049
4033
|
}
|
|
4050
4034
|
return void 0;
|
|
@@ -4053,20 +4037,18 @@ var CompletionService = class {
|
|
|
4053
4037
|
result = Query.from(ctx.packageMemberLookup.getNamedMembers(ctx.hidingMatcher)).map((d) => {
|
|
4054
4038
|
switch (d.kind) {
|
|
4055
4039
|
case 0 /* Variable */:
|
|
4056
|
-
return new
|
|
4040
|
+
return new TranslationsSourceVariableCompletionItemInfo(this.completionItemInfoContext, d);
|
|
4057
4041
|
case 1 /* Function */:
|
|
4058
|
-
return new
|
|
4042
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4059
4043
|
this.completionItemInfoContext,
|
|
4060
4044
|
d,
|
|
4061
|
-
!ctx.hasPrecedingKeyword
|
|
4062
|
-
displayService_
|
|
4045
|
+
!ctx.hasPrecedingKeyword
|
|
4063
4046
|
);
|
|
4064
4047
|
case 2 /* Type */:
|
|
4065
|
-
return new
|
|
4048
|
+
return new TranslationsSourcePackageTypeCompletionItemInfo(
|
|
4066
4049
|
this.completionItemInfoContext,
|
|
4067
4050
|
d,
|
|
4068
|
-
!ctx.hasPrecedingKeyword
|
|
4069
|
-
displayService_
|
|
4051
|
+
!ctx.hasPrecedingKeyword
|
|
4070
4052
|
);
|
|
4071
4053
|
default:
|
|
4072
4054
|
Debug.never(d);
|
|
@@ -4081,7 +4063,7 @@ var CompletionService = class {
|
|
|
4081
4063
|
12 /* Function */
|
|
4082
4064
|
];
|
|
4083
4065
|
result = result.chain(
|
|
4084
|
-
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k,
|
|
4066
|
+
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))).flatMap((i) => i)
|
|
4085
4067
|
);
|
|
4086
4068
|
}
|
|
4087
4069
|
return result.toArray();
|
|
@@ -4089,55 +4071,45 @@ var CompletionService = class {
|
|
|
4089
4071
|
getTypeAliasMemberListItemInfos(ctx) {
|
|
4090
4072
|
let result = Query.empty();
|
|
4091
4073
|
if (ctx.typeEntity !== void 0) {
|
|
4092
|
-
const displayService_ = new DisplayService(
|
|
4093
|
-
this.analyzer,
|
|
4094
|
-
ctx.sourceLocale,
|
|
4095
|
-
this.dialect,
|
|
4096
|
-
this.sourceFile
|
|
4097
|
-
);
|
|
4098
4074
|
if (ctx.translationKind === 1 /* Method */) {
|
|
4099
4075
|
result = Query.from(ctx.typeEntity.getMembers().getNamedMembers()).mapAndFilter((m) => {
|
|
4100
4076
|
if (m.kind === 1 /* Function */) {
|
|
4101
|
-
return new
|
|
4077
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4102
4078
|
this.completionItemInfoContext,
|
|
4103
4079
|
m,
|
|
4104
|
-
!ctx.hasPrecedingKeyword
|
|
4105
|
-
displayService_
|
|
4080
|
+
!ctx.hasPrecedingKeyword
|
|
4106
4081
|
);
|
|
4107
4082
|
}
|
|
4108
4083
|
return void 0;
|
|
4109
4084
|
});
|
|
4110
4085
|
} else if (ctx.translationKind === 3 /* Constructor */) {
|
|
4111
|
-
result = Query.from(ctx.typeEntity.getMembers().getConstructors()).map((c) => new
|
|
4086
|
+
result = Query.from(ctx.typeEntity.getMembers().getConstructors()).map((c) => new TranslationsSourceConstructorCompletionItemInfo(
|
|
4112
4087
|
this.completionItemInfoContext,
|
|
4113
4088
|
c,
|
|
4114
|
-
!ctx.hasPrecedingKeyword
|
|
4115
|
-
displayService_
|
|
4089
|
+
!ctx.hasPrecedingKeyword
|
|
4116
4090
|
));
|
|
4117
4091
|
} else if (ctx.translationKind === 2 /* Indexer */) {
|
|
4118
|
-
result = Query.from(ctx.typeEntity.getMembers().getIndexers()).map((i) => new
|
|
4092
|
+
result = Query.from(ctx.typeEntity.getMembers().getIndexers()).map((i) => new TranslationsSourceIndexerCompletionItemInfo(this.completionItemInfoContext, i));
|
|
4119
4093
|
} else if (ctx.translationKind === 0 /* Any */) {
|
|
4120
4094
|
result = Query.from(ctx.typeEntity.getMembers().getNamedMembers()).mapAndFilter((m) => {
|
|
4121
4095
|
if (m.kind === 0 /* Variable */) {
|
|
4122
|
-
return new
|
|
4096
|
+
return new TranslationsSourceVariableCompletionItemInfo(this.completionItemInfoContext, m);
|
|
4123
4097
|
} else if (m.kind === 1 /* Function */) {
|
|
4124
|
-
return new
|
|
4098
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4125
4099
|
this.completionItemInfoContext,
|
|
4126
4100
|
m,
|
|
4127
|
-
!ctx.hasPrecedingKeyword
|
|
4128
|
-
displayService_
|
|
4101
|
+
!ctx.hasPrecedingKeyword
|
|
4129
4102
|
);
|
|
4130
4103
|
}
|
|
4131
4104
|
return void 0;
|
|
4132
4105
|
}).chain(
|
|
4133
|
-
ctx.typeEntity.getMembers().getConstructors().map((c) => new
|
|
4106
|
+
ctx.typeEntity.getMembers().getConstructors().map((c) => new TranslationsSourceConstructorCompletionItemInfo(
|
|
4134
4107
|
this.completionItemInfoContext,
|
|
4135
4108
|
c,
|
|
4136
|
-
!ctx.hasPrecedingKeyword
|
|
4137
|
-
displayService_
|
|
4109
|
+
!ctx.hasPrecedingKeyword
|
|
4138
4110
|
))
|
|
4139
4111
|
).chain(
|
|
4140
|
-
ctx.typeEntity.getMembers().getIndexers().map((i) => new
|
|
4112
|
+
ctx.typeEntity.getMembers().getIndexers().map((i) => new TranslationsSourceIndexerCompletionItemInfo(this.completionItemInfoContext, i))
|
|
4141
4113
|
);
|
|
4142
4114
|
} else {
|
|
4143
4115
|
Debug.never(ctx.translationKind);
|
|
@@ -4149,7 +4121,7 @@ var CompletionService = class {
|
|
|
4149
4121
|
31 /* Creation */
|
|
4150
4122
|
];
|
|
4151
4123
|
result = result.chain(
|
|
4152
|
-
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k,
|
|
4124
|
+
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))).flatMap((i) => i)
|
|
4153
4125
|
);
|
|
4154
4126
|
}
|
|
4155
4127
|
return result.toArray();
|
|
@@ -4203,7 +4175,7 @@ var CompletionService = class {
|
|
|
4203
4175
|
const seenLabels = /* @__PURE__ */ new Set();
|
|
4204
4176
|
const result = new Array();
|
|
4205
4177
|
for (const completionItemInfo of completionItemInfos) {
|
|
4206
|
-
if (completionItemInfo.kind === "
|
|
4178
|
+
if (completionItemInfo.kind === "translations-source-function" || completionItemInfo.kind === "translations-source-package-type") {
|
|
4207
4179
|
result.push(completionItemInfo);
|
|
4208
4180
|
continue;
|
|
4209
4181
|
}
|
|
@@ -4397,8 +4369,7 @@ var ExpressionCompletionContext = class {
|
|
|
4397
4369
|
}
|
|
4398
4370
|
};
|
|
4399
4371
|
var TopLevelTranslationListCompletionContext = class {
|
|
4400
|
-
constructor(
|
|
4401
|
-
this.sourceLocale = sourceLocale;
|
|
4372
|
+
constructor(packageMemberLookup, hidingMatcher, translationKind, hasPrecedingKeyword) {
|
|
4402
4373
|
this.packageMemberLookup = packageMemberLookup;
|
|
4403
4374
|
this.hidingMatcher = hidingMatcher;
|
|
4404
4375
|
this.translationKind = translationKind;
|
|
@@ -4407,8 +4378,7 @@ var TopLevelTranslationListCompletionContext = class {
|
|
|
4407
4378
|
}
|
|
4408
4379
|
};
|
|
4409
4380
|
var TypeMemberTranslationListCompletionContext = class {
|
|
4410
|
-
constructor(
|
|
4411
|
-
this.sourceLocale = sourceLocale;
|
|
4381
|
+
constructor(typeEntity, hidingMatcher, translationKind, hasPrecedingKeyword) {
|
|
4412
4382
|
this.typeEntity = typeEntity;
|
|
4413
4383
|
this.hidingMatcher = hidingMatcher;
|
|
4414
4384
|
this.translationKind = translationKind;
|
|
@@ -4769,12 +4739,11 @@ var TargetSignatureParameterCompletionItemInfo = class {
|
|
|
4769
4739
|
return void 0;
|
|
4770
4740
|
}
|
|
4771
4741
|
};
|
|
4772
|
-
var
|
|
4773
|
-
constructor(ctx, variable
|
|
4742
|
+
var TranslationsSourceVariableCompletionItemInfo = class {
|
|
4743
|
+
constructor(ctx, variable) {
|
|
4774
4744
|
this.ctx = ctx;
|
|
4775
4745
|
this.variable = variable;
|
|
4776
|
-
this.
|
|
4777
|
-
this.kind = "aliases-source-variable";
|
|
4746
|
+
this.kind = "translations-source-variable";
|
|
4778
4747
|
}
|
|
4779
4748
|
getLabel() {
|
|
4780
4749
|
return this.ctx.getInsertTextForName(this.variable.getName());
|
|
@@ -4794,7 +4763,7 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
|
4794
4763
|
}
|
|
4795
4764
|
}
|
|
4796
4765
|
getDetails() {
|
|
4797
|
-
return this.displayService.displayEntity(this.variable);
|
|
4766
|
+
return this.ctx.displayService.displayEntity(this.variable);
|
|
4798
4767
|
}
|
|
4799
4768
|
getInsertText() {
|
|
4800
4769
|
return void 0;
|
|
@@ -4806,13 +4775,12 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
|
4806
4775
|
return void 0;
|
|
4807
4776
|
}
|
|
4808
4777
|
};
|
|
4809
|
-
var
|
|
4810
|
-
constructor(ctx, func, includeFunctionKeyword
|
|
4778
|
+
var TranslationsSourceFunctionCompletionItemInfo = class {
|
|
4779
|
+
constructor(ctx, func, includeFunctionKeyword) {
|
|
4811
4780
|
this.ctx = ctx;
|
|
4812
4781
|
this.func = func;
|
|
4813
4782
|
this.includeFunctionKeyword = includeFunctionKeyword;
|
|
4814
|
-
this.
|
|
4815
|
-
this.kind = "aliases-source-function";
|
|
4783
|
+
this.kind = "translations-source-function";
|
|
4816
4784
|
}
|
|
4817
4785
|
getLabel() {
|
|
4818
4786
|
return this.ctx.getInsertTextForName(this.func.getName());
|
|
@@ -4830,15 +4798,14 @@ var AliasesSourceFunctionCompletionItemInfo = class {
|
|
|
4830
4798
|
}
|
|
4831
4799
|
}
|
|
4832
4800
|
getDetails() {
|
|
4833
|
-
return this.displayService.displayFunctionDeclaration(new FunctionDeclaration_entity(this.func));
|
|
4801
|
+
return this.ctx.displayService.displayFunctionDeclaration(new FunctionDeclaration_entity(this.func));
|
|
4834
4802
|
}
|
|
4835
4803
|
getInsertText() {
|
|
4836
|
-
const
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
const
|
|
4840
|
-
|
|
4841
|
-
return keywordWithWhitespace + displayParts.name + displayParts.typeParametersStart + displayParts.typeParameters.join(displayParts.typeParameterSeparator) + displayParts.typeParametersEnd + displayParts.parametersStart + parameters + displayParts.parametersEnd;
|
|
4804
|
+
const keywordWithWhitespace = this.includeFunctionKeyword ? `${this.ctx.displayService.displayKeyword(12 /* Function */)} ` : "";
|
|
4805
|
+
const typeParameters = this.func.getTypeParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4806
|
+
const typeParametersWithAngles = typeParameters.length > 0 ? `<${typeParameters}>` : "";
|
|
4807
|
+
const parameters = this.func.getParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4808
|
+
return `${keywordWithWhitespace}${this.ctx.getInsertTextForName(this.func.getName())}${typeParametersWithAngles}(${parameters})`;
|
|
4842
4809
|
}
|
|
4843
4810
|
getSortText() {
|
|
4844
4811
|
return void 0;
|
|
@@ -4847,13 +4814,12 @@ var AliasesSourceFunctionCompletionItemInfo = class {
|
|
|
4847
4814
|
return void 0;
|
|
4848
4815
|
}
|
|
4849
4816
|
};
|
|
4850
|
-
var
|
|
4851
|
-
constructor(ctx, typeEntity, includeTypeKeyword
|
|
4817
|
+
var TranslationsSourcePackageTypeCompletionItemInfo = class {
|
|
4818
|
+
constructor(ctx, typeEntity, includeTypeKeyword) {
|
|
4852
4819
|
this.ctx = ctx;
|
|
4853
4820
|
this.typeEntity = typeEntity;
|
|
4854
4821
|
this.includeTypeKeyword = includeTypeKeyword;
|
|
4855
|
-
this.
|
|
4856
|
-
this.kind = "aliases-source-package-type";
|
|
4822
|
+
this.kind = "translations-source-package-type";
|
|
4857
4823
|
}
|
|
4858
4824
|
getLabel() {
|
|
4859
4825
|
return this.ctx.getInsertTextForName(this.typeEntity.getName());
|
|
@@ -4883,13 +4849,18 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
|
4883
4849
|
}
|
|
4884
4850
|
getDetails() {
|
|
4885
4851
|
const typeDeclaration = this.getDisplayServiceTypeDeclaration();
|
|
4886
|
-
return this.displayService.displayTypeDeclaration(typeDeclaration);
|
|
4852
|
+
return this.ctx.displayService.displayTypeDeclaration(typeDeclaration);
|
|
4887
4853
|
}
|
|
4888
4854
|
getInsertText() {
|
|
4889
|
-
const
|
|
4890
|
-
const
|
|
4891
|
-
const
|
|
4892
|
-
|
|
4855
|
+
const keywordWithWhitespace = this.includeTypeKeyword ? `${this.ctx.displayService.displayKeyword(16 /* Type */)} ` : "";
|
|
4856
|
+
const typeParameters = this.typeEntity.getTypeParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4857
|
+
const typeParametersWithAngles = typeParameters.length > 0 ? `<${typeParameters}>` : "";
|
|
4858
|
+
let result = `${keywordWithWhitespace}${this.ctx.getInsertTextForName(this.typeEntity.getName())}${typeParametersWithAngles}`;
|
|
4859
|
+
if (this.typeEntity.typeEntityKind === 0 /* Function */) {
|
|
4860
|
+
const parameters = this.typeEntity.getParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4861
|
+
result = `${result}(${parameters})`;
|
|
4862
|
+
}
|
|
4863
|
+
return result;
|
|
4893
4864
|
}
|
|
4894
4865
|
getSortText() {
|
|
4895
4866
|
return void 0;
|
|
@@ -4920,16 +4891,15 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
|
4920
4891
|
return void 0;
|
|
4921
4892
|
}
|
|
4922
4893
|
};
|
|
4923
|
-
var
|
|
4924
|
-
constructor(ctx, indexer
|
|
4894
|
+
var TranslationsSourceIndexerCompletionItemInfo = class {
|
|
4895
|
+
constructor(ctx, indexer) {
|
|
4925
4896
|
this.ctx = ctx;
|
|
4926
4897
|
this.indexer = indexer;
|
|
4927
|
-
this.
|
|
4928
|
-
this.kind = "aliases-source-type-indexer";
|
|
4898
|
+
this.kind = "translations-source-type-indexer";
|
|
4929
4899
|
this.label_ = new Cached();
|
|
4930
4900
|
}
|
|
4931
4901
|
get label() {
|
|
4932
|
-
return this.label_.getOrInsertWith(() => this.displayService.displayIndexerDeclaration(new IndexerDeclaration_entity(this.indexer)));
|
|
4902
|
+
return this.label_.getOrInsertWith(() => this.ctx.displayService.displayIndexerDeclaration(new IndexerDeclaration_entity(this.indexer)));
|
|
4933
4903
|
}
|
|
4934
4904
|
getLabel() {
|
|
4935
4905
|
return this.label;
|
|
@@ -4951,20 +4921,19 @@ var AliasesSourceIndexerCompletionItemInfo = class {
|
|
|
4951
4921
|
return void 0;
|
|
4952
4922
|
}
|
|
4953
4923
|
};
|
|
4954
|
-
var
|
|
4955
|
-
constructor(ctx, constructor_, includeOnCreateKeyword
|
|
4924
|
+
var TranslationsSourceConstructorCompletionItemInfo = class {
|
|
4925
|
+
constructor(ctx, constructor_, includeOnCreateKeyword) {
|
|
4956
4926
|
this.ctx = ctx;
|
|
4957
4927
|
this.constructor_ = constructor_;
|
|
4958
4928
|
this.includeOnCreateKeyword = includeOnCreateKeyword;
|
|
4959
|
-
this.
|
|
4960
|
-
this.kind = "aliases-source-type-constructor";
|
|
4929
|
+
this.kind = "translations-source-type-constructor";
|
|
4961
4930
|
this.label_ = new Cached();
|
|
4962
4931
|
}
|
|
4963
4932
|
get label() {
|
|
4964
4933
|
return this.label_.getOrInsertWith(() => {
|
|
4965
4934
|
const constructorDeclaration = new ConstructorDeclaration_entity(this.constructor_);
|
|
4966
|
-
const displayParts = this.displayService.getConstructorDeclarationDisplayParts(constructorDeclaration);
|
|
4967
|
-
const creationKeyword = this.displayService.displayKeyword(31 /* Creation */);
|
|
4935
|
+
const displayParts = this.ctx.displayService.getConstructorDeclarationDisplayParts(constructorDeclaration);
|
|
4936
|
+
const creationKeyword = this.ctx.displayService.displayKeyword(31 /* Creation */);
|
|
4968
4937
|
return creationKeyword + displayParts.parametersStart + displayParts.parameters.map((p) => p.toString()).join(displayParts.parameterSeparator) + displayParts.parametersEnd;
|
|
4969
4938
|
});
|
|
4970
4939
|
}
|
|
@@ -4978,7 +4947,7 @@ var AliasesSourceConstructorCompletionItemInfo = class {
|
|
|
4978
4947
|
return this.label;
|
|
4979
4948
|
}
|
|
4980
4949
|
getInsertText() {
|
|
4981
|
-
const creationKeyword = this.includeOnCreateKeyword ? this.displayService.displayKeyword(31 /* Creation */) : "";
|
|
4950
|
+
const creationKeyword = this.includeOnCreateKeyword ? this.ctx.displayService.displayKeyword(31 /* Creation */) : "";
|
|
4982
4951
|
const parameters = this.constructor_.getParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4983
4952
|
return `${creationKeyword}(${parameters})`;
|
|
4984
4953
|
}
|
|
@@ -5696,8 +5665,8 @@ var NodeSemanticInfoService = class {
|
|
|
5696
5665
|
return void 0;
|
|
5697
5666
|
}
|
|
5698
5667
|
static ofRegularOrBlockFunctionLiteral(analyzer, node) {
|
|
5699
|
-
const
|
|
5700
|
-
return new
|
|
5668
|
+
const entity = analyzer.entity.ofRegularOrBlockFunctionLiteral(node);
|
|
5669
|
+
return new DefinitionNodeSemanticInfo(entity);
|
|
5701
5670
|
}
|
|
5702
5671
|
static ofDefaultMatchExpression(analyzer, node) {
|
|
5703
5672
|
const type = analyzer.type.ofExpression(node);
|
|
@@ -6437,7 +6406,7 @@ var NodeSemanticInfoService = class {
|
|
|
6437
6406
|
let result;
|
|
6438
6407
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6439
6408
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6440
|
-
if (translationTargets !== void 0) {
|
|
6409
|
+
if (translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6441
6410
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6442
6411
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6443
6412
|
if (options6.includeBetterReferenceTargets) {
|
|
@@ -6450,7 +6419,7 @@ var NodeSemanticInfoService = class {
|
|
|
6450
6419
|
let result;
|
|
6451
6420
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6452
6421
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6453
|
-
if (translationPackage !== void 0 && translationTargets !== void 0) {
|
|
6422
|
+
if (translationPackage !== void 0 && translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6454
6423
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(
|
|
6455
6424
|
translationPackage.localizationContext.getLocalizedTypeMemberEntity(t),
|
|
6456
6425
|
0 /* Get */
|
|
@@ -6466,7 +6435,7 @@ var NodeSemanticInfoService = class {
|
|
|
6466
6435
|
let result;
|
|
6467
6436
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6468
6437
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6469
|
-
if (translationTargets !== void 0) {
|
|
6438
|
+
if (translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6470
6439
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6471
6440
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6472
6441
|
if (options6.includeBetterReferenceTargets) {
|
|
@@ -6479,7 +6448,7 @@ var NodeSemanticInfoService = class {
|
|
|
6479
6448
|
let result;
|
|
6480
6449
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6481
6450
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6482
|
-
if (translationPackage !== void 0 && translationTargets !== void 0) {
|
|
6451
|
+
if (translationPackage !== void 0 && translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6483
6452
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(
|
|
6484
6453
|
translationPackage.localizationContext.getLocalizedTypeMemberEntity(t),
|
|
6485
6454
|
0 /* Get */
|
|
@@ -6807,12 +6776,6 @@ var DefaultSwitchMatchNodeSemanticInfo = class {
|
|
|
6807
6776
|
this.kind = "default-switch-match";
|
|
6808
6777
|
}
|
|
6809
6778
|
};
|
|
6810
|
-
var RegularOrBlockFunctionLiteralNodeSemanticInfo = class {
|
|
6811
|
-
constructor(type) {
|
|
6812
|
-
this.type = type;
|
|
6813
|
-
this.kind = "regular-or-block-function-literal";
|
|
6814
|
-
}
|
|
6815
|
-
};
|
|
6816
6779
|
|
|
6817
6780
|
// source/services/Utils.ts
|
|
6818
6781
|
function getEntitySourceLocations(analyzer, entity) {
|
|
@@ -6921,6 +6884,12 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
|
6921
6884
|
case 49 /* DereferencedVariableSetterDeclaration */:
|
|
6922
6885
|
range = node.caretToken.rangeWithoutTrivia;
|
|
6923
6886
|
break;
|
|
6887
|
+
case 65 /* FunctionLiteral */:
|
|
6888
|
+
range = node.functionKeyword.rangeWithoutTrivia;
|
|
6889
|
+
break;
|
|
6890
|
+
case 66 /* FunctionBlockLiteral */:
|
|
6891
|
+
range = node.block.openBraceToken.rangeWithoutTrivia;
|
|
6892
|
+
break;
|
|
6924
6893
|
default:
|
|
6925
6894
|
Debug.never(node);
|
|
6926
6895
|
}
|
|
@@ -6945,7 +6914,7 @@ var DefinitionService = class {
|
|
|
6945
6914
|
constructor(sourceGenerationService) {
|
|
6946
6915
|
this.sourceGenerationService = sourceGenerationService;
|
|
6947
6916
|
}
|
|
6948
|
-
getDefinition(analyzer, sourceFile, offset,
|
|
6917
|
+
getDefinition(analyzer, sourceFile, offset, taskController) {
|
|
6949
6918
|
return __async(this, null, function* () {
|
|
6950
6919
|
const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSingleWithHighestPriority((t) => {
|
|
6951
6920
|
if (t.isToken(10 /* Identifier */) || t.isKeyword()) {
|
|
@@ -6982,8 +6951,6 @@ var DefinitionService = class {
|
|
|
6982
6951
|
}
|
|
6983
6952
|
case "default-switch-match":
|
|
6984
6953
|
break;
|
|
6985
|
-
case "regular-or-block-function-literal":
|
|
6986
|
-
break;
|
|
6987
6954
|
default:
|
|
6988
6955
|
Debug.never(semanticInfo);
|
|
6989
6956
|
}
|
|
@@ -6995,7 +6962,7 @@ var DefinitionService = class {
|
|
|
6995
6962
|
const locations = yield this.sourceGenerationService.getDefinitionInGeneratedCode(
|
|
6996
6963
|
analyzer,
|
|
6997
6964
|
referencedEntity,
|
|
6998
|
-
|
|
6965
|
+
taskController
|
|
6999
6966
|
);
|
|
7000
6967
|
if (locations !== void 0) {
|
|
7001
6968
|
sourceLocations.push(...locations);
|
|
@@ -7179,7 +7146,7 @@ var DefinitionsAndReferenceInfo = class {
|
|
|
7179
7146
|
|
|
7180
7147
|
// source/services/ReferencesService.ts
|
|
7181
7148
|
var ReferencesService = class {
|
|
7182
|
-
getReferencesInCompilation(analyzer, sourceFile, offset, options6,
|
|
7149
|
+
getReferencesInCompilation(analyzer, sourceFile, offset, options6, taskController) {
|
|
7183
7150
|
return __async(this, null, function* () {
|
|
7184
7151
|
return this.getReferencesInFiles(
|
|
7185
7152
|
analyzer,
|
|
@@ -7187,11 +7154,11 @@ var ReferencesService = class {
|
|
|
7187
7154
|
offset,
|
|
7188
7155
|
analyzer.compilation.enumerateSourceFiles(),
|
|
7189
7156
|
options6,
|
|
7190
|
-
|
|
7157
|
+
taskController
|
|
7191
7158
|
);
|
|
7192
7159
|
});
|
|
7193
7160
|
}
|
|
7194
|
-
getReferencesInFiles(analyzer, sourceFile, offset, sourceFiles, options6,
|
|
7161
|
+
getReferencesInFiles(analyzer, sourceFile, offset, sourceFiles, options6, taskController) {
|
|
7195
7162
|
return __async(this, null, function* () {
|
|
7196
7163
|
const definitions = this.getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset, options6);
|
|
7197
7164
|
if (definitions.length === 0) {
|
|
@@ -7215,11 +7182,10 @@ var ReferencesService = class {
|
|
|
7215
7182
|
};
|
|
7216
7183
|
}
|
|
7217
7184
|
for (const sourceFile2 of sourceFiles) {
|
|
7218
|
-
yield
|
|
7185
|
+
yield traverseTree(
|
|
7219
7186
|
sourceFile2.getSyntaxNode(),
|
|
7220
|
-
cancellationToken,
|
|
7221
|
-
LanguageServer.DefaultCancellationTokenThrottleTime,
|
|
7222
7187
|
true,
|
|
7188
|
+
taskController,
|
|
7223
7189
|
(node) => {
|
|
7224
7190
|
if (isIdentifier(node) && restrictions.canBeIdentifier && node.parent.kind !== 3 /* Keyword */) {
|
|
7225
7191
|
const semanticInfo = NodeSemanticInfoService.ofNonKeywordIdentifier(analyzer, node, semanticInfoOptions);
|
|
@@ -7467,6 +7433,7 @@ var ReferencesService = class {
|
|
|
7467
7433
|
}
|
|
7468
7434
|
}
|
|
7469
7435
|
}
|
|
7436
|
+
return void 0;
|
|
7470
7437
|
}
|
|
7471
7438
|
);
|
|
7472
7439
|
}
|
|
@@ -7512,8 +7479,6 @@ var ReferencesService = class {
|
|
|
7512
7479
|
return getDefinitionOfReference(info);
|
|
7513
7480
|
case "default-switch-match":
|
|
7514
7481
|
return [];
|
|
7515
|
-
case "regular-or-block-function-literal":
|
|
7516
|
-
return [];
|
|
7517
7482
|
default:
|
|
7518
7483
|
Debug.never(info);
|
|
7519
7484
|
}
|
|
@@ -7705,8 +7670,13 @@ var ReferencesService = class {
|
|
|
7705
7670
|
Debug.never(entity);
|
|
7706
7671
|
}
|
|
7707
7672
|
}
|
|
7708
|
-
case 1 /* Function */:
|
|
7709
|
-
|
|
7673
|
+
case 1 /* Function */: {
|
|
7674
|
+
const naming = entity.getNaming();
|
|
7675
|
+
if (naming.kind === "named") {
|
|
7676
|
+
return { name: naming.value };
|
|
7677
|
+
}
|
|
7678
|
+
return void 0;
|
|
7679
|
+
}
|
|
7710
7680
|
case 10 /* PackageAlias */:
|
|
7711
7681
|
return { name: entity.getName() };
|
|
7712
7682
|
case 3 /* Getter */:
|
|
@@ -7758,7 +7728,7 @@ var DocumentHighlightsService = class _DocumentHighlightsService {
|
|
|
7758
7728
|
constructor() {
|
|
7759
7729
|
this.referencesService = new ReferencesService();
|
|
7760
7730
|
}
|
|
7761
|
-
getDocumentHighlights(analyzer, sourceFile, offset,
|
|
7731
|
+
getDocumentHighlights(analyzer, sourceFile, offset, taskController) {
|
|
7762
7732
|
return __async(this, null, function* () {
|
|
7763
7733
|
const options6 = {
|
|
7764
7734
|
onlyWithSameAlias: false,
|
|
@@ -7771,7 +7741,7 @@ var DocumentHighlightsService = class _DocumentHighlightsService {
|
|
|
7771
7741
|
offset,
|
|
7772
7742
|
[sourceFile],
|
|
7773
7743
|
options6,
|
|
7774
|
-
|
|
7744
|
+
taskController
|
|
7775
7745
|
);
|
|
7776
7746
|
const result = references.map((r) => ({
|
|
7777
7747
|
range: r.range,
|
|
@@ -8012,8 +7982,6 @@ var HoverService = class {
|
|
|
8012
7982
|
`*: ${this.displayService.displayType(semanticInfo.type)}`,
|
|
8013
7983
|
tokenOrKeyword.value.rangeWithoutTrivia
|
|
8014
7984
|
);
|
|
8015
|
-
case "regular-or-block-function-literal":
|
|
8016
|
-
return new Hover(this.displayService.displayType(semanticInfo.type), tokenOrKeyword.value.rangeWithoutTrivia);
|
|
8017
7985
|
default:
|
|
8018
7986
|
Debug.never(semanticInfo);
|
|
8019
7987
|
}
|
|
@@ -8423,7 +8391,7 @@ var RenameService = class {
|
|
|
8423
8391
|
const checkResult = this.canRename(analyzer, sourceFile, offset);
|
|
8424
8392
|
return checkResult?.renameRange;
|
|
8425
8393
|
}
|
|
8426
|
-
rename(analyzer, sourceFile, offset, newText,
|
|
8394
|
+
rename(analyzer, sourceFile, offset, newText, taskController) {
|
|
8427
8395
|
return __async(this, null, function* () {
|
|
8428
8396
|
let result;
|
|
8429
8397
|
if (this.canRename(analyzer, sourceFile, offset) !== void 0) {
|
|
@@ -8440,7 +8408,7 @@ var RenameService = class {
|
|
|
8440
8408
|
offset,
|
|
8441
8409
|
sourceFiles,
|
|
8442
8410
|
options6,
|
|
8443
|
-
|
|
8411
|
+
taskController
|
|
8444
8412
|
);
|
|
8445
8413
|
result = references.map((r) => new Rename(r.sourceFile, r.range, newText));
|
|
8446
8414
|
} else {
|
|
@@ -8601,27 +8569,26 @@ var SelectionRange = class {
|
|
|
8601
8569
|
|
|
8602
8570
|
// source/services/SemanticTokensService.ts
|
|
8603
8571
|
var SemanticTokensService = class {
|
|
8604
|
-
getSemanticTokens(analyzer, sourceFile,
|
|
8572
|
+
getSemanticTokens(analyzer, sourceFile, taskController) {
|
|
8605
8573
|
return __async(this, null, function* () {
|
|
8606
8574
|
return this.getSemanticTokensInRange(
|
|
8607
8575
|
analyzer,
|
|
8608
8576
|
sourceFile,
|
|
8609
8577
|
sourceFile.getSyntaxNode().rangeWithTrivia,
|
|
8610
|
-
|
|
8578
|
+
taskController
|
|
8611
8579
|
);
|
|
8612
8580
|
});
|
|
8613
8581
|
}
|
|
8614
|
-
getSemanticTokensInRange(analyzer, sourceFile, range,
|
|
8582
|
+
getSemanticTokensInRange(analyzer, sourceFile, range, taskController) {
|
|
8615
8583
|
return __async(this, null, function* () {
|
|
8616
8584
|
const result = new Array();
|
|
8617
|
-
yield
|
|
8585
|
+
yield traverseTree(
|
|
8618
8586
|
sourceFile.getSyntaxNode(),
|
|
8619
|
-
cancellationToken,
|
|
8620
|
-
LanguageServer.DefaultCancellationTokenThrottleTime,
|
|
8621
8587
|
false,
|
|
8588
|
+
taskController,
|
|
8622
8589
|
(node, controller) => {
|
|
8623
8590
|
if (!this.rangesOverlap(range, node.rangeWithoutTrivia)) {
|
|
8624
|
-
controller.
|
|
8591
|
+
controller.skipChildrenTraverse();
|
|
8625
8592
|
return;
|
|
8626
8593
|
}
|
|
8627
8594
|
if (node.kind === 89 /* IdentifierExpression */) {
|
|
@@ -8665,7 +8632,7 @@ var SemanticTokensService = class {
|
|
|
8665
8632
|
result.push(
|
|
8666
8633
|
new SemanticToken(
|
|
8667
8634
|
node.rangeWithoutTrivia,
|
|
8668
|
-
this.
|
|
8635
|
+
this.getSemanticTokenKindForNamedFunctionEntity(func.getEntity()),
|
|
8669
8636
|
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(func.value.getName()))
|
|
8670
8637
|
)
|
|
8671
8638
|
);
|
|
@@ -8709,7 +8676,7 @@ var SemanticTokensService = class {
|
|
|
8709
8676
|
result.push(
|
|
8710
8677
|
new SemanticToken(
|
|
8711
8678
|
node.memberName.rangeWithoutTrivia,
|
|
8712
|
-
this.
|
|
8679
|
+
this.getSemanticTokenKindForNamedFunctionEntity(func.getEntity()),
|
|
8713
8680
|
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(func.getName()))
|
|
8714
8681
|
)
|
|
8715
8682
|
);
|
|
@@ -8759,6 +8726,7 @@ var SemanticTokensService = class {
|
|
|
8759
8726
|
new SemanticToken(node.name.rangeWithoutTrivia, 7 /* Operator */, new SemanticTokenModifiers().makeDeclaration())
|
|
8760
8727
|
);
|
|
8761
8728
|
}
|
|
8729
|
+
return void 0;
|
|
8762
8730
|
}
|
|
8763
8731
|
);
|
|
8764
8732
|
return result.sort((t1, t2) => t1.range.start - t2.range.end);
|
|
@@ -8767,7 +8735,7 @@ var SemanticTokensService = class {
|
|
|
8767
8735
|
rangesOverlap(range1, range2) {
|
|
8768
8736
|
return range1.start < range2.end && range1.end > range2.start;
|
|
8769
8737
|
}
|
|
8770
|
-
|
|
8738
|
+
getSemanticTokenKindForNamedFunctionEntity(entity) {
|
|
8771
8739
|
switch (entity.subkind) {
|
|
8772
8740
|
case "package":
|
|
8773
8741
|
return 4 /* PackageFunction */;
|
|
@@ -9577,6 +9545,30 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9577
9545
|
get state() {
|
|
9578
9546
|
return this.state_;
|
|
9579
9547
|
}
|
|
9548
|
+
waitFullyLoadedAndConfigsProcessed(taskController) {
|
|
9549
|
+
return __async(this, null, function* () {
|
|
9550
|
+
yield this.waitFullyLoaded();
|
|
9551
|
+
while (!this.hasAllConfigsProcessed()) {
|
|
9552
|
+
if (taskController.shouldYieldOnceOutOf100()) {
|
|
9553
|
+
yield taskController.yieldTask();
|
|
9554
|
+
}
|
|
9555
|
+
taskController.throwIfCancellationRequested();
|
|
9556
|
+
}
|
|
9557
|
+
});
|
|
9558
|
+
}
|
|
9559
|
+
hasAllConfigsProcessed() {
|
|
9560
|
+
switch (this.state) {
|
|
9561
|
+
case 2 /* ProcessedPackageConfigsWithErrors */:
|
|
9562
|
+
case 3 /* LoadedMainCompilation */:
|
|
9563
|
+
case 4 /* ErrorsCreatingAnalyzer */:
|
|
9564
|
+
return true;
|
|
9565
|
+
case 0 /* Created */:
|
|
9566
|
+
case 1 /* ProcessingInitialPackageConfigs */:
|
|
9567
|
+
return false;
|
|
9568
|
+
default:
|
|
9569
|
+
Debug.never(this.state);
|
|
9570
|
+
}
|
|
9571
|
+
}
|
|
9580
9572
|
waitFullyLoaded() {
|
|
9581
9573
|
return __async(this, null, function* () {
|
|
9582
9574
|
yield Transaction.outside(() => __async(this, null, function* () {
|
|
@@ -9654,12 +9646,14 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9654
9646
|
// Включаем логирование только при первой загрузке.
|
|
9655
9647
|
additionalPackageContents: this.config.additionalPackageContents
|
|
9656
9648
|
};
|
|
9649
|
+
const currentTransaction = Transaction.current;
|
|
9657
9650
|
const loadResult = yield runNonReactively(() => __async(this, null, function* () {
|
|
9651
|
+
const taskController = new TaskController(50, new GenericCancellationToken(() => currentTransaction.isCanceled));
|
|
9658
9652
|
return yield CompilationLoader.loadFromFileSystemTree(
|
|
9659
9653
|
this.rootDirectory,
|
|
9660
9654
|
this.fileSystemTree,
|
|
9661
|
-
|
|
9662
|
-
|
|
9655
|
+
taskController,
|
|
9656
|
+
loaderOptions
|
|
9663
9657
|
);
|
|
9664
9658
|
}));
|
|
9665
9659
|
this.previousCompilationLoadResult = loadResult;
|
|
@@ -9903,7 +9897,7 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9903
9897
|
if (compilationState === void 0) {
|
|
9904
9898
|
return;
|
|
9905
9899
|
}
|
|
9906
|
-
const
|
|
9900
|
+
const taskController = new TaskController(50, new GenericCancellationToken(() => currentTransaction.isCanceled));
|
|
9907
9901
|
try {
|
|
9908
9902
|
for (const package_ of compilationState.analyzer.compilation.userPackages) {
|
|
9909
9903
|
for (const sourceFile of package_.sourceFiles) {
|
|
@@ -9912,7 +9906,7 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9912
9906
|
}
|
|
9913
9907
|
const diagnostics = yield compilationState.collectSourceFileDiagnosticsWithLowPriority(
|
|
9914
9908
|
sourceFile,
|
|
9915
|
-
|
|
9909
|
+
taskController
|
|
9916
9910
|
);
|
|
9917
9911
|
if (currentTransaction.isCanceled) {
|
|
9918
9912
|
return;
|
|
@@ -10101,36 +10095,36 @@ var ReadonlyCompilationState = class {
|
|
|
10101
10095
|
this.version = version;
|
|
10102
10096
|
this.diagnosticsCollectionSummaryByUri = /* @__PURE__ */ new Map();
|
|
10103
10097
|
}
|
|
10104
|
-
collectSourceFileDiagnosticsWithHighPriority(sourceFile,
|
|
10098
|
+
collectSourceFileDiagnosticsWithHighPriority(sourceFile, taskController) {
|
|
10105
10099
|
return __async(this, null, function* () {
|
|
10106
|
-
const { diagnostics, summary } = yield this.
|
|
10100
|
+
const { diagnostics, summary } = yield this.analyzeSourceFile(sourceFile, taskController);
|
|
10107
10101
|
this.diagnosticsCollectionSummaryByUri.set(sourceFile.uri.toString(), summary);
|
|
10108
10102
|
return diagnostics;
|
|
10109
10103
|
});
|
|
10110
10104
|
}
|
|
10111
|
-
collectSourceFileDiagnosticsWithLowPriority(sourceFile,
|
|
10105
|
+
collectSourceFileDiagnosticsWithLowPriority(sourceFile, taskController) {
|
|
10112
10106
|
return __async(this, null, function* () {
|
|
10113
10107
|
yield highPriorityDiagnosticsCollectionIndicator.whenIdle();
|
|
10114
|
-
const { diagnostics, summary } = yield this.
|
|
10108
|
+
const { diagnostics, summary } = yield this.analyzeSourceFile(sourceFile, taskController);
|
|
10115
10109
|
this.diagnosticsCollectionSummaryByUri.set(sourceFile.uri.toString(), summary);
|
|
10116
10110
|
return diagnostics;
|
|
10117
10111
|
});
|
|
10118
10112
|
}
|
|
10119
|
-
getDiagnosticsCollectionSummary(sourceFile,
|
|
10113
|
+
getDiagnosticsCollectionSummary(sourceFile, taskController) {
|
|
10120
10114
|
return __async(this, null, function* () {
|
|
10121
10115
|
let result = this.diagnosticsCollectionSummaryByUri.get(sourceFile.uri.toString());
|
|
10122
10116
|
if (result === void 0) {
|
|
10123
|
-
const { summary } = yield this.
|
|
10117
|
+
const { summary } = yield this.analyzeSourceFile(sourceFile, taskController);
|
|
10124
10118
|
result = summary;
|
|
10125
10119
|
this.diagnosticsCollectionSummaryByUri.set(sourceFile.uri.toString(), summary);
|
|
10126
10120
|
}
|
|
10127
10121
|
return result;
|
|
10128
10122
|
});
|
|
10129
10123
|
}
|
|
10130
|
-
|
|
10124
|
+
analyzeSourceFile(sourceFile, taskController) {
|
|
10131
10125
|
return __async(this, null, function* () {
|
|
10132
|
-
const
|
|
10133
|
-
const diagnostics = yield
|
|
10126
|
+
const sourceFileAnalyzer = new SourceFileAnalyzer(this.analyzer, sourceFile);
|
|
10127
|
+
const diagnostics = yield sourceFileAnalyzer.analyze(taskController);
|
|
10134
10128
|
const summary = this.createDiagnosticsCollectionSummary(diagnostics);
|
|
10135
10129
|
return { diagnostics, summary };
|
|
10136
10130
|
});
|
|
@@ -10503,9 +10497,9 @@ var FileSystemTreeProviderBasedOnWatchedFileSystem = class extends ObservableObj
|
|
|
10503
10497
|
this.trackedSourceFiles = trackedSourceFiles;
|
|
10504
10498
|
this.isInitialized = true;
|
|
10505
10499
|
}
|
|
10506
|
-
waitLoaded(
|
|
10500
|
+
waitLoaded(taskController) {
|
|
10507
10501
|
return __async(this, null, function* () {
|
|
10508
|
-
yield this.taskQueue.waitAllTasksProcessed(
|
|
10502
|
+
yield this.taskQueue.waitAllTasksProcessed(taskController);
|
|
10509
10503
|
});
|
|
10510
10504
|
}
|
|
10511
10505
|
dispose() {
|
|
@@ -10850,7 +10844,7 @@ var FileSystemTreeProviderBasedOnWatchedFileSystem = class extends ObservableObj
|
|
|
10850
10844
|
const directory = this.fileSystemTree.getDirectory(uri);
|
|
10851
10845
|
if (directory !== void 0) {
|
|
10852
10846
|
this.loadedDirectoryUris.delete(directory.uri.toString());
|
|
10853
|
-
for (const descendant of directory.
|
|
10847
|
+
for (const descendant of directory.getFlatChildren()) {
|
|
10854
10848
|
if (descendant.kind === "directory" && this.loadedDirectoryUris.has(descendant.uri.toString())) {
|
|
10855
10849
|
this.loadedDirectoryUris.delete(descendant.uri.toString());
|
|
10856
10850
|
}
|
|
@@ -11134,19 +11128,19 @@ var TaskQueue = class extends ObservableObject3 {
|
|
|
11134
11128
|
disposeObservableObject3(this.tasks);
|
|
11135
11129
|
disposeObservableObject3(this);
|
|
11136
11130
|
}
|
|
11137
|
-
waitAllTasksProcessed(
|
|
11131
|
+
waitAllTasksProcessed(taskController) {
|
|
11138
11132
|
return __async(this, null, function* () {
|
|
11139
11133
|
yield Transaction2.outside(() => __async(this, null, function* () {
|
|
11140
11134
|
while (this.tasks.length > 0 || this.currentTask !== void 0) {
|
|
11141
11135
|
if (!(this.processTasksIndicator.isBusy || this.executeTaskIndicator.isBusy)) {
|
|
11142
|
-
yield
|
|
11136
|
+
yield yieldTask();
|
|
11143
11137
|
if (!(this.processTasksIndicator.isBusy || this.executeTaskIndicator.isBusy)) {
|
|
11144
11138
|
return;
|
|
11145
11139
|
}
|
|
11146
11140
|
}
|
|
11147
11141
|
yield this.processTasksIndicator.whenIdle();
|
|
11148
11142
|
yield this.executeTaskIndicator.whenIdle();
|
|
11149
|
-
|
|
11143
|
+
taskController?.throwIfCancellationRequested();
|
|
11150
11144
|
}
|
|
11151
11145
|
}));
|
|
11152
11146
|
});
|
|
@@ -11211,7 +11205,7 @@ var ManuallyUpdatedFileSystemTreeProvider = class extends ObservableObject4 {
|
|
|
11211
11205
|
this.workspaceFolderUris = workspaceFolderUris;
|
|
11212
11206
|
this.trackedSourceFiles = trackedSourceFiles;
|
|
11213
11207
|
}
|
|
11214
|
-
waitLoaded(
|
|
11208
|
+
waitLoaded(_taskController) {
|
|
11215
11209
|
return Promise.resolve();
|
|
11216
11210
|
}
|
|
11217
11211
|
dispose() {
|
|
@@ -11404,9 +11398,9 @@ var WorkspaceFiles = class extends ObservableObject5 {
|
|
|
11404
11398
|
}
|
|
11405
11399
|
this.trackedSourceFiles.close(uri);
|
|
11406
11400
|
}
|
|
11407
|
-
waitLoaded(
|
|
11401
|
+
waitLoaded(taskController) {
|
|
11408
11402
|
return __async(this, null, function* () {
|
|
11409
|
-
yield this.fileSystemTreeProvider.waitLoaded(
|
|
11403
|
+
yield this.fileSystemTreeProvider.waitLoaded(taskController);
|
|
11410
11404
|
});
|
|
11411
11405
|
}
|
|
11412
11406
|
dispose() {
|
|
@@ -11544,12 +11538,12 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11544
11538
|
notifyClosedTextDocument(uri) {
|
|
11545
11539
|
this.files.stopTrackingSourceFile(uri);
|
|
11546
11540
|
}
|
|
11547
|
-
waitLoadedAndGetWorkspaceElementInfo(uri,
|
|
11541
|
+
waitLoadedAndGetWorkspaceElementInfo(uri, taskController) {
|
|
11548
11542
|
return __async(this, null, function* () {
|
|
11549
|
-
yield this.files.waitLoaded(
|
|
11543
|
+
yield this.files.waitLoaded(taskController);
|
|
11550
11544
|
const controllerGroups = [
|
|
11551
|
-
this.compilationControllers_.filter((c) =>
|
|
11552
|
-
this.compilationControllers_.filter((c) => !
|
|
11545
|
+
this.compilationControllers_.filter((c) => c.hasAllConfigsProcessed()),
|
|
11546
|
+
this.compilationControllers_.filter((c) => !c.hasAllConfigsProcessed())
|
|
11553
11547
|
];
|
|
11554
11548
|
let result = yield findWorkspaceElement(this, true);
|
|
11555
11549
|
if (result === void 0) {
|
|
@@ -11560,7 +11554,7 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11560
11554
|
return __async(this, null, function* () {
|
|
11561
11555
|
for (const group of controllerGroups) {
|
|
11562
11556
|
for (const controller of group) {
|
|
11563
|
-
yield
|
|
11557
|
+
yield controller.waitFullyLoadedAndConfigsProcessed(taskController);
|
|
11564
11558
|
const state = yield controller.getStateOfCompilationContainingItemAtUri(uri);
|
|
11565
11559
|
if (state !== void 0) {
|
|
11566
11560
|
const sourceFile = state.analyzer.compilation.getSourceFileByUri(uri);
|
|
@@ -11586,14 +11580,14 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11586
11580
|
}
|
|
11587
11581
|
});
|
|
11588
11582
|
}
|
|
11589
|
-
getStandardPackageContents(
|
|
11583
|
+
getStandardPackageContents(taskController) {
|
|
11590
11584
|
return __async(this, null, function* () {
|
|
11591
11585
|
return this.standardPackageContents.getOrInsertWith(() => __async(this, null, function* () {
|
|
11592
11586
|
if (this.config.builtInStandardPackagesUri !== void 0) {
|
|
11593
|
-
yield this.files.waitLoaded(
|
|
11587
|
+
yield this.files.waitLoaded(taskController);
|
|
11594
11588
|
const directory = this.files.fileSystemTree.getDirectory(this.config.builtInStandardPackagesUri);
|
|
11595
11589
|
if (directory !== void 0 && Query.from(directory.getChildren()).count() > 0) {
|
|
11596
|
-
return yield createPackageContentsFromFSTree(directory, this.files.fileSystemTree);
|
|
11590
|
+
return yield createPackageContentsFromFSTree(directory, this.files.fileSystemTree, taskController);
|
|
11597
11591
|
}
|
|
11598
11592
|
}
|
|
11599
11593
|
return Promise.resolve(void 0);
|
|
@@ -11656,13 +11650,13 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11656
11650
|
});
|
|
11657
11651
|
}
|
|
11658
11652
|
updateIsDiagnosticsCollectionInBackgroundEnabled() {
|
|
11659
|
-
const shouldColletDiagnostics = this.isReadyToAcceptWorkspaceDiagnostics && this.compilationControllers_.every((c) =>
|
|
11653
|
+
const shouldColletDiagnostics = this.isReadyToAcceptWorkspaceDiagnostics && this.compilationControllers_.every((c) => c.hasAllConfigsProcessed());
|
|
11660
11654
|
this.compilationControllers_.forEach((c) => c.isDiagnosticsCollectionInBackgroundEnabled = shouldColletDiagnostics);
|
|
11661
11655
|
}
|
|
11662
11656
|
updateControllersWithOpenedFiles() {
|
|
11663
11657
|
return __async(this, null, function* () {
|
|
11664
|
-
const controllersWithProcessedConfigs = this.compilationControllers_.filter((c) =>
|
|
11665
|
-
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !
|
|
11658
|
+
const controllersWithProcessedConfigs = this.compilationControllers_.filter((c) => c.hasAllConfigsProcessed());
|
|
11659
|
+
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !c.hasAllConfigsProcessed());
|
|
11666
11660
|
this.controllersWithOpenedFiles.clear();
|
|
11667
11661
|
outer:
|
|
11668
11662
|
for (const trackedFile of this.files.trackedSourceFiles.items.values()) {
|
|
@@ -11709,7 +11703,7 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11709
11703
|
return new CompilationController(config);
|
|
11710
11704
|
}
|
|
11711
11705
|
getControllerToLoad() {
|
|
11712
|
-
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !
|
|
11706
|
+
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !c.hasAllConfigsProcessed());
|
|
11713
11707
|
if (controllersWithUnprocessedConfigs.length === 0) {
|
|
11714
11708
|
return void 0;
|
|
11715
11709
|
}
|
|
@@ -11725,28 +11719,6 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11725
11719
|
}
|
|
11726
11720
|
return controller;
|
|
11727
11721
|
}
|
|
11728
|
-
isCompilationControllerStateWithProcessedConfigs(state) {
|
|
11729
|
-
switch (state) {
|
|
11730
|
-
case 2 /* ProcessedPackageConfigsWithErrors */:
|
|
11731
|
-
case 3 /* LoadedMainCompilation */:
|
|
11732
|
-
case 4 /* ErrorsCreatingAnalyzer */:
|
|
11733
|
-
return true;
|
|
11734
|
-
case 0 /* Created */:
|
|
11735
|
-
case 1 /* ProcessingInitialPackageConfigs */:
|
|
11736
|
-
return false;
|
|
11737
|
-
default:
|
|
11738
|
-
Debug.never(state);
|
|
11739
|
-
}
|
|
11740
|
-
}
|
|
11741
|
-
waitForControllerToFullyLoad(controller, cancellationToken) {
|
|
11742
|
-
return __async(this, null, function* () {
|
|
11743
|
-
yield controller.waitFullyLoaded();
|
|
11744
|
-
while (!this.isCompilationControllerStateWithProcessedConfigs(controller.state)) {
|
|
11745
|
-
yield new Promise((r) => setTimeout(r, 30));
|
|
11746
|
-
cancellationToken.throwIfCancellationRequested();
|
|
11747
|
-
}
|
|
11748
|
-
});
|
|
11749
|
-
}
|
|
11750
11722
|
};
|
|
11751
11723
|
__decorateClass([
|
|
11752
11724
|
observable6(false)
|
|
@@ -12116,16 +12088,13 @@ var EntityToSyntax = class {
|
|
|
12116
12088
|
const baseAspectTypes = entity.getBaseAspectTypes().declared;
|
|
12117
12089
|
if (baseObjectType !== void 0 || baseAspectTypes.length > 0) {
|
|
12118
12090
|
baseTypes = [];
|
|
12119
|
-
if (baseObjectType !== void 0) {
|
|
12091
|
+
if (baseObjectType !== void 0 && this.analyzer.getImplicitBaseTypeForStructuredType(entity)?.equals(baseObjectType) !== true) {
|
|
12120
12092
|
const baseObjectTypeSpecifier = this.convertType(baseObjectType);
|
|
12121
12093
|
if (baseObjectTypeSpecifier.kind === 10 /* NamedTypeSpecifier */) {
|
|
12122
12094
|
baseTypes.push(baseObjectTypeSpecifier);
|
|
12123
12095
|
}
|
|
12124
12096
|
}
|
|
12125
12097
|
baseTypes.push(...baseAspectTypes.map((t) => this.convertType(t)).filter((t) => t.kind === 10 /* NamedTypeSpecifier */));
|
|
12126
|
-
if (baseAspectTypes.length === 0) {
|
|
12127
|
-
baseTypes = void 0;
|
|
12128
|
-
}
|
|
12129
12098
|
}
|
|
12130
12099
|
const members = this.convertTypeEntityMembers(entity.getMembers());
|
|
12131
12100
|
return SyntaxFactory.structuredTypeDeclarationBody(structuredTypeKindKeyword, baseTypes, members);
|
|
@@ -12306,7 +12275,7 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12306
12275
|
get compilationControllers() {
|
|
12307
12276
|
return Array.from(this.generatedPackageStates.values()).map((s) => s.compilationController);
|
|
12308
12277
|
}
|
|
12309
|
-
getDefinitionInGeneratedCode(analyzer, entity,
|
|
12278
|
+
getDefinitionInGeneratedCode(analyzer, entity, taskController) {
|
|
12310
12279
|
return __async(this, null, function* () {
|
|
12311
12280
|
if (!this.entityDefinitionRequiresSourceGeneration(entity)) {
|
|
12312
12281
|
return void 0;
|
|
@@ -12314,7 +12283,7 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12314
12283
|
const generatedPackageState = yield this.getOrGeneratePackageSource(
|
|
12315
12284
|
analyzer,
|
|
12316
12285
|
entity.getContainingPackage(),
|
|
12317
|
-
|
|
12286
|
+
taskController
|
|
12318
12287
|
);
|
|
12319
12288
|
if (generatedPackageState === void 0) {
|
|
12320
12289
|
return void 0;
|
|
@@ -12377,7 +12346,7 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12377
12346
|
}
|
|
12378
12347
|
}
|
|
12379
12348
|
}
|
|
12380
|
-
getOrGeneratePackageSource(analyzer, packageEntity,
|
|
12349
|
+
getOrGeneratePackageSource(analyzer, packageEntity, taskController) {
|
|
12381
12350
|
return __async(this, null, function* () {
|
|
12382
12351
|
const packageLocale = packageEntity.getLocale();
|
|
12383
12352
|
const key = `${packageEntity.getName().toString()}-${localeToString(packageLocale)}`;
|
|
@@ -12395,7 +12364,7 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12395
12364
|
packageLocale,
|
|
12396
12365
|
DefaultDialect
|
|
12397
12366
|
);
|
|
12398
|
-
const standardPackageContents = yield this.standardPackageContentsProviders(
|
|
12367
|
+
const standardPackageContents = yield this.standardPackageContentsProviders(taskController);
|
|
12399
12368
|
if (standardPackageContents === void 0) {
|
|
12400
12369
|
Logger.warn("\u0421\u0435\u0440\u0432\u0438\u0441\u0443 \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0433\u043E \u043A\u043E\u0434\u0430 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0435 \u043F\u0430\u043A\u0435\u0442\u044B. \u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u043A\u043E\u0434 \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u043D.");
|
|
12401
12370
|
return void 0;
|
|
@@ -12634,6 +12603,7 @@ var EntityFinder = class {
|
|
|
12634
12603
|
}
|
|
12635
12604
|
}
|
|
12636
12605
|
case "nested":
|
|
12606
|
+
case "anonymous":
|
|
12637
12607
|
return void 0;
|
|
12638
12608
|
default:
|
|
12639
12609
|
Debug.never(entity);
|
|
@@ -12821,7 +12791,7 @@ var DataForFindingOverloadedMember = class {
|
|
|
12821
12791
|
};
|
|
12822
12792
|
|
|
12823
12793
|
// source/services/LanguageServer.ts
|
|
12824
|
-
var
|
|
12794
|
+
var _LanguageServer = class _LanguageServer {
|
|
12825
12795
|
constructor(config) {
|
|
12826
12796
|
this.disposables = new Array();
|
|
12827
12797
|
this.isInitialized = false;
|
|
@@ -12871,39 +12841,39 @@ var LanguageServer = class {
|
|
|
12871
12841
|
this.disposables.push(disposable);
|
|
12872
12842
|
disposable = this.connection.onDidCloseTextDocument((params) => this.onDidCloseTextDocument(params));
|
|
12873
12843
|
this.disposables.push(disposable);
|
|
12874
|
-
disposable = this.connection.onDefinition((params, token) => this.
|
|
12844
|
+
disposable = this.connection.onDefinition((params, token) => this.withTaskController(token, (taskController) => this.onDefinition(params, taskController)));
|
|
12875
12845
|
this.disposables.push(disposable);
|
|
12876
|
-
disposable = this.connection.onReferences((params, token) => this.
|
|
12846
|
+
disposable = this.connection.onReferences((params, token) => this.withTaskController(token, (taskController) => this.onReferences(params, taskController)));
|
|
12877
12847
|
this.disposables.push(disposable);
|
|
12878
|
-
disposable = this.connection.onDocumentHighlight((params, token) => this.
|
|
12848
|
+
disposable = this.connection.onDocumentHighlight((params, token) => this.withTaskController(token, (taskController) => this.onDocumentHighlight(params, taskController)));
|
|
12879
12849
|
this.disposables.push(disposable);
|
|
12880
|
-
disposable = this.connection.onPrepareRename((params, token) => this.
|
|
12850
|
+
disposable = this.connection.onPrepareRename((params, token) => this.withTaskController(token, (taskController) => this.onPrepareRename(params, taskController)));
|
|
12881
12851
|
this.disposables.push(disposable);
|
|
12882
|
-
disposable = this.connection.onRenameRequest((params, token) => this.
|
|
12852
|
+
disposable = this.connection.onRenameRequest((params, token) => this.withTaskController(token, (taskController) => this.onRename(params, taskController)));
|
|
12883
12853
|
this.disposables.push(disposable);
|
|
12884
|
-
disposable = this.connection.onWorkspaceSymbol((params, token) => this.
|
|
12854
|
+
disposable = this.connection.onWorkspaceSymbol((params, token) => this.withTaskController(token, (taskController) => this.onWorkspaceSymbol(params, taskController)));
|
|
12885
12855
|
this.disposables.push(disposable);
|
|
12886
|
-
disposable = this.connection.onDocumentSymbol((params, token) => this.
|
|
12856
|
+
disposable = this.connection.onDocumentSymbol((params, token) => this.withTaskController(token, (taskController) => this.onDocumentSymbol(params, taskController)));
|
|
12887
12857
|
this.disposables.push(disposable);
|
|
12888
|
-
disposable = this.connection.onHover((params, token) => this.
|
|
12858
|
+
disposable = this.connection.onHover((params, token) => this.withTaskController(token, (taskController) => this.onHover(params, taskController)));
|
|
12889
12859
|
this.disposables.push(disposable);
|
|
12890
|
-
disposable = this.connection.onExecuteCommand((params, token) => this.
|
|
12860
|
+
disposable = this.connection.onExecuteCommand((params, token) => this.withTaskController(token, (taskController) => this.onExecuteCommand(params, taskController)));
|
|
12891
12861
|
this.disposables.push(disposable);
|
|
12892
|
-
disposable = this.connection.onCompletion((params, token) => this.
|
|
12862
|
+
disposable = this.connection.onCompletion((params, token) => this.withTaskController(token, (taskController) => this.onCompletion(params, taskController)));
|
|
12893
12863
|
this.disposables.push(disposable);
|
|
12894
12864
|
disposable = this.connection.onCompletionResolve((params) => this.onCompletionResolve(params));
|
|
12895
12865
|
this.disposables.push(disposable);
|
|
12896
|
-
disposable = this.connection.languages.semanticTokens.on((params, token) => this.
|
|
12866
|
+
disposable = this.connection.languages.semanticTokens.on((params, token) => this.withTaskController(token, (taskController) => this.onSemanticTokens(params, taskController)));
|
|
12897
12867
|
this.disposables.push(disposable);
|
|
12898
|
-
disposable = this.connection.languages.semanticTokens.onRange((params, token) => this.
|
|
12868
|
+
disposable = this.connection.languages.semanticTokens.onRange((params, token) => this.withTaskController(token, (taskController) => this.onSemanticTokensRange(params, taskController)));
|
|
12899
12869
|
this.disposables.push(disposable);
|
|
12900
|
-
disposable = this.connection.onSignatureHelp((params, token) => this.
|
|
12870
|
+
disposable = this.connection.onSignatureHelp((params, token) => this.withTaskController(token, (taskController) => this.onSignatureHelp(params, taskController)));
|
|
12901
12871
|
this.disposables.push(disposable);
|
|
12902
|
-
disposable = this.connection.onSelectionRanges((params, token) => this.
|
|
12872
|
+
disposable = this.connection.onSelectionRanges((params, token) => this.withTaskController(token, (taskController) => this.onSelectionRanges(params, taskController)));
|
|
12903
12873
|
this.disposables.push(disposable);
|
|
12904
|
-
disposable = this.connection.onCodeAction((params, token) => this.
|
|
12874
|
+
disposable = this.connection.onCodeAction((params, token) => this.withTaskController(token, (taskController) => this.onCodeAction(params, taskController)));
|
|
12905
12875
|
this.disposables.push(disposable);
|
|
12906
|
-
disposable = this.connection.onCodeActionResolve((params, token) => this.
|
|
12876
|
+
disposable = this.connection.onCodeActionResolve((params, token) => this.withTaskController(token, (taskController) => this.onCodeActionResolve(params, taskController)));
|
|
12907
12877
|
this.disposables.push(disposable);
|
|
12908
12878
|
this.connection.listen();
|
|
12909
12879
|
}
|
|
@@ -12976,8 +12946,8 @@ var LanguageServer = class {
|
|
|
12976
12946
|
this.sourceGenerationService = runAtomically3(() => new SourceGenerationService(
|
|
12977
12947
|
this.workspace.trackedSourceFiles,
|
|
12978
12948
|
this.config.tsLibrariesProvider,
|
|
12979
|
-
(
|
|
12980
|
-
return yield this.workspace.getStandardPackageContents(
|
|
12949
|
+
(taskController) => __async(this, null, function* () {
|
|
12950
|
+
return yield this.workspace.getStandardPackageContents(taskController);
|
|
12981
12951
|
})
|
|
12982
12952
|
));
|
|
12983
12953
|
this.definitionService = new DefinitionService(this.sourceGenerationService);
|
|
@@ -13045,12 +13015,18 @@ var LanguageServer = class {
|
|
|
13045
13015
|
if (this.clientCapabilities.textDocument?.diagnostic?.dynamicRegistration === true) {
|
|
13046
13016
|
disposable = this.connection.onRequest(
|
|
13047
13017
|
ls3.DocumentDiagnosticRequest.type,
|
|
13048
|
-
(params, token) => this.
|
|
13018
|
+
(params, token) => this.withTaskController(
|
|
13019
|
+
token,
|
|
13020
|
+
(taskController) => this.onDocumentDiagnostic(params, taskController)
|
|
13021
|
+
)
|
|
13049
13022
|
);
|
|
13050
13023
|
this.disposables.push(disposable);
|
|
13051
13024
|
disposable = this.connection.onRequest(
|
|
13052
13025
|
ls3.WorkspaceDiagnosticRequest.type,
|
|
13053
|
-
(params, token) => this.
|
|
13026
|
+
(params, token) => this.withTaskController(
|
|
13027
|
+
token,
|
|
13028
|
+
(taskController) => this.onWorkspaceDiagnostic(params, taskController)
|
|
13029
|
+
)
|
|
13054
13030
|
);
|
|
13055
13031
|
this.disposables.push(disposable);
|
|
13056
13032
|
disposable = yield this.connection.client.register(ls3.DocumentDiagnosticRequest.type, {
|
|
@@ -13120,13 +13096,13 @@ var LanguageServer = class {
|
|
|
13120
13096
|
this.fileSystemUpdateNotificationsPublisher.publish(notifications);
|
|
13121
13097
|
}
|
|
13122
13098
|
}
|
|
13123
|
-
onDocumentDiagnostic(params,
|
|
13099
|
+
onDocumentDiagnostic(params, taskController) {
|
|
13124
13100
|
return __async(this, null, function* () {
|
|
13125
13101
|
const vscodeUri = URI2.parse(params.textDocument.uri);
|
|
13126
13102
|
if (vscodeUri.scheme === GeneratedSourceFileScheme) {
|
|
13127
13103
|
return void 0;
|
|
13128
13104
|
}
|
|
13129
|
-
const sourceFileContext = yield this.getSourceFileContext(vscodeUri,
|
|
13105
|
+
const sourceFileContext = yield this.getSourceFileContext(vscodeUri, taskController);
|
|
13130
13106
|
let result = { kind: "full", items: [] };
|
|
13131
13107
|
if (sourceFileContext !== void 0) {
|
|
13132
13108
|
const uri = this.convertVscodeUriToUri(vscodeUri);
|
|
@@ -13137,7 +13113,7 @@ var LanguageServer = class {
|
|
|
13137
13113
|
} else {
|
|
13138
13114
|
const sourceFile = state.analyzer.compilation.getSourceFileByUri(uri);
|
|
13139
13115
|
if (sourceFile !== void 0) {
|
|
13140
|
-
const diagnostics = yield state.collectSourceFileDiagnosticsWithHighPriority(sourceFile,
|
|
13116
|
+
const diagnostics = yield state.collectSourceFileDiagnosticsWithHighPriority(sourceFile, taskController);
|
|
13141
13117
|
if (diagnostics !== void 0) {
|
|
13142
13118
|
const protocolDiagnostics = diagnostics.map((d) => this.convertDiagnostic(d, sourceFile));
|
|
13143
13119
|
result = { kind: "full", items: protocolDiagnostics, resultId: state.version.toString() };
|
|
@@ -13150,12 +13126,12 @@ var LanguageServer = class {
|
|
|
13150
13126
|
return result;
|
|
13151
13127
|
});
|
|
13152
13128
|
}
|
|
13153
|
-
onWorkspaceDiagnostic(params,
|
|
13129
|
+
onWorkspaceDiagnostic(params, taskController) {
|
|
13154
13130
|
return __async(this, null, function* () {
|
|
13155
13131
|
this.workspaceDiagnosticsPartialResultToken = params.partialResultToken;
|
|
13156
13132
|
runAtomically3(() => this.workspace.isReadyToAcceptWorkspaceDiagnostics = true);
|
|
13157
|
-
while (!
|
|
13158
|
-
yield
|
|
13133
|
+
while (!taskController.isCancellationRequested()) {
|
|
13134
|
+
yield taskController.yieldTask(1e3);
|
|
13159
13135
|
}
|
|
13160
13136
|
if (this.workspaceDiagnosticsPartialResultToken === params.partialResultToken) {
|
|
13161
13137
|
this.workspaceDiagnosticsPartialResultToken = void 0;
|
|
@@ -13185,7 +13161,7 @@ var LanguageServer = class {
|
|
|
13185
13161
|
}
|
|
13186
13162
|
});
|
|
13187
13163
|
}
|
|
13188
|
-
onDocumentSymbol(params,
|
|
13164
|
+
onDocumentSymbol(params, taskController) {
|
|
13189
13165
|
return __async(this, null, function* () {
|
|
13190
13166
|
const convertSourceFileItem = (item) => {
|
|
13191
13167
|
const kind = this.convertSourceFileItemKind(item.kind);
|
|
@@ -13194,7 +13170,7 @@ var LanguageServer = class {
|
|
|
13194
13170
|
const children = Query.from(item.items).map((item2) => convertSourceFileItem(item2)).toArray();
|
|
13195
13171
|
return ls3.DocumentSymbol.create(item.name, void 0, kind, range, selectionRange, children);
|
|
13196
13172
|
};
|
|
13197
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13173
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13198
13174
|
let result = new Array();
|
|
13199
13175
|
if (sourceFileContext !== void 0) {
|
|
13200
13176
|
const { sourceFile } = sourceFileContext;
|
|
@@ -13203,7 +13179,7 @@ var LanguageServer = class {
|
|
|
13203
13179
|
return result;
|
|
13204
13180
|
});
|
|
13205
13181
|
}
|
|
13206
|
-
onWorkspaceSymbol(_params,
|
|
13182
|
+
onWorkspaceSymbol(_params, _taskController) {
|
|
13207
13183
|
return __async(this, null, function* () {
|
|
13208
13184
|
const convertSourceFileItem = (item) => {
|
|
13209
13185
|
const result = new Array();
|
|
@@ -13221,16 +13197,21 @@ var LanguageServer = class {
|
|
|
13221
13197
|
return items.flatMap((i) => convertSourceFileItem(i));
|
|
13222
13198
|
});
|
|
13223
13199
|
}
|
|
13224
|
-
onDefinition(params,
|
|
13200
|
+
onDefinition(params, taskController) {
|
|
13225
13201
|
return __async(this, null, function* () {
|
|
13226
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13202
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13227
13203
|
if (sourceFileContext === void 0) {
|
|
13228
13204
|
return;
|
|
13229
13205
|
}
|
|
13230
13206
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13231
13207
|
const position = new Position(params.position.line, params.position.character);
|
|
13232
13208
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13233
|
-
const definitionAndReferenceInfo = yield this.definitionService.getDefinition(
|
|
13209
|
+
const definitionAndReferenceInfo = yield this.definitionService.getDefinition(
|
|
13210
|
+
analyzer,
|
|
13211
|
+
sourceFile,
|
|
13212
|
+
offset,
|
|
13213
|
+
taskController
|
|
13214
|
+
);
|
|
13234
13215
|
if (definitionAndReferenceInfo === void 0) {
|
|
13235
13216
|
return;
|
|
13236
13217
|
}
|
|
@@ -13248,10 +13229,10 @@ var LanguageServer = class {
|
|
|
13248
13229
|
return result;
|
|
13249
13230
|
});
|
|
13250
13231
|
}
|
|
13251
|
-
onReferences(params,
|
|
13232
|
+
onReferences(params, taskController) {
|
|
13252
13233
|
return __async(this, null, function* () {
|
|
13253
13234
|
let result = new Array();
|
|
13254
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13235
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13255
13236
|
if (sourceFileContext !== void 0) {
|
|
13256
13237
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13257
13238
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13266,7 +13247,7 @@ var LanguageServer = class {
|
|
|
13266
13247
|
sourceFile,
|
|
13267
13248
|
offset,
|
|
13268
13249
|
options6,
|
|
13269
|
-
|
|
13250
|
+
taskController
|
|
13270
13251
|
);
|
|
13271
13252
|
result = Query.from(references).map((reference) => ({
|
|
13272
13253
|
uri: this.convertUriToVscodeUri(reference.sourceFile.uri).toString(),
|
|
@@ -13276,15 +13257,20 @@ var LanguageServer = class {
|
|
|
13276
13257
|
return result;
|
|
13277
13258
|
});
|
|
13278
13259
|
}
|
|
13279
|
-
onDocumentHighlight(params,
|
|
13260
|
+
onDocumentHighlight(params, taskController) {
|
|
13280
13261
|
return __async(this, null, function* () {
|
|
13281
13262
|
let result = new Array();
|
|
13282
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13263
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13283
13264
|
if (sourceFileContext !== void 0) {
|
|
13284
13265
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13285
13266
|
const position = new Position(params.position.line, params.position.character);
|
|
13286
13267
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13287
|
-
const highlights = yield this.documentHighlightService.getDocumentHighlights(
|
|
13268
|
+
const highlights = yield this.documentHighlightService.getDocumentHighlights(
|
|
13269
|
+
analyzer,
|
|
13270
|
+
sourceFile,
|
|
13271
|
+
offset,
|
|
13272
|
+
taskController
|
|
13273
|
+
);
|
|
13288
13274
|
result = Query.from(highlights).map((highlight) => {
|
|
13289
13275
|
let kind;
|
|
13290
13276
|
switch (highlight.kind) {
|
|
@@ -13304,10 +13290,10 @@ var LanguageServer = class {
|
|
|
13304
13290
|
return result;
|
|
13305
13291
|
});
|
|
13306
13292
|
}
|
|
13307
|
-
onPrepareRename(params,
|
|
13293
|
+
onPrepareRename(params, taskController) {
|
|
13308
13294
|
return __async(this, null, function* () {
|
|
13309
13295
|
let result;
|
|
13310
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13296
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13311
13297
|
if (sourceFileContext !== void 0) {
|
|
13312
13298
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13313
13299
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13320,15 +13306,15 @@ var LanguageServer = class {
|
|
|
13320
13306
|
return result;
|
|
13321
13307
|
});
|
|
13322
13308
|
}
|
|
13323
|
-
onRename(params,
|
|
13309
|
+
onRename(params, taskController) {
|
|
13324
13310
|
return __async(this, null, function* () {
|
|
13325
13311
|
let result;
|
|
13326
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13312
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13327
13313
|
if (sourceFileContext !== void 0) {
|
|
13328
13314
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13329
13315
|
const position = new Position(params.position.line, params.position.character);
|
|
13330
13316
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13331
|
-
const renames = yield this.renameService.rename(analyzer, sourceFile, offset, params.newName,
|
|
13317
|
+
const renames = yield this.renameService.rename(analyzer, sourceFile, offset, params.newName, taskController);
|
|
13332
13318
|
const changes = Query.from(renames).groupBy((rename) => rename.sourceFile.uri.toString()).reduce({}, (changes2, group) => {
|
|
13333
13319
|
const uri = this.convertUriToVscodeUri(group[1][0].sourceFile.uri).toString();
|
|
13334
13320
|
const edits = group[1].map((rename) => ({
|
|
@@ -13343,10 +13329,10 @@ var LanguageServer = class {
|
|
|
13343
13329
|
return result ?? {};
|
|
13344
13330
|
});
|
|
13345
13331
|
}
|
|
13346
|
-
onHover(params,
|
|
13332
|
+
onHover(params, taskController) {
|
|
13347
13333
|
return __async(this, null, function* () {
|
|
13348
13334
|
let result = void 0;
|
|
13349
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13335
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13350
13336
|
if (sourceFileContext !== void 0) {
|
|
13351
13337
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13352
13338
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13436,17 +13422,17 @@ var LanguageServer = class {
|
|
|
13436
13422
|
const code = diagnostic.data.code;
|
|
13437
13423
|
return { message, range, severity, tags, code };
|
|
13438
13424
|
}
|
|
13439
|
-
onExecuteCommand(params,
|
|
13425
|
+
onExecuteCommand(params, taskController) {
|
|
13440
13426
|
switch (params.command) {
|
|
13441
13427
|
case customCommandName.provideEvaluatableExpression:
|
|
13442
13428
|
Debug.assert(params.arguments?.length === 1 && isProvideEvaluatableExpressionParams(params.arguments[0]));
|
|
13443
|
-
return this.onProvideEvaluatableExpression(params.arguments[0],
|
|
13429
|
+
return this.onProvideEvaluatableExpression(params.arguments[0], taskController);
|
|
13444
13430
|
case customCommandName.provideServerOwnedDocumentContent:
|
|
13445
13431
|
Debug.assert(params.arguments?.length === 1 && isProvideServerOwnedDocumentContentParams(params.arguments[0]));
|
|
13446
|
-
return this.onProvideInMemoryDocumentContent(params.arguments[0],
|
|
13432
|
+
return this.onProvideInMemoryDocumentContent(params.arguments[0], taskController);
|
|
13447
13433
|
case customCommandName.emitCodeToString:
|
|
13448
13434
|
Debug.assert(params.arguments?.length === 1 && isEmitCodeToStringParams(params.arguments[0]));
|
|
13449
|
-
return this.onEmitCodeToString(params.arguments[0],
|
|
13435
|
+
return this.onEmitCodeToString(params.arguments[0], taskController);
|
|
13450
13436
|
case customCommandName.displayFileSystemTree:
|
|
13451
13437
|
Debug.assert(params.arguments?.length === 1 && isDisplayFileSystemTreeParams(params.arguments[0]));
|
|
13452
13438
|
return this.onDisplayFileSystemTree(params.arguments[0]);
|
|
@@ -13458,18 +13444,18 @@ var LanguageServer = class {
|
|
|
13458
13444
|
return this.onDeleteSourceFile(params.arguments[0]);
|
|
13459
13445
|
case customCommandName.getNodeRange:
|
|
13460
13446
|
Debug.assert(params.arguments?.length === 1 && isGetNodeRangeParams(params.arguments[0]));
|
|
13461
|
-
return this.onGetNodeRange(params.arguments[0],
|
|
13447
|
+
return this.onGetNodeRange(params.arguments[0], taskController);
|
|
13462
13448
|
case customCommandName.assignField:
|
|
13463
13449
|
Debug.assert(params.arguments?.length === 1 && isAssignFieldParams(params.arguments[0]));
|
|
13464
|
-
return this.onAssignField(params.arguments[0],
|
|
13450
|
+
return this.onAssignField(params.arguments[0], taskController);
|
|
13465
13451
|
default:
|
|
13466
13452
|
return void 0;
|
|
13467
13453
|
}
|
|
13468
13454
|
}
|
|
13469
|
-
onAssignField(params,
|
|
13455
|
+
onAssignField(params, taskController) {
|
|
13470
13456
|
return __async(this, null, function* () {
|
|
13471
13457
|
const functionNodeUri = URI2.parse(params.functionNodePath);
|
|
13472
|
-
const sourceFileContext = yield this.getSourceFileContext(functionNodeUri,
|
|
13458
|
+
const sourceFileContext = yield this.getSourceFileContext(functionNodeUri, taskController);
|
|
13473
13459
|
if (sourceFileContext !== void 0) {
|
|
13474
13460
|
const functionDeclaration = NodePath.parse(functionNodeUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
13475
13461
|
if (functionDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(functionDeclaration)) {
|
|
@@ -13501,10 +13487,10 @@ var LanguageServer = class {
|
|
|
13501
13487
|
const convertedEdits = edits.map((e) => this.convertSourceFileEdit(e));
|
|
13502
13488
|
return { documentChanges: convertedEdits };
|
|
13503
13489
|
}
|
|
13504
|
-
onGetNodeRange(params,
|
|
13490
|
+
onGetNodeRange(params, taskController) {
|
|
13505
13491
|
return __async(this, null, function* () {
|
|
13506
13492
|
const uri = URI2.parse(params.uri);
|
|
13507
|
-
const sourceFileContext = yield this.getSourceFileContext(uri,
|
|
13493
|
+
const sourceFileContext = yield this.getSourceFileContext(uri, taskController);
|
|
13508
13494
|
let result;
|
|
13509
13495
|
if (sourceFileContext !== void 0) {
|
|
13510
13496
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
@@ -13544,7 +13530,7 @@ var LanguageServer = class {
|
|
|
13544
13530
|
return result;
|
|
13545
13531
|
});
|
|
13546
13532
|
}
|
|
13547
|
-
onEmitCodeToString(params,
|
|
13533
|
+
onEmitCodeToString(params, taskController) {
|
|
13548
13534
|
return __async(this, null, function* () {
|
|
13549
13535
|
let compilationControllerUri;
|
|
13550
13536
|
if (params.workspaceFolderUri !== void 0) {
|
|
@@ -13558,7 +13544,10 @@ var LanguageServer = class {
|
|
|
13558
13544
|
}
|
|
13559
13545
|
compilationControllerUri = this.workspace.workspaceFolderUris[0];
|
|
13560
13546
|
}
|
|
13561
|
-
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(
|
|
13547
|
+
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(
|
|
13548
|
+
compilationControllerUri,
|
|
13549
|
+
taskController
|
|
13550
|
+
);
|
|
13562
13551
|
const compilationController = workspaceElementInfo?.compilationController;
|
|
13563
13552
|
if (compilationController === void 0) {
|
|
13564
13553
|
throw new ls3.ResponseError(
|
|
@@ -13574,12 +13563,12 @@ var LanguageServer = class {
|
|
|
13574
13563
|
const trackedSourceFiles = this.workspace.trackedSourceFiles.createItemsSnapshot();
|
|
13575
13564
|
const packageGraph = new SourcePackageDependencyGraph(compilationState.analyzer);
|
|
13576
13565
|
let hasErrors = false;
|
|
13577
|
-
for (const pkg of packageGraph.
|
|
13566
|
+
for (const pkg of packageGraph.packagesForTargetPlatform(0 /* JavaScript */)) {
|
|
13578
13567
|
if (pkg.kind === "translation") {
|
|
13579
13568
|
continue;
|
|
13580
13569
|
}
|
|
13581
13570
|
for (const sourceFile of pkg.sourceFiles) {
|
|
13582
|
-
const summary = yield compilationState.getDiagnosticsCollectionSummary(sourceFile,
|
|
13571
|
+
const summary = yield compilationState.getDiagnosticsCollectionSummary(sourceFile, taskController);
|
|
13583
13572
|
hasErrors ||= summary.hasErrors;
|
|
13584
13573
|
if (summary.hasErrors) {
|
|
13585
13574
|
const uri = this.convertUriToVscodeUri(sourceFile.uri).toString();
|
|
@@ -13598,7 +13587,7 @@ var LanguageServer = class {
|
|
|
13598
13587
|
let result;
|
|
13599
13588
|
try {
|
|
13600
13589
|
const emitter = new Emitter(compilationController.mainCompilationState.analyzer, options6);
|
|
13601
|
-
const code = yield emitter.emitToString(
|
|
13590
|
+
const code = yield emitter.emitToString(taskController);
|
|
13602
13591
|
result = { hasErrors: false, code };
|
|
13603
13592
|
} catch (e) {
|
|
13604
13593
|
Logger.error(`\u0412\u043E \u0432\u0440\u0435\u043C\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438 \u043A\u043E\u0434\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 ${compilationController.uri} \u0432\u043E\u0437\u043D\u0438\u043A\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430
|
|
@@ -13608,11 +13597,11 @@ ${e}`);
|
|
|
13608
13597
|
return result;
|
|
13609
13598
|
});
|
|
13610
13599
|
}
|
|
13611
|
-
onProvideInMemoryDocumentContent(params,
|
|
13600
|
+
onProvideInMemoryDocumentContent(params, taskController) {
|
|
13612
13601
|
return __async(this, null, function* () {
|
|
13613
13602
|
const vscodeUri = URI2.parse(params.uri);
|
|
13614
13603
|
if (vscodeUri.scheme === InMemoryPackageScheme) {
|
|
13615
|
-
const sourceFileContext = yield this.getSourceFileContext(vscodeUri,
|
|
13604
|
+
const sourceFileContext = yield this.getSourceFileContext(vscodeUri, taskController);
|
|
13616
13605
|
return sourceFileContext?.sourceFile.getSourceText();
|
|
13617
13606
|
} else if (vscodeUri.scheme === GeneratedSourceFileScheme) {
|
|
13618
13607
|
const uri = this.convertVscodeUriToUri(vscodeUri);
|
|
@@ -13629,10 +13618,10 @@ ${e}`);
|
|
|
13629
13618
|
}
|
|
13630
13619
|
});
|
|
13631
13620
|
}
|
|
13632
|
-
onProvideEvaluatableExpression(params,
|
|
13621
|
+
onProvideEvaluatableExpression(params, taskController) {
|
|
13633
13622
|
return __async(this, null, function* () {
|
|
13634
13623
|
let result;
|
|
13635
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13624
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13636
13625
|
if (sourceFileContext !== void 0) {
|
|
13637
13626
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13638
13627
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13648,10 +13637,10 @@ ${e}`);
|
|
|
13648
13637
|
return result;
|
|
13649
13638
|
});
|
|
13650
13639
|
}
|
|
13651
|
-
onCompletion(params,
|
|
13640
|
+
onCompletion(params, taskController) {
|
|
13652
13641
|
return __async(this, null, function* () {
|
|
13653
13642
|
let result = new Array();
|
|
13654
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13643
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13655
13644
|
if (sourceFileContext !== void 0) {
|
|
13656
13645
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13657
13646
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13753,22 +13742,22 @@ ${e}`);
|
|
|
13753
13742
|
Debug.never(kind);
|
|
13754
13743
|
}
|
|
13755
13744
|
}
|
|
13756
|
-
onSemanticTokens(params,
|
|
13745
|
+
onSemanticTokens(params, taskController) {
|
|
13757
13746
|
return __async(this, null, function* () {
|
|
13758
13747
|
let result;
|
|
13759
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13748
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13760
13749
|
if (sourceFileContext !== void 0) {
|
|
13761
13750
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13762
|
-
const semanticTokens = yield this.semanticTokensService.getSemanticTokens(analyzer, sourceFile,
|
|
13751
|
+
const semanticTokens = yield this.semanticTokensService.getSemanticTokens(analyzer, sourceFile, taskController);
|
|
13763
13752
|
result = this.convertSemanticTokens(semanticTokens, sourceFile);
|
|
13764
13753
|
}
|
|
13765
13754
|
return result ?? { data: [] };
|
|
13766
13755
|
});
|
|
13767
13756
|
}
|
|
13768
|
-
onSemanticTokensRange(params,
|
|
13757
|
+
onSemanticTokensRange(params, taskController) {
|
|
13769
13758
|
return __async(this, null, function* () {
|
|
13770
13759
|
let result;
|
|
13771
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13760
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13772
13761
|
if (sourceFileContext !== void 0) {
|
|
13773
13762
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13774
13763
|
const range = new Range(
|
|
@@ -13779,7 +13768,7 @@ ${e}`);
|
|
|
13779
13768
|
analyzer,
|
|
13780
13769
|
sourceFile,
|
|
13781
13770
|
range,
|
|
13782
|
-
|
|
13771
|
+
taskController
|
|
13783
13772
|
);
|
|
13784
13773
|
return this.convertSemanticTokens(semanticTokens, sourceFile);
|
|
13785
13774
|
}
|
|
@@ -13867,10 +13856,10 @@ ${e}`);
|
|
|
13867
13856
|
Debug.never(flag);
|
|
13868
13857
|
}
|
|
13869
13858
|
}
|
|
13870
|
-
onSignatureHelp(params,
|
|
13859
|
+
onSignatureHelp(params, taskController) {
|
|
13871
13860
|
return __async(this, null, function* () {
|
|
13872
13861
|
let result;
|
|
13873
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13862
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13874
13863
|
if (sourceFileContext !== void 0) {
|
|
13875
13864
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13876
13865
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13891,10 +13880,10 @@ ${e}`);
|
|
|
13891
13880
|
return result;
|
|
13892
13881
|
});
|
|
13893
13882
|
}
|
|
13894
|
-
onSelectionRanges(params,
|
|
13883
|
+
onSelectionRanges(params, taskController) {
|
|
13895
13884
|
return __async(this, null, function* () {
|
|
13896
13885
|
let result;
|
|
13897
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13886
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13898
13887
|
if (sourceFileContext !== void 0) {
|
|
13899
13888
|
result = [];
|
|
13900
13889
|
const { sourceFile } = sourceFileContext;
|
|
@@ -13916,10 +13905,10 @@ ${e}`);
|
|
|
13916
13905
|
const range = this.convertSourceFileRange(sourceFile, selectionRange.range);
|
|
13917
13906
|
return ls3.SelectionRange.create(range, parent);
|
|
13918
13907
|
}
|
|
13919
|
-
onCodeAction(params,
|
|
13908
|
+
onCodeAction(params, taskController) {
|
|
13920
13909
|
return __async(this, null, function* () {
|
|
13921
13910
|
let result;
|
|
13922
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri),
|
|
13911
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.textDocument.uri), taskController);
|
|
13923
13912
|
if (sourceFileContext !== void 0) {
|
|
13924
13913
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13925
13914
|
const offset = sourceFile.getOffsetAtPosition(new Position(params.range.start.line, params.range.start.character));
|
|
@@ -13930,11 +13919,11 @@ ${e}`);
|
|
|
13930
13919
|
return result;
|
|
13931
13920
|
});
|
|
13932
13921
|
}
|
|
13933
|
-
onCodeActionResolve(params,
|
|
13922
|
+
onCodeActionResolve(params, taskController) {
|
|
13934
13923
|
return __async(this, null, function* () {
|
|
13935
13924
|
const result = params;
|
|
13936
13925
|
if (isCodeActionData(params.data)) {
|
|
13937
|
-
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.data.location.uri),
|
|
13926
|
+
const sourceFileContext = yield this.getSourceFileContext(URI2.parse(params.data.location.uri), taskController);
|
|
13938
13927
|
if (sourceFileContext !== void 0) {
|
|
13939
13928
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13940
13929
|
const offset = sourceFile.getOffsetAtPosition(new Position(
|
|
@@ -14001,7 +13990,7 @@ ${e}`);
|
|
|
14001
13990
|
const endPosition = sourceFile.getPositionAt(range.end);
|
|
14002
13991
|
return ls3.Range.create(startPosition, endPosition);
|
|
14003
13992
|
}
|
|
14004
|
-
getSourceFileContext(vscodeUri,
|
|
13993
|
+
getSourceFileContext(vscodeUri, taskController) {
|
|
14005
13994
|
return __async(this, null, function* () {
|
|
14006
13995
|
const uri = this.convertVscodeUriToUri(vscodeUri);
|
|
14007
13996
|
if (uri.scheme === GeneratedSourceFileScheme) {
|
|
@@ -14017,7 +14006,7 @@ ${e}`);
|
|
|
14017
14006
|
}
|
|
14018
14007
|
return void 0;
|
|
14019
14008
|
} else {
|
|
14020
|
-
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(uri,
|
|
14009
|
+
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(uri, taskController);
|
|
14021
14010
|
if (workspaceElementInfo?.sourceFile !== void 0) {
|
|
14022
14011
|
return new SourceFileContext(
|
|
14023
14012
|
workspaceElementInfo.compilationController,
|
|
@@ -14041,11 +14030,14 @@ ${e}`);
|
|
|
14041
14030
|
}
|
|
14042
14031
|
return new ClientCancellationToken(cancellationToken);
|
|
14043
14032
|
}
|
|
14044
|
-
|
|
14033
|
+
withTaskController(token, handler) {
|
|
14045
14034
|
return __async(this, null, function* () {
|
|
14046
|
-
const
|
|
14035
|
+
const taskController = new TaskController(
|
|
14036
|
+
_LanguageServer.DefaultCancellationTokenThrottleTime,
|
|
14037
|
+
this.createCancellationToken(token)
|
|
14038
|
+
);
|
|
14047
14039
|
try {
|
|
14048
|
-
return yield handler(
|
|
14040
|
+
return yield handler(taskController);
|
|
14049
14041
|
} catch (e) {
|
|
14050
14042
|
if (e instanceof CancelledError) {
|
|
14051
14043
|
throw new ls3.ResponseError(ls3.LSPErrorCodes.RequestCancelled, e.message);
|
|
@@ -14057,7 +14049,8 @@ ${e}`);
|
|
|
14057
14049
|
};
|
|
14058
14050
|
__decorateClass([
|
|
14059
14051
|
atomic6
|
|
14060
|
-
],
|
|
14052
|
+
], _LanguageServer.prototype, "onDidChangeWorkspaceFolders", 1);
|
|
14053
|
+
var LanguageServer = _LanguageServer;
|
|
14061
14054
|
var FileSystemSynchronizationMode;
|
|
14062
14055
|
((FileSystemSynchronizationMode2) => {
|
|
14063
14056
|
class ClientSideFSWatcher {
|