@artel/artc 0.6.25277 → 0.6.25279
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 -20
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +609 -565
- package/build/{chunk-QK3TWMY2.js → chunk-65GDIOT3.js} +20 -24
- package/build/{chunk-DKZTCPRN.js → chunk-C4HHHOM5.js} +15 -15
- package/build/{chunk-EVYL6VFM.js → chunk-HPU7DXMO.js} +2235 -1500
- 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 +23 -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/UserDefinableBinaryOperatorResolver.d.ts +1 -1
- package/build/types/analysis/UserDefinableUnaryOperatorResolver.d.ts +1 -1
- 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/api/ApiServices.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 -5
- package/build/types/diagnostic/DiagnosticCode.d.ts +5 -1
- package/build/types/{common → diagnostic}/WithDiagnostics.d.ts +1 -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/{CustomCommand.d.ts → CustomRequests.d.ts} +20 -51
- package/build/types/services/DefinitionService.d.ts +2 -2
- package/build/types/services/DeleteBlockFromScriptService.d.ts +6 -0
- 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 +4 -3
- 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 +6 -5
- 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/Delayed.d.ts +0 -7
- package/build/types/common/ThrottledCancellationToken.d.ts +0 -17
- package/build/types/common/YieldExecution.d.ts +0 -1
- /package/build/types/{common → analysis}/TreeQuery.d.ts +0 -0
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,100 +183,36 @@ 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-HPU7DXMO.js";
|
|
191
192
|
|
|
192
|
-
// source/services/
|
|
193
|
+
// source/services/CustomRequests.ts
|
|
193
194
|
import * as ls from "vscode-languageserver";
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
*/
|
|
210
|
-
provideServerOwnedDocumentContent: "artel/provideServerOwnedDocumentContent",
|
|
211
|
-
/**
|
|
212
|
-
* Возвращает `EmitCodeToStringResult`.
|
|
213
|
-
*/
|
|
214
|
-
emitCodeToString: "artel/emitCodeToString",
|
|
215
|
-
/**
|
|
216
|
-
* Возвращает `string | null`.
|
|
217
|
-
*/
|
|
218
|
-
displayFileSystemTree: "artel/displayFileSystemTree",
|
|
219
|
-
/**
|
|
220
|
-
* Возвращает `void`.
|
|
221
|
-
*/
|
|
222
|
-
createOrUpdateSourceFile: "artel/fs.createOrUpdateSourceFile",
|
|
223
|
-
/**
|
|
224
|
-
* Возвращает `void`.
|
|
225
|
-
*/
|
|
226
|
-
deleteSourceFile: "artel/fs.deleteSourceFile",
|
|
227
|
-
/**
|
|
228
|
-
* Возвращает `ls.Range | null`.
|
|
229
|
-
*/
|
|
230
|
-
getNodeRange: "artel/getNodeRange",
|
|
231
|
-
/**
|
|
232
|
-
* Возвращает `void`.
|
|
233
|
-
*/
|
|
234
|
-
assignField: "artel/assignField"
|
|
235
|
-
};
|
|
236
|
-
function isProvideEvaluatableExpressionParams(value) {
|
|
237
|
-
cast(value);
|
|
238
|
-
return !isNullOrUndefined(value) && ls.TextDocumentIdentifier.is(value.textDocument) && ls.Position.is(value.position);
|
|
239
|
-
}
|
|
240
|
-
function isProvideServerOwnedDocumentContentParams(value) {
|
|
241
|
-
cast(value);
|
|
242
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri);
|
|
243
|
-
}
|
|
244
|
-
function isEmitCodeToStringParams(value) {
|
|
245
|
-
cast(value);
|
|
246
|
-
return !isNullOrUndefined(value) && (value.workspaceFolderUri === void 0 || ls.URI.is(value.workspaceFolderUri));
|
|
247
|
-
}
|
|
248
|
-
function isDisplayFileSystemTreeParams(value) {
|
|
249
|
-
cast(value);
|
|
250
|
-
return !isNullOrUndefined(value) && (value.workspaceFolderUri === void 0 || ls.URI.is(value.workspaceFolderUri)) && (value.log === void 0 || typeof value.log === "boolean");
|
|
251
|
-
}
|
|
252
|
-
function isCreateOrUpdateSourceFileParams(value) {
|
|
253
|
-
cast(value);
|
|
254
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri) && typeof value.text === "string";
|
|
255
|
-
}
|
|
256
|
-
function isDeleteSourceFileParams(value) {
|
|
257
|
-
cast(value);
|
|
258
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri);
|
|
259
|
-
}
|
|
260
|
-
function isGetNodeRangeParams(value) {
|
|
261
|
-
cast(value);
|
|
262
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri);
|
|
263
|
-
}
|
|
264
|
-
function isAssignFieldParams(value) {
|
|
265
|
-
cast(value);
|
|
266
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.functionNodePath) && typeof value.fieldName === "string" && typeof value.value === "string" && (value.lastAssignmentLocation === void 0 || ls.DocumentUri.is(value.lastAssignmentLocation));
|
|
267
|
-
}
|
|
268
|
-
function isNullOrUndefined(value) {
|
|
269
|
-
return value === null || value === void 0;
|
|
270
|
-
}
|
|
271
|
-
function cast(value) {
|
|
272
|
-
}
|
|
195
|
+
var CustomRequestType = class extends ls.RequestType {
|
|
196
|
+
};
|
|
197
|
+
var customRequests = {
|
|
198
|
+
getLocalesAvailableForTranslation: new CustomRequestType("artel/getLocalesAvailableForTranslation"),
|
|
199
|
+
translateSourceFile: new CustomRequestType("artel/translateSourceFile"),
|
|
200
|
+
provideEvaluatableExpression: new CustomRequestType("artel/provideEvaluatableExpression"),
|
|
201
|
+
provideServerOwnedDocumentContent: new CustomRequestType("artel/provideServerOwnedDocumentContent"),
|
|
202
|
+
emitCodeToString: new CustomRequestType("artel/emitCodeToString"),
|
|
203
|
+
displayFileSystemTree: new CustomRequestType("artel/displayFileSystemTree"),
|
|
204
|
+
createOrUpdateSourceFile: new CustomRequestType("artel/fs.createOrUpdateSourceFile"),
|
|
205
|
+
deleteSourceFile: new CustomRequestType("artel/fs.deleteSourceFile"),
|
|
206
|
+
getNodeRange: new CustomRequestType("artel/getNodeRange"),
|
|
207
|
+
assignField: new CustomRequestType("artel/assignField"),
|
|
208
|
+
deleteBlockFromScript: new CustomRequestType("artel/deleteBlockFromScript")
|
|
209
|
+
};
|
|
273
210
|
|
|
274
211
|
// source/services/LanguageServer.ts
|
|
275
|
-
import { atomic as
|
|
212
|
+
import { atomic as atomic7, runAtomically as runAtomically2 } from "reactronic";
|
|
276
213
|
import * as ls3 from "vscode-languageserver";
|
|
277
214
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
278
|
-
import { URI
|
|
215
|
+
import { URI } from "vscode-uri";
|
|
279
216
|
|
|
280
217
|
// source/services/Types.ts
|
|
281
218
|
import * as ls2 from "vscode-languageserver";
|
|
@@ -517,7 +454,7 @@ var SyntaxFactory = class {
|
|
|
517
454
|
}
|
|
518
455
|
static structuredTypeDeclarationBody(structuredTypeKind, baseTypes, members) {
|
|
519
456
|
const structuredTypeKindKeyword = this.keyword(structuredTypeKind);
|
|
520
|
-
const baseTypeList = baseTypes !== void 0 ? new BaseTypeList(this.createTokenSeparatedElements(baseTypes, 25 /* Comma */), void 0) : void 0;
|
|
457
|
+
const baseTypeList = baseTypes !== void 0 && baseTypes.length > 0 ? new BaseTypeList(this.createTokenSeparatedElements(baseTypes, 25 /* Comma */), void 0) : void 0;
|
|
521
458
|
const memberBlock = this.typeMemberDeclarationBlock(members);
|
|
522
459
|
return new StructuredTypeDeclarationBody(
|
|
523
460
|
structuredTypeKindKeyword,
|
|
@@ -1110,17 +1047,17 @@ var SyntaxFactory = class {
|
|
|
1110
1047
|
|
|
1111
1048
|
// source/tree/SyntaxToCode.ts
|
|
1112
1049
|
var SyntaxToCode = class _SyntaxToCode {
|
|
1113
|
-
constructor(node,
|
|
1050
|
+
constructor(node, options7) {
|
|
1114
1051
|
this.code = "";
|
|
1115
1052
|
this.isIndentationWritten = false;
|
|
1116
1053
|
this.isSingleLineMode = false;
|
|
1117
1054
|
this.node = node;
|
|
1118
|
-
this.newLine =
|
|
1119
|
-
this.indentationStep =
|
|
1120
|
-
this.keywordsLocale =
|
|
1121
|
-
this.keywordsDialect =
|
|
1055
|
+
this.newLine = options7?.newLine ?? "\n";
|
|
1056
|
+
this.indentationStep = options7?.indentationStep ?? " ";
|
|
1057
|
+
this.keywordsLocale = options7?.keywordsLocale ?? 1 /* Ru */;
|
|
1058
|
+
this.keywordsDialect = options7?.keywordsDialect ?? DefaultDialect;
|
|
1122
1059
|
this.singleWordKeywordValues = Query.from(getOrCreateKeywordDictionary(this.keywordsLocale, this.keywordsDialect).values()).mapAndFilter((k) => k.keywordKind !== 0 /* Unknown */ ? k.value : void 0).uniqueToSet();
|
|
1123
|
-
this.indentation =
|
|
1060
|
+
this.indentation = options7?.initialIndentation ?? "";
|
|
1124
1061
|
}
|
|
1125
1062
|
static get writeFunctions() {
|
|
1126
1063
|
return this.writeFunctions_ ??= this.createWriteFunctions();
|
|
@@ -2606,7 +2543,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
|
2606
2543
|
}
|
|
2607
2544
|
isNotTranslatedEntity(entity) {
|
|
2608
2545
|
const translation = entity.getTranslation();
|
|
2609
|
-
return translation === void 0 || translation.definition.kind === "intrinsic"
|
|
2546
|
+
return translation === void 0 || translation.definition.kind === "intrinsic";
|
|
2610
2547
|
}
|
|
2611
2548
|
createPackageMemberTranslationNode(entity) {
|
|
2612
2549
|
switch (entity.kind) {
|
|
@@ -3452,11 +3389,9 @@ var CompletionService = class {
|
|
|
3452
3389
|
hasPrecedingKeyword = true;
|
|
3453
3390
|
}
|
|
3454
3391
|
if (translationsDeclaration !== void 0) {
|
|
3455
|
-
const sourceLocale = translationPackage.getTargetPackage().getLocale();
|
|
3456
3392
|
const translatedPackageMemberLookup = new PackageMemberLookup(translationPackage.getTargetPackage());
|
|
3457
3393
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
|
3458
3394
|
return new TopLevelTranslationListCompletionContext(
|
|
3459
|
-
sourceLocale,
|
|
3460
3395
|
translatedPackageMemberLookup,
|
|
3461
3396
|
hidingMatcher,
|
|
3462
3397
|
translationKind,
|
|
@@ -3493,7 +3428,6 @@ var CompletionService = class {
|
|
|
3493
3428
|
hasPrecedingKeyword = true;
|
|
3494
3429
|
}
|
|
3495
3430
|
if (typeTranslation !== void 0) {
|
|
3496
|
-
const sourceLocale = translationPackage.getTargetPackage().getLocale();
|
|
3497
3431
|
let type;
|
|
3498
3432
|
if (this.sourceFile.package.kind === "translation") {
|
|
3499
3433
|
const translationPackage2 = this.analyzer.getAnalyzedTranslationPackageIfTargetResolved(this.sourceFile.package);
|
|
@@ -3503,13 +3437,7 @@ var CompletionService = class {
|
|
|
3503
3437
|
}
|
|
3504
3438
|
}
|
|
3505
3439
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
|
3506
|
-
return new TypeMemberTranslationListCompletionContext(
|
|
3507
|
-
sourceLocale,
|
|
3508
|
-
type,
|
|
3509
|
-
hidingMatcher,
|
|
3510
|
-
translationKind,
|
|
3511
|
-
hasPrecedingKeyword
|
|
3512
|
-
);
|
|
3440
|
+
return new TypeMemberTranslationListCompletionContext(type, hidingMatcher, translationKind, hasPrecedingKeyword);
|
|
3513
3441
|
}
|
|
3514
3442
|
return void 0;
|
|
3515
3443
|
}
|
|
@@ -3992,8 +3920,8 @@ var CompletionService = class {
|
|
|
3992
3920
|
getTypeMemberCompletionItemInfos(ctx) {
|
|
3993
3921
|
const type = this.analyzer.excludeNullFromType(ctx.type);
|
|
3994
3922
|
const memberLookup = TypeMemberLookup.ofType(this.analyzer, type, this.locale);
|
|
3995
|
-
const
|
|
3996
|
-
return memberLookup.getNamedMembers(
|
|
3923
|
+
const options7 = ctx.isStaticAccess ? 2 /* OnlyStaticMembers */ : 1 /* OnlyInstanceMembers */;
|
|
3924
|
+
return memberLookup.getNamedMembers(options7, ctx.hidingMatcher, ctx.typeExtensionLookup).map((m) => {
|
|
3997
3925
|
switch (m.kind) {
|
|
3998
3926
|
case "method":
|
|
3999
3927
|
return new MethodCompletionItemInfo(this.completionItemInfoContext, m);
|
|
@@ -4002,7 +3930,7 @@ var CompletionService = class {
|
|
|
4002
3930
|
default:
|
|
4003
3931
|
Debug.never(m);
|
|
4004
3932
|
}
|
|
4005
|
-
}).concat(memberLookup.getOperators(
|
|
3933
|
+
}).concat(memberLookup.getOperators(options7, ctx.hidingMatcher, ctx.typeExtensionLookup).map((o) => new OperatorCompletionItemInfo(this.completionItemInfoContext, o)));
|
|
4006
3934
|
}
|
|
4007
3935
|
getPackageImportCompletionItemInfos(ctx) {
|
|
4008
3936
|
const result = this.analyzer.packageImports.getPackagesAvailableForImport(this.sourceFile.package).map((p) => p.getName()).filter((n) => {
|
|
@@ -4019,20 +3947,13 @@ var CompletionService = class {
|
|
|
4019
3947
|
}
|
|
4020
3948
|
getTopLevelAliasListCompletionItemInfos(ctx) {
|
|
4021
3949
|
let result;
|
|
4022
|
-
const displayService_ = new DisplayService(
|
|
4023
|
-
this.analyzer,
|
|
4024
|
-
ctx.sourceLocale,
|
|
4025
|
-
this.dialect,
|
|
4026
|
-
this.sourceFile
|
|
4027
|
-
);
|
|
4028
3950
|
if (ctx.translationKind === 1 /* Method */) {
|
|
4029
3951
|
result = Query.from(ctx.packageMemberLookup.getNamedMembers(ctx.hidingMatcher)).mapAndFilter((d) => {
|
|
4030
3952
|
if (d.kind === 1 /* Function */) {
|
|
4031
|
-
return new
|
|
3953
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4032
3954
|
this.completionItemInfoContext,
|
|
4033
3955
|
d,
|
|
4034
|
-
!ctx.hasPrecedingKeyword
|
|
4035
|
-
displayService_
|
|
3956
|
+
!ctx.hasPrecedingKeyword
|
|
4036
3957
|
);
|
|
4037
3958
|
}
|
|
4038
3959
|
return void 0;
|
|
@@ -4040,11 +3961,10 @@ var CompletionService = class {
|
|
|
4040
3961
|
} else if (ctx.translationKind === 2 /* Type */) {
|
|
4041
3962
|
result = Query.from(ctx.packageMemberLookup.getNamedMembers(ctx.hidingMatcher)).mapAndFilter((d) => {
|
|
4042
3963
|
if (d.kind === 2 /* Type */) {
|
|
4043
|
-
return new
|
|
3964
|
+
return new TranslationsSourcePackageTypeCompletionItemInfo(
|
|
4044
3965
|
this.completionItemInfoContext,
|
|
4045
3966
|
d,
|
|
4046
|
-
!ctx.hasPrecedingKeyword
|
|
4047
|
-
displayService_
|
|
3967
|
+
!ctx.hasPrecedingKeyword
|
|
4048
3968
|
);
|
|
4049
3969
|
}
|
|
4050
3970
|
return void 0;
|
|
@@ -4053,20 +3973,18 @@ var CompletionService = class {
|
|
|
4053
3973
|
result = Query.from(ctx.packageMemberLookup.getNamedMembers(ctx.hidingMatcher)).map((d) => {
|
|
4054
3974
|
switch (d.kind) {
|
|
4055
3975
|
case 0 /* Variable */:
|
|
4056
|
-
return new
|
|
3976
|
+
return new TranslationsSourceVariableCompletionItemInfo(this.completionItemInfoContext, d);
|
|
4057
3977
|
case 1 /* Function */:
|
|
4058
|
-
return new
|
|
3978
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4059
3979
|
this.completionItemInfoContext,
|
|
4060
3980
|
d,
|
|
4061
|
-
!ctx.hasPrecedingKeyword
|
|
4062
|
-
displayService_
|
|
3981
|
+
!ctx.hasPrecedingKeyword
|
|
4063
3982
|
);
|
|
4064
3983
|
case 2 /* Type */:
|
|
4065
|
-
return new
|
|
3984
|
+
return new TranslationsSourcePackageTypeCompletionItemInfo(
|
|
4066
3985
|
this.completionItemInfoContext,
|
|
4067
3986
|
d,
|
|
4068
|
-
!ctx.hasPrecedingKeyword
|
|
4069
|
-
displayService_
|
|
3987
|
+
!ctx.hasPrecedingKeyword
|
|
4070
3988
|
);
|
|
4071
3989
|
default:
|
|
4072
3990
|
Debug.never(d);
|
|
@@ -4081,7 +3999,7 @@ var CompletionService = class {
|
|
|
4081
3999
|
12 /* Function */
|
|
4082
4000
|
];
|
|
4083
4001
|
result = result.chain(
|
|
4084
|
-
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k,
|
|
4002
|
+
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))).flatMap((i) => i)
|
|
4085
4003
|
);
|
|
4086
4004
|
}
|
|
4087
4005
|
return result.toArray();
|
|
@@ -4089,55 +4007,45 @@ var CompletionService = class {
|
|
|
4089
4007
|
getTypeAliasMemberListItemInfos(ctx) {
|
|
4090
4008
|
let result = Query.empty();
|
|
4091
4009
|
if (ctx.typeEntity !== void 0) {
|
|
4092
|
-
const displayService_ = new DisplayService(
|
|
4093
|
-
this.analyzer,
|
|
4094
|
-
ctx.sourceLocale,
|
|
4095
|
-
this.dialect,
|
|
4096
|
-
this.sourceFile
|
|
4097
|
-
);
|
|
4098
4010
|
if (ctx.translationKind === 1 /* Method */) {
|
|
4099
4011
|
result = Query.from(ctx.typeEntity.getMembers().getNamedMembers()).mapAndFilter((m) => {
|
|
4100
4012
|
if (m.kind === 1 /* Function */) {
|
|
4101
|
-
return new
|
|
4013
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4102
4014
|
this.completionItemInfoContext,
|
|
4103
4015
|
m,
|
|
4104
|
-
!ctx.hasPrecedingKeyword
|
|
4105
|
-
displayService_
|
|
4016
|
+
!ctx.hasPrecedingKeyword
|
|
4106
4017
|
);
|
|
4107
4018
|
}
|
|
4108
4019
|
return void 0;
|
|
4109
4020
|
});
|
|
4110
4021
|
} else if (ctx.translationKind === 3 /* Constructor */) {
|
|
4111
|
-
result = Query.from(ctx.typeEntity.getMembers().getConstructors()).map((c) => new
|
|
4022
|
+
result = Query.from(ctx.typeEntity.getMembers().getConstructors()).map((c) => new TranslationsSourceConstructorCompletionItemInfo(
|
|
4112
4023
|
this.completionItemInfoContext,
|
|
4113
4024
|
c,
|
|
4114
|
-
!ctx.hasPrecedingKeyword
|
|
4115
|
-
displayService_
|
|
4025
|
+
!ctx.hasPrecedingKeyword
|
|
4116
4026
|
));
|
|
4117
4027
|
} else if (ctx.translationKind === 2 /* Indexer */) {
|
|
4118
|
-
result = Query.from(ctx.typeEntity.getMembers().getIndexers()).map((i) => new
|
|
4028
|
+
result = Query.from(ctx.typeEntity.getMembers().getIndexers()).map((i) => new TranslationsSourceIndexerCompletionItemInfo(this.completionItemInfoContext, i));
|
|
4119
4029
|
} else if (ctx.translationKind === 0 /* Any */) {
|
|
4120
4030
|
result = Query.from(ctx.typeEntity.getMembers().getNamedMembers()).mapAndFilter((m) => {
|
|
4121
4031
|
if (m.kind === 0 /* Variable */) {
|
|
4122
|
-
return new
|
|
4032
|
+
return new TranslationsSourceVariableCompletionItemInfo(this.completionItemInfoContext, m);
|
|
4123
4033
|
} else if (m.kind === 1 /* Function */) {
|
|
4124
|
-
return new
|
|
4034
|
+
return new TranslationsSourceFunctionCompletionItemInfo(
|
|
4125
4035
|
this.completionItemInfoContext,
|
|
4126
4036
|
m,
|
|
4127
|
-
!ctx.hasPrecedingKeyword
|
|
4128
|
-
displayService_
|
|
4037
|
+
!ctx.hasPrecedingKeyword
|
|
4129
4038
|
);
|
|
4130
4039
|
}
|
|
4131
4040
|
return void 0;
|
|
4132
4041
|
}).chain(
|
|
4133
|
-
ctx.typeEntity.getMembers().getConstructors().map((c) => new
|
|
4042
|
+
ctx.typeEntity.getMembers().getConstructors().map((c) => new TranslationsSourceConstructorCompletionItemInfo(
|
|
4134
4043
|
this.completionItemInfoContext,
|
|
4135
4044
|
c,
|
|
4136
|
-
!ctx.hasPrecedingKeyword
|
|
4137
|
-
displayService_
|
|
4045
|
+
!ctx.hasPrecedingKeyword
|
|
4138
4046
|
))
|
|
4139
4047
|
).chain(
|
|
4140
|
-
ctx.typeEntity.getMembers().getIndexers().map((i) => new
|
|
4048
|
+
ctx.typeEntity.getMembers().getIndexers().map((i) => new TranslationsSourceIndexerCompletionItemInfo(this.completionItemInfoContext, i))
|
|
4141
4049
|
);
|
|
4142
4050
|
} else {
|
|
4143
4051
|
Debug.never(ctx.translationKind);
|
|
@@ -4149,7 +4057,7 @@ var CompletionService = class {
|
|
|
4149
4057
|
31 /* Creation */
|
|
4150
4058
|
];
|
|
4151
4059
|
result = result.chain(
|
|
4152
|
-
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k,
|
|
4060
|
+
Query.from(keywords).map((k) => LocalizationHelper.localizeKeyword(k, this.locale, this.dialect).map((v) => new KeywordCompletionItemInfo(this.completionItemInfoContext, k, v))).flatMap((i) => i)
|
|
4153
4061
|
);
|
|
4154
4062
|
}
|
|
4155
4063
|
return result.toArray();
|
|
@@ -4203,7 +4111,7 @@ var CompletionService = class {
|
|
|
4203
4111
|
const seenLabels = /* @__PURE__ */ new Set();
|
|
4204
4112
|
const result = new Array();
|
|
4205
4113
|
for (const completionItemInfo of completionItemInfos) {
|
|
4206
|
-
if (completionItemInfo.kind === "
|
|
4114
|
+
if (completionItemInfo.kind === "translations-source-function" || completionItemInfo.kind === "translations-source-package-type") {
|
|
4207
4115
|
result.push(completionItemInfo);
|
|
4208
4116
|
continue;
|
|
4209
4117
|
}
|
|
@@ -4397,8 +4305,7 @@ var ExpressionCompletionContext = class {
|
|
|
4397
4305
|
}
|
|
4398
4306
|
};
|
|
4399
4307
|
var TopLevelTranslationListCompletionContext = class {
|
|
4400
|
-
constructor(
|
|
4401
|
-
this.sourceLocale = sourceLocale;
|
|
4308
|
+
constructor(packageMemberLookup, hidingMatcher, translationKind, hasPrecedingKeyword) {
|
|
4402
4309
|
this.packageMemberLookup = packageMemberLookup;
|
|
4403
4310
|
this.hidingMatcher = hidingMatcher;
|
|
4404
4311
|
this.translationKind = translationKind;
|
|
@@ -4407,8 +4314,7 @@ var TopLevelTranslationListCompletionContext = class {
|
|
|
4407
4314
|
}
|
|
4408
4315
|
};
|
|
4409
4316
|
var TypeMemberTranslationListCompletionContext = class {
|
|
4410
|
-
constructor(
|
|
4411
|
-
this.sourceLocale = sourceLocale;
|
|
4317
|
+
constructor(typeEntity, hidingMatcher, translationKind, hasPrecedingKeyword) {
|
|
4412
4318
|
this.typeEntity = typeEntity;
|
|
4413
4319
|
this.hidingMatcher = hidingMatcher;
|
|
4414
4320
|
this.translationKind = translationKind;
|
|
@@ -4769,12 +4675,11 @@ var TargetSignatureParameterCompletionItemInfo = class {
|
|
|
4769
4675
|
return void 0;
|
|
4770
4676
|
}
|
|
4771
4677
|
};
|
|
4772
|
-
var
|
|
4773
|
-
constructor(ctx, variable
|
|
4678
|
+
var TranslationsSourceVariableCompletionItemInfo = class {
|
|
4679
|
+
constructor(ctx, variable) {
|
|
4774
4680
|
this.ctx = ctx;
|
|
4775
4681
|
this.variable = variable;
|
|
4776
|
-
this.
|
|
4777
|
-
this.kind = "aliases-source-variable";
|
|
4682
|
+
this.kind = "translations-source-variable";
|
|
4778
4683
|
}
|
|
4779
4684
|
getLabel() {
|
|
4780
4685
|
return this.ctx.getInsertTextForName(this.variable.getName());
|
|
@@ -4794,7 +4699,7 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
|
4794
4699
|
}
|
|
4795
4700
|
}
|
|
4796
4701
|
getDetails() {
|
|
4797
|
-
return this.displayService.displayEntity(this.variable);
|
|
4702
|
+
return this.ctx.displayService.displayEntity(this.variable);
|
|
4798
4703
|
}
|
|
4799
4704
|
getInsertText() {
|
|
4800
4705
|
return void 0;
|
|
@@ -4806,13 +4711,12 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
|
4806
4711
|
return void 0;
|
|
4807
4712
|
}
|
|
4808
4713
|
};
|
|
4809
|
-
var
|
|
4810
|
-
constructor(ctx, func, includeFunctionKeyword
|
|
4714
|
+
var TranslationsSourceFunctionCompletionItemInfo = class {
|
|
4715
|
+
constructor(ctx, func, includeFunctionKeyword) {
|
|
4811
4716
|
this.ctx = ctx;
|
|
4812
4717
|
this.func = func;
|
|
4813
4718
|
this.includeFunctionKeyword = includeFunctionKeyword;
|
|
4814
|
-
this.
|
|
4815
|
-
this.kind = "aliases-source-function";
|
|
4719
|
+
this.kind = "translations-source-function";
|
|
4816
4720
|
}
|
|
4817
4721
|
getLabel() {
|
|
4818
4722
|
return this.ctx.getInsertTextForName(this.func.getName());
|
|
@@ -4830,15 +4734,14 @@ var AliasesSourceFunctionCompletionItemInfo = class {
|
|
|
4830
4734
|
}
|
|
4831
4735
|
}
|
|
4832
4736
|
getDetails() {
|
|
4833
|
-
return this.displayService.displayFunctionDeclaration(new FunctionDeclaration_entity(this.func));
|
|
4737
|
+
return this.ctx.displayService.displayFunctionDeclaration(new FunctionDeclaration_entity(this.func));
|
|
4834
4738
|
}
|
|
4835
4739
|
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;
|
|
4740
|
+
const keywordWithWhitespace = this.includeFunctionKeyword ? `${this.ctx.displayService.displayKeyword(12 /* Function */)} ` : "";
|
|
4741
|
+
const typeParameters = this.func.getTypeParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4742
|
+
const typeParametersWithAngles = typeParameters.length > 0 ? `<${typeParameters}>` : "";
|
|
4743
|
+
const parameters = this.func.getParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4744
|
+
return `${keywordWithWhitespace}${this.ctx.getInsertTextForName(this.func.getName())}${typeParametersWithAngles}(${parameters})`;
|
|
4842
4745
|
}
|
|
4843
4746
|
getSortText() {
|
|
4844
4747
|
return void 0;
|
|
@@ -4847,13 +4750,12 @@ var AliasesSourceFunctionCompletionItemInfo = class {
|
|
|
4847
4750
|
return void 0;
|
|
4848
4751
|
}
|
|
4849
4752
|
};
|
|
4850
|
-
var
|
|
4851
|
-
constructor(ctx, typeEntity, includeTypeKeyword
|
|
4753
|
+
var TranslationsSourcePackageTypeCompletionItemInfo = class {
|
|
4754
|
+
constructor(ctx, typeEntity, includeTypeKeyword) {
|
|
4852
4755
|
this.ctx = ctx;
|
|
4853
4756
|
this.typeEntity = typeEntity;
|
|
4854
4757
|
this.includeTypeKeyword = includeTypeKeyword;
|
|
4855
|
-
this.
|
|
4856
|
-
this.kind = "aliases-source-package-type";
|
|
4758
|
+
this.kind = "translations-source-package-type";
|
|
4857
4759
|
}
|
|
4858
4760
|
getLabel() {
|
|
4859
4761
|
return this.ctx.getInsertTextForName(this.typeEntity.getName());
|
|
@@ -4883,13 +4785,18 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
|
4883
4785
|
}
|
|
4884
4786
|
getDetails() {
|
|
4885
4787
|
const typeDeclaration = this.getDisplayServiceTypeDeclaration();
|
|
4886
|
-
return this.displayService.displayTypeDeclaration(typeDeclaration);
|
|
4788
|
+
return this.ctx.displayService.displayTypeDeclaration(typeDeclaration);
|
|
4887
4789
|
}
|
|
4888
4790
|
getInsertText() {
|
|
4889
|
-
const
|
|
4890
|
-
const
|
|
4891
|
-
const
|
|
4892
|
-
|
|
4791
|
+
const keywordWithWhitespace = this.includeTypeKeyword ? `${this.ctx.displayService.displayKeyword(16 /* Type */)} ` : "";
|
|
4792
|
+
const typeParameters = this.typeEntity.getTypeParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4793
|
+
const typeParametersWithAngles = typeParameters.length > 0 ? `<${typeParameters}>` : "";
|
|
4794
|
+
let result = `${keywordWithWhitespace}${this.ctx.getInsertTextForName(this.typeEntity.getName())}${typeParametersWithAngles}`;
|
|
4795
|
+
if (this.typeEntity.typeEntityKind === 0 /* Function */) {
|
|
4796
|
+
const parameters = this.typeEntity.getParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4797
|
+
result = `${result}(${parameters})`;
|
|
4798
|
+
}
|
|
4799
|
+
return result;
|
|
4893
4800
|
}
|
|
4894
4801
|
getSortText() {
|
|
4895
4802
|
return void 0;
|
|
@@ -4920,16 +4827,15 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
|
4920
4827
|
return void 0;
|
|
4921
4828
|
}
|
|
4922
4829
|
};
|
|
4923
|
-
var
|
|
4924
|
-
constructor(ctx, indexer
|
|
4830
|
+
var TranslationsSourceIndexerCompletionItemInfo = class {
|
|
4831
|
+
constructor(ctx, indexer) {
|
|
4925
4832
|
this.ctx = ctx;
|
|
4926
4833
|
this.indexer = indexer;
|
|
4927
|
-
this.
|
|
4928
|
-
this.kind = "aliases-source-type-indexer";
|
|
4834
|
+
this.kind = "translations-source-type-indexer";
|
|
4929
4835
|
this.label_ = new Cached();
|
|
4930
4836
|
}
|
|
4931
4837
|
get label() {
|
|
4932
|
-
return this.label_.getOrInsertWith(() => this.displayService.displayIndexerDeclaration(new IndexerDeclaration_entity(this.indexer)));
|
|
4838
|
+
return this.label_.getOrInsertWith(() => this.ctx.displayService.displayIndexerDeclaration(new IndexerDeclaration_entity(this.indexer)));
|
|
4933
4839
|
}
|
|
4934
4840
|
getLabel() {
|
|
4935
4841
|
return this.label;
|
|
@@ -4951,20 +4857,19 @@ var AliasesSourceIndexerCompletionItemInfo = class {
|
|
|
4951
4857
|
return void 0;
|
|
4952
4858
|
}
|
|
4953
4859
|
};
|
|
4954
|
-
var
|
|
4955
|
-
constructor(ctx, constructor_, includeOnCreateKeyword
|
|
4860
|
+
var TranslationsSourceConstructorCompletionItemInfo = class {
|
|
4861
|
+
constructor(ctx, constructor_, includeOnCreateKeyword) {
|
|
4956
4862
|
this.ctx = ctx;
|
|
4957
4863
|
this.constructor_ = constructor_;
|
|
4958
4864
|
this.includeOnCreateKeyword = includeOnCreateKeyword;
|
|
4959
|
-
this.
|
|
4960
|
-
this.kind = "aliases-source-type-constructor";
|
|
4865
|
+
this.kind = "translations-source-type-constructor";
|
|
4961
4866
|
this.label_ = new Cached();
|
|
4962
4867
|
}
|
|
4963
4868
|
get label() {
|
|
4964
4869
|
return this.label_.getOrInsertWith(() => {
|
|
4965
4870
|
const constructorDeclaration = new ConstructorDeclaration_entity(this.constructor_);
|
|
4966
|
-
const displayParts = this.displayService.getConstructorDeclarationDisplayParts(constructorDeclaration);
|
|
4967
|
-
const creationKeyword = this.displayService.displayKeyword(31 /* Creation */);
|
|
4871
|
+
const displayParts = this.ctx.displayService.getConstructorDeclarationDisplayParts(constructorDeclaration);
|
|
4872
|
+
const creationKeyword = this.ctx.displayService.displayKeyword(31 /* Creation */);
|
|
4968
4873
|
return creationKeyword + displayParts.parametersStart + displayParts.parameters.map((p) => p.toString()).join(displayParts.parameterSeparator) + displayParts.parametersEnd;
|
|
4969
4874
|
});
|
|
4970
4875
|
}
|
|
@@ -4978,7 +4883,7 @@ var AliasesSourceConstructorCompletionItemInfo = class {
|
|
|
4978
4883
|
return this.label;
|
|
4979
4884
|
}
|
|
4980
4885
|
getInsertText() {
|
|
4981
|
-
const creationKeyword = this.includeOnCreateKeyword ? this.displayService.displayKeyword(31 /* Creation */) : "";
|
|
4886
|
+
const creationKeyword = this.includeOnCreateKeyword ? this.ctx.displayService.displayKeyword(31 /* Creation */) : "";
|
|
4982
4887
|
const parameters = this.constructor_.getParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
|
4983
4888
|
return `${creationKeyword}(${parameters})`;
|
|
4984
4889
|
}
|
|
@@ -5653,21 +5558,21 @@ var CompletionItemInfoCache = class {
|
|
|
5653
5558
|
|
|
5654
5559
|
// source/services/NodeSemanticInfo.ts
|
|
5655
5560
|
var NodeSemanticInfoService = class {
|
|
5656
|
-
static ofTokenOrKeyword(analyzer, tokenOrKeyword,
|
|
5561
|
+
static ofTokenOrKeyword(analyzer, tokenOrKeyword, options7) {
|
|
5657
5562
|
if (isIdentifier(tokenOrKeyword.value)) {
|
|
5658
|
-
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value,
|
|
5563
|
+
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options7);
|
|
5659
5564
|
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind === 69 /* AutotypeCallExpression */) {
|
|
5660
|
-
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent,
|
|
5565
|
+
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent, options7);
|
|
5661
5566
|
} else if (tokenOrKeyword.parent.kind === 75 /* PrefixUnaryExpression */) {
|
|
5662
|
-
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5567
|
+
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5663
5568
|
} else if (tokenOrKeyword.parent.kind === 64 /* BinaryExpression */) {
|
|
5664
|
-
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5569
|
+
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5665
5570
|
} else if (tokenOrKeyword.isToken(20 /* Caret */) && (tokenOrKeyword.parent.kind === 48 /* DereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 49 /* DereferencedVariableSetterDeclaration */)) {
|
|
5666
5571
|
return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
|
|
5667
5572
|
} else if (tokenOrKeyword.isToken(20 /* Caret */) && tokenOrKeyword.parent.kind === 78 /* DereferenceExpression */) {
|
|
5668
|
-
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5573
|
+
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5669
5574
|
} else if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
|
5670
|
-
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent,
|
|
5575
|
+
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5671
5576
|
} else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 43 /* ConstructorDeclaration */) {
|
|
5672
5577
|
return this.ofConstructorDeclaration(analyzer, tokenOrKeyword.parent);
|
|
5673
5578
|
} else if (tokenOrKeyword.isToken(14 /* Asterisk */) && tokenOrKeyword.parent.kind === 91 /* DefaultMatchExpression */) {
|
|
@@ -5677,46 +5582,46 @@ var NodeSemanticInfoService = class {
|
|
|
5677
5582
|
} else if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && tokenOrKeyword.parent.parent.kind === 66 /* FunctionBlockLiteral */) {
|
|
5678
5583
|
return this.ofRegularOrBlockFunctionLiteral(analyzer, tokenOrKeyword.parent.parent);
|
|
5679
5584
|
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 87 /* ObjectExpression */) {
|
|
5680
|
-
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent,
|
|
5585
|
+
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options7);
|
|
5681
5586
|
} else if (tokenOrKeyword.isKeyword(56 /* Base */) && tokenOrKeyword.parent.kind === 88 /* BaseExpression */) {
|
|
5682
|
-
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent,
|
|
5587
|
+
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options7);
|
|
5683
5588
|
} else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 47 /* IndexParameterClause */) {
|
|
5684
5589
|
return this.ofIndexedElementAccessorDeclaration(analyzer, tokenOrKeyword.parent.parent);
|
|
5685
5590
|
} else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 70 /* IndexedAccessExpression */) {
|
|
5686
|
-
return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5591
|
+
return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5687
5592
|
} else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 127 /* ConstructorTranslation */) {
|
|
5688
|
-
return this.ofConstructorTranslationSourceConstructor(analyzer, tokenOrKeyword.parent,
|
|
5593
|
+
return this.ofConstructorTranslationSourceConstructor(analyzer, tokenOrKeyword.parent, options7);
|
|
5689
5594
|
} else if ((tokenOrKeyword.isToken(45 /* OpenParenthesis */) || tokenOrKeyword.isToken(22 /* CloseParenthesis */)) && tokenOrKeyword.parent.kind === 126 /* TranslationParameterClause */ && tokenOrKeyword.parent.parent.kind === 127 /* ConstructorTranslation */ && tokenOrKeyword.parent.parent.translatedParameterClause === tokenOrKeyword.parent) {
|
|
5690
|
-
return this.ofConstructorTranslationTranslatedConstructor(analyzer, tokenOrKeyword.parent.parent,
|
|
5595
|
+
return this.ofConstructorTranslationTranslatedConstructor(analyzer, tokenOrKeyword.parent.parent, options7);
|
|
5691
5596
|
} else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 128 /* IndexParameterTranslationClause */ && tokenOrKeyword.parent.parent.kind === 129 /* IndexerTranslation */ && tokenOrKeyword.parent.parent.sourceParameterClause === tokenOrKeyword.parent) {
|
|
5692
|
-
return this.ofIndexerTranslationSourceIndexer(analyzer, tokenOrKeyword.parent.parent,
|
|
5597
|
+
return this.ofIndexerTranslationSourceIndexer(analyzer, tokenOrKeyword.parent.parent, options7);
|
|
5693
5598
|
} else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 128 /* IndexParameterTranslationClause */ && tokenOrKeyword.parent.parent.kind === 129 /* IndexerTranslation */ && tokenOrKeyword.parent.parent.translatedParameterClause === tokenOrKeyword.parent) {
|
|
5694
|
-
return this.ofIndexerTranslationTranslatedIndexer(analyzer, tokenOrKeyword.parent.parent,
|
|
5599
|
+
return this.ofIndexerTranslationTranslatedIndexer(analyzer, tokenOrKeyword.parent.parent, options7);
|
|
5695
5600
|
}
|
|
5696
5601
|
return void 0;
|
|
5697
5602
|
}
|
|
5698
5603
|
static ofRegularOrBlockFunctionLiteral(analyzer, node) {
|
|
5699
|
-
const
|
|
5700
|
-
return new
|
|
5604
|
+
const entity = analyzer.entity.ofRegularOrBlockFunctionLiteral(node);
|
|
5605
|
+
return new DefinitionNodeSemanticInfo(entity);
|
|
5701
5606
|
}
|
|
5702
5607
|
static ofDefaultMatchExpression(analyzer, node) {
|
|
5703
5608
|
const type = analyzer.type.ofExpression(node);
|
|
5704
5609
|
return new DefaultSwitchMatchNodeSemanticInfo(type);
|
|
5705
5610
|
}
|
|
5706
|
-
static ofNonKeywordIdentifier(analyzer, node,
|
|
5611
|
+
static ofNonKeywordIdentifier(analyzer, node, options7) {
|
|
5707
5612
|
let result;
|
|
5708
5613
|
const parent = node.parent;
|
|
5709
5614
|
switch (parent.kind) {
|
|
5710
5615
|
case 130 /* TranslationTypeParameterList */:
|
|
5711
|
-
return this.ofTranslationTypeParameterListParameter(analyzer, node, parent,
|
|
5616
|
+
return this.ofTranslationTypeParameterListParameter(analyzer, node, parent, options7);
|
|
5712
5617
|
case 125 /* TranslationParameterList */:
|
|
5713
|
-
return this.ofTranslationParameterListParameter(analyzer, node, parent,
|
|
5618
|
+
return this.ofTranslationParameterListParameter(analyzer, node, parent, options7);
|
|
5714
5619
|
case 150 /* Argument */: {
|
|
5715
5620
|
const respectiveParameter = analyzer.getRespectiveParameter(parent);
|
|
5716
5621
|
if (respectiveParameter !== void 0) {
|
|
5717
5622
|
const target = new MatchResultParameterReferenceTarget(respectiveParameter, 0 /* Get */);
|
|
5718
5623
|
result = new ReferenceNodeSemanticInfo([target], false);
|
|
5719
|
-
if (
|
|
5624
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5720
5625
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5721
5626
|
}
|
|
5722
5627
|
}
|
|
@@ -5747,7 +5652,7 @@ var NodeSemanticInfoService = class {
|
|
|
5747
5652
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageVariantTypeDeclaration(parent));
|
|
5748
5653
|
break;
|
|
5749
5654
|
case 89 /* IdentifierExpression */:
|
|
5750
|
-
result = this.ofIdentifierExpression(analyzer, parent,
|
|
5655
|
+
result = this.ofIdentifierExpression(analyzer, parent, options7);
|
|
5751
5656
|
break;
|
|
5752
5657
|
case 56 /* NestedFunctionDeclaration */:
|
|
5753
5658
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofNestedFunctionDeclaration(parent));
|
|
@@ -5756,7 +5661,7 @@ var NodeSemanticInfoService = class {
|
|
|
5756
5661
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
|
|
5757
5662
|
break;
|
|
5758
5663
|
case 135 /* QualifiedName */:
|
|
5759
|
-
result = this.ofQualifiedNameQualifier(analyzer, parent, node,
|
|
5664
|
+
result = this.ofQualifiedNameQualifier(analyzer, parent, node, options7);
|
|
5760
5665
|
break;
|
|
5761
5666
|
case 136 /* PackageVariableTranslationDeclaration */:
|
|
5762
5667
|
case 132 /* PackageFunctionTranslationDeclaration */:
|
|
@@ -5768,7 +5673,7 @@ var NodeSemanticInfoService = class {
|
|
|
5768
5673
|
if (node === parent.sourceName) {
|
|
5769
5674
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
5770
5675
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5771
|
-
if (
|
|
5676
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5772
5677
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5773
5678
|
}
|
|
5774
5679
|
} else if (node === parent.translatedName) {
|
|
@@ -5777,7 +5682,7 @@ var NodeSemanticInfoService = class {
|
|
|
5777
5682
|
0 /* Get */
|
|
5778
5683
|
));
|
|
5779
5684
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5780
|
-
if (
|
|
5685
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5781
5686
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5782
5687
|
}
|
|
5783
5688
|
}
|
|
@@ -5792,7 +5697,7 @@ var NodeSemanticInfoService = class {
|
|
|
5792
5697
|
if (node === parent.sourceName) {
|
|
5793
5698
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
5794
5699
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5795
|
-
if (
|
|
5700
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5796
5701
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5797
5702
|
}
|
|
5798
5703
|
} else if (node === parent.translatedName) {
|
|
@@ -5801,7 +5706,7 @@ var NodeSemanticInfoService = class {
|
|
|
5801
5706
|
0 /* Get */
|
|
5802
5707
|
));
|
|
5803
5708
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5804
|
-
if (
|
|
5709
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5805
5710
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5806
5711
|
}
|
|
5807
5712
|
}
|
|
@@ -5818,7 +5723,7 @@ var NodeSemanticInfoService = class {
|
|
|
5818
5723
|
result = void 0;
|
|
5819
5724
|
break;
|
|
5820
5725
|
case 76 /* MemberAccessExpression */:
|
|
5821
|
-
result = this.ofMember(analyzer, parent,
|
|
5726
|
+
result = this.ofMember(analyzer, parent, options7);
|
|
5822
5727
|
break;
|
|
5823
5728
|
case 50 /* MethodDeclaration */:
|
|
5824
5729
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofMethodDeclaration(parent));
|
|
@@ -5854,7 +5759,7 @@ var NodeSemanticInfoService = class {
|
|
|
5854
5759
|
}
|
|
5855
5760
|
return result;
|
|
5856
5761
|
}
|
|
5857
|
-
static ofMember(analyzer, node,
|
|
5762
|
+
static ofMember(analyzer, node, options7) {
|
|
5858
5763
|
let result;
|
|
5859
5764
|
const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
|
|
5860
5765
|
switch (meaning.kind) {
|
|
@@ -5960,7 +5865,7 @@ var NodeSemanticInfoService = class {
|
|
|
5960
5865
|
callExpressionMeaning.singleNotSuitableSubstitutedCandidate,
|
|
5961
5866
|
callExpressionMeaning.suitableConstructors,
|
|
5962
5867
|
callExpressionMeaning.candidates,
|
|
5963
|
-
|
|
5868
|
+
options7
|
|
5964
5869
|
);
|
|
5965
5870
|
break;
|
|
5966
5871
|
}
|
|
@@ -5979,7 +5884,7 @@ var NodeSemanticInfoService = class {
|
|
|
5979
5884
|
default:
|
|
5980
5885
|
Debug.never(meaning);
|
|
5981
5886
|
}
|
|
5982
|
-
if (result !== void 0 &&
|
|
5887
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
5983
5888
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5984
5889
|
}
|
|
5985
5890
|
return result;
|
|
@@ -5988,19 +5893,19 @@ var NodeSemanticInfoService = class {
|
|
|
5988
5893
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
5989
5894
|
}
|
|
5990
5895
|
}
|
|
5991
|
-
static ofQualifiedNameQualifier(analyzer, node, qualifier,
|
|
5896
|
+
static ofQualifiedNameQualifier(analyzer, node, qualifier, options7) {
|
|
5992
5897
|
switch (node.parent.kind) {
|
|
5993
5898
|
case 10 /* NamedTypeSpecifier */:
|
|
5994
|
-
return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier,
|
|
5899
|
+
return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier, options7);
|
|
5995
5900
|
case 152 /* Tag */:
|
|
5996
|
-
return this.ofTagNameQualifier(analyzer, node.parent, qualifier,
|
|
5901
|
+
return this.ofTagNameQualifier(analyzer, node.parent, qualifier, options7);
|
|
5997
5902
|
case 40 /* ExtendedTypeClause */:
|
|
5998
5903
|
return void 0;
|
|
5999
5904
|
default:
|
|
6000
5905
|
Debug.never(node.parent);
|
|
6001
5906
|
}
|
|
6002
5907
|
}
|
|
6003
|
-
static ofNamedTypeSpecifierNameQualifier(analyzer, node, qualifier,
|
|
5908
|
+
static ofNamedTypeSpecifierNameQualifier(analyzer, node, qualifier, options7) {
|
|
6004
5909
|
let result;
|
|
6005
5910
|
const resolutionResult = analyzer.resolveNamedTypeSpecifier(node);
|
|
6006
5911
|
const qualifierIndex = node.qualifiedName.qualifiers.toArray().indexOf(qualifier);
|
|
@@ -6047,12 +5952,12 @@ var NodeSemanticInfoService = class {
|
|
|
6047
5952
|
result = new ReferenceNodeSemanticInfo(targets, true);
|
|
6048
5953
|
}
|
|
6049
5954
|
}
|
|
6050
|
-
if (result !== void 0 &&
|
|
5955
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6051
5956
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6052
5957
|
}
|
|
6053
5958
|
return result;
|
|
6054
5959
|
}
|
|
6055
|
-
static ofTagNameQualifier(analyzer, node, qualifier,
|
|
5960
|
+
static ofTagNameQualifier(analyzer, node, qualifier, options7) {
|
|
6056
5961
|
let result;
|
|
6057
5962
|
const resolutionResult = analyzer.resolveTag(node);
|
|
6058
5963
|
const qualifierIndex = node.name.qualifiers.toArray().indexOf(qualifier);
|
|
@@ -6077,7 +5982,7 @@ var NodeSemanticInfoService = class {
|
|
|
6077
5982
|
resolutionResult.meaning.singleNotSuitableSubstitutedCandidate,
|
|
6078
5983
|
resolutionResult.meaning.suitableConstructors,
|
|
6079
5984
|
resolutionResult.meaning.candidates,
|
|
6080
|
-
|
|
5985
|
+
options7
|
|
6081
5986
|
);
|
|
6082
5987
|
}
|
|
6083
5988
|
break;
|
|
@@ -6131,12 +6036,12 @@ var NodeSemanticInfoService = class {
|
|
|
6131
6036
|
result = new ReferenceNodeSemanticInfo(targets, true);
|
|
6132
6037
|
}
|
|
6133
6038
|
}
|
|
6134
|
-
if (result !== void 0 &&
|
|
6039
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6135
6040
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6136
6041
|
}
|
|
6137
6042
|
return result;
|
|
6138
6043
|
}
|
|
6139
|
-
static ofIdentifierExpression(analyzer, node,
|
|
6044
|
+
static ofIdentifierExpression(analyzer, node, options7) {
|
|
6140
6045
|
let result;
|
|
6141
6046
|
const meaning = analyzer.resolveIdentifierExpression(node).meaning;
|
|
6142
6047
|
switch (meaning.kind) {
|
|
@@ -6165,7 +6070,7 @@ var NodeSemanticInfoService = class {
|
|
|
6165
6070
|
callExpressionMeaning.singleNotSuitableSubstitutedCandidate,
|
|
6166
6071
|
callExpressionMeaning.suitableConstructors,
|
|
6167
6072
|
callExpressionMeaning.candidates,
|
|
6168
|
-
|
|
6073
|
+
options7
|
|
6169
6074
|
);
|
|
6170
6075
|
break;
|
|
6171
6076
|
}
|
|
@@ -6244,7 +6149,7 @@ var NodeSemanticInfoService = class {
|
|
|
6244
6149
|
default:
|
|
6245
6150
|
Debug.never(meaning);
|
|
6246
6151
|
}
|
|
6247
|
-
if (result !== void 0 &&
|
|
6152
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6248
6153
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6249
6154
|
}
|
|
6250
6155
|
return result;
|
|
@@ -6261,7 +6166,7 @@ var NodeSemanticInfoService = class {
|
|
|
6261
6166
|
const entity = analyzer.entity.ofIndexerDeclaration(node);
|
|
6262
6167
|
return new DefinitionNodeSemanticInfo(entity);
|
|
6263
6168
|
}
|
|
6264
|
-
static ofIndexedAccessExpressionOperator(analyzer, node,
|
|
6169
|
+
static ofIndexedAccessExpressionOperator(analyzer, node, options7) {
|
|
6265
6170
|
const meaning = analyzer.resolveIndexedAccessExpression(node).meaning;
|
|
6266
6171
|
if (meaning.kind === "resolved") {
|
|
6267
6172
|
let result;
|
|
@@ -6274,7 +6179,7 @@ var NodeSemanticInfoService = class {
|
|
|
6274
6179
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
|
6275
6180
|
result = createIndexersReference(meaning.candidates, meaning.accessKind, true);
|
|
6276
6181
|
}
|
|
6277
|
-
if (result !== void 0 &&
|
|
6182
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6278
6183
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6279
6184
|
}
|
|
6280
6185
|
return result;
|
|
@@ -6285,14 +6190,14 @@ var NodeSemanticInfoService = class {
|
|
|
6285
6190
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
6286
6191
|
}
|
|
6287
6192
|
}
|
|
6288
|
-
static ofAssignmentStatementOperator(analyzer, node,
|
|
6193
|
+
static ofAssignmentStatementOperator(analyzer, node, options7) {
|
|
6289
6194
|
const operatorKind = analyzer.getBinaryOperatorKindIfCompoundAssignmentOperator(node.operator);
|
|
6290
6195
|
if (operatorKind !== void 0) {
|
|
6291
6196
|
const operator = analyzer.resolveCompoundAssignmentStatementOperator(node, operatorKind);
|
|
6292
6197
|
if (operator.kind === "ok") {
|
|
6293
6198
|
const target = new OperatorReferenceTarget(operator.value);
|
|
6294
6199
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6295
|
-
if (
|
|
6200
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6296
6201
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6297
6202
|
}
|
|
6298
6203
|
return result;
|
|
@@ -6300,14 +6205,14 @@ var NodeSemanticInfoService = class {
|
|
|
6300
6205
|
}
|
|
6301
6206
|
return void 0;
|
|
6302
6207
|
}
|
|
6303
|
-
static ofBinaryExpressionOperator(analyzer, node,
|
|
6208
|
+
static ofBinaryExpressionOperator(analyzer, node, options7) {
|
|
6304
6209
|
const classificationResult = analyzer.classifyBinaryExpressionOperator(node.operator);
|
|
6305
6210
|
if (classificationResult.kind === "user-definable") {
|
|
6306
6211
|
const operator = analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
|
|
6307
6212
|
if (operator.kind === "ok") {
|
|
6308
6213
|
const target = new OperatorReferenceTarget(operator.value);
|
|
6309
6214
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6310
|
-
if (
|
|
6215
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6311
6216
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6312
6217
|
}
|
|
6313
6218
|
return result;
|
|
@@ -6315,12 +6220,12 @@ var NodeSemanticInfoService = class {
|
|
|
6315
6220
|
}
|
|
6316
6221
|
return void 0;
|
|
6317
6222
|
}
|
|
6318
|
-
static ofPrefixUnaryExpressionOperator(analyzer, node,
|
|
6223
|
+
static ofPrefixUnaryExpressionOperator(analyzer, node, options7) {
|
|
6319
6224
|
const operator = analyzer.resolvePrefixUnaryExpressionUserDefinableOperator(node);
|
|
6320
6225
|
if (operator.kind === "ok") {
|
|
6321
6226
|
const target = new OperatorReferenceTarget(operator.value);
|
|
6322
6227
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6323
|
-
if (
|
|
6228
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6324
6229
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6325
6230
|
}
|
|
6326
6231
|
return result;
|
|
@@ -6331,19 +6236,19 @@ var NodeSemanticInfoService = class {
|
|
|
6331
6236
|
const entity = analyzer.entity.ofDereferenceOperatorDeclaration(node);
|
|
6332
6237
|
return new DefinitionNodeSemanticInfo(entity);
|
|
6333
6238
|
}
|
|
6334
|
-
static ofDereferenceExpressionOperator(analyzer, node,
|
|
6239
|
+
static ofDereferenceExpressionOperator(analyzer, node, options7) {
|
|
6335
6240
|
const meaning = analyzer.getDereferenceExpressionMeaning(node);
|
|
6336
6241
|
if (meaning.kind === "resolved") {
|
|
6337
6242
|
const target = new DereferenceOperatorReferenceTarget(meaning.operator, meaning.accessKind);
|
|
6338
6243
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6339
|
-
if (
|
|
6244
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6340
6245
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6341
6246
|
}
|
|
6342
6247
|
return result;
|
|
6343
6248
|
}
|
|
6344
6249
|
return void 0;
|
|
6345
6250
|
}
|
|
6346
|
-
static ofAutotypeCallExpression(analyzer, node,
|
|
6251
|
+
static ofAutotypeCallExpression(analyzer, node, options7) {
|
|
6347
6252
|
const meaning = analyzer.resolveAutotypeCallExpression(node).meaning;
|
|
6348
6253
|
let result;
|
|
6349
6254
|
if (meaning.kind === "constructor-call") {
|
|
@@ -6357,12 +6262,12 @@ var NodeSemanticInfoService = class {
|
|
|
6357
6262
|
result = this.ofConstructors(analyzer, constructors);
|
|
6358
6263
|
}
|
|
6359
6264
|
}
|
|
6360
|
-
if (result !== void 0 &&
|
|
6265
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6361
6266
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6362
6267
|
}
|
|
6363
6268
|
return result;
|
|
6364
6269
|
}
|
|
6365
|
-
static ofObjectExpression(analyzer, node,
|
|
6270
|
+
static ofObjectExpression(analyzer, node, options7) {
|
|
6366
6271
|
const meaning = analyzer.resolveObjectExpression(node).meaning;
|
|
6367
6272
|
let result;
|
|
6368
6273
|
switch (meaning.kind) {
|
|
@@ -6389,12 +6294,12 @@ var NodeSemanticInfoService = class {
|
|
|
6389
6294
|
default:
|
|
6390
6295
|
Debug.never(meaning);
|
|
6391
6296
|
}
|
|
6392
|
-
if (result !== void 0 &&
|
|
6297
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6393
6298
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6394
6299
|
}
|
|
6395
6300
|
return result;
|
|
6396
6301
|
}
|
|
6397
|
-
static ofBaseExpression(analyzer, node,
|
|
6302
|
+
static ofBaseExpression(analyzer, node, options7) {
|
|
6398
6303
|
const meaning = analyzer.resolveBaseExpression(node).meaning;
|
|
6399
6304
|
let result;
|
|
6400
6305
|
switch (meaning.kind) {
|
|
@@ -6428,64 +6333,64 @@ var NodeSemanticInfoService = class {
|
|
|
6428
6333
|
default:
|
|
6429
6334
|
Debug.never(meaning);
|
|
6430
6335
|
}
|
|
6431
|
-
if (result !== void 0 &&
|
|
6336
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6432
6337
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6433
6338
|
}
|
|
6434
6339
|
return result;
|
|
6435
6340
|
}
|
|
6436
|
-
static ofConstructorTranslationSourceConstructor(analyzer, node,
|
|
6341
|
+
static ofConstructorTranslationSourceConstructor(analyzer, node, options7) {
|
|
6437
6342
|
let result;
|
|
6438
6343
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6439
6344
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6440
|
-
if (translationTargets !== void 0) {
|
|
6345
|
+
if (translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6441
6346
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6442
6347
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6443
|
-
if (
|
|
6348
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6444
6349
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6445
6350
|
}
|
|
6446
6351
|
}
|
|
6447
6352
|
return result;
|
|
6448
6353
|
}
|
|
6449
|
-
static ofConstructorTranslationTranslatedConstructor(analyzer, node,
|
|
6354
|
+
static ofConstructorTranslationTranslatedConstructor(analyzer, node, options7) {
|
|
6450
6355
|
let result;
|
|
6451
6356
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6452
6357
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6453
|
-
if (translationPackage !== void 0 && translationTargets !== void 0) {
|
|
6358
|
+
if (translationPackage !== void 0 && translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6454
6359
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(
|
|
6455
6360
|
translationPackage.localizationContext.getLocalizedTypeMemberEntity(t),
|
|
6456
6361
|
0 /* Get */
|
|
6457
6362
|
));
|
|
6458
6363
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6459
|
-
if (
|
|
6364
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6460
6365
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6461
6366
|
}
|
|
6462
6367
|
}
|
|
6463
6368
|
return result;
|
|
6464
6369
|
}
|
|
6465
|
-
static ofIndexerTranslationSourceIndexer(analyzer, node,
|
|
6370
|
+
static ofIndexerTranslationSourceIndexer(analyzer, node, options7) {
|
|
6466
6371
|
let result;
|
|
6467
6372
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6468
6373
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6469
|
-
if (translationTargets !== void 0) {
|
|
6374
|
+
if (translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6470
6375
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6471
6376
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6472
|
-
if (
|
|
6377
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6473
6378
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6474
6379
|
}
|
|
6475
6380
|
}
|
|
6476
6381
|
return result;
|
|
6477
6382
|
}
|
|
6478
|
-
static ofIndexerTranslationTranslatedIndexer(analyzer, node,
|
|
6383
|
+
static ofIndexerTranslationTranslatedIndexer(analyzer, node, options7) {
|
|
6479
6384
|
let result;
|
|
6480
6385
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6481
6386
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6482
|
-
if (translationPackage !== void 0 && translationTargets !== void 0) {
|
|
6387
|
+
if (translationPackage !== void 0 && translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6483
6388
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(
|
|
6484
6389
|
translationPackage.localizationContext.getLocalizedTypeMemberEntity(t),
|
|
6485
6390
|
0 /* Get */
|
|
6486
6391
|
));
|
|
6487
6392
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6488
|
-
if (
|
|
6393
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6489
6394
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6490
6395
|
}
|
|
6491
6396
|
}
|
|
@@ -6507,8 +6412,8 @@ var NodeSemanticInfoService = class {
|
|
|
6507
6412
|
}
|
|
6508
6413
|
return new ReferenceNodeSemanticInfo([new PackageReferenceTarget(packageTreeNode.package)], false);
|
|
6509
6414
|
}
|
|
6510
|
-
static ofConstructorCallWithTypeAccess(analyzer, suitableType, typeCandidates, singleNotSuitableSubstitutedCandidate, suitableConstructors, candidates,
|
|
6511
|
-
if (
|
|
6415
|
+
static ofConstructorCallWithTypeAccess(analyzer, suitableType, typeCandidates, singleNotSuitableSubstitutedCandidate, suitableConstructors, candidates, options7) {
|
|
6416
|
+
if (options7.preferredTargetOfExplicitConstructorCall === "type-declaration") {
|
|
6512
6417
|
const targets2 = suitableType !== void 0 ? [new EntityReferenceTarget(suitableType, 0 /* Get */)] : typeCandidates.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6513
6418
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets2), targets2.length > 1);
|
|
6514
6419
|
}
|
|
@@ -6526,7 +6431,7 @@ var NodeSemanticInfoService = class {
|
|
|
6526
6431
|
const targets = suitableType !== void 0 ? [new EntityReferenceTarget(suitableType, 0 /* Get */)] : typeCandidates.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6527
6432
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
6528
6433
|
}
|
|
6529
|
-
static ofTranslationTypeParameterListParameter(analyzer, node, typeParameterList,
|
|
6434
|
+
static ofTranslationTypeParameterListParameter(analyzer, node, typeParameterList, options7) {
|
|
6530
6435
|
const parameterIndex = typeParameterList.typeParameters.indexOf(node);
|
|
6531
6436
|
if (parameterIndex < 0) {
|
|
6532
6437
|
return void 0;
|
|
@@ -6564,14 +6469,14 @@ var NodeSemanticInfoService = class {
|
|
|
6564
6469
|
if (isNonEmptyArray(typeParameters)) {
|
|
6565
6470
|
const targets = typeParameters.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6566
6471
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6567
|
-
if (
|
|
6472
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6568
6473
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6569
6474
|
}
|
|
6570
6475
|
}
|
|
6571
6476
|
}
|
|
6572
6477
|
return result;
|
|
6573
6478
|
}
|
|
6574
|
-
static ofTranslationParameterListParameter(analyzer, node, parameterList,
|
|
6479
|
+
static ofTranslationParameterListParameter(analyzer, node, parameterList, options7) {
|
|
6575
6480
|
const parameterIndex = parameterList.parameters.indexOf(node);
|
|
6576
6481
|
if (parameterIndex < 0) {
|
|
6577
6482
|
return void 0;
|
|
@@ -6610,7 +6515,7 @@ var NodeSemanticInfoService = class {
|
|
|
6610
6515
|
if (isNonEmptyArray(typeParameters)) {
|
|
6611
6516
|
const targets = typeParameters.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6612
6517
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6613
|
-
if (
|
|
6518
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6614
6519
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6615
6520
|
}
|
|
6616
6521
|
}
|
|
@@ -6807,12 +6712,6 @@ var DefaultSwitchMatchNodeSemanticInfo = class {
|
|
|
6807
6712
|
this.kind = "default-switch-match";
|
|
6808
6713
|
}
|
|
6809
6714
|
};
|
|
6810
|
-
var RegularOrBlockFunctionLiteralNodeSemanticInfo = class {
|
|
6811
|
-
constructor(type) {
|
|
6812
|
-
this.type = type;
|
|
6813
|
-
this.kind = "regular-or-block-function-literal";
|
|
6814
|
-
}
|
|
6815
|
-
};
|
|
6816
6715
|
|
|
6817
6716
|
// source/services/Utils.ts
|
|
6818
6717
|
function getEntitySourceLocations(analyzer, entity) {
|
|
@@ -6921,6 +6820,12 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
|
6921
6820
|
case 49 /* DereferencedVariableSetterDeclaration */:
|
|
6922
6821
|
range = node.caretToken.rangeWithoutTrivia;
|
|
6923
6822
|
break;
|
|
6823
|
+
case 65 /* FunctionLiteral */:
|
|
6824
|
+
range = node.functionKeyword.rangeWithoutTrivia;
|
|
6825
|
+
break;
|
|
6826
|
+
case 66 /* FunctionBlockLiteral */:
|
|
6827
|
+
range = node.block.openBraceToken.rangeWithoutTrivia;
|
|
6828
|
+
break;
|
|
6924
6829
|
default:
|
|
6925
6830
|
Debug.never(node);
|
|
6926
6831
|
}
|
|
@@ -6945,7 +6850,7 @@ var DefinitionService = class {
|
|
|
6945
6850
|
constructor(sourceGenerationService) {
|
|
6946
6851
|
this.sourceGenerationService = sourceGenerationService;
|
|
6947
6852
|
}
|
|
6948
|
-
getDefinition(analyzer, sourceFile, offset,
|
|
6853
|
+
getDefinition(analyzer, sourceFile, offset, taskController) {
|
|
6949
6854
|
return __async(this, null, function* () {
|
|
6950
6855
|
const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSingleWithHighestPriority((t) => {
|
|
6951
6856
|
if (t.isToken(10 /* Identifier */) || t.isKeyword()) {
|
|
@@ -6959,11 +6864,11 @@ var DefinitionService = class {
|
|
|
6959
6864
|
if (tokenOrKeyword === void 0) {
|
|
6960
6865
|
return void 0;
|
|
6961
6866
|
}
|
|
6962
|
-
const
|
|
6867
|
+
const options7 = {
|
|
6963
6868
|
includeBetterReferenceTargets: true,
|
|
6964
6869
|
preferredTargetOfExplicitConstructorCall: "constructor-declaration"
|
|
6965
6870
|
};
|
|
6966
|
-
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword,
|
|
6871
|
+
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword, options7);
|
|
6967
6872
|
if (semanticInfo === void 0) {
|
|
6968
6873
|
return void 0;
|
|
6969
6874
|
}
|
|
@@ -6982,8 +6887,6 @@ var DefinitionService = class {
|
|
|
6982
6887
|
}
|
|
6983
6888
|
case "default-switch-match":
|
|
6984
6889
|
break;
|
|
6985
|
-
case "regular-or-block-function-literal":
|
|
6986
|
-
break;
|
|
6987
6890
|
default:
|
|
6988
6891
|
Debug.never(semanticInfo);
|
|
6989
6892
|
}
|
|
@@ -6995,7 +6898,7 @@ var DefinitionService = class {
|
|
|
6995
6898
|
const locations = yield this.sourceGenerationService.getDefinitionInGeneratedCode(
|
|
6996
6899
|
analyzer,
|
|
6997
6900
|
referencedEntity,
|
|
6998
|
-
|
|
6901
|
+
taskController
|
|
6999
6902
|
);
|
|
7000
6903
|
if (locations !== void 0) {
|
|
7001
6904
|
sourceLocations.push(...locations);
|
|
@@ -7177,31 +7080,63 @@ var DefinitionsAndReferenceInfo = class {
|
|
|
7177
7080
|
}
|
|
7178
7081
|
};
|
|
7179
7082
|
|
|
7083
|
+
// source/services/DeleteBlockFromScriptService.ts
|
|
7084
|
+
var DeleteBlockFromScriptService = class {
|
|
7085
|
+
createEditDeletingBlock(sourceFile, subprogramDeclaration) {
|
|
7086
|
+
let result;
|
|
7087
|
+
if (NodeTypeUtils.isRegularOrBlockFunctionLiteral(subprogramDeclaration) && subprogramDeclaration.parent.kind === 150 /* Argument */ && subprogramDeclaration.parent.parent.parent.kind === 68 /* CallExpression */) {
|
|
7088
|
+
const callExpression = subprogramDeclaration.parent.parent.parent;
|
|
7089
|
+
let rangeStart = callExpression.rangeWithoutTrivia.start;
|
|
7090
|
+
let rangeEnd = callExpression.rangeWithoutTrivia.end;
|
|
7091
|
+
const leadingTrivia = callExpression.findLeftmostToken()?.selectLeadingTrivia(() => true);
|
|
7092
|
+
const lastLeadingTrivia = leadingTrivia !== void 0 && leadingTrivia.length > 0 ? leadingTrivia[leadingTrivia.length - 1] : void 0;
|
|
7093
|
+
if (lastLeadingTrivia?.kind === 0 /* Whitespace */) {
|
|
7094
|
+
rangeStart = lastLeadingTrivia.range.start;
|
|
7095
|
+
}
|
|
7096
|
+
const trailingTrivia = callExpression.findRightmostToken()?.selectTrailingTrivia(() => true);
|
|
7097
|
+
if (trailingTrivia !== void 0) {
|
|
7098
|
+
let trailingTriviaIndex = -1;
|
|
7099
|
+
if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 0 /* Whitespace */) {
|
|
7100
|
+
trailingTriviaIndex++;
|
|
7101
|
+
}
|
|
7102
|
+
if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 1 /* NewLine */) {
|
|
7103
|
+
trailingTriviaIndex++;
|
|
7104
|
+
}
|
|
7105
|
+
if (trailingTriviaIndex >= 0) {
|
|
7106
|
+
rangeEnd = trailingTrivia[trailingTriviaIndex].range.end;
|
|
7107
|
+
}
|
|
7108
|
+
}
|
|
7109
|
+
result = new SourceFileEdit(sourceFile, new Range(rangeStart, rangeEnd), "");
|
|
7110
|
+
}
|
|
7111
|
+
return result;
|
|
7112
|
+
}
|
|
7113
|
+
};
|
|
7114
|
+
|
|
7180
7115
|
// source/services/ReferencesService.ts
|
|
7181
7116
|
var ReferencesService = class {
|
|
7182
|
-
getReferencesInCompilation(analyzer, sourceFile, offset,
|
|
7117
|
+
getReferencesInCompilation(analyzer, sourceFile, offset, options7, taskController) {
|
|
7183
7118
|
return __async(this, null, function* () {
|
|
7184
7119
|
return this.getReferencesInFiles(
|
|
7185
7120
|
analyzer,
|
|
7186
7121
|
sourceFile,
|
|
7187
7122
|
offset,
|
|
7188
7123
|
analyzer.compilation.enumerateSourceFiles(),
|
|
7189
|
-
|
|
7190
|
-
|
|
7124
|
+
options7,
|
|
7125
|
+
taskController
|
|
7191
7126
|
);
|
|
7192
7127
|
});
|
|
7193
7128
|
}
|
|
7194
|
-
getReferencesInFiles(analyzer, sourceFile, offset, sourceFiles,
|
|
7129
|
+
getReferencesInFiles(analyzer, sourceFile, offset, sourceFiles, options7, taskController) {
|
|
7195
7130
|
return __async(this, null, function* () {
|
|
7196
|
-
const definitions = this.getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset,
|
|
7131
|
+
const definitions = this.getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset, options7);
|
|
7197
7132
|
if (definitions.length === 0) {
|
|
7198
7133
|
return [];
|
|
7199
7134
|
}
|
|
7200
|
-
const allowAmbiguous =
|
|
7201
|
-
const isForRename =
|
|
7135
|
+
const allowAmbiguous = options7.allowAmbiguous;
|
|
7136
|
+
const isForRename = options7.isForRename ?? false;
|
|
7202
7137
|
const result = [];
|
|
7203
7138
|
const firstDefinition = definitions[0];
|
|
7204
|
-
const restrictions = this.getReferenceRestrictions(firstDefinition,
|
|
7139
|
+
const restrictions = this.getReferenceRestrictions(firstDefinition, options7);
|
|
7205
7140
|
let semanticInfoOptions;
|
|
7206
7141
|
if (firstDefinition.value.kind === 7 /* Constructor */) {
|
|
7207
7142
|
semanticInfoOptions = {
|
|
@@ -7215,11 +7150,10 @@ var ReferencesService = class {
|
|
|
7215
7150
|
};
|
|
7216
7151
|
}
|
|
7217
7152
|
for (const sourceFile2 of sourceFiles) {
|
|
7218
|
-
yield
|
|
7153
|
+
yield traverseTree(
|
|
7219
7154
|
sourceFile2.getSyntaxNode(),
|
|
7220
|
-
cancellationToken,
|
|
7221
|
-
LanguageServer.DefaultCancellationTokenThrottleTime,
|
|
7222
7155
|
true,
|
|
7156
|
+
taskController,
|
|
7223
7157
|
(node) => {
|
|
7224
7158
|
if (isIdentifier(node) && restrictions.canBeIdentifier && node.parent.kind !== 3 /* Keyword */) {
|
|
7225
7159
|
const semanticInfo = NodeSemanticInfoService.ofNonKeywordIdentifier(analyzer, node, semanticInfoOptions);
|
|
@@ -7233,7 +7167,7 @@ var ReferencesService = class {
|
|
|
7233
7167
|
result.push(new Reference(sourceFile2, node.rangeWithoutTrivia, referenceKind));
|
|
7234
7168
|
}
|
|
7235
7169
|
}
|
|
7236
|
-
if (!
|
|
7170
|
+
if (!options7.onlyNamed) {
|
|
7237
7171
|
if (node.kind === 69 /* AutotypeCallExpression */ && restrictions.canBeAutotypeCall) {
|
|
7238
7172
|
const semanticInfo = NodeSemanticInfoService.ofAutotypeCallExpression(analyzer, node, semanticInfoOptions);
|
|
7239
7173
|
const referenceKind = this.ifReferenceToSomeOfDefinitionsThenKind(
|
|
@@ -7467,13 +7401,14 @@ var ReferencesService = class {
|
|
|
7467
7401
|
}
|
|
7468
7402
|
}
|
|
7469
7403
|
}
|
|
7404
|
+
return void 0;
|
|
7470
7405
|
}
|
|
7471
7406
|
);
|
|
7472
7407
|
}
|
|
7473
7408
|
return result;
|
|
7474
7409
|
});
|
|
7475
7410
|
}
|
|
7476
|
-
getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset,
|
|
7411
|
+
getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset, options7) {
|
|
7477
7412
|
const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSingleWithHighestPriority((t) => {
|
|
7478
7413
|
if (t.isToken(10 /* Identifier */) || t.isKeyword()) {
|
|
7479
7414
|
return 2;
|
|
@@ -7487,7 +7422,7 @@ var ReferencesService = class {
|
|
|
7487
7422
|
return [];
|
|
7488
7423
|
}
|
|
7489
7424
|
let semanticInfoOptions;
|
|
7490
|
-
if (
|
|
7425
|
+
if (options7.onlyNamed) {
|
|
7491
7426
|
semanticInfoOptions = {
|
|
7492
7427
|
includeBetterReferenceTargets: true,
|
|
7493
7428
|
preferredTargetOfExplicitConstructorCall: "type-declaration"
|
|
@@ -7512,8 +7447,6 @@ var ReferencesService = class {
|
|
|
7512
7447
|
return getDefinitionOfReference(info);
|
|
7513
7448
|
case "default-switch-match":
|
|
7514
7449
|
return [];
|
|
7515
|
-
case "regular-or-block-function-literal":
|
|
7516
|
-
return [];
|
|
7517
7450
|
default:
|
|
7518
7451
|
Debug.never(info);
|
|
7519
7452
|
}
|
|
@@ -7705,8 +7638,13 @@ var ReferencesService = class {
|
|
|
7705
7638
|
Debug.never(entity);
|
|
7706
7639
|
}
|
|
7707
7640
|
}
|
|
7708
|
-
case 1 /* Function */:
|
|
7709
|
-
|
|
7641
|
+
case 1 /* Function */: {
|
|
7642
|
+
const naming = entity.getNaming();
|
|
7643
|
+
if (naming.kind === "named") {
|
|
7644
|
+
return { name: naming.value };
|
|
7645
|
+
}
|
|
7646
|
+
return void 0;
|
|
7647
|
+
}
|
|
7710
7648
|
case 10 /* PackageAlias */:
|
|
7711
7649
|
return { name: entity.getName() };
|
|
7712
7650
|
case 3 /* Getter */:
|
|
@@ -7758,9 +7696,9 @@ var DocumentHighlightsService = class _DocumentHighlightsService {
|
|
|
7758
7696
|
constructor() {
|
|
7759
7697
|
this.referencesService = new ReferencesService();
|
|
7760
7698
|
}
|
|
7761
|
-
getDocumentHighlights(analyzer, sourceFile, offset,
|
|
7699
|
+
getDocumentHighlights(analyzer, sourceFile, offset, taskController) {
|
|
7762
7700
|
return __async(this, null, function* () {
|
|
7763
|
-
const
|
|
7701
|
+
const options7 = {
|
|
7764
7702
|
onlyWithSameAlias: false,
|
|
7765
7703
|
onlyNamed: false,
|
|
7766
7704
|
allowAmbiguous: true
|
|
@@ -7770,8 +7708,8 @@ var DocumentHighlightsService = class _DocumentHighlightsService {
|
|
|
7770
7708
|
sourceFile,
|
|
7771
7709
|
offset,
|
|
7772
7710
|
[sourceFile],
|
|
7773
|
-
|
|
7774
|
-
|
|
7711
|
+
options7,
|
|
7712
|
+
taskController
|
|
7775
7713
|
);
|
|
7776
7714
|
const result = references.map((r) => ({
|
|
7777
7715
|
range: r.range,
|
|
@@ -7988,11 +7926,11 @@ var HoverService = class {
|
|
|
7988
7926
|
if (tokenOrKeyword === void 0) {
|
|
7989
7927
|
return void 0;
|
|
7990
7928
|
}
|
|
7991
|
-
const
|
|
7929
|
+
const options7 = {
|
|
7992
7930
|
includeBetterReferenceTargets: false,
|
|
7993
7931
|
preferredTargetOfExplicitConstructorCall: "constructor-declaration"
|
|
7994
7932
|
};
|
|
7995
|
-
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword,
|
|
7933
|
+
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword, options7);
|
|
7996
7934
|
if (semanticInfo === void 0) {
|
|
7997
7935
|
return void 0;
|
|
7998
7936
|
}
|
|
@@ -8012,8 +7950,6 @@ var HoverService = class {
|
|
|
8012
7950
|
`*: ${this.displayService.displayType(semanticInfo.type)}`,
|
|
8013
7951
|
tokenOrKeyword.value.rangeWithoutTrivia
|
|
8014
7952
|
);
|
|
8015
|
-
case "regular-or-block-function-literal":
|
|
8016
|
-
return new Hover(this.displayService.displayType(semanticInfo.type), tokenOrKeyword.value.rangeWithoutTrivia);
|
|
8017
7953
|
default:
|
|
8018
7954
|
Debug.never(semanticInfo);
|
|
8019
7955
|
}
|
|
@@ -8423,11 +8359,11 @@ var RenameService = class {
|
|
|
8423
8359
|
const checkResult = this.canRename(analyzer, sourceFile, offset);
|
|
8424
8360
|
return checkResult?.renameRange;
|
|
8425
8361
|
}
|
|
8426
|
-
rename(analyzer, sourceFile, offset, newText,
|
|
8362
|
+
rename(analyzer, sourceFile, offset, newText, taskController) {
|
|
8427
8363
|
return __async(this, null, function* () {
|
|
8428
8364
|
let result;
|
|
8429
8365
|
if (this.canRename(analyzer, sourceFile, offset) !== void 0) {
|
|
8430
|
-
const
|
|
8366
|
+
const options7 = {
|
|
8431
8367
|
onlyWithSameAlias: true,
|
|
8432
8368
|
onlyNamed: true,
|
|
8433
8369
|
allowAmbiguous: false,
|
|
@@ -8439,8 +8375,8 @@ var RenameService = class {
|
|
|
8439
8375
|
sourceFile,
|
|
8440
8376
|
offset,
|
|
8441
8377
|
sourceFiles,
|
|
8442
|
-
|
|
8443
|
-
|
|
8378
|
+
options7,
|
|
8379
|
+
taskController
|
|
8444
8380
|
);
|
|
8445
8381
|
result = references.map((r) => new Rename(r.sourceFile, r.range, newText));
|
|
8446
8382
|
} else {
|
|
@@ -8454,11 +8390,11 @@ var RenameService = class {
|
|
|
8454
8390
|
if (!(tokenOrKeyword !== void 0 && isIdentifier(tokenOrKeyword.value))) {
|
|
8455
8391
|
return void 0;
|
|
8456
8392
|
}
|
|
8457
|
-
const
|
|
8393
|
+
const options7 = {
|
|
8458
8394
|
includeBetterReferenceTargets: false,
|
|
8459
8395
|
preferredTargetOfExplicitConstructorCall: "type-declaration"
|
|
8460
8396
|
};
|
|
8461
|
-
const semanticInfo = NodeSemanticInfoService.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value,
|
|
8397
|
+
const semanticInfo = NodeSemanticInfoService.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options7);
|
|
8462
8398
|
if (semanticInfo !== void 0) {
|
|
8463
8399
|
if (semanticInfo.kind === "reference") {
|
|
8464
8400
|
if (semanticInfo.isAmbiguous) {
|
|
@@ -8601,27 +8537,26 @@ var SelectionRange = class {
|
|
|
8601
8537
|
|
|
8602
8538
|
// source/services/SemanticTokensService.ts
|
|
8603
8539
|
var SemanticTokensService = class {
|
|
8604
|
-
getSemanticTokens(analyzer, sourceFile,
|
|
8540
|
+
getSemanticTokens(analyzer, sourceFile, taskController) {
|
|
8605
8541
|
return __async(this, null, function* () {
|
|
8606
8542
|
return this.getSemanticTokensInRange(
|
|
8607
8543
|
analyzer,
|
|
8608
8544
|
sourceFile,
|
|
8609
8545
|
sourceFile.getSyntaxNode().rangeWithTrivia,
|
|
8610
|
-
|
|
8546
|
+
taskController
|
|
8611
8547
|
);
|
|
8612
8548
|
});
|
|
8613
8549
|
}
|
|
8614
|
-
getSemanticTokensInRange(analyzer, sourceFile, range,
|
|
8550
|
+
getSemanticTokensInRange(analyzer, sourceFile, range, taskController) {
|
|
8615
8551
|
return __async(this, null, function* () {
|
|
8616
8552
|
const result = new Array();
|
|
8617
|
-
yield
|
|
8553
|
+
yield traverseTree(
|
|
8618
8554
|
sourceFile.getSyntaxNode(),
|
|
8619
|
-
cancellationToken,
|
|
8620
|
-
LanguageServer.DefaultCancellationTokenThrottleTime,
|
|
8621
8555
|
false,
|
|
8556
|
+
taskController,
|
|
8622
8557
|
(node, controller) => {
|
|
8623
8558
|
if (!this.rangesOverlap(range, node.rangeWithoutTrivia)) {
|
|
8624
|
-
controller.
|
|
8559
|
+
controller.skipChildrenTraverse();
|
|
8625
8560
|
return;
|
|
8626
8561
|
}
|
|
8627
8562
|
if (node.kind === 89 /* IdentifierExpression */) {
|
|
@@ -8665,7 +8600,7 @@ var SemanticTokensService = class {
|
|
|
8665
8600
|
result.push(
|
|
8666
8601
|
new SemanticToken(
|
|
8667
8602
|
node.rangeWithoutTrivia,
|
|
8668
|
-
this.
|
|
8603
|
+
this.getSemanticTokenKindForNamedFunctionEntity(func.getEntity()),
|
|
8669
8604
|
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(func.value.getName()))
|
|
8670
8605
|
)
|
|
8671
8606
|
);
|
|
@@ -8709,7 +8644,7 @@ var SemanticTokensService = class {
|
|
|
8709
8644
|
result.push(
|
|
8710
8645
|
new SemanticToken(
|
|
8711
8646
|
node.memberName.rangeWithoutTrivia,
|
|
8712
|
-
this.
|
|
8647
|
+
this.getSemanticTokenKindForNamedFunctionEntity(func.getEntity()),
|
|
8713
8648
|
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(func.getName()))
|
|
8714
8649
|
)
|
|
8715
8650
|
);
|
|
@@ -8759,6 +8694,7 @@ var SemanticTokensService = class {
|
|
|
8759
8694
|
new SemanticToken(node.name.rangeWithoutTrivia, 7 /* Operator */, new SemanticTokenModifiers().makeDeclaration())
|
|
8760
8695
|
);
|
|
8761
8696
|
}
|
|
8697
|
+
return void 0;
|
|
8762
8698
|
}
|
|
8763
8699
|
);
|
|
8764
8700
|
return result.sort((t1, t2) => t1.range.start - t2.range.end);
|
|
@@ -8767,7 +8703,7 @@ var SemanticTokensService = class {
|
|
|
8767
8703
|
rangesOverlap(range1, range2) {
|
|
8768
8704
|
return range1.start < range2.end && range1.end > range2.start;
|
|
8769
8705
|
}
|
|
8770
|
-
|
|
8706
|
+
getSemanticTokenKindForNamedFunctionEntity(entity) {
|
|
8771
8707
|
switch (entity.subkind) {
|
|
8772
8708
|
case "package":
|
|
8773
8709
|
return 4 /* PackageFunction */;
|
|
@@ -9412,7 +9348,16 @@ var SignatureInfo = class {
|
|
|
9412
9348
|
};
|
|
9413
9349
|
|
|
9414
9350
|
// source/services/source-generation/SourceGenerationService.ts
|
|
9415
|
-
import {
|
|
9351
|
+
import {
|
|
9352
|
+
atomic as atomic6,
|
|
9353
|
+
observable as observable7,
|
|
9354
|
+
ObservableMap as ObservableMap6,
|
|
9355
|
+
ObservableObject as ObservableObject7,
|
|
9356
|
+
options as options6,
|
|
9357
|
+
reactive as reactive6,
|
|
9358
|
+
Reentrance as Reentrance3,
|
|
9359
|
+
Transaction as Transaction4
|
|
9360
|
+
} from "reactronic";
|
|
9416
9361
|
|
|
9417
9362
|
// source/services/workspace/ClientTrackedSourceFiles.ts
|
|
9418
9363
|
import { ObservableMap, ObservableObject, observable, atomic, disposeObservableObject } from "reactronic";
|
|
@@ -9577,6 +9522,30 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9577
9522
|
get state() {
|
|
9578
9523
|
return this.state_;
|
|
9579
9524
|
}
|
|
9525
|
+
waitFullyLoadedAndConfigsProcessed(taskController) {
|
|
9526
|
+
return __async(this, null, function* () {
|
|
9527
|
+
yield this.waitFullyLoaded();
|
|
9528
|
+
while (!this.hasAllConfigsProcessed()) {
|
|
9529
|
+
if (taskController.shouldYieldOnceOutOf100()) {
|
|
9530
|
+
yield taskController.yieldTask();
|
|
9531
|
+
}
|
|
9532
|
+
taskController.throwIfCancellationRequested();
|
|
9533
|
+
}
|
|
9534
|
+
});
|
|
9535
|
+
}
|
|
9536
|
+
hasAllConfigsProcessed() {
|
|
9537
|
+
switch (this.state) {
|
|
9538
|
+
case 2 /* ProcessedPackageConfigsWithErrors */:
|
|
9539
|
+
case 3 /* LoadedMainCompilation */:
|
|
9540
|
+
case 4 /* ErrorsCreatingAnalyzer */:
|
|
9541
|
+
return true;
|
|
9542
|
+
case 0 /* Created */:
|
|
9543
|
+
case 1 /* ProcessingInitialPackageConfigs */:
|
|
9544
|
+
return false;
|
|
9545
|
+
default:
|
|
9546
|
+
Debug.never(this.state);
|
|
9547
|
+
}
|
|
9548
|
+
}
|
|
9580
9549
|
waitFullyLoaded() {
|
|
9581
9550
|
return __async(this, null, function* () {
|
|
9582
9551
|
yield Transaction.outside(() => __async(this, null, function* () {
|
|
@@ -9654,12 +9623,14 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9654
9623
|
// Включаем логирование только при первой загрузке.
|
|
9655
9624
|
additionalPackageContents: this.config.additionalPackageContents
|
|
9656
9625
|
};
|
|
9626
|
+
const currentTransaction = Transaction.current;
|
|
9657
9627
|
const loadResult = yield runNonReactively(() => __async(this, null, function* () {
|
|
9628
|
+
const taskController = new TaskController(50, new GenericCancellationToken(() => currentTransaction.isCanceled));
|
|
9658
9629
|
return yield CompilationLoader.loadFromFileSystemTree(
|
|
9659
9630
|
this.rootDirectory,
|
|
9660
9631
|
this.fileSystemTree,
|
|
9661
|
-
|
|
9662
|
-
|
|
9632
|
+
taskController,
|
|
9633
|
+
loaderOptions
|
|
9663
9634
|
);
|
|
9664
9635
|
}));
|
|
9665
9636
|
this.previousCompilationLoadResult = loadResult;
|
|
@@ -9903,7 +9874,7 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9903
9874
|
if (compilationState === void 0) {
|
|
9904
9875
|
return;
|
|
9905
9876
|
}
|
|
9906
|
-
const
|
|
9877
|
+
const taskController = new TaskController(50, new GenericCancellationToken(() => currentTransaction.isCanceled));
|
|
9907
9878
|
try {
|
|
9908
9879
|
for (const package_ of compilationState.analyzer.compilation.userPackages) {
|
|
9909
9880
|
for (const sourceFile of package_.sourceFiles) {
|
|
@@ -9912,7 +9883,7 @@ var CompilationController = class extends ObservableObject2 {
|
|
|
9912
9883
|
}
|
|
9913
9884
|
const diagnostics = yield compilationState.collectSourceFileDiagnosticsWithLowPriority(
|
|
9914
9885
|
sourceFile,
|
|
9915
|
-
|
|
9886
|
+
taskController
|
|
9916
9887
|
);
|
|
9917
9888
|
if (currentTransaction.isCanceled) {
|
|
9918
9889
|
return;
|
|
@@ -10101,36 +10072,36 @@ var ReadonlyCompilationState = class {
|
|
|
10101
10072
|
this.version = version;
|
|
10102
10073
|
this.diagnosticsCollectionSummaryByUri = /* @__PURE__ */ new Map();
|
|
10103
10074
|
}
|
|
10104
|
-
collectSourceFileDiagnosticsWithHighPriority(sourceFile,
|
|
10075
|
+
collectSourceFileDiagnosticsWithHighPriority(sourceFile, taskController) {
|
|
10105
10076
|
return __async(this, null, function* () {
|
|
10106
|
-
const { diagnostics, summary } = yield this.
|
|
10077
|
+
const { diagnostics, summary } = yield this.analyzeSourceFile(sourceFile, taskController);
|
|
10107
10078
|
this.diagnosticsCollectionSummaryByUri.set(sourceFile.uri.toString(), summary);
|
|
10108
10079
|
return diagnostics;
|
|
10109
10080
|
});
|
|
10110
10081
|
}
|
|
10111
|
-
collectSourceFileDiagnosticsWithLowPriority(sourceFile,
|
|
10082
|
+
collectSourceFileDiagnosticsWithLowPriority(sourceFile, taskController) {
|
|
10112
10083
|
return __async(this, null, function* () {
|
|
10113
10084
|
yield highPriorityDiagnosticsCollectionIndicator.whenIdle();
|
|
10114
|
-
const { diagnostics, summary } = yield this.
|
|
10085
|
+
const { diagnostics, summary } = yield this.analyzeSourceFile(sourceFile, taskController);
|
|
10115
10086
|
this.diagnosticsCollectionSummaryByUri.set(sourceFile.uri.toString(), summary);
|
|
10116
10087
|
return diagnostics;
|
|
10117
10088
|
});
|
|
10118
10089
|
}
|
|
10119
|
-
getDiagnosticsCollectionSummary(sourceFile,
|
|
10090
|
+
getDiagnosticsCollectionSummary(sourceFile, taskController) {
|
|
10120
10091
|
return __async(this, null, function* () {
|
|
10121
10092
|
let result = this.diagnosticsCollectionSummaryByUri.get(sourceFile.uri.toString());
|
|
10122
10093
|
if (result === void 0) {
|
|
10123
|
-
const { summary } = yield this.
|
|
10094
|
+
const { summary } = yield this.analyzeSourceFile(sourceFile, taskController);
|
|
10124
10095
|
result = summary;
|
|
10125
10096
|
this.diagnosticsCollectionSummaryByUri.set(sourceFile.uri.toString(), summary);
|
|
10126
10097
|
}
|
|
10127
10098
|
return result;
|
|
10128
10099
|
});
|
|
10129
10100
|
}
|
|
10130
|
-
|
|
10101
|
+
analyzeSourceFile(sourceFile, taskController) {
|
|
10131
10102
|
return __async(this, null, function* () {
|
|
10132
|
-
const
|
|
10133
|
-
const diagnostics = yield
|
|
10103
|
+
const sourceFileAnalyzer = new SourceFileAnalyzer(this.analyzer, sourceFile);
|
|
10104
|
+
const diagnostics = yield sourceFileAnalyzer.analyze(taskController);
|
|
10134
10105
|
const summary = this.createDiagnosticsCollectionSummary(diagnostics);
|
|
10135
10106
|
return { diagnostics, summary };
|
|
10136
10107
|
});
|
|
@@ -10503,9 +10474,9 @@ var FileSystemTreeProviderBasedOnWatchedFileSystem = class extends ObservableObj
|
|
|
10503
10474
|
this.trackedSourceFiles = trackedSourceFiles;
|
|
10504
10475
|
this.isInitialized = true;
|
|
10505
10476
|
}
|
|
10506
|
-
waitLoaded(
|
|
10477
|
+
waitLoaded(taskController) {
|
|
10507
10478
|
return __async(this, null, function* () {
|
|
10508
|
-
yield this.taskQueue.waitAllTasksProcessed(
|
|
10479
|
+
yield this.taskQueue.waitAllTasksProcessed(taskController);
|
|
10509
10480
|
});
|
|
10510
10481
|
}
|
|
10511
10482
|
dispose() {
|
|
@@ -10850,7 +10821,7 @@ var FileSystemTreeProviderBasedOnWatchedFileSystem = class extends ObservableObj
|
|
|
10850
10821
|
const directory = this.fileSystemTree.getDirectory(uri);
|
|
10851
10822
|
if (directory !== void 0) {
|
|
10852
10823
|
this.loadedDirectoryUris.delete(directory.uri.toString());
|
|
10853
|
-
for (const descendant of directory.
|
|
10824
|
+
for (const descendant of directory.getFlatChildren()) {
|
|
10854
10825
|
if (descendant.kind === "directory" && this.loadedDirectoryUris.has(descendant.uri.toString())) {
|
|
10855
10826
|
this.loadedDirectoryUris.delete(descendant.uri.toString());
|
|
10856
10827
|
}
|
|
@@ -11134,19 +11105,19 @@ var TaskQueue = class extends ObservableObject3 {
|
|
|
11134
11105
|
disposeObservableObject3(this.tasks);
|
|
11135
11106
|
disposeObservableObject3(this);
|
|
11136
11107
|
}
|
|
11137
|
-
waitAllTasksProcessed(
|
|
11108
|
+
waitAllTasksProcessed(taskController) {
|
|
11138
11109
|
return __async(this, null, function* () {
|
|
11139
11110
|
yield Transaction2.outside(() => __async(this, null, function* () {
|
|
11140
11111
|
while (this.tasks.length > 0 || this.currentTask !== void 0) {
|
|
11141
11112
|
if (!(this.processTasksIndicator.isBusy || this.executeTaskIndicator.isBusy)) {
|
|
11142
|
-
yield
|
|
11113
|
+
yield yieldTask();
|
|
11143
11114
|
if (!(this.processTasksIndicator.isBusy || this.executeTaskIndicator.isBusy)) {
|
|
11144
11115
|
return;
|
|
11145
11116
|
}
|
|
11146
11117
|
}
|
|
11147
11118
|
yield this.processTasksIndicator.whenIdle();
|
|
11148
11119
|
yield this.executeTaskIndicator.whenIdle();
|
|
11149
|
-
|
|
11120
|
+
taskController?.throwIfCancellationRequested();
|
|
11150
11121
|
}
|
|
11151
11122
|
}));
|
|
11152
11123
|
});
|
|
@@ -11211,7 +11182,7 @@ var ManuallyUpdatedFileSystemTreeProvider = class extends ObservableObject4 {
|
|
|
11211
11182
|
this.workspaceFolderUris = workspaceFolderUris;
|
|
11212
11183
|
this.trackedSourceFiles = trackedSourceFiles;
|
|
11213
11184
|
}
|
|
11214
|
-
waitLoaded(
|
|
11185
|
+
waitLoaded(_taskController) {
|
|
11215
11186
|
return Promise.resolve();
|
|
11216
11187
|
}
|
|
11217
11188
|
dispose() {
|
|
@@ -11404,9 +11375,9 @@ var WorkspaceFiles = class extends ObservableObject5 {
|
|
|
11404
11375
|
}
|
|
11405
11376
|
this.trackedSourceFiles.close(uri);
|
|
11406
11377
|
}
|
|
11407
|
-
waitLoaded(
|
|
11378
|
+
waitLoaded(taskController) {
|
|
11408
11379
|
return __async(this, null, function* () {
|
|
11409
|
-
yield this.fileSystemTreeProvider.waitLoaded(
|
|
11380
|
+
yield this.fileSystemTreeProvider.waitLoaded(taskController);
|
|
11410
11381
|
});
|
|
11411
11382
|
}
|
|
11412
11383
|
dispose() {
|
|
@@ -11544,12 +11515,12 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11544
11515
|
notifyClosedTextDocument(uri) {
|
|
11545
11516
|
this.files.stopTrackingSourceFile(uri);
|
|
11546
11517
|
}
|
|
11547
|
-
waitLoadedAndGetWorkspaceElementInfo(uri,
|
|
11518
|
+
waitLoadedAndGetWorkspaceElementInfo(uri, taskController) {
|
|
11548
11519
|
return __async(this, null, function* () {
|
|
11549
|
-
yield this.files.waitLoaded(
|
|
11520
|
+
yield this.files.waitLoaded(taskController);
|
|
11550
11521
|
const controllerGroups = [
|
|
11551
|
-
this.compilationControllers_.filter((c) =>
|
|
11552
|
-
this.compilationControllers_.filter((c) => !
|
|
11522
|
+
this.compilationControllers_.filter((c) => c.hasAllConfigsProcessed()),
|
|
11523
|
+
this.compilationControllers_.filter((c) => !c.hasAllConfigsProcessed())
|
|
11553
11524
|
];
|
|
11554
11525
|
let result = yield findWorkspaceElement(this, true);
|
|
11555
11526
|
if (result === void 0) {
|
|
@@ -11560,7 +11531,7 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11560
11531
|
return __async(this, null, function* () {
|
|
11561
11532
|
for (const group of controllerGroups) {
|
|
11562
11533
|
for (const controller of group) {
|
|
11563
|
-
yield
|
|
11534
|
+
yield controller.waitFullyLoadedAndConfigsProcessed(taskController);
|
|
11564
11535
|
const state = yield controller.getStateOfCompilationContainingItemAtUri(uri);
|
|
11565
11536
|
if (state !== void 0) {
|
|
11566
11537
|
const sourceFile = state.analyzer.compilation.getSourceFileByUri(uri);
|
|
@@ -11586,14 +11557,14 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11586
11557
|
}
|
|
11587
11558
|
});
|
|
11588
11559
|
}
|
|
11589
|
-
getStandardPackageContents(
|
|
11560
|
+
getStandardPackageContents(taskController) {
|
|
11590
11561
|
return __async(this, null, function* () {
|
|
11591
11562
|
return this.standardPackageContents.getOrInsertWith(() => __async(this, null, function* () {
|
|
11592
11563
|
if (this.config.builtInStandardPackagesUri !== void 0) {
|
|
11593
|
-
yield this.files.waitLoaded(
|
|
11564
|
+
yield this.files.waitLoaded(taskController);
|
|
11594
11565
|
const directory = this.files.fileSystemTree.getDirectory(this.config.builtInStandardPackagesUri);
|
|
11595
11566
|
if (directory !== void 0 && Query.from(directory.getChildren()).count() > 0) {
|
|
11596
|
-
return yield createPackageContentsFromFSTree(directory, this.files.fileSystemTree);
|
|
11567
|
+
return yield createPackageContentsFromFSTree(directory, this.files.fileSystemTree, taskController);
|
|
11597
11568
|
}
|
|
11598
11569
|
}
|
|
11599
11570
|
return Promise.resolve(void 0);
|
|
@@ -11656,13 +11627,13 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11656
11627
|
});
|
|
11657
11628
|
}
|
|
11658
11629
|
updateIsDiagnosticsCollectionInBackgroundEnabled() {
|
|
11659
|
-
const shouldColletDiagnostics = this.isReadyToAcceptWorkspaceDiagnostics && this.compilationControllers_.every((c) =>
|
|
11630
|
+
const shouldColletDiagnostics = this.isReadyToAcceptWorkspaceDiagnostics && this.compilationControllers_.every((c) => c.hasAllConfigsProcessed());
|
|
11660
11631
|
this.compilationControllers_.forEach((c) => c.isDiagnosticsCollectionInBackgroundEnabled = shouldColletDiagnostics);
|
|
11661
11632
|
}
|
|
11662
11633
|
updateControllersWithOpenedFiles() {
|
|
11663
11634
|
return __async(this, null, function* () {
|
|
11664
|
-
const controllersWithProcessedConfigs = this.compilationControllers_.filter((c) =>
|
|
11665
|
-
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !
|
|
11635
|
+
const controllersWithProcessedConfigs = this.compilationControllers_.filter((c) => c.hasAllConfigsProcessed());
|
|
11636
|
+
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !c.hasAllConfigsProcessed());
|
|
11666
11637
|
this.controllersWithOpenedFiles.clear();
|
|
11667
11638
|
outer:
|
|
11668
11639
|
for (const trackedFile of this.files.trackedSourceFiles.items.values()) {
|
|
@@ -11709,7 +11680,7 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11709
11680
|
return new CompilationController(config);
|
|
11710
11681
|
}
|
|
11711
11682
|
getControllerToLoad() {
|
|
11712
|
-
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !
|
|
11683
|
+
const controllersWithUnprocessedConfigs = this.compilationControllers_.filter((c) => !c.hasAllConfigsProcessed());
|
|
11713
11684
|
if (controllersWithUnprocessedConfigs.length === 0) {
|
|
11714
11685
|
return void 0;
|
|
11715
11686
|
}
|
|
@@ -11725,28 +11696,6 @@ var _Workspace = class _Workspace extends ObservableObject6 {
|
|
|
11725
11696
|
}
|
|
11726
11697
|
return controller;
|
|
11727
11698
|
}
|
|
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
11699
|
};
|
|
11751
11700
|
__decorateClass([
|
|
11752
11701
|
observable6(false)
|
|
@@ -12116,16 +12065,13 @@ var EntityToSyntax = class {
|
|
|
12116
12065
|
const baseAspectTypes = entity.getBaseAspectTypes().declared;
|
|
12117
12066
|
if (baseObjectType !== void 0 || baseAspectTypes.length > 0) {
|
|
12118
12067
|
baseTypes = [];
|
|
12119
|
-
if (baseObjectType !== void 0) {
|
|
12068
|
+
if (baseObjectType !== void 0 && this.analyzer.getImplicitBaseTypeForStructuredType(entity)?.equals(baseObjectType) !== true) {
|
|
12120
12069
|
const baseObjectTypeSpecifier = this.convertType(baseObjectType);
|
|
12121
12070
|
if (baseObjectTypeSpecifier.kind === 10 /* NamedTypeSpecifier */) {
|
|
12122
12071
|
baseTypes.push(baseObjectTypeSpecifier);
|
|
12123
12072
|
}
|
|
12124
12073
|
}
|
|
12125
12074
|
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
12075
|
}
|
|
12130
12076
|
const members = this.convertTypeEntityMembers(entity.getMembers());
|
|
12131
12077
|
return SyntaxFactory.structuredTypeDeclarationBody(structuredTypeKindKeyword, baseTypes, members);
|
|
@@ -12302,11 +12248,13 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12302
12248
|
this.tsLibrariesProvider = tsLibrariesProvider;
|
|
12303
12249
|
this.standardPackageContentsProviders = standardPackageContentsProviders;
|
|
12304
12250
|
this.generatedPackageStates = new ObservableMap6();
|
|
12251
|
+
this.packagesToDeleteAfterFileIsClosed = new Array();
|
|
12252
|
+
this.nextId = 0;
|
|
12305
12253
|
}
|
|
12306
12254
|
get compilationControllers() {
|
|
12307
|
-
return Array.from(this.generatedPackageStates.values()).map((s) => s.compilationController);
|
|
12255
|
+
return Array.from(this.generatedPackageStates.values()).map((s) => s.compilationController).concat(this.packagesToDeleteAfterFileIsClosed.map((s) => s.compilationController));
|
|
12308
12256
|
}
|
|
12309
|
-
getDefinitionInGeneratedCode(analyzer, entity,
|
|
12257
|
+
getDefinitionInGeneratedCode(analyzer, entity, taskController) {
|
|
12310
12258
|
return __async(this, null, function* () {
|
|
12311
12259
|
if (!this.entityDefinitionRequiresSourceGeneration(entity)) {
|
|
12312
12260
|
return void 0;
|
|
@@ -12314,13 +12262,12 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12314
12262
|
const generatedPackageState = yield this.getOrGeneratePackageSource(
|
|
12315
12263
|
analyzer,
|
|
12316
12264
|
entity.getContainingPackage(),
|
|
12317
|
-
|
|
12265
|
+
taskController
|
|
12318
12266
|
);
|
|
12319
12267
|
if (generatedPackageState === void 0) {
|
|
12320
12268
|
return void 0;
|
|
12321
12269
|
}
|
|
12322
12270
|
const compilationController = generatedPackageState.compilationController;
|
|
12323
|
-
runAtomically2(() => compilationController.isConfigurationsProcessingEnabled = true);
|
|
12324
12271
|
yield compilationController.waitFullyLoaded();
|
|
12325
12272
|
const compilationState = compilationController.mainCompilationState;
|
|
12326
12273
|
if (compilationState?.analyzer.compilation.mainPackage === void 0) {
|
|
@@ -12364,30 +12311,50 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12364
12311
|
}
|
|
12365
12312
|
onOpenedSourceFilesChanged() {
|
|
12366
12313
|
this.trackedSourceFiles.items.entries();
|
|
12367
|
-
for (const
|
|
12314
|
+
for (const state of this.generatedPackageStates.values()) {
|
|
12368
12315
|
if (this.trackedSourceFiles.items.has(state.generatedFileUri.toString())) {
|
|
12369
12316
|
state.fileWasOpenedByClient = true;
|
|
12370
|
-
|
|
12371
|
-
clearTimeout(state.deleteAfterTimeoutId);
|
|
12372
|
-
state.deleteAfterTimeoutId = void 0;
|
|
12373
|
-
}
|
|
12317
|
+
state.cancelScheduledDispose();
|
|
12374
12318
|
} else if (state.fileWasOpenedByClient) {
|
|
12375
12319
|
state.fileWasOpenedByClient = false;
|
|
12376
|
-
|
|
12320
|
+
state.scheduleDisposeAfterTimeout(deleteGeneratedPackageTimeoutMs, (state2) => {
|
|
12321
|
+
if (this.generatedPackageStates.get(state2.key) === state2) {
|
|
12322
|
+
this.generatedPackageStates.delete(state2.key);
|
|
12323
|
+
}
|
|
12324
|
+
});
|
|
12377
12325
|
}
|
|
12378
12326
|
}
|
|
12327
|
+
this.packagesToDeleteAfterFileIsClosed = this.packagesToDeleteAfterFileIsClosed.filter((p) => {
|
|
12328
|
+
if (!this.trackedSourceFiles.items.has(p.generatedFileUri.toString())) {
|
|
12329
|
+
p.dispose();
|
|
12330
|
+
return false;
|
|
12331
|
+
} else {
|
|
12332
|
+
return true;
|
|
12333
|
+
}
|
|
12334
|
+
});
|
|
12379
12335
|
}
|
|
12380
|
-
getOrGeneratePackageSource(analyzer, packageEntity,
|
|
12336
|
+
getOrGeneratePackageSource(analyzer, packageEntity, taskController) {
|
|
12381
12337
|
return __async(this, null, function* () {
|
|
12382
12338
|
const packageLocale = packageEntity.getLocale();
|
|
12383
12339
|
const key = `${packageEntity.getName().toString()}-${localeToString(packageLocale)}`;
|
|
12384
12340
|
let result = this.generatedPackageStates.get(key);
|
|
12341
|
+
if (result !== void 0 && result.originalPackageEntity !== packageEntity) {
|
|
12342
|
+
if (result.fileWasOpenedByClient) {
|
|
12343
|
+
result.deleteAfterFileIsClosed = true;
|
|
12344
|
+
result.cancelScheduledDispose();
|
|
12345
|
+
this.packagesToDeleteAfterFileIsClosed.push(result);
|
|
12346
|
+
} else {
|
|
12347
|
+
result.dispose();
|
|
12348
|
+
}
|
|
12349
|
+
this.generatedPackageStates.delete(key);
|
|
12350
|
+
result = void 0;
|
|
12351
|
+
}
|
|
12385
12352
|
if (result === void 0) {
|
|
12386
12353
|
const node = new EntityToSyntax(analyzer, packageEntity).convert();
|
|
12387
12354
|
const code = new SyntaxToCode(node, { keywordsLocale: packageLocale }).convert();
|
|
12388
|
-
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, "", [key]);
|
|
12355
|
+
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, "", [`${key}-${this.nextId++}`]);
|
|
12389
12356
|
const generatedFileUri = generatedPackageUri.append(`${packageEntity.getName().toString()}.art`);
|
|
12390
|
-
const fileSystemTree =
|
|
12357
|
+
const fileSystemTree = new FileSystemTree();
|
|
12391
12358
|
const packageDirectory = fileSystemTree.addDirectory(generatedPackageUri);
|
|
12392
12359
|
fileSystemTree.addFile(generatedFileUri, code);
|
|
12393
12360
|
const packageConfiguration = this.createGeneratedPackageConfiguration(
|
|
@@ -12395,7 +12362,12 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12395
12362
|
packageLocale,
|
|
12396
12363
|
DefaultDialect
|
|
12397
12364
|
);
|
|
12398
|
-
const standardPackageContents = yield
|
|
12365
|
+
const standardPackageContents = yield Transaction4.outside(() => __async(this, null, function* () {
|
|
12366
|
+
return yield this.standardPackageContentsProviders(taskController);
|
|
12367
|
+
}));
|
|
12368
|
+
if (Transaction4.current.isCanceled) {
|
|
12369
|
+
return void 0;
|
|
12370
|
+
}
|
|
12399
12371
|
if (standardPackageContents === void 0) {
|
|
12400
12372
|
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
12373
|
return void 0;
|
|
@@ -12409,10 +12381,15 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12409
12381
|
getTreatRootAsPackageIfConfigIsMissing: () => true,
|
|
12410
12382
|
additionalPackageContents: standardPackageContents
|
|
12411
12383
|
};
|
|
12412
|
-
const controller =
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12384
|
+
const controller = new CompilationController(controllerConfig);
|
|
12385
|
+
controller.isConfigurationsProcessingEnabled = true;
|
|
12386
|
+
result = new GeneratedPackageState(key, controller, generatedFileUri, packageEntity);
|
|
12387
|
+
result.scheduleDisposeAfterTimeout(deleteGeneratedPackageTimeoutMs, (state) => {
|
|
12388
|
+
if (this.generatedPackageStates.get(state.key) === state) {
|
|
12389
|
+
this.generatedPackageStates.delete(state.key);
|
|
12390
|
+
}
|
|
12391
|
+
});
|
|
12392
|
+
this.generatedPackageStates.set(key, result);
|
|
12416
12393
|
}
|
|
12417
12394
|
return result;
|
|
12418
12395
|
});
|
|
@@ -12498,30 +12475,58 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12498
12475
|
Debug.never(entity);
|
|
12499
12476
|
}
|
|
12500
12477
|
}
|
|
12501
|
-
setDeleteGeneratedPackageTimeout(key, state, timeoutMs) {
|
|
12502
|
-
const timeoutId = setTimeout(() => {
|
|
12503
|
-
Transaction4.isolate(() => {
|
|
12504
|
-
const state2 = this.generatedPackageStates.get(key);
|
|
12505
|
-
if (state2 !== void 0) {
|
|
12506
|
-
this.generatedPackageStates.delete(key);
|
|
12507
|
-
state2.compilationController.dispose();
|
|
12508
|
-
}
|
|
12509
|
-
});
|
|
12510
|
-
}, timeoutMs);
|
|
12511
|
-
state.deleteAfterTimeoutId = timeoutId;
|
|
12512
|
-
}
|
|
12513
12478
|
};
|
|
12479
|
+
__decorateClass([
|
|
12480
|
+
observable7(false)
|
|
12481
|
+
], SourceGenerationService.prototype, "generatedPackageStates", 2);
|
|
12482
|
+
__decorateClass([
|
|
12483
|
+
observable7(false)
|
|
12484
|
+
], SourceGenerationService.prototype, "packagesToDeleteAfterFileIsClosed", 2);
|
|
12485
|
+
__decorateClass([
|
|
12486
|
+
observable7(false)
|
|
12487
|
+
], SourceGenerationService.prototype, "nextId", 2);
|
|
12514
12488
|
__decorateClass([
|
|
12515
12489
|
reactive6
|
|
12516
12490
|
], SourceGenerationService.prototype, "onOpenedSourceFilesChanged", 1);
|
|
12491
|
+
__decorateClass([
|
|
12492
|
+
atomic6,
|
|
12493
|
+
options6({ reentrance: Reentrance3.cancelAndWaitPrevious })
|
|
12494
|
+
], SourceGenerationService.prototype, "getOrGeneratePackageSource", 1);
|
|
12517
12495
|
var deleteGeneratedPackageTimeoutMs = 1e4;
|
|
12518
12496
|
var GeneratedPackageState = class {
|
|
12519
|
-
constructor(compilationController, generatedFileUri) {
|
|
12497
|
+
constructor(key, compilationController, generatedFileUri, originalPackageEntity) {
|
|
12498
|
+
this.key = key;
|
|
12520
12499
|
this.compilationController = compilationController;
|
|
12521
12500
|
this.generatedFileUri = generatedFileUri;
|
|
12501
|
+
this.originalPackageEntity = originalPackageEntity;
|
|
12522
12502
|
this.fileWasOpenedByClient = false;
|
|
12503
|
+
this.deleteAfterFileIsClosed = false;
|
|
12504
|
+
}
|
|
12505
|
+
scheduleDisposeAfterTimeout(timeoutMs, onDispose) {
|
|
12506
|
+
if (this.deleteAfterTimeoutId !== void 0) {
|
|
12507
|
+
clearTimeout(this.deleteAfterTimeoutId);
|
|
12508
|
+
}
|
|
12509
|
+
this.deleteAfterTimeoutId = setTimeout(() => {
|
|
12510
|
+
Transaction4.isolate(() => {
|
|
12511
|
+
onDispose(this);
|
|
12512
|
+
this.dispose();
|
|
12513
|
+
});
|
|
12514
|
+
}, timeoutMs);
|
|
12515
|
+
}
|
|
12516
|
+
cancelScheduledDispose() {
|
|
12517
|
+
if (this.deleteAfterTimeoutId !== void 0) {
|
|
12518
|
+
clearTimeout(this.deleteAfterTimeoutId);
|
|
12519
|
+
this.deleteAfterTimeoutId = void 0;
|
|
12520
|
+
}
|
|
12521
|
+
}
|
|
12522
|
+
dispose() {
|
|
12523
|
+
this.cancelScheduledDispose();
|
|
12524
|
+
this.compilationController.dispose();
|
|
12523
12525
|
}
|
|
12524
12526
|
};
|
|
12527
|
+
__decorateClass([
|
|
12528
|
+
atomic6
|
|
12529
|
+
], GeneratedPackageState.prototype, "dispose", 1);
|
|
12525
12530
|
var EntityFinder = class {
|
|
12526
12531
|
constructor(entity, packageEntity) {
|
|
12527
12532
|
this.entity = entity;
|
|
@@ -12634,6 +12639,7 @@ var EntityFinder = class {
|
|
|
12634
12639
|
}
|
|
12635
12640
|
}
|
|
12636
12641
|
case "nested":
|
|
12642
|
+
case "anonymous":
|
|
12637
12643
|
return void 0;
|
|
12638
12644
|
default:
|
|
12639
12645
|
Debug.never(entity);
|
|
@@ -12821,7 +12827,7 @@ var DataForFindingOverloadedMember = class {
|
|
|
12821
12827
|
};
|
|
12822
12828
|
|
|
12823
12829
|
// source/services/LanguageServer.ts
|
|
12824
|
-
var
|
|
12830
|
+
var _LanguageServer = class _LanguageServer {
|
|
12825
12831
|
constructor(config) {
|
|
12826
12832
|
this.disposables = new Array();
|
|
12827
12833
|
this.isInitialized = false;
|
|
@@ -12839,6 +12845,7 @@ var LanguageServer = class {
|
|
|
12839
12845
|
this.fileSystemTreeDisplayService = new FileSystemTreeDisplayService();
|
|
12840
12846
|
this.selectionRangeService = new SelectionRangeService();
|
|
12841
12847
|
this.assignFieldService = new AssignFieldService();
|
|
12848
|
+
this.deleteBlockFromScriptService = new DeleteBlockFromScriptService();
|
|
12842
12849
|
this.codeActionsService = new CodeActionsService();
|
|
12843
12850
|
this.connection = config.connection;
|
|
12844
12851
|
this.config = config;
|
|
@@ -12871,39 +12878,71 @@ var LanguageServer = class {
|
|
|
12871
12878
|
this.disposables.push(disposable);
|
|
12872
12879
|
disposable = this.connection.onDidCloseTextDocument((params) => this.onDidCloseTextDocument(params));
|
|
12873
12880
|
this.disposables.push(disposable);
|
|
12874
|
-
disposable = this.connection.onDefinition((params, token) => this.
|
|
12875
|
-
this.disposables.push(disposable);
|
|
12876
|
-
disposable = this.connection.onReferences((params, token) => this.withCancellation(token, (token2) => this.onReferences(params, token2)));
|
|
12881
|
+
disposable = this.connection.onDefinition((params, token) => this.withTaskController(token, (taskController) => this.onDefinition(params, taskController)));
|
|
12877
12882
|
this.disposables.push(disposable);
|
|
12878
|
-
disposable = this.connection.
|
|
12883
|
+
disposable = this.connection.onReferences((params, token) => this.withTaskController(token, (taskController) => this.onReferences(params, taskController)));
|
|
12879
12884
|
this.disposables.push(disposable);
|
|
12880
|
-
disposable = this.connection.
|
|
12885
|
+
disposable = this.connection.onDocumentHighlight((params, token) => this.withTaskController(token, (taskController) => this.onDocumentHighlight(params, taskController)));
|
|
12881
12886
|
this.disposables.push(disposable);
|
|
12882
|
-
disposable = this.connection.
|
|
12887
|
+
disposable = this.connection.onPrepareRename((params, token) => this.withTaskController(token, (taskController) => this.onPrepareRename(params, taskController)));
|
|
12883
12888
|
this.disposables.push(disposable);
|
|
12884
|
-
disposable = this.connection.
|
|
12889
|
+
disposable = this.connection.onRenameRequest((params, token) => this.withTaskController(token, (taskController) => this.onRename(params, taskController)));
|
|
12885
12890
|
this.disposables.push(disposable);
|
|
12886
|
-
disposable = this.connection.
|
|
12891
|
+
disposable = this.connection.onWorkspaceSymbol((params, token) => this.withTaskController(token, (taskController) => this.onWorkspaceSymbol(params, taskController)));
|
|
12887
12892
|
this.disposables.push(disposable);
|
|
12888
|
-
disposable = this.connection.
|
|
12893
|
+
disposable = this.connection.onDocumentSymbol((params, token) => this.withTaskController(token, (taskController) => this.onDocumentSymbol(params, taskController)));
|
|
12889
12894
|
this.disposables.push(disposable);
|
|
12890
|
-
disposable = this.connection.
|
|
12895
|
+
disposable = this.connection.onHover((params, token) => this.withTaskController(token, (taskController) => this.onHover(params, taskController)));
|
|
12891
12896
|
this.disposables.push(disposable);
|
|
12892
|
-
disposable = this.connection.onCompletion((params, token) => this.
|
|
12897
|
+
disposable = this.connection.onCompletion((params, token) => this.withTaskController(token, (taskController) => this.onCompletion(params, taskController)));
|
|
12893
12898
|
this.disposables.push(disposable);
|
|
12894
12899
|
disposable = this.connection.onCompletionResolve((params) => this.onCompletionResolve(params));
|
|
12895
12900
|
this.disposables.push(disposable);
|
|
12896
|
-
disposable = this.connection.languages.semanticTokens.on((params, token) => this.
|
|
12901
|
+
disposable = this.connection.languages.semanticTokens.on((params, token) => this.withTaskController(token, (taskController) => this.onSemanticTokens(params, taskController)));
|
|
12902
|
+
this.disposables.push(disposable);
|
|
12903
|
+
disposable = this.connection.languages.semanticTokens.onRange((params, token) => this.withTaskController(token, (taskController) => this.onSemanticTokensRange(params, taskController)));
|
|
12904
|
+
this.disposables.push(disposable);
|
|
12905
|
+
disposable = this.connection.onSignatureHelp((params, token) => this.withTaskController(token, (taskController) => this.onSignatureHelp(params, taskController)));
|
|
12897
12906
|
this.disposables.push(disposable);
|
|
12898
|
-
disposable = this.connection.
|
|
12907
|
+
disposable = this.connection.onSelectionRanges((params, token) => this.withTaskController(token, (taskController) => this.onSelectionRanges(params, taskController)));
|
|
12899
12908
|
this.disposables.push(disposable);
|
|
12900
|
-
disposable = this.connection.
|
|
12909
|
+
disposable = this.connection.onCodeAction((params, token) => this.withTaskController(token, (taskController) => this.onCodeAction(params, taskController)));
|
|
12901
12910
|
this.disposables.push(disposable);
|
|
12902
|
-
disposable = this.connection.
|
|
12911
|
+
disposable = this.connection.onCodeActionResolve((params, token) => this.withTaskController(token, (taskController) => this.onCodeActionResolve(params, taskController)));
|
|
12903
12912
|
this.disposables.push(disposable);
|
|
12904
|
-
disposable = this.connection.
|
|
12913
|
+
disposable = this.connection.onRequest(customRequests.getLocalesAvailableForTranslation, (params, token) => this.withTaskController(token, (_taskController) => __async(this, null, function* () {
|
|
12914
|
+
return void 0;
|
|
12915
|
+
})));
|
|
12916
|
+
this.disposables.push(disposable);
|
|
12917
|
+
disposable = this.connection.onRequest(customRequests.provideEvaluatableExpression, (params, token) => this.withTaskController(token, (taskController) => this.onProvideEvaluatableExpression(params, taskController)));
|
|
12918
|
+
this.disposables.push(disposable);
|
|
12919
|
+
disposable = this.connection.onRequest(customRequests.provideServerOwnedDocumentContent, (params, token) => this.withTaskController(
|
|
12920
|
+
token,
|
|
12921
|
+
(taskController) => this.onProvideServerOwnedDocumentContent(params, taskController)
|
|
12922
|
+
));
|
|
12923
|
+
this.disposables.push(disposable);
|
|
12924
|
+
disposable = this.connection.onRequest(customRequests.emitCodeToString, (params, token) => this.withTaskController(token, (taskController) => this.onEmitCodeToString(params, taskController)));
|
|
12925
|
+
this.disposables.push(disposable);
|
|
12926
|
+
disposable = this.connection.onRequest(
|
|
12927
|
+
customRequests.displayFileSystemTree,
|
|
12928
|
+
(params) => this.onDisplayFileSystemTree(params)
|
|
12929
|
+
);
|
|
12930
|
+
this.disposables.push(disposable);
|
|
12931
|
+
disposable = this.connection.onRequest(
|
|
12932
|
+
customRequests.createOrUpdateSourceFile,
|
|
12933
|
+
(params) => this.onCreateOrUpdateSourceFile(params)
|
|
12934
|
+
);
|
|
12935
|
+
this.disposables.push(disposable);
|
|
12936
|
+
disposable = this.connection.onRequest(
|
|
12937
|
+
customRequests.deleteSourceFile,
|
|
12938
|
+
(params) => this.onDeleteSourceFile(params)
|
|
12939
|
+
);
|
|
12905
12940
|
this.disposables.push(disposable);
|
|
12906
|
-
disposable = this.connection.
|
|
12941
|
+
disposable = this.connection.onRequest(customRequests.getNodeRange, (params, token) => this.withTaskController(token, (taskController) => this.onGetNodeRange(params, taskController)));
|
|
12942
|
+
this.disposables.push(disposable);
|
|
12943
|
+
disposable = this.connection.onRequest(customRequests.assignField, (params, token) => this.withTaskController(token, (taskController) => this.onAssignField(params, taskController)));
|
|
12944
|
+
this.disposables.push(disposable);
|
|
12945
|
+
disposable = this.connection.onRequest(customRequests.deleteBlockFromScript, (params, token) => this.withTaskController(token, (taskController) => this.onDeleteBlockFromScript(params, taskController)));
|
|
12907
12946
|
this.disposables.push(disposable);
|
|
12908
12947
|
this.connection.listen();
|
|
12909
12948
|
}
|
|
@@ -12920,13 +12959,13 @@ var LanguageServer = class {
|
|
|
12920
12959
|
setUserLocale(params.initializationOptions?.localeOverride ?? params.locale ?? "en");
|
|
12921
12960
|
let workspaceFolderUris;
|
|
12922
12961
|
if (params.initializationOptions?.workspaceFoldersOverride !== void 0) {
|
|
12923
|
-
workspaceFolderUris = params.initializationOptions.workspaceFoldersOverride.map((f) => this.convertVscodeUriToUri(
|
|
12962
|
+
workspaceFolderUris = params.initializationOptions.workspaceFoldersOverride.map((f) => this.convertVscodeUriToUri(URI.parse(f.uri)));
|
|
12924
12963
|
} else if (params.workspaceFolders) {
|
|
12925
|
-
workspaceFolderUris = params.workspaceFolders.map((f) => this.convertVscodeUriToUri(
|
|
12964
|
+
workspaceFolderUris = params.workspaceFolders.map((f) => this.convertVscodeUriToUri(URI.parse(f.uri)));
|
|
12926
12965
|
} else if (params.rootUri) {
|
|
12927
|
-
workspaceFolderUris = [this.convertVscodeUriToUri(
|
|
12966
|
+
workspaceFolderUris = [this.convertVscodeUriToUri(URI.parse(params.rootUri))];
|
|
12928
12967
|
} else if (params.rootPath) {
|
|
12929
|
-
workspaceFolderUris = [this.convertVscodeUriToUri(
|
|
12968
|
+
workspaceFolderUris = [this.convertVscodeUriToUri(URI.parse(params.rootPath))];
|
|
12930
12969
|
} else {
|
|
12931
12970
|
workspaceFolderUris = [];
|
|
12932
12971
|
}
|
|
@@ -12942,7 +12981,7 @@ var LanguageServer = class {
|
|
|
12942
12981
|
if (builtInStandardPackagesUri !== void 0) {
|
|
12943
12982
|
additionalUrisOfDirectoriesToLoad.push(builtInStandardPackagesUri);
|
|
12944
12983
|
}
|
|
12945
|
-
fileSystemTreeProvider =
|
|
12984
|
+
fileSystemTreeProvider = runAtomically2(() => new FileSystemTreeProviderBasedOnWatchedFileSystem(
|
|
12946
12985
|
fileSystem,
|
|
12947
12986
|
publisher,
|
|
12948
12987
|
void 0,
|
|
@@ -12951,7 +12990,7 @@ var LanguageServer = class {
|
|
|
12951
12990
|
break;
|
|
12952
12991
|
}
|
|
12953
12992
|
case "client-to-server-requests": {
|
|
12954
|
-
this.manuallyUpdatedFileSystemTreeProvider =
|
|
12993
|
+
this.manuallyUpdatedFileSystemTreeProvider = runAtomically2(() => new ManuallyUpdatedFileSystemTreeProvider());
|
|
12955
12994
|
fileSystemTreeProvider = this.manuallyUpdatedFileSystemTreeProvider;
|
|
12956
12995
|
break;
|
|
12957
12996
|
}
|
|
@@ -12963,21 +13002,21 @@ var LanguageServer = class {
|
|
|
12963
13002
|
tsLibrariesProvider: this.config.tsLibrariesProvider,
|
|
12964
13003
|
diagnosticsCollectedInBackgroundHandler: this.reportDiagnostics.bind(this),
|
|
12965
13004
|
rawPackageConfigurationsChangedHandler: this.onRawPackageConfigurationsChanged.bind(this),
|
|
12966
|
-
initiallyOpenedFileUris: params.initializationOptions?.initiallyOpenedFileUris?.map((u) => this.convertVscodeUriToUri(
|
|
12967
|
-
standardPackagesUri: params.initializationOptions?.standardPackagesUri !== void 0 ? this.convertVscodeUriToUri(
|
|
13005
|
+
initiallyOpenedFileUris: params.initializationOptions?.initiallyOpenedFileUris?.map((u) => this.convertVscodeUriToUri(URI.parse(u))),
|
|
13006
|
+
standardPackagesUri: params.initializationOptions?.standardPackagesUri !== void 0 ? this.convertVscodeUriToUri(URI.parse(params.initializationOptions.standardPackagesUri)) : void 0,
|
|
12968
13007
|
showErrorMessage: (message) => __async(this, null, function* () {
|
|
12969
13008
|
this.connection.window.showErrorMessage(message);
|
|
12970
13009
|
}),
|
|
12971
13010
|
builtInStandardPackagesUri,
|
|
12972
13011
|
additionalPackageContents: this.config.additionalPackageContents
|
|
12973
13012
|
};
|
|
12974
|
-
this.workspace = yield
|
|
13013
|
+
this.workspace = yield runAtomically2(() => Workspace.create(config));
|
|
12975
13014
|
this.workspace.addWorkspaceFolders(workspaceFolderUris);
|
|
12976
|
-
this.sourceGenerationService =
|
|
13015
|
+
this.sourceGenerationService = runAtomically2(() => new SourceGenerationService(
|
|
12977
13016
|
this.workspace.trackedSourceFiles,
|
|
12978
13017
|
this.config.tsLibrariesProvider,
|
|
12979
|
-
(
|
|
12980
|
-
return yield this.workspace.getStandardPackageContents(
|
|
13018
|
+
(taskController) => __async(this, null, function* () {
|
|
13019
|
+
return yield this.workspace.getStandardPackageContents(taskController);
|
|
12981
13020
|
})
|
|
12982
13021
|
));
|
|
12983
13022
|
this.definitionService = new DefinitionService(this.sourceGenerationService);
|
|
@@ -13045,12 +13084,18 @@ var LanguageServer = class {
|
|
|
13045
13084
|
if (this.clientCapabilities.textDocument?.diagnostic?.dynamicRegistration === true) {
|
|
13046
13085
|
disposable = this.connection.onRequest(
|
|
13047
13086
|
ls3.DocumentDiagnosticRequest.type,
|
|
13048
|
-
(params, token) => this.
|
|
13087
|
+
(params, token) => this.withTaskController(
|
|
13088
|
+
token,
|
|
13089
|
+
(taskController) => this.onDocumentDiagnostic(params, taskController)
|
|
13090
|
+
)
|
|
13049
13091
|
);
|
|
13050
13092
|
this.disposables.push(disposable);
|
|
13051
13093
|
disposable = this.connection.onRequest(
|
|
13052
13094
|
ls3.WorkspaceDiagnosticRequest.type,
|
|
13053
|
-
(params, token) => this.
|
|
13095
|
+
(params, token) => this.withTaskController(
|
|
13096
|
+
token,
|
|
13097
|
+
(taskController) => this.onWorkspaceDiagnostic(params, taskController)
|
|
13098
|
+
)
|
|
13054
13099
|
);
|
|
13055
13100
|
this.disposables.push(disposable);
|
|
13056
13101
|
disposable = yield this.connection.client.register(ls3.DocumentDiagnosticRequest.type, {
|
|
@@ -13078,11 +13123,11 @@ var LanguageServer = class {
|
|
|
13078
13123
|
});
|
|
13079
13124
|
}
|
|
13080
13125
|
onDidOpenTextDocument(params) {
|
|
13081
|
-
const uri = this.convertVscodeUriToUri(
|
|
13126
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13082
13127
|
this.workspace.notifyOpenedTextDocument(uri, params.textDocument.text, params.textDocument.version);
|
|
13083
13128
|
}
|
|
13084
13129
|
onDidChangeTextDocument(params) {
|
|
13085
|
-
const uri = this.convertVscodeUriToUri(
|
|
13130
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13086
13131
|
const applyEdits = (text) => {
|
|
13087
13132
|
const textDocument = TextDocument.create(params.textDocument.uri, "artel", 0, text);
|
|
13088
13133
|
TextDocument.update(textDocument, params.contentChanges, 1);
|
|
@@ -13091,21 +13136,21 @@ var LanguageServer = class {
|
|
|
13091
13136
|
this.workspace.notifyUpdatedTextDocument(uri, applyEdits, params.textDocument.version);
|
|
13092
13137
|
}
|
|
13093
13138
|
onDidSaveTextDocument(params) {
|
|
13094
|
-
const uri = this.convertVscodeUriToUri(
|
|
13139
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13095
13140
|
this.workspace.notifySavedTextDocument(uri);
|
|
13096
13141
|
}
|
|
13097
13142
|
onDidCloseTextDocument(params) {
|
|
13098
|
-
const uri = this.convertVscodeUriToUri(
|
|
13143
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13099
13144
|
this.workspace.notifyClosedTextDocument(uri);
|
|
13100
13145
|
}
|
|
13101
13146
|
onDidChangeWorkspaceFolders(event) {
|
|
13102
|
-
this.workspace.addWorkspaceFolders(event.added.map((f) => this.convertVscodeUriToUri(
|
|
13103
|
-
this.workspace.removeWorkspaceFolders(event.removed.map((f) => this.convertVscodeUriToUri(
|
|
13147
|
+
this.workspace.addWorkspaceFolders(event.added.map((f) => this.convertVscodeUriToUri(URI.parse(f.uri))));
|
|
13148
|
+
this.workspace.removeWorkspaceFolders(event.removed.map((f) => this.convertVscodeUriToUri(URI.parse(f.uri))));
|
|
13104
13149
|
}
|
|
13105
13150
|
onDidChangeWatchedFiles(event) {
|
|
13106
13151
|
if (this.fileSystemUpdateNotificationsPublisher !== void 0) {
|
|
13107
13152
|
const notifications = event.changes.map((c) => {
|
|
13108
|
-
const uri = this.convertVscodeUriToUri(
|
|
13153
|
+
const uri = this.convertVscodeUriToUri(URI.parse(c.uri));
|
|
13109
13154
|
switch (c.type) {
|
|
13110
13155
|
case ls3.FileChangeType.Created:
|
|
13111
13156
|
return new FileSystemUpdateNotification(uri, "created");
|
|
@@ -13120,13 +13165,13 @@ var LanguageServer = class {
|
|
|
13120
13165
|
this.fileSystemUpdateNotificationsPublisher.publish(notifications);
|
|
13121
13166
|
}
|
|
13122
13167
|
}
|
|
13123
|
-
onDocumentDiagnostic(params,
|
|
13168
|
+
onDocumentDiagnostic(params, taskController) {
|
|
13124
13169
|
return __async(this, null, function* () {
|
|
13125
|
-
const vscodeUri =
|
|
13170
|
+
const vscodeUri = URI.parse(params.textDocument.uri);
|
|
13126
13171
|
if (vscodeUri.scheme === GeneratedSourceFileScheme) {
|
|
13127
13172
|
return void 0;
|
|
13128
13173
|
}
|
|
13129
|
-
const sourceFileContext = yield this.getSourceFileContext(vscodeUri,
|
|
13174
|
+
const sourceFileContext = yield this.getSourceFileContext(vscodeUri, taskController);
|
|
13130
13175
|
let result = { kind: "full", items: [] };
|
|
13131
13176
|
if (sourceFileContext !== void 0) {
|
|
13132
13177
|
const uri = this.convertVscodeUriToUri(vscodeUri);
|
|
@@ -13137,7 +13182,7 @@ var LanguageServer = class {
|
|
|
13137
13182
|
} else {
|
|
13138
13183
|
const sourceFile = state.analyzer.compilation.getSourceFileByUri(uri);
|
|
13139
13184
|
if (sourceFile !== void 0) {
|
|
13140
|
-
const diagnostics = yield state.collectSourceFileDiagnosticsWithHighPriority(sourceFile,
|
|
13185
|
+
const diagnostics = yield state.collectSourceFileDiagnosticsWithHighPriority(sourceFile, taskController);
|
|
13141
13186
|
if (diagnostics !== void 0) {
|
|
13142
13187
|
const protocolDiagnostics = diagnostics.map((d) => this.convertDiagnostic(d, sourceFile));
|
|
13143
13188
|
result = { kind: "full", items: protocolDiagnostics, resultId: state.version.toString() };
|
|
@@ -13150,16 +13195,16 @@ var LanguageServer = class {
|
|
|
13150
13195
|
return result;
|
|
13151
13196
|
});
|
|
13152
13197
|
}
|
|
13153
|
-
onWorkspaceDiagnostic(params,
|
|
13198
|
+
onWorkspaceDiagnostic(params, taskController) {
|
|
13154
13199
|
return __async(this, null, function* () {
|
|
13155
13200
|
this.workspaceDiagnosticsPartialResultToken = params.partialResultToken;
|
|
13156
|
-
|
|
13157
|
-
while (!
|
|
13158
|
-
yield
|
|
13201
|
+
runAtomically2(() => this.workspace.isReadyToAcceptWorkspaceDiagnostics = true);
|
|
13202
|
+
while (!taskController.isCancellationRequested()) {
|
|
13203
|
+
yield taskController.yieldTask(1e3);
|
|
13159
13204
|
}
|
|
13160
13205
|
if (this.workspaceDiagnosticsPartialResultToken === params.partialResultToken) {
|
|
13161
13206
|
this.workspaceDiagnosticsPartialResultToken = void 0;
|
|
13162
|
-
|
|
13207
|
+
runAtomically2(() => this.workspace.isReadyToAcceptWorkspaceDiagnostics = false);
|
|
13163
13208
|
}
|
|
13164
13209
|
throw new CancelledError();
|
|
13165
13210
|
});
|
|
@@ -13185,7 +13230,7 @@ var LanguageServer = class {
|
|
|
13185
13230
|
}
|
|
13186
13231
|
});
|
|
13187
13232
|
}
|
|
13188
|
-
onDocumentSymbol(params,
|
|
13233
|
+
onDocumentSymbol(params, taskController) {
|
|
13189
13234
|
return __async(this, null, function* () {
|
|
13190
13235
|
const convertSourceFileItem = (item) => {
|
|
13191
13236
|
const kind = this.convertSourceFileItemKind(item.kind);
|
|
@@ -13194,7 +13239,7 @@ var LanguageServer = class {
|
|
|
13194
13239
|
const children = Query.from(item.items).map((item2) => convertSourceFileItem(item2)).toArray();
|
|
13195
13240
|
return ls3.DocumentSymbol.create(item.name, void 0, kind, range, selectionRange, children);
|
|
13196
13241
|
};
|
|
13197
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13242
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13198
13243
|
let result = new Array();
|
|
13199
13244
|
if (sourceFileContext !== void 0) {
|
|
13200
13245
|
const { sourceFile } = sourceFileContext;
|
|
@@ -13203,7 +13248,7 @@ var LanguageServer = class {
|
|
|
13203
13248
|
return result;
|
|
13204
13249
|
});
|
|
13205
13250
|
}
|
|
13206
|
-
onWorkspaceSymbol(_params,
|
|
13251
|
+
onWorkspaceSymbol(_params, _taskController) {
|
|
13207
13252
|
return __async(this, null, function* () {
|
|
13208
13253
|
const convertSourceFileItem = (item) => {
|
|
13209
13254
|
const result = new Array();
|
|
@@ -13221,16 +13266,21 @@ var LanguageServer = class {
|
|
|
13221
13266
|
return items.flatMap((i) => convertSourceFileItem(i));
|
|
13222
13267
|
});
|
|
13223
13268
|
}
|
|
13224
|
-
onDefinition(params,
|
|
13269
|
+
onDefinition(params, taskController) {
|
|
13225
13270
|
return __async(this, null, function* () {
|
|
13226
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13271
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13227
13272
|
if (sourceFileContext === void 0) {
|
|
13228
13273
|
return;
|
|
13229
13274
|
}
|
|
13230
13275
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13231
13276
|
const position = new Position(params.position.line, params.position.character);
|
|
13232
13277
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13233
|
-
const definitionAndReferenceInfo = yield this.definitionService.getDefinition(
|
|
13278
|
+
const definitionAndReferenceInfo = yield this.definitionService.getDefinition(
|
|
13279
|
+
analyzer,
|
|
13280
|
+
sourceFile,
|
|
13281
|
+
offset,
|
|
13282
|
+
taskController
|
|
13283
|
+
);
|
|
13234
13284
|
if (definitionAndReferenceInfo === void 0) {
|
|
13235
13285
|
return;
|
|
13236
13286
|
}
|
|
@@ -13248,15 +13298,15 @@ var LanguageServer = class {
|
|
|
13248
13298
|
return result;
|
|
13249
13299
|
});
|
|
13250
13300
|
}
|
|
13251
|
-
onReferences(params,
|
|
13301
|
+
onReferences(params, taskController) {
|
|
13252
13302
|
return __async(this, null, function* () {
|
|
13253
13303
|
let result = new Array();
|
|
13254
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13304
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13255
13305
|
if (sourceFileContext !== void 0) {
|
|
13256
13306
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13257
13307
|
const position = new Position(params.position.line, params.position.character);
|
|
13258
13308
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13259
|
-
const
|
|
13309
|
+
const options7 = {
|
|
13260
13310
|
onlyNamed: false,
|
|
13261
13311
|
onlyWithSameAlias: false,
|
|
13262
13312
|
allowAmbiguous: true
|
|
@@ -13265,8 +13315,8 @@ var LanguageServer = class {
|
|
|
13265
13315
|
analyzer,
|
|
13266
13316
|
sourceFile,
|
|
13267
13317
|
offset,
|
|
13268
|
-
|
|
13269
|
-
|
|
13318
|
+
options7,
|
|
13319
|
+
taskController
|
|
13270
13320
|
);
|
|
13271
13321
|
result = Query.from(references).map((reference) => ({
|
|
13272
13322
|
uri: this.convertUriToVscodeUri(reference.sourceFile.uri).toString(),
|
|
@@ -13276,15 +13326,20 @@ var LanguageServer = class {
|
|
|
13276
13326
|
return result;
|
|
13277
13327
|
});
|
|
13278
13328
|
}
|
|
13279
|
-
onDocumentHighlight(params,
|
|
13329
|
+
onDocumentHighlight(params, taskController) {
|
|
13280
13330
|
return __async(this, null, function* () {
|
|
13281
13331
|
let result = new Array();
|
|
13282
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13332
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13283
13333
|
if (sourceFileContext !== void 0) {
|
|
13284
13334
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13285
13335
|
const position = new Position(params.position.line, params.position.character);
|
|
13286
13336
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13287
|
-
const highlights = yield this.documentHighlightService.getDocumentHighlights(
|
|
13337
|
+
const highlights = yield this.documentHighlightService.getDocumentHighlights(
|
|
13338
|
+
analyzer,
|
|
13339
|
+
sourceFile,
|
|
13340
|
+
offset,
|
|
13341
|
+
taskController
|
|
13342
|
+
);
|
|
13288
13343
|
result = Query.from(highlights).map((highlight) => {
|
|
13289
13344
|
let kind;
|
|
13290
13345
|
switch (highlight.kind) {
|
|
@@ -13304,10 +13359,10 @@ var LanguageServer = class {
|
|
|
13304
13359
|
return result;
|
|
13305
13360
|
});
|
|
13306
13361
|
}
|
|
13307
|
-
onPrepareRename(params,
|
|
13362
|
+
onPrepareRename(params, taskController) {
|
|
13308
13363
|
return __async(this, null, function* () {
|
|
13309
13364
|
let result;
|
|
13310
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13365
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13311
13366
|
if (sourceFileContext !== void 0) {
|
|
13312
13367
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13313
13368
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13320,15 +13375,15 @@ var LanguageServer = class {
|
|
|
13320
13375
|
return result;
|
|
13321
13376
|
});
|
|
13322
13377
|
}
|
|
13323
|
-
onRename(params,
|
|
13378
|
+
onRename(params, taskController) {
|
|
13324
13379
|
return __async(this, null, function* () {
|
|
13325
13380
|
let result;
|
|
13326
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13381
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13327
13382
|
if (sourceFileContext !== void 0) {
|
|
13328
13383
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13329
13384
|
const position = new Position(params.position.line, params.position.character);
|
|
13330
13385
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13331
|
-
const renames = yield this.renameService.rename(analyzer, sourceFile, offset, params.newName,
|
|
13386
|
+
const renames = yield this.renameService.rename(analyzer, sourceFile, offset, params.newName, taskController);
|
|
13332
13387
|
const changes = Query.from(renames).groupBy((rename) => rename.sourceFile.uri.toString()).reduce({}, (changes2, group) => {
|
|
13333
13388
|
const uri = this.convertUriToVscodeUri(group[1][0].sourceFile.uri).toString();
|
|
13334
13389
|
const edits = group[1].map((rename) => ({
|
|
@@ -13343,10 +13398,10 @@ var LanguageServer = class {
|
|
|
13343
13398
|
return result ?? {};
|
|
13344
13399
|
});
|
|
13345
13400
|
}
|
|
13346
|
-
onHover(params,
|
|
13401
|
+
onHover(params, taskController) {
|
|
13347
13402
|
return __async(this, null, function* () {
|
|
13348
13403
|
let result = void 0;
|
|
13349
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13404
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13350
13405
|
if (sourceFileContext !== void 0) {
|
|
13351
13406
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13352
13407
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13436,40 +13491,10 @@ var LanguageServer = class {
|
|
|
13436
13491
|
const code = diagnostic.data.code;
|
|
13437
13492
|
return { message, range, severity, tags, code };
|
|
13438
13493
|
}
|
|
13439
|
-
|
|
13440
|
-
switch (params.command) {
|
|
13441
|
-
case customCommandName.provideEvaluatableExpression:
|
|
13442
|
-
Debug.assert(params.arguments?.length === 1 && isProvideEvaluatableExpressionParams(params.arguments[0]));
|
|
13443
|
-
return this.onProvideEvaluatableExpression(params.arguments[0], token);
|
|
13444
|
-
case customCommandName.provideServerOwnedDocumentContent:
|
|
13445
|
-
Debug.assert(params.arguments?.length === 1 && isProvideServerOwnedDocumentContentParams(params.arguments[0]));
|
|
13446
|
-
return this.onProvideInMemoryDocumentContent(params.arguments[0], token);
|
|
13447
|
-
case customCommandName.emitCodeToString:
|
|
13448
|
-
Debug.assert(params.arguments?.length === 1 && isEmitCodeToStringParams(params.arguments[0]));
|
|
13449
|
-
return this.onEmitCodeToString(params.arguments[0], token);
|
|
13450
|
-
case customCommandName.displayFileSystemTree:
|
|
13451
|
-
Debug.assert(params.arguments?.length === 1 && isDisplayFileSystemTreeParams(params.arguments[0]));
|
|
13452
|
-
return this.onDisplayFileSystemTree(params.arguments[0]);
|
|
13453
|
-
case customCommandName.createOrUpdateSourceFile:
|
|
13454
|
-
Debug.assert(params.arguments?.length === 1 && isCreateOrUpdateSourceFileParams(params.arguments[0]));
|
|
13455
|
-
return this.onCreateOrUpdateSourceFile(params.arguments[0]);
|
|
13456
|
-
case customCommandName.deleteSourceFile:
|
|
13457
|
-
Debug.assert(params.arguments?.length === 1 && isDeleteSourceFileParams(params.arguments[0]));
|
|
13458
|
-
return this.onDeleteSourceFile(params.arguments[0]);
|
|
13459
|
-
case customCommandName.getNodeRange:
|
|
13460
|
-
Debug.assert(params.arguments?.length === 1 && isGetNodeRangeParams(params.arguments[0]));
|
|
13461
|
-
return this.onGetNodeRange(params.arguments[0], token);
|
|
13462
|
-
case customCommandName.assignField:
|
|
13463
|
-
Debug.assert(params.arguments?.length === 1 && isAssignFieldParams(params.arguments[0]));
|
|
13464
|
-
return this.onAssignField(params.arguments[0], token);
|
|
13465
|
-
default:
|
|
13466
|
-
return void 0;
|
|
13467
|
-
}
|
|
13468
|
-
}
|
|
13469
|
-
onAssignField(params, token) {
|
|
13494
|
+
onAssignField(params, taskController) {
|
|
13470
13495
|
return __async(this, null, function* () {
|
|
13471
|
-
const functionNodeUri =
|
|
13472
|
-
const sourceFileContext = yield this.getSourceFileContext(functionNodeUri,
|
|
13496
|
+
const functionNodeUri = URI.parse(params.functionNodeUri);
|
|
13497
|
+
const sourceFileContext = yield this.getSourceFileContext(functionNodeUri, taskController);
|
|
13473
13498
|
if (sourceFileContext !== void 0) {
|
|
13474
13499
|
const functionDeclaration = NodePath.parse(functionNodeUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
13475
13500
|
if (functionDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(functionDeclaration)) {
|
|
@@ -13489,6 +13514,26 @@ var LanguageServer = class {
|
|
|
13489
13514
|
}
|
|
13490
13515
|
});
|
|
13491
13516
|
}
|
|
13517
|
+
onDeleteBlockFromScript(params, taskController) {
|
|
13518
|
+
return __async(this, null, function* () {
|
|
13519
|
+
const functionNodeUri = URI.parse(params.functionNodeUri);
|
|
13520
|
+
const sourceFileContext = yield this.getSourceFileContext(functionNodeUri, taskController);
|
|
13521
|
+
if (sourceFileContext !== void 0) {
|
|
13522
|
+
const functionDeclaration = NodePath.parse(functionNodeUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
13523
|
+
if (functionDeclaration !== void 0 && NodeTypeUtils.isSubprogramDeclarationOrLiteral(functionDeclaration)) {
|
|
13524
|
+
const sourceFileEdit = this.deleteBlockFromScriptService.createEditDeletingBlock(
|
|
13525
|
+
sourceFileContext.sourceFile,
|
|
13526
|
+
functionDeclaration
|
|
13527
|
+
);
|
|
13528
|
+
if (sourceFileEdit !== void 0) {
|
|
13529
|
+
const textDocumentEdit = this.convertSourceFileEdit(sourceFileEdit);
|
|
13530
|
+
const workspaceEdit = { documentChanges: [textDocumentEdit] };
|
|
13531
|
+
yield this.connection.workspace.applyEdit(workspaceEdit);
|
|
13532
|
+
}
|
|
13533
|
+
}
|
|
13534
|
+
}
|
|
13535
|
+
});
|
|
13536
|
+
}
|
|
13492
13537
|
convertSourceFileEdit(edit) {
|
|
13493
13538
|
const range = this.convertSourceFileRange(edit.sourceFile, edit.range);
|
|
13494
13539
|
const textDocument = ls3.OptionalVersionedTextDocumentIdentifier.create(
|
|
@@ -13501,10 +13546,10 @@ var LanguageServer = class {
|
|
|
13501
13546
|
const convertedEdits = edits.map((e) => this.convertSourceFileEdit(e));
|
|
13502
13547
|
return { documentChanges: convertedEdits };
|
|
13503
13548
|
}
|
|
13504
|
-
onGetNodeRange(params,
|
|
13549
|
+
onGetNodeRange(params, taskController) {
|
|
13505
13550
|
return __async(this, null, function* () {
|
|
13506
|
-
const uri =
|
|
13507
|
-
const sourceFileContext = yield this.getSourceFileContext(uri,
|
|
13551
|
+
const uri = URI.parse(params.uri);
|
|
13552
|
+
const sourceFileContext = yield this.getSourceFileContext(uri, taskController);
|
|
13508
13553
|
let result;
|
|
13509
13554
|
if (sourceFileContext !== void 0) {
|
|
13510
13555
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
@@ -13521,13 +13566,13 @@ var LanguageServer = class {
|
|
|
13521
13566
|
}
|
|
13522
13567
|
onCreateOrUpdateSourceFile(params) {
|
|
13523
13568
|
return __async(this, null, function* () {
|
|
13524
|
-
const uri = this.convertVscodeUriToUri(
|
|
13569
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.uri));
|
|
13525
13570
|
this.manuallyUpdatedFileSystemTreeProvider?.createOrUpdateSourceFile(uri, params.text);
|
|
13526
13571
|
});
|
|
13527
13572
|
}
|
|
13528
13573
|
onDeleteSourceFile(params) {
|
|
13529
13574
|
return __async(this, null, function* () {
|
|
13530
|
-
const uri = this.convertVscodeUriToUri(
|
|
13575
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.uri));
|
|
13531
13576
|
this.manuallyUpdatedFileSystemTreeProvider?.deleteSourceFile(uri);
|
|
13532
13577
|
});
|
|
13533
13578
|
}
|
|
@@ -13544,11 +13589,11 @@ var LanguageServer = class {
|
|
|
13544
13589
|
return result;
|
|
13545
13590
|
});
|
|
13546
13591
|
}
|
|
13547
|
-
onEmitCodeToString(params,
|
|
13592
|
+
onEmitCodeToString(params, taskController) {
|
|
13548
13593
|
return __async(this, null, function* () {
|
|
13549
13594
|
let compilationControllerUri;
|
|
13550
13595
|
if (params.workspaceFolderUri !== void 0) {
|
|
13551
|
-
compilationControllerUri = this.convertVscodeUriToUri(
|
|
13596
|
+
compilationControllerUri = this.convertVscodeUriToUri(URI.parse(params.workspaceFolderUri));
|
|
13552
13597
|
} else {
|
|
13553
13598
|
if (this.workspace.workspaceFolderUris.length !== 1) {
|
|
13554
13599
|
throw new ls3.ResponseError(
|
|
@@ -13558,7 +13603,10 @@ var LanguageServer = class {
|
|
|
13558
13603
|
}
|
|
13559
13604
|
compilationControllerUri = this.workspace.workspaceFolderUris[0];
|
|
13560
13605
|
}
|
|
13561
|
-
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(
|
|
13606
|
+
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(
|
|
13607
|
+
compilationControllerUri,
|
|
13608
|
+
taskController
|
|
13609
|
+
);
|
|
13562
13610
|
const compilationController = workspaceElementInfo?.compilationController;
|
|
13563
13611
|
if (compilationController === void 0) {
|
|
13564
13612
|
throw new ls3.ResponseError(
|
|
@@ -13574,12 +13622,12 @@ var LanguageServer = class {
|
|
|
13574
13622
|
const trackedSourceFiles = this.workspace.trackedSourceFiles.createItemsSnapshot();
|
|
13575
13623
|
const packageGraph = new SourcePackageDependencyGraph(compilationState.analyzer);
|
|
13576
13624
|
let hasErrors = false;
|
|
13577
|
-
for (const pkg of packageGraph.
|
|
13625
|
+
for (const pkg of packageGraph.packagesForTargetPlatform(0 /* JavaScript */)) {
|
|
13578
13626
|
if (pkg.kind === "translation") {
|
|
13579
13627
|
continue;
|
|
13580
13628
|
}
|
|
13581
13629
|
for (const sourceFile of pkg.sourceFiles) {
|
|
13582
|
-
const summary = yield compilationState.getDiagnosticsCollectionSummary(sourceFile,
|
|
13630
|
+
const summary = yield compilationState.getDiagnosticsCollectionSummary(sourceFile, taskController);
|
|
13583
13631
|
hasErrors ||= summary.hasErrors;
|
|
13584
13632
|
if (summary.hasErrors) {
|
|
13585
13633
|
const uri = this.convertUriToVscodeUri(sourceFile.uri).toString();
|
|
@@ -13591,14 +13639,14 @@ var LanguageServer = class {
|
|
|
13591
13639
|
if (hasErrors) {
|
|
13592
13640
|
return { hasErrors, filesWithErrors };
|
|
13593
13641
|
}
|
|
13594
|
-
const
|
|
13642
|
+
const options7 = {
|
|
13595
13643
|
importEmitKind: 2 /* Custom */,
|
|
13596
13644
|
isCustomImportSynchronous: true
|
|
13597
13645
|
};
|
|
13598
13646
|
let result;
|
|
13599
13647
|
try {
|
|
13600
|
-
const emitter = new Emitter(compilationController.mainCompilationState.analyzer,
|
|
13601
|
-
const code = yield emitter.emitToString(
|
|
13648
|
+
const emitter = new Emitter(compilationController.mainCompilationState.analyzer, options7);
|
|
13649
|
+
const code = yield emitter.emitToString(taskController);
|
|
13602
13650
|
result = { hasErrors: false, code };
|
|
13603
13651
|
} catch (e) {
|
|
13604
13652
|
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 +13656,11 @@ ${e}`);
|
|
|
13608
13656
|
return result;
|
|
13609
13657
|
});
|
|
13610
13658
|
}
|
|
13611
|
-
|
|
13659
|
+
onProvideServerOwnedDocumentContent(params, taskController) {
|
|
13612
13660
|
return __async(this, null, function* () {
|
|
13613
|
-
const vscodeUri =
|
|
13661
|
+
const vscodeUri = URI.parse(params.uri);
|
|
13614
13662
|
if (vscodeUri.scheme === InMemoryPackageScheme) {
|
|
13615
|
-
const sourceFileContext = yield this.getSourceFileContext(vscodeUri,
|
|
13663
|
+
const sourceFileContext = yield this.getSourceFileContext(vscodeUri, taskController);
|
|
13616
13664
|
return sourceFileContext?.sourceFile.getSourceText();
|
|
13617
13665
|
} else if (vscodeUri.scheme === GeneratedSourceFileScheme) {
|
|
13618
13666
|
const uri = this.convertVscodeUriToUri(vscodeUri);
|
|
@@ -13629,10 +13677,10 @@ ${e}`);
|
|
|
13629
13677
|
}
|
|
13630
13678
|
});
|
|
13631
13679
|
}
|
|
13632
|
-
onProvideEvaluatableExpression(params,
|
|
13680
|
+
onProvideEvaluatableExpression(params, taskController) {
|
|
13633
13681
|
return __async(this, null, function* () {
|
|
13634
13682
|
let result;
|
|
13635
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13683
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13636
13684
|
if (sourceFileContext !== void 0) {
|
|
13637
13685
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13638
13686
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13648,10 +13696,10 @@ ${e}`);
|
|
|
13648
13696
|
return result;
|
|
13649
13697
|
});
|
|
13650
13698
|
}
|
|
13651
|
-
onCompletion(params,
|
|
13699
|
+
onCompletion(params, taskController) {
|
|
13652
13700
|
return __async(this, null, function* () {
|
|
13653
13701
|
let result = new Array();
|
|
13654
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13702
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13655
13703
|
if (sourceFileContext !== void 0) {
|
|
13656
13704
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13657
13705
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13753,22 +13801,22 @@ ${e}`);
|
|
|
13753
13801
|
Debug.never(kind);
|
|
13754
13802
|
}
|
|
13755
13803
|
}
|
|
13756
|
-
onSemanticTokens(params,
|
|
13804
|
+
onSemanticTokens(params, taskController) {
|
|
13757
13805
|
return __async(this, null, function* () {
|
|
13758
13806
|
let result;
|
|
13759
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13807
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13760
13808
|
if (sourceFileContext !== void 0) {
|
|
13761
13809
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13762
|
-
const semanticTokens = yield this.semanticTokensService.getSemanticTokens(analyzer, sourceFile,
|
|
13810
|
+
const semanticTokens = yield this.semanticTokensService.getSemanticTokens(analyzer, sourceFile, taskController);
|
|
13763
13811
|
result = this.convertSemanticTokens(semanticTokens, sourceFile);
|
|
13764
13812
|
}
|
|
13765
13813
|
return result ?? { data: [] };
|
|
13766
13814
|
});
|
|
13767
13815
|
}
|
|
13768
|
-
onSemanticTokensRange(params,
|
|
13816
|
+
onSemanticTokensRange(params, taskController) {
|
|
13769
13817
|
return __async(this, null, function* () {
|
|
13770
13818
|
let result;
|
|
13771
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13819
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13772
13820
|
if (sourceFileContext !== void 0) {
|
|
13773
13821
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13774
13822
|
const range = new Range(
|
|
@@ -13779,7 +13827,7 @@ ${e}`);
|
|
|
13779
13827
|
analyzer,
|
|
13780
13828
|
sourceFile,
|
|
13781
13829
|
range,
|
|
13782
|
-
|
|
13830
|
+
taskController
|
|
13783
13831
|
);
|
|
13784
13832
|
return this.convertSemanticTokens(semanticTokens, sourceFile);
|
|
13785
13833
|
}
|
|
@@ -13867,10 +13915,10 @@ ${e}`);
|
|
|
13867
13915
|
Debug.never(flag);
|
|
13868
13916
|
}
|
|
13869
13917
|
}
|
|
13870
|
-
onSignatureHelp(params,
|
|
13918
|
+
onSignatureHelp(params, taskController) {
|
|
13871
13919
|
return __async(this, null, function* () {
|
|
13872
13920
|
let result;
|
|
13873
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13921
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13874
13922
|
if (sourceFileContext !== void 0) {
|
|
13875
13923
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13876
13924
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13891,10 +13939,10 @@ ${e}`);
|
|
|
13891
13939
|
return result;
|
|
13892
13940
|
});
|
|
13893
13941
|
}
|
|
13894
|
-
onSelectionRanges(params,
|
|
13942
|
+
onSelectionRanges(params, taskController) {
|
|
13895
13943
|
return __async(this, null, function* () {
|
|
13896
13944
|
let result;
|
|
13897
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13945
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13898
13946
|
if (sourceFileContext !== void 0) {
|
|
13899
13947
|
result = [];
|
|
13900
13948
|
const { sourceFile } = sourceFileContext;
|
|
@@ -13916,10 +13964,10 @@ ${e}`);
|
|
|
13916
13964
|
const range = this.convertSourceFileRange(sourceFile, selectionRange.range);
|
|
13917
13965
|
return ls3.SelectionRange.create(range, parent);
|
|
13918
13966
|
}
|
|
13919
|
-
onCodeAction(params,
|
|
13967
|
+
onCodeAction(params, taskController) {
|
|
13920
13968
|
return __async(this, null, function* () {
|
|
13921
13969
|
let result;
|
|
13922
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13970
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13923
13971
|
if (sourceFileContext !== void 0) {
|
|
13924
13972
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13925
13973
|
const offset = sourceFile.getOffsetAtPosition(new Position(params.range.start.line, params.range.start.character));
|
|
@@ -13930,11 +13978,11 @@ ${e}`);
|
|
|
13930
13978
|
return result;
|
|
13931
13979
|
});
|
|
13932
13980
|
}
|
|
13933
|
-
onCodeActionResolve(params,
|
|
13981
|
+
onCodeActionResolve(params, taskController) {
|
|
13934
13982
|
return __async(this, null, function* () {
|
|
13935
13983
|
const result = params;
|
|
13936
13984
|
if (isCodeActionData(params.data)) {
|
|
13937
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13985
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.data.location.uri), taskController);
|
|
13938
13986
|
if (sourceFileContext !== void 0) {
|
|
13939
13987
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13940
13988
|
const offset = sourceFile.getOffsetAtPosition(new Position(
|
|
@@ -14001,7 +14049,7 @@ ${e}`);
|
|
|
14001
14049
|
const endPosition = sourceFile.getPositionAt(range.end);
|
|
14002
14050
|
return ls3.Range.create(startPosition, endPosition);
|
|
14003
14051
|
}
|
|
14004
|
-
getSourceFileContext(vscodeUri,
|
|
14052
|
+
getSourceFileContext(vscodeUri, taskController) {
|
|
14005
14053
|
return __async(this, null, function* () {
|
|
14006
14054
|
const uri = this.convertVscodeUriToUri(vscodeUri);
|
|
14007
14055
|
if (uri.scheme === GeneratedSourceFileScheme) {
|
|
@@ -14017,7 +14065,7 @@ ${e}`);
|
|
|
14017
14065
|
}
|
|
14018
14066
|
return void 0;
|
|
14019
14067
|
} else {
|
|
14020
|
-
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(uri,
|
|
14068
|
+
const workspaceElementInfo = yield this.workspace.waitLoadedAndGetWorkspaceElementInfo(uri, taskController);
|
|
14021
14069
|
if (workspaceElementInfo?.sourceFile !== void 0) {
|
|
14022
14070
|
return new SourceFileContext(
|
|
14023
14071
|
workspaceElementInfo.compilationController,
|
|
@@ -14030,7 +14078,7 @@ ${e}`);
|
|
|
14030
14078
|
});
|
|
14031
14079
|
}
|
|
14032
14080
|
convertUriToVscodeUri(uri) {
|
|
14033
|
-
return
|
|
14081
|
+
return URI.from({ scheme: uri.scheme, authority: uri.authority, path: uri.path });
|
|
14034
14082
|
}
|
|
14035
14083
|
convertVscodeUriToUri(uri) {
|
|
14036
14084
|
return Uri.from(uri.scheme, uri.authority, uri.path);
|
|
@@ -14041,11 +14089,14 @@ ${e}`);
|
|
|
14041
14089
|
}
|
|
14042
14090
|
return new ClientCancellationToken(cancellationToken);
|
|
14043
14091
|
}
|
|
14044
|
-
|
|
14092
|
+
withTaskController(token, handler) {
|
|
14045
14093
|
return __async(this, null, function* () {
|
|
14046
|
-
const
|
|
14094
|
+
const taskController = new TaskController(
|
|
14095
|
+
_LanguageServer.DefaultCancellationTokenThrottleTime,
|
|
14096
|
+
this.createCancellationToken(token)
|
|
14097
|
+
);
|
|
14047
14098
|
try {
|
|
14048
|
-
return yield handler(
|
|
14099
|
+
return yield handler(taskController);
|
|
14049
14100
|
} catch (e) {
|
|
14050
14101
|
if (e instanceof CancelledError) {
|
|
14051
14102
|
throw new ls3.ResponseError(ls3.LSPErrorCodes.RequestCancelled, e.message);
|
|
@@ -14056,8 +14107,9 @@ ${e}`);
|
|
|
14056
14107
|
}
|
|
14057
14108
|
};
|
|
14058
14109
|
__decorateClass([
|
|
14059
|
-
|
|
14060
|
-
],
|
|
14110
|
+
atomic7
|
|
14111
|
+
], _LanguageServer.prototype, "onDidChangeWorkspaceFolders", 1);
|
|
14112
|
+
var LanguageServer = _LanguageServer;
|
|
14061
14113
|
var FileSystemSynchronizationMode;
|
|
14062
14114
|
((FileSystemSynchronizationMode2) => {
|
|
14063
14115
|
class ClientSideFSWatcher {
|
|
@@ -14106,13 +14158,5 @@ export {
|
|
|
14106
14158
|
ClientCancellationToken,
|
|
14107
14159
|
FileSystemSynchronizationMode,
|
|
14108
14160
|
LanguageServer,
|
|
14109
|
-
|
|
14110
|
-
isAssignFieldParams,
|
|
14111
|
-
isCreateOrUpdateSourceFileParams,
|
|
14112
|
-
isDeleteSourceFileParams,
|
|
14113
|
-
isDisplayFileSystemTreeParams,
|
|
14114
|
-
isEmitCodeToStringParams,
|
|
14115
|
-
isGetNodeRangeParams,
|
|
14116
|
-
isProvideEvaluatableExpressionParams,
|
|
14117
|
-
isProvideServerOwnedDocumentContentParams
|
|
14161
|
+
customRequests
|
|
14118
14162
|
};
|