@artel/artc 0.6.25278 → 0.6.25280
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 +2 -12
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +350 -299
- package/build/{chunk-A2QTLTGI.js → chunk-LLI2DYRX.js} +142 -166
- package/build/{chunk-L44WWCT7.js → chunk-W3UL6UED.js} +1 -1
- package/build/{chunk-4C7CEJJF.js → chunk-YIFO3FBO.js} +2 -2
- package/build/types/analysis/Analyzer.d.ts +3 -1
- package/build/types/analysis/UserDefinableBinaryOperatorResolver.d.ts +1 -1
- package/build/types/analysis/UserDefinableUnaryOperatorResolver.d.ts +1 -1
- package/build/types/api/ApiServices.d.ts +1 -1
- package/build/types/common/index.d.ts +1 -4
- package/build/types/{common → diagnostic}/WithDiagnostics.d.ts +1 -1
- package/build/types/services/{CustomCommand.d.ts → CustomRequests.d.ts} +20 -51
- package/build/types/services/DeleteBlockFromScriptService.d.ts +6 -0
- package/build/types/services/LanguageServer.d.ts +3 -2
- package/build/types/services/source-generation/SourceGenerationService.d.ts +3 -2
- package/package.json +1 -1
- package/build/types/common/Delayed.d.ts +0 -7
- /package/build/types/{common → analysis}/TreeQuery.d.ts +0 -0
package/build/api/ApiServices.js
CHANGED
|
@@ -188,95 +188,31 @@ import {
|
|
|
188
188
|
unwrapParenthesizedExpressions,
|
|
189
189
|
visitChildren,
|
|
190
190
|
yieldTask
|
|
191
|
-
} from "../chunk-
|
|
191
|
+
} from "../chunk-LLI2DYRX.js";
|
|
192
192
|
|
|
193
|
-
// source/services/
|
|
193
|
+
// source/services/CustomRequests.ts
|
|
194
194
|
import * as ls from "vscode-languageserver";
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
*/
|
|
211
|
-
provideServerOwnedDocumentContent: "artel/provideServerOwnedDocumentContent",
|
|
212
|
-
/**
|
|
213
|
-
* Возвращает `EmitCodeToStringResult`.
|
|
214
|
-
*/
|
|
215
|
-
emitCodeToString: "artel/emitCodeToString",
|
|
216
|
-
/**
|
|
217
|
-
* Возвращает `string | null`.
|
|
218
|
-
*/
|
|
219
|
-
displayFileSystemTree: "artel/displayFileSystemTree",
|
|
220
|
-
/**
|
|
221
|
-
* Возвращает `void`.
|
|
222
|
-
*/
|
|
223
|
-
createOrUpdateSourceFile: "artel/fs.createOrUpdateSourceFile",
|
|
224
|
-
/**
|
|
225
|
-
* Возвращает `void`.
|
|
226
|
-
*/
|
|
227
|
-
deleteSourceFile: "artel/fs.deleteSourceFile",
|
|
228
|
-
/**
|
|
229
|
-
* Возвращает `ls.Range | null`.
|
|
230
|
-
*/
|
|
231
|
-
getNodeRange: "artel/getNodeRange",
|
|
232
|
-
/**
|
|
233
|
-
* Возвращает `void`.
|
|
234
|
-
*/
|
|
235
|
-
assignField: "artel/assignField"
|
|
236
|
-
};
|
|
237
|
-
function isProvideEvaluatableExpressionParams(value) {
|
|
238
|
-
cast(value);
|
|
239
|
-
return !isNullOrUndefined(value) && ls.TextDocumentIdentifier.is(value.textDocument) && ls.Position.is(value.position);
|
|
240
|
-
}
|
|
241
|
-
function isProvideServerOwnedDocumentContentParams(value) {
|
|
242
|
-
cast(value);
|
|
243
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri);
|
|
244
|
-
}
|
|
245
|
-
function isEmitCodeToStringParams(value) {
|
|
246
|
-
cast(value);
|
|
247
|
-
return !isNullOrUndefined(value) && (value.workspaceFolderUri === void 0 || ls.URI.is(value.workspaceFolderUri));
|
|
248
|
-
}
|
|
249
|
-
function isDisplayFileSystemTreeParams(value) {
|
|
250
|
-
cast(value);
|
|
251
|
-
return !isNullOrUndefined(value) && (value.workspaceFolderUri === void 0 || ls.URI.is(value.workspaceFolderUri)) && (value.log === void 0 || typeof value.log === "boolean");
|
|
252
|
-
}
|
|
253
|
-
function isCreateOrUpdateSourceFileParams(value) {
|
|
254
|
-
cast(value);
|
|
255
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri) && typeof value.text === "string";
|
|
256
|
-
}
|
|
257
|
-
function isDeleteSourceFileParams(value) {
|
|
258
|
-
cast(value);
|
|
259
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri);
|
|
260
|
-
}
|
|
261
|
-
function isGetNodeRangeParams(value) {
|
|
262
|
-
cast(value);
|
|
263
|
-
return !isNullOrUndefined(value) && ls.DocumentUri.is(value.uri);
|
|
264
|
-
}
|
|
265
|
-
function isAssignFieldParams(value) {
|
|
266
|
-
cast(value);
|
|
267
|
-
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));
|
|
268
|
-
}
|
|
269
|
-
function isNullOrUndefined(value) {
|
|
270
|
-
return value === null || value === void 0;
|
|
271
|
-
}
|
|
272
|
-
function cast(value) {
|
|
273
|
-
}
|
|
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
|
+
};
|
|
274
210
|
|
|
275
211
|
// source/services/LanguageServer.ts
|
|
276
|
-
import { atomic as
|
|
212
|
+
import { atomic as atomic7, runAtomically as runAtomically2 } from "reactronic";
|
|
277
213
|
import * as ls3 from "vscode-languageserver";
|
|
278
214
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
279
|
-
import { URI
|
|
215
|
+
import { URI } from "vscode-uri";
|
|
280
216
|
|
|
281
217
|
// source/services/Types.ts
|
|
282
218
|
import * as ls2 from "vscode-languageserver";
|
|
@@ -1111,17 +1047,17 @@ var SyntaxFactory = class {
|
|
|
1111
1047
|
|
|
1112
1048
|
// source/tree/SyntaxToCode.ts
|
|
1113
1049
|
var SyntaxToCode = class _SyntaxToCode {
|
|
1114
|
-
constructor(node,
|
|
1050
|
+
constructor(node, options7) {
|
|
1115
1051
|
this.code = "";
|
|
1116
1052
|
this.isIndentationWritten = false;
|
|
1117
1053
|
this.isSingleLineMode = false;
|
|
1118
1054
|
this.node = node;
|
|
1119
|
-
this.newLine =
|
|
1120
|
-
this.indentationStep =
|
|
1121
|
-
this.keywordsLocale =
|
|
1122
|
-
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;
|
|
1123
1059
|
this.singleWordKeywordValues = Query.from(getOrCreateKeywordDictionary(this.keywordsLocale, this.keywordsDialect).values()).mapAndFilter((k) => k.keywordKind !== 0 /* Unknown */ ? k.value : void 0).uniqueToSet();
|
|
1124
|
-
this.indentation =
|
|
1060
|
+
this.indentation = options7?.initialIndentation ?? "";
|
|
1125
1061
|
}
|
|
1126
1062
|
static get writeFunctions() {
|
|
1127
1063
|
return this.writeFunctions_ ??= this.createWriteFunctions();
|
|
@@ -3984,8 +3920,8 @@ var CompletionService = class {
|
|
|
3984
3920
|
getTypeMemberCompletionItemInfos(ctx) {
|
|
3985
3921
|
const type = this.analyzer.excludeNullFromType(ctx.type);
|
|
3986
3922
|
const memberLookup = TypeMemberLookup.ofType(this.analyzer, type, this.locale);
|
|
3987
|
-
const
|
|
3988
|
-
return memberLookup.getNamedMembers(
|
|
3923
|
+
const options7 = ctx.isStaticAccess ? 2 /* OnlyStaticMembers */ : 1 /* OnlyInstanceMembers */;
|
|
3924
|
+
return memberLookup.getNamedMembers(options7, ctx.hidingMatcher, ctx.typeExtensionLookup).map((m) => {
|
|
3989
3925
|
switch (m.kind) {
|
|
3990
3926
|
case "method":
|
|
3991
3927
|
return new MethodCompletionItemInfo(this.completionItemInfoContext, m);
|
|
@@ -3994,7 +3930,7 @@ var CompletionService = class {
|
|
|
3994
3930
|
default:
|
|
3995
3931
|
Debug.never(m);
|
|
3996
3932
|
}
|
|
3997
|
-
}).concat(memberLookup.getOperators(
|
|
3933
|
+
}).concat(memberLookup.getOperators(options7, ctx.hidingMatcher, ctx.typeExtensionLookup).map((o) => new OperatorCompletionItemInfo(this.completionItemInfoContext, o)));
|
|
3998
3934
|
}
|
|
3999
3935
|
getPackageImportCompletionItemInfos(ctx) {
|
|
4000
3936
|
const result = this.analyzer.packageImports.getPackagesAvailableForImport(this.sourceFile.package).map((p) => p.getName()).filter((n) => {
|
|
@@ -5622,21 +5558,21 @@ var CompletionItemInfoCache = class {
|
|
|
5622
5558
|
|
|
5623
5559
|
// source/services/NodeSemanticInfo.ts
|
|
5624
5560
|
var NodeSemanticInfoService = class {
|
|
5625
|
-
static ofTokenOrKeyword(analyzer, tokenOrKeyword,
|
|
5561
|
+
static ofTokenOrKeyword(analyzer, tokenOrKeyword, options7) {
|
|
5626
5562
|
if (isIdentifier(tokenOrKeyword.value)) {
|
|
5627
|
-
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value,
|
|
5563
|
+
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options7);
|
|
5628
5564
|
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind === 69 /* AutotypeCallExpression */) {
|
|
5629
|
-
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent,
|
|
5565
|
+
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent, options7);
|
|
5630
5566
|
} else if (tokenOrKeyword.parent.kind === 75 /* PrefixUnaryExpression */) {
|
|
5631
|
-
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5567
|
+
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5632
5568
|
} else if (tokenOrKeyword.parent.kind === 64 /* BinaryExpression */) {
|
|
5633
|
-
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5569
|
+
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5634
5570
|
} else if (tokenOrKeyword.isToken(20 /* Caret */) && (tokenOrKeyword.parent.kind === 48 /* DereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 49 /* DereferencedVariableSetterDeclaration */)) {
|
|
5635
5571
|
return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
|
|
5636
5572
|
} else if (tokenOrKeyword.isToken(20 /* Caret */) && tokenOrKeyword.parent.kind === 78 /* DereferenceExpression */) {
|
|
5637
|
-
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5573
|
+
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5638
5574
|
} else if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
|
5639
|
-
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent,
|
|
5575
|
+
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5640
5576
|
} else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 43 /* ConstructorDeclaration */) {
|
|
5641
5577
|
return this.ofConstructorDeclaration(analyzer, tokenOrKeyword.parent);
|
|
5642
5578
|
} else if (tokenOrKeyword.isToken(14 /* Asterisk */) && tokenOrKeyword.parent.kind === 91 /* DefaultMatchExpression */) {
|
|
@@ -5646,21 +5582,21 @@ var NodeSemanticInfoService = class {
|
|
|
5646
5582
|
} else if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && tokenOrKeyword.parent.parent.kind === 66 /* FunctionBlockLiteral */) {
|
|
5647
5583
|
return this.ofRegularOrBlockFunctionLiteral(analyzer, tokenOrKeyword.parent.parent);
|
|
5648
5584
|
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 87 /* ObjectExpression */) {
|
|
5649
|
-
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent,
|
|
5585
|
+
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options7);
|
|
5650
5586
|
} else if (tokenOrKeyword.isKeyword(56 /* Base */) && tokenOrKeyword.parent.kind === 88 /* BaseExpression */) {
|
|
5651
|
-
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent,
|
|
5587
|
+
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options7);
|
|
5652
5588
|
} else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 47 /* IndexParameterClause */) {
|
|
5653
5589
|
return this.ofIndexedElementAccessorDeclaration(analyzer, tokenOrKeyword.parent.parent);
|
|
5654
5590
|
} else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 70 /* IndexedAccessExpression */) {
|
|
5655
|
-
return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent,
|
|
5591
|
+
return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent, options7);
|
|
5656
5592
|
} else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 127 /* ConstructorTranslation */) {
|
|
5657
|
-
return this.ofConstructorTranslationSourceConstructor(analyzer, tokenOrKeyword.parent,
|
|
5593
|
+
return this.ofConstructorTranslationSourceConstructor(analyzer, tokenOrKeyword.parent, options7);
|
|
5658
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) {
|
|
5659
|
-
return this.ofConstructorTranslationTranslatedConstructor(analyzer, tokenOrKeyword.parent.parent,
|
|
5595
|
+
return this.ofConstructorTranslationTranslatedConstructor(analyzer, tokenOrKeyword.parent.parent, options7);
|
|
5660
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) {
|
|
5661
|
-
return this.ofIndexerTranslationSourceIndexer(analyzer, tokenOrKeyword.parent.parent,
|
|
5597
|
+
return this.ofIndexerTranslationSourceIndexer(analyzer, tokenOrKeyword.parent.parent, options7);
|
|
5662
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) {
|
|
5663
|
-
return this.ofIndexerTranslationTranslatedIndexer(analyzer, tokenOrKeyword.parent.parent,
|
|
5599
|
+
return this.ofIndexerTranslationTranslatedIndexer(analyzer, tokenOrKeyword.parent.parent, options7);
|
|
5664
5600
|
}
|
|
5665
5601
|
return void 0;
|
|
5666
5602
|
}
|
|
@@ -5672,20 +5608,20 @@ var NodeSemanticInfoService = class {
|
|
|
5672
5608
|
const type = analyzer.type.ofExpression(node);
|
|
5673
5609
|
return new DefaultSwitchMatchNodeSemanticInfo(type);
|
|
5674
5610
|
}
|
|
5675
|
-
static ofNonKeywordIdentifier(analyzer, node,
|
|
5611
|
+
static ofNonKeywordIdentifier(analyzer, node, options7) {
|
|
5676
5612
|
let result;
|
|
5677
5613
|
const parent = node.parent;
|
|
5678
5614
|
switch (parent.kind) {
|
|
5679
5615
|
case 130 /* TranslationTypeParameterList */:
|
|
5680
|
-
return this.ofTranslationTypeParameterListParameter(analyzer, node, parent,
|
|
5616
|
+
return this.ofTranslationTypeParameterListParameter(analyzer, node, parent, options7);
|
|
5681
5617
|
case 125 /* TranslationParameterList */:
|
|
5682
|
-
return this.ofTranslationParameterListParameter(analyzer, node, parent,
|
|
5618
|
+
return this.ofTranslationParameterListParameter(analyzer, node, parent, options7);
|
|
5683
5619
|
case 150 /* Argument */: {
|
|
5684
5620
|
const respectiveParameter = analyzer.getRespectiveParameter(parent);
|
|
5685
5621
|
if (respectiveParameter !== void 0) {
|
|
5686
5622
|
const target = new MatchResultParameterReferenceTarget(respectiveParameter, 0 /* Get */);
|
|
5687
5623
|
result = new ReferenceNodeSemanticInfo([target], false);
|
|
5688
|
-
if (
|
|
5624
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5689
5625
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5690
5626
|
}
|
|
5691
5627
|
}
|
|
@@ -5716,7 +5652,7 @@ var NodeSemanticInfoService = class {
|
|
|
5716
5652
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageVariantTypeDeclaration(parent));
|
|
5717
5653
|
break;
|
|
5718
5654
|
case 89 /* IdentifierExpression */:
|
|
5719
|
-
result = this.ofIdentifierExpression(analyzer, parent,
|
|
5655
|
+
result = this.ofIdentifierExpression(analyzer, parent, options7);
|
|
5720
5656
|
break;
|
|
5721
5657
|
case 56 /* NestedFunctionDeclaration */:
|
|
5722
5658
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofNestedFunctionDeclaration(parent));
|
|
@@ -5725,7 +5661,7 @@ var NodeSemanticInfoService = class {
|
|
|
5725
5661
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
|
|
5726
5662
|
break;
|
|
5727
5663
|
case 135 /* QualifiedName */:
|
|
5728
|
-
result = this.ofQualifiedNameQualifier(analyzer, parent, node,
|
|
5664
|
+
result = this.ofQualifiedNameQualifier(analyzer, parent, node, options7);
|
|
5729
5665
|
break;
|
|
5730
5666
|
case 136 /* PackageVariableTranslationDeclaration */:
|
|
5731
5667
|
case 132 /* PackageFunctionTranslationDeclaration */:
|
|
@@ -5737,7 +5673,7 @@ var NodeSemanticInfoService = class {
|
|
|
5737
5673
|
if (node === parent.sourceName) {
|
|
5738
5674
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
5739
5675
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5740
|
-
if (
|
|
5676
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5741
5677
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5742
5678
|
}
|
|
5743
5679
|
} else if (node === parent.translatedName) {
|
|
@@ -5746,7 +5682,7 @@ var NodeSemanticInfoService = class {
|
|
|
5746
5682
|
0 /* Get */
|
|
5747
5683
|
));
|
|
5748
5684
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5749
|
-
if (
|
|
5685
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5750
5686
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5751
5687
|
}
|
|
5752
5688
|
}
|
|
@@ -5761,7 +5697,7 @@ var NodeSemanticInfoService = class {
|
|
|
5761
5697
|
if (node === parent.sourceName) {
|
|
5762
5698
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
5763
5699
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5764
|
-
if (
|
|
5700
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5765
5701
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5766
5702
|
}
|
|
5767
5703
|
} else if (node === parent.translatedName) {
|
|
@@ -5770,7 +5706,7 @@ var NodeSemanticInfoService = class {
|
|
|
5770
5706
|
0 /* Get */
|
|
5771
5707
|
));
|
|
5772
5708
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
5773
|
-
if (
|
|
5709
|
+
if (options7.includeBetterReferenceTargets) {
|
|
5774
5710
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5775
5711
|
}
|
|
5776
5712
|
}
|
|
@@ -5787,7 +5723,7 @@ var NodeSemanticInfoService = class {
|
|
|
5787
5723
|
result = void 0;
|
|
5788
5724
|
break;
|
|
5789
5725
|
case 76 /* MemberAccessExpression */:
|
|
5790
|
-
result = this.ofMember(analyzer, parent,
|
|
5726
|
+
result = this.ofMember(analyzer, parent, options7);
|
|
5791
5727
|
break;
|
|
5792
5728
|
case 50 /* MethodDeclaration */:
|
|
5793
5729
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofMethodDeclaration(parent));
|
|
@@ -5823,7 +5759,7 @@ var NodeSemanticInfoService = class {
|
|
|
5823
5759
|
}
|
|
5824
5760
|
return result;
|
|
5825
5761
|
}
|
|
5826
|
-
static ofMember(analyzer, node,
|
|
5762
|
+
static ofMember(analyzer, node, options7) {
|
|
5827
5763
|
let result;
|
|
5828
5764
|
const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
|
|
5829
5765
|
switch (meaning.kind) {
|
|
@@ -5929,7 +5865,7 @@ var NodeSemanticInfoService = class {
|
|
|
5929
5865
|
callExpressionMeaning.singleNotSuitableSubstitutedCandidate,
|
|
5930
5866
|
callExpressionMeaning.suitableConstructors,
|
|
5931
5867
|
callExpressionMeaning.candidates,
|
|
5932
|
-
|
|
5868
|
+
options7
|
|
5933
5869
|
);
|
|
5934
5870
|
break;
|
|
5935
5871
|
}
|
|
@@ -5948,7 +5884,7 @@ var NodeSemanticInfoService = class {
|
|
|
5948
5884
|
default:
|
|
5949
5885
|
Debug.never(meaning);
|
|
5950
5886
|
}
|
|
5951
|
-
if (result !== void 0 &&
|
|
5887
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
5952
5888
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5953
5889
|
}
|
|
5954
5890
|
return result;
|
|
@@ -5957,19 +5893,19 @@ var NodeSemanticInfoService = class {
|
|
|
5957
5893
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
5958
5894
|
}
|
|
5959
5895
|
}
|
|
5960
|
-
static ofQualifiedNameQualifier(analyzer, node, qualifier,
|
|
5896
|
+
static ofQualifiedNameQualifier(analyzer, node, qualifier, options7) {
|
|
5961
5897
|
switch (node.parent.kind) {
|
|
5962
5898
|
case 10 /* NamedTypeSpecifier */:
|
|
5963
|
-
return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier,
|
|
5899
|
+
return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier, options7);
|
|
5964
5900
|
case 152 /* Tag */:
|
|
5965
|
-
return this.ofTagNameQualifier(analyzer, node.parent, qualifier,
|
|
5901
|
+
return this.ofTagNameQualifier(analyzer, node.parent, qualifier, options7);
|
|
5966
5902
|
case 40 /* ExtendedTypeClause */:
|
|
5967
5903
|
return void 0;
|
|
5968
5904
|
default:
|
|
5969
5905
|
Debug.never(node.parent);
|
|
5970
5906
|
}
|
|
5971
5907
|
}
|
|
5972
|
-
static ofNamedTypeSpecifierNameQualifier(analyzer, node, qualifier,
|
|
5908
|
+
static ofNamedTypeSpecifierNameQualifier(analyzer, node, qualifier, options7) {
|
|
5973
5909
|
let result;
|
|
5974
5910
|
const resolutionResult = analyzer.resolveNamedTypeSpecifier(node);
|
|
5975
5911
|
const qualifierIndex = node.qualifiedName.qualifiers.toArray().indexOf(qualifier);
|
|
@@ -6016,12 +5952,12 @@ var NodeSemanticInfoService = class {
|
|
|
6016
5952
|
result = new ReferenceNodeSemanticInfo(targets, true);
|
|
6017
5953
|
}
|
|
6018
5954
|
}
|
|
6019
|
-
if (result !== void 0 &&
|
|
5955
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6020
5956
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6021
5957
|
}
|
|
6022
5958
|
return result;
|
|
6023
5959
|
}
|
|
6024
|
-
static ofTagNameQualifier(analyzer, node, qualifier,
|
|
5960
|
+
static ofTagNameQualifier(analyzer, node, qualifier, options7) {
|
|
6025
5961
|
let result;
|
|
6026
5962
|
const resolutionResult = analyzer.resolveTag(node);
|
|
6027
5963
|
const qualifierIndex = node.name.qualifiers.toArray().indexOf(qualifier);
|
|
@@ -6046,7 +5982,7 @@ var NodeSemanticInfoService = class {
|
|
|
6046
5982
|
resolutionResult.meaning.singleNotSuitableSubstitutedCandidate,
|
|
6047
5983
|
resolutionResult.meaning.suitableConstructors,
|
|
6048
5984
|
resolutionResult.meaning.candidates,
|
|
6049
|
-
|
|
5985
|
+
options7
|
|
6050
5986
|
);
|
|
6051
5987
|
}
|
|
6052
5988
|
break;
|
|
@@ -6100,12 +6036,12 @@ var NodeSemanticInfoService = class {
|
|
|
6100
6036
|
result = new ReferenceNodeSemanticInfo(targets, true);
|
|
6101
6037
|
}
|
|
6102
6038
|
}
|
|
6103
|
-
if (result !== void 0 &&
|
|
6039
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6104
6040
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6105
6041
|
}
|
|
6106
6042
|
return result;
|
|
6107
6043
|
}
|
|
6108
|
-
static ofIdentifierExpression(analyzer, node,
|
|
6044
|
+
static ofIdentifierExpression(analyzer, node, options7) {
|
|
6109
6045
|
let result;
|
|
6110
6046
|
const meaning = analyzer.resolveIdentifierExpression(node).meaning;
|
|
6111
6047
|
switch (meaning.kind) {
|
|
@@ -6134,7 +6070,7 @@ var NodeSemanticInfoService = class {
|
|
|
6134
6070
|
callExpressionMeaning.singleNotSuitableSubstitutedCandidate,
|
|
6135
6071
|
callExpressionMeaning.suitableConstructors,
|
|
6136
6072
|
callExpressionMeaning.candidates,
|
|
6137
|
-
|
|
6073
|
+
options7
|
|
6138
6074
|
);
|
|
6139
6075
|
break;
|
|
6140
6076
|
}
|
|
@@ -6213,7 +6149,7 @@ var NodeSemanticInfoService = class {
|
|
|
6213
6149
|
default:
|
|
6214
6150
|
Debug.never(meaning);
|
|
6215
6151
|
}
|
|
6216
|
-
if (result !== void 0 &&
|
|
6152
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6217
6153
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6218
6154
|
}
|
|
6219
6155
|
return result;
|
|
@@ -6230,7 +6166,7 @@ var NodeSemanticInfoService = class {
|
|
|
6230
6166
|
const entity = analyzer.entity.ofIndexerDeclaration(node);
|
|
6231
6167
|
return new DefinitionNodeSemanticInfo(entity);
|
|
6232
6168
|
}
|
|
6233
|
-
static ofIndexedAccessExpressionOperator(analyzer, node,
|
|
6169
|
+
static ofIndexedAccessExpressionOperator(analyzer, node, options7) {
|
|
6234
6170
|
const meaning = analyzer.resolveIndexedAccessExpression(node).meaning;
|
|
6235
6171
|
if (meaning.kind === "resolved") {
|
|
6236
6172
|
let result;
|
|
@@ -6243,7 +6179,7 @@ var NodeSemanticInfoService = class {
|
|
|
6243
6179
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
|
6244
6180
|
result = createIndexersReference(meaning.candidates, meaning.accessKind, true);
|
|
6245
6181
|
}
|
|
6246
|
-
if (result !== void 0 &&
|
|
6182
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6247
6183
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6248
6184
|
}
|
|
6249
6185
|
return result;
|
|
@@ -6254,14 +6190,14 @@ var NodeSemanticInfoService = class {
|
|
|
6254
6190
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
6255
6191
|
}
|
|
6256
6192
|
}
|
|
6257
|
-
static ofAssignmentStatementOperator(analyzer, node,
|
|
6193
|
+
static ofAssignmentStatementOperator(analyzer, node, options7) {
|
|
6258
6194
|
const operatorKind = analyzer.getBinaryOperatorKindIfCompoundAssignmentOperator(node.operator);
|
|
6259
6195
|
if (operatorKind !== void 0) {
|
|
6260
6196
|
const operator = analyzer.resolveCompoundAssignmentStatementOperator(node, operatorKind);
|
|
6261
6197
|
if (operator.kind === "ok") {
|
|
6262
6198
|
const target = new OperatorReferenceTarget(operator.value);
|
|
6263
6199
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6264
|
-
if (
|
|
6200
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6265
6201
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6266
6202
|
}
|
|
6267
6203
|
return result;
|
|
@@ -6269,14 +6205,14 @@ var NodeSemanticInfoService = class {
|
|
|
6269
6205
|
}
|
|
6270
6206
|
return void 0;
|
|
6271
6207
|
}
|
|
6272
|
-
static ofBinaryExpressionOperator(analyzer, node,
|
|
6208
|
+
static ofBinaryExpressionOperator(analyzer, node, options7) {
|
|
6273
6209
|
const classificationResult = analyzer.classifyBinaryExpressionOperator(node.operator);
|
|
6274
6210
|
if (classificationResult.kind === "user-definable") {
|
|
6275
6211
|
const operator = analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
|
|
6276
6212
|
if (operator.kind === "ok") {
|
|
6277
6213
|
const target = new OperatorReferenceTarget(operator.value);
|
|
6278
6214
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6279
|
-
if (
|
|
6215
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6280
6216
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6281
6217
|
}
|
|
6282
6218
|
return result;
|
|
@@ -6284,12 +6220,12 @@ var NodeSemanticInfoService = class {
|
|
|
6284
6220
|
}
|
|
6285
6221
|
return void 0;
|
|
6286
6222
|
}
|
|
6287
|
-
static ofPrefixUnaryExpressionOperator(analyzer, node,
|
|
6223
|
+
static ofPrefixUnaryExpressionOperator(analyzer, node, options7) {
|
|
6288
6224
|
const operator = analyzer.resolvePrefixUnaryExpressionUserDefinableOperator(node);
|
|
6289
6225
|
if (operator.kind === "ok") {
|
|
6290
6226
|
const target = new OperatorReferenceTarget(operator.value);
|
|
6291
6227
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6292
|
-
if (
|
|
6228
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6293
6229
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6294
6230
|
}
|
|
6295
6231
|
return result;
|
|
@@ -6300,19 +6236,19 @@ var NodeSemanticInfoService = class {
|
|
|
6300
6236
|
const entity = analyzer.entity.ofDereferenceOperatorDeclaration(node);
|
|
6301
6237
|
return new DefinitionNodeSemanticInfo(entity);
|
|
6302
6238
|
}
|
|
6303
|
-
static ofDereferenceExpressionOperator(analyzer, node,
|
|
6239
|
+
static ofDereferenceExpressionOperator(analyzer, node, options7) {
|
|
6304
6240
|
const meaning = analyzer.getDereferenceExpressionMeaning(node);
|
|
6305
6241
|
if (meaning.kind === "resolved") {
|
|
6306
6242
|
const target = new DereferenceOperatorReferenceTarget(meaning.operator, meaning.accessKind);
|
|
6307
6243
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
|
6308
|
-
if (
|
|
6244
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6309
6245
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6310
6246
|
}
|
|
6311
6247
|
return result;
|
|
6312
6248
|
}
|
|
6313
6249
|
return void 0;
|
|
6314
6250
|
}
|
|
6315
|
-
static ofAutotypeCallExpression(analyzer, node,
|
|
6251
|
+
static ofAutotypeCallExpression(analyzer, node, options7) {
|
|
6316
6252
|
const meaning = analyzer.resolveAutotypeCallExpression(node).meaning;
|
|
6317
6253
|
let result;
|
|
6318
6254
|
if (meaning.kind === "constructor-call") {
|
|
@@ -6326,12 +6262,12 @@ var NodeSemanticInfoService = class {
|
|
|
6326
6262
|
result = this.ofConstructors(analyzer, constructors);
|
|
6327
6263
|
}
|
|
6328
6264
|
}
|
|
6329
|
-
if (result !== void 0 &&
|
|
6265
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6330
6266
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6331
6267
|
}
|
|
6332
6268
|
return result;
|
|
6333
6269
|
}
|
|
6334
|
-
static ofObjectExpression(analyzer, node,
|
|
6270
|
+
static ofObjectExpression(analyzer, node, options7) {
|
|
6335
6271
|
const meaning = analyzer.resolveObjectExpression(node).meaning;
|
|
6336
6272
|
let result;
|
|
6337
6273
|
switch (meaning.kind) {
|
|
@@ -6358,12 +6294,12 @@ var NodeSemanticInfoService = class {
|
|
|
6358
6294
|
default:
|
|
6359
6295
|
Debug.never(meaning);
|
|
6360
6296
|
}
|
|
6361
|
-
if (result !== void 0 &&
|
|
6297
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6362
6298
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6363
6299
|
}
|
|
6364
6300
|
return result;
|
|
6365
6301
|
}
|
|
6366
|
-
static ofBaseExpression(analyzer, node,
|
|
6302
|
+
static ofBaseExpression(analyzer, node, options7) {
|
|
6367
6303
|
const meaning = analyzer.resolveBaseExpression(node).meaning;
|
|
6368
6304
|
let result;
|
|
6369
6305
|
switch (meaning.kind) {
|
|
@@ -6397,25 +6333,25 @@ var NodeSemanticInfoService = class {
|
|
|
6397
6333
|
default:
|
|
6398
6334
|
Debug.never(meaning);
|
|
6399
6335
|
}
|
|
6400
|
-
if (result !== void 0 &&
|
|
6336
|
+
if (result !== void 0 && options7.includeBetterReferenceTargets) {
|
|
6401
6337
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6402
6338
|
}
|
|
6403
6339
|
return result;
|
|
6404
6340
|
}
|
|
6405
|
-
static ofConstructorTranslationSourceConstructor(analyzer, node,
|
|
6341
|
+
static ofConstructorTranslationSourceConstructor(analyzer, node, options7) {
|
|
6406
6342
|
let result;
|
|
6407
6343
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6408
6344
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6409
6345
|
if (translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6410
6346
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6411
6347
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6412
|
-
if (
|
|
6348
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6413
6349
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6414
6350
|
}
|
|
6415
6351
|
}
|
|
6416
6352
|
return result;
|
|
6417
6353
|
}
|
|
6418
|
-
static ofConstructorTranslationTranslatedConstructor(analyzer, node,
|
|
6354
|
+
static ofConstructorTranslationTranslatedConstructor(analyzer, node, options7) {
|
|
6419
6355
|
let result;
|
|
6420
6356
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6421
6357
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
@@ -6425,26 +6361,26 @@ var NodeSemanticInfoService = class {
|
|
|
6425
6361
|
0 /* Get */
|
|
6426
6362
|
));
|
|
6427
6363
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6428
|
-
if (
|
|
6364
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6429
6365
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6430
6366
|
}
|
|
6431
6367
|
}
|
|
6432
6368
|
return result;
|
|
6433
6369
|
}
|
|
6434
|
-
static ofIndexerTranslationSourceIndexer(analyzer, node,
|
|
6370
|
+
static ofIndexerTranslationSourceIndexer(analyzer, node, options7) {
|
|
6435
6371
|
let result;
|
|
6436
6372
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6437
6373
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
6438
6374
|
if (translationTargets !== void 0 && translationTargets.values.length > 0) {
|
|
6439
6375
|
const targets = translationTargets.values.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6440
6376
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6441
|
-
if (
|
|
6377
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6442
6378
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6443
6379
|
}
|
|
6444
6380
|
}
|
|
6445
6381
|
return result;
|
|
6446
6382
|
}
|
|
6447
|
-
static ofIndexerTranslationTranslatedIndexer(analyzer, node,
|
|
6383
|
+
static ofIndexerTranslationTranslatedIndexer(analyzer, node, options7) {
|
|
6448
6384
|
let result;
|
|
6449
6385
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
6450
6386
|
const translationTargets = translationPackage?.getTypeMemberTranslationTargets(node);
|
|
@@ -6454,7 +6390,7 @@ var NodeSemanticInfoService = class {
|
|
|
6454
6390
|
0 /* Get */
|
|
6455
6391
|
));
|
|
6456
6392
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6457
|
-
if (
|
|
6393
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6458
6394
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6459
6395
|
}
|
|
6460
6396
|
}
|
|
@@ -6476,8 +6412,8 @@ var NodeSemanticInfoService = class {
|
|
|
6476
6412
|
}
|
|
6477
6413
|
return new ReferenceNodeSemanticInfo([new PackageReferenceTarget(packageTreeNode.package)], false);
|
|
6478
6414
|
}
|
|
6479
|
-
static ofConstructorCallWithTypeAccess(analyzer, suitableType, typeCandidates, singleNotSuitableSubstitutedCandidate, suitableConstructors, candidates,
|
|
6480
|
-
if (
|
|
6415
|
+
static ofConstructorCallWithTypeAccess(analyzer, suitableType, typeCandidates, singleNotSuitableSubstitutedCandidate, suitableConstructors, candidates, options7) {
|
|
6416
|
+
if (options7.preferredTargetOfExplicitConstructorCall === "type-declaration") {
|
|
6481
6417
|
const targets2 = suitableType !== void 0 ? [new EntityReferenceTarget(suitableType, 0 /* Get */)] : typeCandidates.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6482
6418
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets2), targets2.length > 1);
|
|
6483
6419
|
}
|
|
@@ -6495,7 +6431,7 @@ var NodeSemanticInfoService = class {
|
|
|
6495
6431
|
const targets = suitableType !== void 0 ? [new EntityReferenceTarget(suitableType, 0 /* Get */)] : typeCandidates.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6496
6432
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
6497
6433
|
}
|
|
6498
|
-
static ofTranslationTypeParameterListParameter(analyzer, node, typeParameterList,
|
|
6434
|
+
static ofTranslationTypeParameterListParameter(analyzer, node, typeParameterList, options7) {
|
|
6499
6435
|
const parameterIndex = typeParameterList.typeParameters.indexOf(node);
|
|
6500
6436
|
if (parameterIndex < 0) {
|
|
6501
6437
|
return void 0;
|
|
@@ -6533,14 +6469,14 @@ var NodeSemanticInfoService = class {
|
|
|
6533
6469
|
if (isNonEmptyArray(typeParameters)) {
|
|
6534
6470
|
const targets = typeParameters.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6535
6471
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6536
|
-
if (
|
|
6472
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6537
6473
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6538
6474
|
}
|
|
6539
6475
|
}
|
|
6540
6476
|
}
|
|
6541
6477
|
return result;
|
|
6542
6478
|
}
|
|
6543
|
-
static ofTranslationParameterListParameter(analyzer, node, parameterList,
|
|
6479
|
+
static ofTranslationParameterListParameter(analyzer, node, parameterList, options7) {
|
|
6544
6480
|
const parameterIndex = parameterList.parameters.indexOf(node);
|
|
6545
6481
|
if (parameterIndex < 0) {
|
|
6546
6482
|
return void 0;
|
|
@@ -6579,7 +6515,7 @@ var NodeSemanticInfoService = class {
|
|
|
6579
6515
|
if (isNonEmptyArray(typeParameters)) {
|
|
6580
6516
|
const targets = typeParameters.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6581
6517
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), !translationTargets.areSuitable);
|
|
6582
|
-
if (
|
|
6518
|
+
if (options7.includeBetterReferenceTargets) {
|
|
6583
6519
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6584
6520
|
}
|
|
6585
6521
|
}
|
|
@@ -6928,11 +6864,11 @@ var DefinitionService = class {
|
|
|
6928
6864
|
if (tokenOrKeyword === void 0) {
|
|
6929
6865
|
return void 0;
|
|
6930
6866
|
}
|
|
6931
|
-
const
|
|
6867
|
+
const options7 = {
|
|
6932
6868
|
includeBetterReferenceTargets: true,
|
|
6933
6869
|
preferredTargetOfExplicitConstructorCall: "constructor-declaration"
|
|
6934
6870
|
};
|
|
6935
|
-
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword,
|
|
6871
|
+
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword, options7);
|
|
6936
6872
|
if (semanticInfo === void 0) {
|
|
6937
6873
|
return void 0;
|
|
6938
6874
|
}
|
|
@@ -7144,31 +7080,63 @@ var DefinitionsAndReferenceInfo = class {
|
|
|
7144
7080
|
}
|
|
7145
7081
|
};
|
|
7146
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
|
+
|
|
7147
7115
|
// source/services/ReferencesService.ts
|
|
7148
7116
|
var ReferencesService = class {
|
|
7149
|
-
getReferencesInCompilation(analyzer, sourceFile, offset,
|
|
7117
|
+
getReferencesInCompilation(analyzer, sourceFile, offset, options7, taskController) {
|
|
7150
7118
|
return __async(this, null, function* () {
|
|
7151
7119
|
return this.getReferencesInFiles(
|
|
7152
7120
|
analyzer,
|
|
7153
7121
|
sourceFile,
|
|
7154
7122
|
offset,
|
|
7155
7123
|
analyzer.compilation.enumerateSourceFiles(),
|
|
7156
|
-
|
|
7124
|
+
options7,
|
|
7157
7125
|
taskController
|
|
7158
7126
|
);
|
|
7159
7127
|
});
|
|
7160
7128
|
}
|
|
7161
|
-
getReferencesInFiles(analyzer, sourceFile, offset, sourceFiles,
|
|
7129
|
+
getReferencesInFiles(analyzer, sourceFile, offset, sourceFiles, options7, taskController) {
|
|
7162
7130
|
return __async(this, null, function* () {
|
|
7163
|
-
const definitions = this.getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset,
|
|
7131
|
+
const definitions = this.getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset, options7);
|
|
7164
7132
|
if (definitions.length === 0) {
|
|
7165
7133
|
return [];
|
|
7166
7134
|
}
|
|
7167
|
-
const allowAmbiguous =
|
|
7168
|
-
const isForRename =
|
|
7135
|
+
const allowAmbiguous = options7.allowAmbiguous;
|
|
7136
|
+
const isForRename = options7.isForRename ?? false;
|
|
7169
7137
|
const result = [];
|
|
7170
7138
|
const firstDefinition = definitions[0];
|
|
7171
|
-
const restrictions = this.getReferenceRestrictions(firstDefinition,
|
|
7139
|
+
const restrictions = this.getReferenceRestrictions(firstDefinition, options7);
|
|
7172
7140
|
let semanticInfoOptions;
|
|
7173
7141
|
if (firstDefinition.value.kind === 7 /* Constructor */) {
|
|
7174
7142
|
semanticInfoOptions = {
|
|
@@ -7199,7 +7167,7 @@ var ReferencesService = class {
|
|
|
7199
7167
|
result.push(new Reference(sourceFile2, node.rangeWithoutTrivia, referenceKind));
|
|
7200
7168
|
}
|
|
7201
7169
|
}
|
|
7202
|
-
if (!
|
|
7170
|
+
if (!options7.onlyNamed) {
|
|
7203
7171
|
if (node.kind === 69 /* AutotypeCallExpression */ && restrictions.canBeAutotypeCall) {
|
|
7204
7172
|
const semanticInfo = NodeSemanticInfoService.ofAutotypeCallExpression(analyzer, node, semanticInfoOptions);
|
|
7205
7173
|
const referenceKind = this.ifReferenceToSomeOfDefinitionsThenKind(
|
|
@@ -7440,7 +7408,7 @@ var ReferencesService = class {
|
|
|
7440
7408
|
return result;
|
|
7441
7409
|
});
|
|
7442
7410
|
}
|
|
7443
|
-
getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset,
|
|
7411
|
+
getReferencedDefinitionInfosAtOffset(analyzer, sourceFile, offset, options7) {
|
|
7444
7412
|
const tokenOrKeyword = getTokenOrKeywordsTouchingOffset(sourceFile.getSyntaxNode(), offset).getSingleWithHighestPriority((t) => {
|
|
7445
7413
|
if (t.isToken(10 /* Identifier */) || t.isKeyword()) {
|
|
7446
7414
|
return 2;
|
|
@@ -7454,7 +7422,7 @@ var ReferencesService = class {
|
|
|
7454
7422
|
return [];
|
|
7455
7423
|
}
|
|
7456
7424
|
let semanticInfoOptions;
|
|
7457
|
-
if (
|
|
7425
|
+
if (options7.onlyNamed) {
|
|
7458
7426
|
semanticInfoOptions = {
|
|
7459
7427
|
includeBetterReferenceTargets: true,
|
|
7460
7428
|
preferredTargetOfExplicitConstructorCall: "type-declaration"
|
|
@@ -7730,7 +7698,7 @@ var DocumentHighlightsService = class _DocumentHighlightsService {
|
|
|
7730
7698
|
}
|
|
7731
7699
|
getDocumentHighlights(analyzer, sourceFile, offset, taskController) {
|
|
7732
7700
|
return __async(this, null, function* () {
|
|
7733
|
-
const
|
|
7701
|
+
const options7 = {
|
|
7734
7702
|
onlyWithSameAlias: false,
|
|
7735
7703
|
onlyNamed: false,
|
|
7736
7704
|
allowAmbiguous: true
|
|
@@ -7740,7 +7708,7 @@ var DocumentHighlightsService = class _DocumentHighlightsService {
|
|
|
7740
7708
|
sourceFile,
|
|
7741
7709
|
offset,
|
|
7742
7710
|
[sourceFile],
|
|
7743
|
-
|
|
7711
|
+
options7,
|
|
7744
7712
|
taskController
|
|
7745
7713
|
);
|
|
7746
7714
|
const result = references.map((r) => ({
|
|
@@ -7958,11 +7926,11 @@ var HoverService = class {
|
|
|
7958
7926
|
if (tokenOrKeyword === void 0) {
|
|
7959
7927
|
return void 0;
|
|
7960
7928
|
}
|
|
7961
|
-
const
|
|
7929
|
+
const options7 = {
|
|
7962
7930
|
includeBetterReferenceTargets: false,
|
|
7963
7931
|
preferredTargetOfExplicitConstructorCall: "constructor-declaration"
|
|
7964
7932
|
};
|
|
7965
|
-
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword,
|
|
7933
|
+
const semanticInfo = NodeSemanticInfoService.ofTokenOrKeyword(analyzer, tokenOrKeyword, options7);
|
|
7966
7934
|
if (semanticInfo === void 0) {
|
|
7967
7935
|
return void 0;
|
|
7968
7936
|
}
|
|
@@ -8395,7 +8363,7 @@ var RenameService = class {
|
|
|
8395
8363
|
return __async(this, null, function* () {
|
|
8396
8364
|
let result;
|
|
8397
8365
|
if (this.canRename(analyzer, sourceFile, offset) !== void 0) {
|
|
8398
|
-
const
|
|
8366
|
+
const options7 = {
|
|
8399
8367
|
onlyWithSameAlias: true,
|
|
8400
8368
|
onlyNamed: true,
|
|
8401
8369
|
allowAmbiguous: false,
|
|
@@ -8407,7 +8375,7 @@ var RenameService = class {
|
|
|
8407
8375
|
sourceFile,
|
|
8408
8376
|
offset,
|
|
8409
8377
|
sourceFiles,
|
|
8410
|
-
|
|
8378
|
+
options7,
|
|
8411
8379
|
taskController
|
|
8412
8380
|
);
|
|
8413
8381
|
result = references.map((r) => new Rename(r.sourceFile, r.range, newText));
|
|
@@ -8422,11 +8390,11 @@ var RenameService = class {
|
|
|
8422
8390
|
if (!(tokenOrKeyword !== void 0 && isIdentifier(tokenOrKeyword.value))) {
|
|
8423
8391
|
return void 0;
|
|
8424
8392
|
}
|
|
8425
|
-
const
|
|
8393
|
+
const options7 = {
|
|
8426
8394
|
includeBetterReferenceTargets: false,
|
|
8427
8395
|
preferredTargetOfExplicitConstructorCall: "type-declaration"
|
|
8428
8396
|
};
|
|
8429
|
-
const semanticInfo = NodeSemanticInfoService.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value,
|
|
8397
|
+
const semanticInfo = NodeSemanticInfoService.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options7);
|
|
8430
8398
|
if (semanticInfo !== void 0) {
|
|
8431
8399
|
if (semanticInfo.kind === "reference") {
|
|
8432
8400
|
if (semanticInfo.isAmbiguous) {
|
|
@@ -9380,7 +9348,16 @@ var SignatureInfo = class {
|
|
|
9380
9348
|
};
|
|
9381
9349
|
|
|
9382
9350
|
// source/services/source-generation/SourceGenerationService.ts
|
|
9383
|
-
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";
|
|
9384
9361
|
|
|
9385
9362
|
// source/services/workspace/ClientTrackedSourceFiles.ts
|
|
9386
9363
|
import { ObservableMap, ObservableObject, observable, atomic, disposeObservableObject } from "reactronic";
|
|
@@ -12271,9 +12248,11 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12271
12248
|
this.tsLibrariesProvider = tsLibrariesProvider;
|
|
12272
12249
|
this.standardPackageContentsProviders = standardPackageContentsProviders;
|
|
12273
12250
|
this.generatedPackageStates = new ObservableMap6();
|
|
12251
|
+
this.packagesToDeleteAfterFileIsClosed = new Array();
|
|
12252
|
+
this.nextId = 0;
|
|
12274
12253
|
}
|
|
12275
12254
|
get compilationControllers() {
|
|
12276
|
-
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));
|
|
12277
12256
|
}
|
|
12278
12257
|
getDefinitionInGeneratedCode(analyzer, entity, taskController) {
|
|
12279
12258
|
return __async(this, null, function* () {
|
|
@@ -12289,7 +12268,6 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12289
12268
|
return void 0;
|
|
12290
12269
|
}
|
|
12291
12270
|
const compilationController = generatedPackageState.compilationController;
|
|
12292
|
-
runAtomically2(() => compilationController.isConfigurationsProcessingEnabled = true);
|
|
12293
12271
|
yield compilationController.waitFullyLoaded();
|
|
12294
12272
|
const compilationState = compilationController.mainCompilationState;
|
|
12295
12273
|
if (compilationState?.analyzer.compilation.mainPackage === void 0) {
|
|
@@ -12333,30 +12311,50 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12333
12311
|
}
|
|
12334
12312
|
onOpenedSourceFilesChanged() {
|
|
12335
12313
|
this.trackedSourceFiles.items.entries();
|
|
12336
|
-
for (const
|
|
12314
|
+
for (const state of this.generatedPackageStates.values()) {
|
|
12337
12315
|
if (this.trackedSourceFiles.items.has(state.generatedFileUri.toString())) {
|
|
12338
12316
|
state.fileWasOpenedByClient = true;
|
|
12339
|
-
|
|
12340
|
-
clearTimeout(state.deleteAfterTimeoutId);
|
|
12341
|
-
state.deleteAfterTimeoutId = void 0;
|
|
12342
|
-
}
|
|
12317
|
+
state.cancelScheduledDispose();
|
|
12343
12318
|
} else if (state.fileWasOpenedByClient) {
|
|
12344
12319
|
state.fileWasOpenedByClient = false;
|
|
12345
|
-
|
|
12320
|
+
state.scheduleDisposeAfterTimeout(deleteGeneratedPackageTimeoutMs, (state2) => {
|
|
12321
|
+
if (this.generatedPackageStates.get(state2.key) === state2) {
|
|
12322
|
+
this.generatedPackageStates.delete(state2.key);
|
|
12323
|
+
}
|
|
12324
|
+
});
|
|
12346
12325
|
}
|
|
12347
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
|
+
});
|
|
12348
12335
|
}
|
|
12349
12336
|
getOrGeneratePackageSource(analyzer, packageEntity, taskController) {
|
|
12350
12337
|
return __async(this, null, function* () {
|
|
12351
12338
|
const packageLocale = packageEntity.getLocale();
|
|
12352
12339
|
const key = `${packageEntity.getName().toString()}-${localeToString(packageLocale)}`;
|
|
12353
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
|
+
}
|
|
12354
12352
|
if (result === void 0) {
|
|
12355
12353
|
const node = new EntityToSyntax(analyzer, packageEntity).convert();
|
|
12356
12354
|
const code = new SyntaxToCode(node, { keywordsLocale: packageLocale }).convert();
|
|
12357
|
-
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, "", [key]);
|
|
12355
|
+
const generatedPackageUri = new Uri(GeneratedSourceFileScheme, "", [`${key}-${this.nextId++}`]);
|
|
12358
12356
|
const generatedFileUri = generatedPackageUri.append(`${packageEntity.getName().toString()}.art`);
|
|
12359
|
-
const fileSystemTree =
|
|
12357
|
+
const fileSystemTree = new FileSystemTree();
|
|
12360
12358
|
const packageDirectory = fileSystemTree.addDirectory(generatedPackageUri);
|
|
12361
12359
|
fileSystemTree.addFile(generatedFileUri, code);
|
|
12362
12360
|
const packageConfiguration = this.createGeneratedPackageConfiguration(
|
|
@@ -12364,7 +12362,12 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12364
12362
|
packageLocale,
|
|
12365
12363
|
DefaultDialect
|
|
12366
12364
|
);
|
|
12367
|
-
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
|
+
}
|
|
12368
12371
|
if (standardPackageContents === void 0) {
|
|
12369
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.");
|
|
12370
12373
|
return void 0;
|
|
@@ -12378,10 +12381,15 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12378
12381
|
getTreatRootAsPackageIfConfigIsMissing: () => true,
|
|
12379
12382
|
additionalPackageContents: standardPackageContents
|
|
12380
12383
|
};
|
|
12381
|
-
const controller =
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
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);
|
|
12385
12393
|
}
|
|
12386
12394
|
return result;
|
|
12387
12395
|
});
|
|
@@ -12467,30 +12475,58 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12467
12475
|
Debug.never(entity);
|
|
12468
12476
|
}
|
|
12469
12477
|
}
|
|
12470
|
-
setDeleteGeneratedPackageTimeout(key, state, timeoutMs) {
|
|
12471
|
-
const timeoutId = setTimeout(() => {
|
|
12472
|
-
Transaction4.isolate(() => {
|
|
12473
|
-
const state2 = this.generatedPackageStates.get(key);
|
|
12474
|
-
if (state2 !== void 0) {
|
|
12475
|
-
this.generatedPackageStates.delete(key);
|
|
12476
|
-
state2.compilationController.dispose();
|
|
12477
|
-
}
|
|
12478
|
-
});
|
|
12479
|
-
}, timeoutMs);
|
|
12480
|
-
state.deleteAfterTimeoutId = timeoutId;
|
|
12481
|
-
}
|
|
12482
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);
|
|
12483
12488
|
__decorateClass([
|
|
12484
12489
|
reactive6
|
|
12485
12490
|
], SourceGenerationService.prototype, "onOpenedSourceFilesChanged", 1);
|
|
12491
|
+
__decorateClass([
|
|
12492
|
+
atomic6,
|
|
12493
|
+
options6({ reentrance: Reentrance3.cancelAndWaitPrevious })
|
|
12494
|
+
], SourceGenerationService.prototype, "getOrGeneratePackageSource", 1);
|
|
12486
12495
|
var deleteGeneratedPackageTimeoutMs = 1e4;
|
|
12487
12496
|
var GeneratedPackageState = class {
|
|
12488
|
-
constructor(compilationController, generatedFileUri) {
|
|
12497
|
+
constructor(key, compilationController, generatedFileUri, originalPackageEntity) {
|
|
12498
|
+
this.key = key;
|
|
12489
12499
|
this.compilationController = compilationController;
|
|
12490
12500
|
this.generatedFileUri = generatedFileUri;
|
|
12501
|
+
this.originalPackageEntity = originalPackageEntity;
|
|
12491
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();
|
|
12492
12525
|
}
|
|
12493
12526
|
};
|
|
12527
|
+
__decorateClass([
|
|
12528
|
+
atomic6
|
|
12529
|
+
], GeneratedPackageState.prototype, "dispose", 1);
|
|
12494
12530
|
var EntityFinder = class {
|
|
12495
12531
|
constructor(entity, packageEntity) {
|
|
12496
12532
|
this.entity = entity;
|
|
@@ -12809,6 +12845,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
12809
12845
|
this.fileSystemTreeDisplayService = new FileSystemTreeDisplayService();
|
|
12810
12846
|
this.selectionRangeService = new SelectionRangeService();
|
|
12811
12847
|
this.assignFieldService = new AssignFieldService();
|
|
12848
|
+
this.deleteBlockFromScriptService = new DeleteBlockFromScriptService();
|
|
12812
12849
|
this.codeActionsService = new CodeActionsService();
|
|
12813
12850
|
this.connection = config.connection;
|
|
12814
12851
|
this.config = config;
|
|
@@ -12857,8 +12894,6 @@ var _LanguageServer = class _LanguageServer {
|
|
|
12857
12894
|
this.disposables.push(disposable);
|
|
12858
12895
|
disposable = this.connection.onHover((params, token) => this.withTaskController(token, (taskController) => this.onHover(params, taskController)));
|
|
12859
12896
|
this.disposables.push(disposable);
|
|
12860
|
-
disposable = this.connection.onExecuteCommand((params, token) => this.withTaskController(token, (taskController) => this.onExecuteCommand(params, taskController)));
|
|
12861
|
-
this.disposables.push(disposable);
|
|
12862
12897
|
disposable = this.connection.onCompletion((params, token) => this.withTaskController(token, (taskController) => this.onCompletion(params, taskController)));
|
|
12863
12898
|
this.disposables.push(disposable);
|
|
12864
12899
|
disposable = this.connection.onCompletionResolve((params) => this.onCompletionResolve(params));
|
|
@@ -12875,6 +12910,40 @@ var _LanguageServer = class _LanguageServer {
|
|
|
12875
12910
|
this.disposables.push(disposable);
|
|
12876
12911
|
disposable = this.connection.onCodeActionResolve((params, token) => this.withTaskController(token, (taskController) => this.onCodeActionResolve(params, taskController)));
|
|
12877
12912
|
this.disposables.push(disposable);
|
|
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
|
+
);
|
|
12940
|
+
this.disposables.push(disposable);
|
|
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)));
|
|
12946
|
+
this.disposables.push(disposable);
|
|
12878
12947
|
this.connection.listen();
|
|
12879
12948
|
}
|
|
12880
12949
|
dispose() {
|
|
@@ -12890,13 +12959,13 @@ var _LanguageServer = class _LanguageServer {
|
|
|
12890
12959
|
setUserLocale(params.initializationOptions?.localeOverride ?? params.locale ?? "en");
|
|
12891
12960
|
let workspaceFolderUris;
|
|
12892
12961
|
if (params.initializationOptions?.workspaceFoldersOverride !== void 0) {
|
|
12893
|
-
workspaceFolderUris = params.initializationOptions.workspaceFoldersOverride.map((f) => this.convertVscodeUriToUri(
|
|
12962
|
+
workspaceFolderUris = params.initializationOptions.workspaceFoldersOverride.map((f) => this.convertVscodeUriToUri(URI.parse(f.uri)));
|
|
12894
12963
|
} else if (params.workspaceFolders) {
|
|
12895
|
-
workspaceFolderUris = params.workspaceFolders.map((f) => this.convertVscodeUriToUri(
|
|
12964
|
+
workspaceFolderUris = params.workspaceFolders.map((f) => this.convertVscodeUriToUri(URI.parse(f.uri)));
|
|
12896
12965
|
} else if (params.rootUri) {
|
|
12897
|
-
workspaceFolderUris = [this.convertVscodeUriToUri(
|
|
12966
|
+
workspaceFolderUris = [this.convertVscodeUriToUri(URI.parse(params.rootUri))];
|
|
12898
12967
|
} else if (params.rootPath) {
|
|
12899
|
-
workspaceFolderUris = [this.convertVscodeUriToUri(
|
|
12968
|
+
workspaceFolderUris = [this.convertVscodeUriToUri(URI.parse(params.rootPath))];
|
|
12900
12969
|
} else {
|
|
12901
12970
|
workspaceFolderUris = [];
|
|
12902
12971
|
}
|
|
@@ -12912,7 +12981,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
12912
12981
|
if (builtInStandardPackagesUri !== void 0) {
|
|
12913
12982
|
additionalUrisOfDirectoriesToLoad.push(builtInStandardPackagesUri);
|
|
12914
12983
|
}
|
|
12915
|
-
fileSystemTreeProvider =
|
|
12984
|
+
fileSystemTreeProvider = runAtomically2(() => new FileSystemTreeProviderBasedOnWatchedFileSystem(
|
|
12916
12985
|
fileSystem,
|
|
12917
12986
|
publisher,
|
|
12918
12987
|
void 0,
|
|
@@ -12921,7 +12990,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
12921
12990
|
break;
|
|
12922
12991
|
}
|
|
12923
12992
|
case "client-to-server-requests": {
|
|
12924
|
-
this.manuallyUpdatedFileSystemTreeProvider =
|
|
12993
|
+
this.manuallyUpdatedFileSystemTreeProvider = runAtomically2(() => new ManuallyUpdatedFileSystemTreeProvider());
|
|
12925
12994
|
fileSystemTreeProvider = this.manuallyUpdatedFileSystemTreeProvider;
|
|
12926
12995
|
break;
|
|
12927
12996
|
}
|
|
@@ -12933,17 +13002,17 @@ var _LanguageServer = class _LanguageServer {
|
|
|
12933
13002
|
tsLibrariesProvider: this.config.tsLibrariesProvider,
|
|
12934
13003
|
diagnosticsCollectedInBackgroundHandler: this.reportDiagnostics.bind(this),
|
|
12935
13004
|
rawPackageConfigurationsChangedHandler: this.onRawPackageConfigurationsChanged.bind(this),
|
|
12936
|
-
initiallyOpenedFileUris: params.initializationOptions?.initiallyOpenedFileUris?.map((u) => this.convertVscodeUriToUri(
|
|
12937
|
-
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,
|
|
12938
13007
|
showErrorMessage: (message) => __async(this, null, function* () {
|
|
12939
13008
|
this.connection.window.showErrorMessage(message);
|
|
12940
13009
|
}),
|
|
12941
13010
|
builtInStandardPackagesUri,
|
|
12942
13011
|
additionalPackageContents: this.config.additionalPackageContents
|
|
12943
13012
|
};
|
|
12944
|
-
this.workspace = yield
|
|
13013
|
+
this.workspace = yield runAtomically2(() => Workspace.create(config));
|
|
12945
13014
|
this.workspace.addWorkspaceFolders(workspaceFolderUris);
|
|
12946
|
-
this.sourceGenerationService =
|
|
13015
|
+
this.sourceGenerationService = runAtomically2(() => new SourceGenerationService(
|
|
12947
13016
|
this.workspace.trackedSourceFiles,
|
|
12948
13017
|
this.config.tsLibrariesProvider,
|
|
12949
13018
|
(taskController) => __async(this, null, function* () {
|
|
@@ -13054,11 +13123,11 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13054
13123
|
});
|
|
13055
13124
|
}
|
|
13056
13125
|
onDidOpenTextDocument(params) {
|
|
13057
|
-
const uri = this.convertVscodeUriToUri(
|
|
13126
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13058
13127
|
this.workspace.notifyOpenedTextDocument(uri, params.textDocument.text, params.textDocument.version);
|
|
13059
13128
|
}
|
|
13060
13129
|
onDidChangeTextDocument(params) {
|
|
13061
|
-
const uri = this.convertVscodeUriToUri(
|
|
13130
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13062
13131
|
const applyEdits = (text) => {
|
|
13063
13132
|
const textDocument = TextDocument.create(params.textDocument.uri, "artel", 0, text);
|
|
13064
13133
|
TextDocument.update(textDocument, params.contentChanges, 1);
|
|
@@ -13067,21 +13136,21 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13067
13136
|
this.workspace.notifyUpdatedTextDocument(uri, applyEdits, params.textDocument.version);
|
|
13068
13137
|
}
|
|
13069
13138
|
onDidSaveTextDocument(params) {
|
|
13070
|
-
const uri = this.convertVscodeUriToUri(
|
|
13139
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13071
13140
|
this.workspace.notifySavedTextDocument(uri);
|
|
13072
13141
|
}
|
|
13073
13142
|
onDidCloseTextDocument(params) {
|
|
13074
|
-
const uri = this.convertVscodeUriToUri(
|
|
13143
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.textDocument.uri));
|
|
13075
13144
|
this.workspace.notifyClosedTextDocument(uri);
|
|
13076
13145
|
}
|
|
13077
13146
|
onDidChangeWorkspaceFolders(event) {
|
|
13078
|
-
this.workspace.addWorkspaceFolders(event.added.map((f) => this.convertVscodeUriToUri(
|
|
13079
|
-
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))));
|
|
13080
13149
|
}
|
|
13081
13150
|
onDidChangeWatchedFiles(event) {
|
|
13082
13151
|
if (this.fileSystemUpdateNotificationsPublisher !== void 0) {
|
|
13083
13152
|
const notifications = event.changes.map((c) => {
|
|
13084
|
-
const uri = this.convertVscodeUriToUri(
|
|
13153
|
+
const uri = this.convertVscodeUriToUri(URI.parse(c.uri));
|
|
13085
13154
|
switch (c.type) {
|
|
13086
13155
|
case ls3.FileChangeType.Created:
|
|
13087
13156
|
return new FileSystemUpdateNotification(uri, "created");
|
|
@@ -13098,7 +13167,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13098
13167
|
}
|
|
13099
13168
|
onDocumentDiagnostic(params, taskController) {
|
|
13100
13169
|
return __async(this, null, function* () {
|
|
13101
|
-
const vscodeUri =
|
|
13170
|
+
const vscodeUri = URI.parse(params.textDocument.uri);
|
|
13102
13171
|
if (vscodeUri.scheme === GeneratedSourceFileScheme) {
|
|
13103
13172
|
return void 0;
|
|
13104
13173
|
}
|
|
@@ -13129,13 +13198,13 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13129
13198
|
onWorkspaceDiagnostic(params, taskController) {
|
|
13130
13199
|
return __async(this, null, function* () {
|
|
13131
13200
|
this.workspaceDiagnosticsPartialResultToken = params.partialResultToken;
|
|
13132
|
-
|
|
13201
|
+
runAtomically2(() => this.workspace.isReadyToAcceptWorkspaceDiagnostics = true);
|
|
13133
13202
|
while (!taskController.isCancellationRequested()) {
|
|
13134
13203
|
yield taskController.yieldTask(1e3);
|
|
13135
13204
|
}
|
|
13136
13205
|
if (this.workspaceDiagnosticsPartialResultToken === params.partialResultToken) {
|
|
13137
13206
|
this.workspaceDiagnosticsPartialResultToken = void 0;
|
|
13138
|
-
|
|
13207
|
+
runAtomically2(() => this.workspace.isReadyToAcceptWorkspaceDiagnostics = false);
|
|
13139
13208
|
}
|
|
13140
13209
|
throw new CancelledError();
|
|
13141
13210
|
});
|
|
@@ -13170,7 +13239,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13170
13239
|
const children = Query.from(item.items).map((item2) => convertSourceFileItem(item2)).toArray();
|
|
13171
13240
|
return ls3.DocumentSymbol.create(item.name, void 0, kind, range, selectionRange, children);
|
|
13172
13241
|
};
|
|
13173
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13242
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13174
13243
|
let result = new Array();
|
|
13175
13244
|
if (sourceFileContext !== void 0) {
|
|
13176
13245
|
const { sourceFile } = sourceFileContext;
|
|
@@ -13199,7 +13268,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13199
13268
|
}
|
|
13200
13269
|
onDefinition(params, taskController) {
|
|
13201
13270
|
return __async(this, null, function* () {
|
|
13202
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13271
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13203
13272
|
if (sourceFileContext === void 0) {
|
|
13204
13273
|
return;
|
|
13205
13274
|
}
|
|
@@ -13232,12 +13301,12 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13232
13301
|
onReferences(params, taskController) {
|
|
13233
13302
|
return __async(this, null, function* () {
|
|
13234
13303
|
let result = new Array();
|
|
13235
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13304
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13236
13305
|
if (sourceFileContext !== void 0) {
|
|
13237
13306
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13238
13307
|
const position = new Position(params.position.line, params.position.character);
|
|
13239
13308
|
const offset = sourceFile.getOffsetAtPosition(position);
|
|
13240
|
-
const
|
|
13309
|
+
const options7 = {
|
|
13241
13310
|
onlyNamed: false,
|
|
13242
13311
|
onlyWithSameAlias: false,
|
|
13243
13312
|
allowAmbiguous: true
|
|
@@ -13246,7 +13315,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13246
13315
|
analyzer,
|
|
13247
13316
|
sourceFile,
|
|
13248
13317
|
offset,
|
|
13249
|
-
|
|
13318
|
+
options7,
|
|
13250
13319
|
taskController
|
|
13251
13320
|
);
|
|
13252
13321
|
result = Query.from(references).map((reference) => ({
|
|
@@ -13260,7 +13329,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13260
13329
|
onDocumentHighlight(params, taskController) {
|
|
13261
13330
|
return __async(this, null, function* () {
|
|
13262
13331
|
let result = new Array();
|
|
13263
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13332
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13264
13333
|
if (sourceFileContext !== void 0) {
|
|
13265
13334
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13266
13335
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13293,7 +13362,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13293
13362
|
onPrepareRename(params, taskController) {
|
|
13294
13363
|
return __async(this, null, function* () {
|
|
13295
13364
|
let result;
|
|
13296
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13365
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13297
13366
|
if (sourceFileContext !== void 0) {
|
|
13298
13367
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13299
13368
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13309,7 +13378,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13309
13378
|
onRename(params, taskController) {
|
|
13310
13379
|
return __async(this, null, function* () {
|
|
13311
13380
|
let result;
|
|
13312
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13381
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13313
13382
|
if (sourceFileContext !== void 0) {
|
|
13314
13383
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13315
13384
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13332,7 +13401,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13332
13401
|
onHover(params, taskController) {
|
|
13333
13402
|
return __async(this, null, function* () {
|
|
13334
13403
|
let result = void 0;
|
|
13335
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13404
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13336
13405
|
if (sourceFileContext !== void 0) {
|
|
13337
13406
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13338
13407
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13422,39 +13491,9 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13422
13491
|
const code = diagnostic.data.code;
|
|
13423
13492
|
return { message, range, severity, tags, code };
|
|
13424
13493
|
}
|
|
13425
|
-
onExecuteCommand(params, taskController) {
|
|
13426
|
-
switch (params.command) {
|
|
13427
|
-
case customCommandName.provideEvaluatableExpression:
|
|
13428
|
-
Debug.assert(params.arguments?.length === 1 && isProvideEvaluatableExpressionParams(params.arguments[0]));
|
|
13429
|
-
return this.onProvideEvaluatableExpression(params.arguments[0], taskController);
|
|
13430
|
-
case customCommandName.provideServerOwnedDocumentContent:
|
|
13431
|
-
Debug.assert(params.arguments?.length === 1 && isProvideServerOwnedDocumentContentParams(params.arguments[0]));
|
|
13432
|
-
return this.onProvideInMemoryDocumentContent(params.arguments[0], taskController);
|
|
13433
|
-
case customCommandName.emitCodeToString:
|
|
13434
|
-
Debug.assert(params.arguments?.length === 1 && isEmitCodeToStringParams(params.arguments[0]));
|
|
13435
|
-
return this.onEmitCodeToString(params.arguments[0], taskController);
|
|
13436
|
-
case customCommandName.displayFileSystemTree:
|
|
13437
|
-
Debug.assert(params.arguments?.length === 1 && isDisplayFileSystemTreeParams(params.arguments[0]));
|
|
13438
|
-
return this.onDisplayFileSystemTree(params.arguments[0]);
|
|
13439
|
-
case customCommandName.createOrUpdateSourceFile:
|
|
13440
|
-
Debug.assert(params.arguments?.length === 1 && isCreateOrUpdateSourceFileParams(params.arguments[0]));
|
|
13441
|
-
return this.onCreateOrUpdateSourceFile(params.arguments[0]);
|
|
13442
|
-
case customCommandName.deleteSourceFile:
|
|
13443
|
-
Debug.assert(params.arguments?.length === 1 && isDeleteSourceFileParams(params.arguments[0]));
|
|
13444
|
-
return this.onDeleteSourceFile(params.arguments[0]);
|
|
13445
|
-
case customCommandName.getNodeRange:
|
|
13446
|
-
Debug.assert(params.arguments?.length === 1 && isGetNodeRangeParams(params.arguments[0]));
|
|
13447
|
-
return this.onGetNodeRange(params.arguments[0], taskController);
|
|
13448
|
-
case customCommandName.assignField:
|
|
13449
|
-
Debug.assert(params.arguments?.length === 1 && isAssignFieldParams(params.arguments[0]));
|
|
13450
|
-
return this.onAssignField(params.arguments[0], taskController);
|
|
13451
|
-
default:
|
|
13452
|
-
return void 0;
|
|
13453
|
-
}
|
|
13454
|
-
}
|
|
13455
13494
|
onAssignField(params, taskController) {
|
|
13456
13495
|
return __async(this, null, function* () {
|
|
13457
|
-
const functionNodeUri =
|
|
13496
|
+
const functionNodeUri = URI.parse(params.functionNodeUri);
|
|
13458
13497
|
const sourceFileContext = yield this.getSourceFileContext(functionNodeUri, taskController);
|
|
13459
13498
|
if (sourceFileContext !== void 0) {
|
|
13460
13499
|
const functionDeclaration = NodePath.parse(functionNodeUri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
@@ -13475,6 +13514,26 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13475
13514
|
}
|
|
13476
13515
|
});
|
|
13477
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
|
+
}
|
|
13478
13537
|
convertSourceFileEdit(edit) {
|
|
13479
13538
|
const range = this.convertSourceFileRange(edit.sourceFile, edit.range);
|
|
13480
13539
|
const textDocument = ls3.OptionalVersionedTextDocumentIdentifier.create(
|
|
@@ -13489,7 +13548,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13489
13548
|
}
|
|
13490
13549
|
onGetNodeRange(params, taskController) {
|
|
13491
13550
|
return __async(this, null, function* () {
|
|
13492
|
-
const uri =
|
|
13551
|
+
const uri = URI.parse(params.uri);
|
|
13493
13552
|
const sourceFileContext = yield this.getSourceFileContext(uri, taskController);
|
|
13494
13553
|
let result;
|
|
13495
13554
|
if (sourceFileContext !== void 0) {
|
|
@@ -13507,13 +13566,13 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13507
13566
|
}
|
|
13508
13567
|
onCreateOrUpdateSourceFile(params) {
|
|
13509
13568
|
return __async(this, null, function* () {
|
|
13510
|
-
const uri = this.convertVscodeUriToUri(
|
|
13569
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.uri));
|
|
13511
13570
|
this.manuallyUpdatedFileSystemTreeProvider?.createOrUpdateSourceFile(uri, params.text);
|
|
13512
13571
|
});
|
|
13513
13572
|
}
|
|
13514
13573
|
onDeleteSourceFile(params) {
|
|
13515
13574
|
return __async(this, null, function* () {
|
|
13516
|
-
const uri = this.convertVscodeUriToUri(
|
|
13575
|
+
const uri = this.convertVscodeUriToUri(URI.parse(params.uri));
|
|
13517
13576
|
this.manuallyUpdatedFileSystemTreeProvider?.deleteSourceFile(uri);
|
|
13518
13577
|
});
|
|
13519
13578
|
}
|
|
@@ -13534,7 +13593,7 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13534
13593
|
return __async(this, null, function* () {
|
|
13535
13594
|
let compilationControllerUri;
|
|
13536
13595
|
if (params.workspaceFolderUri !== void 0) {
|
|
13537
|
-
compilationControllerUri = this.convertVscodeUriToUri(
|
|
13596
|
+
compilationControllerUri = this.convertVscodeUriToUri(URI.parse(params.workspaceFolderUri));
|
|
13538
13597
|
} else {
|
|
13539
13598
|
if (this.workspace.workspaceFolderUris.length !== 1) {
|
|
13540
13599
|
throw new ls3.ResponseError(
|
|
@@ -13580,13 +13639,13 @@ var _LanguageServer = class _LanguageServer {
|
|
|
13580
13639
|
if (hasErrors) {
|
|
13581
13640
|
return { hasErrors, filesWithErrors };
|
|
13582
13641
|
}
|
|
13583
|
-
const
|
|
13642
|
+
const options7 = {
|
|
13584
13643
|
importEmitKind: 2 /* Custom */,
|
|
13585
13644
|
isCustomImportSynchronous: true
|
|
13586
13645
|
};
|
|
13587
13646
|
let result;
|
|
13588
13647
|
try {
|
|
13589
|
-
const emitter = new Emitter(compilationController.mainCompilationState.analyzer,
|
|
13648
|
+
const emitter = new Emitter(compilationController.mainCompilationState.analyzer, options7);
|
|
13590
13649
|
const code = yield emitter.emitToString(taskController);
|
|
13591
13650
|
result = { hasErrors: false, code };
|
|
13592
13651
|
} catch (e) {
|
|
@@ -13597,9 +13656,9 @@ ${e}`);
|
|
|
13597
13656
|
return result;
|
|
13598
13657
|
});
|
|
13599
13658
|
}
|
|
13600
|
-
|
|
13659
|
+
onProvideServerOwnedDocumentContent(params, taskController) {
|
|
13601
13660
|
return __async(this, null, function* () {
|
|
13602
|
-
const vscodeUri =
|
|
13661
|
+
const vscodeUri = URI.parse(params.uri);
|
|
13603
13662
|
if (vscodeUri.scheme === InMemoryPackageScheme) {
|
|
13604
13663
|
const sourceFileContext = yield this.getSourceFileContext(vscodeUri, taskController);
|
|
13605
13664
|
return sourceFileContext?.sourceFile.getSourceText();
|
|
@@ -13621,7 +13680,7 @@ ${e}`);
|
|
|
13621
13680
|
onProvideEvaluatableExpression(params, taskController) {
|
|
13622
13681
|
return __async(this, null, function* () {
|
|
13623
13682
|
let result;
|
|
13624
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13683
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13625
13684
|
if (sourceFileContext !== void 0) {
|
|
13626
13685
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13627
13686
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13640,7 +13699,7 @@ ${e}`);
|
|
|
13640
13699
|
onCompletion(params, taskController) {
|
|
13641
13700
|
return __async(this, null, function* () {
|
|
13642
13701
|
let result = new Array();
|
|
13643
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13702
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13644
13703
|
if (sourceFileContext !== void 0) {
|
|
13645
13704
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13646
13705
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13745,7 +13804,7 @@ ${e}`);
|
|
|
13745
13804
|
onSemanticTokens(params, taskController) {
|
|
13746
13805
|
return __async(this, null, function* () {
|
|
13747
13806
|
let result;
|
|
13748
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13807
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13749
13808
|
if (sourceFileContext !== void 0) {
|
|
13750
13809
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13751
13810
|
const semanticTokens = yield this.semanticTokensService.getSemanticTokens(analyzer, sourceFile, taskController);
|
|
@@ -13757,7 +13816,7 @@ ${e}`);
|
|
|
13757
13816
|
onSemanticTokensRange(params, taskController) {
|
|
13758
13817
|
return __async(this, null, function* () {
|
|
13759
13818
|
let result;
|
|
13760
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13819
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13761
13820
|
if (sourceFileContext !== void 0) {
|
|
13762
13821
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13763
13822
|
const range = new Range(
|
|
@@ -13859,7 +13918,7 @@ ${e}`);
|
|
|
13859
13918
|
onSignatureHelp(params, taskController) {
|
|
13860
13919
|
return __async(this, null, function* () {
|
|
13861
13920
|
let result;
|
|
13862
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13921
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13863
13922
|
if (sourceFileContext !== void 0) {
|
|
13864
13923
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13865
13924
|
const position = new Position(params.position.line, params.position.character);
|
|
@@ -13883,7 +13942,7 @@ ${e}`);
|
|
|
13883
13942
|
onSelectionRanges(params, taskController) {
|
|
13884
13943
|
return __async(this, null, function* () {
|
|
13885
13944
|
let result;
|
|
13886
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13945
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13887
13946
|
if (sourceFileContext !== void 0) {
|
|
13888
13947
|
result = [];
|
|
13889
13948
|
const { sourceFile } = sourceFileContext;
|
|
@@ -13908,7 +13967,7 @@ ${e}`);
|
|
|
13908
13967
|
onCodeAction(params, taskController) {
|
|
13909
13968
|
return __async(this, null, function* () {
|
|
13910
13969
|
let result;
|
|
13911
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13970
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.textDocument.uri), taskController);
|
|
13912
13971
|
if (sourceFileContext !== void 0) {
|
|
13913
13972
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13914
13973
|
const offset = sourceFile.getOffsetAtPosition(new Position(params.range.start.line, params.range.start.character));
|
|
@@ -13923,7 +13982,7 @@ ${e}`);
|
|
|
13923
13982
|
return __async(this, null, function* () {
|
|
13924
13983
|
const result = params;
|
|
13925
13984
|
if (isCodeActionData(params.data)) {
|
|
13926
|
-
const sourceFileContext = yield this.getSourceFileContext(
|
|
13985
|
+
const sourceFileContext = yield this.getSourceFileContext(URI.parse(params.data.location.uri), taskController);
|
|
13927
13986
|
if (sourceFileContext !== void 0) {
|
|
13928
13987
|
const { analyzer, sourceFile } = sourceFileContext;
|
|
13929
13988
|
const offset = sourceFile.getOffsetAtPosition(new Position(
|
|
@@ -14019,7 +14078,7 @@ ${e}`);
|
|
|
14019
14078
|
});
|
|
14020
14079
|
}
|
|
14021
14080
|
convertUriToVscodeUri(uri) {
|
|
14022
|
-
return
|
|
14081
|
+
return URI.from({ scheme: uri.scheme, authority: uri.authority, path: uri.path });
|
|
14023
14082
|
}
|
|
14024
14083
|
convertVscodeUriToUri(uri) {
|
|
14025
14084
|
return Uri.from(uri.scheme, uri.authority, uri.path);
|
|
@@ -14048,7 +14107,7 @@ ${e}`);
|
|
|
14048
14107
|
}
|
|
14049
14108
|
};
|
|
14050
14109
|
__decorateClass([
|
|
14051
|
-
|
|
14110
|
+
atomic7
|
|
14052
14111
|
], _LanguageServer.prototype, "onDidChangeWorkspaceFolders", 1);
|
|
14053
14112
|
var LanguageServer = _LanguageServer;
|
|
14054
14113
|
var FileSystemSynchronizationMode;
|
|
@@ -14099,13 +14158,5 @@ export {
|
|
|
14099
14158
|
ClientCancellationToken,
|
|
14100
14159
|
FileSystemSynchronizationMode,
|
|
14101
14160
|
LanguageServer,
|
|
14102
|
-
|
|
14103
|
-
isAssignFieldParams,
|
|
14104
|
-
isCreateOrUpdateSourceFileParams,
|
|
14105
|
-
isDeleteSourceFileParams,
|
|
14106
|
-
isDisplayFileSystemTreeParams,
|
|
14107
|
-
isEmitCodeToStringParams,
|
|
14108
|
-
isGetNodeRangeParams,
|
|
14109
|
-
isProvideEvaluatableExpressionParams,
|
|
14110
|
-
isProvideServerOwnedDocumentContentParams
|
|
14161
|
+
customRequests
|
|
14111
14162
|
};
|