typescript 5.2.0-dev.20230516 → 5.2.0-dev.20230518
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 +39 -6
- package/lib/tsserver.js +110 -32
- package/lib/tsserverlibrary.d.ts +6 -0
- package/lib/tsserverlibrary.js +110 -32
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +108 -32
- package/lib/typingsInstaller.js +6 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230518`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -18559,7 +18559,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18559
18559
|
ensureUseStrict,
|
|
18560
18560
|
liftToBlock,
|
|
18561
18561
|
mergeLexicalEnvironment,
|
|
18562
|
-
updateModifiers
|
|
18562
|
+
updateModifiers,
|
|
18563
|
+
updateModifierLike
|
|
18563
18564
|
};
|
|
18564
18565
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
18565
18566
|
return factory2;
|
|
@@ -22041,6 +22042,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22041
22042
|
}
|
|
22042
22043
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node);
|
|
22043
22044
|
}
|
|
22045
|
+
function updateModifierLike(node, modifierArray) {
|
|
22046
|
+
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
22047
|
+
}
|
|
22044
22048
|
function asNodeArray(array) {
|
|
22045
22049
|
return array ? createNodeArray(array) : void 0;
|
|
22046
22050
|
}
|
|
@@ -23366,10 +23370,10 @@ var esDecorateHelper = {
|
|
|
23366
23370
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23367
23371
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
23368
23372
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
23369
|
-
if (_ = accept(result.init)) initializers.
|
|
23373
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
23370
23374
|
}
|
|
23371
23375
|
else if (_ = accept(result)) {
|
|
23372
|
-
if (kind === "field") initializers.
|
|
23376
|
+
if (kind === "field") initializers.unshift(_);
|
|
23373
23377
|
else descriptor[key] = _;
|
|
23374
23378
|
}
|
|
23375
23379
|
}
|
|
@@ -54156,7 +54160,35 @@ function createTypeChecker(host) {
|
|
|
54156
54160
|
return emptyArray;
|
|
54157
54161
|
}
|
|
54158
54162
|
function getSignaturesOfType(type, kind) {
|
|
54159
|
-
|
|
54163
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
54164
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
54165
|
+
if (type.arrayFallbackSignatures) {
|
|
54166
|
+
return type.arrayFallbackSignatures;
|
|
54167
|
+
}
|
|
54168
|
+
let memberName;
|
|
54169
|
+
if (everyType(type, (t) => {
|
|
54170
|
+
var _a;
|
|
54171
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
54172
|
+
})) {
|
|
54173
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
54174
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
54175
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
54176
|
+
}
|
|
54177
|
+
type.arrayFallbackSignatures = result;
|
|
54178
|
+
}
|
|
54179
|
+
return result;
|
|
54180
|
+
}
|
|
54181
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
54182
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
54183
|
+
return false;
|
|
54184
|
+
}
|
|
54185
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
54186
|
+
}
|
|
54187
|
+
function isReadonlyArraySymbol(symbol) {
|
|
54188
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
54189
|
+
return false;
|
|
54190
|
+
}
|
|
54191
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
54160
54192
|
}
|
|
54161
54193
|
function findIndexInfo(indexInfos, keyType) {
|
|
54162
54194
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -69677,8 +69709,9 @@ function createTypeChecker(host) {
|
|
|
69677
69709
|
void 0,
|
|
69678
69710
|
checkMode
|
|
69679
69711
|
);
|
|
69712
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
69680
69713
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
69681
|
-
|
|
69714
|
+
checkAttributesType,
|
|
69682
69715
|
paramType,
|
|
69683
69716
|
relation,
|
|
69684
69717
|
reportErrors2 ? node.tagName : void 0,
|
package/lib/tsserver.js
CHANGED
|
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
2306
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-dev.20230518`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -22754,7 +22754,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22754
22754
|
ensureUseStrict,
|
|
22755
22755
|
liftToBlock,
|
|
22756
22756
|
mergeLexicalEnvironment,
|
|
22757
|
-
updateModifiers
|
|
22757
|
+
updateModifiers,
|
|
22758
|
+
updateModifierLike
|
|
22758
22759
|
};
|
|
22759
22760
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
22760
22761
|
return factory2;
|
|
@@ -26236,6 +26237,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26236
26237
|
}
|
|
26237
26238
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node);
|
|
26238
26239
|
}
|
|
26240
|
+
function updateModifierLike(node, modifierArray) {
|
|
26241
|
+
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
26242
|
+
}
|
|
26239
26243
|
function asNodeArray(array) {
|
|
26240
26244
|
return array ? createNodeArray(array) : void 0;
|
|
26241
26245
|
}
|
|
@@ -27617,10 +27621,10 @@ var esDecorateHelper = {
|
|
|
27617
27621
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
27618
27622
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
27619
27623
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
27620
|
-
if (_ = accept(result.init)) initializers.
|
|
27624
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
27621
27625
|
}
|
|
27622
27626
|
else if (_ = accept(result)) {
|
|
27623
|
-
if (kind === "field") initializers.
|
|
27627
|
+
if (kind === "field") initializers.unshift(_);
|
|
27624
27628
|
else descriptor[key] = _;
|
|
27625
27629
|
}
|
|
27626
27630
|
}
|
|
@@ -58807,7 +58811,35 @@ function createTypeChecker(host) {
|
|
|
58807
58811
|
return emptyArray;
|
|
58808
58812
|
}
|
|
58809
58813
|
function getSignaturesOfType(type, kind) {
|
|
58810
|
-
|
|
58814
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
58815
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
58816
|
+
if (type.arrayFallbackSignatures) {
|
|
58817
|
+
return type.arrayFallbackSignatures;
|
|
58818
|
+
}
|
|
58819
|
+
let memberName;
|
|
58820
|
+
if (everyType(type, (t) => {
|
|
58821
|
+
var _a;
|
|
58822
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
58823
|
+
})) {
|
|
58824
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
58825
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
58826
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
58827
|
+
}
|
|
58828
|
+
type.arrayFallbackSignatures = result;
|
|
58829
|
+
}
|
|
58830
|
+
return result;
|
|
58831
|
+
}
|
|
58832
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
58833
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
58834
|
+
return false;
|
|
58835
|
+
}
|
|
58836
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
58837
|
+
}
|
|
58838
|
+
function isReadonlyArraySymbol(symbol) {
|
|
58839
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
58840
|
+
return false;
|
|
58841
|
+
}
|
|
58842
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
58811
58843
|
}
|
|
58812
58844
|
function findIndexInfo(indexInfos, keyType) {
|
|
58813
58845
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -74328,8 +74360,9 @@ function createTypeChecker(host) {
|
|
|
74328
74360
|
void 0,
|
|
74329
74361
|
checkMode
|
|
74330
74362
|
);
|
|
74363
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
74331
74364
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
74332
|
-
|
|
74365
|
+
checkAttributesType,
|
|
74333
74366
|
paramType,
|
|
74334
74367
|
relation,
|
|
74335
74368
|
reportErrors2 ? node.tagName : void 0,
|
|
@@ -153144,7 +153177,8 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
153144
153177
|
false
|
|
153145
153178
|
);
|
|
153146
153179
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
153147
|
-
let modifierFlags = effectiveModifierFlags &
|
|
153180
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
153181
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
153148
153182
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
153149
153183
|
modifierFlags |= 128 /* Accessor */;
|
|
153150
153184
|
}
|
|
@@ -155716,6 +155750,7 @@ function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
|
155716
155750
|
}
|
|
155717
155751
|
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) {
|
|
155718
155752
|
let insertText;
|
|
155753
|
+
let filterText;
|
|
155719
155754
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
155720
155755
|
let data;
|
|
155721
155756
|
let isSnippet;
|
|
@@ -155774,11 +155809,15 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
155774
155809
|
}
|
|
155775
155810
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155776
155811
|
let importAdder;
|
|
155777
|
-
|
|
155778
|
-
|
|
155779
|
-
|
|
155780
|
-
|
|
155781
|
-
|
|
155812
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155813
|
+
if (memberCompletionEntry) {
|
|
155814
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155815
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155816
|
+
hasAction = true;
|
|
155817
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155818
|
+
}
|
|
155819
|
+
} else {
|
|
155820
|
+
return void 0;
|
|
155782
155821
|
}
|
|
155783
155822
|
}
|
|
155784
155823
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155822,6 +155861,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
155822
155861
|
hasAction: hasAction ? true : void 0,
|
|
155823
155862
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155824
155863
|
insertText,
|
|
155864
|
+
filterText,
|
|
155825
155865
|
replacementSpan,
|
|
155826
155866
|
sourceDisplay,
|
|
155827
155867
|
labelDetails,
|
|
@@ -155842,11 +155882,11 @@ function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
|
155842
155882
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155843
155883
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155844
155884
|
if (!classLikeDeclaration) {
|
|
155845
|
-
return
|
|
155885
|
+
return void 0;
|
|
155846
155886
|
}
|
|
155847
155887
|
let isSnippet;
|
|
155848
|
-
let replacementSpan;
|
|
155849
155888
|
let insertText = name;
|
|
155889
|
+
const filterText = name;
|
|
155850
155890
|
const checker = program.getTypeChecker();
|
|
155851
155891
|
const sourceFile = location.getSourceFile();
|
|
155852
155892
|
const printer = createSnippetPrinter({
|
|
@@ -155875,9 +155915,9 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155875
155915
|
);
|
|
155876
155916
|
}
|
|
155877
155917
|
let modifiers = 0 /* None */;
|
|
155878
|
-
const { modifiers: presentModifiers,
|
|
155879
|
-
const isAbstract =
|
|
155880
|
-
|
|
155918
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155919
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155920
|
+
let completionNodes = [];
|
|
155881
155921
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155882
155922
|
symbol,
|
|
155883
155923
|
classLikeDeclaration,
|
|
@@ -155901,18 +155941,42 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155901
155941
|
requiredModifiers |= 16384 /* Override */;
|
|
155902
155942
|
}
|
|
155903
155943
|
if (!completionNodes.length) {
|
|
155904
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155944
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155905
155945
|
}
|
|
155906
155946
|
node = factory.updateModifiers(node, modifiers);
|
|
155907
155947
|
completionNodes.push(node);
|
|
155908
155948
|
},
|
|
155909
155949
|
body,
|
|
155910
155950
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155911
|
-
isAbstract
|
|
155951
|
+
!!isAbstract
|
|
155912
155952
|
);
|
|
155913
155953
|
if (completionNodes.length) {
|
|
155954
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155955
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155956
|
+
if (!isMethod) {
|
|
155957
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155958
|
+
} else {
|
|
155959
|
+
allowedModifiers |= 512 /* Async */;
|
|
155960
|
+
}
|
|
155961
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155962
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155963
|
+
return void 0;
|
|
155964
|
+
}
|
|
155965
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155966
|
+
modifiers &= ~16 /* Protected */;
|
|
155967
|
+
}
|
|
155968
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155969
|
+
modifiers &= ~4 /* Public */;
|
|
155970
|
+
}
|
|
155971
|
+
modifiers |= allowedAndPresent;
|
|
155972
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155973
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155974
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155975
|
+
if (canHaveDecorators(lastNode)) {
|
|
155976
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155977
|
+
}
|
|
155978
|
+
}
|
|
155914
155979
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155915
|
-
replacementSpan = modifiersSpan;
|
|
155916
155980
|
if (formatContext) {
|
|
155917
155981
|
insertText = printer.printAndFormatSnippetList(
|
|
155918
155982
|
format,
|
|
@@ -155928,24 +155992,29 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155928
155992
|
);
|
|
155929
155993
|
}
|
|
155930
155994
|
}
|
|
155931
|
-
return { insertText, isSnippet, importAdder,
|
|
155995
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155932
155996
|
}
|
|
155933
155997
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155934
155998
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155935
155999
|
return { modifiers: 0 /* None */ };
|
|
155936
156000
|
}
|
|
155937
156001
|
let modifiers = 0 /* None */;
|
|
155938
|
-
let
|
|
156002
|
+
let decorators;
|
|
155939
156003
|
let contextMod;
|
|
155940
|
-
|
|
155941
|
-
|
|
155942
|
-
span = createTextSpanFromNode(contextToken);
|
|
155943
|
-
}
|
|
155944
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
156004
|
+
const range = { pos: position, end: position };
|
|
156005
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155945
156006
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155946
|
-
|
|
156007
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
156008
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
156009
|
+
}
|
|
156010
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
156011
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
156012
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
156013
|
+
modifiers |= contextModifierFlag;
|
|
156014
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
156015
|
+
}
|
|
155947
156016
|
}
|
|
155948
|
-
return { modifiers,
|
|
156017
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155949
156018
|
}
|
|
155950
156019
|
function isModifierLike2(node) {
|
|
155951
156020
|
if (isModifier(node)) {
|
|
@@ -156568,7 +156637,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
156568
156637
|
}
|
|
156569
156638
|
}
|
|
156570
156639
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
156571
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
156640
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
156572
156641
|
host,
|
|
156573
156642
|
program,
|
|
156574
156643
|
compilerOptions,
|
|
@@ -156580,10 +156649,17 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
156580
156649
|
contextToken,
|
|
156581
156650
|
formatContext
|
|
156582
156651
|
);
|
|
156583
|
-
if (importAdder) {
|
|
156652
|
+
if (importAdder || eraseRange) {
|
|
156584
156653
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
156585
156654
|
{ host, formatContext, preferences },
|
|
156586
|
-
|
|
156655
|
+
(tracker) => {
|
|
156656
|
+
if (importAdder) {
|
|
156657
|
+
importAdder.writeFixes(tracker);
|
|
156658
|
+
}
|
|
156659
|
+
if (eraseRange) {
|
|
156660
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
156661
|
+
}
|
|
156662
|
+
}
|
|
156587
156663
|
);
|
|
156588
156664
|
return {
|
|
156589
156665
|
sourceDisplay: void 0,
|
|
@@ -181650,6 +181726,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181650
181726
|
kindModifiers,
|
|
181651
181727
|
sortText,
|
|
181652
181728
|
insertText,
|
|
181729
|
+
filterText,
|
|
181653
181730
|
replacementSpan,
|
|
181654
181731
|
hasAction,
|
|
181655
181732
|
source,
|
|
@@ -181668,6 +181745,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181668
181745
|
kindModifiers,
|
|
181669
181746
|
sortText,
|
|
181670
181747
|
insertText,
|
|
181748
|
+
filterText,
|
|
181671
181749
|
replacementSpan: convertedSpan,
|
|
181672
181750
|
isSnippet,
|
|
181673
181751
|
hasAction: hasAction || void 0,
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -1829,6 +1829,11 @@ declare namespace ts {
|
|
|
1829
1829
|
* coupled with `replacementSpan` to replace a dotted access with a bracket access.
|
|
1830
1830
|
*/
|
|
1831
1831
|
insertText?: string;
|
|
1832
|
+
/**
|
|
1833
|
+
* A string that should be used when filtering a set of
|
|
1834
|
+
* completion items.
|
|
1835
|
+
*/
|
|
1836
|
+
filterText?: string;
|
|
1832
1837
|
/**
|
|
1833
1838
|
* `insertText` should be interpreted as a snippet if true.
|
|
1834
1839
|
*/
|
|
@@ -10801,6 +10806,7 @@ declare namespace ts {
|
|
|
10801
10806
|
kindModifiers?: string;
|
|
10802
10807
|
sortText: string;
|
|
10803
10808
|
insertText?: string;
|
|
10809
|
+
filterText?: string;
|
|
10804
10810
|
isSnippet?: true;
|
|
10805
10811
|
/**
|
|
10806
10812
|
* An optional span that indicates the text to be replaced by this completion item.
|
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.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230518`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20592,7 +20592,8 @@ ${lanes.join("\n")}
|
|
|
20592
20592
|
ensureUseStrict,
|
|
20593
20593
|
liftToBlock,
|
|
20594
20594
|
mergeLexicalEnvironment,
|
|
20595
|
-
updateModifiers
|
|
20595
|
+
updateModifiers,
|
|
20596
|
+
updateModifierLike
|
|
20596
20597
|
};
|
|
20597
20598
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
20598
20599
|
return factory2;
|
|
@@ -24074,6 +24075,9 @@ ${lanes.join("\n")}
|
|
|
24074
24075
|
}
|
|
24075
24076
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node);
|
|
24076
24077
|
}
|
|
24078
|
+
function updateModifierLike(node, modifierArray) {
|
|
24079
|
+
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
24080
|
+
}
|
|
24077
24081
|
function asNodeArray(array) {
|
|
24078
24082
|
return array ? createNodeArray(array) : void 0;
|
|
24079
24083
|
}
|
|
@@ -25516,10 +25520,10 @@ ${lanes.join("\n")}
|
|
|
25516
25520
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
25517
25521
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
25518
25522
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
25519
|
-
if (_ = accept(result.init)) initializers.
|
|
25523
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
25520
25524
|
}
|
|
25521
25525
|
else if (_ = accept(result)) {
|
|
25522
|
-
if (kind === "field") initializers.
|
|
25526
|
+
if (kind === "field") initializers.unshift(_);
|
|
25523
25527
|
else descriptor[key] = _;
|
|
25524
25528
|
}
|
|
25525
25529
|
}
|
|
@@ -56598,7 +56602,35 @@ ${lanes.join("\n")}
|
|
|
56598
56602
|
return emptyArray;
|
|
56599
56603
|
}
|
|
56600
56604
|
function getSignaturesOfType(type, kind) {
|
|
56601
|
-
|
|
56605
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
56606
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
56607
|
+
if (type.arrayFallbackSignatures) {
|
|
56608
|
+
return type.arrayFallbackSignatures;
|
|
56609
|
+
}
|
|
56610
|
+
let memberName;
|
|
56611
|
+
if (everyType(type, (t) => {
|
|
56612
|
+
var _a;
|
|
56613
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
56614
|
+
})) {
|
|
56615
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
56616
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
56617
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
56618
|
+
}
|
|
56619
|
+
type.arrayFallbackSignatures = result;
|
|
56620
|
+
}
|
|
56621
|
+
return result;
|
|
56622
|
+
}
|
|
56623
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
56624
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
56625
|
+
return false;
|
|
56626
|
+
}
|
|
56627
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56628
|
+
}
|
|
56629
|
+
function isReadonlyArraySymbol(symbol) {
|
|
56630
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
56631
|
+
return false;
|
|
56632
|
+
}
|
|
56633
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56602
56634
|
}
|
|
56603
56635
|
function findIndexInfo(indexInfos, keyType) {
|
|
56604
56636
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -72119,8 +72151,9 @@ ${lanes.join("\n")}
|
|
|
72119
72151
|
void 0,
|
|
72120
72152
|
checkMode
|
|
72121
72153
|
);
|
|
72154
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
72122
72155
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
72123
|
-
|
|
72156
|
+
checkAttributesType,
|
|
72124
72157
|
paramType,
|
|
72125
72158
|
relation,
|
|
72126
72159
|
reportErrors2 ? node.tagName : void 0,
|
|
@@ -152191,7 +152224,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152191
152224
|
false
|
|
152192
152225
|
);
|
|
152193
152226
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
152194
|
-
let modifierFlags = effectiveModifierFlags &
|
|
152227
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
152228
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
152195
152229
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
152196
152230
|
modifierFlags |= 128 /* Accessor */;
|
|
152197
152231
|
}
|
|
@@ -154948,6 +154982,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154948
154982
|
}
|
|
154949
154983
|
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) {
|
|
154950
154984
|
let insertText;
|
|
154985
|
+
let filterText;
|
|
154951
154986
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
154952
154987
|
let data;
|
|
154953
154988
|
let isSnippet;
|
|
@@ -155006,11 +155041,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155006
155041
|
}
|
|
155007
155042
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155008
155043
|
let importAdder;
|
|
155009
|
-
|
|
155010
|
-
|
|
155011
|
-
|
|
155012
|
-
|
|
155013
|
-
|
|
155044
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155045
|
+
if (memberCompletionEntry) {
|
|
155046
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155047
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155048
|
+
hasAction = true;
|
|
155049
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155050
|
+
}
|
|
155051
|
+
} else {
|
|
155052
|
+
return void 0;
|
|
155014
155053
|
}
|
|
155015
155054
|
}
|
|
155016
155055
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155054,6 +155093,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155054
155093
|
hasAction: hasAction ? true : void 0,
|
|
155055
155094
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155056
155095
|
insertText,
|
|
155096
|
+
filterText,
|
|
155057
155097
|
replacementSpan,
|
|
155058
155098
|
sourceDisplay,
|
|
155059
155099
|
labelDetails,
|
|
@@ -155074,11 +155114,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155074
155114
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155075
155115
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155076
155116
|
if (!classLikeDeclaration) {
|
|
155077
|
-
return
|
|
155117
|
+
return void 0;
|
|
155078
155118
|
}
|
|
155079
155119
|
let isSnippet;
|
|
155080
|
-
let replacementSpan;
|
|
155081
155120
|
let insertText = name;
|
|
155121
|
+
const filterText = name;
|
|
155082
155122
|
const checker = program.getTypeChecker();
|
|
155083
155123
|
const sourceFile = location.getSourceFile();
|
|
155084
155124
|
const printer = createSnippetPrinter({
|
|
@@ -155107,9 +155147,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155107
155147
|
);
|
|
155108
155148
|
}
|
|
155109
155149
|
let modifiers = 0 /* None */;
|
|
155110
|
-
const { modifiers: presentModifiers,
|
|
155111
|
-
const isAbstract =
|
|
155112
|
-
|
|
155150
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155151
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155152
|
+
let completionNodes = [];
|
|
155113
155153
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155114
155154
|
symbol,
|
|
155115
155155
|
classLikeDeclaration,
|
|
@@ -155133,18 +155173,42 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155133
155173
|
requiredModifiers |= 16384 /* Override */;
|
|
155134
155174
|
}
|
|
155135
155175
|
if (!completionNodes.length) {
|
|
155136
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155176
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155137
155177
|
}
|
|
155138
155178
|
node = factory.updateModifiers(node, modifiers);
|
|
155139
155179
|
completionNodes.push(node);
|
|
155140
155180
|
},
|
|
155141
155181
|
body,
|
|
155142
155182
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155143
|
-
isAbstract
|
|
155183
|
+
!!isAbstract
|
|
155144
155184
|
);
|
|
155145
155185
|
if (completionNodes.length) {
|
|
155186
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155187
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155188
|
+
if (!isMethod) {
|
|
155189
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155190
|
+
} else {
|
|
155191
|
+
allowedModifiers |= 512 /* Async */;
|
|
155192
|
+
}
|
|
155193
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155194
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155195
|
+
return void 0;
|
|
155196
|
+
}
|
|
155197
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155198
|
+
modifiers &= ~16 /* Protected */;
|
|
155199
|
+
}
|
|
155200
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155201
|
+
modifiers &= ~4 /* Public */;
|
|
155202
|
+
}
|
|
155203
|
+
modifiers |= allowedAndPresent;
|
|
155204
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155205
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155206
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155207
|
+
if (canHaveDecorators(lastNode)) {
|
|
155208
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155209
|
+
}
|
|
155210
|
+
}
|
|
155146
155211
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155147
|
-
replacementSpan = modifiersSpan;
|
|
155148
155212
|
if (formatContext) {
|
|
155149
155213
|
insertText = printer.printAndFormatSnippetList(
|
|
155150
155214
|
format,
|
|
@@ -155160,24 +155224,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155160
155224
|
);
|
|
155161
155225
|
}
|
|
155162
155226
|
}
|
|
155163
|
-
return { insertText, isSnippet, importAdder,
|
|
155227
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155164
155228
|
}
|
|
155165
155229
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155166
155230
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155167
155231
|
return { modifiers: 0 /* None */ };
|
|
155168
155232
|
}
|
|
155169
155233
|
let modifiers = 0 /* None */;
|
|
155170
|
-
let
|
|
155234
|
+
let decorators;
|
|
155171
155235
|
let contextMod;
|
|
155172
|
-
|
|
155173
|
-
|
|
155174
|
-
span = createTextSpanFromNode(contextToken);
|
|
155175
|
-
}
|
|
155176
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
155236
|
+
const range = { pos: position, end: position };
|
|
155237
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155177
155238
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155178
|
-
|
|
155239
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
155240
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
155241
|
+
}
|
|
155242
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
155243
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
155244
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
155245
|
+
modifiers |= contextModifierFlag;
|
|
155246
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
155247
|
+
}
|
|
155179
155248
|
}
|
|
155180
|
-
return { modifiers,
|
|
155249
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155181
155250
|
}
|
|
155182
155251
|
function isModifierLike2(node) {
|
|
155183
155252
|
if (isModifier(node)) {
|
|
@@ -155800,7 +155869,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155800
155869
|
}
|
|
155801
155870
|
}
|
|
155802
155871
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
155803
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
155872
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
155804
155873
|
host,
|
|
155805
155874
|
program,
|
|
155806
155875
|
compilerOptions,
|
|
@@ -155812,10 +155881,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155812
155881
|
contextToken,
|
|
155813
155882
|
formatContext
|
|
155814
155883
|
);
|
|
155815
|
-
if (importAdder) {
|
|
155884
|
+
if (importAdder || eraseRange) {
|
|
155816
155885
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
155817
155886
|
{ host, formatContext, preferences },
|
|
155818
|
-
|
|
155887
|
+
(tracker) => {
|
|
155888
|
+
if (importAdder) {
|
|
155889
|
+
importAdder.writeFixes(tracker);
|
|
155890
|
+
}
|
|
155891
|
+
if (eraseRange) {
|
|
155892
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
155893
|
+
}
|
|
155894
|
+
}
|
|
155819
155895
|
);
|
|
155820
155896
|
return {
|
|
155821
155897
|
sourceDisplay: void 0,
|
|
@@ -179088,6 +179164,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179088
179164
|
kindModifiers,
|
|
179089
179165
|
sortText,
|
|
179090
179166
|
insertText,
|
|
179167
|
+
filterText,
|
|
179091
179168
|
replacementSpan,
|
|
179092
179169
|
hasAction,
|
|
179093
179170
|
source,
|
|
@@ -179106,6 +179183,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179106
179183
|
kindModifiers,
|
|
179107
179184
|
sortText,
|
|
179108
179185
|
insertText,
|
|
179186
|
+
filterText,
|
|
179109
179187
|
replacementSpan: convertedSpan,
|
|
179110
179188
|
isSnippet,
|
|
179111
179189
|
hasAction: hasAction || void 0,
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6838,6 +6838,7 @@ declare namespace ts {
|
|
|
6838
6838
|
kindModifiers?: string;
|
|
6839
6839
|
sortText: string;
|
|
6840
6840
|
insertText?: string;
|
|
6841
|
+
filterText?: string;
|
|
6841
6842
|
isSnippet?: true;
|
|
6842
6843
|
/**
|
|
6843
6844
|
* An optional span that indicates the text to be replaced by this completion item.
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230518`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20592,7 +20592,8 @@ ${lanes.join("\n")}
|
|
|
20592
20592
|
ensureUseStrict,
|
|
20593
20593
|
liftToBlock,
|
|
20594
20594
|
mergeLexicalEnvironment,
|
|
20595
|
-
updateModifiers
|
|
20595
|
+
updateModifiers,
|
|
20596
|
+
updateModifierLike
|
|
20596
20597
|
};
|
|
20597
20598
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
20598
20599
|
return factory2;
|
|
@@ -24074,6 +24075,9 @@ ${lanes.join("\n")}
|
|
|
24074
24075
|
}
|
|
24075
24076
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node);
|
|
24076
24077
|
}
|
|
24078
|
+
function updateModifierLike(node, modifierArray) {
|
|
24079
|
+
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
24080
|
+
}
|
|
24077
24081
|
function asNodeArray(array) {
|
|
24078
24082
|
return array ? createNodeArray(array) : void 0;
|
|
24079
24083
|
}
|
|
@@ -25516,10 +25520,10 @@ ${lanes.join("\n")}
|
|
|
25516
25520
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
25517
25521
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
25518
25522
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
25519
|
-
if (_ = accept(result.init)) initializers.
|
|
25523
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
25520
25524
|
}
|
|
25521
25525
|
else if (_ = accept(result)) {
|
|
25522
|
-
if (kind === "field") initializers.
|
|
25526
|
+
if (kind === "field") initializers.unshift(_);
|
|
25523
25527
|
else descriptor[key] = _;
|
|
25524
25528
|
}
|
|
25525
25529
|
}
|
|
@@ -56598,7 +56602,35 @@ ${lanes.join("\n")}
|
|
|
56598
56602
|
return emptyArray;
|
|
56599
56603
|
}
|
|
56600
56604
|
function getSignaturesOfType(type, kind) {
|
|
56601
|
-
|
|
56605
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
56606
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
56607
|
+
if (type.arrayFallbackSignatures) {
|
|
56608
|
+
return type.arrayFallbackSignatures;
|
|
56609
|
+
}
|
|
56610
|
+
let memberName;
|
|
56611
|
+
if (everyType(type, (t) => {
|
|
56612
|
+
var _a;
|
|
56613
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
56614
|
+
})) {
|
|
56615
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
56616
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
56617
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
56618
|
+
}
|
|
56619
|
+
type.arrayFallbackSignatures = result;
|
|
56620
|
+
}
|
|
56621
|
+
return result;
|
|
56622
|
+
}
|
|
56623
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
56624
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
56625
|
+
return false;
|
|
56626
|
+
}
|
|
56627
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56628
|
+
}
|
|
56629
|
+
function isReadonlyArraySymbol(symbol) {
|
|
56630
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
56631
|
+
return false;
|
|
56632
|
+
}
|
|
56633
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56602
56634
|
}
|
|
56603
56635
|
function findIndexInfo(indexInfos, keyType) {
|
|
56604
56636
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -72119,8 +72151,9 @@ ${lanes.join("\n")}
|
|
|
72119
72151
|
void 0,
|
|
72120
72152
|
checkMode
|
|
72121
72153
|
);
|
|
72154
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
72122
72155
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
72123
|
-
|
|
72156
|
+
checkAttributesType,
|
|
72124
72157
|
paramType,
|
|
72125
72158
|
relation,
|
|
72126
72159
|
reportErrors2 ? node.tagName : void 0,
|
|
@@ -152206,7 +152239,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152206
152239
|
false
|
|
152207
152240
|
);
|
|
152208
152241
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
152209
|
-
let modifierFlags = effectiveModifierFlags &
|
|
152242
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
152243
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
152210
152244
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
152211
152245
|
modifierFlags |= 128 /* Accessor */;
|
|
152212
152246
|
}
|
|
@@ -154963,6 +154997,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154963
154997
|
}
|
|
154964
154998
|
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) {
|
|
154965
154999
|
let insertText;
|
|
155000
|
+
let filterText;
|
|
154966
155001
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
154967
155002
|
let data;
|
|
154968
155003
|
let isSnippet;
|
|
@@ -155021,11 +155056,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155021
155056
|
}
|
|
155022
155057
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155023
155058
|
let importAdder;
|
|
155024
|
-
|
|
155025
|
-
|
|
155026
|
-
|
|
155027
|
-
|
|
155028
|
-
|
|
155059
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155060
|
+
if (memberCompletionEntry) {
|
|
155061
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155062
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155063
|
+
hasAction = true;
|
|
155064
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155065
|
+
}
|
|
155066
|
+
} else {
|
|
155067
|
+
return void 0;
|
|
155029
155068
|
}
|
|
155030
155069
|
}
|
|
155031
155070
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155069,6 +155108,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155069
155108
|
hasAction: hasAction ? true : void 0,
|
|
155070
155109
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155071
155110
|
insertText,
|
|
155111
|
+
filterText,
|
|
155072
155112
|
replacementSpan,
|
|
155073
155113
|
sourceDisplay,
|
|
155074
155114
|
labelDetails,
|
|
@@ -155089,11 +155129,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155089
155129
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155090
155130
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155091
155131
|
if (!classLikeDeclaration) {
|
|
155092
|
-
return
|
|
155132
|
+
return void 0;
|
|
155093
155133
|
}
|
|
155094
155134
|
let isSnippet;
|
|
155095
|
-
let replacementSpan;
|
|
155096
155135
|
let insertText = name;
|
|
155136
|
+
const filterText = name;
|
|
155097
155137
|
const checker = program.getTypeChecker();
|
|
155098
155138
|
const sourceFile = location.getSourceFile();
|
|
155099
155139
|
const printer = createSnippetPrinter({
|
|
@@ -155122,9 +155162,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155122
155162
|
);
|
|
155123
155163
|
}
|
|
155124
155164
|
let modifiers = 0 /* None */;
|
|
155125
|
-
const { modifiers: presentModifiers,
|
|
155126
|
-
const isAbstract =
|
|
155127
|
-
|
|
155165
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155166
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155167
|
+
let completionNodes = [];
|
|
155128
155168
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155129
155169
|
symbol,
|
|
155130
155170
|
classLikeDeclaration,
|
|
@@ -155148,18 +155188,42 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155148
155188
|
requiredModifiers |= 16384 /* Override */;
|
|
155149
155189
|
}
|
|
155150
155190
|
if (!completionNodes.length) {
|
|
155151
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155191
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155152
155192
|
}
|
|
155153
155193
|
node = factory.updateModifiers(node, modifiers);
|
|
155154
155194
|
completionNodes.push(node);
|
|
155155
155195
|
},
|
|
155156
155196
|
body,
|
|
155157
155197
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155158
|
-
isAbstract
|
|
155198
|
+
!!isAbstract
|
|
155159
155199
|
);
|
|
155160
155200
|
if (completionNodes.length) {
|
|
155201
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155202
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155203
|
+
if (!isMethod) {
|
|
155204
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155205
|
+
} else {
|
|
155206
|
+
allowedModifiers |= 512 /* Async */;
|
|
155207
|
+
}
|
|
155208
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155209
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155210
|
+
return void 0;
|
|
155211
|
+
}
|
|
155212
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155213
|
+
modifiers &= ~16 /* Protected */;
|
|
155214
|
+
}
|
|
155215
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155216
|
+
modifiers &= ~4 /* Public */;
|
|
155217
|
+
}
|
|
155218
|
+
modifiers |= allowedAndPresent;
|
|
155219
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155220
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155221
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155222
|
+
if (canHaveDecorators(lastNode)) {
|
|
155223
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155224
|
+
}
|
|
155225
|
+
}
|
|
155161
155226
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155162
|
-
replacementSpan = modifiersSpan;
|
|
155163
155227
|
if (formatContext) {
|
|
155164
155228
|
insertText = printer.printAndFormatSnippetList(
|
|
155165
155229
|
format,
|
|
@@ -155175,24 +155239,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155175
155239
|
);
|
|
155176
155240
|
}
|
|
155177
155241
|
}
|
|
155178
|
-
return { insertText, isSnippet, importAdder,
|
|
155242
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155179
155243
|
}
|
|
155180
155244
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155181
155245
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155182
155246
|
return { modifiers: 0 /* None */ };
|
|
155183
155247
|
}
|
|
155184
155248
|
let modifiers = 0 /* None */;
|
|
155185
|
-
let
|
|
155249
|
+
let decorators;
|
|
155186
155250
|
let contextMod;
|
|
155187
|
-
|
|
155188
|
-
|
|
155189
|
-
span = createTextSpanFromNode(contextToken);
|
|
155190
|
-
}
|
|
155191
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
155251
|
+
const range = { pos: position, end: position };
|
|
155252
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155192
155253
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155193
|
-
|
|
155254
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
155255
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
155256
|
+
}
|
|
155257
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
155258
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
155259
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
155260
|
+
modifiers |= contextModifierFlag;
|
|
155261
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
155262
|
+
}
|
|
155194
155263
|
}
|
|
155195
|
-
return { modifiers,
|
|
155264
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155196
155265
|
}
|
|
155197
155266
|
function isModifierLike2(node) {
|
|
155198
155267
|
if (isModifier(node)) {
|
|
@@ -155815,7 +155884,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155815
155884
|
}
|
|
155816
155885
|
}
|
|
155817
155886
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
155818
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
155887
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
155819
155888
|
host,
|
|
155820
155889
|
program,
|
|
155821
155890
|
compilerOptions,
|
|
@@ -155827,10 +155896,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155827
155896
|
contextToken,
|
|
155828
155897
|
formatContext
|
|
155829
155898
|
);
|
|
155830
|
-
if (importAdder) {
|
|
155899
|
+
if (importAdder || eraseRange) {
|
|
155831
155900
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
155832
155901
|
{ host, formatContext, preferences },
|
|
155833
|
-
|
|
155902
|
+
(tracker) => {
|
|
155903
|
+
if (importAdder) {
|
|
155904
|
+
importAdder.writeFixes(tracker);
|
|
155905
|
+
}
|
|
155906
|
+
if (eraseRange) {
|
|
155907
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
155908
|
+
}
|
|
155909
|
+
}
|
|
155834
155910
|
);
|
|
155835
155911
|
return {
|
|
155836
155912
|
sourceDisplay: void 0,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230518`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -12891,7 +12891,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
12891
12891
|
ensureUseStrict,
|
|
12892
12892
|
liftToBlock,
|
|
12893
12893
|
mergeLexicalEnvironment,
|
|
12894
|
-
updateModifiers
|
|
12894
|
+
updateModifiers,
|
|
12895
|
+
updateModifierLike
|
|
12895
12896
|
};
|
|
12896
12897
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
12897
12898
|
return factory2;
|
|
@@ -16373,6 +16374,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
16373
16374
|
}
|
|
16374
16375
|
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node);
|
|
16375
16376
|
}
|
|
16377
|
+
function updateModifierLike(node, modifierArray) {
|
|
16378
|
+
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
16379
|
+
}
|
|
16376
16380
|
function asNodeArray(array) {
|
|
16377
16381
|
return array ? createNodeArray(array) : void 0;
|
|
16378
16382
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-dev.
|
|
5
|
+
"version": "5.2.0-dev.20230518",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "174599c5542c38ee8f1fc61c9ca6532b68cbb19c"
|
|
117
117
|
}
|