typescript 5.1.0-dev.20230301 → 5.1.0-dev.20230303
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 +135 -102
- package/lib/tsserver.js +878 -641
- package/lib/tsserverlibrary.d.ts +2 -37
- package/lib/tsserverlibrary.js +937 -691
- package/lib/typescript.d.ts +0 -3
- package/lib/typescript.js +815 -581
- package/lib/typingsInstaller.js +52 -49
- package/package.json +1 -1
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.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230303`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -1622,7 +1622,7 @@ var ts = (() => {
|
|
|
1622
1622
|
function isNodeLikeSystem() {
|
|
1623
1623
|
return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
|
|
1624
1624
|
}
|
|
1625
|
-
var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty,
|
|
1625
|
+
var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty, fileNameLowerCaseRegExp, AssertionLevel, createUIStringComparer, uiComparerCaseSensitive, uiLocale, trimString, trimStringEnd, trimStringStart;
|
|
1626
1626
|
var init_core = __esm({
|
|
1627
1627
|
"src/compiler/core.ts"() {
|
|
1628
1628
|
"use strict";
|
|
@@ -1647,10 +1647,6 @@ var ts = (() => {
|
|
|
1647
1647
|
return void 0;
|
|
1648
1648
|
};
|
|
1649
1649
|
hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1650
|
-
noopPush = {
|
|
1651
|
-
push: noop,
|
|
1652
|
-
length: 0
|
|
1653
|
-
};
|
|
1654
1650
|
fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
|
|
1655
1651
|
AssertionLevel = /* @__PURE__ */ ((AssertionLevel2) => {
|
|
1656
1652
|
AssertionLevel2[AssertionLevel2["None"] = 0] = "None";
|
|
@@ -3057,41 +3053,8 @@ ${lanes.join("\n")}
|
|
|
3057
3053
|
function tryGetNodePerformanceHooks() {
|
|
3058
3054
|
if (isNodeLikeSystem()) {
|
|
3059
3055
|
try {
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) {
|
|
3063
|
-
performance2 = nodePerformance;
|
|
3064
|
-
const version2 = new Version(process.versions.node);
|
|
3065
|
-
const range = new VersionRange("<12.16.3 || 13 <13.13");
|
|
3066
|
-
if (range.test(version2)) {
|
|
3067
|
-
performance2 = {
|
|
3068
|
-
get timeOrigin() {
|
|
3069
|
-
return nodePerformance.timeOrigin;
|
|
3070
|
-
},
|
|
3071
|
-
now() {
|
|
3072
|
-
return nodePerformance.now();
|
|
3073
|
-
},
|
|
3074
|
-
mark(name) {
|
|
3075
|
-
return nodePerformance.mark(name);
|
|
3076
|
-
},
|
|
3077
|
-
measure(name, start = "nodeStart", end) {
|
|
3078
|
-
if (end === void 0) {
|
|
3079
|
-
end = "__performance.measure-fix__";
|
|
3080
|
-
nodePerformance.mark(end);
|
|
3081
|
-
}
|
|
3082
|
-
nodePerformance.measure(name, start, end);
|
|
3083
|
-
if (end === "__performance.measure-fix__") {
|
|
3084
|
-
nodePerformance.clearMarks("__performance.measure-fix__");
|
|
3085
|
-
}
|
|
3086
|
-
},
|
|
3087
|
-
clearMarks(name) {
|
|
3088
|
-
return nodePerformance.clearMarks(name);
|
|
3089
|
-
},
|
|
3090
|
-
clearMeasures(name) {
|
|
3091
|
-
return nodePerformance.clearMeasures(name);
|
|
3092
|
-
}
|
|
3093
|
-
};
|
|
3094
|
-
}
|
|
3056
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
3057
|
+
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
3095
3058
|
return {
|
|
3096
3059
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
3097
3060
|
shouldWriteNativeEvents: false,
|
|
@@ -8458,6 +8421,7 @@ ${lanes.join("\n")}
|
|
|
8458
8421
|
File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
|
|
8459
8422
|
Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
|
|
8460
8423
|
Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
|
|
8424
|
+
Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
|
|
8461
8425
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
8462
8426
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
8463
8427
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -8853,6 +8817,8 @@ ${lanes.join("\n")}
|
|
|
8853
8817
|
This_may_be_converted_to_an_async_function: diag(80006, 2 /* Suggestion */, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."),
|
|
8854
8818
|
await_has_no_effect_on_the_type_of_this_expression: diag(80007, 2 /* Suggestion */, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."),
|
|
8855
8819
|
Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, 2 /* Suggestion */, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),
|
|
8820
|
+
JSDoc_typedef_may_be_converted_to_TypeScript_type: diag(80009, 2 /* Suggestion */, "JSDoc_typedef_may_be_converted_to_TypeScript_type_80009", "JSDoc typedef may be converted to TypeScript type."),
|
|
8821
|
+
JSDoc_typedefs_may_be_converted_to_TypeScript_types: diag(80010, 2 /* Suggestion */, "JSDoc_typedefs_may_be_converted_to_TypeScript_types_80010", "JSDoc typedefs may be converted to TypeScript types."),
|
|
8856
8822
|
Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
|
|
8857
8823
|
Make_super_call_the_first_statement_in_the_constructor: diag(90002, 3 /* Message */, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"),
|
|
8858
8824
|
Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
|
|
@@ -9067,6 +9033,8 @@ ${lanes.join("\n")}
|
|
|
9067
9033
|
Rename_param_tag_name_0_to_1: diag(95173, 3 /* Message */, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
|
|
9068
9034
|
Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
|
|
9069
9035
|
Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
9036
|
+
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
9037
|
+
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
9070
9038
|
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."),
|
|
9071
9039
|
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'."),
|
|
9072
9040
|
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?"),
|
|
@@ -38853,20 +38821,14 @@ ${lanes.join("\n")}
|
|
|
38853
38821
|
currentDirectory = host.getCurrentDirectory();
|
|
38854
38822
|
}
|
|
38855
38823
|
if (currentDirectory !== void 0) {
|
|
38856
|
-
return getDefaultTypeRoots(currentDirectory
|
|
38824
|
+
return getDefaultTypeRoots(currentDirectory);
|
|
38857
38825
|
}
|
|
38858
38826
|
}
|
|
38859
|
-
function getDefaultTypeRoots(currentDirectory
|
|
38860
|
-
if (!host.directoryExists) {
|
|
38861
|
-
return [combinePaths(currentDirectory, nodeModulesAtTypes)];
|
|
38862
|
-
}
|
|
38827
|
+
function getDefaultTypeRoots(currentDirectory) {
|
|
38863
38828
|
let typeRoots;
|
|
38864
38829
|
forEachAncestorDirectory(normalizePath(currentDirectory), (directory) => {
|
|
38865
38830
|
const atTypes = combinePaths(directory, nodeModulesAtTypes);
|
|
38866
|
-
|
|
38867
|
-
(typeRoots || (typeRoots = [])).push(atTypes);
|
|
38868
|
-
}
|
|
38869
|
-
return void 0;
|
|
38831
|
+
(typeRoots != null ? typeRoots : typeRoots = []).push(atTypes);
|
|
38870
38832
|
});
|
|
38871
38833
|
return typeRoots;
|
|
38872
38834
|
}
|
|
@@ -39002,10 +38964,22 @@ ${lanes.join("\n")}
|
|
|
39002
38964
|
}
|
|
39003
38965
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
39004
38966
|
const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
|
|
39005
|
-
const
|
|
39006
|
-
const directoryExists = directoryProbablyExists(candidateDirectory, host);
|
|
38967
|
+
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
39007
38968
|
if (!directoryExists && traceEnabled) {
|
|
39008
|
-
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,
|
|
38969
|
+
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
38970
|
+
}
|
|
38971
|
+
if (options.typeRoots) {
|
|
38972
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState);
|
|
38973
|
+
if (resolvedFromFile) {
|
|
38974
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
38975
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
38976
|
+
packageDirectory,
|
|
38977
|
+
/*onlyRecordFailures*/
|
|
38978
|
+
false,
|
|
38979
|
+
moduleResolutionState
|
|
38980
|
+
) : void 0;
|
|
38981
|
+
return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile));
|
|
38982
|
+
}
|
|
39009
38983
|
}
|
|
39010
38984
|
return resolvedTypeScriptOnly(
|
|
39011
38985
|
loadNodeModuleFromDirectory(
|
|
@@ -39025,33 +38999,37 @@ ${lanes.join("\n")}
|
|
|
39025
38999
|
function secondaryLookup() {
|
|
39026
39000
|
const initialLocationForSecondaryLookup = containingFile && getDirectoryPath(containingFile);
|
|
39027
39001
|
if (initialLocationForSecondaryLookup !== void 0) {
|
|
39028
|
-
if (traceEnabled) {
|
|
39029
|
-
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
39030
|
-
}
|
|
39031
39002
|
let result2;
|
|
39032
|
-
if (!
|
|
39033
|
-
|
|
39034
|
-
|
|
39035
|
-
|
|
39036
|
-
|
|
39037
|
-
|
|
39038
|
-
|
|
39039
|
-
|
|
39040
|
-
|
|
39041
|
-
|
|
39042
|
-
|
|
39043
|
-
|
|
39044
|
-
|
|
39045
|
-
|
|
39046
|
-
|
|
39047
|
-
|
|
39048
|
-
|
|
39049
|
-
|
|
39050
|
-
|
|
39051
|
-
|
|
39052
|
-
|
|
39053
|
-
|
|
39054
|
-
|
|
39003
|
+
if (!options.typeRoots || !endsWith(containingFile, inferredTypesContainingFile)) {
|
|
39004
|
+
if (traceEnabled) {
|
|
39005
|
+
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
39006
|
+
}
|
|
39007
|
+
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
39008
|
+
const searchResult = loadModuleFromNearestNodeModulesDirectory(
|
|
39009
|
+
4 /* Declaration */,
|
|
39010
|
+
typeReferenceDirectiveName,
|
|
39011
|
+
initialLocationForSecondaryLookup,
|
|
39012
|
+
moduleResolutionState,
|
|
39013
|
+
/*cache*/
|
|
39014
|
+
void 0,
|
|
39015
|
+
/*redirectedReference*/
|
|
39016
|
+
void 0
|
|
39017
|
+
);
|
|
39018
|
+
result2 = searchResult && searchResult.value;
|
|
39019
|
+
} else {
|
|
39020
|
+
const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName);
|
|
39021
|
+
result2 = nodeLoadModuleByRelativeName(
|
|
39022
|
+
4 /* Declaration */,
|
|
39023
|
+
candidate,
|
|
39024
|
+
/*onlyRecordFailures*/
|
|
39025
|
+
false,
|
|
39026
|
+
moduleResolutionState,
|
|
39027
|
+
/*considerPackageJson*/
|
|
39028
|
+
true
|
|
39029
|
+
);
|
|
39030
|
+
}
|
|
39031
|
+
} else if (traceEnabled) {
|
|
39032
|
+
trace(host, Diagnostics.Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder);
|
|
39055
39033
|
}
|
|
39056
39034
|
return resolvedTypeScriptOnly(result2);
|
|
39057
39035
|
} else {
|
|
@@ -39870,6 +39848,9 @@ ${lanes.join("\n")}
|
|
|
39870
39848
|
}
|
|
39871
39849
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
39872
39850
|
}
|
|
39851
|
+
if (extensions2 & 4 /* Declaration */) {
|
|
39852
|
+
resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
|
|
39853
|
+
}
|
|
39873
39854
|
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
39874
39855
|
} else {
|
|
39875
39856
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
@@ -40049,6 +40030,7 @@ ${lanes.join("\n")}
|
|
|
40049
40030
|
return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
|
|
40050
40031
|
}
|
|
40051
40032
|
function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
40033
|
+
var _a2;
|
|
40052
40034
|
if (!onlyRecordFailures) {
|
|
40053
40035
|
if (state.host.fileExists(fileName)) {
|
|
40054
40036
|
if (state.traceEnabled) {
|
|
@@ -40061,7 +40043,7 @@ ${lanes.join("\n")}
|
|
|
40061
40043
|
}
|
|
40062
40044
|
}
|
|
40063
40045
|
}
|
|
40064
|
-
state.failedLookupLocations.push(fileName);
|
|
40046
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
|
|
40065
40047
|
return void 0;
|
|
40066
40048
|
}
|
|
40067
40049
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
@@ -40176,8 +40158,8 @@ ${lanes.join("\n")}
|
|
|
40176
40158
|
host,
|
|
40177
40159
|
compilerOptions: options,
|
|
40178
40160
|
traceEnabled: isTraceEnabled(options, host),
|
|
40179
|
-
failedLookupLocations:
|
|
40180
|
-
affectingLocations:
|
|
40161
|
+
failedLookupLocations: void 0,
|
|
40162
|
+
affectingLocations: void 0,
|
|
40181
40163
|
packageJsonInfoCache,
|
|
40182
40164
|
features: 0 /* None */,
|
|
40183
40165
|
conditions: emptyArray,
|
|
@@ -40211,24 +40193,24 @@ ${lanes.join("\n")}
|
|
|
40211
40193
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
40212
40194
|
}
|
|
40213
40195
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
40214
|
-
var _a2, _b, _c;
|
|
40196
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
40215
40197
|
const { host, traceEnabled } = state;
|
|
40216
40198
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
40217
40199
|
if (onlyRecordFailures) {
|
|
40218
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40200
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
|
|
40219
40201
|
return void 0;
|
|
40220
40202
|
}
|
|
40221
|
-
const existing = (
|
|
40203
|
+
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
40222
40204
|
if (existing !== void 0) {
|
|
40223
40205
|
if (typeof existing !== "boolean") {
|
|
40224
40206
|
if (traceEnabled)
|
|
40225
40207
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40226
|
-
state.affectingLocations.push(packageJsonPath);
|
|
40208
|
+
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
40227
40209
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
40228
40210
|
} else {
|
|
40229
40211
|
if (existing && traceEnabled)
|
|
40230
40212
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40231
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40213
|
+
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
40232
40214
|
return void 0;
|
|
40233
40215
|
}
|
|
40234
40216
|
}
|
|
@@ -40239,15 +40221,15 @@ ${lanes.join("\n")}
|
|
|
40239
40221
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
40240
40222
|
}
|
|
40241
40223
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
40242
|
-
(
|
|
40243
|
-
state.affectingLocations.push(packageJsonPath);
|
|
40224
|
+
(_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
|
|
40225
|
+
(_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
40244
40226
|
return result;
|
|
40245
40227
|
} else {
|
|
40246
40228
|
if (directoryExists && traceEnabled) {
|
|
40247
40229
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
40248
40230
|
}
|
|
40249
|
-
(
|
|
40250
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40231
|
+
(_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
40232
|
+
(_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
|
|
40251
40233
|
}
|
|
40252
40234
|
}
|
|
40253
40235
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -41067,11 +41049,13 @@ ${lanes.join("\n")}
|
|
|
41067
41049
|
state
|
|
41068
41050
|
));
|
|
41069
41051
|
});
|
|
41070
|
-
if (resolved2)
|
|
41052
|
+
if (resolved2)
|
|
41071
41053
|
return resolved2;
|
|
41072
|
-
}
|
|
41073
41054
|
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
41074
|
-
|
|
41055
|
+
let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
41056
|
+
if (extensions & 4 /* Declaration */)
|
|
41057
|
+
resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
|
|
41058
|
+
return resolved3;
|
|
41075
41059
|
}
|
|
41076
41060
|
} else {
|
|
41077
41061
|
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
|
@@ -41085,6 +41069,31 @@ ${lanes.join("\n")}
|
|
|
41085
41069
|
}
|
|
41086
41070
|
}
|
|
41087
41071
|
}
|
|
41072
|
+
function resolveFromTypeRoot(moduleName, state) {
|
|
41073
|
+
if (!state.compilerOptions.typeRoots)
|
|
41074
|
+
return;
|
|
41075
|
+
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
41076
|
+
const candidate = combinePaths(typeRoot, moduleName);
|
|
41077
|
+
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
41078
|
+
if (!directoryExists && state.traceEnabled) {
|
|
41079
|
+
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
41080
|
+
}
|
|
41081
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state);
|
|
41082
|
+
if (resolvedFromFile) {
|
|
41083
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
41084
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
41085
|
+
packageDirectory,
|
|
41086
|
+
/*onlyRecordFailures*/
|
|
41087
|
+
false,
|
|
41088
|
+
state
|
|
41089
|
+
) : void 0;
|
|
41090
|
+
return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
|
|
41091
|
+
}
|
|
41092
|
+
const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
|
|
41093
|
+
if (resolved)
|
|
41094
|
+
return toSearchResult(resolved);
|
|
41095
|
+
}
|
|
41096
|
+
}
|
|
41088
41097
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
41089
41098
|
return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
|
|
41090
41099
|
}
|
|
@@ -54007,7 +54016,11 @@ ${lanes.join("\n")}
|
|
|
54007
54016
|
const baseTypeVariable = getBaseTypeVariableOfClass(symbol);
|
|
54008
54017
|
return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type;
|
|
54009
54018
|
} else {
|
|
54010
|
-
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
54019
|
+
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
54020
|
+
type,
|
|
54021
|
+
/*isProperty*/
|
|
54022
|
+
true
|
|
54023
|
+
) : type;
|
|
54011
54024
|
}
|
|
54012
54025
|
}
|
|
54013
54026
|
function getTypeOfEnumMember(symbol) {
|
|
@@ -62708,6 +62721,7 @@ ${lanes.join("\n")}
|
|
|
62708
62721
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
62709
62722
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
62710
62723
|
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
62724
|
+
instantiateType(source2.objectType, reportUnreliableMapper);
|
|
62711
62725
|
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
62712
62726
|
}
|
|
62713
62727
|
if (result2) {
|
|
@@ -65853,7 +65867,7 @@ ${lanes.join("\n")}
|
|
|
65853
65867
|
);
|
|
65854
65868
|
}
|
|
65855
65869
|
function isInAmbientOrTypeNode(node) {
|
|
65856
|
-
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
65870
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n)));
|
|
65857
65871
|
}
|
|
65858
65872
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
65859
65873
|
switch (node.kind) {
|
|
@@ -69001,6 +69015,16 @@ ${lanes.join("\n")}
|
|
|
69001
69015
|
const symbol = getSymbolOfDeclaration(element);
|
|
69002
69016
|
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
69003
69017
|
}
|
|
69018
|
+
if (hasDynamicName(element)) {
|
|
69019
|
+
const name = getNameOfDeclaration(element);
|
|
69020
|
+
if (name && isComputedPropertyName(name)) {
|
|
69021
|
+
const exprType = checkExpression(name.expression);
|
|
69022
|
+
const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
|
|
69023
|
+
if (propType) {
|
|
69024
|
+
return propType;
|
|
69025
|
+
}
|
|
69026
|
+
}
|
|
69027
|
+
}
|
|
69004
69028
|
if (element.name) {
|
|
69005
69029
|
const nameType = getLiteralTypeFromPropertyName(element.name);
|
|
69006
69030
|
return mapType(
|
|
@@ -71608,16 +71632,20 @@ ${lanes.join("\n")}
|
|
|
71608
71632
|
) : createTupleType([type], [8 /* Variadic */]);
|
|
71609
71633
|
}
|
|
71610
71634
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
71635
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
71611
71636
|
if (index >= argCount - 1) {
|
|
71612
71637
|
const arg = args[argCount - 1];
|
|
71613
71638
|
if (isSpreadArgument(arg)) {
|
|
71614
|
-
|
|
71639
|
+
const spreadType = arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
71640
|
+
if (isArrayLikeType(spreadType)) {
|
|
71641
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
71642
|
+
}
|
|
71643
|
+
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 227 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
71615
71644
|
}
|
|
71616
71645
|
}
|
|
71617
71646
|
const types = [];
|
|
71618
71647
|
const flags = [];
|
|
71619
71648
|
const names = [];
|
|
71620
|
-
const inConstContext = isConstTypeVariable(restType);
|
|
71621
71649
|
for (let i = index; i < argCount; i++) {
|
|
71622
71650
|
const arg = args[i];
|
|
71623
71651
|
if (isSpreadArgument(arg)) {
|
|
@@ -73774,7 +73802,7 @@ ${lanes.join("\n")}
|
|
|
73774
73802
|
}
|
|
73775
73803
|
function getNonArrayRestType(signature) {
|
|
73776
73804
|
const restType = getEffectiveRestType(signature);
|
|
73777
|
-
return restType && !isArrayType(restType) && !isTypeAny(restType)
|
|
73805
|
+
return restType && !isArrayType(restType) && !isTypeAny(restType) ? restType : void 0;
|
|
73778
73806
|
}
|
|
73779
73807
|
function getTypeOfFirstParameterOfSignature(signature) {
|
|
73780
73808
|
return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType);
|
|
@@ -78588,6 +78616,9 @@ ${lanes.join("\n")}
|
|
|
78588
78616
|
return;
|
|
78589
78617
|
}
|
|
78590
78618
|
if (isBindingPattern(node.name)) {
|
|
78619
|
+
if (isInAmbientOrTypeNode(node)) {
|
|
78620
|
+
return;
|
|
78621
|
+
}
|
|
78591
78622
|
const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* ForInStatement */;
|
|
78592
78623
|
const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression));
|
|
78593
78624
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
@@ -121573,7 +121604,7 @@ ${lanes.join("\n")}
|
|
|
121573
121604
|
return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
121574
121605
|
}
|
|
121575
121606
|
function createTypeRootsWatch(typeRootPath, typeRoot) {
|
|
121576
|
-
return resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
121607
|
+
return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
121577
121608
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
121578
121609
|
if (cachedDirectoryStructureHost) {
|
|
121579
121610
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -121584,7 +121615,7 @@ ${lanes.join("\n")}
|
|
|
121584
121615
|
if (dirPath) {
|
|
121585
121616
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
121586
121617
|
}
|
|
121587
|
-
}, 1 /* Recursive */);
|
|
121618
|
+
}, 1 /* Recursive */) : noopFileWatcher;
|
|
121588
121619
|
}
|
|
121589
121620
|
function updateTypeRootsWatch() {
|
|
121590
121621
|
const options = resolutionHost.getCompilationSettings();
|
|
@@ -121592,7 +121623,7 @@ ${lanes.join("\n")}
|
|
|
121592
121623
|
closeTypeRootsWatch();
|
|
121593
121624
|
return;
|
|
121594
121625
|
}
|
|
121595
|
-
const typeRoots = getEffectiveTypeRoots(options, {
|
|
121626
|
+
const typeRoots = getEffectiveTypeRoots(options, { getCurrentDirectory });
|
|
121596
121627
|
if (typeRoots) {
|
|
121597
121628
|
mutateMap(
|
|
121598
121629
|
typeRootsWatches,
|
|
@@ -121606,7 +121637,9 @@ ${lanes.join("\n")}
|
|
|
121606
121637
|
closeTypeRootsWatch();
|
|
121607
121638
|
}
|
|
121608
121639
|
}
|
|
121609
|
-
function
|
|
121640
|
+
function canWatchTypeRootPath(nodeTypesDirectory) {
|
|
121641
|
+
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
121642
|
+
return true;
|
|
121610
121643
|
const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
|
|
121611
121644
|
const dirPath = resolutionHost.toPath(dir);
|
|
121612
121645
|
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
@@ -131649,6 +131682,10 @@ ${lanes.join("\n")}
|
|
|
131649
131682
|
diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
|
|
131650
131683
|
}
|
|
131651
131684
|
}
|
|
131685
|
+
const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node);
|
|
131686
|
+
if (jsdocTypedefNode) {
|
|
131687
|
+
diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
|
|
131688
|
+
}
|
|
131652
131689
|
if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
|
|
131653
131690
|
diags.push(createDiagnosticForNode(node.name || node, Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types));
|
|
131654
131691
|
}
|
|
@@ -133464,18 +133501,6 @@ ${lanes.join("\n")}
|
|
|
133464
133501
|
synchronizeHostData();
|
|
133465
133502
|
return ts_FindAllReferences_exports.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position);
|
|
133466
133503
|
}
|
|
133467
|
-
function getOccurrencesAtPosition(fileName, position) {
|
|
133468
|
-
return flatMap(
|
|
133469
|
-
getDocumentHighlights(fileName, position, [fileName]),
|
|
133470
|
-
(entry) => entry.highlightSpans.map((highlightSpan) => ({
|
|
133471
|
-
fileName: entry.fileName,
|
|
133472
|
-
textSpan: highlightSpan.textSpan,
|
|
133473
|
-
isWriteAccess: highlightSpan.kind === "writtenReference" /* writtenReference */,
|
|
133474
|
-
...highlightSpan.isInString && { isInString: true },
|
|
133475
|
-
...highlightSpan.contextSpan && { contextSpan: highlightSpan.contextSpan }
|
|
133476
|
-
}))
|
|
133477
|
-
);
|
|
133478
|
-
}
|
|
133479
133504
|
function getDocumentHighlights(fileName, position, filesToSearch) {
|
|
133480
133505
|
const normalizedFileName = normalizePath(fileName);
|
|
133481
133506
|
Debug.assert(filesToSearch.some((f) => normalizePath(f) === normalizedFileName));
|
|
@@ -133668,22 +133693,22 @@ ${lanes.join("\n")}
|
|
|
133668
133693
|
}
|
|
133669
133694
|
return [];
|
|
133670
133695
|
}
|
|
133671
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
133696
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes64, formatOptions, preferences = emptyOptions) {
|
|
133672
133697
|
synchronizeHostData();
|
|
133673
133698
|
const sourceFile = getValidSourceFile(fileName);
|
|
133674
133699
|
const span = createTextSpanFromBounds(start, end);
|
|
133675
133700
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133676
|
-
return flatMap(deduplicate(
|
|
133701
|
+
return flatMap(deduplicate(errorCodes64, equateValues, compareValues), (errorCode) => {
|
|
133677
133702
|
cancellationToken.throwIfCancellationRequested();
|
|
133678
133703
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
133679
133704
|
});
|
|
133680
133705
|
}
|
|
133681
|
-
function getCombinedCodeFix(scope,
|
|
133706
|
+
function getCombinedCodeFix(scope, fixId52, formatOptions, preferences = emptyOptions) {
|
|
133682
133707
|
synchronizeHostData();
|
|
133683
133708
|
Debug.assert(scope.type === "file");
|
|
133684
133709
|
const sourceFile = getValidSourceFile(scope.fileName);
|
|
133685
133710
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133686
|
-
return ts_codefix_exports.getAllFixes({ fixId:
|
|
133711
|
+
return ts_codefix_exports.getAllFixes({ fixId: fixId52, sourceFile, program, host, cancellationToken, formatContext, preferences });
|
|
133687
133712
|
}
|
|
133688
133713
|
function organizeImports2(args, formatOptions, preferences = emptyOptions) {
|
|
133689
133714
|
var _a3;
|
|
@@ -134105,7 +134130,6 @@ ${lanes.join("\n")}
|
|
|
134105
134130
|
getReferencesAtPosition,
|
|
134106
134131
|
findReferences,
|
|
134107
134132
|
getFileReferences,
|
|
134108
|
-
getOccurrencesAtPosition,
|
|
134109
134133
|
getDocumentHighlights,
|
|
134110
134134
|
getNameOrDottedNameSpan,
|
|
134111
134135
|
getBreakpointStatementAtPosition,
|
|
@@ -134931,7 +134955,6 @@ ${lanes.join("\n")}
|
|
|
134931
134955
|
"getTypeDefinitionAtPosition",
|
|
134932
134956
|
"getReferencesAtPosition",
|
|
134933
134957
|
"findReferences",
|
|
134934
|
-
"getOccurrencesAtPosition",
|
|
134935
134958
|
"getDocumentHighlights",
|
|
134936
134959
|
"getNavigateToItems",
|
|
134937
134960
|
"getRenameInfo",
|
|
@@ -135515,12 +135538,6 @@ ${lanes.join("\n")}
|
|
|
135515
135538
|
() => this.languageService.getFileReferences(fileName)
|
|
135516
135539
|
);
|
|
135517
135540
|
}
|
|
135518
|
-
getOccurrencesAtPosition(fileName, position) {
|
|
135519
|
-
return this.forwardJSONCall(
|
|
135520
|
-
`getOccurrencesAtPosition('${fileName}', ${position})`,
|
|
135521
|
-
() => this.languageService.getOccurrencesAtPosition(fileName, position)
|
|
135522
|
-
);
|
|
135523
|
-
}
|
|
135524
135541
|
getDocumentHighlights(fileName, position, filesToSearch) {
|
|
135525
135542
|
return this.forwardJSONCall(
|
|
135526
135543
|
`getDocumentHighlights('${fileName}', ${position})`,
|
|
@@ -137154,41 +137171,42 @@ ${lanes.join("\n")}
|
|
|
137154
137171
|
void 0
|
|
137155
137172
|
);
|
|
137156
137173
|
}
|
|
137157
|
-
function createCodeFixAction(fixName8, changes, description2,
|
|
137158
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137174
|
+
function createCodeFixAction(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137175
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, diagnosticToString(fixAllDescription), command);
|
|
137159
137176
|
}
|
|
137160
|
-
function createCodeFixActionMaybeFixAll(fixName8, changes, description2,
|
|
137161
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137177
|
+
function createCodeFixActionMaybeFixAll(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137178
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
137162
137179
|
}
|
|
137163
|
-
function createCodeFixActionWorker(fixName8, description2, changes,
|
|
137164
|
-
return { fixName: fixName8, description: description2, changes, fixId:
|
|
137180
|
+
function createCodeFixActionWorker(fixName8, description2, changes, fixId52, fixAllDescription, command) {
|
|
137181
|
+
return { fixName: fixName8, description: description2, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
137165
137182
|
}
|
|
137166
137183
|
function registerCodeFix(reg) {
|
|
137167
137184
|
for (const error of reg.errorCodes) {
|
|
137185
|
+
errorCodeToFixesArray = void 0;
|
|
137168
137186
|
errorCodeToFixes.add(String(error), reg);
|
|
137169
137187
|
}
|
|
137170
137188
|
if (reg.fixIds) {
|
|
137171
|
-
for (const
|
|
137172
|
-
Debug.assert(!fixIdToRegistration.has(
|
|
137173
|
-
fixIdToRegistration.set(
|
|
137189
|
+
for (const fixId52 of reg.fixIds) {
|
|
137190
|
+
Debug.assert(!fixIdToRegistration.has(fixId52));
|
|
137191
|
+
fixIdToRegistration.set(fixId52, reg);
|
|
137174
137192
|
}
|
|
137175
137193
|
}
|
|
137176
137194
|
}
|
|
137177
137195
|
function getSupportedErrorCodes() {
|
|
137178
|
-
return arrayFrom(errorCodeToFixes.keys());
|
|
137196
|
+
return errorCodeToFixesArray != null ? errorCodeToFixesArray : errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys());
|
|
137179
137197
|
}
|
|
137180
137198
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
137181
|
-
const { errorCodes:
|
|
137199
|
+
const { errorCodes: errorCodes64 } = registration;
|
|
137182
137200
|
let maybeFixableDiagnostics = 0;
|
|
137183
137201
|
for (const diag2 of diagnostics) {
|
|
137184
|
-
if (contains(
|
|
137202
|
+
if (contains(errorCodes64, diag2.code))
|
|
137185
137203
|
maybeFixableDiagnostics++;
|
|
137186
137204
|
if (maybeFixableDiagnostics > 1)
|
|
137187
137205
|
break;
|
|
137188
137206
|
}
|
|
137189
137207
|
const fixAllUnavailable = maybeFixableDiagnostics < 2;
|
|
137190
|
-
return ({ fixId:
|
|
137191
|
-
return fixAllUnavailable ? action : { ...action, fixId:
|
|
137208
|
+
return ({ fixId: fixId52, fixAllDescription, ...action }) => {
|
|
137209
|
+
return fixAllUnavailable ? action : { ...action, fixId: fixId52, fixAllDescription };
|
|
137192
137210
|
};
|
|
137193
137211
|
}
|
|
137194
137212
|
function getFixes(context) {
|
|
@@ -137205,14 +137223,14 @@ ${lanes.join("\n")}
|
|
|
137205
137223
|
function createFileTextChanges(fileName, textChanges2) {
|
|
137206
137224
|
return { fileName, textChanges: textChanges2 };
|
|
137207
137225
|
}
|
|
137208
|
-
function codeFixAll(context,
|
|
137226
|
+
function codeFixAll(context, errorCodes64, use) {
|
|
137209
137227
|
const commands = [];
|
|
137210
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
137228
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes64, (diag2) => use(t, diag2, commands)));
|
|
137211
137229
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
137212
137230
|
}
|
|
137213
|
-
function eachDiagnostic(context,
|
|
137231
|
+
function eachDiagnostic(context, errorCodes64, cb) {
|
|
137214
137232
|
for (const diag2 of getDiagnostics(context)) {
|
|
137215
|
-
if (contains(
|
|
137233
|
+
if (contains(errorCodes64, diag2.code)) {
|
|
137216
137234
|
cb(diag2);
|
|
137217
137235
|
}
|
|
137218
137236
|
}
|
|
@@ -137224,7 +137242,7 @@ ${lanes.join("\n")}
|
|
|
137224
137242
|
...computeSuggestionDiagnostics(sourceFile, program, cancellationToken)
|
|
137225
137243
|
];
|
|
137226
137244
|
}
|
|
137227
|
-
var errorCodeToFixes, fixIdToRegistration;
|
|
137245
|
+
var errorCodeToFixes, fixIdToRegistration, errorCodeToFixesArray;
|
|
137228
137246
|
var init_codeFixProvider = __esm({
|
|
137229
137247
|
"src/services/codeFixProvider.ts"() {
|
|
137230
137248
|
"use strict";
|
|
@@ -139794,32 +139812,96 @@ ${lanes.join("\n")}
|
|
|
139794
139812
|
});
|
|
139795
139813
|
|
|
139796
139814
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
139797
|
-
function
|
|
139798
|
-
|
|
139815
|
+
function getDeclaration2(sourceFile, pos) {
|
|
139816
|
+
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
139817
|
+
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
139799
139818
|
}
|
|
139800
|
-
function
|
|
139801
|
-
if (
|
|
139802
|
-
|
|
139803
|
-
|
|
139804
|
-
|
|
139805
|
-
|
|
139806
|
-
|
|
139807
|
-
|
|
139808
|
-
changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration(
|
|
139809
|
-
importDeclaration,
|
|
139810
|
-
/*modifiers*/
|
|
139811
|
-
void 0,
|
|
139812
|
-
factory.createImportClause(
|
|
139813
|
-
/*isTypeOnly*/
|
|
139814
|
-
true,
|
|
139815
|
-
importClause.name,
|
|
139816
|
-
/*namedBindings*/
|
|
139817
|
-
void 0
|
|
139818
|
-
),
|
|
139819
|
-
importDeclaration.moduleSpecifier,
|
|
139820
|
-
/*assertClause*/
|
|
139821
|
-
void 0
|
|
139819
|
+
function doChange4(changes, sourceFile, declaration) {
|
|
139820
|
+
if (isImportSpecifier(declaration)) {
|
|
139821
|
+
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
139822
|
+
declaration,
|
|
139823
|
+
/*isTypeOnly*/
|
|
139824
|
+
true,
|
|
139825
|
+
declaration.propertyName,
|
|
139826
|
+
declaration.name
|
|
139822
139827
|
));
|
|
139828
|
+
} else {
|
|
139829
|
+
const importClause = declaration.importClause;
|
|
139830
|
+
if (importClause.name && importClause.namedBindings) {
|
|
139831
|
+
changes.replaceNodeWithNodes(sourceFile, declaration, [
|
|
139832
|
+
factory.createImportDeclaration(
|
|
139833
|
+
getSynthesizedDeepClones(
|
|
139834
|
+
declaration.modifiers,
|
|
139835
|
+
/*includeTrivia*/
|
|
139836
|
+
true
|
|
139837
|
+
),
|
|
139838
|
+
factory.createImportClause(
|
|
139839
|
+
/*isTypeOnly*/
|
|
139840
|
+
true,
|
|
139841
|
+
getSynthesizedDeepClone(
|
|
139842
|
+
importClause.name,
|
|
139843
|
+
/*includeTrivia*/
|
|
139844
|
+
true
|
|
139845
|
+
),
|
|
139846
|
+
/*namedBindings*/
|
|
139847
|
+
void 0
|
|
139848
|
+
),
|
|
139849
|
+
getSynthesizedDeepClone(
|
|
139850
|
+
declaration.moduleSpecifier,
|
|
139851
|
+
/*includeTrivia*/
|
|
139852
|
+
true
|
|
139853
|
+
),
|
|
139854
|
+
getSynthesizedDeepClone(
|
|
139855
|
+
declaration.assertClause,
|
|
139856
|
+
/*includeTrivia*/
|
|
139857
|
+
true
|
|
139858
|
+
)
|
|
139859
|
+
),
|
|
139860
|
+
factory.createImportDeclaration(
|
|
139861
|
+
getSynthesizedDeepClones(
|
|
139862
|
+
declaration.modifiers,
|
|
139863
|
+
/*includeTrivia*/
|
|
139864
|
+
true
|
|
139865
|
+
),
|
|
139866
|
+
factory.createImportClause(
|
|
139867
|
+
/*isTypeOnly*/
|
|
139868
|
+
true,
|
|
139869
|
+
/*name*/
|
|
139870
|
+
void 0,
|
|
139871
|
+
getSynthesizedDeepClone(
|
|
139872
|
+
importClause.namedBindings,
|
|
139873
|
+
/*includeTrivia*/
|
|
139874
|
+
true
|
|
139875
|
+
)
|
|
139876
|
+
),
|
|
139877
|
+
getSynthesizedDeepClone(
|
|
139878
|
+
declaration.moduleSpecifier,
|
|
139879
|
+
/*includeTrivia*/
|
|
139880
|
+
true
|
|
139881
|
+
),
|
|
139882
|
+
getSynthesizedDeepClone(
|
|
139883
|
+
declaration.assertClause,
|
|
139884
|
+
/*includeTrivia*/
|
|
139885
|
+
true
|
|
139886
|
+
)
|
|
139887
|
+
)
|
|
139888
|
+
]);
|
|
139889
|
+
} else {
|
|
139890
|
+
const importDeclaration = factory.updateImportDeclaration(
|
|
139891
|
+
declaration,
|
|
139892
|
+
declaration.modifiers,
|
|
139893
|
+
factory.updateImportClause(
|
|
139894
|
+
importClause,
|
|
139895
|
+
/*isTypeOnly*/
|
|
139896
|
+
true,
|
|
139897
|
+
importClause.name,
|
|
139898
|
+
importClause.namedBindings
|
|
139899
|
+
),
|
|
139900
|
+
declaration.moduleSpecifier,
|
|
139901
|
+
declaration.assertClause
|
|
139902
|
+
);
|
|
139903
|
+
changes.replaceNode(sourceFile, declaration, importDeclaration);
|
|
139904
|
+
}
|
|
139823
139905
|
}
|
|
139824
139906
|
}
|
|
139825
139907
|
var errorCodes14, fixId13;
|
|
@@ -139828,30 +139910,181 @@ ${lanes.join("\n")}
|
|
|
139828
139910
|
"use strict";
|
|
139829
139911
|
init_ts4();
|
|
139830
139912
|
init_ts_codefix();
|
|
139831
|
-
errorCodes14 = [
|
|
139913
|
+
errorCodes14 = [
|
|
139914
|
+
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
139915
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
139916
|
+
];
|
|
139832
139917
|
fixId13 = "convertToTypeOnlyImport";
|
|
139833
139918
|
registerCodeFix({
|
|
139834
139919
|
errorCodes: errorCodes14,
|
|
139835
139920
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139836
|
-
const
|
|
139837
|
-
|
|
139838
|
-
|
|
139839
|
-
});
|
|
139840
|
-
if (changes.length) {
|
|
139921
|
+
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
139922
|
+
if (declaration) {
|
|
139923
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration));
|
|
139841
139924
|
return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
|
|
139842
139925
|
}
|
|
139926
|
+
return void 0;
|
|
139843
139927
|
},
|
|
139844
139928
|
fixIds: [fixId13],
|
|
139845
139929
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139846
139930
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
139847
|
-
const
|
|
139848
|
-
|
|
139931
|
+
const declaration = getDeclaration2(diag2.file, diag2.start);
|
|
139932
|
+
if (declaration) {
|
|
139933
|
+
doChange4(changes, diag2.file, declaration);
|
|
139934
|
+
}
|
|
139849
139935
|
});
|
|
139850
139936
|
}
|
|
139851
139937
|
});
|
|
139852
139938
|
}
|
|
139853
139939
|
});
|
|
139854
139940
|
|
|
139941
|
+
// src/services/codefixes/convertTypedefToType.ts
|
|
139942
|
+
function doChange5(changes, node, sourceFile) {
|
|
139943
|
+
if (isJSDocTypedefTag(node)) {
|
|
139944
|
+
fixSingleTypeDef(changes, node, sourceFile);
|
|
139945
|
+
}
|
|
139946
|
+
}
|
|
139947
|
+
function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
|
|
139948
|
+
if (!typeDefNode)
|
|
139949
|
+
return;
|
|
139950
|
+
const declaration = createDeclaration(typeDefNode);
|
|
139951
|
+
if (!declaration)
|
|
139952
|
+
return;
|
|
139953
|
+
const comment = typeDefNode.parent;
|
|
139954
|
+
changes.replaceNode(
|
|
139955
|
+
sourceFile,
|
|
139956
|
+
comment,
|
|
139957
|
+
declaration
|
|
139958
|
+
);
|
|
139959
|
+
}
|
|
139960
|
+
function createDeclaration(tag) {
|
|
139961
|
+
var _a2;
|
|
139962
|
+
const { typeExpression } = tag;
|
|
139963
|
+
if (!typeExpression)
|
|
139964
|
+
return;
|
|
139965
|
+
const typeName = (_a2 = tag.name) == null ? void 0 : _a2.getText();
|
|
139966
|
+
if (!typeName)
|
|
139967
|
+
return;
|
|
139968
|
+
if (typeExpression.kind === 325 /* JSDocTypeLiteral */) {
|
|
139969
|
+
return createInterfaceForTypeLiteral(typeName, typeExpression);
|
|
139970
|
+
}
|
|
139971
|
+
if (typeExpression.kind === 312 /* JSDocTypeExpression */) {
|
|
139972
|
+
return createTypeAliasForTypeExpression(typeName, typeExpression);
|
|
139973
|
+
}
|
|
139974
|
+
}
|
|
139975
|
+
function createInterfaceForTypeLiteral(typeName, typeLiteral) {
|
|
139976
|
+
const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
|
|
139977
|
+
if (!some(propertySignatures))
|
|
139978
|
+
return;
|
|
139979
|
+
const interfaceDeclaration = factory.createInterfaceDeclaration(
|
|
139980
|
+
/*modifiers*/
|
|
139981
|
+
void 0,
|
|
139982
|
+
typeName,
|
|
139983
|
+
/*typeParameters*/
|
|
139984
|
+
void 0,
|
|
139985
|
+
/*heritageClauses*/
|
|
139986
|
+
void 0,
|
|
139987
|
+
propertySignatures
|
|
139988
|
+
);
|
|
139989
|
+
return interfaceDeclaration;
|
|
139990
|
+
}
|
|
139991
|
+
function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
139992
|
+
const typeReference = getSynthesizedDeepClone(typeExpression.type);
|
|
139993
|
+
if (!typeReference)
|
|
139994
|
+
return;
|
|
139995
|
+
const declaration = factory.createTypeAliasDeclaration(
|
|
139996
|
+
/*modifiers*/
|
|
139997
|
+
void 0,
|
|
139998
|
+
factory.createIdentifier(typeName),
|
|
139999
|
+
/*typeParameters*/
|
|
140000
|
+
void 0,
|
|
140001
|
+
typeReference
|
|
140002
|
+
);
|
|
140003
|
+
return declaration;
|
|
140004
|
+
}
|
|
140005
|
+
function createSignatureFromTypeLiteral(typeLiteral) {
|
|
140006
|
+
const propertyTags = typeLiteral.jsDocPropertyTags;
|
|
140007
|
+
if (!some(propertyTags))
|
|
140008
|
+
return;
|
|
140009
|
+
const getSignature = (tag) => {
|
|
140010
|
+
var _a2;
|
|
140011
|
+
const name = getPropertyName(tag);
|
|
140012
|
+
const type = (_a2 = tag.typeExpression) == null ? void 0 : _a2.type;
|
|
140013
|
+
const isOptional = tag.isBracketed;
|
|
140014
|
+
let typeReference;
|
|
140015
|
+
if (type && isJSDocTypeLiteral(type)) {
|
|
140016
|
+
const signatures = createSignatureFromTypeLiteral(type);
|
|
140017
|
+
typeReference = factory.createTypeLiteralNode(signatures);
|
|
140018
|
+
} else if (type) {
|
|
140019
|
+
typeReference = getSynthesizedDeepClone(type);
|
|
140020
|
+
}
|
|
140021
|
+
if (typeReference && name) {
|
|
140022
|
+
const questionToken = isOptional ? factory.createToken(57 /* QuestionToken */) : void 0;
|
|
140023
|
+
const prop = factory.createPropertySignature(
|
|
140024
|
+
/*modifiers*/
|
|
140025
|
+
void 0,
|
|
140026
|
+
name,
|
|
140027
|
+
questionToken,
|
|
140028
|
+
typeReference
|
|
140029
|
+
);
|
|
140030
|
+
return prop;
|
|
140031
|
+
}
|
|
140032
|
+
};
|
|
140033
|
+
const props = mapDefined(propertyTags, getSignature);
|
|
140034
|
+
return props;
|
|
140035
|
+
}
|
|
140036
|
+
function getPropertyName(tag) {
|
|
140037
|
+
return tag.name.kind === 79 /* Identifier */ ? tag.name.text : tag.name.right.text;
|
|
140038
|
+
}
|
|
140039
|
+
function getJSDocTypedefNode(node) {
|
|
140040
|
+
if (hasJSDocNodes(node)) {
|
|
140041
|
+
return forEach(node.jsDoc, (node2) => {
|
|
140042
|
+
var _a2;
|
|
140043
|
+
return (_a2 = node2.tags) == null ? void 0 : _a2.find(isJSDocTypedefTag);
|
|
140044
|
+
});
|
|
140045
|
+
}
|
|
140046
|
+
return void 0;
|
|
140047
|
+
}
|
|
140048
|
+
var fixId14, errorCodes15;
|
|
140049
|
+
var init_convertTypedefToType = __esm({
|
|
140050
|
+
"src/services/codefixes/convertTypedefToType.ts"() {
|
|
140051
|
+
"use strict";
|
|
140052
|
+
init_ts4();
|
|
140053
|
+
init_ts_codefix();
|
|
140054
|
+
fixId14 = "convertTypedefToType";
|
|
140055
|
+
errorCodes15 = [Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type.code];
|
|
140056
|
+
registerCodeFix({
|
|
140057
|
+
fixIds: [fixId14],
|
|
140058
|
+
errorCodes: errorCodes15,
|
|
140059
|
+
getCodeActions(context) {
|
|
140060
|
+
const node = getTokenAtPosition(
|
|
140061
|
+
context.sourceFile,
|
|
140062
|
+
context.span.start
|
|
140063
|
+
);
|
|
140064
|
+
if (!node)
|
|
140065
|
+
return;
|
|
140066
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, node, context.sourceFile));
|
|
140067
|
+
if (changes.length > 0) {
|
|
140068
|
+
return [
|
|
140069
|
+
createCodeFixAction(
|
|
140070
|
+
fixId14,
|
|
140071
|
+
changes,
|
|
140072
|
+
Diagnostics.Convert_typedef_to_TypeScript_type,
|
|
140073
|
+
fixId14,
|
|
140074
|
+
Diagnostics.Convert_all_typedef_to_TypeScript_types
|
|
140075
|
+
)
|
|
140076
|
+
];
|
|
140077
|
+
}
|
|
140078
|
+
},
|
|
140079
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
|
|
140080
|
+
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
140081
|
+
if (node)
|
|
140082
|
+
doChange5(changes, node, diag2.file);
|
|
140083
|
+
})
|
|
140084
|
+
});
|
|
140085
|
+
}
|
|
140086
|
+
});
|
|
140087
|
+
|
|
139855
140088
|
// src/services/codefixes/convertLiteralTypeToMappedType.ts
|
|
139856
140089
|
function getInfo2(sourceFile, pos) {
|
|
139857
140090
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -139867,7 +140100,7 @@ ${lanes.join("\n")}
|
|
|
139867
140100
|
}
|
|
139868
140101
|
return void 0;
|
|
139869
140102
|
}
|
|
139870
|
-
function
|
|
140103
|
+
function doChange6(changes, sourceFile, { container, typeNode, constraint, name }) {
|
|
139871
140104
|
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
|
|
139872
140105
|
/*readonlyToken*/
|
|
139873
140106
|
void 0,
|
|
@@ -139886,16 +140119,16 @@ ${lanes.join("\n")}
|
|
|
139886
140119
|
void 0
|
|
139887
140120
|
));
|
|
139888
140121
|
}
|
|
139889
|
-
var
|
|
140122
|
+
var fixId15, errorCodes16;
|
|
139890
140123
|
var init_convertLiteralTypeToMappedType = __esm({
|
|
139891
140124
|
"src/services/codefixes/convertLiteralTypeToMappedType.ts"() {
|
|
139892
140125
|
"use strict";
|
|
139893
140126
|
init_ts4();
|
|
139894
140127
|
init_ts_codefix();
|
|
139895
|
-
|
|
139896
|
-
|
|
140128
|
+
fixId15 = "convertLiteralTypeToMappedType";
|
|
140129
|
+
errorCodes16 = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code];
|
|
139897
140130
|
registerCodeFix({
|
|
139898
|
-
errorCodes:
|
|
140131
|
+
errorCodes: errorCodes16,
|
|
139899
140132
|
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
139900
140133
|
const { sourceFile, span } = context;
|
|
139901
140134
|
const info = getInfo2(sourceFile, span.start);
|
|
@@ -139903,14 +140136,14 @@ ${lanes.join("\n")}
|
|
|
139903
140136
|
return void 0;
|
|
139904
140137
|
}
|
|
139905
140138
|
const { name, constraint } = info;
|
|
139906
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
139907
|
-
return [createCodeFixAction(
|
|
140139
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, sourceFile, info));
|
|
140140
|
+
return [createCodeFixAction(fixId15, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId15, Diagnostics.Convert_all_type_literals_to_mapped_type)];
|
|
139908
140141
|
},
|
|
139909
|
-
fixIds: [
|
|
139910
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
140142
|
+
fixIds: [fixId15],
|
|
140143
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes16, (changes, diag2) => {
|
|
139911
140144
|
const info = getInfo2(diag2.file, diag2.start);
|
|
139912
140145
|
if (info) {
|
|
139913
|
-
|
|
140146
|
+
doChange6(changes, diag2.file, info);
|
|
139914
140147
|
}
|
|
139915
140148
|
})
|
|
139916
140149
|
});
|
|
@@ -139969,31 +140202,31 @@ ${lanes.join("\n")}
|
|
|
139969
140202
|
const heritageClauseTypeSymbols = checker.getPropertiesOfType(heritageClauseType);
|
|
139970
140203
|
return createSymbolTable(heritageClauseTypeSymbols.filter(symbolPointsToNonPrivateMember));
|
|
139971
140204
|
}
|
|
139972
|
-
var
|
|
140205
|
+
var errorCodes17, fixId16;
|
|
139973
140206
|
var init_fixClassIncorrectlyImplementsInterface = __esm({
|
|
139974
140207
|
"src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts"() {
|
|
139975
140208
|
"use strict";
|
|
139976
140209
|
init_ts4();
|
|
139977
140210
|
init_ts_codefix();
|
|
139978
|
-
|
|
140211
|
+
errorCodes17 = [
|
|
139979
140212
|
Diagnostics.Class_0_incorrectly_implements_interface_1.code,
|
|
139980
140213
|
Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code
|
|
139981
140214
|
];
|
|
139982
|
-
|
|
140215
|
+
fixId16 = "fixClassIncorrectlyImplementsInterface";
|
|
139983
140216
|
registerCodeFix({
|
|
139984
|
-
errorCodes:
|
|
140217
|
+
errorCodes: errorCodes17,
|
|
139985
140218
|
getCodeActions(context) {
|
|
139986
140219
|
const { sourceFile, span } = context;
|
|
139987
140220
|
const classDeclaration = getClass(sourceFile, span.start);
|
|
139988
140221
|
return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => {
|
|
139989
140222
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences));
|
|
139990
|
-
return changes.length === 0 ? void 0 : createCodeFixAction(
|
|
140223
|
+
return changes.length === 0 ? void 0 : createCodeFixAction(fixId16, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId16, Diagnostics.Implement_all_unimplemented_interfaces);
|
|
139991
140224
|
});
|
|
139992
140225
|
},
|
|
139993
|
-
fixIds: [
|
|
140226
|
+
fixIds: [fixId16],
|
|
139994
140227
|
getAllCodeActions(context) {
|
|
139995
140228
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
139996
|
-
return codeFixAll(context,
|
|
140229
|
+
return codeFixAll(context, errorCodes17, (changes, diag2) => {
|
|
139997
140230
|
const classDeclaration = getClass(diag2.file, diag2.start);
|
|
139998
140231
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
139999
140232
|
for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) {
|
|
@@ -141167,7 +141400,7 @@ ${lanes.join("\n")}
|
|
|
141167
141400
|
}
|
|
141168
141401
|
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
141169
141402
|
}
|
|
141170
|
-
var importFixName, importFixId,
|
|
141403
|
+
var importFixName, importFixId, errorCodes18;
|
|
141171
141404
|
var init_importFixes = __esm({
|
|
141172
141405
|
"src/services/codefixes/importFixes.ts"() {
|
|
141173
141406
|
"use strict";
|
|
@@ -141175,7 +141408,7 @@ ${lanes.join("\n")}
|
|
|
141175
141408
|
init_ts_codefix();
|
|
141176
141409
|
importFixName = "import";
|
|
141177
141410
|
importFixId = "fixMissingImport";
|
|
141178
|
-
|
|
141411
|
+
errorCodes18 = [
|
|
141179
141412
|
Diagnostics.Cannot_find_name_0.code,
|
|
141180
141413
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
141181
141414
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
@@ -141187,7 +141420,7 @@ ${lanes.join("\n")}
|
|
|
141187
141420
|
Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code
|
|
141188
141421
|
];
|
|
141189
141422
|
registerCodeFix({
|
|
141190
|
-
errorCodes:
|
|
141423
|
+
errorCodes: errorCodes18,
|
|
141191
141424
|
getCodeActions(context) {
|
|
141192
141425
|
const { errorCode, preferences, sourceFile, span, program } = context;
|
|
141193
141426
|
const info = getFixInfos(
|
|
@@ -141222,7 +141455,7 @@ ${lanes.join("\n")}
|
|
|
141222
141455
|
host,
|
|
141223
141456
|
cancellationToken
|
|
141224
141457
|
);
|
|
141225
|
-
eachDiagnostic(context,
|
|
141458
|
+
eachDiagnostic(context, errorCodes18, (diag2) => importAdder.addImportFromDiagnostic(diag2, context));
|
|
141226
141459
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
|
|
141227
141460
|
}
|
|
141228
141461
|
});
|
|
@@ -141297,14 +141530,14 @@ ${lanes.join("\n")}
|
|
|
141297
141530
|
const contextualType = isExpression(node) ? checker.getContextualType(node) : void 0;
|
|
141298
141531
|
return contextualType || checker.getTypeAtLocation(node);
|
|
141299
141532
|
}
|
|
141300
|
-
var
|
|
141533
|
+
var fixId17, errorCodes19;
|
|
141301
141534
|
var init_fixAddMissingConstraint = __esm({
|
|
141302
141535
|
"src/services/codefixes/fixAddMissingConstraint.ts"() {
|
|
141303
141536
|
"use strict";
|
|
141304
141537
|
init_ts4();
|
|
141305
141538
|
init_ts_codefix();
|
|
141306
|
-
|
|
141307
|
-
|
|
141539
|
+
fixId17 = "addMissingConstraint";
|
|
141540
|
+
errorCodes19 = [
|
|
141308
141541
|
// We want errors this could be attached to:
|
|
141309
141542
|
// Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
|
|
141310
141543
|
Diagnostics.Type_0_is_not_comparable_to_type_1.code,
|
|
@@ -141317,21 +141550,21 @@ ${lanes.join("\n")}
|
|
|
141317
141550
|
Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code
|
|
141318
141551
|
];
|
|
141319
141552
|
registerCodeFix({
|
|
141320
|
-
errorCodes:
|
|
141553
|
+
errorCodes: errorCodes19,
|
|
141321
141554
|
getCodeActions(context) {
|
|
141322
141555
|
const { sourceFile, span, program, preferences, host } = context;
|
|
141323
141556
|
const info = getInfo3(program, sourceFile, span);
|
|
141324
141557
|
if (info === void 0)
|
|
141325
141558
|
return;
|
|
141326
141559
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info));
|
|
141327
|
-
return [createCodeFixAction(
|
|
141560
|
+
return [createCodeFixAction(fixId17, changes, Diagnostics.Add_extends_constraint, fixId17, Diagnostics.Add_extends_constraint_to_all_type_parameters)];
|
|
141328
141561
|
},
|
|
141329
|
-
fixIds: [
|
|
141562
|
+
fixIds: [fixId17],
|
|
141330
141563
|
getAllCodeActions: (context) => {
|
|
141331
141564
|
const { program, preferences, host } = context;
|
|
141332
141565
|
const seen = /* @__PURE__ */ new Map();
|
|
141333
141566
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141334
|
-
eachDiagnostic(context,
|
|
141567
|
+
eachDiagnostic(context, errorCodes19, (diag2) => {
|
|
141335
141568
|
const info = getInfo3(program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
141336
141569
|
if (info) {
|
|
141337
141570
|
if (addToSeen(seen, getNodeId(info.declaration))) {
|
|
@@ -141413,7 +141646,7 @@ ${lanes.join("\n")}
|
|
|
141413
141646
|
Debug.assert(classElement && isClassElementLikeHasJSDoc(classElement));
|
|
141414
141647
|
return classElement;
|
|
141415
141648
|
}
|
|
141416
|
-
var fixName, fixAddOverrideId, fixRemoveOverrideId,
|
|
141649
|
+
var fixName, fixAddOverrideId, fixRemoveOverrideId, errorCodes20, errorCodeFixIdMap;
|
|
141417
141650
|
var init_fixOverrideModifier = __esm({
|
|
141418
141651
|
"src/services/codefixes/fixOverrideModifier.ts"() {
|
|
141419
141652
|
"use strict";
|
|
@@ -141422,7 +141655,7 @@ ${lanes.join("\n")}
|
|
|
141422
141655
|
fixName = "fixOverrideModifier";
|
|
141423
141656
|
fixAddOverrideId = "fixAddOverrideModifier";
|
|
141424
141657
|
fixRemoveOverrideId = "fixRemoveOverrideModifier";
|
|
141425
|
-
|
|
141658
|
+
errorCodes20 = [
|
|
141426
141659
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code,
|
|
141427
141660
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
|
|
141428
141661
|
Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,
|
|
@@ -141486,20 +141719,20 @@ ${lanes.join("\n")}
|
|
|
141486
141719
|
}
|
|
141487
141720
|
};
|
|
141488
141721
|
registerCodeFix({
|
|
141489
|
-
errorCodes:
|
|
141722
|
+
errorCodes: errorCodes20,
|
|
141490
141723
|
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
141491
141724
|
const { errorCode, span } = context;
|
|
141492
141725
|
const info = errorCodeFixIdMap[errorCode];
|
|
141493
141726
|
if (!info)
|
|
141494
141727
|
return emptyArray;
|
|
141495
|
-
const { descriptions, fixId:
|
|
141728
|
+
const { descriptions, fixId: fixId52, fixAllDescriptions } = info;
|
|
141496
141729
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
|
|
141497
141730
|
return [
|
|
141498
|
-
createCodeFixActionMaybeFixAll(fixName, changes, descriptions,
|
|
141731
|
+
createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId52, fixAllDescriptions)
|
|
141499
141732
|
];
|
|
141500
141733
|
},
|
|
141501
141734
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
141502
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141735
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => {
|
|
141503
141736
|
const { code, start } = diag2;
|
|
141504
141737
|
const info = errorCodeFixIdMap[code];
|
|
141505
141738
|
if (!info || info.fixId !== context.fixId) {
|
|
@@ -141512,7 +141745,7 @@ ${lanes.join("\n")}
|
|
|
141512
141745
|
});
|
|
141513
141746
|
|
|
141514
141747
|
// src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts
|
|
141515
|
-
function
|
|
141748
|
+
function doChange7(changes, sourceFile, node, preferences) {
|
|
141516
141749
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
141517
141750
|
const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */);
|
|
141518
141751
|
changes.replaceNode(
|
|
@@ -141524,32 +141757,32 @@ ${lanes.join("\n")}
|
|
|
141524
141757
|
function getPropertyAccessExpression(sourceFile, pos) {
|
|
141525
141758
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression);
|
|
141526
141759
|
}
|
|
141527
|
-
var
|
|
141760
|
+
var fixId18, errorCodes21;
|
|
141528
141761
|
var init_fixNoPropertyAccessFromIndexSignature = __esm({
|
|
141529
141762
|
"src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts"() {
|
|
141530
141763
|
"use strict";
|
|
141531
141764
|
init_ts4();
|
|
141532
141765
|
init_ts_codefix();
|
|
141533
|
-
|
|
141534
|
-
|
|
141766
|
+
fixId18 = "fixNoPropertyAccessFromIndexSignature";
|
|
141767
|
+
errorCodes21 = [
|
|
141535
141768
|
Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code
|
|
141536
141769
|
];
|
|
141537
141770
|
registerCodeFix({
|
|
141538
|
-
errorCodes:
|
|
141539
|
-
fixIds: [
|
|
141771
|
+
errorCodes: errorCodes21,
|
|
141772
|
+
fixIds: [fixId18],
|
|
141540
141773
|
getCodeActions(context) {
|
|
141541
141774
|
const { sourceFile, span, preferences } = context;
|
|
141542
141775
|
const property = getPropertyAccessExpression(sourceFile, span.start);
|
|
141543
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141544
|
-
return [createCodeFixAction(
|
|
141776
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, context.sourceFile, property, preferences));
|
|
141777
|
+
return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId18, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
141545
141778
|
},
|
|
141546
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141779
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => doChange7(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
141547
141780
|
});
|
|
141548
141781
|
}
|
|
141549
141782
|
});
|
|
141550
141783
|
|
|
141551
141784
|
// src/services/codefixes/fixImplicitThis.ts
|
|
141552
|
-
function
|
|
141785
|
+
function doChange8(changes, sourceFile, pos, checker) {
|
|
141553
141786
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141554
141787
|
if (!isThis(token))
|
|
141555
141788
|
return void 0;
|
|
@@ -141590,27 +141823,27 @@ ${lanes.join("\n")}
|
|
|
141590
141823
|
}
|
|
141591
141824
|
}
|
|
141592
141825
|
}
|
|
141593
|
-
var
|
|
141826
|
+
var fixId19, errorCodes22;
|
|
141594
141827
|
var init_fixImplicitThis = __esm({
|
|
141595
141828
|
"src/services/codefixes/fixImplicitThis.ts"() {
|
|
141596
141829
|
"use strict";
|
|
141597
141830
|
init_ts4();
|
|
141598
141831
|
init_ts_codefix();
|
|
141599
|
-
|
|
141600
|
-
|
|
141832
|
+
fixId19 = "fixImplicitThis";
|
|
141833
|
+
errorCodes22 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
141601
141834
|
registerCodeFix({
|
|
141602
|
-
errorCodes:
|
|
141835
|
+
errorCodes: errorCodes22,
|
|
141603
141836
|
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
141604
141837
|
const { sourceFile, program, span } = context;
|
|
141605
141838
|
let diagnostic;
|
|
141606
141839
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
141607
|
-
diagnostic =
|
|
141840
|
+
diagnostic = doChange8(t, sourceFile, span.start, program.getTypeChecker());
|
|
141608
141841
|
});
|
|
141609
|
-
return diagnostic ? [createCodeFixAction(
|
|
141842
|
+
return diagnostic ? [createCodeFixAction(fixId19, changes, diagnostic, fixId19, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
|
|
141610
141843
|
},
|
|
141611
|
-
fixIds: [
|
|
141612
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141613
|
-
|
|
141844
|
+
fixIds: [fixId19],
|
|
141845
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => {
|
|
141846
|
+
doChange8(changes, diag2.file, diag2.start, context.program.getTypeChecker());
|
|
141614
141847
|
})
|
|
141615
141848
|
});
|
|
141616
141849
|
}
|
|
@@ -141653,7 +141886,7 @@ ${lanes.join("\n")}
|
|
|
141653
141886
|
}
|
|
141654
141887
|
return void 0;
|
|
141655
141888
|
}
|
|
141656
|
-
function
|
|
141889
|
+
function doChange9(changes, program, { exportName, node, moduleSourceFile }) {
|
|
141657
141890
|
const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
|
|
141658
141891
|
if (exportDeclaration) {
|
|
141659
141892
|
updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
|
|
@@ -141735,32 +141968,32 @@ ${lanes.join("\n")}
|
|
|
141735
141968
|
const variableStatement = isVariableDeclaration(declaration) ? tryCast(declaration.parent.parent, isVariableStatement) : void 0;
|
|
141736
141969
|
return variableStatement && length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration;
|
|
141737
141970
|
}
|
|
141738
|
-
var
|
|
141971
|
+
var fixId20, errorCodes23;
|
|
141739
141972
|
var init_fixImportNonExportedMember = __esm({
|
|
141740
141973
|
"src/services/codefixes/fixImportNonExportedMember.ts"() {
|
|
141741
141974
|
"use strict";
|
|
141742
141975
|
init_ts4();
|
|
141743
141976
|
init_ts_codefix();
|
|
141744
|
-
|
|
141745
|
-
|
|
141977
|
+
fixId20 = "fixImportNonExportedMember";
|
|
141978
|
+
errorCodes23 = [
|
|
141746
141979
|
Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code
|
|
141747
141980
|
];
|
|
141748
141981
|
registerCodeFix({
|
|
141749
|
-
errorCodes:
|
|
141750
|
-
fixIds: [
|
|
141982
|
+
errorCodes: errorCodes23,
|
|
141983
|
+
fixIds: [fixId20],
|
|
141751
141984
|
getCodeActions(context) {
|
|
141752
141985
|
const { sourceFile, span, program } = context;
|
|
141753
141986
|
const info = getInfo4(sourceFile, span.start, program);
|
|
141754
141987
|
if (info === void 0)
|
|
141755
141988
|
return void 0;
|
|
141756
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141757
|
-
return [createCodeFixAction(
|
|
141989
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, program, info));
|
|
141990
|
+
return [createCodeFixAction(fixId20, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId20, Diagnostics.Export_all_referenced_locals)];
|
|
141758
141991
|
},
|
|
141759
141992
|
getAllCodeActions(context) {
|
|
141760
141993
|
const { program } = context;
|
|
141761
141994
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141762
141995
|
const exports = /* @__PURE__ */ new Map();
|
|
141763
|
-
eachDiagnostic(context,
|
|
141996
|
+
eachDiagnostic(context, errorCodes23, (diag2) => {
|
|
141764
141997
|
const info = getInfo4(diag2.file, diag2.start, program);
|
|
141765
141998
|
if (info === void 0)
|
|
141766
141999
|
return void 0;
|
|
@@ -141805,7 +142038,7 @@ ${lanes.join("\n")}
|
|
|
141805
142038
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141806
142039
|
return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */);
|
|
141807
142040
|
}
|
|
141808
|
-
function
|
|
142041
|
+
function doChange10(changes, sourceFile, namedTupleMember) {
|
|
141809
142042
|
if (!namedTupleMember) {
|
|
141810
142043
|
return;
|
|
141811
142044
|
}
|
|
@@ -141832,26 +142065,26 @@ ${lanes.join("\n")}
|
|
|
141832
142065
|
}
|
|
141833
142066
|
changes.replaceNode(sourceFile, namedTupleMember, updated);
|
|
141834
142067
|
}
|
|
141835
|
-
var
|
|
142068
|
+
var fixId21, errorCodes24;
|
|
141836
142069
|
var init_fixIncorrectNamedTupleSyntax = __esm({
|
|
141837
142070
|
"src/services/codefixes/fixIncorrectNamedTupleSyntax.ts"() {
|
|
141838
142071
|
"use strict";
|
|
141839
142072
|
init_ts4();
|
|
141840
142073
|
init_ts_codefix();
|
|
141841
|
-
|
|
141842
|
-
|
|
142074
|
+
fixId21 = "fixIncorrectNamedTupleSyntax";
|
|
142075
|
+
errorCodes24 = [
|
|
141843
142076
|
Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type.code,
|
|
141844
142077
|
Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code
|
|
141845
142078
|
];
|
|
141846
142079
|
registerCodeFix({
|
|
141847
|
-
errorCodes:
|
|
142080
|
+
errorCodes: errorCodes24,
|
|
141848
142081
|
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
141849
142082
|
const { sourceFile, span } = context;
|
|
141850
142083
|
const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
141851
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141852
|
-
return [createCodeFixAction(
|
|
142084
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, namedTupleMember));
|
|
142085
|
+
return [createCodeFixAction(fixId21, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId21, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
|
|
141853
142086
|
},
|
|
141854
|
-
fixIds: [
|
|
142087
|
+
fixIds: [fixId21]
|
|
141855
142088
|
});
|
|
141856
142089
|
}
|
|
141857
142090
|
});
|
|
@@ -141906,7 +142139,7 @@ ${lanes.join("\n")}
|
|
|
141906
142139
|
}
|
|
141907
142140
|
return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol };
|
|
141908
142141
|
}
|
|
141909
|
-
function
|
|
142142
|
+
function doChange11(changes, sourceFile, node, suggestedSymbol, target) {
|
|
141910
142143
|
const suggestion = symbolName(suggestedSymbol);
|
|
141911
142144
|
if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
|
|
141912
142145
|
const valDecl = suggestedSymbol.valueDeclaration;
|
|
@@ -141940,14 +142173,14 @@ ${lanes.join("\n")}
|
|
|
141940
142173
|
return void 0;
|
|
141941
142174
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
141942
142175
|
}
|
|
141943
|
-
var
|
|
142176
|
+
var fixId22, errorCodes25;
|
|
141944
142177
|
var init_fixSpelling = __esm({
|
|
141945
142178
|
"src/services/codefixes/fixSpelling.ts"() {
|
|
141946
142179
|
"use strict";
|
|
141947
142180
|
init_ts4();
|
|
141948
142181
|
init_ts_codefix();
|
|
141949
|
-
|
|
141950
|
-
|
|
142182
|
+
fixId22 = "fixSpelling";
|
|
142183
|
+
errorCodes25 = [
|
|
141951
142184
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141952
142185
|
Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141953
142186
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
@@ -141964,7 +142197,7 @@ ${lanes.join("\n")}
|
|
|
141964
142197
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code
|
|
141965
142198
|
];
|
|
141966
142199
|
registerCodeFix({
|
|
141967
|
-
errorCodes:
|
|
142200
|
+
errorCodes: errorCodes25,
|
|
141968
142201
|
getCodeActions(context) {
|
|
141969
142202
|
const { sourceFile, errorCode } = context;
|
|
141970
142203
|
const info = getInfo5(sourceFile, context.span.start, context, errorCode);
|
|
@@ -141972,15 +142205,15 @@ ${lanes.join("\n")}
|
|
|
141972
142205
|
return void 0;
|
|
141973
142206
|
const { node, suggestedSymbol } = info;
|
|
141974
142207
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141975
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141976
|
-
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)],
|
|
142208
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, node, suggestedSymbol, target));
|
|
142209
|
+
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId22, Diagnostics.Fix_all_detected_spelling_errors)];
|
|
141977
142210
|
},
|
|
141978
|
-
fixIds: [
|
|
141979
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142211
|
+
fixIds: [fixId22],
|
|
142212
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => {
|
|
141980
142213
|
const info = getInfo5(diag2.file, diag2.start, context, diag2.code);
|
|
141981
142214
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141982
142215
|
if (info)
|
|
141983
|
-
|
|
142216
|
+
doChange11(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
141984
142217
|
})
|
|
141985
142218
|
});
|
|
141986
142219
|
}
|
|
@@ -142164,7 +142397,7 @@ ${lanes.join("\n")}
|
|
|
142164
142397
|
}
|
|
142165
142398
|
function getActionForfixAddReturnStatement(context, expression, statement) {
|
|
142166
142399
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement));
|
|
142167
|
-
return createCodeFixAction(
|
|
142400
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement);
|
|
142168
142401
|
}
|
|
142169
142402
|
function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) {
|
|
142170
142403
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace(
|
|
@@ -142176,29 +142409,29 @@ ${lanes.join("\n")}
|
|
|
142176
142409
|
/* withParen */
|
|
142177
142410
|
false
|
|
142178
142411
|
));
|
|
142179
|
-
return createCodeFixAction(
|
|
142412
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues);
|
|
142180
142413
|
}
|
|
142181
142414
|
function getActionForfixWrapTheBlockWithParen(context, declaration, expression) {
|
|
142182
142415
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression));
|
|
142183
|
-
return createCodeFixAction(
|
|
142416
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, Diagnostics.Wrap_all_object_literal_with_parentheses);
|
|
142184
142417
|
}
|
|
142185
|
-
var
|
|
142418
|
+
var fixId23, fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen, errorCodes26;
|
|
142186
142419
|
var init_returnValueCorrect = __esm({
|
|
142187
142420
|
"src/services/codefixes/returnValueCorrect.ts"() {
|
|
142188
142421
|
"use strict";
|
|
142189
142422
|
init_ts4();
|
|
142190
142423
|
init_ts_codefix();
|
|
142191
|
-
|
|
142424
|
+
fixId23 = "returnValueCorrect";
|
|
142192
142425
|
fixIdAddReturnStatement = "fixAddReturnStatement";
|
|
142193
142426
|
fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody";
|
|
142194
142427
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142195
|
-
|
|
142428
|
+
errorCodes26 = [
|
|
142196
142429
|
Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
|
|
142197
142430
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142198
142431
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142199
142432
|
];
|
|
142200
142433
|
registerCodeFix({
|
|
142201
|
-
errorCodes:
|
|
142434
|
+
errorCodes: errorCodes26,
|
|
142202
142435
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
142203
142436
|
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
142204
142437
|
const { program, sourceFile, span: { start }, errorCode } = context;
|
|
@@ -142214,7 +142447,7 @@ ${lanes.join("\n")}
|
|
|
142214
142447
|
return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)];
|
|
142215
142448
|
}
|
|
142216
142449
|
},
|
|
142217
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142450
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => {
|
|
142218
142451
|
const info = getInfo6(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code);
|
|
142219
142452
|
if (!info)
|
|
142220
142453
|
return void 0;
|
|
@@ -142780,7 +143013,7 @@ ${lanes.join("\n")}
|
|
|
142780
143013
|
}
|
|
142781
143014
|
return getSourceFileOfNode(node);
|
|
142782
143015
|
}
|
|
142783
|
-
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration,
|
|
143016
|
+
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration, errorCodes27;
|
|
142784
143017
|
var init_fixAddMissingMember = __esm({
|
|
142785
143018
|
"src/services/codefixes/fixAddMissingMember.ts"() {
|
|
142786
143019
|
"use strict";
|
|
@@ -142790,7 +143023,7 @@ ${lanes.join("\n")}
|
|
|
142790
143023
|
fixMissingProperties = "fixMissingProperties";
|
|
142791
143024
|
fixMissingAttributes = "fixMissingAttributes";
|
|
142792
143025
|
fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration";
|
|
142793
|
-
|
|
143026
|
+
errorCodes27 = [
|
|
142794
143027
|
Diagnostics.Property_0_does_not_exist_on_type_1.code,
|
|
142795
143028
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
142796
143029
|
Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code,
|
|
@@ -142800,7 +143033,7 @@ ${lanes.join("\n")}
|
|
|
142800
143033
|
Diagnostics.Cannot_find_name_0.code
|
|
142801
143034
|
];
|
|
142802
143035
|
registerCodeFix({
|
|
142803
|
-
errorCodes:
|
|
143036
|
+
errorCodes: errorCodes27,
|
|
142804
143037
|
getCodeActions(context) {
|
|
142805
143038
|
const typeChecker = context.program.getTypeChecker();
|
|
142806
143039
|
const info = getInfo7(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program);
|
|
@@ -142827,21 +143060,21 @@ ${lanes.join("\n")}
|
|
|
142827
143060
|
},
|
|
142828
143061
|
fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
|
|
142829
143062
|
getAllCodeActions: (context) => {
|
|
142830
|
-
const { program, fixId:
|
|
143063
|
+
const { program, fixId: fixId52 } = context;
|
|
142831
143064
|
const checker = program.getTypeChecker();
|
|
142832
143065
|
const seen = /* @__PURE__ */ new Map();
|
|
142833
143066
|
const typeDeclToMembers = /* @__PURE__ */ new Map();
|
|
142834
143067
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
142835
|
-
eachDiagnostic(context,
|
|
143068
|
+
eachDiagnostic(context, errorCodes27, (diag2) => {
|
|
142836
143069
|
const info = getInfo7(diag2.file, diag2.start, diag2.code, checker, context.program);
|
|
142837
143070
|
if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
142838
143071
|
return;
|
|
142839
143072
|
}
|
|
142840
|
-
if (
|
|
143073
|
+
if (fixId52 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
|
142841
143074
|
addFunctionDeclaration(changes, context, info);
|
|
142842
|
-
} else if (
|
|
143075
|
+
} else if (fixId52 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
|
142843
143076
|
addObjectLiteralProperties(changes, context, info);
|
|
142844
|
-
} else if (
|
|
143077
|
+
} else if (fixId52 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
|
|
142845
143078
|
addJsxAttributes(changes, context, info);
|
|
142846
143079
|
} else {
|
|
142847
143080
|
if (info.kind === 1 /* Enum */) {
|
|
@@ -142897,23 +143130,23 @@ ${lanes.join("\n")}
|
|
|
142897
143130
|
}
|
|
142898
143131
|
return token;
|
|
142899
143132
|
}
|
|
142900
|
-
var
|
|
143133
|
+
var fixId24, errorCodes28;
|
|
142901
143134
|
var init_fixAddMissingNewOperator = __esm({
|
|
142902
143135
|
"src/services/codefixes/fixAddMissingNewOperator.ts"() {
|
|
142903
143136
|
"use strict";
|
|
142904
143137
|
init_ts4();
|
|
142905
143138
|
init_ts_codefix();
|
|
142906
|
-
|
|
142907
|
-
|
|
143139
|
+
fixId24 = "addMissingNewOperator";
|
|
143140
|
+
errorCodes28 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
|
142908
143141
|
registerCodeFix({
|
|
142909
|
-
errorCodes:
|
|
143142
|
+
errorCodes: errorCodes28,
|
|
142910
143143
|
getCodeActions(context) {
|
|
142911
143144
|
const { sourceFile, span } = context;
|
|
142912
143145
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span));
|
|
142913
|
-
return [createCodeFixAction(
|
|
143146
|
+
return [createCodeFixAction(fixId24, changes, Diagnostics.Add_missing_new_operator_to_call, fixId24, Diagnostics.Add_missing_new_operator_to_all_calls)];
|
|
142914
143147
|
},
|
|
142915
|
-
fixIds: [
|
|
142916
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143148
|
+
fixIds: [fixId24],
|
|
143149
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes28, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2))
|
|
142917
143150
|
});
|
|
142918
143151
|
}
|
|
142919
143152
|
});
|
|
@@ -142934,7 +143167,7 @@ ${lanes.join("\n")}
|
|
|
142934
143167
|
var _a2;
|
|
142935
143168
|
return diagCode === errorCodeCannotFindModule ? ts_JsTyping_exports.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a2 = host.isKnownTypesPackageName) == null ? void 0 : _a2.call(host, packageName)) ? getTypesPackageName(packageName) : void 0;
|
|
142936
143169
|
}
|
|
142937
|
-
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule,
|
|
143170
|
+
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes29;
|
|
142938
143171
|
var init_fixCannotFindModule = __esm({
|
|
142939
143172
|
"src/services/codefixes/fixCannotFindModule.ts"() {
|
|
142940
143173
|
"use strict";
|
|
@@ -142943,12 +143176,12 @@ ${lanes.join("\n")}
|
|
|
142943
143176
|
fixName2 = "fixCannotFindModule";
|
|
142944
143177
|
fixIdInstallTypesPackage = "installTypesPackage";
|
|
142945
143178
|
errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
142946
|
-
|
|
143179
|
+
errorCodes29 = [
|
|
142947
143180
|
errorCodeCannotFindModule,
|
|
142948
143181
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
142949
143182
|
];
|
|
142950
143183
|
registerCodeFix({
|
|
142951
|
-
errorCodes:
|
|
143184
|
+
errorCodes: errorCodes29,
|
|
142952
143185
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
142953
143186
|
const { host, sourceFile, span: { start } } = context;
|
|
142954
143187
|
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
@@ -142967,7 +143200,7 @@ ${lanes.join("\n")}
|
|
|
142967
143200
|
},
|
|
142968
143201
|
fixIds: [fixIdInstallTypesPackage],
|
|
142969
143202
|
getAllCodeActions: (context) => {
|
|
142970
|
-
return codeFixAll(context,
|
|
143203
|
+
return codeFixAll(context, errorCodes29, (_changes, diag2, commands) => {
|
|
142971
143204
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
142972
143205
|
if (packageName === void 0)
|
|
142973
143206
|
return void 0;
|
|
@@ -143006,28 +143239,28 @@ ${lanes.join("\n")}
|
|
|
143006
143239
|
const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()));
|
|
143007
143240
|
return !(flags & 8 /* Private */) && !!(flags & 256 /* Abstract */);
|
|
143008
143241
|
}
|
|
143009
|
-
var
|
|
143242
|
+
var errorCodes30, fixId25;
|
|
143010
143243
|
var init_fixClassDoesntImplementInheritedAbstractMember = __esm({
|
|
143011
143244
|
"src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"() {
|
|
143012
143245
|
"use strict";
|
|
143013
143246
|
init_ts4();
|
|
143014
143247
|
init_ts_codefix();
|
|
143015
|
-
|
|
143248
|
+
errorCodes30 = [
|
|
143016
143249
|
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
143017
143250
|
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code
|
|
143018
143251
|
];
|
|
143019
|
-
|
|
143252
|
+
fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
143020
143253
|
registerCodeFix({
|
|
143021
|
-
errorCodes:
|
|
143254
|
+
errorCodes: errorCodes30,
|
|
143022
143255
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
143023
143256
|
const { sourceFile, span } = context;
|
|
143024
143257
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
|
|
143025
|
-
return changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
143258
|
+
return changes.length === 0 ? void 0 : [createCodeFixAction(fixId25, changes, Diagnostics.Implement_inherited_abstract_class, fixId25, Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
143026
143259
|
},
|
|
143027
|
-
fixIds: [
|
|
143260
|
+
fixIds: [fixId25],
|
|
143028
143261
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
143029
143262
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
143030
|
-
return codeFixAll(context,
|
|
143263
|
+
return codeFixAll(context, errorCodes30, (changes, diag2) => {
|
|
143031
143264
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
143032
143265
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
143033
143266
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -143039,7 +143272,7 @@ ${lanes.join("\n")}
|
|
|
143039
143272
|
});
|
|
143040
143273
|
|
|
143041
143274
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
143042
|
-
function
|
|
143275
|
+
function doChange12(changes, sourceFile, constructor, superCall) {
|
|
143043
143276
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
143044
143277
|
changes.delete(sourceFile, superCall);
|
|
143045
143278
|
}
|
|
@@ -143054,36 +143287,36 @@ ${lanes.join("\n")}
|
|
|
143054
143287
|
function findSuperCall(n) {
|
|
143055
143288
|
return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild(n, findSuperCall);
|
|
143056
143289
|
}
|
|
143057
|
-
var
|
|
143290
|
+
var fixId26, errorCodes31;
|
|
143058
143291
|
var init_fixClassSuperMustPrecedeThisAccess = __esm({
|
|
143059
143292
|
"src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts"() {
|
|
143060
143293
|
"use strict";
|
|
143061
143294
|
init_ts4();
|
|
143062
143295
|
init_ts_codefix();
|
|
143063
|
-
|
|
143064
|
-
|
|
143296
|
+
fixId26 = "classSuperMustPrecedeThisAccess";
|
|
143297
|
+
errorCodes31 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
143065
143298
|
registerCodeFix({
|
|
143066
|
-
errorCodes:
|
|
143299
|
+
errorCodes: errorCodes31,
|
|
143067
143300
|
getCodeActions(context) {
|
|
143068
143301
|
const { sourceFile, span } = context;
|
|
143069
143302
|
const nodes = getNodes(sourceFile, span.start);
|
|
143070
143303
|
if (!nodes)
|
|
143071
143304
|
return void 0;
|
|
143072
143305
|
const { constructor, superCall } = nodes;
|
|
143073
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143074
|
-
return [createCodeFixAction(
|
|
143306
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, constructor, superCall));
|
|
143307
|
+
return [createCodeFixAction(fixId26, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId26, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)];
|
|
143075
143308
|
},
|
|
143076
|
-
fixIds: [
|
|
143309
|
+
fixIds: [fixId26],
|
|
143077
143310
|
getAllCodeActions(context) {
|
|
143078
143311
|
const { sourceFile } = context;
|
|
143079
143312
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
143080
|
-
return codeFixAll(context,
|
|
143313
|
+
return codeFixAll(context, errorCodes31, (changes, diag2) => {
|
|
143081
143314
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
143082
143315
|
if (!nodes)
|
|
143083
143316
|
return;
|
|
143084
143317
|
const { constructor, superCall } = nodes;
|
|
143085
143318
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
143086
|
-
|
|
143319
|
+
doChange12(changes, sourceFile, constructor, superCall);
|
|
143087
143320
|
}
|
|
143088
143321
|
});
|
|
143089
143322
|
}
|
|
@@ -143097,7 +143330,7 @@ ${lanes.join("\n")}
|
|
|
143097
143330
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
143098
143331
|
return token.parent;
|
|
143099
143332
|
}
|
|
143100
|
-
function
|
|
143333
|
+
function doChange13(changes, sourceFile, ctr) {
|
|
143101
143334
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
143102
143335
|
factory.createSuper(),
|
|
143103
143336
|
/*typeArguments*/
|
|
@@ -143107,42 +143340,42 @@ ${lanes.join("\n")}
|
|
|
143107
143340
|
));
|
|
143108
143341
|
changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall);
|
|
143109
143342
|
}
|
|
143110
|
-
var
|
|
143343
|
+
var fixId27, errorCodes32;
|
|
143111
143344
|
var init_fixConstructorForDerivedNeedSuperCall = __esm({
|
|
143112
143345
|
"src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts"() {
|
|
143113
143346
|
"use strict";
|
|
143114
143347
|
init_ts4();
|
|
143115
143348
|
init_ts_codefix();
|
|
143116
|
-
|
|
143117
|
-
|
|
143349
|
+
fixId27 = "constructorForDerivedNeedSuperCall";
|
|
143350
|
+
errorCodes32 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
143118
143351
|
registerCodeFix({
|
|
143119
|
-
errorCodes:
|
|
143352
|
+
errorCodes: errorCodes32,
|
|
143120
143353
|
getCodeActions(context) {
|
|
143121
143354
|
const { sourceFile, span } = context;
|
|
143122
143355
|
const ctr = getNode(sourceFile, span.start);
|
|
143123
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143124
|
-
return [createCodeFixAction(
|
|
143356
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, ctr));
|
|
143357
|
+
return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
|
|
143125
143358
|
},
|
|
143126
|
-
fixIds: [
|
|
143127
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143359
|
+
fixIds: [fixId27],
|
|
143360
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes, diag2) => doChange13(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
143128
143361
|
});
|
|
143129
143362
|
}
|
|
143130
143363
|
});
|
|
143131
143364
|
|
|
143132
143365
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
143133
|
-
function
|
|
143366
|
+
function doChange14(changeTracker, configFile) {
|
|
143134
143367
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
143135
143368
|
}
|
|
143136
|
-
var fixID,
|
|
143369
|
+
var fixID, errorCodes33;
|
|
143137
143370
|
var init_fixEnableJsxFlag = __esm({
|
|
143138
143371
|
"src/services/codefixes/fixEnableJsxFlag.ts"() {
|
|
143139
143372
|
"use strict";
|
|
143140
143373
|
init_ts4();
|
|
143141
143374
|
init_ts_codefix();
|
|
143142
143375
|
fixID = "fixEnableJsxFlag";
|
|
143143
|
-
|
|
143376
|
+
errorCodes33 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
143144
143377
|
registerCodeFix({
|
|
143145
|
-
errorCodes:
|
|
143378
|
+
errorCodes: errorCodes33,
|
|
143146
143379
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
143147
143380
|
const { configFile } = context.program.getCompilerOptions();
|
|
143148
143381
|
if (configFile === void 0) {
|
|
@@ -143150,19 +143383,19 @@ ${lanes.join("\n")}
|
|
|
143150
143383
|
}
|
|
143151
143384
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
143152
143385
|
context,
|
|
143153
|
-
(changeTracker) =>
|
|
143386
|
+
(changeTracker) => doChange14(changeTracker, configFile)
|
|
143154
143387
|
);
|
|
143155
143388
|
return [
|
|
143156
143389
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
143157
143390
|
];
|
|
143158
143391
|
},
|
|
143159
143392
|
fixIds: [fixID],
|
|
143160
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143393
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes) => {
|
|
143161
143394
|
const { configFile } = context.program.getCompilerOptions();
|
|
143162
143395
|
if (configFile === void 0) {
|
|
143163
143396
|
return void 0;
|
|
143164
143397
|
}
|
|
143165
|
-
|
|
143398
|
+
doChange14(changes, configFile);
|
|
143166
143399
|
})
|
|
143167
143400
|
});
|
|
143168
143401
|
}
|
|
@@ -143184,7 +143417,7 @@ ${lanes.join("\n")}
|
|
|
143184
143417
|
}
|
|
143185
143418
|
return void 0;
|
|
143186
143419
|
}
|
|
143187
|
-
function
|
|
143420
|
+
function doChange15(changes, sourceFile, arg, expression) {
|
|
143188
143421
|
const callExpression = factory.createCallExpression(
|
|
143189
143422
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
143190
143423
|
/*typeArguments*/
|
|
@@ -143202,33 +143435,33 @@ ${lanes.join("\n")}
|
|
|
143202
143435
|
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [];
|
|
143203
143436
|
return suggestion;
|
|
143204
143437
|
}
|
|
143205
|
-
var
|
|
143438
|
+
var fixId28, errorCodes34;
|
|
143206
143439
|
var init_fixNaNEquality = __esm({
|
|
143207
143440
|
"src/services/codefixes/fixNaNEquality.ts"() {
|
|
143208
143441
|
"use strict";
|
|
143209
143442
|
init_ts4();
|
|
143210
143443
|
init_ts_codefix();
|
|
143211
|
-
|
|
143212
|
-
|
|
143444
|
+
fixId28 = "fixNaNEquality";
|
|
143445
|
+
errorCodes34 = [
|
|
143213
143446
|
Diagnostics.This_condition_will_always_return_0.code
|
|
143214
143447
|
];
|
|
143215
143448
|
registerCodeFix({
|
|
143216
|
-
errorCodes:
|
|
143449
|
+
errorCodes: errorCodes34,
|
|
143217
143450
|
getCodeActions(context) {
|
|
143218
143451
|
const { sourceFile, span, program } = context;
|
|
143219
143452
|
const info = getInfo8(program, sourceFile, span);
|
|
143220
143453
|
if (info === void 0)
|
|
143221
143454
|
return;
|
|
143222
143455
|
const { suggestion, expression, arg } = info;
|
|
143223
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143224
|
-
return [createCodeFixAction(
|
|
143456
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, arg, expression));
|
|
143457
|
+
return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
143225
143458
|
},
|
|
143226
|
-
fixIds: [
|
|
143459
|
+
fixIds: [fixId28],
|
|
143227
143460
|
getAllCodeActions: (context) => {
|
|
143228
|
-
return codeFixAll(context,
|
|
143461
|
+
return codeFixAll(context, errorCodes34, (changes, diag2) => {
|
|
143229
143462
|
const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
143230
143463
|
if (info) {
|
|
143231
|
-
|
|
143464
|
+
doChange15(changes, diag2.file, info.arg, info.expression);
|
|
143232
143465
|
}
|
|
143233
143466
|
});
|
|
143234
143467
|
}
|
|
@@ -143284,32 +143517,32 @@ ${lanes.join("\n")}
|
|
|
143284
143517
|
});
|
|
143285
143518
|
|
|
143286
143519
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
143287
|
-
function
|
|
143520
|
+
function doChange16(changes, sourceFile, node) {
|
|
143288
143521
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
143289
143522
|
}
|
|
143290
143523
|
function getProperty2(sourceFile, pos) {
|
|
143291
143524
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment);
|
|
143292
143525
|
}
|
|
143293
|
-
var
|
|
143526
|
+
var fixId29, errorCodes35;
|
|
143294
143527
|
var init_fixPropertyAssignment = __esm({
|
|
143295
143528
|
"src/services/codefixes/fixPropertyAssignment.ts"() {
|
|
143296
143529
|
"use strict";
|
|
143297
143530
|
init_ts4();
|
|
143298
143531
|
init_ts_codefix();
|
|
143299
|
-
|
|
143300
|
-
|
|
143532
|
+
fixId29 = "fixPropertyAssignment";
|
|
143533
|
+
errorCodes35 = [
|
|
143301
143534
|
Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code
|
|
143302
143535
|
];
|
|
143303
143536
|
registerCodeFix({
|
|
143304
|
-
errorCodes:
|
|
143305
|
-
fixIds: [
|
|
143537
|
+
errorCodes: errorCodes35,
|
|
143538
|
+
fixIds: [fixId29],
|
|
143306
143539
|
getCodeActions(context) {
|
|
143307
143540
|
const { sourceFile, span } = context;
|
|
143308
143541
|
const property = getProperty2(sourceFile, span.start);
|
|
143309
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143310
|
-
return [createCodeFixAction(
|
|
143542
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, context.sourceFile, property));
|
|
143543
|
+
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
143311
143544
|
},
|
|
143312
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143545
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => doChange16(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
143313
143546
|
});
|
|
143314
143547
|
}
|
|
143315
143548
|
});
|
|
@@ -143335,16 +143568,16 @@ ${lanes.join("\n")}
|
|
|
143335
143568
|
changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end });
|
|
143336
143569
|
}
|
|
143337
143570
|
}
|
|
143338
|
-
var
|
|
143571
|
+
var fixId30, errorCodes36;
|
|
143339
143572
|
var init_fixExtendsInterfaceBecomesImplements = __esm({
|
|
143340
143573
|
"src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts"() {
|
|
143341
143574
|
"use strict";
|
|
143342
143575
|
init_ts4();
|
|
143343
143576
|
init_ts_codefix();
|
|
143344
|
-
|
|
143345
|
-
|
|
143577
|
+
fixId30 = "extendsInterfaceBecomesImplements";
|
|
143578
|
+
errorCodes36 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
143346
143579
|
registerCodeFix({
|
|
143347
|
-
errorCodes:
|
|
143580
|
+
errorCodes: errorCodes36,
|
|
143348
143581
|
getCodeActions(context) {
|
|
143349
143582
|
const { sourceFile } = context;
|
|
143350
143583
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
@@ -143352,10 +143585,10 @@ ${lanes.join("\n")}
|
|
|
143352
143585
|
return void 0;
|
|
143353
143586
|
const { extendsToken, heritageClauses } = nodes;
|
|
143354
143587
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses));
|
|
143355
|
-
return [createCodeFixAction(
|
|
143588
|
+
return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
143356
143589
|
},
|
|
143357
|
-
fixIds: [
|
|
143358
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143590
|
+
fixIds: [fixId30],
|
|
143591
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
|
|
143359
143592
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
143360
143593
|
if (nodes)
|
|
143361
143594
|
doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
@@ -143371,39 +143604,39 @@ ${lanes.join("\n")}
|
|
|
143371
143604
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
143372
143605
|
}
|
|
143373
143606
|
}
|
|
143374
|
-
function
|
|
143607
|
+
function doChange17(changes, sourceFile, { node, className }) {
|
|
143375
143608
|
suppressLeadingAndTrailingTrivia(node);
|
|
143376
143609
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
143377
143610
|
}
|
|
143378
|
-
var
|
|
143611
|
+
var fixId31, didYouMeanStaticMemberCode, errorCodes37;
|
|
143379
143612
|
var init_fixForgottenThisPropertyAccess = __esm({
|
|
143380
143613
|
"src/services/codefixes/fixForgottenThisPropertyAccess.ts"() {
|
|
143381
143614
|
"use strict";
|
|
143382
143615
|
init_ts4();
|
|
143383
143616
|
init_ts_codefix();
|
|
143384
|
-
|
|
143617
|
+
fixId31 = "forgottenThisPropertyAccess";
|
|
143385
143618
|
didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
143386
|
-
|
|
143619
|
+
errorCodes37 = [
|
|
143387
143620
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
143388
143621
|
Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
|
|
143389
143622
|
didYouMeanStaticMemberCode
|
|
143390
143623
|
];
|
|
143391
143624
|
registerCodeFix({
|
|
143392
|
-
errorCodes:
|
|
143625
|
+
errorCodes: errorCodes37,
|
|
143393
143626
|
getCodeActions(context) {
|
|
143394
143627
|
const { sourceFile } = context;
|
|
143395
143628
|
const info = getInfo9(sourceFile, context.span.start, context.errorCode);
|
|
143396
143629
|
if (!info) {
|
|
143397
143630
|
return void 0;
|
|
143398
143631
|
}
|
|
143399
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143400
|
-
return [createCodeFixAction(
|
|
143632
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, info));
|
|
143633
|
+
return [createCodeFixAction(fixId31, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId31, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)];
|
|
143401
143634
|
},
|
|
143402
|
-
fixIds: [
|
|
143403
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143635
|
+
fixIds: [fixId31],
|
|
143636
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
|
|
143404
143637
|
const info = getInfo9(diag2.file, diag2.start, diag2.code);
|
|
143405
143638
|
if (info)
|
|
143406
|
-
|
|
143639
|
+
doChange17(changes, context.sourceFile, info);
|
|
143407
143640
|
})
|
|
143408
143641
|
});
|
|
143409
143642
|
}
|
|
@@ -143413,7 +143646,7 @@ ${lanes.join("\n")}
|
|
|
143413
143646
|
function isValidCharacter(character) {
|
|
143414
143647
|
return hasProperty(htmlEntity, character);
|
|
143415
143648
|
}
|
|
143416
|
-
function
|
|
143649
|
+
function doChange18(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
143417
143650
|
const character = sourceFile.getText()[start];
|
|
143418
143651
|
if (!isValidCharacter(character)) {
|
|
143419
143652
|
return;
|
|
@@ -143421,7 +143654,7 @@ ${lanes.join("\n")}
|
|
|
143421
143654
|
const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`;
|
|
143422
143655
|
changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement);
|
|
143423
143656
|
}
|
|
143424
|
-
var fixIdExpression, fixIdHtmlEntity,
|
|
143657
|
+
var fixIdExpression, fixIdHtmlEntity, errorCodes38, htmlEntity;
|
|
143425
143658
|
var init_fixInvalidJsxCharacters = __esm({
|
|
143426
143659
|
"src/services/codefixes/fixInvalidJsxCharacters.ts"() {
|
|
143427
143660
|
"use strict";
|
|
@@ -143429,16 +143662,16 @@ ${lanes.join("\n")}
|
|
|
143429
143662
|
init_ts_codefix();
|
|
143430
143663
|
fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
143431
143664
|
fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
143432
|
-
|
|
143665
|
+
errorCodes38 = [
|
|
143433
143666
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
143434
143667
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
143435
143668
|
];
|
|
143436
143669
|
registerCodeFix({
|
|
143437
|
-
errorCodes:
|
|
143670
|
+
errorCodes: errorCodes38,
|
|
143438
143671
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
143439
143672
|
getCodeActions(context) {
|
|
143440
143673
|
const { sourceFile, preferences, span } = context;
|
|
143441
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143674
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143442
143675
|
t,
|
|
143443
143676
|
preferences,
|
|
143444
143677
|
sourceFile,
|
|
@@ -143446,7 +143679,7 @@ ${lanes.join("\n")}
|
|
|
143446
143679
|
/* useHtmlEntity */
|
|
143447
143680
|
false
|
|
143448
143681
|
));
|
|
143449
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143682
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143450
143683
|
t,
|
|
143451
143684
|
preferences,
|
|
143452
143685
|
sourceFile,
|
|
@@ -143460,7 +143693,7 @@ ${lanes.join("\n")}
|
|
|
143460
143693
|
];
|
|
143461
143694
|
},
|
|
143462
143695
|
getAllCodeActions(context) {
|
|
143463
|
-
return codeFixAll(context,
|
|
143696
|
+
return codeFixAll(context, errorCodes38, (changes, diagnostic) => doChange18(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
143464
143697
|
}
|
|
143465
143698
|
});
|
|
143466
143699
|
htmlEntity = {
|
|
@@ -143519,7 +143752,7 @@ ${lanes.join("\n")}
|
|
|
143519
143752
|
}
|
|
143520
143753
|
return void 0;
|
|
143521
143754
|
}
|
|
143522
|
-
var deleteUnmatchedParameter, renameUnmatchedParameter,
|
|
143755
|
+
var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes39;
|
|
143523
143756
|
var init_fixUnmatchedParameter = __esm({
|
|
143524
143757
|
"src/services/codefixes/fixUnmatchedParameter.ts"() {
|
|
143525
143758
|
"use strict";
|
|
@@ -143527,12 +143760,12 @@ ${lanes.join("\n")}
|
|
|
143527
143760
|
init_ts_codefix();
|
|
143528
143761
|
deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
143529
143762
|
renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
143530
|
-
|
|
143763
|
+
errorCodes39 = [
|
|
143531
143764
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
143532
143765
|
];
|
|
143533
143766
|
registerCodeFix({
|
|
143534
143767
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
143535
|
-
errorCodes:
|
|
143768
|
+
errorCodes: errorCodes39,
|
|
143536
143769
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
143537
143770
|
const { sourceFile, span } = context;
|
|
143538
143771
|
const actions2 = [];
|
|
@@ -143547,7 +143780,7 @@ ${lanes.join("\n")}
|
|
|
143547
143780
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
143548
143781
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
143549
143782
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
143550
|
-
eachDiagnostic(context,
|
|
143783
|
+
eachDiagnostic(context, errorCodes39, ({ file, start }) => {
|
|
143551
143784
|
const info = getInfo10(file, start);
|
|
143552
143785
|
if (info) {
|
|
143553
143786
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
@@ -143596,16 +143829,16 @@ ${lanes.join("\n")}
|
|
|
143596
143829
|
function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
|
|
143597
143830
|
ts_refactor_exports.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
|
|
143598
143831
|
}
|
|
143599
|
-
var
|
|
143832
|
+
var fixId32, errorCodes40;
|
|
143600
143833
|
var init_fixUnreferenceableDecoratorMetadata = __esm({
|
|
143601
143834
|
"src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts"() {
|
|
143602
143835
|
"use strict";
|
|
143603
143836
|
init_ts4();
|
|
143604
143837
|
init_ts_codefix();
|
|
143605
|
-
|
|
143606
|
-
|
|
143838
|
+
fixId32 = "fixUnreferenceableDecoratorMetadata";
|
|
143839
|
+
errorCodes40 = [Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code];
|
|
143607
143840
|
registerCodeFix({
|
|
143608
|
-
errorCodes:
|
|
143841
|
+
errorCodes: errorCodes40,
|
|
143609
143842
|
getCodeActions: (context) => {
|
|
143610
143843
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
143611
143844
|
if (!importDeclaration)
|
|
@@ -143614,14 +143847,14 @@ ${lanes.join("\n")}
|
|
|
143614
143847
|
const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program));
|
|
143615
143848
|
let actions2;
|
|
143616
143849
|
if (namespaceChanges.length) {
|
|
143617
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143850
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
143618
143851
|
}
|
|
143619
143852
|
if (typeOnlyChanges.length) {
|
|
143620
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143853
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
|
|
143621
143854
|
}
|
|
143622
143855
|
return actions2;
|
|
143623
143856
|
},
|
|
143624
|
-
fixIds: [
|
|
143857
|
+
fixIds: [fixId32]
|
|
143625
143858
|
});
|
|
143626
143859
|
}
|
|
143627
143860
|
});
|
|
@@ -143774,7 +144007,7 @@ ${lanes.join("\n")}
|
|
|
143774
144007
|
function mayDeleteExpression(node) {
|
|
143775
144008
|
return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent);
|
|
143776
144009
|
}
|
|
143777
|
-
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer,
|
|
144010
|
+
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes41;
|
|
143778
144011
|
var init_fixUnusedIdentifier = __esm({
|
|
143779
144012
|
"src/services/codefixes/fixUnusedIdentifier.ts"() {
|
|
143780
144013
|
"use strict";
|
|
@@ -143785,7 +144018,7 @@ ${lanes.join("\n")}
|
|
|
143785
144018
|
fixIdDelete = "unusedIdentifier_delete";
|
|
143786
144019
|
fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
143787
144020
|
fixIdInfer = "unusedIdentifier_infer";
|
|
143788
|
-
|
|
144021
|
+
errorCodes41 = [
|
|
143789
144022
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
143790
144023
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
143791
144024
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -143795,7 +144028,7 @@ ${lanes.join("\n")}
|
|
|
143795
144028
|
Diagnostics.All_type_parameters_are_unused.code
|
|
143796
144029
|
];
|
|
143797
144030
|
registerCodeFix({
|
|
143798
|
-
errorCodes:
|
|
144031
|
+
errorCodes: errorCodes41,
|
|
143799
144032
|
getCodeActions(context) {
|
|
143800
144033
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
143801
144034
|
const checker = program.getTypeChecker();
|
|
@@ -143881,7 +144114,7 @@ ${lanes.join("\n")}
|
|
|
143881
144114
|
const { sourceFile, program, cancellationToken } = context;
|
|
143882
144115
|
const checker = program.getTypeChecker();
|
|
143883
144116
|
const sourceFiles = program.getSourceFiles();
|
|
143884
|
-
return codeFixAll(context,
|
|
144117
|
+
return codeFixAll(context, errorCodes41, (changes, diag2) => {
|
|
143885
144118
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
143886
144119
|
switch (context.fixId) {
|
|
143887
144120
|
case fixIdPrefix:
|
|
@@ -143953,7 +144186,7 @@ ${lanes.join("\n")}
|
|
|
143953
144186
|
});
|
|
143954
144187
|
|
|
143955
144188
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
143956
|
-
function
|
|
144189
|
+
function doChange19(changes, sourceFile, start, length2, errorCode) {
|
|
143957
144190
|
const token = getTokenAtPosition(sourceFile, start);
|
|
143958
144191
|
const statement = findAncestor(token, isStatement);
|
|
143959
144192
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -144001,31 +144234,31 @@ ${lanes.join("\n")}
|
|
|
144001
144234
|
}
|
|
144002
144235
|
return last2;
|
|
144003
144236
|
}
|
|
144004
|
-
var
|
|
144237
|
+
var fixId33, errorCodes42;
|
|
144005
144238
|
var init_fixUnreachableCode = __esm({
|
|
144006
144239
|
"src/services/codefixes/fixUnreachableCode.ts"() {
|
|
144007
144240
|
"use strict";
|
|
144008
144241
|
init_ts4();
|
|
144009
144242
|
init_ts_codefix();
|
|
144010
|
-
|
|
144011
|
-
|
|
144243
|
+
fixId33 = "fixUnreachableCode";
|
|
144244
|
+
errorCodes42 = [Diagnostics.Unreachable_code_detected.code];
|
|
144012
144245
|
registerCodeFix({
|
|
144013
|
-
errorCodes:
|
|
144246
|
+
errorCodes: errorCodes42,
|
|
144014
144247
|
getCodeActions(context) {
|
|
144015
144248
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
144016
144249
|
if (syntacticDiagnostics.length)
|
|
144017
144250
|
return;
|
|
144018
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144019
|
-
return [createCodeFixAction(
|
|
144251
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
144252
|
+
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
|
|
144020
144253
|
},
|
|
144021
|
-
fixIds: [
|
|
144022
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144254
|
+
fixIds: [fixId33],
|
|
144255
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
144023
144256
|
});
|
|
144024
144257
|
}
|
|
144025
144258
|
});
|
|
144026
144259
|
|
|
144027
144260
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
144028
|
-
function
|
|
144261
|
+
function doChange20(changes, sourceFile, start) {
|
|
144029
144262
|
const token = getTokenAtPosition(sourceFile, start);
|
|
144030
144263
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
144031
144264
|
const pos = token.getStart(sourceFile);
|
|
@@ -144038,28 +144271,28 @@ ${lanes.join("\n")}
|
|
|
144038
144271
|
);
|
|
144039
144272
|
changes.deleteRange(sourceFile, { pos, end });
|
|
144040
144273
|
}
|
|
144041
|
-
var
|
|
144274
|
+
var fixId34, errorCodes43;
|
|
144042
144275
|
var init_fixUnusedLabel = __esm({
|
|
144043
144276
|
"src/services/codefixes/fixUnusedLabel.ts"() {
|
|
144044
144277
|
"use strict";
|
|
144045
144278
|
init_ts4();
|
|
144046
144279
|
init_ts_codefix();
|
|
144047
|
-
|
|
144048
|
-
|
|
144280
|
+
fixId34 = "fixUnusedLabel";
|
|
144281
|
+
errorCodes43 = [Diagnostics.Unused_label.code];
|
|
144049
144282
|
registerCodeFix({
|
|
144050
|
-
errorCodes:
|
|
144283
|
+
errorCodes: errorCodes43,
|
|
144051
144284
|
getCodeActions(context) {
|
|
144052
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144053
|
-
return [createCodeFixAction(
|
|
144285
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, context.span.start));
|
|
144286
|
+
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
|
|
144054
144287
|
},
|
|
144055
|
-
fixIds: [
|
|
144056
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144288
|
+
fixIds: [fixId34],
|
|
144289
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange20(changes, diag2.file, diag2.start))
|
|
144057
144290
|
});
|
|
144058
144291
|
}
|
|
144059
144292
|
});
|
|
144060
144293
|
|
|
144061
144294
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
144062
|
-
function
|
|
144295
|
+
function doChange21(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
144063
144296
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
144064
144297
|
newType,
|
|
144065
144298
|
/*enclosingDeclaration*/
|
|
@@ -144108,7 +144341,7 @@ ${lanes.join("\n")}
|
|
|
144108
144341
|
}
|
|
144109
144342
|
return checker.getTypeFromTypeNode(node);
|
|
144110
144343
|
}
|
|
144111
|
-
var fixIdPlain, fixIdNullable,
|
|
144344
|
+
var fixIdPlain, fixIdNullable, errorCodes44;
|
|
144112
144345
|
var init_fixJSDocTypes = __esm({
|
|
144113
144346
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
144114
144347
|
"use strict";
|
|
@@ -144116,13 +144349,13 @@ ${lanes.join("\n")}
|
|
|
144116
144349
|
init_ts_codefix();
|
|
144117
144350
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
144118
144351
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
144119
|
-
|
|
144352
|
+
errorCodes44 = [
|
|
144120
144353
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
144121
144354
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
144122
144355
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
144123
144356
|
];
|
|
144124
144357
|
registerCodeFix({
|
|
144125
|
-
errorCodes:
|
|
144358
|
+
errorCodes: errorCodes44,
|
|
144126
144359
|
getCodeActions(context) {
|
|
144127
144360
|
const { sourceFile } = context;
|
|
144128
144361
|
const checker = context.program.getTypeChecker();
|
|
@@ -144136,22 +144369,22 @@ ${lanes.join("\n")}
|
|
|
144136
144369
|
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
144137
144370
|
}
|
|
144138
144371
|
return actions2;
|
|
144139
|
-
function fix(type2,
|
|
144140
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144141
|
-
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)],
|
|
144372
|
+
function fix(type2, fixId52, fixAllDescription) {
|
|
144373
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, typeNode, type2, checker));
|
|
144374
|
+
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
|
|
144142
144375
|
}
|
|
144143
144376
|
},
|
|
144144
144377
|
fixIds: [fixIdPlain, fixIdNullable],
|
|
144145
144378
|
getAllCodeActions(context) {
|
|
144146
|
-
const { fixId:
|
|
144379
|
+
const { fixId: fixId52, program, sourceFile } = context;
|
|
144147
144380
|
const checker = program.getTypeChecker();
|
|
144148
|
-
return codeFixAll(context,
|
|
144381
|
+
return codeFixAll(context, errorCodes44, (changes, err) => {
|
|
144149
144382
|
const info = getInfo11(err.file, err.start, checker);
|
|
144150
144383
|
if (!info)
|
|
144151
144384
|
return;
|
|
144152
144385
|
const { typeNode, type } = info;
|
|
144153
|
-
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ &&
|
|
144154
|
-
|
|
144386
|
+
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
144387
|
+
doChange21(changes, sourceFile, typeNode, fixedType, checker);
|
|
144155
144388
|
});
|
|
144156
144389
|
}
|
|
144157
144390
|
});
|
|
@@ -144159,7 +144392,7 @@ ${lanes.join("\n")}
|
|
|
144159
144392
|
});
|
|
144160
144393
|
|
|
144161
144394
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
144162
|
-
function
|
|
144395
|
+
function doChange22(changes, sourceFile, name) {
|
|
144163
144396
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
144164
144397
|
}
|
|
144165
144398
|
function getCallName(sourceFile, start) {
|
|
@@ -144176,31 +144409,31 @@ ${lanes.join("\n")}
|
|
|
144176
144409
|
}
|
|
144177
144410
|
return void 0;
|
|
144178
144411
|
}
|
|
144179
|
-
var
|
|
144412
|
+
var fixId35, errorCodes45;
|
|
144180
144413
|
var init_fixMissingCallParentheses = __esm({
|
|
144181
144414
|
"src/services/codefixes/fixMissingCallParentheses.ts"() {
|
|
144182
144415
|
"use strict";
|
|
144183
144416
|
init_ts4();
|
|
144184
144417
|
init_ts_codefix();
|
|
144185
|
-
|
|
144186
|
-
|
|
144418
|
+
fixId35 = "fixMissingCallParentheses";
|
|
144419
|
+
errorCodes45 = [
|
|
144187
144420
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
144188
144421
|
];
|
|
144189
144422
|
registerCodeFix({
|
|
144190
|
-
errorCodes:
|
|
144191
|
-
fixIds: [
|
|
144423
|
+
errorCodes: errorCodes45,
|
|
144424
|
+
fixIds: [fixId35],
|
|
144192
144425
|
getCodeActions(context) {
|
|
144193
144426
|
const { sourceFile, span } = context;
|
|
144194
144427
|
const callName = getCallName(sourceFile, span.start);
|
|
144195
144428
|
if (!callName)
|
|
144196
144429
|
return;
|
|
144197
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144198
|
-
return [createCodeFixAction(
|
|
144430
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, context.sourceFile, callName));
|
|
144431
|
+
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
|
|
144199
144432
|
},
|
|
144200
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144433
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => {
|
|
144201
144434
|
const callName = getCallName(diag2.file, diag2.start);
|
|
144202
144435
|
if (callName)
|
|
144203
|
-
|
|
144436
|
+
doChange22(changes, diag2.file, callName);
|
|
144204
144437
|
})
|
|
144205
144438
|
});
|
|
144206
144439
|
}
|
|
@@ -144242,7 +144475,7 @@ ${lanes.join("\n")}
|
|
|
144242
144475
|
returnType: getReturnType(containingFunction)
|
|
144243
144476
|
};
|
|
144244
144477
|
}
|
|
144245
|
-
function
|
|
144478
|
+
function doChange23(changes, sourceFile, { insertBefore, returnType }) {
|
|
144246
144479
|
if (returnType) {
|
|
144247
144480
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
144248
144481
|
if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -144251,36 +144484,36 @@ ${lanes.join("\n")}
|
|
|
144251
144484
|
}
|
|
144252
144485
|
changes.insertModifierBefore(sourceFile, 132 /* AsyncKeyword */, insertBefore);
|
|
144253
144486
|
}
|
|
144254
|
-
var
|
|
144487
|
+
var fixId36, errorCodes46;
|
|
144255
144488
|
var init_fixAwaitInSyncFunction = __esm({
|
|
144256
144489
|
"src/services/codefixes/fixAwaitInSyncFunction.ts"() {
|
|
144257
144490
|
"use strict";
|
|
144258
144491
|
init_ts4();
|
|
144259
144492
|
init_ts_codefix();
|
|
144260
|
-
|
|
144261
|
-
|
|
144493
|
+
fixId36 = "fixAwaitInSyncFunction";
|
|
144494
|
+
errorCodes46 = [
|
|
144262
144495
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144263
144496
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144264
144497
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
144265
144498
|
];
|
|
144266
144499
|
registerCodeFix({
|
|
144267
|
-
errorCodes:
|
|
144500
|
+
errorCodes: errorCodes46,
|
|
144268
144501
|
getCodeActions(context) {
|
|
144269
144502
|
const { sourceFile, span } = context;
|
|
144270
144503
|
const nodes = getNodes3(sourceFile, span.start);
|
|
144271
144504
|
if (!nodes)
|
|
144272
144505
|
return void 0;
|
|
144273
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144274
|
-
return [createCodeFixAction(
|
|
144506
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, nodes));
|
|
144507
|
+
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
|
|
144275
144508
|
},
|
|
144276
|
-
fixIds: [
|
|
144509
|
+
fixIds: [fixId36],
|
|
144277
144510
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
144278
144511
|
const seen = /* @__PURE__ */ new Map();
|
|
144279
|
-
return codeFixAll(context,
|
|
144512
|
+
return codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
144280
144513
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
144281
144514
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
144282
144515
|
return;
|
|
144283
|
-
|
|
144516
|
+
doChange23(changes, context.sourceFile, nodes);
|
|
144284
144517
|
});
|
|
144285
144518
|
}
|
|
144286
144519
|
});
|
|
@@ -144288,7 +144521,7 @@ ${lanes.join("\n")}
|
|
|
144288
144521
|
});
|
|
144289
144522
|
|
|
144290
144523
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
144291
|
-
function
|
|
144524
|
+
function doChange24(file, start, length2, code, context) {
|
|
144292
144525
|
let startPosition;
|
|
144293
144526
|
let endPosition;
|
|
144294
144527
|
if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
|
|
@@ -144315,28 +144548,28 @@ ${lanes.join("\n")}
|
|
|
144315
144548
|
}
|
|
144316
144549
|
return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message);
|
|
144317
144550
|
}
|
|
144318
|
-
var
|
|
144551
|
+
var errorCodes47, fixId37;
|
|
144319
144552
|
var init_fixPropertyOverrideAccessor = __esm({
|
|
144320
144553
|
"src/services/codefixes/fixPropertyOverrideAccessor.ts"() {
|
|
144321
144554
|
"use strict";
|
|
144322
144555
|
init_ts4();
|
|
144323
144556
|
init_ts_codefix();
|
|
144324
|
-
|
|
144557
|
+
errorCodes47 = [
|
|
144325
144558
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
144326
144559
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
144327
144560
|
];
|
|
144328
|
-
|
|
144561
|
+
fixId37 = "fixPropertyOverrideAccessor";
|
|
144329
144562
|
registerCodeFix({
|
|
144330
|
-
errorCodes:
|
|
144563
|
+
errorCodes: errorCodes47,
|
|
144331
144564
|
getCodeActions(context) {
|
|
144332
|
-
const edits =
|
|
144565
|
+
const edits = doChange24(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
144333
144566
|
if (edits) {
|
|
144334
|
-
return [createCodeFixAction(
|
|
144567
|
+
return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
144335
144568
|
}
|
|
144336
144569
|
},
|
|
144337
|
-
fixIds: [
|
|
144338
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144339
|
-
const edits =
|
|
144570
|
+
fixIds: [fixId37],
|
|
144571
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
144572
|
+
const edits = doChange24(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
144340
144573
|
if (edits) {
|
|
144341
144574
|
for (const edit of edits) {
|
|
144342
144575
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -144383,7 +144616,7 @@ ${lanes.join("\n")}
|
|
|
144383
144616
|
}
|
|
144384
144617
|
return errorCode;
|
|
144385
144618
|
}
|
|
144386
|
-
function
|
|
144619
|
+
function doChange25(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
144387
144620
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) {
|
|
144388
144621
|
return void 0;
|
|
144389
144622
|
}
|
|
@@ -145277,14 +145510,14 @@ ${lanes.join("\n")}
|
|
|
145277
145510
|
}
|
|
145278
145511
|
}
|
|
145279
145512
|
}
|
|
145280
|
-
var
|
|
145513
|
+
var fixId38, errorCodes48;
|
|
145281
145514
|
var init_inferFromUsage = __esm({
|
|
145282
145515
|
"src/services/codefixes/inferFromUsage.ts"() {
|
|
145283
145516
|
"use strict";
|
|
145284
145517
|
init_ts4();
|
|
145285
145518
|
init_ts_codefix();
|
|
145286
|
-
|
|
145287
|
-
|
|
145519
|
+
fixId38 = "inferFromUsage";
|
|
145520
|
+
errorCodes48 = [
|
|
145288
145521
|
// Variable declarations
|
|
145289
145522
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
145290
145523
|
// Variable uses
|
|
@@ -145318,13 +145551,13 @@ ${lanes.join("\n")}
|
|
|
145318
145551
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
145319
145552
|
];
|
|
145320
145553
|
registerCodeFix({
|
|
145321
|
-
errorCodes:
|
|
145554
|
+
errorCodes: errorCodes48,
|
|
145322
145555
|
getCodeActions(context) {
|
|
145323
145556
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
145324
145557
|
const token = getTokenAtPosition(sourceFile, start);
|
|
145325
145558
|
let declaration;
|
|
145326
145559
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
145327
|
-
declaration =
|
|
145560
|
+
declaration = doChange25(
|
|
145328
145561
|
changes2,
|
|
145329
145562
|
sourceFile,
|
|
145330
145563
|
token,
|
|
@@ -145338,14 +145571,14 @@ ${lanes.join("\n")}
|
|
|
145338
145571
|
);
|
|
145339
145572
|
});
|
|
145340
145573
|
const name = declaration && getNameOfDeclaration(declaration);
|
|
145341
|
-
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
145574
|
+
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId38, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId38, Diagnostics.Infer_all_types_from_usage)];
|
|
145342
145575
|
},
|
|
145343
|
-
fixIds: [
|
|
145576
|
+
fixIds: [fixId38],
|
|
145344
145577
|
getAllCodeActions(context) {
|
|
145345
145578
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
145346
145579
|
const markSeen = nodeSeenTracker();
|
|
145347
|
-
return codeFixAll(context,
|
|
145348
|
-
|
|
145580
|
+
return codeFixAll(context, errorCodes48, (changes, err) => {
|
|
145581
|
+
doChange25(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
145349
145582
|
});
|
|
145350
145583
|
}
|
|
145351
145584
|
});
|
|
@@ -145376,22 +145609,22 @@ ${lanes.join("\n")}
|
|
|
145376
145609
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
145377
145610
|
}
|
|
145378
145611
|
}
|
|
145379
|
-
function
|
|
145612
|
+
function doChange26(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
145380
145613
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
145381
145614
|
}
|
|
145382
|
-
var
|
|
145615
|
+
var fixId39, errorCodes49;
|
|
145383
145616
|
var init_fixReturnTypeInAsyncFunction = __esm({
|
|
145384
145617
|
"src/services/codefixes/fixReturnTypeInAsyncFunction.ts"() {
|
|
145385
145618
|
"use strict";
|
|
145386
145619
|
init_ts4();
|
|
145387
145620
|
init_ts_codefix();
|
|
145388
|
-
|
|
145389
|
-
|
|
145621
|
+
fixId39 = "fixReturnTypeInAsyncFunction";
|
|
145622
|
+
errorCodes49 = [
|
|
145390
145623
|
Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0.code
|
|
145391
145624
|
];
|
|
145392
145625
|
registerCodeFix({
|
|
145393
|
-
errorCodes:
|
|
145394
|
-
fixIds: [
|
|
145626
|
+
errorCodes: errorCodes49,
|
|
145627
|
+
fixIds: [fixId39],
|
|
145395
145628
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
145396
145629
|
const { sourceFile, program, span } = context;
|
|
145397
145630
|
const checker = program.getTypeChecker();
|
|
@@ -145400,23 +145633,23 @@ ${lanes.join("\n")}
|
|
|
145400
145633
|
return void 0;
|
|
145401
145634
|
}
|
|
145402
145635
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
145403
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145636
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
145404
145637
|
return [createCodeFixAction(
|
|
145405
|
-
|
|
145638
|
+
fixId39,
|
|
145406
145639
|
changes,
|
|
145407
145640
|
[
|
|
145408
145641
|
Diagnostics.Replace_0_with_Promise_1,
|
|
145409
145642
|
checker.typeToString(returnType),
|
|
145410
145643
|
checker.typeToString(promisedType)
|
|
145411
145644
|
],
|
|
145412
|
-
|
|
145645
|
+
fixId39,
|
|
145413
145646
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
145414
145647
|
)];
|
|
145415
145648
|
},
|
|
145416
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
145649
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes49, (changes, diag2) => {
|
|
145417
145650
|
const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
145418
145651
|
if (info) {
|
|
145419
|
-
|
|
145652
|
+
doChange26(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
145420
145653
|
}
|
|
145421
145654
|
})
|
|
145422
145655
|
});
|
|
@@ -145430,20 +145663,20 @@ ${lanes.join("\n")}
|
|
|
145430
145663
|
changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore");
|
|
145431
145664
|
}
|
|
145432
145665
|
}
|
|
145433
|
-
var fixName4,
|
|
145666
|
+
var fixName4, fixId40, errorCodes50;
|
|
145434
145667
|
var init_disableJsDiagnostics = __esm({
|
|
145435
145668
|
"src/services/codefixes/disableJsDiagnostics.ts"() {
|
|
145436
145669
|
"use strict";
|
|
145437
145670
|
init_ts4();
|
|
145438
145671
|
init_ts_codefix();
|
|
145439
145672
|
fixName4 = "disableJsDiagnostics";
|
|
145440
|
-
|
|
145441
|
-
|
|
145673
|
+
fixId40 = "disableJsDiagnostics";
|
|
145674
|
+
errorCodes50 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
145442
145675
|
const diag2 = Diagnostics[key];
|
|
145443
145676
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
145444
145677
|
});
|
|
145445
145678
|
registerCodeFix({
|
|
145446
|
-
errorCodes:
|
|
145679
|
+
errorCodes: errorCodes50,
|
|
145447
145680
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
145448
145681
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
145449
145682
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -145461,14 +145694,14 @@ ${lanes.join("\n")}
|
|
|
145461
145694
|
)
|
|
145462
145695
|
];
|
|
145463
145696
|
if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) {
|
|
145464
|
-
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message,
|
|
145697
|
+
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId40, Diagnostics.Add_ts_ignore_to_all_error_messages));
|
|
145465
145698
|
}
|
|
145466
145699
|
return fixes;
|
|
145467
145700
|
},
|
|
145468
|
-
fixIds: [
|
|
145701
|
+
fixIds: [fixId40],
|
|
145469
145702
|
getAllCodeActions: (context) => {
|
|
145470
145703
|
const seenLines = /* @__PURE__ */ new Set();
|
|
145471
|
-
return codeFixAll(context,
|
|
145704
|
+
return codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
145472
145705
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
145473
145706
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
145474
145707
|
}
|
|
@@ -146565,7 +146798,7 @@ ${lanes.join("\n")}
|
|
|
146565
146798
|
}
|
|
146566
146799
|
return void 0;
|
|
146567
146800
|
}
|
|
146568
|
-
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer,
|
|
146801
|
+
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes51;
|
|
146569
146802
|
var init_fixStrictClassInitialization = __esm({
|
|
146570
146803
|
"src/services/codefixes/fixStrictClassInitialization.ts"() {
|
|
146571
146804
|
"use strict";
|
|
@@ -146575,9 +146808,9 @@ ${lanes.join("\n")}
|
|
|
146575
146808
|
fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
146576
146809
|
fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
146577
146810
|
fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
146578
|
-
|
|
146811
|
+
errorCodes51 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
146579
146812
|
registerCodeFix({
|
|
146580
|
-
errorCodes:
|
|
146813
|
+
errorCodes: errorCodes51,
|
|
146581
146814
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
146582
146815
|
const info = getInfo13(context.sourceFile, context.span.start);
|
|
146583
146816
|
if (!info)
|
|
@@ -146590,7 +146823,7 @@ ${lanes.join("\n")}
|
|
|
146590
146823
|
},
|
|
146591
146824
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
146592
146825
|
getAllCodeActions: (context) => {
|
|
146593
|
-
return codeFixAll(context,
|
|
146826
|
+
return codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
146594
146827
|
const info = getInfo13(diag2.file, diag2.start);
|
|
146595
146828
|
if (!info)
|
|
146596
146829
|
return;
|
|
@@ -146618,7 +146851,7 @@ ${lanes.join("\n")}
|
|
|
146618
146851
|
});
|
|
146619
146852
|
|
|
146620
146853
|
// src/services/codefixes/requireInTs.ts
|
|
146621
|
-
function
|
|
146854
|
+
function doChange27(changes, sourceFile, info) {
|
|
146622
146855
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
146623
146856
|
changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(
|
|
146624
146857
|
/*modifiers*/
|
|
@@ -146680,29 +146913,29 @@ ${lanes.join("\n")}
|
|
|
146680
146913
|
return factory.createNamedImports(importSpecifiers);
|
|
146681
146914
|
}
|
|
146682
146915
|
}
|
|
146683
|
-
var
|
|
146916
|
+
var fixId41, errorCodes52;
|
|
146684
146917
|
var init_requireInTs = __esm({
|
|
146685
146918
|
"src/services/codefixes/requireInTs.ts"() {
|
|
146686
146919
|
"use strict";
|
|
146687
146920
|
init_ts4();
|
|
146688
146921
|
init_ts_codefix();
|
|
146689
|
-
|
|
146690
|
-
|
|
146922
|
+
fixId41 = "requireInTs";
|
|
146923
|
+
errorCodes52 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
146691
146924
|
registerCodeFix({
|
|
146692
|
-
errorCodes:
|
|
146925
|
+
errorCodes: errorCodes52,
|
|
146693
146926
|
getCodeActions(context) {
|
|
146694
146927
|
const info = getInfo14(context.sourceFile, context.program, context.span.start);
|
|
146695
146928
|
if (!info) {
|
|
146696
146929
|
return void 0;
|
|
146697
146930
|
}
|
|
146698
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146699
|
-
return [createCodeFixAction(
|
|
146931
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, info));
|
|
146932
|
+
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
|
|
146700
146933
|
},
|
|
146701
|
-
fixIds: [
|
|
146702
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
146934
|
+
fixIds: [fixId41],
|
|
146935
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
146703
146936
|
const info = getInfo14(diag2.file, context.program, diag2.start);
|
|
146704
146937
|
if (info) {
|
|
146705
|
-
|
|
146938
|
+
doChange27(changes, context.sourceFile, info);
|
|
146706
146939
|
}
|
|
146707
146940
|
})
|
|
146708
146941
|
});
|
|
@@ -146722,7 +146955,7 @@ ${lanes.join("\n")}
|
|
|
146722
146955
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
146723
146956
|
}
|
|
146724
146957
|
}
|
|
146725
|
-
function
|
|
146958
|
+
function doChange28(changes, sourceFile, info, preferences) {
|
|
146726
146959
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
146727
146960
|
info.name,
|
|
146728
146961
|
/*namedImports*/
|
|
@@ -146731,29 +146964,29 @@ ${lanes.join("\n")}
|
|
|
146731
146964
|
getQuotePreference(sourceFile, preferences)
|
|
146732
146965
|
));
|
|
146733
146966
|
}
|
|
146734
|
-
var
|
|
146967
|
+
var fixId42, errorCodes53;
|
|
146735
146968
|
var init_useDefaultImport = __esm({
|
|
146736
146969
|
"src/services/codefixes/useDefaultImport.ts"() {
|
|
146737
146970
|
"use strict";
|
|
146738
146971
|
init_ts4();
|
|
146739
146972
|
init_ts_codefix();
|
|
146740
|
-
|
|
146741
|
-
|
|
146973
|
+
fixId42 = "useDefaultImport";
|
|
146974
|
+
errorCodes53 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
146742
146975
|
registerCodeFix({
|
|
146743
|
-
errorCodes:
|
|
146976
|
+
errorCodes: errorCodes53,
|
|
146744
146977
|
getCodeActions(context) {
|
|
146745
146978
|
const { sourceFile, span: { start } } = context;
|
|
146746
146979
|
const info = getInfo15(sourceFile, start);
|
|
146747
146980
|
if (!info)
|
|
146748
146981
|
return void 0;
|
|
146749
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146750
|
-
return [createCodeFixAction(
|
|
146982
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, info, context.preferences));
|
|
146983
|
+
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
|
|
146751
146984
|
},
|
|
146752
|
-
fixIds: [
|
|
146753
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
146985
|
+
fixIds: [fixId42],
|
|
146986
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
146754
146987
|
const info = getInfo15(diag2.file, diag2.start);
|
|
146755
146988
|
if (info)
|
|
146756
|
-
|
|
146989
|
+
doChange28(changes, diag2.file, info, context.preferences);
|
|
146757
146990
|
})
|
|
146758
146991
|
});
|
|
146759
146992
|
}
|
|
@@ -146768,27 +147001,27 @@ ${lanes.join("\n")}
|
|
|
146768
147001
|
const newText = numericLiteral.getText(sourceFile) + "n";
|
|
146769
147002
|
changeTracker.replaceNode(sourceFile, numericLiteral, factory.createBigIntLiteral(newText));
|
|
146770
147003
|
}
|
|
146771
|
-
var
|
|
147004
|
+
var fixId43, errorCodes54;
|
|
146772
147005
|
var init_useBigintLiteral = __esm({
|
|
146773
147006
|
"src/services/codefixes/useBigintLiteral.ts"() {
|
|
146774
147007
|
"use strict";
|
|
146775
147008
|
init_ts4();
|
|
146776
147009
|
init_ts_codefix();
|
|
146777
|
-
|
|
146778
|
-
|
|
147010
|
+
fixId43 = "useBigintLiteral";
|
|
147011
|
+
errorCodes54 = [
|
|
146779
147012
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
146780
147013
|
];
|
|
146781
147014
|
registerCodeFix({
|
|
146782
|
-
errorCodes:
|
|
147015
|
+
errorCodes: errorCodes54,
|
|
146783
147016
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
146784
147017
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
146785
147018
|
if (changes.length > 0) {
|
|
146786
|
-
return [createCodeFixAction(
|
|
147019
|
+
return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId43, Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
146787
147020
|
}
|
|
146788
147021
|
},
|
|
146789
|
-
fixIds: [
|
|
147022
|
+
fixIds: [fixId43],
|
|
146790
147023
|
getAllCodeActions: (context) => {
|
|
146791
|
-
return codeFixAll(context,
|
|
147024
|
+
return codeFixAll(context, errorCodes54, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
146792
147025
|
}
|
|
146793
147026
|
});
|
|
146794
147027
|
}
|
|
@@ -146801,7 +147034,7 @@ ${lanes.join("\n")}
|
|
|
146801
147034
|
Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType");
|
|
146802
147035
|
return token.parent;
|
|
146803
147036
|
}
|
|
146804
|
-
function
|
|
147037
|
+
function doChange29(changes, sourceFile, importType) {
|
|
146805
147038
|
const newTypeNode = factory.updateImportTypeNode(
|
|
146806
147039
|
importType,
|
|
146807
147040
|
importType.argument,
|
|
@@ -146813,25 +147046,25 @@ ${lanes.join("\n")}
|
|
|
146813
147046
|
);
|
|
146814
147047
|
changes.replaceNode(sourceFile, importType, newTypeNode);
|
|
146815
147048
|
}
|
|
146816
|
-
var fixIdAddMissingTypeof,
|
|
147049
|
+
var fixIdAddMissingTypeof, fixId44, errorCodes55;
|
|
146817
147050
|
var init_fixAddModuleReferTypeMissingTypeof = __esm({
|
|
146818
147051
|
"src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts"() {
|
|
146819
147052
|
"use strict";
|
|
146820
147053
|
init_ts4();
|
|
146821
147054
|
init_ts_codefix();
|
|
146822
147055
|
fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
146823
|
-
|
|
146824
|
-
|
|
147056
|
+
fixId44 = fixIdAddMissingTypeof;
|
|
147057
|
+
errorCodes55 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
146825
147058
|
registerCodeFix({
|
|
146826
|
-
errorCodes:
|
|
147059
|
+
errorCodes: errorCodes55,
|
|
146827
147060
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
146828
147061
|
const { sourceFile, span } = context;
|
|
146829
147062
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
146830
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146831
|
-
return [createCodeFixAction(
|
|
147063
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, importType));
|
|
147064
|
+
return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
|
|
146832
147065
|
},
|
|
146833
|
-
fixIds: [
|
|
146834
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147066
|
+
fixIds: [fixId44],
|
|
147067
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => doChange29(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
146835
147068
|
});
|
|
146836
147069
|
}
|
|
146837
147070
|
});
|
|
@@ -146850,7 +147083,7 @@ ${lanes.join("\n")}
|
|
|
146850
147083
|
return void 0;
|
|
146851
147084
|
return binaryExpr;
|
|
146852
147085
|
}
|
|
146853
|
-
function
|
|
147086
|
+
function doChange30(changeTracker, sf, node) {
|
|
146854
147087
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
146855
147088
|
if (jsx)
|
|
146856
147089
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -146873,30 +147106,30 @@ ${lanes.join("\n")}
|
|
|
146873
147106
|
return void 0;
|
|
146874
147107
|
}
|
|
146875
147108
|
}
|
|
146876
|
-
var fixID2,
|
|
147109
|
+
var fixID2, errorCodes56;
|
|
146877
147110
|
var init_wrapJsxInFragment = __esm({
|
|
146878
147111
|
"src/services/codefixes/wrapJsxInFragment.ts"() {
|
|
146879
147112
|
"use strict";
|
|
146880
147113
|
init_ts4();
|
|
146881
147114
|
init_ts_codefix();
|
|
146882
147115
|
fixID2 = "wrapJsxInFragment";
|
|
146883
|
-
|
|
147116
|
+
errorCodes56 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
146884
147117
|
registerCodeFix({
|
|
146885
|
-
errorCodes:
|
|
147118
|
+
errorCodes: errorCodes56,
|
|
146886
147119
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
146887
147120
|
const { sourceFile, span } = context;
|
|
146888
147121
|
const node = findNodeToFix(sourceFile, span.start);
|
|
146889
147122
|
if (!node)
|
|
146890
147123
|
return void 0;
|
|
146891
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147124
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, node));
|
|
146892
147125
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
146893
147126
|
},
|
|
146894
147127
|
fixIds: [fixID2],
|
|
146895
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147128
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
|
|
146896
147129
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
146897
147130
|
if (!node)
|
|
146898
147131
|
return void 0;
|
|
146899
|
-
|
|
147132
|
+
doChange30(changes, context.sourceFile, node);
|
|
146900
147133
|
})
|
|
146901
147134
|
});
|
|
146902
147135
|
}
|
|
@@ -146916,7 +147149,7 @@ ${lanes.join("\n")}
|
|
|
146916
147149
|
function createTypeAliasFromInterface(declaration, type) {
|
|
146917
147150
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
146918
147151
|
}
|
|
146919
|
-
function
|
|
147152
|
+
function doChange31(changes, sourceFile, { indexSignature, container }) {
|
|
146920
147153
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
146921
147154
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
146922
147155
|
const parameter = first(indexSignature.parameters);
|
|
@@ -146943,48 +147176,48 @@ ${lanes.join("\n")}
|
|
|
146943
147176
|
]);
|
|
146944
147177
|
changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType));
|
|
146945
147178
|
}
|
|
146946
|
-
var
|
|
147179
|
+
var fixId45, errorCodes57;
|
|
146947
147180
|
var init_convertToMappedObjectType = __esm({
|
|
146948
147181
|
"src/services/codefixes/convertToMappedObjectType.ts"() {
|
|
146949
147182
|
"use strict";
|
|
146950
147183
|
init_ts4();
|
|
146951
147184
|
init_ts_codefix();
|
|
146952
|
-
|
|
146953
|
-
|
|
147185
|
+
fixId45 = "fixConvertToMappedObjectType";
|
|
147186
|
+
errorCodes57 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
146954
147187
|
registerCodeFix({
|
|
146955
|
-
errorCodes:
|
|
147188
|
+
errorCodes: errorCodes57,
|
|
146956
147189
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
146957
147190
|
const { sourceFile, span } = context;
|
|
146958
147191
|
const info = getInfo16(sourceFile, span.start);
|
|
146959
147192
|
if (!info)
|
|
146960
147193
|
return void 0;
|
|
146961
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147194
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info));
|
|
146962
147195
|
const name = idText(info.container.name);
|
|
146963
|
-
return [createCodeFixAction(
|
|
147196
|
+
return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
146964
147197
|
},
|
|
146965
|
-
fixIds: [
|
|
146966
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147198
|
+
fixIds: [fixId45],
|
|
147199
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
|
|
146967
147200
|
const info = getInfo16(diag2.file, diag2.start);
|
|
146968
147201
|
if (info)
|
|
146969
|
-
|
|
147202
|
+
doChange31(changes, diag2.file, info);
|
|
146970
147203
|
})
|
|
146971
147204
|
});
|
|
146972
147205
|
}
|
|
146973
147206
|
});
|
|
146974
147207
|
|
|
146975
147208
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
146976
|
-
var
|
|
147209
|
+
var fixId46, errorCodes58;
|
|
146977
147210
|
var init_removeAccidentalCallParentheses = __esm({
|
|
146978
147211
|
"src/services/codefixes/removeAccidentalCallParentheses.ts"() {
|
|
146979
147212
|
"use strict";
|
|
146980
147213
|
init_ts4();
|
|
146981
147214
|
init_ts_codefix();
|
|
146982
|
-
|
|
146983
|
-
|
|
147215
|
+
fixId46 = "removeAccidentalCallParentheses";
|
|
147216
|
+
errorCodes58 = [
|
|
146984
147217
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
146985
147218
|
];
|
|
146986
147219
|
registerCodeFix({
|
|
146987
|
-
errorCodes:
|
|
147220
|
+
errorCodes: errorCodes58,
|
|
146988
147221
|
getCodeActions(context) {
|
|
146989
147222
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
146990
147223
|
if (!callExpression) {
|
|
@@ -146993,9 +147226,9 @@ ${lanes.join("\n")}
|
|
|
146993
147226
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
146994
147227
|
t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
|
|
146995
147228
|
});
|
|
146996
|
-
return [createCodeFixActionWithoutFixAll(
|
|
147229
|
+
return [createCodeFixActionWithoutFixAll(fixId46, changes, Diagnostics.Remove_parentheses)];
|
|
146997
147230
|
},
|
|
146998
|
-
fixIds: [
|
|
147231
|
+
fixIds: [fixId46]
|
|
146999
147232
|
});
|
|
147000
147233
|
}
|
|
147001
147234
|
});
|
|
@@ -147024,27 +147257,27 @@ ${lanes.join("\n")}
|
|
|
147024
147257
|
}
|
|
147025
147258
|
changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression);
|
|
147026
147259
|
}
|
|
147027
|
-
var
|
|
147260
|
+
var fixId47, errorCodes59;
|
|
147028
147261
|
var init_removeUnnecessaryAwait = __esm({
|
|
147029
147262
|
"src/services/codefixes/removeUnnecessaryAwait.ts"() {
|
|
147030
147263
|
"use strict";
|
|
147031
147264
|
init_ts4();
|
|
147032
147265
|
init_ts_codefix();
|
|
147033
|
-
|
|
147034
|
-
|
|
147266
|
+
fixId47 = "removeUnnecessaryAwait";
|
|
147267
|
+
errorCodes59 = [
|
|
147035
147268
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
147036
147269
|
];
|
|
147037
147270
|
registerCodeFix({
|
|
147038
|
-
errorCodes:
|
|
147271
|
+
errorCodes: errorCodes59,
|
|
147039
147272
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
147040
147273
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
147041
147274
|
if (changes.length > 0) {
|
|
147042
|
-
return [createCodeFixAction(
|
|
147275
|
+
return [createCodeFixAction(fixId47, changes, Diagnostics.Remove_unnecessary_await, fixId47, Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
147043
147276
|
}
|
|
147044
147277
|
},
|
|
147045
|
-
fixIds: [
|
|
147278
|
+
fixIds: [fixId47],
|
|
147046
147279
|
getAllCodeActions: (context) => {
|
|
147047
|
-
return codeFixAll(context,
|
|
147280
|
+
return codeFixAll(context, errorCodes59, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
147048
147281
|
}
|
|
147049
147282
|
});
|
|
147050
147283
|
}
|
|
@@ -147086,26 +147319,26 @@ ${lanes.join("\n")}
|
|
|
147086
147319
|
importDeclaration.assertClause
|
|
147087
147320
|
));
|
|
147088
147321
|
}
|
|
147089
|
-
var
|
|
147322
|
+
var errorCodes60, fixId48;
|
|
147090
147323
|
var init_splitTypeOnlyImport = __esm({
|
|
147091
147324
|
"src/services/codefixes/splitTypeOnlyImport.ts"() {
|
|
147092
147325
|
"use strict";
|
|
147093
147326
|
init_ts4();
|
|
147094
147327
|
init_ts_codefix();
|
|
147095
|
-
|
|
147096
|
-
|
|
147328
|
+
errorCodes60 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
147329
|
+
fixId48 = "splitTypeOnlyImport";
|
|
147097
147330
|
registerCodeFix({
|
|
147098
|
-
errorCodes:
|
|
147099
|
-
fixIds: [
|
|
147331
|
+
errorCodes: errorCodes60,
|
|
147332
|
+
fixIds: [fixId48],
|
|
147100
147333
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
147101
147334
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
147102
147335
|
return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
|
|
147103
147336
|
});
|
|
147104
147337
|
if (changes.length) {
|
|
147105
|
-
return [createCodeFixAction(
|
|
147338
|
+
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
147106
147339
|
}
|
|
147107
147340
|
},
|
|
147108
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147341
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error) => {
|
|
147109
147342
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error), context);
|
|
147110
147343
|
})
|
|
147111
147344
|
});
|
|
@@ -147127,43 +147360,43 @@ ${lanes.join("\n")}
|
|
|
147127
147360
|
return;
|
|
147128
147361
|
return { symbol, token: constToken };
|
|
147129
147362
|
}
|
|
147130
|
-
function
|
|
147363
|
+
function doChange32(changes, sourceFile, token) {
|
|
147131
147364
|
changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */));
|
|
147132
147365
|
}
|
|
147133
|
-
var
|
|
147366
|
+
var fixId49, errorCodes61;
|
|
147134
147367
|
var init_convertConstToLet = __esm({
|
|
147135
147368
|
"src/services/codefixes/convertConstToLet.ts"() {
|
|
147136
147369
|
"use strict";
|
|
147137
147370
|
init_ts4();
|
|
147138
147371
|
init_ts_codefix();
|
|
147139
|
-
|
|
147140
|
-
|
|
147372
|
+
fixId49 = "fixConvertConstToLet";
|
|
147373
|
+
errorCodes61 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
147141
147374
|
registerCodeFix({
|
|
147142
|
-
errorCodes:
|
|
147375
|
+
errorCodes: errorCodes61,
|
|
147143
147376
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
147144
147377
|
const { sourceFile, span, program } = context;
|
|
147145
147378
|
const info = getInfo17(sourceFile, span.start, program);
|
|
147146
147379
|
if (info === void 0)
|
|
147147
147380
|
return;
|
|
147148
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147149
|
-
return [createCodeFixActionMaybeFixAll(
|
|
147381
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info.token));
|
|
147382
|
+
return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
|
|
147150
147383
|
},
|
|
147151
147384
|
getAllCodeActions: (context) => {
|
|
147152
147385
|
const { program } = context;
|
|
147153
147386
|
const seen = /* @__PURE__ */ new Map();
|
|
147154
147387
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
147155
|
-
eachDiagnostic(context,
|
|
147388
|
+
eachDiagnostic(context, errorCodes61, (diag2) => {
|
|
147156
147389
|
const info = getInfo17(diag2.file, diag2.start, program);
|
|
147157
147390
|
if (info) {
|
|
147158
147391
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
147159
|
-
return
|
|
147392
|
+
return doChange32(changes, diag2.file, info.token);
|
|
147160
147393
|
}
|
|
147161
147394
|
}
|
|
147162
147395
|
return void 0;
|
|
147163
147396
|
});
|
|
147164
147397
|
}));
|
|
147165
147398
|
},
|
|
147166
|
-
fixIds: [
|
|
147399
|
+
fixIds: [fixId49]
|
|
147167
147400
|
});
|
|
147168
147401
|
}
|
|
147169
147402
|
});
|
|
@@ -147173,40 +147406,40 @@ ${lanes.join("\n")}
|
|
|
147173
147406
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
147174
147407
|
return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
147175
147408
|
}
|
|
147176
|
-
function
|
|
147409
|
+
function doChange33(changes, sourceFile, { node }) {
|
|
147177
147410
|
const newNode = factory.createToken(27 /* CommaToken */);
|
|
147178
147411
|
changes.replaceNode(sourceFile, node, newNode);
|
|
147179
147412
|
}
|
|
147180
|
-
var
|
|
147413
|
+
var fixId50, expectedErrorCode, errorCodes62;
|
|
147181
147414
|
var init_fixExpectedComma = __esm({
|
|
147182
147415
|
"src/services/codefixes/fixExpectedComma.ts"() {
|
|
147183
147416
|
"use strict";
|
|
147184
147417
|
init_ts4();
|
|
147185
147418
|
init_ts_codefix();
|
|
147186
|
-
|
|
147419
|
+
fixId50 = "fixExpectedComma";
|
|
147187
147420
|
expectedErrorCode = Diagnostics._0_expected.code;
|
|
147188
|
-
|
|
147421
|
+
errorCodes62 = [expectedErrorCode];
|
|
147189
147422
|
registerCodeFix({
|
|
147190
|
-
errorCodes:
|
|
147423
|
+
errorCodes: errorCodes62,
|
|
147191
147424
|
getCodeActions(context) {
|
|
147192
147425
|
const { sourceFile } = context;
|
|
147193
147426
|
const info = getInfo18(sourceFile, context.span.start, context.errorCode);
|
|
147194
147427
|
if (!info)
|
|
147195
147428
|
return void 0;
|
|
147196
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147429
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(t, sourceFile, info));
|
|
147197
147430
|
return [createCodeFixAction(
|
|
147198
|
-
|
|
147431
|
+
fixId50,
|
|
147199
147432
|
changes,
|
|
147200
147433
|
[Diagnostics.Change_0_to_1, ";", ","],
|
|
147201
|
-
|
|
147434
|
+
fixId50,
|
|
147202
147435
|
[Diagnostics.Change_0_to_1, ";", ","]
|
|
147203
147436
|
)];
|
|
147204
147437
|
},
|
|
147205
|
-
fixIds: [
|
|
147206
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147438
|
+
fixIds: [fixId50],
|
|
147439
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes62, (changes, diag2) => {
|
|
147207
147440
|
const info = getInfo18(diag2.file, diag2.start, diag2.code);
|
|
147208
147441
|
if (info)
|
|
147209
|
-
|
|
147442
|
+
doChange33(changes, context.sourceFile, info);
|
|
147210
147443
|
})
|
|
147211
147444
|
});
|
|
147212
147445
|
}
|
|
@@ -147262,29 +147495,29 @@ ${lanes.join("\n")}
|
|
|
147262
147495
|
return node.typeArguments;
|
|
147263
147496
|
}
|
|
147264
147497
|
}
|
|
147265
|
-
var fixName7,
|
|
147498
|
+
var fixName7, fixId51, errorCodes63;
|
|
147266
147499
|
var init_fixAddVoidToPromise = __esm({
|
|
147267
147500
|
"src/services/codefixes/fixAddVoidToPromise.ts"() {
|
|
147268
147501
|
"use strict";
|
|
147269
147502
|
init_ts4();
|
|
147270
147503
|
init_ts_codefix();
|
|
147271
147504
|
fixName7 = "addVoidToPromise";
|
|
147272
|
-
|
|
147273
|
-
|
|
147505
|
+
fixId51 = "addVoidToPromise";
|
|
147506
|
+
errorCodes63 = [
|
|
147274
147507
|
Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
147275
147508
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
147276
147509
|
];
|
|
147277
147510
|
registerCodeFix({
|
|
147278
|
-
errorCodes:
|
|
147279
|
-
fixIds: [
|
|
147511
|
+
errorCodes: errorCodes63,
|
|
147512
|
+
fixIds: [fixId51],
|
|
147280
147513
|
getCodeActions(context) {
|
|
147281
147514
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
|
|
147282
147515
|
if (changes.length > 0) {
|
|
147283
|
-
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value,
|
|
147516
|
+
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId51, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
|
|
147284
147517
|
}
|
|
147285
147518
|
},
|
|
147286
147519
|
getAllCodeActions(context) {
|
|
147287
|
-
return codeFixAll(context,
|
|
147520
|
+
return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
147288
147521
|
}
|
|
147289
147522
|
});
|
|
147290
147523
|
}
|
|
@@ -147319,6 +147552,7 @@ ${lanes.join("\n")}
|
|
|
147319
147552
|
getFixes: () => getFixes,
|
|
147320
147553
|
getImportCompletionAction: () => getImportCompletionAction,
|
|
147321
147554
|
getImportKind: () => getImportKind,
|
|
147555
|
+
getJSDocTypedefNode: () => getJSDocTypedefNode,
|
|
147322
147556
|
getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
|
|
147323
147557
|
getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
|
|
147324
147558
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
@@ -147353,6 +147587,7 @@ ${lanes.join("\n")}
|
|
|
147353
147587
|
init_correctQualifiedNameToIndexedAccessType();
|
|
147354
147588
|
init_convertToTypeOnlyExport();
|
|
147355
147589
|
init_convertToTypeOnlyImport();
|
|
147590
|
+
init_convertTypedefToType();
|
|
147356
147591
|
init_convertLiteralTypeToMappedType();
|
|
147357
147592
|
init_fixClassIncorrectlyImplementsInterface();
|
|
147358
147593
|
init_importFixes();
|
|
@@ -156502,7 +156737,7 @@ ${lanes.join("\n")}
|
|
|
156502
156737
|
return void 0;
|
|
156503
156738
|
}
|
|
156504
156739
|
}
|
|
156505
|
-
function
|
|
156740
|
+
function doChange34(exportingSourceFile, program, info, changes, cancellationToken) {
|
|
156506
156741
|
changeExport(exportingSourceFile, info, changes, program.getTypeChecker());
|
|
156507
156742
|
changeImports(program, info, changes, cancellationToken);
|
|
156508
156743
|
}
|
|
@@ -156698,7 +156933,7 @@ ${lanes.join("\n")}
|
|
|
156698
156933
|
Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name");
|
|
156699
156934
|
const info = getInfo19(context);
|
|
156700
156935
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156701
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
156936
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, info, t, context.cancellationToken));
|
|
156702
156937
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156703
156938
|
}
|
|
156704
156939
|
});
|
|
@@ -156733,7 +156968,7 @@ ${lanes.join("\n")}
|
|
|
156733
156968
|
function getShouldUseDefault(program, importClause) {
|
|
156734
156969
|
return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
|
|
156735
156970
|
}
|
|
156736
|
-
function
|
|
156971
|
+
function doChange35(sourceFile, program, changes, info) {
|
|
156737
156972
|
const checker = program.getTypeChecker();
|
|
156738
156973
|
if (info.convertTo === 0 /* Named */) {
|
|
156739
156974
|
doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions()));
|
|
@@ -156925,7 +157160,7 @@ ${lanes.join("\n")}
|
|
|
156925
157160
|
Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name");
|
|
156926
157161
|
const info = getImportConversionInfo(context);
|
|
156927
157162
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156928
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157163
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, t, info));
|
|
156929
157164
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156930
157165
|
}
|
|
156931
157166
|
});
|
|
@@ -157267,7 +157502,7 @@ ${lanes.join("\n")}
|
|
|
157267
157502
|
afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
|
|
157268
157503
|
};
|
|
157269
157504
|
}
|
|
157270
|
-
function
|
|
157505
|
+
function doChange36(oldFile, program, toMove, changes, host, preferences) {
|
|
157271
157506
|
const checker = program.getTypeChecker();
|
|
157272
157507
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
157273
157508
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
@@ -158037,7 +158272,7 @@ ${lanes.join("\n")}
|
|
|
158037
158272
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
158038
158273
|
Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
|
|
158039
158274
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
158040
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158275
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(context.file, context.program, statements, t, context.host, context.preferences));
|
|
158041
158276
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
158042
158277
|
}
|
|
158043
158278
|
});
|
|
@@ -158699,12 +158934,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158699
158934
|
return void 0;
|
|
158700
158935
|
const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken);
|
|
158701
158936
|
if (groupedReferences.valid) {
|
|
158702
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158937
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(file, program, host, t, functionDeclaration, groupedReferences));
|
|
158703
158938
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
158704
158939
|
}
|
|
158705
158940
|
return { edits: [] };
|
|
158706
158941
|
}
|
|
158707
|
-
function
|
|
158942
|
+
function doChange37(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
158708
158943
|
const signature = groupedReferences.signature;
|
|
158709
158944
|
const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param));
|
|
158710
158945
|
if (signature) {
|
|
@@ -159497,7 +159732,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159497
159732
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
159498
159733
|
const edits = ts_textChanges_exports.ChangeTracker.with(
|
|
159499
159734
|
context,
|
|
159500
|
-
(t) =>
|
|
159735
|
+
(t) => doChange38(context.file, context.program.getTypeChecker(), t, info, actionName2)
|
|
159501
159736
|
);
|
|
159502
159737
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
159503
159738
|
}
|
|
@@ -159653,7 +159888,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159653
159888
|
}
|
|
159654
159889
|
return toConvert;
|
|
159655
159890
|
}
|
|
159656
|
-
function
|
|
159891
|
+
function doChange38(sourceFile, checker, changes, info, _actionName) {
|
|
159657
159892
|
const { finalExpression, occurrences, expression } = info;
|
|
159658
159893
|
const firstOccurrence = occurrences[occurrences.length - 1];
|
|
159659
159894
|
const convertedChain = convertOccurrences(checker, finalExpression, occurrences);
|
|
@@ -161389,7 +161624,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161389
161624
|
function getRefactorEditsToInferReturnType(context) {
|
|
161390
161625
|
const info = getInfo21(context);
|
|
161391
161626
|
if (info && !isRefactorErrorInfo(info)) {
|
|
161392
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
161627
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(context.file, t, info.declaration, info.returnTypeNode));
|
|
161393
161628
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
161394
161629
|
}
|
|
161395
161630
|
return void 0;
|
|
@@ -161414,7 +161649,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161414
161649
|
}
|
|
161415
161650
|
return emptyArray;
|
|
161416
161651
|
}
|
|
161417
|
-
function
|
|
161652
|
+
function doChange39(sourceFile, changes, declaration, typeNode) {
|
|
161418
161653
|
const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile);
|
|
161419
161654
|
const needParens = isArrowFunction(declaration) && closeParen === void 0;
|
|
161420
161655
|
const endNode2 = needParens ? first(declaration.parameters) : closeParen;
|
|
@@ -169281,7 +169516,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169281
169516
|
nodeToDisplayParts: () => nodeToDisplayParts,
|
|
169282
169517
|
noop: () => noop,
|
|
169283
169518
|
noopFileWatcher: () => noopFileWatcher,
|
|
169284
|
-
noopPush: () => noopPush,
|
|
169285
169519
|
normalizePath: () => normalizePath,
|
|
169286
169520
|
normalizeSlashes: () => normalizeSlashes,
|
|
169287
169521
|
not: () => not,
|