@typescript-deploys/pr-build 5.2.0-pr-54052-23 → 5.2.0-pr-54281-11
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 +6 -3
- package/lib/tsserver.js +199 -76
- package/lib/tsserverlibrary.js +217 -85
- package/lib/typescript.js +217 -85
- package/lib/typingsInstaller.js +4 -1
- 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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230531`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7705,6 +7705,9 @@ var Diagnostics = {
|
|
|
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
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"),
|
|
7708
|
+
Inline_variable: diag(95180, 3 /* Message */, "Inline_variable_95180", "Inline variable"),
|
|
7709
|
+
Could_not_find_variable_to_inline: diag(95181, 3 /* Message */, "Could_not_find_variable_to_inline_95181", "Could not find variable to inline."),
|
|
7710
|
+
Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined: diag(95182, 3 /* Message */, "Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined_95182", "Variables that share a name with a type or namespace in the same scope cannot be inlined."),
|
|
7708
7711
|
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."),
|
|
7709
7712
|
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'."),
|
|
7710
7713
|
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?"),
|
|
@@ -61779,7 +61782,7 @@ function createTypeChecker(host) {
|
|
|
61779
61782
|
}
|
|
61780
61783
|
}
|
|
61781
61784
|
}
|
|
61782
|
-
const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])
|
|
61785
|
+
const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target;
|
|
61783
61786
|
return filtered.flags & 131072 /* Never */ ? target : filtered;
|
|
61784
61787
|
}
|
|
61785
61788
|
function isWeakType(type) {
|
|
@@ -81691,7 +81694,7 @@ function createTypeChecker(host) {
|
|
|
81691
81694
|
if (requestedExternalEmitHelperNames.has(name))
|
|
81692
81695
|
continue;
|
|
81693
81696
|
requestedExternalEmitHelperNames.add(name);
|
|
81694
|
-
const symbol = getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
81697
|
+
const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
81695
81698
|
if (!symbol) {
|
|
81696
81699
|
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
81697
81700
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
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-insiders.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-insiders.20230531`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11213,6 +11213,9 @@ var Diagnostics = {
|
|
|
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
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"),
|
|
11216
|
+
Inline_variable: diag(95180, 3 /* Message */, "Inline_variable_95180", "Inline variable"),
|
|
11217
|
+
Could_not_find_variable_to_inline: diag(95181, 3 /* Message */, "Could_not_find_variable_to_inline_95181", "Could not find variable to inline."),
|
|
11218
|
+
Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined: diag(95182, 3 /* Message */, "Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined_95182", "Variables that share a name with a type or namespace in the same scope cannot be inlined."),
|
|
11216
11219
|
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."),
|
|
11217
11220
|
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'."),
|
|
11218
11221
|
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?"),
|
|
@@ -66430,7 +66433,7 @@ function createTypeChecker(host) {
|
|
|
66430
66433
|
}
|
|
66431
66434
|
}
|
|
66432
66435
|
}
|
|
66433
|
-
const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])
|
|
66436
|
+
const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target;
|
|
66434
66437
|
return filtered.flags & 131072 /* Never */ ? target : filtered;
|
|
66435
66438
|
}
|
|
66436
66439
|
function isWeakType(type) {
|
|
@@ -86342,7 +86345,7 @@ function createTypeChecker(host) {
|
|
|
86342
86345
|
if (requestedExternalEmitHelperNames.has(name))
|
|
86343
86346
|
continue;
|
|
86344
86347
|
requestedExternalEmitHelperNames.add(name);
|
|
86345
|
-
const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
86348
|
+
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
|
|
86346
86349
|
if (!symbol) {
|
|
86347
86350
|
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
|
|
86348
86351
|
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
|
|
@@ -135597,8 +135600,8 @@ function getApplicableRefactors(context, includeInteractiveActions) {
|
|
|
135597
135600
|
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions);
|
|
135598
135601
|
}));
|
|
135599
135602
|
}
|
|
135600
|
-
function getEditsForRefactor(context,
|
|
135601
|
-
const refactor = refactors.get(
|
|
135603
|
+
function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) {
|
|
135604
|
+
const refactor = refactors.get(refactorName14);
|
|
135602
135605
|
return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments);
|
|
135603
135606
|
}
|
|
135604
135607
|
|
|
@@ -136366,24 +136369,144 @@ function refactorKindBeginsWith(known, requested) {
|
|
|
136366
136369
|
return known.substr(0, requested.length) === requested;
|
|
136367
136370
|
}
|
|
136368
136371
|
|
|
136372
|
+
// src/services/refactors/inlineVariable.ts
|
|
136373
|
+
var refactorName4 = "Inline variable";
|
|
136374
|
+
var refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable);
|
|
136375
|
+
var inlineVariableAction = {
|
|
136376
|
+
name: refactorName4,
|
|
136377
|
+
description: refactorDescription,
|
|
136378
|
+
kind: "refactor.inline.variable"
|
|
136379
|
+
};
|
|
136380
|
+
registerRefactor(refactorName4, {
|
|
136381
|
+
kinds: [inlineVariableAction.kind],
|
|
136382
|
+
getAvailableActions(context) {
|
|
136383
|
+
const {
|
|
136384
|
+
file,
|
|
136385
|
+
program,
|
|
136386
|
+
preferences,
|
|
136387
|
+
startPosition,
|
|
136388
|
+
triggerReason
|
|
136389
|
+
} = context;
|
|
136390
|
+
const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program);
|
|
136391
|
+
if (!info) {
|
|
136392
|
+
return emptyArray;
|
|
136393
|
+
}
|
|
136394
|
+
if (ts_refactor_exports.isRefactorErrorInfo(info) && preferences.provideRefactorNotApplicableReason) {
|
|
136395
|
+
return [{
|
|
136396
|
+
name: refactorName4,
|
|
136397
|
+
description: refactorDescription,
|
|
136398
|
+
actions: [{
|
|
136399
|
+
...inlineVariableAction,
|
|
136400
|
+
notApplicableReason: info.error
|
|
136401
|
+
}]
|
|
136402
|
+
}];
|
|
136403
|
+
}
|
|
136404
|
+
if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
136405
|
+
return [{
|
|
136406
|
+
name: refactorName4,
|
|
136407
|
+
description: refactorDescription,
|
|
136408
|
+
actions: [inlineVariableAction]
|
|
136409
|
+
}];
|
|
136410
|
+
}
|
|
136411
|
+
return emptyArray;
|
|
136412
|
+
},
|
|
136413
|
+
getEditsForAction(context, actionName2) {
|
|
136414
|
+
Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked");
|
|
136415
|
+
const { file, program, startPosition } = context;
|
|
136416
|
+
const info = getInliningInfo(
|
|
136417
|
+
file,
|
|
136418
|
+
startPosition,
|
|
136419
|
+
/*tryWithReferenceToken*/
|
|
136420
|
+
true,
|
|
136421
|
+
program
|
|
136422
|
+
);
|
|
136423
|
+
if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) {
|
|
136424
|
+
return void 0;
|
|
136425
|
+
}
|
|
136426
|
+
const { references, declaration, replacement } = info;
|
|
136427
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
|
|
136428
|
+
for (const node of references) {
|
|
136429
|
+
tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
|
|
136430
|
+
}
|
|
136431
|
+
tracker.delete(file, declaration);
|
|
136432
|
+
});
|
|
136433
|
+
return { edits };
|
|
136434
|
+
}
|
|
136435
|
+
});
|
|
136436
|
+
function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
|
|
136437
|
+
var _a, _b;
|
|
136438
|
+
const checker = program.getTypeChecker();
|
|
136439
|
+
const token = getTokenAtPosition(file, startPosition);
|
|
136440
|
+
const parent2 = token.parent;
|
|
136441
|
+
if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2) && isIdentifier(parent2.name)) {
|
|
136442
|
+
if (((_a = parent2.symbol.declarations) == null ? void 0 : _a.length) !== 1) {
|
|
136443
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined) };
|
|
136444
|
+
}
|
|
136445
|
+
if (findAncestor(parent2, (node) => canHaveModifiers(node) && some(node.modifiers, isExportModifier))) {
|
|
136446
|
+
return void 0;
|
|
136447
|
+
}
|
|
136448
|
+
const references = getReferenceNodes(parent2.name, checker, file);
|
|
136449
|
+
return references && { references, declaration: parent2, replacement: parent2.initializer };
|
|
136450
|
+
}
|
|
136451
|
+
if (tryWithReferenceToken && isIdentifier(token)) {
|
|
136452
|
+
const definition = checker.resolveName(
|
|
136453
|
+
token.text,
|
|
136454
|
+
token,
|
|
136455
|
+
111551 /* Value */,
|
|
136456
|
+
/*excludeGlobals*/
|
|
136457
|
+
false
|
|
136458
|
+
);
|
|
136459
|
+
if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) {
|
|
136460
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Variables_that_share_a_name_with_a_type_or_namespace_in_the_same_scope_cannot_be_inlined) };
|
|
136461
|
+
}
|
|
136462
|
+
const declaration = definition.declarations[0];
|
|
136463
|
+
if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) {
|
|
136464
|
+
return void 0;
|
|
136465
|
+
}
|
|
136466
|
+
const references = getReferenceNodes(declaration.name, checker, file);
|
|
136467
|
+
return references && { references, declaration, replacement: declaration.initializer };
|
|
136468
|
+
}
|
|
136469
|
+
return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) };
|
|
136470
|
+
}
|
|
136471
|
+
function getReferenceNodes(declaration, checker, file) {
|
|
136472
|
+
const references = [];
|
|
136473
|
+
const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration, checker, file, (ref) => {
|
|
136474
|
+
if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
|
|
136475
|
+
return true;
|
|
136476
|
+
}
|
|
136477
|
+
if (isTypeQueryNode(ref.parent)) {
|
|
136478
|
+
return true;
|
|
136479
|
+
}
|
|
136480
|
+
references.push(ref);
|
|
136481
|
+
});
|
|
136482
|
+
return references.length === 0 || cannotInline ? void 0 : references;
|
|
136483
|
+
}
|
|
136484
|
+
function getReplacementExpression(reference, replacement) {
|
|
136485
|
+
const { parent: parent2 } = reference;
|
|
136486
|
+
if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
|
|
136487
|
+
return factory.createParenthesizedExpression(replacement);
|
|
136488
|
+
}
|
|
136489
|
+
return replacement;
|
|
136490
|
+
}
|
|
136491
|
+
|
|
136369
136492
|
// src/services/refactors/moveToNewFile.ts
|
|
136370
|
-
var
|
|
136493
|
+
var refactorName5 = "Move to a new file";
|
|
136371
136494
|
var description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file);
|
|
136372
136495
|
var moveToNewFileAction = {
|
|
136373
|
-
name:
|
|
136496
|
+
name: refactorName5,
|
|
136374
136497
|
description,
|
|
136375
136498
|
kind: "refactor.move.newFile"
|
|
136376
136499
|
};
|
|
136377
|
-
registerRefactor(
|
|
136500
|
+
registerRefactor(refactorName5, {
|
|
136378
136501
|
kinds: [moveToNewFileAction.kind],
|
|
136379
136502
|
getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
|
|
136380
136503
|
const statements = getStatementsToMove(context);
|
|
136381
136504
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
136382
|
-
return [{ name:
|
|
136505
|
+
return [{ name: refactorName5, description, actions: [moveToNewFileAction] }];
|
|
136383
136506
|
}
|
|
136384
136507
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
136385
136508
|
return [{
|
|
136386
|
-
name:
|
|
136509
|
+
name: refactorName5,
|
|
136387
136510
|
description,
|
|
136388
136511
|
actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }]
|
|
136389
136512
|
}];
|
|
@@ -136391,7 +136514,7 @@ registerRefactor(refactorName4, {
|
|
|
136391
136514
|
return emptyArray;
|
|
136392
136515
|
},
|
|
136393
136516
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
136394
|
-
Debug.assert(actionName2 ===
|
|
136517
|
+
Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked");
|
|
136395
136518
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
136396
136519
|
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context));
|
|
136397
136520
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
@@ -137368,14 +137491,14 @@ function getOverloadRangeToMove(sourceFile, statement) {
|
|
|
137368
137491
|
var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
|
|
137369
137492
|
|
|
137370
137493
|
// src/services/refactors/convertOverloadListToSingleSignature.ts
|
|
137371
|
-
var
|
|
137372
|
-
var
|
|
137494
|
+
var refactorName6 = "Convert overload list to single signature";
|
|
137495
|
+
var refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
|
|
137373
137496
|
var functionOverloadAction = {
|
|
137374
|
-
name:
|
|
137375
|
-
description:
|
|
137497
|
+
name: refactorName6,
|
|
137498
|
+
description: refactorDescription2,
|
|
137376
137499
|
kind: "refactor.rewrite.function.overloadList"
|
|
137377
137500
|
};
|
|
137378
|
-
registerRefactor(
|
|
137501
|
+
registerRefactor(refactorName6, {
|
|
137379
137502
|
kinds: [functionOverloadAction.kind],
|
|
137380
137503
|
getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature,
|
|
137381
137504
|
getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature
|
|
@@ -137386,8 +137509,8 @@ function getRefactorActionsToConvertOverloadsToOneSignature(context) {
|
|
|
137386
137509
|
if (!info)
|
|
137387
137510
|
return emptyArray;
|
|
137388
137511
|
return [{
|
|
137389
|
-
name:
|
|
137390
|
-
description:
|
|
137512
|
+
name: refactorName6,
|
|
137513
|
+
description: refactorDescription2,
|
|
137391
137514
|
actions: [functionOverloadAction]
|
|
137392
137515
|
}];
|
|
137393
137516
|
}
|
|
@@ -137580,8 +137703,8 @@ function getConvertableOverloadListAtPosition(file, startPosition, program) {
|
|
|
137580
137703
|
}
|
|
137581
137704
|
|
|
137582
137705
|
// src/services/refactors/addOrRemoveBracesToArrowFunction.ts
|
|
137583
|
-
var
|
|
137584
|
-
var
|
|
137706
|
+
var refactorName7 = "Add or remove braces in an arrow function";
|
|
137707
|
+
var refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
|
|
137585
137708
|
var addBracesAction = {
|
|
137586
137709
|
name: "Add braces to arrow function",
|
|
137587
137710
|
description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
|
|
@@ -137592,7 +137715,7 @@ var removeBracesAction = {
|
|
|
137592
137715
|
description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
|
|
137593
137716
|
kind: "refactor.rewrite.arrow.braces.remove"
|
|
137594
137717
|
};
|
|
137595
|
-
registerRefactor(
|
|
137718
|
+
registerRefactor(refactorName7, {
|
|
137596
137719
|
kinds: [removeBracesAction.kind],
|
|
137597
137720
|
getEditsForAction: getRefactorEditsToRemoveFunctionBraces,
|
|
137598
137721
|
getAvailableActions: getRefactorActionsToRemoveFunctionBraces
|
|
@@ -137604,8 +137727,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
|
|
|
137604
137727
|
return emptyArray;
|
|
137605
137728
|
if (!isRefactorErrorInfo(info)) {
|
|
137606
137729
|
return [{
|
|
137607
|
-
name:
|
|
137608
|
-
description:
|
|
137730
|
+
name: refactorName7,
|
|
137731
|
+
description: refactorDescription3,
|
|
137609
137732
|
actions: [
|
|
137610
137733
|
info.addBraces ? addBracesAction : removeBracesAction
|
|
137611
137734
|
]
|
|
@@ -137613,8 +137736,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
|
|
|
137613
137736
|
}
|
|
137614
137737
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
137615
137738
|
return [{
|
|
137616
|
-
name:
|
|
137617
|
-
description:
|
|
137739
|
+
name: refactorName7,
|
|
137740
|
+
description: refactorDescription3,
|
|
137618
137741
|
actions: [
|
|
137619
137742
|
{ ...addBracesAction, notApplicableReason: info.error },
|
|
137620
137743
|
{ ...removeBracesAction, notApplicableReason: info.error }
|
|
@@ -137710,8 +137833,8 @@ function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunc
|
|
|
137710
137833
|
var ts_refactor_convertArrowFunctionOrFunctionExpression_exports = {};
|
|
137711
137834
|
|
|
137712
137835
|
// src/services/refactors/convertArrowFunctionOrFunctionExpression.ts
|
|
137713
|
-
var
|
|
137714
|
-
var
|
|
137836
|
+
var refactorName8 = "Convert arrow function or function expression";
|
|
137837
|
+
var refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
|
|
137715
137838
|
var toAnonymousFunctionAction = {
|
|
137716
137839
|
name: "Convert to anonymous function",
|
|
137717
137840
|
description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function),
|
|
@@ -137727,7 +137850,7 @@ var toArrowFunctionAction = {
|
|
|
137727
137850
|
description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function),
|
|
137728
137851
|
kind: "refactor.rewrite.function.arrow"
|
|
137729
137852
|
};
|
|
137730
|
-
registerRefactor(
|
|
137853
|
+
registerRefactor(refactorName8, {
|
|
137731
137854
|
kinds: [
|
|
137732
137855
|
toAnonymousFunctionAction.kind,
|
|
137733
137856
|
toNamedFunctionAction.kind,
|
|
@@ -137769,8 +137892,8 @@ function getRefactorActionsToConvertFunctionExpressions(context) {
|
|
|
137769
137892
|
}
|
|
137770
137893
|
}
|
|
137771
137894
|
return [{
|
|
137772
|
-
name:
|
|
137773
|
-
description:
|
|
137895
|
+
name: refactorName8,
|
|
137896
|
+
description: refactorDescription4,
|
|
137774
137897
|
actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions
|
|
137775
137898
|
}];
|
|
137776
137899
|
}
|
|
@@ -137935,15 +138058,15 @@ function isFunctionReferencedInFile(sourceFile, typeChecker, node) {
|
|
|
137935
138058
|
var ts_refactor_convertParamsToDestructuredObject_exports = {};
|
|
137936
138059
|
|
|
137937
138060
|
// src/services/refactors/convertParamsToDestructuredObject.ts
|
|
137938
|
-
var
|
|
138061
|
+
var refactorName9 = "Convert parameters to destructured object";
|
|
137939
138062
|
var minimumParameterLength = 1;
|
|
137940
|
-
var
|
|
138063
|
+
var refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
|
|
137941
138064
|
var toDestructuredAction = {
|
|
137942
|
-
name:
|
|
137943
|
-
description:
|
|
138065
|
+
name: refactorName9,
|
|
138066
|
+
description: refactorDescription5,
|
|
137944
138067
|
kind: "refactor.rewrite.parameters.toDestructured"
|
|
137945
138068
|
};
|
|
137946
|
-
registerRefactor(
|
|
138069
|
+
registerRefactor(refactorName9, {
|
|
137947
138070
|
kinds: [toDestructuredAction.kind],
|
|
137948
138071
|
getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject,
|
|
137949
138072
|
getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject
|
|
@@ -137957,13 +138080,13 @@ function getRefactorActionsToConvertParametersToDestructuredObject(context) {
|
|
|
137957
138080
|
if (!functionDeclaration)
|
|
137958
138081
|
return emptyArray;
|
|
137959
138082
|
return [{
|
|
137960
|
-
name:
|
|
137961
|
-
description:
|
|
138083
|
+
name: refactorName9,
|
|
138084
|
+
description: refactorDescription5,
|
|
137962
138085
|
actions: [toDestructuredAction]
|
|
137963
138086
|
}];
|
|
137964
138087
|
}
|
|
137965
138088
|
function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) {
|
|
137966
|
-
Debug.assert(actionName2 ===
|
|
138089
|
+
Debug.assert(actionName2 === refactorName9, "Unexpected action name");
|
|
137967
138090
|
const { file, startPosition, program, cancellationToken, host } = context;
|
|
137968
138091
|
const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker());
|
|
137969
138092
|
if (!functionDeclaration || !cancellationToken)
|
|
@@ -138478,14 +138601,14 @@ function getFunctionNames(functionDeclaration) {
|
|
|
138478
138601
|
var ts_refactor_convertStringOrTemplateLiteral_exports = {};
|
|
138479
138602
|
|
|
138480
138603
|
// src/services/refactors/convertStringOrTemplateLiteral.ts
|
|
138481
|
-
var
|
|
138482
|
-
var
|
|
138604
|
+
var refactorName10 = "Convert to template string";
|
|
138605
|
+
var refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
|
|
138483
138606
|
var convertStringAction = {
|
|
138484
|
-
name:
|
|
138485
|
-
description:
|
|
138607
|
+
name: refactorName10,
|
|
138608
|
+
description: refactorDescription6,
|
|
138486
138609
|
kind: "refactor.rewrite.string"
|
|
138487
138610
|
};
|
|
138488
|
-
registerRefactor(
|
|
138611
|
+
registerRefactor(refactorName10, {
|
|
138489
138612
|
kinds: [convertStringAction.kind],
|
|
138490
138613
|
getEditsForAction: getRefactorEditsToConvertToTemplateString,
|
|
138491
138614
|
getAvailableActions: getRefactorActionsToConvertToTemplateString
|
|
@@ -138494,7 +138617,7 @@ function getRefactorActionsToConvertToTemplateString(context) {
|
|
|
138494
138617
|
const { file, startPosition } = context;
|
|
138495
138618
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
138496
138619
|
const maybeBinary = getParentBinaryExpression(node);
|
|
138497
|
-
const refactorInfo = { name:
|
|
138620
|
+
const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
|
|
138498
138621
|
if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
|
|
138499
138622
|
refactorInfo.actions.push(convertStringAction);
|
|
138500
138623
|
return [refactorInfo];
|
|
@@ -138520,7 +138643,7 @@ function getRefactorEditsToConvertToTemplateString(context, actionName2) {
|
|
|
138520
138643
|
const { file, startPosition } = context;
|
|
138521
138644
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
138522
138645
|
switch (actionName2) {
|
|
138523
|
-
case
|
|
138646
|
+
case refactorDescription6:
|
|
138524
138647
|
return { edits: getEditsForToTemplateLiteral(context, node) };
|
|
138525
138648
|
default:
|
|
138526
138649
|
return Debug.fail("invalid action");
|
|
@@ -138702,14 +138825,14 @@ function getExpressionFromParenthesesOrExpression(node) {
|
|
|
138702
138825
|
var ts_refactor_convertToOptionalChainExpression_exports = {};
|
|
138703
138826
|
|
|
138704
138827
|
// src/services/refactors/convertToOptionalChainExpression.ts
|
|
138705
|
-
var
|
|
138828
|
+
var refactorName11 = "Convert to optional chain expression";
|
|
138706
138829
|
var convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression);
|
|
138707
138830
|
var toOptionalChainAction = {
|
|
138708
|
-
name:
|
|
138831
|
+
name: refactorName11,
|
|
138709
138832
|
description: convertToOptionalChainExpressionMessage,
|
|
138710
138833
|
kind: "refactor.rewrite.expression.optionalChain"
|
|
138711
138834
|
};
|
|
138712
|
-
registerRefactor(
|
|
138835
|
+
registerRefactor(refactorName11, {
|
|
138713
138836
|
kinds: [toOptionalChainAction.kind],
|
|
138714
138837
|
getEditsForAction: getRefactorEditsToConvertToOptionalChain,
|
|
138715
138838
|
getAvailableActions: getRefactorActionsToConvertToOptionalChain
|
|
@@ -138720,14 +138843,14 @@ function getRefactorActionsToConvertToOptionalChain(context) {
|
|
|
138720
138843
|
return emptyArray;
|
|
138721
138844
|
if (!isRefactorErrorInfo(info)) {
|
|
138722
138845
|
return [{
|
|
138723
|
-
name:
|
|
138846
|
+
name: refactorName11,
|
|
138724
138847
|
description: convertToOptionalChainExpressionMessage,
|
|
138725
138848
|
actions: [toOptionalChainAction]
|
|
138726
138849
|
}];
|
|
138727
138850
|
}
|
|
138728
138851
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
138729
138852
|
return [{
|
|
138730
|
-
name:
|
|
138853
|
+
name: refactorName11,
|
|
138731
138854
|
description: convertToOptionalChainExpressionMessage,
|
|
138732
138855
|
actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }]
|
|
138733
138856
|
}];
|
|
@@ -138923,7 +139046,7 @@ __export(ts_refactor_extractSymbol_exports, {
|
|
|
138923
139046
|
});
|
|
138924
139047
|
|
|
138925
139048
|
// src/services/refactors/extractSymbol.ts
|
|
138926
|
-
var
|
|
139049
|
+
var refactorName12 = "Extract Symbol";
|
|
138927
139050
|
var extractConstantAction = {
|
|
138928
139051
|
name: "Extract Constant",
|
|
138929
139052
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
@@ -138934,7 +139057,7 @@ var extractFunctionAction = {
|
|
|
138934
139057
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
138935
139058
|
kind: "refactor.extract.function"
|
|
138936
139059
|
};
|
|
138937
|
-
registerRefactor(
|
|
139060
|
+
registerRefactor(refactorName12, {
|
|
138938
139061
|
kinds: [
|
|
138939
139062
|
extractConstantAction.kind,
|
|
138940
139063
|
extractFunctionAction.kind
|
|
@@ -138953,14 +139076,14 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
138953
139076
|
const errors = [];
|
|
138954
139077
|
if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
|
|
138955
139078
|
errors.push({
|
|
138956
|
-
name:
|
|
139079
|
+
name: refactorName12,
|
|
138957
139080
|
description: extractFunctionAction.description,
|
|
138958
139081
|
actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
|
|
138959
139082
|
});
|
|
138960
139083
|
}
|
|
138961
139084
|
if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
|
|
138962
139085
|
errors.push({
|
|
138963
|
-
name:
|
|
139086
|
+
name: refactorName12,
|
|
138964
139087
|
description: extractConstantAction.description,
|
|
138965
139088
|
actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
|
|
138966
139089
|
});
|
|
@@ -139024,26 +139147,26 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
139024
139147
|
const infos = [];
|
|
139025
139148
|
if (functionActions.length) {
|
|
139026
139149
|
infos.push({
|
|
139027
|
-
name:
|
|
139150
|
+
name: refactorName12,
|
|
139028
139151
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
139029
139152
|
actions: functionActions
|
|
139030
139153
|
});
|
|
139031
139154
|
} else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) {
|
|
139032
139155
|
infos.push({
|
|
139033
|
-
name:
|
|
139156
|
+
name: refactorName12,
|
|
139034
139157
|
description: getLocaleSpecificMessage(Diagnostics.Extract_function),
|
|
139035
139158
|
actions: [innermostErrorFunctionAction]
|
|
139036
139159
|
});
|
|
139037
139160
|
}
|
|
139038
139161
|
if (constantActions.length) {
|
|
139039
139162
|
infos.push({
|
|
139040
|
-
name:
|
|
139163
|
+
name: refactorName12,
|
|
139041
139164
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
139042
139165
|
actions: constantActions
|
|
139043
139166
|
});
|
|
139044
139167
|
} else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) {
|
|
139045
139168
|
infos.push({
|
|
139046
|
-
name:
|
|
139169
|
+
name: refactorName12,
|
|
139047
139170
|
description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
|
|
139048
139171
|
actions: [innermostErrorConstantAction]
|
|
139049
139172
|
});
|
|
@@ -140575,14 +140698,14 @@ registerRefactor(actionName, {
|
|
|
140575
140698
|
var ts_refactor_inferFunctionReturnType_exports = {};
|
|
140576
140699
|
|
|
140577
140700
|
// src/services/refactors/inferFunctionReturnType.ts
|
|
140578
|
-
var
|
|
140579
|
-
var
|
|
140701
|
+
var refactorName13 = "Infer function return type";
|
|
140702
|
+
var refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
|
|
140580
140703
|
var inferReturnTypeAction = {
|
|
140581
|
-
name:
|
|
140582
|
-
description:
|
|
140704
|
+
name: refactorName13,
|
|
140705
|
+
description: refactorDescription7,
|
|
140583
140706
|
kind: "refactor.rewrite.function.returnType"
|
|
140584
140707
|
};
|
|
140585
|
-
registerRefactor(
|
|
140708
|
+
registerRefactor(refactorName13, {
|
|
140586
140709
|
kinds: [inferReturnTypeAction.kind],
|
|
140587
140710
|
getEditsForAction: getRefactorEditsToInferReturnType,
|
|
140588
140711
|
getAvailableActions: getRefactorActionsToInferReturnType
|
|
@@ -140601,15 +140724,15 @@ function getRefactorActionsToInferReturnType(context) {
|
|
|
140601
140724
|
return emptyArray;
|
|
140602
140725
|
if (!isRefactorErrorInfo(info)) {
|
|
140603
140726
|
return [{
|
|
140604
|
-
name:
|
|
140605
|
-
description:
|
|
140727
|
+
name: refactorName13,
|
|
140728
|
+
description: refactorDescription7,
|
|
140606
140729
|
actions: [inferReturnTypeAction]
|
|
140607
140730
|
}];
|
|
140608
140731
|
}
|
|
140609
140732
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
140610
140733
|
return [{
|
|
140611
|
-
name:
|
|
140612
|
-
description:
|
|
140734
|
+
name: refactorName13,
|
|
140735
|
+
description: refactorDescription7,
|
|
140613
140736
|
actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }]
|
|
140614
140737
|
}];
|
|
140615
140738
|
}
|
|
@@ -142853,10 +142976,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
142853
142976
|
const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host);
|
|
142854
142977
|
return { newFileName, files };
|
|
142855
142978
|
}
|
|
142856
|
-
function getEditsForRefactor2(fileName, formatOptions, positionOrRange,
|
|
142979
|
+
function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
|
|
142857
142980
|
synchronizeHostData();
|
|
142858
142981
|
const file = getValidSourceFile(fileName);
|
|
142859
|
-
return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions),
|
|
142982
|
+
return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments);
|
|
142860
142983
|
}
|
|
142861
142984
|
function toLineColumnOffset(fileName, position) {
|
|
142862
142985
|
if (position === 0) {
|
|
@@ -153478,8 +153601,7 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
|
|
|
153478
153601
|
instanceTypes,
|
|
153479
153602
|
contextNode,
|
|
153480
153603
|
scriptTarget,
|
|
153481
|
-
/*
|
|
153482
|
-
void 0,
|
|
153604
|
+
1 /* NoTruncation */,
|
|
153483
153605
|
tracker
|
|
153484
153606
|
);
|
|
153485
153607
|
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0;
|
|
@@ -159532,6 +159654,7 @@ __export(ts_FindAllReferences_exports, {
|
|
|
159532
159654
|
getTextSpanOfEntry: () => getTextSpanOfEntry,
|
|
159533
159655
|
isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
|
|
159534
159656
|
isDeclarationOfSymbol: () => isDeclarationOfSymbol,
|
|
159657
|
+
isWriteAccessForReference: () => isWriteAccessForReference,
|
|
159535
159658
|
nodeEntry: () => nodeEntry,
|
|
159536
159659
|
toContextSpan: () => toContextSpan,
|
|
159537
159660
|
toHighlightSpan: () => toHighlightSpan,
|
|
@@ -172176,9 +172299,9 @@ function buildOverload(name) {
|
|
|
172176
172299
|
|
|
172177
172300
|
// src/deprecatedCompat/5.0/identifierProperties.ts
|
|
172178
172301
|
addObjectAllocatorPatcher((objectAllocator2) => {
|
|
172179
|
-
const
|
|
172180
|
-
if (!hasProperty(
|
|
172181
|
-
Object.defineProperty(
|
|
172302
|
+
const Identifier75 = objectAllocator2.getIdentifierConstructor();
|
|
172303
|
+
if (!hasProperty(Identifier75.prototype, "originalKeywordKind")) {
|
|
172304
|
+
Object.defineProperty(Identifier75.prototype, "originalKeywordKind", {
|
|
172182
172305
|
get: deprecate(function() {
|
|
172183
172306
|
return identifierToKeywordKind(this);
|
|
172184
172307
|
}, {
|
|
@@ -172190,8 +172313,8 @@ addObjectAllocatorPatcher((objectAllocator2) => {
|
|
|
172190
172313
|
})
|
|
172191
172314
|
});
|
|
172192
172315
|
}
|
|
172193
|
-
if (!hasProperty(
|
|
172194
|
-
Object.defineProperty(
|
|
172316
|
+
if (!hasProperty(Identifier75.prototype, "isInJSDocNamespace")) {
|
|
172317
|
+
Object.defineProperty(Identifier75.prototype, "isInJSDocNamespace", {
|
|
172195
172318
|
get: deprecate(function() {
|
|
172196
172319
|
return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
|
|
172197
172320
|
}, {
|