typescript 5.0.0-dev.20230216 → 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 -11
- package/lib/tsserver.js +121 -28
- package/lib/tsserverlibrary.d.ts +13 -0
- package/lib/tsserverlibrary.js +120 -28
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +119 -28
- package/lib/typingsInstaller.js +2 -3
- 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);
|
|
@@ -30706,6 +30736,7 @@ ${lanes.join("\n")}
|
|
|
30706
30736
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
30707
30737
|
const modifiers = parseModifiersForConstructorType();
|
|
30708
30738
|
const isConstructorType = parseOptional(103 /* NewKeyword */);
|
|
30739
|
+
Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
|
|
30709
30740
|
const typeParameters = parseTypeParameters();
|
|
30710
30741
|
const parameters = parseParameters(4 /* Type */);
|
|
30711
30742
|
const type = parseReturnType(
|
|
@@ -30714,8 +30745,6 @@ ${lanes.join("\n")}
|
|
|
30714
30745
|
false
|
|
30715
30746
|
);
|
|
30716
30747
|
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
|
|
30717
|
-
if (!isConstructorType)
|
|
30718
|
-
node.modifiers = modifiers;
|
|
30719
30748
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
30720
30749
|
}
|
|
30721
30750
|
function parseKeywordAndNoDot() {
|
|
@@ -44970,6 +44999,7 @@ ${lanes.join("\n")}
|
|
|
44970
44999
|
let inlineLevel = 0;
|
|
44971
45000
|
let currentNode;
|
|
44972
45001
|
let varianceTypeParameter;
|
|
45002
|
+
let isInferencePartiallyBlocked = false;
|
|
44973
45003
|
const emptySymbols = createSymbolTable();
|
|
44974
45004
|
const arrayVariances = [1 /* Covariant */];
|
|
44975
45005
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -45401,7 +45431,9 @@ ${lanes.join("\n")}
|
|
|
45401
45431
|
toMarkSkip = toMarkSkip.parent;
|
|
45402
45432
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45403
45433
|
}
|
|
45434
|
+
isInferencePartiallyBlocked = true;
|
|
45404
45435
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
45436
|
+
isInferencePartiallyBlocked = false;
|
|
45405
45437
|
if (containingCall) {
|
|
45406
45438
|
let toMarkSkip = node;
|
|
45407
45439
|
do {
|
|
@@ -55447,6 +55479,7 @@ ${lanes.join("\n")}
|
|
|
55447
55479
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
55448
55480
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
55449
55481
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
55482
|
+
const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
|
|
55450
55483
|
const templateType = getTemplateTypeFromMappedType(type.target || type);
|
|
55451
55484
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
55452
55485
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -55484,7 +55517,7 @@ ${lanes.join("\n")}
|
|
|
55484
55517
|
prop.links.keyType = keyType;
|
|
55485
55518
|
if (modifiersProp) {
|
|
55486
55519
|
prop.links.syntheticOrigin = modifiersProp;
|
|
55487
|
-
prop.declarations = nameType
|
|
55520
|
+
prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
|
|
55488
55521
|
}
|
|
55489
55522
|
members.set(propName, prop);
|
|
55490
55523
|
}
|
|
@@ -64216,6 +64249,9 @@ ${lanes.join("\n")}
|
|
|
64216
64249
|
const key = `B${getTypeId(type)}`;
|
|
64217
64250
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
64218
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
|
+
}
|
|
64219
64255
|
function getWidenedLiteralType(type) {
|
|
64220
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;
|
|
64221
64257
|
}
|
|
@@ -72040,7 +72076,7 @@ ${lanes.join("\n")}
|
|
|
72040
72076
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
72041
72077
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
72042
72078
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
72043
|
-
const reportErrors2 = !candidatesOutArray;
|
|
72079
|
+
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
72044
72080
|
let typeArguments;
|
|
72045
72081
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
72046
72082
|
typeArguments = node.typeArguments;
|
|
@@ -75281,8 +75317,8 @@ ${lanes.join("\n")}
|
|
|
75281
75317
|
case 32 /* LessThanEqualsToken */:
|
|
75282
75318
|
case 33 /* GreaterThanEqualsToken */:
|
|
75283
75319
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
75284
|
-
leftType =
|
|
75285
|
-
rightType =
|
|
75320
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
75321
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
75286
75322
|
reportOperatorErrorUnless((left2, right2) => {
|
|
75287
75323
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
75288
75324
|
return true;
|
|
@@ -77118,6 +77154,17 @@ ${lanes.join("\n")}
|
|
|
77118
77154
|
lastSeenNonAmbientDeclaration = node;
|
|
77119
77155
|
}
|
|
77120
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
|
+
}
|
|
77121
77168
|
}
|
|
77122
77169
|
}
|
|
77123
77170
|
if (multipleConstructorImplementation) {
|
|
@@ -77155,8 +77202,9 @@ ${lanes.join("\n")}
|
|
|
77155
77202
|
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
|
|
77156
77203
|
for (const signature of signatures) {
|
|
77157
77204
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
77205
|
+
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
77158
77206
|
addRelatedInfo(
|
|
77159
|
-
error(
|
|
77207
|
+
error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
77160
77208
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
77161
77209
|
);
|
|
77162
77210
|
break;
|
|
@@ -83772,7 +83820,6 @@ ${lanes.join("\n")}
|
|
|
83772
83820
|
case 299 /* PropertyAssignment */:
|
|
83773
83821
|
case 300 /* ShorthandPropertyAssignment */:
|
|
83774
83822
|
case 267 /* NamespaceExportDeclaration */:
|
|
83775
|
-
case 181 /* FunctionType */:
|
|
83776
83823
|
case 279 /* MissingDeclaration */:
|
|
83777
83824
|
return find(node.modifiers, isModifier);
|
|
83778
83825
|
default:
|
|
@@ -90366,7 +90413,16 @@ ${lanes.join("\n")}
|
|
|
90366
90413
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
90367
90414
|
);
|
|
90368
90415
|
}
|
|
90369
|
-
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
|
+
);
|
|
90370
90426
|
}
|
|
90371
90427
|
function transformPublicFieldInitializer(node) {
|
|
90372
90428
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -133196,7 +133252,8 @@ ${lanes.join("\n")}
|
|
|
133196
133252
|
options.triggerCharacter,
|
|
133197
133253
|
options.triggerKind,
|
|
133198
133254
|
cancellationToken,
|
|
133199
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
133255
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
133256
|
+
options.includeSymbol
|
|
133200
133257
|
);
|
|
133201
133258
|
}
|
|
133202
133259
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -146120,7 +146177,14 @@ ${lanes.join("\n")}
|
|
|
146120
146177
|
changeTracker.replaceNode(file, declaration, property);
|
|
146121
146178
|
}
|
|
146122
146179
|
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
|
|
146123
|
-
|
|
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
|
+
}
|
|
146124
146188
|
changeTracker.replacePropertyAssignment(file, declaration, assignment);
|
|
146125
146189
|
}
|
|
146126
146190
|
function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
|
|
@@ -147311,7 +147375,7 @@ ${lanes.join("\n")}
|
|
|
147311
147375
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
147312
147376
|
}
|
|
147313
147377
|
}
|
|
147314
|
-
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) {
|
|
147315
147379
|
var _a2;
|
|
147316
147380
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
147317
147381
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -147333,7 +147397,7 @@ ${lanes.join("\n")}
|
|
|
147333
147397
|
} else {
|
|
147334
147398
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
147335
147399
|
}
|
|
147336
|
-
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);
|
|
147337
147401
|
if (stringCompletions) {
|
|
147338
147402
|
return stringCompletions;
|
|
147339
147403
|
}
|
|
@@ -147358,7 +147422,7 @@ ${lanes.join("\n")}
|
|
|
147358
147422
|
}
|
|
147359
147423
|
switch (completionData.kind) {
|
|
147360
147424
|
case 0 /* Data */:
|
|
147361
|
-
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);
|
|
147362
147426
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
147363
147427
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
147364
147428
|
}
|
|
@@ -147488,7 +147552,7 @@ ${lanes.join("\n")}
|
|
|
147488
147552
|
function getOptionalReplacementSpan(location) {
|
|
147489
147553
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
147490
147554
|
}
|
|
147491
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
147555
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
147492
147556
|
const {
|
|
147493
147557
|
symbols,
|
|
147494
147558
|
contextToken,
|
|
@@ -147562,7 +147626,8 @@ ${lanes.join("\n")}
|
|
|
147562
147626
|
symbolToOriginInfoMap,
|
|
147563
147627
|
symbolToSortTextMap,
|
|
147564
147628
|
isJsxIdentifierExpected,
|
|
147565
|
-
isRightOfOpenTag
|
|
147629
|
+
isRightOfOpenTag,
|
|
147630
|
+
includeSymbol
|
|
147566
147631
|
);
|
|
147567
147632
|
if (keywordFilters !== 0 /* None */) {
|
|
147568
147633
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -147811,7 +147876,7 @@ ${lanes.join("\n")}
|
|
|
147811
147876
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
147812
147877
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
147813
147878
|
}
|
|
147814
|
-
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) {
|
|
147815
147880
|
let insertText;
|
|
147816
147881
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
147817
147882
|
let data;
|
|
@@ -147855,7 +147920,9 @@ ${lanes.join("\n")}
|
|
|
147855
147920
|
}
|
|
147856
147921
|
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
|
147857
147922
|
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
|
147858
|
-
|
|
147923
|
+
const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
|
|
147924
|
+
const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
|
|
147925
|
+
replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
|
|
147859
147926
|
}
|
|
147860
147927
|
if (originIsResolvedExport(origin)) {
|
|
147861
147928
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
@@ -147923,7 +147990,8 @@ ${lanes.join("\n")}
|
|
|
147923
147990
|
isSnippet,
|
|
147924
147991
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
147925
147992
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
147926
|
-
data
|
|
147993
|
+
data,
|
|
147994
|
+
...includeSymbol ? { symbol } : void 0
|
|
147927
147995
|
};
|
|
147928
147996
|
}
|
|
147929
147997
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -148393,7 +148461,7 @@ ${lanes.join("\n")}
|
|
|
148393
148461
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
148394
148462
|
}
|
|
148395
148463
|
}
|
|
148396
|
-
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) {
|
|
148397
148465
|
var _a2;
|
|
148398
148466
|
const start = timestamp();
|
|
148399
148467
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -148433,7 +148501,8 @@ ${lanes.join("\n")}
|
|
|
148433
148501
|
kind,
|
|
148434
148502
|
formatContext,
|
|
148435
148503
|
isJsxIdentifierExpected,
|
|
148436
|
-
isRightOfOpenTag
|
|
148504
|
+
isRightOfOpenTag,
|
|
148505
|
+
includeSymbol
|
|
148437
148506
|
);
|
|
148438
148507
|
if (!entry) {
|
|
148439
148508
|
continue;
|
|
@@ -150674,7 +150743,7 @@ ${lanes.join("\n")}
|
|
|
150674
150743
|
values: map2.values.bind(map2)
|
|
150675
150744
|
};
|
|
150676
150745
|
}
|
|
150677
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
150746
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
150678
150747
|
if (isInReferenceComment(sourceFile, position)) {
|
|
150679
150748
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
150680
150749
|
return entries && convertPathCompletions(entries);
|
|
@@ -150683,10 +150752,10 @@ ${lanes.join("\n")}
|
|
|
150683
150752
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
150684
150753
|
return void 0;
|
|
150685
150754
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
150686
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
150755
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
150687
150756
|
}
|
|
150688
150757
|
}
|
|
150689
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
150758
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
150690
150759
|
if (completion === void 0) {
|
|
150691
150760
|
return void 0;
|
|
150692
150761
|
}
|
|
@@ -150712,7 +150781,28 @@ ${lanes.join("\n")}
|
|
|
150712
150781
|
preferences,
|
|
150713
150782
|
options,
|
|
150714
150783
|
/*formatContext*/
|
|
150715
|
-
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
|
|
150716
150806
|
);
|
|
150717
150807
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
150718
150808
|
}
|
|
@@ -165857,7 +165947,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
165857
165947
|
}
|
|
165858
165948
|
function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
165859
165949
|
Debug.assert(!nodeIsSynthesized(child));
|
|
165860
|
-
if (nodeIsMissing(child)) {
|
|
165950
|
+
if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
|
|
165861
165951
|
return inheritedIndentation;
|
|
165862
165952
|
}
|
|
165863
165953
|
const childStartPos = child.getStart(sourceFile);
|
|
@@ -179366,6 +179456,7 @@ ${e.message}`;
|
|
|
179366
179456
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
179367
179457
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
179368
179458
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
179459
|
+
isGrammarError: () => isGrammarError,
|
|
179369
179460
|
isHeritageClause: () => isHeritageClause,
|
|
179370
179461
|
isHoistedFunction: () => isHoistedFunction,
|
|
179371
179462
|
isHoistedVariableStatement: () => isHoistedVariableStatement,
|
|
@@ -181725,6 +181816,7 @@ ${e.message}`;
|
|
|
181725
181816
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
181726
181817
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
181727
181818
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
181819
|
+
isGrammarError: () => isGrammarError,
|
|
181728
181820
|
isHeritageClause: () => isHeritageClause,
|
|
181729
181821
|
isHoistedFunction: () => isHoistedFunction,
|
|
181730
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
|