typescript 5.2.0-dev.20230517 → 5.2.0-dev.20230519
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 +9 -4
- package/lib/tsserver.js +88 -33
- package/lib/tsserverlibrary.d.ts +8 -0
- package/lib/tsserverlibrary.js +88 -33
- package/lib/typescript.d.ts +2 -0
- package/lib/typescript.js +84 -32
- package/lib/typingsInstaller.js +7 -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.20230519`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7704,6 +7704,7 @@ var Diagnostics = {
|
|
|
7704
7704
|
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
7705
7705
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
7706
7706
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
7707
|
+
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
7707
7708
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7708
7709
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7709
7710
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -18559,7 +18560,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18559
18560
|
ensureUseStrict,
|
|
18560
18561
|
liftToBlock,
|
|
18561
18562
|
mergeLexicalEnvironment,
|
|
18562
|
-
updateModifiers
|
|
18563
|
+
updateModifiers,
|
|
18564
|
+
updateModifierLike
|
|
18563
18565
|
};
|
|
18564
18566
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
18565
18567
|
return factory2;
|
|
@@ -22041,6 +22043,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22041
22043
|
}
|
|
22042
22044
|
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
22045
|
}
|
|
22046
|
+
function updateModifierLike(node, modifierArray) {
|
|
22047
|
+
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);
|
|
22048
|
+
}
|
|
22044
22049
|
function asNodeArray(array) {
|
|
22045
22050
|
return array ? createNodeArray(array) : void 0;
|
|
22046
22051
|
}
|
|
@@ -23366,10 +23371,10 @@ var esDecorateHelper = {
|
|
|
23366
23371
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23367
23372
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
23368
23373
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
23369
|
-
if (_ = accept(result.init)) initializers.
|
|
23374
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
23370
23375
|
}
|
|
23371
23376
|
else if (_ = accept(result)) {
|
|
23372
|
-
if (kind === "field") initializers.
|
|
23377
|
+
if (kind === "field") initializers.unshift(_);
|
|
23373
23378
|
else descriptor[key] = _;
|
|
23374
23379
|
}
|
|
23375
23380
|
}
|
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.20230519`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11212,6 +11212,7 @@ var Diagnostics = {
|
|
|
11212
11212
|
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
11213
11213
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
11214
11214
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
11215
|
+
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
11215
11216
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
11216
11217
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
11217
11218
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -22754,7 +22755,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22754
22755
|
ensureUseStrict,
|
|
22755
22756
|
liftToBlock,
|
|
22756
22757
|
mergeLexicalEnvironment,
|
|
22757
|
-
updateModifiers
|
|
22758
|
+
updateModifiers,
|
|
22759
|
+
updateModifierLike
|
|
22758
22760
|
};
|
|
22759
22761
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
22760
22762
|
return factory2;
|
|
@@ -26236,6 +26238,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26236
26238
|
}
|
|
26237
26239
|
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
26240
|
}
|
|
26241
|
+
function updateModifierLike(node, modifierArray) {
|
|
26242
|
+
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);
|
|
26243
|
+
}
|
|
26239
26244
|
function asNodeArray(array) {
|
|
26240
26245
|
return array ? createNodeArray(array) : void 0;
|
|
26241
26246
|
}
|
|
@@ -27617,10 +27622,10 @@ var esDecorateHelper = {
|
|
|
27617
27622
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
27618
27623
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
27619
27624
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
27620
|
-
if (_ = accept(result.init)) initializers.
|
|
27625
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
27621
27626
|
}
|
|
27622
27627
|
else if (_ = accept(result)) {
|
|
27623
|
-
if (kind === "field") initializers.
|
|
27628
|
+
if (kind === "field") initializers.unshift(_);
|
|
27624
27629
|
else descriptor[key] = _;
|
|
27625
27630
|
}
|
|
27626
27631
|
}
|
|
@@ -136490,8 +136495,12 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
136490
136495
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
136491
136496
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
136492
136497
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
136493
|
-
const
|
|
136494
|
-
|
|
136498
|
+
const targetFile = interactiveRefactorArguments.targetFile;
|
|
136499
|
+
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
136500
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
136501
|
+
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
136502
|
+
}
|
|
136503
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) };
|
|
136495
136504
|
}
|
|
136496
136505
|
});
|
|
136497
136506
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
@@ -153173,7 +153182,8 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
|
|
|
153173
153182
|
false
|
|
153174
153183
|
);
|
|
153175
153184
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
153176
|
-
let modifierFlags = effectiveModifierFlags &
|
|
153185
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
153186
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
153177
153187
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
153178
153188
|
modifierFlags |= 128 /* Accessor */;
|
|
153179
153189
|
}
|
|
@@ -155745,6 +155755,7 @@ function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
|
155745
155755
|
}
|
|
155746
155756
|
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) {
|
|
155747
155757
|
let insertText;
|
|
155758
|
+
let filterText;
|
|
155748
155759
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
155749
155760
|
let data;
|
|
155750
155761
|
let isSnippet;
|
|
@@ -155803,11 +155814,15 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
155803
155814
|
}
|
|
155804
155815
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155805
155816
|
let importAdder;
|
|
155806
|
-
|
|
155807
|
-
|
|
155808
|
-
|
|
155809
|
-
|
|
155810
|
-
|
|
155817
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155818
|
+
if (memberCompletionEntry) {
|
|
155819
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155820
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155821
|
+
hasAction = true;
|
|
155822
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155823
|
+
}
|
|
155824
|
+
} else {
|
|
155825
|
+
return void 0;
|
|
155811
155826
|
}
|
|
155812
155827
|
}
|
|
155813
155828
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155851,6 +155866,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
155851
155866
|
hasAction: hasAction ? true : void 0,
|
|
155852
155867
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155853
155868
|
insertText,
|
|
155869
|
+
filterText,
|
|
155854
155870
|
replacementSpan,
|
|
155855
155871
|
sourceDisplay,
|
|
155856
155872
|
labelDetails,
|
|
@@ -155871,11 +155887,11 @@ function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
|
155871
155887
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155872
155888
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155873
155889
|
if (!classLikeDeclaration) {
|
|
155874
|
-
return
|
|
155890
|
+
return void 0;
|
|
155875
155891
|
}
|
|
155876
155892
|
let isSnippet;
|
|
155877
|
-
let replacementSpan;
|
|
155878
155893
|
let insertText = name;
|
|
155894
|
+
const filterText = name;
|
|
155879
155895
|
const checker = program.getTypeChecker();
|
|
155880
155896
|
const sourceFile = location.getSourceFile();
|
|
155881
155897
|
const printer = createSnippetPrinter({
|
|
@@ -155904,9 +155920,9 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155904
155920
|
);
|
|
155905
155921
|
}
|
|
155906
155922
|
let modifiers = 0 /* None */;
|
|
155907
|
-
const { modifiers: presentModifiers,
|
|
155908
|
-
const isAbstract =
|
|
155909
|
-
|
|
155923
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155924
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155925
|
+
let completionNodes = [];
|
|
155910
155926
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155911
155927
|
symbol,
|
|
155912
155928
|
classLikeDeclaration,
|
|
@@ -155930,18 +155946,42 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155930
155946
|
requiredModifiers |= 16384 /* Override */;
|
|
155931
155947
|
}
|
|
155932
155948
|
if (!completionNodes.length) {
|
|
155933
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155949
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155934
155950
|
}
|
|
155935
155951
|
node = factory.updateModifiers(node, modifiers);
|
|
155936
155952
|
completionNodes.push(node);
|
|
155937
155953
|
},
|
|
155938
155954
|
body,
|
|
155939
155955
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155940
|
-
isAbstract
|
|
155956
|
+
!!isAbstract
|
|
155941
155957
|
);
|
|
155942
155958
|
if (completionNodes.length) {
|
|
155959
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155960
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155961
|
+
if (!isMethod) {
|
|
155962
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155963
|
+
} else {
|
|
155964
|
+
allowedModifiers |= 512 /* Async */;
|
|
155965
|
+
}
|
|
155966
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155967
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155968
|
+
return void 0;
|
|
155969
|
+
}
|
|
155970
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155971
|
+
modifiers &= ~16 /* Protected */;
|
|
155972
|
+
}
|
|
155973
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155974
|
+
modifiers &= ~4 /* Public */;
|
|
155975
|
+
}
|
|
155976
|
+
modifiers |= allowedAndPresent;
|
|
155977
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155978
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155979
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155980
|
+
if (canHaveDecorators(lastNode)) {
|
|
155981
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155982
|
+
}
|
|
155983
|
+
}
|
|
155943
155984
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155944
|
-
replacementSpan = modifiersSpan;
|
|
155945
155985
|
if (formatContext) {
|
|
155946
155986
|
insertText = printer.printAndFormatSnippetList(
|
|
155947
155987
|
format,
|
|
@@ -155957,24 +155997,29 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
155957
155997
|
);
|
|
155958
155998
|
}
|
|
155959
155999
|
}
|
|
155960
|
-
return { insertText, isSnippet, importAdder,
|
|
156000
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155961
156001
|
}
|
|
155962
156002
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155963
156003
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155964
156004
|
return { modifiers: 0 /* None */ };
|
|
155965
156005
|
}
|
|
155966
156006
|
let modifiers = 0 /* None */;
|
|
155967
|
-
let
|
|
156007
|
+
let decorators;
|
|
155968
156008
|
let contextMod;
|
|
155969
|
-
|
|
155970
|
-
|
|
155971
|
-
span = createTextSpanFromNode(contextToken);
|
|
155972
|
-
}
|
|
155973
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
156009
|
+
const range = { pos: position, end: position };
|
|
156010
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155974
156011
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155975
|
-
|
|
156012
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
156013
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
155976
156014
|
}
|
|
155977
|
-
|
|
156015
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
156016
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
156017
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
156018
|
+
modifiers |= contextModifierFlag;
|
|
156019
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
156020
|
+
}
|
|
156021
|
+
}
|
|
156022
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155978
156023
|
}
|
|
155979
156024
|
function isModifierLike2(node) {
|
|
155980
156025
|
if (isModifier(node)) {
|
|
@@ -156597,7 +156642,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
156597
156642
|
}
|
|
156598
156643
|
}
|
|
156599
156644
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
156600
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
156645
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
156601
156646
|
host,
|
|
156602
156647
|
program,
|
|
156603
156648
|
compilerOptions,
|
|
@@ -156609,10 +156654,17 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
156609
156654
|
contextToken,
|
|
156610
156655
|
formatContext
|
|
156611
156656
|
);
|
|
156612
|
-
if (importAdder) {
|
|
156657
|
+
if (importAdder || eraseRange) {
|
|
156613
156658
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
156614
156659
|
{ host, formatContext, preferences },
|
|
156615
|
-
|
|
156660
|
+
(tracker) => {
|
|
156661
|
+
if (importAdder) {
|
|
156662
|
+
importAdder.writeFixes(tracker);
|
|
156663
|
+
}
|
|
156664
|
+
if (eraseRange) {
|
|
156665
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
156666
|
+
}
|
|
156667
|
+
}
|
|
156616
156668
|
);
|
|
156617
156669
|
return {
|
|
156618
156670
|
sourceDisplay: void 0,
|
|
@@ -181679,6 +181731,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181679
181731
|
kindModifiers,
|
|
181680
181732
|
sortText,
|
|
181681
181733
|
insertText,
|
|
181734
|
+
filterText,
|
|
181682
181735
|
replacementSpan,
|
|
181683
181736
|
hasAction,
|
|
181684
181737
|
source,
|
|
@@ -181697,6 +181750,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181697
181750
|
kindModifiers,
|
|
181698
181751
|
sortText,
|
|
181699
181752
|
insertText,
|
|
181753
|
+
filterText,
|
|
181700
181754
|
replacementSpan: convertedSpan,
|
|
181701
181755
|
isSnippet,
|
|
181702
181756
|
hasAction: hasAction || void 0,
|
|
@@ -182068,7 +182122,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
182068
182122
|
return {
|
|
182069
182123
|
renameLocation: mappedRenameLocation,
|
|
182070
182124
|
renameFilename,
|
|
182071
|
-
edits: this.mapTextChangesToCodeEdits(edits)
|
|
182125
|
+
edits: this.mapTextChangesToCodeEdits(edits),
|
|
182126
|
+
notApplicableReason: result.notApplicableReason
|
|
182072
182127
|
};
|
|
182073
182128
|
}
|
|
182074
182129
|
return result;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -619,6 +619,7 @@ declare namespace ts {
|
|
|
619
619
|
*/
|
|
620
620
|
renameLocation?: Location;
|
|
621
621
|
renameFilename?: string;
|
|
622
|
+
notApplicableReason?: string;
|
|
622
623
|
}
|
|
623
624
|
/**
|
|
624
625
|
* Organize imports by:
|
|
@@ -1829,6 +1830,11 @@ declare namespace ts {
|
|
|
1829
1830
|
* coupled with `replacementSpan` to replace a dotted access with a bracket access.
|
|
1830
1831
|
*/
|
|
1831
1832
|
insertText?: string;
|
|
1833
|
+
/**
|
|
1834
|
+
* A string that should be used when filtering a set of
|
|
1835
|
+
* completion items.
|
|
1836
|
+
*/
|
|
1837
|
+
filterText?: string;
|
|
1832
1838
|
/**
|
|
1833
1839
|
* `insertText` should be interpreted as a snippet if true.
|
|
1834
1840
|
*/
|
|
@@ -10480,6 +10486,7 @@ declare namespace ts {
|
|
|
10480
10486
|
renameFilename?: string;
|
|
10481
10487
|
renameLocation?: number;
|
|
10482
10488
|
commands?: CodeActionCommand[];
|
|
10489
|
+
notApplicableReason?: string;
|
|
10483
10490
|
}
|
|
10484
10491
|
type RefactorTriggerReason = "implicit" | "invoked";
|
|
10485
10492
|
interface TextInsertion {
|
|
@@ -10801,6 +10808,7 @@ declare namespace ts {
|
|
|
10801
10808
|
kindModifiers?: string;
|
|
10802
10809
|
sortText: string;
|
|
10803
10810
|
insertText?: string;
|
|
10811
|
+
filterText?: string;
|
|
10804
10812
|
isSnippet?: true;
|
|
10805
10813
|
/**
|
|
10806
10814
|
* 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.20230519`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9018,6 +9018,7 @@ ${lanes.join("\n")}
|
|
|
9018
9018
|
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
9019
9019
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
9020
9020
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
9021
|
+
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
9021
9022
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9022
9023
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9023
9024
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -20592,7 +20593,8 @@ ${lanes.join("\n")}
|
|
|
20592
20593
|
ensureUseStrict,
|
|
20593
20594
|
liftToBlock,
|
|
20594
20595
|
mergeLexicalEnvironment,
|
|
20595
|
-
updateModifiers
|
|
20596
|
+
updateModifiers,
|
|
20597
|
+
updateModifierLike
|
|
20596
20598
|
};
|
|
20597
20599
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
20598
20600
|
return factory2;
|
|
@@ -24074,6 +24076,9 @@ ${lanes.join("\n")}
|
|
|
24074
24076
|
}
|
|
24075
24077
|
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
24078
|
}
|
|
24079
|
+
function updateModifierLike(node, modifierArray) {
|
|
24080
|
+
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);
|
|
24081
|
+
}
|
|
24077
24082
|
function asNodeArray(array) {
|
|
24078
24083
|
return array ? createNodeArray(array) : void 0;
|
|
24079
24084
|
}
|
|
@@ -25516,10 +25521,10 @@ ${lanes.join("\n")}
|
|
|
25516
25521
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
25517
25522
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
25518
25523
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
25519
|
-
if (_ = accept(result.init)) initializers.
|
|
25524
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
25520
25525
|
}
|
|
25521
25526
|
else if (_ = accept(result)) {
|
|
25522
|
-
if (kind === "field") initializers.
|
|
25527
|
+
if (kind === "field") initializers.unshift(_);
|
|
25523
25528
|
else descriptor[key] = _;
|
|
25524
25529
|
}
|
|
25525
25530
|
}
|
|
@@ -135737,8 +135742,12 @@ ${lanes.join("\n")}
|
|
|
135737
135742
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
135738
135743
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
135739
135744
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
135740
|
-
const
|
|
135741
|
-
|
|
135745
|
+
const targetFile = interactiveRefactorArguments.targetFile;
|
|
135746
|
+
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
135747
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
135748
|
+
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
135749
|
+
}
|
|
135750
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) };
|
|
135742
135751
|
}
|
|
135743
135752
|
});
|
|
135744
135753
|
}
|
|
@@ -152220,7 +152229,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152220
152229
|
false
|
|
152221
152230
|
);
|
|
152222
152231
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
152223
|
-
let modifierFlags = effectiveModifierFlags &
|
|
152232
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
152233
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
152224
152234
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
152225
152235
|
modifierFlags |= 128 /* Accessor */;
|
|
152226
152236
|
}
|
|
@@ -154977,6 +154987,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154977
154987
|
}
|
|
154978
154988
|
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) {
|
|
154979
154989
|
let insertText;
|
|
154990
|
+
let filterText;
|
|
154980
154991
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
154981
154992
|
let data;
|
|
154982
154993
|
let isSnippet;
|
|
@@ -155035,11 +155046,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155035
155046
|
}
|
|
155036
155047
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155037
155048
|
let importAdder;
|
|
155038
|
-
|
|
155039
|
-
|
|
155040
|
-
|
|
155041
|
-
|
|
155042
|
-
|
|
155049
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155050
|
+
if (memberCompletionEntry) {
|
|
155051
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155052
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155053
|
+
hasAction = true;
|
|
155054
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155055
|
+
}
|
|
155056
|
+
} else {
|
|
155057
|
+
return void 0;
|
|
155043
155058
|
}
|
|
155044
155059
|
}
|
|
155045
155060
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155083,6 +155098,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155083
155098
|
hasAction: hasAction ? true : void 0,
|
|
155084
155099
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155085
155100
|
insertText,
|
|
155101
|
+
filterText,
|
|
155086
155102
|
replacementSpan,
|
|
155087
155103
|
sourceDisplay,
|
|
155088
155104
|
labelDetails,
|
|
@@ -155103,11 +155119,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155103
155119
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155104
155120
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155105
155121
|
if (!classLikeDeclaration) {
|
|
155106
|
-
return
|
|
155122
|
+
return void 0;
|
|
155107
155123
|
}
|
|
155108
155124
|
let isSnippet;
|
|
155109
|
-
let replacementSpan;
|
|
155110
155125
|
let insertText = name;
|
|
155126
|
+
const filterText = name;
|
|
155111
155127
|
const checker = program.getTypeChecker();
|
|
155112
155128
|
const sourceFile = location.getSourceFile();
|
|
155113
155129
|
const printer = createSnippetPrinter({
|
|
@@ -155136,9 +155152,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155136
155152
|
);
|
|
155137
155153
|
}
|
|
155138
155154
|
let modifiers = 0 /* None */;
|
|
155139
|
-
const { modifiers: presentModifiers,
|
|
155140
|
-
const isAbstract =
|
|
155141
|
-
|
|
155155
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155156
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155157
|
+
let completionNodes = [];
|
|
155142
155158
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155143
155159
|
symbol,
|
|
155144
155160
|
classLikeDeclaration,
|
|
@@ -155162,18 +155178,42 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155162
155178
|
requiredModifiers |= 16384 /* Override */;
|
|
155163
155179
|
}
|
|
155164
155180
|
if (!completionNodes.length) {
|
|
155165
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155181
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155166
155182
|
}
|
|
155167
155183
|
node = factory.updateModifiers(node, modifiers);
|
|
155168
155184
|
completionNodes.push(node);
|
|
155169
155185
|
},
|
|
155170
155186
|
body,
|
|
155171
155187
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155172
|
-
isAbstract
|
|
155188
|
+
!!isAbstract
|
|
155173
155189
|
);
|
|
155174
155190
|
if (completionNodes.length) {
|
|
155191
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155192
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155193
|
+
if (!isMethod) {
|
|
155194
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155195
|
+
} else {
|
|
155196
|
+
allowedModifiers |= 512 /* Async */;
|
|
155197
|
+
}
|
|
155198
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155199
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155200
|
+
return void 0;
|
|
155201
|
+
}
|
|
155202
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155203
|
+
modifiers &= ~16 /* Protected */;
|
|
155204
|
+
}
|
|
155205
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155206
|
+
modifiers &= ~4 /* Public */;
|
|
155207
|
+
}
|
|
155208
|
+
modifiers |= allowedAndPresent;
|
|
155209
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155210
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155211
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155212
|
+
if (canHaveDecorators(lastNode)) {
|
|
155213
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155214
|
+
}
|
|
155215
|
+
}
|
|
155175
155216
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155176
|
-
replacementSpan = modifiersSpan;
|
|
155177
155217
|
if (formatContext) {
|
|
155178
155218
|
insertText = printer.printAndFormatSnippetList(
|
|
155179
155219
|
format,
|
|
@@ -155189,24 +155229,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155189
155229
|
);
|
|
155190
155230
|
}
|
|
155191
155231
|
}
|
|
155192
|
-
return { insertText, isSnippet, importAdder,
|
|
155232
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155193
155233
|
}
|
|
155194
155234
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155195
155235
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155196
155236
|
return { modifiers: 0 /* None */ };
|
|
155197
155237
|
}
|
|
155198
155238
|
let modifiers = 0 /* None */;
|
|
155199
|
-
let
|
|
155239
|
+
let decorators;
|
|
155200
155240
|
let contextMod;
|
|
155201
|
-
|
|
155202
|
-
|
|
155203
|
-
span = createTextSpanFromNode(contextToken);
|
|
155204
|
-
}
|
|
155205
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
155241
|
+
const range = { pos: position, end: position };
|
|
155242
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155206
155243
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155207
|
-
|
|
155244
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
155245
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
155208
155246
|
}
|
|
155209
|
-
|
|
155247
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
155248
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
155249
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
155250
|
+
modifiers |= contextModifierFlag;
|
|
155251
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
155252
|
+
}
|
|
155253
|
+
}
|
|
155254
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155210
155255
|
}
|
|
155211
155256
|
function isModifierLike2(node) {
|
|
155212
155257
|
if (isModifier(node)) {
|
|
@@ -155829,7 +155874,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155829
155874
|
}
|
|
155830
155875
|
}
|
|
155831
155876
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
155832
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
155877
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
155833
155878
|
host,
|
|
155834
155879
|
program,
|
|
155835
155880
|
compilerOptions,
|
|
@@ -155841,10 +155886,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155841
155886
|
contextToken,
|
|
155842
155887
|
formatContext
|
|
155843
155888
|
);
|
|
155844
|
-
if (importAdder) {
|
|
155889
|
+
if (importAdder || eraseRange) {
|
|
155845
155890
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
155846
155891
|
{ host, formatContext, preferences },
|
|
155847
|
-
|
|
155892
|
+
(tracker) => {
|
|
155893
|
+
if (importAdder) {
|
|
155894
|
+
importAdder.writeFixes(tracker);
|
|
155895
|
+
}
|
|
155896
|
+
if (eraseRange) {
|
|
155897
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
155898
|
+
}
|
|
155899
|
+
}
|
|
155848
155900
|
);
|
|
155849
155901
|
return {
|
|
155850
155902
|
sourceDisplay: void 0,
|
|
@@ -179117,6 +179169,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179117
179169
|
kindModifiers,
|
|
179118
179170
|
sortText,
|
|
179119
179171
|
insertText,
|
|
179172
|
+
filterText,
|
|
179120
179173
|
replacementSpan,
|
|
179121
179174
|
hasAction,
|
|
179122
179175
|
source,
|
|
@@ -179135,6 +179188,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179135
179188
|
kindModifiers,
|
|
179136
179189
|
sortText,
|
|
179137
179190
|
insertText,
|
|
179191
|
+
filterText,
|
|
179138
179192
|
replacementSpan: convertedSpan,
|
|
179139
179193
|
isSnippet,
|
|
179140
179194
|
hasAction: hasAction || void 0,
|
|
@@ -179506,7 +179560,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
179506
179560
|
return {
|
|
179507
179561
|
renameLocation: mappedRenameLocation,
|
|
179508
179562
|
renameFilename,
|
|
179509
|
-
edits: this.mapTextChangesToCodeEdits(edits)
|
|
179563
|
+
edits: this.mapTextChangesToCodeEdits(edits),
|
|
179564
|
+
notApplicableReason: result.notApplicableReason
|
|
179510
179565
|
};
|
|
179511
179566
|
}
|
|
179512
179567
|
return result;
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6517,6 +6517,7 @@ declare namespace ts {
|
|
|
6517
6517
|
renameFilename?: string;
|
|
6518
6518
|
renameLocation?: number;
|
|
6519
6519
|
commands?: CodeActionCommand[];
|
|
6520
|
+
notApplicableReason?: string;
|
|
6520
6521
|
}
|
|
6521
6522
|
type RefactorTriggerReason = "implicit" | "invoked";
|
|
6522
6523
|
interface TextInsertion {
|
|
@@ -6838,6 +6839,7 @@ declare namespace ts {
|
|
|
6838
6839
|
kindModifiers?: string;
|
|
6839
6840
|
sortText: string;
|
|
6840
6841
|
insertText?: string;
|
|
6842
|
+
filterText?: string;
|
|
6841
6843
|
isSnippet?: true;
|
|
6842
6844
|
/**
|
|
6843
6845
|
* 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.20230519`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9018,6 +9018,7 @@ ${lanes.join("\n")}
|
|
|
9018
9018
|
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
9019
9019
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
9020
9020
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
9021
|
+
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
9021
9022
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9022
9023
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9023
9024
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -20592,7 +20593,8 @@ ${lanes.join("\n")}
|
|
|
20592
20593
|
ensureUseStrict,
|
|
20593
20594
|
liftToBlock,
|
|
20594
20595
|
mergeLexicalEnvironment,
|
|
20595
|
-
updateModifiers
|
|
20596
|
+
updateModifiers,
|
|
20597
|
+
updateModifierLike
|
|
20596
20598
|
};
|
|
20597
20599
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
20598
20600
|
return factory2;
|
|
@@ -24074,6 +24076,9 @@ ${lanes.join("\n")}
|
|
|
24074
24076
|
}
|
|
24075
24077
|
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
24078
|
}
|
|
24079
|
+
function updateModifierLike(node, modifierArray) {
|
|
24080
|
+
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);
|
|
24081
|
+
}
|
|
24077
24082
|
function asNodeArray(array) {
|
|
24078
24083
|
return array ? createNodeArray(array) : void 0;
|
|
24079
24084
|
}
|
|
@@ -25516,10 +25521,10 @@ ${lanes.join("\n")}
|
|
|
25516
25521
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
25517
25522
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
25518
25523
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
25519
|
-
if (_ = accept(result.init)) initializers.
|
|
25524
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
25520
25525
|
}
|
|
25521
25526
|
else if (_ = accept(result)) {
|
|
25522
|
-
if (kind === "field") initializers.
|
|
25527
|
+
if (kind === "field") initializers.unshift(_);
|
|
25523
25528
|
else descriptor[key] = _;
|
|
25524
25529
|
}
|
|
25525
25530
|
}
|
|
@@ -135752,8 +135757,12 @@ ${lanes.join("\n")}
|
|
|
135752
135757
|
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
|
|
135753
135758
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
135754
135759
|
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
|
|
135755
|
-
const
|
|
135756
|
-
|
|
135760
|
+
const targetFile = interactiveRefactorArguments.targetFile;
|
|
135761
|
+
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
|
|
135762
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
|
|
135763
|
+
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
135764
|
+
}
|
|
135765
|
+
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) };
|
|
135757
135766
|
}
|
|
135758
135767
|
});
|
|
135759
135768
|
}
|
|
@@ -152235,7 +152244,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152235
152244
|
false
|
|
152236
152245
|
);
|
|
152237
152246
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
152238
|
-
let modifierFlags = effectiveModifierFlags &
|
|
152247
|
+
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
152248
|
+
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
152239
152249
|
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
|
|
152240
152250
|
modifierFlags |= 128 /* Accessor */;
|
|
152241
152251
|
}
|
|
@@ -154992,6 +155002,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154992
155002
|
}
|
|
154993
155003
|
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) {
|
|
154994
155004
|
let insertText;
|
|
155005
|
+
let filterText;
|
|
154995
155006
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
154996
155007
|
let data;
|
|
154997
155008
|
let isSnippet;
|
|
@@ -155050,11 +155061,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155050
155061
|
}
|
|
155051
155062
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
155052
155063
|
let importAdder;
|
|
155053
|
-
|
|
155054
|
-
|
|
155055
|
-
|
|
155056
|
-
|
|
155057
|
-
|
|
155064
|
+
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
155065
|
+
if (memberCompletionEntry) {
|
|
155066
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
155067
|
+
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
155068
|
+
hasAction = true;
|
|
155069
|
+
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
155070
|
+
}
|
|
155071
|
+
} else {
|
|
155072
|
+
return void 0;
|
|
155058
155073
|
}
|
|
155059
155074
|
}
|
|
155060
155075
|
if (origin && originIsObjectLiteralMethod(origin)) {
|
|
@@ -155098,6 +155113,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155098
155113
|
hasAction: hasAction ? true : void 0,
|
|
155099
155114
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0,
|
|
155100
155115
|
insertText,
|
|
155116
|
+
filterText,
|
|
155101
155117
|
replacementSpan,
|
|
155102
155118
|
sourceDisplay,
|
|
155103
155119
|
labelDetails,
|
|
@@ -155118,11 +155134,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155118
155134
|
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) {
|
|
155119
155135
|
const classLikeDeclaration = findAncestor(location, isClassLike);
|
|
155120
155136
|
if (!classLikeDeclaration) {
|
|
155121
|
-
return
|
|
155137
|
+
return void 0;
|
|
155122
155138
|
}
|
|
155123
155139
|
let isSnippet;
|
|
155124
|
-
let replacementSpan;
|
|
155125
155140
|
let insertText = name;
|
|
155141
|
+
const filterText = name;
|
|
155126
155142
|
const checker = program.getTypeChecker();
|
|
155127
155143
|
const sourceFile = location.getSourceFile();
|
|
155128
155144
|
const printer = createSnippetPrinter({
|
|
@@ -155151,9 +155167,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155151
155167
|
);
|
|
155152
155168
|
}
|
|
155153
155169
|
let modifiers = 0 /* None */;
|
|
155154
|
-
const { modifiers: presentModifiers,
|
|
155155
|
-
const isAbstract =
|
|
155156
|
-
|
|
155170
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
155171
|
+
const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */;
|
|
155172
|
+
let completionNodes = [];
|
|
155157
155173
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
155158
155174
|
symbol,
|
|
155159
155175
|
classLikeDeclaration,
|
|
@@ -155177,18 +155193,42 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155177
155193
|
requiredModifiers |= 16384 /* Override */;
|
|
155178
155194
|
}
|
|
155179
155195
|
if (!completionNodes.length) {
|
|
155180
|
-
modifiers = node.modifierFlagsCache | requiredModifiers
|
|
155196
|
+
modifiers = node.modifierFlagsCache | requiredModifiers;
|
|
155181
155197
|
}
|
|
155182
155198
|
node = factory.updateModifiers(node, modifiers);
|
|
155183
155199
|
completionNodes.push(node);
|
|
155184
155200
|
},
|
|
155185
155201
|
body,
|
|
155186
155202
|
ts_codefix_exports.PreserveOptionalFlags.Property,
|
|
155187
|
-
isAbstract
|
|
155203
|
+
!!isAbstract
|
|
155188
155204
|
);
|
|
155189
155205
|
if (completionNodes.length) {
|
|
155206
|
+
const isMethod = symbol.flags & 8192 /* Method */;
|
|
155207
|
+
let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */;
|
|
155208
|
+
if (!isMethod) {
|
|
155209
|
+
allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */;
|
|
155210
|
+
} else {
|
|
155211
|
+
allowedModifiers |= 512 /* Async */;
|
|
155212
|
+
}
|
|
155213
|
+
const allowedAndPresent = presentModifiers & allowedModifiers;
|
|
155214
|
+
if (presentModifiers & ~allowedModifiers) {
|
|
155215
|
+
return void 0;
|
|
155216
|
+
}
|
|
155217
|
+
if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) {
|
|
155218
|
+
modifiers &= ~16 /* Protected */;
|
|
155219
|
+
}
|
|
155220
|
+
if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) {
|
|
155221
|
+
modifiers &= ~4 /* Public */;
|
|
155222
|
+
}
|
|
155223
|
+
modifiers |= allowedAndPresent;
|
|
155224
|
+
completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers));
|
|
155225
|
+
if (presentDecorators == null ? void 0 : presentDecorators.length) {
|
|
155226
|
+
const lastNode = completionNodes[completionNodes.length - 1];
|
|
155227
|
+
if (canHaveDecorators(lastNode)) {
|
|
155228
|
+
completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || []));
|
|
155229
|
+
}
|
|
155230
|
+
}
|
|
155190
155231
|
const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */;
|
|
155191
|
-
replacementSpan = modifiersSpan;
|
|
155192
155232
|
if (formatContext) {
|
|
155193
155233
|
insertText = printer.printAndFormatSnippetList(
|
|
155194
155234
|
format,
|
|
@@ -155204,24 +155244,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155204
155244
|
);
|
|
155205
155245
|
}
|
|
155206
155246
|
}
|
|
155207
|
-
return { insertText, isSnippet, importAdder,
|
|
155247
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
155208
155248
|
}
|
|
155209
155249
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
155210
155250
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
155211
155251
|
return { modifiers: 0 /* None */ };
|
|
155212
155252
|
}
|
|
155213
155253
|
let modifiers = 0 /* None */;
|
|
155214
|
-
let
|
|
155254
|
+
let decorators;
|
|
155215
155255
|
let contextMod;
|
|
155216
|
-
|
|
155217
|
-
|
|
155218
|
-
span = createTextSpanFromNode(contextToken);
|
|
155219
|
-
}
|
|
155220
|
-
if (isPropertyDeclaration(contextToken.parent)) {
|
|
155256
|
+
const range = { pos: position, end: position };
|
|
155257
|
+
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
155221
155258
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */;
|
|
155222
|
-
|
|
155259
|
+
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
155260
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
155223
155261
|
}
|
|
155224
|
-
|
|
155262
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
155263
|
+
const contextModifierFlag = modifierToFlag(contextMod);
|
|
155264
|
+
if (!(modifiers & contextModifierFlag)) {
|
|
155265
|
+
modifiers |= contextModifierFlag;
|
|
155266
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
155267
|
+
}
|
|
155268
|
+
}
|
|
155269
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
155225
155270
|
}
|
|
155226
155271
|
function isModifierLike2(node) {
|
|
155227
155272
|
if (isModifier(node)) {
|
|
@@ -155844,7 +155889,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155844
155889
|
}
|
|
155845
155890
|
}
|
|
155846
155891
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
155847
|
-
const { importAdder } = getEntryForMemberCompletion(
|
|
155892
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
155848
155893
|
host,
|
|
155849
155894
|
program,
|
|
155850
155895
|
compilerOptions,
|
|
@@ -155856,10 +155901,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155856
155901
|
contextToken,
|
|
155857
155902
|
formatContext
|
|
155858
155903
|
);
|
|
155859
|
-
if (importAdder) {
|
|
155904
|
+
if (importAdder || eraseRange) {
|
|
155860
155905
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
155861
155906
|
{ host, formatContext, preferences },
|
|
155862
|
-
|
|
155907
|
+
(tracker) => {
|
|
155908
|
+
if (importAdder) {
|
|
155909
|
+
importAdder.writeFixes(tracker);
|
|
155910
|
+
}
|
|
155911
|
+
if (eraseRange) {
|
|
155912
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
155913
|
+
}
|
|
155914
|
+
}
|
|
155863
155915
|
);
|
|
155864
155916
|
return {
|
|
155865
155917
|
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.20230519`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -7078,6 +7078,7 @@ var Diagnostics = {
|
|
|
7078
7078
|
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
7079
7079
|
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
7080
7080
|
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
|
|
7081
|
+
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
|
|
7081
7082
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7082
7083
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7083
7084
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -12891,7 +12892,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
12891
12892
|
ensureUseStrict,
|
|
12892
12893
|
liftToBlock,
|
|
12893
12894
|
mergeLexicalEnvironment,
|
|
12894
|
-
updateModifiers
|
|
12895
|
+
updateModifiers,
|
|
12896
|
+
updateModifierLike
|
|
12895
12897
|
};
|
|
12896
12898
|
forEach(nodeFactoryPatchers, (fn) => fn(factory2));
|
|
12897
12899
|
return factory2;
|
|
@@ -16373,6 +16375,9 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
16373
16375
|
}
|
|
16374
16376
|
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
16377
|
}
|
|
16378
|
+
function updateModifierLike(node, modifierArray) {
|
|
16379
|
+
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);
|
|
16380
|
+
}
|
|
16376
16381
|
function asNodeArray(array) {
|
|
16377
16382
|
return array ? createNodeArray(array) : void 0;
|
|
16378
16383
|
}
|
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.20230519",
|
|
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": "ae33099f25a2d575a130f70eac44733a8046cf4e"
|
|
117
117
|
}
|