typescript 5.0.0-dev.20230215 → 5.0.0-dev.20230217
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/lib/tsc.js +37 -12
- package/lib/tsserver.js +122 -36
- package/lib/tsserverlibrary.d.ts +13 -0
- package/lib/tsserverlibrary.js +121 -36
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +120 -36
- package/lib/typingsInstaller.js +2 -4
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230217`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -13027,6 +13027,36 @@ ${lanes.join("\n")}
|
|
|
13027
13027
|
function nodeIsPresent(node) {
|
|
13028
13028
|
return !nodeIsMissing(node);
|
|
13029
13029
|
}
|
|
13030
|
+
function isGrammarError(parent2, child) {
|
|
13031
|
+
if (isTypeParameterDeclaration(parent2))
|
|
13032
|
+
return child === parent2.expression;
|
|
13033
|
+
if (isClassStaticBlockDeclaration(parent2))
|
|
13034
|
+
return child === parent2.modifiers;
|
|
13035
|
+
if (isPropertySignature(parent2))
|
|
13036
|
+
return child === parent2.initializer;
|
|
13037
|
+
if (isPropertyDeclaration(parent2))
|
|
13038
|
+
return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2);
|
|
13039
|
+
if (isPropertyAssignment(parent2))
|
|
13040
|
+
return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
13041
|
+
if (isShorthandPropertyAssignment(parent2))
|
|
13042
|
+
return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
13043
|
+
if (isMethodDeclaration(parent2))
|
|
13044
|
+
return child === parent2.exclamationToken;
|
|
13045
|
+
if (isConstructorDeclaration(parent2))
|
|
13046
|
+
return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
13047
|
+
if (isGetAccessorDeclaration(parent2))
|
|
13048
|
+
return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
13049
|
+
if (isSetAccessorDeclaration(parent2))
|
|
13050
|
+
return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
13051
|
+
if (isNamespaceExportDeclaration(parent2))
|
|
13052
|
+
return child === parent2.modifiers || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
13053
|
+
return false;
|
|
13054
|
+
}
|
|
13055
|
+
function isGrammarErrorElement(nodeArray, child, isElement) {
|
|
13056
|
+
if (!nodeArray || isArray(child) || !isElement(child))
|
|
13057
|
+
return false;
|
|
13058
|
+
return contains(nodeArray, child);
|
|
13059
|
+
}
|
|
13030
13060
|
function insertStatementsAfterPrologue(to, from, isPrologueDirective2) {
|
|
13031
13061
|
if (from === void 0 || from.length === 0)
|
|
13032
13062
|
return to;
|
|
@@ -27168,7 +27198,7 @@ ${lanes.join("\n")}
|
|
|
27168
27198
|
}
|
|
27169
27199
|
function canHaveIllegalModifiers(node) {
|
|
27170
27200
|
const kind = node.kind;
|
|
27171
|
-
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind ===
|
|
27201
|
+
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
|
|
27172
27202
|
}
|
|
27173
27203
|
function isQuestionOrExclamationToken(node) {
|
|
27174
27204
|
return isQuestionToken(node) || isExclamationToken(node);
|
|
@@ -29414,7 +29444,6 @@ ${lanes.join("\n")}
|
|
|
29414
29444
|
return canFollowExportModifier();
|
|
29415
29445
|
case 88 /* DefaultKeyword */:
|
|
29416
29446
|
return nextTokenCanFollowDefaultKeyword();
|
|
29417
|
-
case 127 /* AccessorKeyword */:
|
|
29418
29447
|
case 124 /* StaticKeyword */:
|
|
29419
29448
|
case 137 /* GetKeyword */:
|
|
29420
29449
|
case 151 /* SetKeyword */:
|
|
@@ -30707,6 +30736,7 @@ ${lanes.join("\n")}
|
|
|
30707
30736
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
30708
30737
|
const modifiers = parseModifiersForConstructorType();
|
|
30709
30738
|
const isConstructorType = parseOptional(103 /* NewKeyword */);
|
|
30739
|
+
Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
|
|
30710
30740
|
const typeParameters = parseTypeParameters();
|
|
30711
30741
|
const parameters = parseParameters(4 /* Type */);
|
|
30712
30742
|
const type = parseReturnType(
|
|
@@ -30715,8 +30745,6 @@ ${lanes.join("\n")}
|
|
|
30715
30745
|
false
|
|
30716
30746
|
);
|
|
30717
30747
|
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
|
|
30718
|
-
if (!isConstructorType)
|
|
30719
|
-
node.modifiers = modifiers;
|
|
30720
30748
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
30721
30749
|
}
|
|
30722
30750
|
function parseKeywordAndNoDot() {
|
|
@@ -44971,6 +44999,7 @@ ${lanes.join("\n")}
|
|
|
44971
44999
|
let inlineLevel = 0;
|
|
44972
45000
|
let currentNode;
|
|
44973
45001
|
let varianceTypeParameter;
|
|
45002
|
+
let isInferencePartiallyBlocked = false;
|
|
44974
45003
|
const emptySymbols = createSymbolTable();
|
|
44975
45004
|
const arrayVariances = [1 /* Covariant */];
|
|
44976
45005
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -45402,7 +45431,9 @@ ${lanes.join("\n")}
|
|
|
45402
45431
|
toMarkSkip = toMarkSkip.parent;
|
|
45403
45432
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45404
45433
|
}
|
|
45434
|
+
isInferencePartiallyBlocked = true;
|
|
45405
45435
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
45436
|
+
isInferencePartiallyBlocked = false;
|
|
45406
45437
|
if (containingCall) {
|
|
45407
45438
|
let toMarkSkip = node;
|
|
45408
45439
|
do {
|
|
@@ -55448,6 +55479,7 @@ ${lanes.join("\n")}
|
|
|
55448
55479
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
55449
55480
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
55450
55481
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
55482
|
+
const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
|
|
55451
55483
|
const templateType = getTemplateTypeFromMappedType(type.target || type);
|
|
55452
55484
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
55453
55485
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -55485,7 +55517,7 @@ ${lanes.join("\n")}
|
|
|
55485
55517
|
prop.links.keyType = keyType;
|
|
55486
55518
|
if (modifiersProp) {
|
|
55487
55519
|
prop.links.syntheticOrigin = modifiersProp;
|
|
55488
|
-
prop.declarations = nameType
|
|
55520
|
+
prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
|
|
55489
55521
|
}
|
|
55490
55522
|
members.set(propName, prop);
|
|
55491
55523
|
}
|
|
@@ -64217,6 +64249,9 @@ ${lanes.join("\n")}
|
|
|
64217
64249
|
const key = `B${getTypeId(type)}`;
|
|
64218
64250
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
64219
64251
|
}
|
|
64252
|
+
function getBaseTypeOfLiteralTypeForComparison(type) {
|
|
64253
|
+
return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
|
|
64254
|
+
}
|
|
64220
64255
|
function getWidenedLiteralType(type) {
|
|
64221
64256
|
return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
|
|
64222
64257
|
}
|
|
@@ -72041,7 +72076,7 @@ ${lanes.join("\n")}
|
|
|
72041
72076
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
72042
72077
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
72043
72078
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
72044
|
-
const reportErrors2 = !candidatesOutArray;
|
|
72079
|
+
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
72045
72080
|
let typeArguments;
|
|
72046
72081
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
72047
72082
|
typeArguments = node.typeArguments;
|
|
@@ -75282,8 +75317,8 @@ ${lanes.join("\n")}
|
|
|
75282
75317
|
case 32 /* LessThanEqualsToken */:
|
|
75283
75318
|
case 33 /* GreaterThanEqualsToken */:
|
|
75284
75319
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
75285
|
-
leftType =
|
|
75286
|
-
rightType =
|
|
75320
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
75321
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
75287
75322
|
reportOperatorErrorUnless((left2, right2) => {
|
|
75288
75323
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
75289
75324
|
return true;
|
|
@@ -77119,6 +77154,17 @@ ${lanes.join("\n")}
|
|
|
77119
77154
|
lastSeenNonAmbientDeclaration = node;
|
|
77120
77155
|
}
|
|
77121
77156
|
}
|
|
77157
|
+
if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
|
|
77158
|
+
for (const node2 of current.jsDoc) {
|
|
77159
|
+
if (node2.tags) {
|
|
77160
|
+
for (const tag of node2.tags) {
|
|
77161
|
+
if (isJSDocOverloadTag(tag)) {
|
|
77162
|
+
hasOverloads = true;
|
|
77163
|
+
}
|
|
77164
|
+
}
|
|
77165
|
+
}
|
|
77166
|
+
}
|
|
77167
|
+
}
|
|
77122
77168
|
}
|
|
77123
77169
|
}
|
|
77124
77170
|
if (multipleConstructorImplementation) {
|
|
@@ -77156,8 +77202,9 @@ ${lanes.join("\n")}
|
|
|
77156
77202
|
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
|
|
77157
77203
|
for (const signature of signatures) {
|
|
77158
77204
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
77205
|
+
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
77159
77206
|
addRelatedInfo(
|
|
77160
|
-
error(
|
|
77207
|
+
error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
77161
77208
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
77162
77209
|
);
|
|
77163
77210
|
break;
|
|
@@ -83773,7 +83820,6 @@ ${lanes.join("\n")}
|
|
|
83773
83820
|
case 299 /* PropertyAssignment */:
|
|
83774
83821
|
case 300 /* ShorthandPropertyAssignment */:
|
|
83775
83822
|
case 267 /* NamespaceExportDeclaration */:
|
|
83776
|
-
case 181 /* FunctionType */:
|
|
83777
83823
|
case 279 /* MissingDeclaration */:
|
|
83778
83824
|
return find(node.modifiers, isModifier);
|
|
83779
83825
|
default:
|
|
@@ -90367,7 +90413,16 @@ ${lanes.join("\n")}
|
|
|
90367
90413
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
90368
90414
|
);
|
|
90369
90415
|
}
|
|
90370
|
-
return
|
|
90416
|
+
return factory2.updatePropertyDeclaration(
|
|
90417
|
+
node,
|
|
90418
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
90419
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
90420
|
+
/*questionOrExclamationToken*/
|
|
90421
|
+
void 0,
|
|
90422
|
+
/*type*/
|
|
90423
|
+
void 0,
|
|
90424
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
90425
|
+
);
|
|
90371
90426
|
}
|
|
90372
90427
|
function transformPublicFieldInitializer(node) {
|
|
90373
90428
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -133197,7 +133252,8 @@ ${lanes.join("\n")}
|
|
|
133197
133252
|
options.triggerCharacter,
|
|
133198
133253
|
options.triggerKind,
|
|
133199
133254
|
cancellationToken,
|
|
133200
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
133255
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
133256
|
+
options.includeSymbol
|
|
133201
133257
|
);
|
|
133202
133258
|
}
|
|
133203
133259
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -145829,13 +145885,7 @@ ${lanes.join("\n")}
|
|
|
145829
145885
|
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
|
|
145830
145886
|
if (length(signatures)) {
|
|
145831
145887
|
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
|
|
145832
|
-
return checker.typeToTypeNode(
|
|
145833
|
-
type,
|
|
145834
|
-
enclosingDeclaration,
|
|
145835
|
-
/*flags*/
|
|
145836
|
-
void 0,
|
|
145837
|
-
getNoopSymbolTrackerWithResolver(context)
|
|
145838
|
-
);
|
|
145888
|
+
return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
|
|
145839
145889
|
}
|
|
145840
145890
|
}
|
|
145841
145891
|
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
|
|
@@ -146127,7 +146177,14 @@ ${lanes.join("\n")}
|
|
|
146127
146177
|
changeTracker.replaceNode(file, declaration, property);
|
|
146128
146178
|
}
|
|
146129
146179
|
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
|
|
146130
|
-
|
|
146180
|
+
let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
|
|
146181
|
+
if (assignment.modifiers || assignment.questionToken || assignment.exclamationToken) {
|
|
146182
|
+
if (assignment === declaration)
|
|
146183
|
+
assignment = factory.cloneNode(assignment);
|
|
146184
|
+
assignment.modifiers = void 0;
|
|
146185
|
+
assignment.questionToken = void 0;
|
|
146186
|
+
assignment.exclamationToken = void 0;
|
|
146187
|
+
}
|
|
146131
146188
|
changeTracker.replacePropertyAssignment(file, declaration, assignment);
|
|
146132
146189
|
}
|
|
146133
146190
|
function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
|
|
@@ -147318,7 +147375,7 @@ ${lanes.join("\n")}
|
|
|
147318
147375
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
147319
147376
|
}
|
|
147320
147377
|
}
|
|
147321
|
-
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
147378
|
+
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
|
|
147322
147379
|
var _a2;
|
|
147323
147380
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
147324
147381
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -147340,7 +147397,7 @@ ${lanes.join("\n")}
|
|
|
147340
147397
|
} else {
|
|
147341
147398
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
147342
147399
|
}
|
|
147343
|
-
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
147400
|
+
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
|
|
147344
147401
|
if (stringCompletions) {
|
|
147345
147402
|
return stringCompletions;
|
|
147346
147403
|
}
|
|
@@ -147365,7 +147422,7 @@ ${lanes.join("\n")}
|
|
|
147365
147422
|
}
|
|
147366
147423
|
switch (completionData.kind) {
|
|
147367
147424
|
case 0 /* Data */:
|
|
147368
|
-
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
147425
|
+
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
|
|
147369
147426
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
147370
147427
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
147371
147428
|
}
|
|
@@ -147495,7 +147552,7 @@ ${lanes.join("\n")}
|
|
|
147495
147552
|
function getOptionalReplacementSpan(location) {
|
|
147496
147553
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
147497
147554
|
}
|
|
147498
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
147555
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
147499
147556
|
const {
|
|
147500
147557
|
symbols,
|
|
147501
147558
|
contextToken,
|
|
@@ -147569,7 +147626,8 @@ ${lanes.join("\n")}
|
|
|
147569
147626
|
symbolToOriginInfoMap,
|
|
147570
147627
|
symbolToSortTextMap,
|
|
147571
147628
|
isJsxIdentifierExpected,
|
|
147572
|
-
isRightOfOpenTag
|
|
147629
|
+
isRightOfOpenTag,
|
|
147630
|
+
includeSymbol
|
|
147573
147631
|
);
|
|
147574
147632
|
if (keywordFilters !== 0 /* None */) {
|
|
147575
147633
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -147818,7 +147876,7 @@ ${lanes.join("\n")}
|
|
|
147818
147876
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
147819
147877
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
147820
147878
|
}
|
|
147821
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
147879
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
147822
147880
|
let insertText;
|
|
147823
147881
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
147824
147882
|
let data;
|
|
@@ -147862,7 +147920,9 @@ ${lanes.join("\n")}
|
|
|
147862
147920
|
}
|
|
147863
147921
|
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
|
147864
147922
|
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
|
147865
|
-
|
|
147923
|
+
const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
|
|
147924
|
+
const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
|
|
147925
|
+
replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
|
|
147866
147926
|
}
|
|
147867
147927
|
if (originIsResolvedExport(origin)) {
|
|
147868
147928
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
@@ -147930,7 +147990,8 @@ ${lanes.join("\n")}
|
|
|
147930
147990
|
isSnippet,
|
|
147931
147991
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
147932
147992
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
147933
|
-
data
|
|
147993
|
+
data,
|
|
147994
|
+
...includeSymbol ? { symbol } : void 0
|
|
147934
147995
|
};
|
|
147935
147996
|
}
|
|
147936
147997
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -148400,7 +148461,7 @@ ${lanes.join("\n")}
|
|
|
148400
148461
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
148401
148462
|
}
|
|
148402
148463
|
}
|
|
148403
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
148464
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
148404
148465
|
var _a2;
|
|
148405
148466
|
const start = timestamp();
|
|
148406
148467
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -148440,7 +148501,8 @@ ${lanes.join("\n")}
|
|
|
148440
148501
|
kind,
|
|
148441
148502
|
formatContext,
|
|
148442
148503
|
isJsxIdentifierExpected,
|
|
148443
|
-
isRightOfOpenTag
|
|
148504
|
+
isRightOfOpenTag,
|
|
148505
|
+
includeSymbol
|
|
148444
148506
|
);
|
|
148445
148507
|
if (!entry) {
|
|
148446
148508
|
continue;
|
|
@@ -150681,7 +150743,7 @@ ${lanes.join("\n")}
|
|
|
150681
150743
|
values: map2.values.bind(map2)
|
|
150682
150744
|
};
|
|
150683
150745
|
}
|
|
150684
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
150746
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
150685
150747
|
if (isInReferenceComment(sourceFile, position)) {
|
|
150686
150748
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
150687
150749
|
return entries && convertPathCompletions(entries);
|
|
@@ -150690,10 +150752,10 @@ ${lanes.join("\n")}
|
|
|
150690
150752
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
150691
150753
|
return void 0;
|
|
150692
150754
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
150693
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
150755
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
150694
150756
|
}
|
|
150695
150757
|
}
|
|
150696
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
150758
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
150697
150759
|
if (completion === void 0) {
|
|
150698
150760
|
return void 0;
|
|
150699
150761
|
}
|
|
@@ -150719,7 +150781,28 @@ ${lanes.join("\n")}
|
|
|
150719
150781
|
preferences,
|
|
150720
150782
|
options,
|
|
150721
150783
|
/*formatContext*/
|
|
150722
|
-
void 0
|
|
150784
|
+
void 0,
|
|
150785
|
+
/*isTypeOnlyLocation */
|
|
150786
|
+
void 0,
|
|
150787
|
+
/*propertyAccessToConvert*/
|
|
150788
|
+
void 0,
|
|
150789
|
+
/*jsxIdentifierExpected*/
|
|
150790
|
+
void 0,
|
|
150791
|
+
/*isJsxInitializer*/
|
|
150792
|
+
void 0,
|
|
150793
|
+
/*importStatementCompletion*/
|
|
150794
|
+
void 0,
|
|
150795
|
+
/*recommendedCompletion*/
|
|
150796
|
+
void 0,
|
|
150797
|
+
/*symbolToOriginInfoMap*/
|
|
150798
|
+
void 0,
|
|
150799
|
+
/*symbolToSortTextMap*/
|
|
150800
|
+
void 0,
|
|
150801
|
+
/*isJsxIdentifierExpected*/
|
|
150802
|
+
void 0,
|
|
150803
|
+
/*isRightOfOpenTag*/
|
|
150804
|
+
void 0,
|
|
150805
|
+
includeSymbol
|
|
150723
150806
|
);
|
|
150724
150807
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
150725
150808
|
}
|
|
@@ -165864,7 +165947,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
165864
165947
|
}
|
|
165865
165948
|
function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
165866
165949
|
Debug.assert(!nodeIsSynthesized(child));
|
|
165867
|
-
if (nodeIsMissing(child)) {
|
|
165950
|
+
if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
|
|
165868
165951
|
return inheritedIndentation;
|
|
165869
165952
|
}
|
|
165870
165953
|
const childStartPos = child.getStart(sourceFile);
|
|
@@ -179373,6 +179456,7 @@ ${e.message}`;
|
|
|
179373
179456
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
179374
179457
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
179375
179458
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
179459
|
+
isGrammarError: () => isGrammarError,
|
|
179376
179460
|
isHeritageClause: () => isHeritageClause,
|
|
179377
179461
|
isHoistedFunction: () => isHoistedFunction,
|
|
179378
179462
|
isHoistedVariableStatement: () => isHoistedVariableStatement,
|
|
@@ -181732,6 +181816,7 @@ ${e.message}`;
|
|
|
181732
181816
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
181733
181817
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
181734
181818
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
181819
|
+
isGrammarError: () => isGrammarError,
|
|
181735
181820
|
isHeritageClause: () => isHeritageClause,
|
|
181736
181821
|
isHoistedFunction: () => isHoistedFunction,
|
|
181737
181822
|
isHoistedVariableStatement: () => isHoistedVariableStatement,
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6171,6 +6171,13 @@ declare namespace ts {
|
|
|
6171
6171
|
*/
|
|
6172
6172
|
triggerCharacter?: CompletionsTriggerCharacter;
|
|
6173
6173
|
triggerKind?: CompletionTriggerKind;
|
|
6174
|
+
/**
|
|
6175
|
+
* Include a `symbol` property on each completion entry object.
|
|
6176
|
+
* Symbols reference cyclic data structures and sometimes an entire TypeChecker instance,
|
|
6177
|
+
* so use caution when serializing or retaining completion entries retrieved with this option.
|
|
6178
|
+
* @default false
|
|
6179
|
+
*/
|
|
6180
|
+
includeSymbol?: boolean;
|
|
6174
6181
|
/** @deprecated Use includeCompletionsForModuleExports */
|
|
6175
6182
|
includeExternalModuleExports?: boolean;
|
|
6176
6183
|
/** @deprecated Use includeCompletionsWithInsertText */
|
|
@@ -6728,6 +6735,12 @@ declare namespace ts {
|
|
|
6728
6735
|
isFromUncheckedFile?: true;
|
|
6729
6736
|
isPackageJsonImport?: true;
|
|
6730
6737
|
isImportStatementCompletion?: true;
|
|
6738
|
+
/**
|
|
6739
|
+
* For API purposes.
|
|
6740
|
+
* Included for non-string completions only when `includeSymbol: true` option is passed to `getCompletionsAtPosition`.
|
|
6741
|
+
* @example Get declaration of completion: `symbol.valueDeclaration`
|
|
6742
|
+
*/
|
|
6743
|
+
symbol?: Symbol;
|
|
6731
6744
|
/**
|
|
6732
6745
|
* A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
|
|
6733
6746
|
* that allows TS Server to look up the symbol represented by the completion item, disambiguating
|