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/tsserverlibrary.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);
|
|
@@ -131635,6 +131668,10 @@ ${lanes.join("\n")}
|
|
|
131635
131668
|
diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
|
|
131636
131669
|
}
|
|
131637
131670
|
}
|
|
131671
|
+
const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node);
|
|
131672
|
+
if (jsdocTypedefNode) {
|
|
131673
|
+
diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
|
|
131674
|
+
}
|
|
131638
131675
|
if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
|
|
131639
131676
|
diags.push(createDiagnosticForNode(node.name || node, Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types));
|
|
131640
131677
|
}
|
|
@@ -133450,18 +133487,6 @@ ${lanes.join("\n")}
|
|
|
133450
133487
|
synchronizeHostData();
|
|
133451
133488
|
return ts_FindAllReferences_exports.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position);
|
|
133452
133489
|
}
|
|
133453
|
-
function getOccurrencesAtPosition(fileName, position) {
|
|
133454
|
-
return flatMap(
|
|
133455
|
-
getDocumentHighlights(fileName, position, [fileName]),
|
|
133456
|
-
(entry) => entry.highlightSpans.map((highlightSpan) => ({
|
|
133457
|
-
fileName: entry.fileName,
|
|
133458
|
-
textSpan: highlightSpan.textSpan,
|
|
133459
|
-
isWriteAccess: highlightSpan.kind === "writtenReference" /* writtenReference */,
|
|
133460
|
-
...highlightSpan.isInString && { isInString: true },
|
|
133461
|
-
...highlightSpan.contextSpan && { contextSpan: highlightSpan.contextSpan }
|
|
133462
|
-
}))
|
|
133463
|
-
);
|
|
133464
|
-
}
|
|
133465
133490
|
function getDocumentHighlights(fileName, position, filesToSearch) {
|
|
133466
133491
|
const normalizedFileName = normalizePath(fileName);
|
|
133467
133492
|
Debug.assert(filesToSearch.some((f) => normalizePath(f) === normalizedFileName));
|
|
@@ -133654,22 +133679,22 @@ ${lanes.join("\n")}
|
|
|
133654
133679
|
}
|
|
133655
133680
|
return [];
|
|
133656
133681
|
}
|
|
133657
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
133682
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes64, formatOptions, preferences = emptyOptions) {
|
|
133658
133683
|
synchronizeHostData();
|
|
133659
133684
|
const sourceFile = getValidSourceFile(fileName);
|
|
133660
133685
|
const span = createTextSpanFromBounds(start, end);
|
|
133661
133686
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133662
|
-
return flatMap(deduplicate(
|
|
133687
|
+
return flatMap(deduplicate(errorCodes64, equateValues, compareValues), (errorCode) => {
|
|
133663
133688
|
cancellationToken.throwIfCancellationRequested();
|
|
133664
133689
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
133665
133690
|
});
|
|
133666
133691
|
}
|
|
133667
|
-
function getCombinedCodeFix(scope,
|
|
133692
|
+
function getCombinedCodeFix(scope, fixId52, formatOptions, preferences = emptyOptions) {
|
|
133668
133693
|
synchronizeHostData();
|
|
133669
133694
|
Debug.assert(scope.type === "file");
|
|
133670
133695
|
const sourceFile = getValidSourceFile(scope.fileName);
|
|
133671
133696
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133672
|
-
return ts_codefix_exports.getAllFixes({ fixId:
|
|
133697
|
+
return ts_codefix_exports.getAllFixes({ fixId: fixId52, sourceFile, program, host, cancellationToken, formatContext, preferences });
|
|
133673
133698
|
}
|
|
133674
133699
|
function organizeImports2(args, formatOptions, preferences = emptyOptions) {
|
|
133675
133700
|
var _a3;
|
|
@@ -134091,7 +134116,6 @@ ${lanes.join("\n")}
|
|
|
134091
134116
|
getReferencesAtPosition,
|
|
134092
134117
|
findReferences,
|
|
134093
134118
|
getFileReferences,
|
|
134094
|
-
getOccurrencesAtPosition,
|
|
134095
134119
|
getDocumentHighlights,
|
|
134096
134120
|
getNameOrDottedNameSpan,
|
|
134097
134121
|
getBreakpointStatementAtPosition,
|
|
@@ -134917,7 +134941,6 @@ ${lanes.join("\n")}
|
|
|
134917
134941
|
"getTypeDefinitionAtPosition",
|
|
134918
134942
|
"getReferencesAtPosition",
|
|
134919
134943
|
"findReferences",
|
|
134920
|
-
"getOccurrencesAtPosition",
|
|
134921
134944
|
"getDocumentHighlights",
|
|
134922
134945
|
"getNavigateToItems",
|
|
134923
134946
|
"getRenameInfo",
|
|
@@ -135501,12 +135524,6 @@ ${lanes.join("\n")}
|
|
|
135501
135524
|
() => this.languageService.getFileReferences(fileName)
|
|
135502
135525
|
);
|
|
135503
135526
|
}
|
|
135504
|
-
getOccurrencesAtPosition(fileName, position) {
|
|
135505
|
-
return this.forwardJSONCall(
|
|
135506
|
-
`getOccurrencesAtPosition('${fileName}', ${position})`,
|
|
135507
|
-
() => this.languageService.getOccurrencesAtPosition(fileName, position)
|
|
135508
|
-
);
|
|
135509
|
-
}
|
|
135510
135527
|
getDocumentHighlights(fileName, position, filesToSearch) {
|
|
135511
135528
|
return this.forwardJSONCall(
|
|
135512
135529
|
`getDocumentHighlights('${fileName}', ${position})`,
|
|
@@ -137140,41 +137157,42 @@ ${lanes.join("\n")}
|
|
|
137140
137157
|
void 0
|
|
137141
137158
|
);
|
|
137142
137159
|
}
|
|
137143
|
-
function createCodeFixAction(fixName8, changes, description2,
|
|
137144
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137160
|
+
function createCodeFixAction(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137161
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, diagnosticToString(fixAllDescription), command);
|
|
137145
137162
|
}
|
|
137146
|
-
function createCodeFixActionMaybeFixAll(fixName8, changes, description2,
|
|
137147
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137163
|
+
function createCodeFixActionMaybeFixAll(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137164
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
137148
137165
|
}
|
|
137149
|
-
function createCodeFixActionWorker(fixName8, description2, changes,
|
|
137150
|
-
return { fixName: fixName8, description: description2, changes, fixId:
|
|
137166
|
+
function createCodeFixActionWorker(fixName8, description2, changes, fixId52, fixAllDescription, command) {
|
|
137167
|
+
return { fixName: fixName8, description: description2, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
137151
137168
|
}
|
|
137152
137169
|
function registerCodeFix(reg) {
|
|
137153
137170
|
for (const error of reg.errorCodes) {
|
|
137171
|
+
errorCodeToFixesArray = void 0;
|
|
137154
137172
|
errorCodeToFixes.add(String(error), reg);
|
|
137155
137173
|
}
|
|
137156
137174
|
if (reg.fixIds) {
|
|
137157
|
-
for (const
|
|
137158
|
-
Debug.assert(!fixIdToRegistration.has(
|
|
137159
|
-
fixIdToRegistration.set(
|
|
137175
|
+
for (const fixId52 of reg.fixIds) {
|
|
137176
|
+
Debug.assert(!fixIdToRegistration.has(fixId52));
|
|
137177
|
+
fixIdToRegistration.set(fixId52, reg);
|
|
137160
137178
|
}
|
|
137161
137179
|
}
|
|
137162
137180
|
}
|
|
137163
137181
|
function getSupportedErrorCodes() {
|
|
137164
|
-
return arrayFrom(errorCodeToFixes.keys());
|
|
137182
|
+
return errorCodeToFixesArray != null ? errorCodeToFixesArray : errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys());
|
|
137165
137183
|
}
|
|
137166
137184
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
137167
|
-
const { errorCodes:
|
|
137185
|
+
const { errorCodes: errorCodes64 } = registration;
|
|
137168
137186
|
let maybeFixableDiagnostics = 0;
|
|
137169
137187
|
for (const diag2 of diagnostics) {
|
|
137170
|
-
if (contains(
|
|
137188
|
+
if (contains(errorCodes64, diag2.code))
|
|
137171
137189
|
maybeFixableDiagnostics++;
|
|
137172
137190
|
if (maybeFixableDiagnostics > 1)
|
|
137173
137191
|
break;
|
|
137174
137192
|
}
|
|
137175
137193
|
const fixAllUnavailable = maybeFixableDiagnostics < 2;
|
|
137176
|
-
return ({ fixId:
|
|
137177
|
-
return fixAllUnavailable ? action : { ...action, fixId:
|
|
137194
|
+
return ({ fixId: fixId52, fixAllDescription, ...action }) => {
|
|
137195
|
+
return fixAllUnavailable ? action : { ...action, fixId: fixId52, fixAllDescription };
|
|
137178
137196
|
};
|
|
137179
137197
|
}
|
|
137180
137198
|
function getFixes(context) {
|
|
@@ -137191,14 +137209,14 @@ ${lanes.join("\n")}
|
|
|
137191
137209
|
function createFileTextChanges(fileName, textChanges2) {
|
|
137192
137210
|
return { fileName, textChanges: textChanges2 };
|
|
137193
137211
|
}
|
|
137194
|
-
function codeFixAll(context,
|
|
137212
|
+
function codeFixAll(context, errorCodes64, use) {
|
|
137195
137213
|
const commands = [];
|
|
137196
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
137214
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes64, (diag2) => use(t, diag2, commands)));
|
|
137197
137215
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
137198
137216
|
}
|
|
137199
|
-
function eachDiagnostic(context,
|
|
137217
|
+
function eachDiagnostic(context, errorCodes64, cb) {
|
|
137200
137218
|
for (const diag2 of getDiagnostics(context)) {
|
|
137201
|
-
if (contains(
|
|
137219
|
+
if (contains(errorCodes64, diag2.code)) {
|
|
137202
137220
|
cb(diag2);
|
|
137203
137221
|
}
|
|
137204
137222
|
}
|
|
@@ -137210,7 +137228,7 @@ ${lanes.join("\n")}
|
|
|
137210
137228
|
...computeSuggestionDiagnostics(sourceFile, program, cancellationToken)
|
|
137211
137229
|
];
|
|
137212
137230
|
}
|
|
137213
|
-
var errorCodeToFixes, fixIdToRegistration;
|
|
137231
|
+
var errorCodeToFixes, fixIdToRegistration, errorCodeToFixesArray;
|
|
137214
137232
|
var init_codeFixProvider = __esm({
|
|
137215
137233
|
"src/services/codeFixProvider.ts"() {
|
|
137216
137234
|
"use strict";
|
|
@@ -139780,32 +139798,96 @@ ${lanes.join("\n")}
|
|
|
139780
139798
|
});
|
|
139781
139799
|
|
|
139782
139800
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
139783
|
-
function
|
|
139784
|
-
|
|
139801
|
+
function getDeclaration2(sourceFile, pos) {
|
|
139802
|
+
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
139803
|
+
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
139785
139804
|
}
|
|
139786
|
-
function
|
|
139787
|
-
if (
|
|
139788
|
-
|
|
139789
|
-
|
|
139790
|
-
|
|
139791
|
-
|
|
139792
|
-
|
|
139793
|
-
|
|
139794
|
-
changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration(
|
|
139795
|
-
importDeclaration,
|
|
139796
|
-
/*modifiers*/
|
|
139797
|
-
void 0,
|
|
139798
|
-
factory.createImportClause(
|
|
139799
|
-
/*isTypeOnly*/
|
|
139800
|
-
true,
|
|
139801
|
-
importClause.name,
|
|
139802
|
-
/*namedBindings*/
|
|
139803
|
-
void 0
|
|
139804
|
-
),
|
|
139805
|
-
importDeclaration.moduleSpecifier,
|
|
139806
|
-
/*assertClause*/
|
|
139807
|
-
void 0
|
|
139805
|
+
function doChange4(changes, sourceFile, declaration) {
|
|
139806
|
+
if (isImportSpecifier(declaration)) {
|
|
139807
|
+
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
139808
|
+
declaration,
|
|
139809
|
+
/*isTypeOnly*/
|
|
139810
|
+
true,
|
|
139811
|
+
declaration.propertyName,
|
|
139812
|
+
declaration.name
|
|
139808
139813
|
));
|
|
139814
|
+
} else {
|
|
139815
|
+
const importClause = declaration.importClause;
|
|
139816
|
+
if (importClause.name && importClause.namedBindings) {
|
|
139817
|
+
changes.replaceNodeWithNodes(sourceFile, declaration, [
|
|
139818
|
+
factory.createImportDeclaration(
|
|
139819
|
+
getSynthesizedDeepClones(
|
|
139820
|
+
declaration.modifiers,
|
|
139821
|
+
/*includeTrivia*/
|
|
139822
|
+
true
|
|
139823
|
+
),
|
|
139824
|
+
factory.createImportClause(
|
|
139825
|
+
/*isTypeOnly*/
|
|
139826
|
+
true,
|
|
139827
|
+
getSynthesizedDeepClone(
|
|
139828
|
+
importClause.name,
|
|
139829
|
+
/*includeTrivia*/
|
|
139830
|
+
true
|
|
139831
|
+
),
|
|
139832
|
+
/*namedBindings*/
|
|
139833
|
+
void 0
|
|
139834
|
+
),
|
|
139835
|
+
getSynthesizedDeepClone(
|
|
139836
|
+
declaration.moduleSpecifier,
|
|
139837
|
+
/*includeTrivia*/
|
|
139838
|
+
true
|
|
139839
|
+
),
|
|
139840
|
+
getSynthesizedDeepClone(
|
|
139841
|
+
declaration.assertClause,
|
|
139842
|
+
/*includeTrivia*/
|
|
139843
|
+
true
|
|
139844
|
+
)
|
|
139845
|
+
),
|
|
139846
|
+
factory.createImportDeclaration(
|
|
139847
|
+
getSynthesizedDeepClones(
|
|
139848
|
+
declaration.modifiers,
|
|
139849
|
+
/*includeTrivia*/
|
|
139850
|
+
true
|
|
139851
|
+
),
|
|
139852
|
+
factory.createImportClause(
|
|
139853
|
+
/*isTypeOnly*/
|
|
139854
|
+
true,
|
|
139855
|
+
/*name*/
|
|
139856
|
+
void 0,
|
|
139857
|
+
getSynthesizedDeepClone(
|
|
139858
|
+
importClause.namedBindings,
|
|
139859
|
+
/*includeTrivia*/
|
|
139860
|
+
true
|
|
139861
|
+
)
|
|
139862
|
+
),
|
|
139863
|
+
getSynthesizedDeepClone(
|
|
139864
|
+
declaration.moduleSpecifier,
|
|
139865
|
+
/*includeTrivia*/
|
|
139866
|
+
true
|
|
139867
|
+
),
|
|
139868
|
+
getSynthesizedDeepClone(
|
|
139869
|
+
declaration.assertClause,
|
|
139870
|
+
/*includeTrivia*/
|
|
139871
|
+
true
|
|
139872
|
+
)
|
|
139873
|
+
)
|
|
139874
|
+
]);
|
|
139875
|
+
} else {
|
|
139876
|
+
const importDeclaration = factory.updateImportDeclaration(
|
|
139877
|
+
declaration,
|
|
139878
|
+
declaration.modifiers,
|
|
139879
|
+
factory.updateImportClause(
|
|
139880
|
+
importClause,
|
|
139881
|
+
/*isTypeOnly*/
|
|
139882
|
+
true,
|
|
139883
|
+
importClause.name,
|
|
139884
|
+
importClause.namedBindings
|
|
139885
|
+
),
|
|
139886
|
+
declaration.moduleSpecifier,
|
|
139887
|
+
declaration.assertClause
|
|
139888
|
+
);
|
|
139889
|
+
changes.replaceNode(sourceFile, declaration, importDeclaration);
|
|
139890
|
+
}
|
|
139809
139891
|
}
|
|
139810
139892
|
}
|
|
139811
139893
|
var errorCodes14, fixId13;
|
|
@@ -139814,30 +139896,181 @@ ${lanes.join("\n")}
|
|
|
139814
139896
|
"use strict";
|
|
139815
139897
|
init_ts4();
|
|
139816
139898
|
init_ts_codefix();
|
|
139817
|
-
errorCodes14 = [
|
|
139899
|
+
errorCodes14 = [
|
|
139900
|
+
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
139901
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
139902
|
+
];
|
|
139818
139903
|
fixId13 = "convertToTypeOnlyImport";
|
|
139819
139904
|
registerCodeFix({
|
|
139820
139905
|
errorCodes: errorCodes14,
|
|
139821
139906
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139822
|
-
const
|
|
139823
|
-
|
|
139824
|
-
|
|
139825
|
-
});
|
|
139826
|
-
if (changes.length) {
|
|
139907
|
+
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
139908
|
+
if (declaration) {
|
|
139909
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration));
|
|
139827
139910
|
return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
|
|
139828
139911
|
}
|
|
139912
|
+
return void 0;
|
|
139829
139913
|
},
|
|
139830
139914
|
fixIds: [fixId13],
|
|
139831
139915
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139832
139916
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
139833
|
-
const
|
|
139834
|
-
|
|
139917
|
+
const declaration = getDeclaration2(diag2.file, diag2.start);
|
|
139918
|
+
if (declaration) {
|
|
139919
|
+
doChange4(changes, diag2.file, declaration);
|
|
139920
|
+
}
|
|
139835
139921
|
});
|
|
139836
139922
|
}
|
|
139837
139923
|
});
|
|
139838
139924
|
}
|
|
139839
139925
|
});
|
|
139840
139926
|
|
|
139927
|
+
// src/services/codefixes/convertTypedefToType.ts
|
|
139928
|
+
function doChange5(changes, node, sourceFile) {
|
|
139929
|
+
if (isJSDocTypedefTag(node)) {
|
|
139930
|
+
fixSingleTypeDef(changes, node, sourceFile);
|
|
139931
|
+
}
|
|
139932
|
+
}
|
|
139933
|
+
function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
|
|
139934
|
+
if (!typeDefNode)
|
|
139935
|
+
return;
|
|
139936
|
+
const declaration = createDeclaration(typeDefNode);
|
|
139937
|
+
if (!declaration)
|
|
139938
|
+
return;
|
|
139939
|
+
const comment = typeDefNode.parent;
|
|
139940
|
+
changes.replaceNode(
|
|
139941
|
+
sourceFile,
|
|
139942
|
+
comment,
|
|
139943
|
+
declaration
|
|
139944
|
+
);
|
|
139945
|
+
}
|
|
139946
|
+
function createDeclaration(tag) {
|
|
139947
|
+
var _a2;
|
|
139948
|
+
const { typeExpression } = tag;
|
|
139949
|
+
if (!typeExpression)
|
|
139950
|
+
return;
|
|
139951
|
+
const typeName = (_a2 = tag.name) == null ? void 0 : _a2.getText();
|
|
139952
|
+
if (!typeName)
|
|
139953
|
+
return;
|
|
139954
|
+
if (typeExpression.kind === 325 /* JSDocTypeLiteral */) {
|
|
139955
|
+
return createInterfaceForTypeLiteral(typeName, typeExpression);
|
|
139956
|
+
}
|
|
139957
|
+
if (typeExpression.kind === 312 /* JSDocTypeExpression */) {
|
|
139958
|
+
return createTypeAliasForTypeExpression(typeName, typeExpression);
|
|
139959
|
+
}
|
|
139960
|
+
}
|
|
139961
|
+
function createInterfaceForTypeLiteral(typeName, typeLiteral) {
|
|
139962
|
+
const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
|
|
139963
|
+
if (!some(propertySignatures))
|
|
139964
|
+
return;
|
|
139965
|
+
const interfaceDeclaration = factory.createInterfaceDeclaration(
|
|
139966
|
+
/*modifiers*/
|
|
139967
|
+
void 0,
|
|
139968
|
+
typeName,
|
|
139969
|
+
/*typeParameters*/
|
|
139970
|
+
void 0,
|
|
139971
|
+
/*heritageClauses*/
|
|
139972
|
+
void 0,
|
|
139973
|
+
propertySignatures
|
|
139974
|
+
);
|
|
139975
|
+
return interfaceDeclaration;
|
|
139976
|
+
}
|
|
139977
|
+
function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
139978
|
+
const typeReference = getSynthesizedDeepClone(typeExpression.type);
|
|
139979
|
+
if (!typeReference)
|
|
139980
|
+
return;
|
|
139981
|
+
const declaration = factory.createTypeAliasDeclaration(
|
|
139982
|
+
/*modifiers*/
|
|
139983
|
+
void 0,
|
|
139984
|
+
factory.createIdentifier(typeName),
|
|
139985
|
+
/*typeParameters*/
|
|
139986
|
+
void 0,
|
|
139987
|
+
typeReference
|
|
139988
|
+
);
|
|
139989
|
+
return declaration;
|
|
139990
|
+
}
|
|
139991
|
+
function createSignatureFromTypeLiteral(typeLiteral) {
|
|
139992
|
+
const propertyTags = typeLiteral.jsDocPropertyTags;
|
|
139993
|
+
if (!some(propertyTags))
|
|
139994
|
+
return;
|
|
139995
|
+
const getSignature = (tag) => {
|
|
139996
|
+
var _a2;
|
|
139997
|
+
const name = getPropertyName(tag);
|
|
139998
|
+
const type = (_a2 = tag.typeExpression) == null ? void 0 : _a2.type;
|
|
139999
|
+
const isOptional = tag.isBracketed;
|
|
140000
|
+
let typeReference;
|
|
140001
|
+
if (type && isJSDocTypeLiteral(type)) {
|
|
140002
|
+
const signatures = createSignatureFromTypeLiteral(type);
|
|
140003
|
+
typeReference = factory.createTypeLiteralNode(signatures);
|
|
140004
|
+
} else if (type) {
|
|
140005
|
+
typeReference = getSynthesizedDeepClone(type);
|
|
140006
|
+
}
|
|
140007
|
+
if (typeReference && name) {
|
|
140008
|
+
const questionToken = isOptional ? factory.createToken(57 /* QuestionToken */) : void 0;
|
|
140009
|
+
const prop = factory.createPropertySignature(
|
|
140010
|
+
/*modifiers*/
|
|
140011
|
+
void 0,
|
|
140012
|
+
name,
|
|
140013
|
+
questionToken,
|
|
140014
|
+
typeReference
|
|
140015
|
+
);
|
|
140016
|
+
return prop;
|
|
140017
|
+
}
|
|
140018
|
+
};
|
|
140019
|
+
const props = mapDefined(propertyTags, getSignature);
|
|
140020
|
+
return props;
|
|
140021
|
+
}
|
|
140022
|
+
function getPropertyName(tag) {
|
|
140023
|
+
return tag.name.kind === 79 /* Identifier */ ? tag.name.text : tag.name.right.text;
|
|
140024
|
+
}
|
|
140025
|
+
function getJSDocTypedefNode(node) {
|
|
140026
|
+
if (hasJSDocNodes(node)) {
|
|
140027
|
+
return forEach(node.jsDoc, (node2) => {
|
|
140028
|
+
var _a2;
|
|
140029
|
+
return (_a2 = node2.tags) == null ? void 0 : _a2.find(isJSDocTypedefTag);
|
|
140030
|
+
});
|
|
140031
|
+
}
|
|
140032
|
+
return void 0;
|
|
140033
|
+
}
|
|
140034
|
+
var fixId14, errorCodes15;
|
|
140035
|
+
var init_convertTypedefToType = __esm({
|
|
140036
|
+
"src/services/codefixes/convertTypedefToType.ts"() {
|
|
140037
|
+
"use strict";
|
|
140038
|
+
init_ts4();
|
|
140039
|
+
init_ts_codefix();
|
|
140040
|
+
fixId14 = "convertTypedefToType";
|
|
140041
|
+
errorCodes15 = [Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type.code];
|
|
140042
|
+
registerCodeFix({
|
|
140043
|
+
fixIds: [fixId14],
|
|
140044
|
+
errorCodes: errorCodes15,
|
|
140045
|
+
getCodeActions(context) {
|
|
140046
|
+
const node = getTokenAtPosition(
|
|
140047
|
+
context.sourceFile,
|
|
140048
|
+
context.span.start
|
|
140049
|
+
);
|
|
140050
|
+
if (!node)
|
|
140051
|
+
return;
|
|
140052
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, node, context.sourceFile));
|
|
140053
|
+
if (changes.length > 0) {
|
|
140054
|
+
return [
|
|
140055
|
+
createCodeFixAction(
|
|
140056
|
+
fixId14,
|
|
140057
|
+
changes,
|
|
140058
|
+
Diagnostics.Convert_typedef_to_TypeScript_type,
|
|
140059
|
+
fixId14,
|
|
140060
|
+
Diagnostics.Convert_all_typedef_to_TypeScript_types
|
|
140061
|
+
)
|
|
140062
|
+
];
|
|
140063
|
+
}
|
|
140064
|
+
},
|
|
140065
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
|
|
140066
|
+
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
140067
|
+
if (node)
|
|
140068
|
+
doChange5(changes, node, diag2.file);
|
|
140069
|
+
})
|
|
140070
|
+
});
|
|
140071
|
+
}
|
|
140072
|
+
});
|
|
140073
|
+
|
|
139841
140074
|
// src/services/codefixes/convertLiteralTypeToMappedType.ts
|
|
139842
140075
|
function getInfo2(sourceFile, pos) {
|
|
139843
140076
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -139853,7 +140086,7 @@ ${lanes.join("\n")}
|
|
|
139853
140086
|
}
|
|
139854
140087
|
return void 0;
|
|
139855
140088
|
}
|
|
139856
|
-
function
|
|
140089
|
+
function doChange6(changes, sourceFile, { container, typeNode, constraint, name }) {
|
|
139857
140090
|
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
|
|
139858
140091
|
/*readonlyToken*/
|
|
139859
140092
|
void 0,
|
|
@@ -139872,16 +140105,16 @@ ${lanes.join("\n")}
|
|
|
139872
140105
|
void 0
|
|
139873
140106
|
));
|
|
139874
140107
|
}
|
|
139875
|
-
var
|
|
140108
|
+
var fixId15, errorCodes16;
|
|
139876
140109
|
var init_convertLiteralTypeToMappedType = __esm({
|
|
139877
140110
|
"src/services/codefixes/convertLiteralTypeToMappedType.ts"() {
|
|
139878
140111
|
"use strict";
|
|
139879
140112
|
init_ts4();
|
|
139880
140113
|
init_ts_codefix();
|
|
139881
|
-
|
|
139882
|
-
|
|
140114
|
+
fixId15 = "convertLiteralTypeToMappedType";
|
|
140115
|
+
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];
|
|
139883
140116
|
registerCodeFix({
|
|
139884
|
-
errorCodes:
|
|
140117
|
+
errorCodes: errorCodes16,
|
|
139885
140118
|
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
139886
140119
|
const { sourceFile, span } = context;
|
|
139887
140120
|
const info = getInfo2(sourceFile, span.start);
|
|
@@ -139889,14 +140122,14 @@ ${lanes.join("\n")}
|
|
|
139889
140122
|
return void 0;
|
|
139890
140123
|
}
|
|
139891
140124
|
const { name, constraint } = info;
|
|
139892
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
139893
|
-
return [createCodeFixAction(
|
|
140125
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, sourceFile, info));
|
|
140126
|
+
return [createCodeFixAction(fixId15, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId15, Diagnostics.Convert_all_type_literals_to_mapped_type)];
|
|
139894
140127
|
},
|
|
139895
|
-
fixIds: [
|
|
139896
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
140128
|
+
fixIds: [fixId15],
|
|
140129
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes16, (changes, diag2) => {
|
|
139897
140130
|
const info = getInfo2(diag2.file, diag2.start);
|
|
139898
140131
|
if (info) {
|
|
139899
|
-
|
|
140132
|
+
doChange6(changes, diag2.file, info);
|
|
139900
140133
|
}
|
|
139901
140134
|
})
|
|
139902
140135
|
});
|
|
@@ -139955,31 +140188,31 @@ ${lanes.join("\n")}
|
|
|
139955
140188
|
const heritageClauseTypeSymbols = checker.getPropertiesOfType(heritageClauseType);
|
|
139956
140189
|
return createSymbolTable(heritageClauseTypeSymbols.filter(symbolPointsToNonPrivateMember));
|
|
139957
140190
|
}
|
|
139958
|
-
var
|
|
140191
|
+
var errorCodes17, fixId16;
|
|
139959
140192
|
var init_fixClassIncorrectlyImplementsInterface = __esm({
|
|
139960
140193
|
"src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts"() {
|
|
139961
140194
|
"use strict";
|
|
139962
140195
|
init_ts4();
|
|
139963
140196
|
init_ts_codefix();
|
|
139964
|
-
|
|
140197
|
+
errorCodes17 = [
|
|
139965
140198
|
Diagnostics.Class_0_incorrectly_implements_interface_1.code,
|
|
139966
140199
|
Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code
|
|
139967
140200
|
];
|
|
139968
|
-
|
|
140201
|
+
fixId16 = "fixClassIncorrectlyImplementsInterface";
|
|
139969
140202
|
registerCodeFix({
|
|
139970
|
-
errorCodes:
|
|
140203
|
+
errorCodes: errorCodes17,
|
|
139971
140204
|
getCodeActions(context) {
|
|
139972
140205
|
const { sourceFile, span } = context;
|
|
139973
140206
|
const classDeclaration = getClass(sourceFile, span.start);
|
|
139974
140207
|
return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => {
|
|
139975
140208
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences));
|
|
139976
|
-
return changes.length === 0 ? void 0 : createCodeFixAction(
|
|
140209
|
+
return changes.length === 0 ? void 0 : createCodeFixAction(fixId16, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId16, Diagnostics.Implement_all_unimplemented_interfaces);
|
|
139977
140210
|
});
|
|
139978
140211
|
},
|
|
139979
|
-
fixIds: [
|
|
140212
|
+
fixIds: [fixId16],
|
|
139980
140213
|
getAllCodeActions(context) {
|
|
139981
140214
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
139982
|
-
return codeFixAll(context,
|
|
140215
|
+
return codeFixAll(context, errorCodes17, (changes, diag2) => {
|
|
139983
140216
|
const classDeclaration = getClass(diag2.file, diag2.start);
|
|
139984
140217
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
139985
140218
|
for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) {
|
|
@@ -141153,7 +141386,7 @@ ${lanes.join("\n")}
|
|
|
141153
141386
|
}
|
|
141154
141387
|
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
141155
141388
|
}
|
|
141156
|
-
var importFixName, importFixId,
|
|
141389
|
+
var importFixName, importFixId, errorCodes18;
|
|
141157
141390
|
var init_importFixes = __esm({
|
|
141158
141391
|
"src/services/codefixes/importFixes.ts"() {
|
|
141159
141392
|
"use strict";
|
|
@@ -141161,7 +141394,7 @@ ${lanes.join("\n")}
|
|
|
141161
141394
|
init_ts_codefix();
|
|
141162
141395
|
importFixName = "import";
|
|
141163
141396
|
importFixId = "fixMissingImport";
|
|
141164
|
-
|
|
141397
|
+
errorCodes18 = [
|
|
141165
141398
|
Diagnostics.Cannot_find_name_0.code,
|
|
141166
141399
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
141167
141400
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
@@ -141173,7 +141406,7 @@ ${lanes.join("\n")}
|
|
|
141173
141406
|
Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code
|
|
141174
141407
|
];
|
|
141175
141408
|
registerCodeFix({
|
|
141176
|
-
errorCodes:
|
|
141409
|
+
errorCodes: errorCodes18,
|
|
141177
141410
|
getCodeActions(context) {
|
|
141178
141411
|
const { errorCode, preferences, sourceFile, span, program } = context;
|
|
141179
141412
|
const info = getFixInfos(
|
|
@@ -141208,7 +141441,7 @@ ${lanes.join("\n")}
|
|
|
141208
141441
|
host,
|
|
141209
141442
|
cancellationToken
|
|
141210
141443
|
);
|
|
141211
|
-
eachDiagnostic(context,
|
|
141444
|
+
eachDiagnostic(context, errorCodes18, (diag2) => importAdder.addImportFromDiagnostic(diag2, context));
|
|
141212
141445
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
|
|
141213
141446
|
}
|
|
141214
141447
|
});
|
|
@@ -141283,14 +141516,14 @@ ${lanes.join("\n")}
|
|
|
141283
141516
|
const contextualType = isExpression(node) ? checker.getContextualType(node) : void 0;
|
|
141284
141517
|
return contextualType || checker.getTypeAtLocation(node);
|
|
141285
141518
|
}
|
|
141286
|
-
var
|
|
141519
|
+
var fixId17, errorCodes19;
|
|
141287
141520
|
var init_fixAddMissingConstraint = __esm({
|
|
141288
141521
|
"src/services/codefixes/fixAddMissingConstraint.ts"() {
|
|
141289
141522
|
"use strict";
|
|
141290
141523
|
init_ts4();
|
|
141291
141524
|
init_ts_codefix();
|
|
141292
|
-
|
|
141293
|
-
|
|
141525
|
+
fixId17 = "addMissingConstraint";
|
|
141526
|
+
errorCodes19 = [
|
|
141294
141527
|
// We want errors this could be attached to:
|
|
141295
141528
|
// Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
|
|
141296
141529
|
Diagnostics.Type_0_is_not_comparable_to_type_1.code,
|
|
@@ -141303,21 +141536,21 @@ ${lanes.join("\n")}
|
|
|
141303
141536
|
Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code
|
|
141304
141537
|
];
|
|
141305
141538
|
registerCodeFix({
|
|
141306
|
-
errorCodes:
|
|
141539
|
+
errorCodes: errorCodes19,
|
|
141307
141540
|
getCodeActions(context) {
|
|
141308
141541
|
const { sourceFile, span, program, preferences, host } = context;
|
|
141309
141542
|
const info = getInfo3(program, sourceFile, span);
|
|
141310
141543
|
if (info === void 0)
|
|
141311
141544
|
return;
|
|
141312
141545
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info));
|
|
141313
|
-
return [createCodeFixAction(
|
|
141546
|
+
return [createCodeFixAction(fixId17, changes, Diagnostics.Add_extends_constraint, fixId17, Diagnostics.Add_extends_constraint_to_all_type_parameters)];
|
|
141314
141547
|
},
|
|
141315
|
-
fixIds: [
|
|
141548
|
+
fixIds: [fixId17],
|
|
141316
141549
|
getAllCodeActions: (context) => {
|
|
141317
141550
|
const { program, preferences, host } = context;
|
|
141318
141551
|
const seen = /* @__PURE__ */ new Map();
|
|
141319
141552
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141320
|
-
eachDiagnostic(context,
|
|
141553
|
+
eachDiagnostic(context, errorCodes19, (diag2) => {
|
|
141321
141554
|
const info = getInfo3(program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
141322
141555
|
if (info) {
|
|
141323
141556
|
if (addToSeen(seen, getNodeId(info.declaration))) {
|
|
@@ -141399,7 +141632,7 @@ ${lanes.join("\n")}
|
|
|
141399
141632
|
Debug.assert(classElement && isClassElementLikeHasJSDoc(classElement));
|
|
141400
141633
|
return classElement;
|
|
141401
141634
|
}
|
|
141402
|
-
var fixName, fixAddOverrideId, fixRemoveOverrideId,
|
|
141635
|
+
var fixName, fixAddOverrideId, fixRemoveOverrideId, errorCodes20, errorCodeFixIdMap;
|
|
141403
141636
|
var init_fixOverrideModifier = __esm({
|
|
141404
141637
|
"src/services/codefixes/fixOverrideModifier.ts"() {
|
|
141405
141638
|
"use strict";
|
|
@@ -141408,7 +141641,7 @@ ${lanes.join("\n")}
|
|
|
141408
141641
|
fixName = "fixOverrideModifier";
|
|
141409
141642
|
fixAddOverrideId = "fixAddOverrideModifier";
|
|
141410
141643
|
fixRemoveOverrideId = "fixRemoveOverrideModifier";
|
|
141411
|
-
|
|
141644
|
+
errorCodes20 = [
|
|
141412
141645
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code,
|
|
141413
141646
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
|
|
141414
141647
|
Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,
|
|
@@ -141472,20 +141705,20 @@ ${lanes.join("\n")}
|
|
|
141472
141705
|
}
|
|
141473
141706
|
};
|
|
141474
141707
|
registerCodeFix({
|
|
141475
|
-
errorCodes:
|
|
141708
|
+
errorCodes: errorCodes20,
|
|
141476
141709
|
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
141477
141710
|
const { errorCode, span } = context;
|
|
141478
141711
|
const info = errorCodeFixIdMap[errorCode];
|
|
141479
141712
|
if (!info)
|
|
141480
141713
|
return emptyArray;
|
|
141481
|
-
const { descriptions, fixId:
|
|
141714
|
+
const { descriptions, fixId: fixId52, fixAllDescriptions } = info;
|
|
141482
141715
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
|
|
141483
141716
|
return [
|
|
141484
|
-
createCodeFixActionMaybeFixAll(fixName, changes, descriptions,
|
|
141717
|
+
createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId52, fixAllDescriptions)
|
|
141485
141718
|
];
|
|
141486
141719
|
},
|
|
141487
141720
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
141488
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141721
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => {
|
|
141489
141722
|
const { code, start } = diag2;
|
|
141490
141723
|
const info = errorCodeFixIdMap[code];
|
|
141491
141724
|
if (!info || info.fixId !== context.fixId) {
|
|
@@ -141498,7 +141731,7 @@ ${lanes.join("\n")}
|
|
|
141498
141731
|
});
|
|
141499
141732
|
|
|
141500
141733
|
// src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts
|
|
141501
|
-
function
|
|
141734
|
+
function doChange7(changes, sourceFile, node, preferences) {
|
|
141502
141735
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
141503
141736
|
const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */);
|
|
141504
141737
|
changes.replaceNode(
|
|
@@ -141510,32 +141743,32 @@ ${lanes.join("\n")}
|
|
|
141510
141743
|
function getPropertyAccessExpression(sourceFile, pos) {
|
|
141511
141744
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression);
|
|
141512
141745
|
}
|
|
141513
|
-
var
|
|
141746
|
+
var fixId18, errorCodes21;
|
|
141514
141747
|
var init_fixNoPropertyAccessFromIndexSignature = __esm({
|
|
141515
141748
|
"src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts"() {
|
|
141516
141749
|
"use strict";
|
|
141517
141750
|
init_ts4();
|
|
141518
141751
|
init_ts_codefix();
|
|
141519
|
-
|
|
141520
|
-
|
|
141752
|
+
fixId18 = "fixNoPropertyAccessFromIndexSignature";
|
|
141753
|
+
errorCodes21 = [
|
|
141521
141754
|
Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code
|
|
141522
141755
|
];
|
|
141523
141756
|
registerCodeFix({
|
|
141524
|
-
errorCodes:
|
|
141525
|
-
fixIds: [
|
|
141757
|
+
errorCodes: errorCodes21,
|
|
141758
|
+
fixIds: [fixId18],
|
|
141526
141759
|
getCodeActions(context) {
|
|
141527
141760
|
const { sourceFile, span, preferences } = context;
|
|
141528
141761
|
const property = getPropertyAccessExpression(sourceFile, span.start);
|
|
141529
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141530
|
-
return [createCodeFixAction(
|
|
141762
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, context.sourceFile, property, preferences));
|
|
141763
|
+
return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId18, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
141531
141764
|
},
|
|
141532
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141765
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => doChange7(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
141533
141766
|
});
|
|
141534
141767
|
}
|
|
141535
141768
|
});
|
|
141536
141769
|
|
|
141537
141770
|
// src/services/codefixes/fixImplicitThis.ts
|
|
141538
|
-
function
|
|
141771
|
+
function doChange8(changes, sourceFile, pos, checker) {
|
|
141539
141772
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141540
141773
|
if (!isThis(token))
|
|
141541
141774
|
return void 0;
|
|
@@ -141576,27 +141809,27 @@ ${lanes.join("\n")}
|
|
|
141576
141809
|
}
|
|
141577
141810
|
}
|
|
141578
141811
|
}
|
|
141579
|
-
var
|
|
141812
|
+
var fixId19, errorCodes22;
|
|
141580
141813
|
var init_fixImplicitThis = __esm({
|
|
141581
141814
|
"src/services/codefixes/fixImplicitThis.ts"() {
|
|
141582
141815
|
"use strict";
|
|
141583
141816
|
init_ts4();
|
|
141584
141817
|
init_ts_codefix();
|
|
141585
|
-
|
|
141586
|
-
|
|
141818
|
+
fixId19 = "fixImplicitThis";
|
|
141819
|
+
errorCodes22 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
141587
141820
|
registerCodeFix({
|
|
141588
|
-
errorCodes:
|
|
141821
|
+
errorCodes: errorCodes22,
|
|
141589
141822
|
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
141590
141823
|
const { sourceFile, program, span } = context;
|
|
141591
141824
|
let diagnostic;
|
|
141592
141825
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
141593
|
-
diagnostic =
|
|
141826
|
+
diagnostic = doChange8(t, sourceFile, span.start, program.getTypeChecker());
|
|
141594
141827
|
});
|
|
141595
|
-
return diagnostic ? [createCodeFixAction(
|
|
141828
|
+
return diagnostic ? [createCodeFixAction(fixId19, changes, diagnostic, fixId19, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
|
|
141596
141829
|
},
|
|
141597
|
-
fixIds: [
|
|
141598
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141599
|
-
|
|
141830
|
+
fixIds: [fixId19],
|
|
141831
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => {
|
|
141832
|
+
doChange8(changes, diag2.file, diag2.start, context.program.getTypeChecker());
|
|
141600
141833
|
})
|
|
141601
141834
|
});
|
|
141602
141835
|
}
|
|
@@ -141639,7 +141872,7 @@ ${lanes.join("\n")}
|
|
|
141639
141872
|
}
|
|
141640
141873
|
return void 0;
|
|
141641
141874
|
}
|
|
141642
|
-
function
|
|
141875
|
+
function doChange9(changes, program, { exportName, node, moduleSourceFile }) {
|
|
141643
141876
|
const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
|
|
141644
141877
|
if (exportDeclaration) {
|
|
141645
141878
|
updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
|
|
@@ -141721,32 +141954,32 @@ ${lanes.join("\n")}
|
|
|
141721
141954
|
const variableStatement = isVariableDeclaration(declaration) ? tryCast(declaration.parent.parent, isVariableStatement) : void 0;
|
|
141722
141955
|
return variableStatement && length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration;
|
|
141723
141956
|
}
|
|
141724
|
-
var
|
|
141957
|
+
var fixId20, errorCodes23;
|
|
141725
141958
|
var init_fixImportNonExportedMember = __esm({
|
|
141726
141959
|
"src/services/codefixes/fixImportNonExportedMember.ts"() {
|
|
141727
141960
|
"use strict";
|
|
141728
141961
|
init_ts4();
|
|
141729
141962
|
init_ts_codefix();
|
|
141730
|
-
|
|
141731
|
-
|
|
141963
|
+
fixId20 = "fixImportNonExportedMember";
|
|
141964
|
+
errorCodes23 = [
|
|
141732
141965
|
Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code
|
|
141733
141966
|
];
|
|
141734
141967
|
registerCodeFix({
|
|
141735
|
-
errorCodes:
|
|
141736
|
-
fixIds: [
|
|
141968
|
+
errorCodes: errorCodes23,
|
|
141969
|
+
fixIds: [fixId20],
|
|
141737
141970
|
getCodeActions(context) {
|
|
141738
141971
|
const { sourceFile, span, program } = context;
|
|
141739
141972
|
const info = getInfo4(sourceFile, span.start, program);
|
|
141740
141973
|
if (info === void 0)
|
|
141741
141974
|
return void 0;
|
|
141742
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141743
|
-
return [createCodeFixAction(
|
|
141975
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, program, info));
|
|
141976
|
+
return [createCodeFixAction(fixId20, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId20, Diagnostics.Export_all_referenced_locals)];
|
|
141744
141977
|
},
|
|
141745
141978
|
getAllCodeActions(context) {
|
|
141746
141979
|
const { program } = context;
|
|
141747
141980
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141748
141981
|
const exports = /* @__PURE__ */ new Map();
|
|
141749
|
-
eachDiagnostic(context,
|
|
141982
|
+
eachDiagnostic(context, errorCodes23, (diag2) => {
|
|
141750
141983
|
const info = getInfo4(diag2.file, diag2.start, program);
|
|
141751
141984
|
if (info === void 0)
|
|
141752
141985
|
return void 0;
|
|
@@ -141791,7 +142024,7 @@ ${lanes.join("\n")}
|
|
|
141791
142024
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141792
142025
|
return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */);
|
|
141793
142026
|
}
|
|
141794
|
-
function
|
|
142027
|
+
function doChange10(changes, sourceFile, namedTupleMember) {
|
|
141795
142028
|
if (!namedTupleMember) {
|
|
141796
142029
|
return;
|
|
141797
142030
|
}
|
|
@@ -141818,26 +142051,26 @@ ${lanes.join("\n")}
|
|
|
141818
142051
|
}
|
|
141819
142052
|
changes.replaceNode(sourceFile, namedTupleMember, updated);
|
|
141820
142053
|
}
|
|
141821
|
-
var
|
|
142054
|
+
var fixId21, errorCodes24;
|
|
141822
142055
|
var init_fixIncorrectNamedTupleSyntax = __esm({
|
|
141823
142056
|
"src/services/codefixes/fixIncorrectNamedTupleSyntax.ts"() {
|
|
141824
142057
|
"use strict";
|
|
141825
142058
|
init_ts4();
|
|
141826
142059
|
init_ts_codefix();
|
|
141827
|
-
|
|
141828
|
-
|
|
142060
|
+
fixId21 = "fixIncorrectNamedTupleSyntax";
|
|
142061
|
+
errorCodes24 = [
|
|
141829
142062
|
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,
|
|
141830
142063
|
Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code
|
|
141831
142064
|
];
|
|
141832
142065
|
registerCodeFix({
|
|
141833
|
-
errorCodes:
|
|
142066
|
+
errorCodes: errorCodes24,
|
|
141834
142067
|
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
141835
142068
|
const { sourceFile, span } = context;
|
|
141836
142069
|
const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
141837
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141838
|
-
return [createCodeFixAction(
|
|
142070
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, namedTupleMember));
|
|
142071
|
+
return [createCodeFixAction(fixId21, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId21, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
|
|
141839
142072
|
},
|
|
141840
|
-
fixIds: [
|
|
142073
|
+
fixIds: [fixId21]
|
|
141841
142074
|
});
|
|
141842
142075
|
}
|
|
141843
142076
|
});
|
|
@@ -141892,7 +142125,7 @@ ${lanes.join("\n")}
|
|
|
141892
142125
|
}
|
|
141893
142126
|
return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol };
|
|
141894
142127
|
}
|
|
141895
|
-
function
|
|
142128
|
+
function doChange11(changes, sourceFile, node, suggestedSymbol, target) {
|
|
141896
142129
|
const suggestion = symbolName(suggestedSymbol);
|
|
141897
142130
|
if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
|
|
141898
142131
|
const valDecl = suggestedSymbol.valueDeclaration;
|
|
@@ -141926,14 +142159,14 @@ ${lanes.join("\n")}
|
|
|
141926
142159
|
return void 0;
|
|
141927
142160
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
141928
142161
|
}
|
|
141929
|
-
var
|
|
142162
|
+
var fixId22, errorCodes25;
|
|
141930
142163
|
var init_fixSpelling = __esm({
|
|
141931
142164
|
"src/services/codefixes/fixSpelling.ts"() {
|
|
141932
142165
|
"use strict";
|
|
141933
142166
|
init_ts4();
|
|
141934
142167
|
init_ts_codefix();
|
|
141935
|
-
|
|
141936
|
-
|
|
142168
|
+
fixId22 = "fixSpelling";
|
|
142169
|
+
errorCodes25 = [
|
|
141937
142170
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141938
142171
|
Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141939
142172
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
@@ -141950,7 +142183,7 @@ ${lanes.join("\n")}
|
|
|
141950
142183
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code
|
|
141951
142184
|
];
|
|
141952
142185
|
registerCodeFix({
|
|
141953
|
-
errorCodes:
|
|
142186
|
+
errorCodes: errorCodes25,
|
|
141954
142187
|
getCodeActions(context) {
|
|
141955
142188
|
const { sourceFile, errorCode } = context;
|
|
141956
142189
|
const info = getInfo5(sourceFile, context.span.start, context, errorCode);
|
|
@@ -141958,15 +142191,15 @@ ${lanes.join("\n")}
|
|
|
141958
142191
|
return void 0;
|
|
141959
142192
|
const { node, suggestedSymbol } = info;
|
|
141960
142193
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141961
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141962
|
-
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)],
|
|
142194
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, node, suggestedSymbol, target));
|
|
142195
|
+
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId22, Diagnostics.Fix_all_detected_spelling_errors)];
|
|
141963
142196
|
},
|
|
141964
|
-
fixIds: [
|
|
141965
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142197
|
+
fixIds: [fixId22],
|
|
142198
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => {
|
|
141966
142199
|
const info = getInfo5(diag2.file, diag2.start, context, diag2.code);
|
|
141967
142200
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141968
142201
|
if (info)
|
|
141969
|
-
|
|
142202
|
+
doChange11(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
141970
142203
|
})
|
|
141971
142204
|
});
|
|
141972
142205
|
}
|
|
@@ -142150,7 +142383,7 @@ ${lanes.join("\n")}
|
|
|
142150
142383
|
}
|
|
142151
142384
|
function getActionForfixAddReturnStatement(context, expression, statement) {
|
|
142152
142385
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement));
|
|
142153
|
-
return createCodeFixAction(
|
|
142386
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement);
|
|
142154
142387
|
}
|
|
142155
142388
|
function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) {
|
|
142156
142389
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace(
|
|
@@ -142162,29 +142395,29 @@ ${lanes.join("\n")}
|
|
|
142162
142395
|
/* withParen */
|
|
142163
142396
|
false
|
|
142164
142397
|
));
|
|
142165
|
-
return createCodeFixAction(
|
|
142398
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues);
|
|
142166
142399
|
}
|
|
142167
142400
|
function getActionForfixWrapTheBlockWithParen(context, declaration, expression) {
|
|
142168
142401
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression));
|
|
142169
|
-
return createCodeFixAction(
|
|
142402
|
+
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);
|
|
142170
142403
|
}
|
|
142171
|
-
var
|
|
142404
|
+
var fixId23, fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen, errorCodes26;
|
|
142172
142405
|
var init_returnValueCorrect = __esm({
|
|
142173
142406
|
"src/services/codefixes/returnValueCorrect.ts"() {
|
|
142174
142407
|
"use strict";
|
|
142175
142408
|
init_ts4();
|
|
142176
142409
|
init_ts_codefix();
|
|
142177
|
-
|
|
142410
|
+
fixId23 = "returnValueCorrect";
|
|
142178
142411
|
fixIdAddReturnStatement = "fixAddReturnStatement";
|
|
142179
142412
|
fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody";
|
|
142180
142413
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142181
|
-
|
|
142414
|
+
errorCodes26 = [
|
|
142182
142415
|
Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
|
|
142183
142416
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142184
142417
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142185
142418
|
];
|
|
142186
142419
|
registerCodeFix({
|
|
142187
|
-
errorCodes:
|
|
142420
|
+
errorCodes: errorCodes26,
|
|
142188
142421
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
142189
142422
|
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
142190
142423
|
const { program, sourceFile, span: { start }, errorCode } = context;
|
|
@@ -142200,7 +142433,7 @@ ${lanes.join("\n")}
|
|
|
142200
142433
|
return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)];
|
|
142201
142434
|
}
|
|
142202
142435
|
},
|
|
142203
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142436
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => {
|
|
142204
142437
|
const info = getInfo6(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code);
|
|
142205
142438
|
if (!info)
|
|
142206
142439
|
return void 0;
|
|
@@ -142766,7 +142999,7 @@ ${lanes.join("\n")}
|
|
|
142766
142999
|
}
|
|
142767
143000
|
return getSourceFileOfNode(node);
|
|
142768
143001
|
}
|
|
142769
|
-
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration,
|
|
143002
|
+
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration, errorCodes27;
|
|
142770
143003
|
var init_fixAddMissingMember = __esm({
|
|
142771
143004
|
"src/services/codefixes/fixAddMissingMember.ts"() {
|
|
142772
143005
|
"use strict";
|
|
@@ -142776,7 +143009,7 @@ ${lanes.join("\n")}
|
|
|
142776
143009
|
fixMissingProperties = "fixMissingProperties";
|
|
142777
143010
|
fixMissingAttributes = "fixMissingAttributes";
|
|
142778
143011
|
fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration";
|
|
142779
|
-
|
|
143012
|
+
errorCodes27 = [
|
|
142780
143013
|
Diagnostics.Property_0_does_not_exist_on_type_1.code,
|
|
142781
143014
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
142782
143015
|
Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code,
|
|
@@ -142786,7 +143019,7 @@ ${lanes.join("\n")}
|
|
|
142786
143019
|
Diagnostics.Cannot_find_name_0.code
|
|
142787
143020
|
];
|
|
142788
143021
|
registerCodeFix({
|
|
142789
|
-
errorCodes:
|
|
143022
|
+
errorCodes: errorCodes27,
|
|
142790
143023
|
getCodeActions(context) {
|
|
142791
143024
|
const typeChecker = context.program.getTypeChecker();
|
|
142792
143025
|
const info = getInfo7(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program);
|
|
@@ -142813,21 +143046,21 @@ ${lanes.join("\n")}
|
|
|
142813
143046
|
},
|
|
142814
143047
|
fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
|
|
142815
143048
|
getAllCodeActions: (context) => {
|
|
142816
|
-
const { program, fixId:
|
|
143049
|
+
const { program, fixId: fixId52 } = context;
|
|
142817
143050
|
const checker = program.getTypeChecker();
|
|
142818
143051
|
const seen = /* @__PURE__ */ new Map();
|
|
142819
143052
|
const typeDeclToMembers = /* @__PURE__ */ new Map();
|
|
142820
143053
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
142821
|
-
eachDiagnostic(context,
|
|
143054
|
+
eachDiagnostic(context, errorCodes27, (diag2) => {
|
|
142822
143055
|
const info = getInfo7(diag2.file, diag2.start, diag2.code, checker, context.program);
|
|
142823
143056
|
if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
142824
143057
|
return;
|
|
142825
143058
|
}
|
|
142826
|
-
if (
|
|
143059
|
+
if (fixId52 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
|
142827
143060
|
addFunctionDeclaration(changes, context, info);
|
|
142828
|
-
} else if (
|
|
143061
|
+
} else if (fixId52 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
|
142829
143062
|
addObjectLiteralProperties(changes, context, info);
|
|
142830
|
-
} else if (
|
|
143063
|
+
} else if (fixId52 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
|
|
142831
143064
|
addJsxAttributes(changes, context, info);
|
|
142832
143065
|
} else {
|
|
142833
143066
|
if (info.kind === 1 /* Enum */) {
|
|
@@ -142883,23 +143116,23 @@ ${lanes.join("\n")}
|
|
|
142883
143116
|
}
|
|
142884
143117
|
return token;
|
|
142885
143118
|
}
|
|
142886
|
-
var
|
|
143119
|
+
var fixId24, errorCodes28;
|
|
142887
143120
|
var init_fixAddMissingNewOperator = __esm({
|
|
142888
143121
|
"src/services/codefixes/fixAddMissingNewOperator.ts"() {
|
|
142889
143122
|
"use strict";
|
|
142890
143123
|
init_ts4();
|
|
142891
143124
|
init_ts_codefix();
|
|
142892
|
-
|
|
142893
|
-
|
|
143125
|
+
fixId24 = "addMissingNewOperator";
|
|
143126
|
+
errorCodes28 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
|
142894
143127
|
registerCodeFix({
|
|
142895
|
-
errorCodes:
|
|
143128
|
+
errorCodes: errorCodes28,
|
|
142896
143129
|
getCodeActions(context) {
|
|
142897
143130
|
const { sourceFile, span } = context;
|
|
142898
143131
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span));
|
|
142899
|
-
return [createCodeFixAction(
|
|
143132
|
+
return [createCodeFixAction(fixId24, changes, Diagnostics.Add_missing_new_operator_to_call, fixId24, Diagnostics.Add_missing_new_operator_to_all_calls)];
|
|
142900
143133
|
},
|
|
142901
|
-
fixIds: [
|
|
142902
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143134
|
+
fixIds: [fixId24],
|
|
143135
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes28, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2))
|
|
142903
143136
|
});
|
|
142904
143137
|
}
|
|
142905
143138
|
});
|
|
@@ -142920,7 +143153,7 @@ ${lanes.join("\n")}
|
|
|
142920
143153
|
var _a2;
|
|
142921
143154
|
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;
|
|
142922
143155
|
}
|
|
142923
|
-
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule,
|
|
143156
|
+
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes29;
|
|
142924
143157
|
var init_fixCannotFindModule = __esm({
|
|
142925
143158
|
"src/services/codefixes/fixCannotFindModule.ts"() {
|
|
142926
143159
|
"use strict";
|
|
@@ -142929,12 +143162,12 @@ ${lanes.join("\n")}
|
|
|
142929
143162
|
fixName2 = "fixCannotFindModule";
|
|
142930
143163
|
fixIdInstallTypesPackage = "installTypesPackage";
|
|
142931
143164
|
errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
142932
|
-
|
|
143165
|
+
errorCodes29 = [
|
|
142933
143166
|
errorCodeCannotFindModule,
|
|
142934
143167
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
142935
143168
|
];
|
|
142936
143169
|
registerCodeFix({
|
|
142937
|
-
errorCodes:
|
|
143170
|
+
errorCodes: errorCodes29,
|
|
142938
143171
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
142939
143172
|
const { host, sourceFile, span: { start } } = context;
|
|
142940
143173
|
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
@@ -142953,7 +143186,7 @@ ${lanes.join("\n")}
|
|
|
142953
143186
|
},
|
|
142954
143187
|
fixIds: [fixIdInstallTypesPackage],
|
|
142955
143188
|
getAllCodeActions: (context) => {
|
|
142956
|
-
return codeFixAll(context,
|
|
143189
|
+
return codeFixAll(context, errorCodes29, (_changes, diag2, commands) => {
|
|
142957
143190
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
142958
143191
|
if (packageName === void 0)
|
|
142959
143192
|
return void 0;
|
|
@@ -142992,28 +143225,28 @@ ${lanes.join("\n")}
|
|
|
142992
143225
|
const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()));
|
|
142993
143226
|
return !(flags & 8 /* Private */) && !!(flags & 256 /* Abstract */);
|
|
142994
143227
|
}
|
|
142995
|
-
var
|
|
143228
|
+
var errorCodes30, fixId25;
|
|
142996
143229
|
var init_fixClassDoesntImplementInheritedAbstractMember = __esm({
|
|
142997
143230
|
"src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"() {
|
|
142998
143231
|
"use strict";
|
|
142999
143232
|
init_ts4();
|
|
143000
143233
|
init_ts_codefix();
|
|
143001
|
-
|
|
143234
|
+
errorCodes30 = [
|
|
143002
143235
|
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
143003
143236
|
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code
|
|
143004
143237
|
];
|
|
143005
|
-
|
|
143238
|
+
fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
143006
143239
|
registerCodeFix({
|
|
143007
|
-
errorCodes:
|
|
143240
|
+
errorCodes: errorCodes30,
|
|
143008
143241
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
143009
143242
|
const { sourceFile, span } = context;
|
|
143010
143243
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
|
|
143011
|
-
return changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
143244
|
+
return changes.length === 0 ? void 0 : [createCodeFixAction(fixId25, changes, Diagnostics.Implement_inherited_abstract_class, fixId25, Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
143012
143245
|
},
|
|
143013
|
-
fixIds: [
|
|
143246
|
+
fixIds: [fixId25],
|
|
143014
143247
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
143015
143248
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
143016
|
-
return codeFixAll(context,
|
|
143249
|
+
return codeFixAll(context, errorCodes30, (changes, diag2) => {
|
|
143017
143250
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
143018
143251
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
143019
143252
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -143025,7 +143258,7 @@ ${lanes.join("\n")}
|
|
|
143025
143258
|
});
|
|
143026
143259
|
|
|
143027
143260
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
143028
|
-
function
|
|
143261
|
+
function doChange12(changes, sourceFile, constructor, superCall) {
|
|
143029
143262
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
143030
143263
|
changes.delete(sourceFile, superCall);
|
|
143031
143264
|
}
|
|
@@ -143040,36 +143273,36 @@ ${lanes.join("\n")}
|
|
|
143040
143273
|
function findSuperCall(n) {
|
|
143041
143274
|
return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild(n, findSuperCall);
|
|
143042
143275
|
}
|
|
143043
|
-
var
|
|
143276
|
+
var fixId26, errorCodes31;
|
|
143044
143277
|
var init_fixClassSuperMustPrecedeThisAccess = __esm({
|
|
143045
143278
|
"src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts"() {
|
|
143046
143279
|
"use strict";
|
|
143047
143280
|
init_ts4();
|
|
143048
143281
|
init_ts_codefix();
|
|
143049
|
-
|
|
143050
|
-
|
|
143282
|
+
fixId26 = "classSuperMustPrecedeThisAccess";
|
|
143283
|
+
errorCodes31 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
143051
143284
|
registerCodeFix({
|
|
143052
|
-
errorCodes:
|
|
143285
|
+
errorCodes: errorCodes31,
|
|
143053
143286
|
getCodeActions(context) {
|
|
143054
143287
|
const { sourceFile, span } = context;
|
|
143055
143288
|
const nodes = getNodes(sourceFile, span.start);
|
|
143056
143289
|
if (!nodes)
|
|
143057
143290
|
return void 0;
|
|
143058
143291
|
const { constructor, superCall } = nodes;
|
|
143059
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143060
|
-
return [createCodeFixAction(
|
|
143292
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, constructor, superCall));
|
|
143293
|
+
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)];
|
|
143061
143294
|
},
|
|
143062
|
-
fixIds: [
|
|
143295
|
+
fixIds: [fixId26],
|
|
143063
143296
|
getAllCodeActions(context) {
|
|
143064
143297
|
const { sourceFile } = context;
|
|
143065
143298
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
143066
|
-
return codeFixAll(context,
|
|
143299
|
+
return codeFixAll(context, errorCodes31, (changes, diag2) => {
|
|
143067
143300
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
143068
143301
|
if (!nodes)
|
|
143069
143302
|
return;
|
|
143070
143303
|
const { constructor, superCall } = nodes;
|
|
143071
143304
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
143072
|
-
|
|
143305
|
+
doChange12(changes, sourceFile, constructor, superCall);
|
|
143073
143306
|
}
|
|
143074
143307
|
});
|
|
143075
143308
|
}
|
|
@@ -143083,7 +143316,7 @@ ${lanes.join("\n")}
|
|
|
143083
143316
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
143084
143317
|
return token.parent;
|
|
143085
143318
|
}
|
|
143086
|
-
function
|
|
143319
|
+
function doChange13(changes, sourceFile, ctr) {
|
|
143087
143320
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
143088
143321
|
factory.createSuper(),
|
|
143089
143322
|
/*typeArguments*/
|
|
@@ -143093,42 +143326,42 @@ ${lanes.join("\n")}
|
|
|
143093
143326
|
));
|
|
143094
143327
|
changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall);
|
|
143095
143328
|
}
|
|
143096
|
-
var
|
|
143329
|
+
var fixId27, errorCodes32;
|
|
143097
143330
|
var init_fixConstructorForDerivedNeedSuperCall = __esm({
|
|
143098
143331
|
"src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts"() {
|
|
143099
143332
|
"use strict";
|
|
143100
143333
|
init_ts4();
|
|
143101
143334
|
init_ts_codefix();
|
|
143102
|
-
|
|
143103
|
-
|
|
143335
|
+
fixId27 = "constructorForDerivedNeedSuperCall";
|
|
143336
|
+
errorCodes32 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
143104
143337
|
registerCodeFix({
|
|
143105
|
-
errorCodes:
|
|
143338
|
+
errorCodes: errorCodes32,
|
|
143106
143339
|
getCodeActions(context) {
|
|
143107
143340
|
const { sourceFile, span } = context;
|
|
143108
143341
|
const ctr = getNode(sourceFile, span.start);
|
|
143109
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143110
|
-
return [createCodeFixAction(
|
|
143342
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, ctr));
|
|
143343
|
+
return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
|
|
143111
143344
|
},
|
|
143112
|
-
fixIds: [
|
|
143113
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143345
|
+
fixIds: [fixId27],
|
|
143346
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes, diag2) => doChange13(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
143114
143347
|
});
|
|
143115
143348
|
}
|
|
143116
143349
|
});
|
|
143117
143350
|
|
|
143118
143351
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
143119
|
-
function
|
|
143352
|
+
function doChange14(changeTracker, configFile) {
|
|
143120
143353
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
143121
143354
|
}
|
|
143122
|
-
var fixID,
|
|
143355
|
+
var fixID, errorCodes33;
|
|
143123
143356
|
var init_fixEnableJsxFlag = __esm({
|
|
143124
143357
|
"src/services/codefixes/fixEnableJsxFlag.ts"() {
|
|
143125
143358
|
"use strict";
|
|
143126
143359
|
init_ts4();
|
|
143127
143360
|
init_ts_codefix();
|
|
143128
143361
|
fixID = "fixEnableJsxFlag";
|
|
143129
|
-
|
|
143362
|
+
errorCodes33 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
143130
143363
|
registerCodeFix({
|
|
143131
|
-
errorCodes:
|
|
143364
|
+
errorCodes: errorCodes33,
|
|
143132
143365
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
143133
143366
|
const { configFile } = context.program.getCompilerOptions();
|
|
143134
143367
|
if (configFile === void 0) {
|
|
@@ -143136,19 +143369,19 @@ ${lanes.join("\n")}
|
|
|
143136
143369
|
}
|
|
143137
143370
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
143138
143371
|
context,
|
|
143139
|
-
(changeTracker) =>
|
|
143372
|
+
(changeTracker) => doChange14(changeTracker, configFile)
|
|
143140
143373
|
);
|
|
143141
143374
|
return [
|
|
143142
143375
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
143143
143376
|
];
|
|
143144
143377
|
},
|
|
143145
143378
|
fixIds: [fixID],
|
|
143146
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143379
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes) => {
|
|
143147
143380
|
const { configFile } = context.program.getCompilerOptions();
|
|
143148
143381
|
if (configFile === void 0) {
|
|
143149
143382
|
return void 0;
|
|
143150
143383
|
}
|
|
143151
|
-
|
|
143384
|
+
doChange14(changes, configFile);
|
|
143152
143385
|
})
|
|
143153
143386
|
});
|
|
143154
143387
|
}
|
|
@@ -143170,7 +143403,7 @@ ${lanes.join("\n")}
|
|
|
143170
143403
|
}
|
|
143171
143404
|
return void 0;
|
|
143172
143405
|
}
|
|
143173
|
-
function
|
|
143406
|
+
function doChange15(changes, sourceFile, arg, expression) {
|
|
143174
143407
|
const callExpression = factory.createCallExpression(
|
|
143175
143408
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
143176
143409
|
/*typeArguments*/
|
|
@@ -143188,33 +143421,33 @@ ${lanes.join("\n")}
|
|
|
143188
143421
|
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [];
|
|
143189
143422
|
return suggestion;
|
|
143190
143423
|
}
|
|
143191
|
-
var
|
|
143424
|
+
var fixId28, errorCodes34;
|
|
143192
143425
|
var init_fixNaNEquality = __esm({
|
|
143193
143426
|
"src/services/codefixes/fixNaNEquality.ts"() {
|
|
143194
143427
|
"use strict";
|
|
143195
143428
|
init_ts4();
|
|
143196
143429
|
init_ts_codefix();
|
|
143197
|
-
|
|
143198
|
-
|
|
143430
|
+
fixId28 = "fixNaNEquality";
|
|
143431
|
+
errorCodes34 = [
|
|
143199
143432
|
Diagnostics.This_condition_will_always_return_0.code
|
|
143200
143433
|
];
|
|
143201
143434
|
registerCodeFix({
|
|
143202
|
-
errorCodes:
|
|
143435
|
+
errorCodes: errorCodes34,
|
|
143203
143436
|
getCodeActions(context) {
|
|
143204
143437
|
const { sourceFile, span, program } = context;
|
|
143205
143438
|
const info = getInfo8(program, sourceFile, span);
|
|
143206
143439
|
if (info === void 0)
|
|
143207
143440
|
return;
|
|
143208
143441
|
const { suggestion, expression, arg } = info;
|
|
143209
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143210
|
-
return [createCodeFixAction(
|
|
143442
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, arg, expression));
|
|
143443
|
+
return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
143211
143444
|
},
|
|
143212
|
-
fixIds: [
|
|
143445
|
+
fixIds: [fixId28],
|
|
143213
143446
|
getAllCodeActions: (context) => {
|
|
143214
|
-
return codeFixAll(context,
|
|
143447
|
+
return codeFixAll(context, errorCodes34, (changes, diag2) => {
|
|
143215
143448
|
const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
143216
143449
|
if (info) {
|
|
143217
|
-
|
|
143450
|
+
doChange15(changes, diag2.file, info.arg, info.expression);
|
|
143218
143451
|
}
|
|
143219
143452
|
});
|
|
143220
143453
|
}
|
|
@@ -143270,32 +143503,32 @@ ${lanes.join("\n")}
|
|
|
143270
143503
|
});
|
|
143271
143504
|
|
|
143272
143505
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
143273
|
-
function
|
|
143506
|
+
function doChange16(changes, sourceFile, node) {
|
|
143274
143507
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
143275
143508
|
}
|
|
143276
143509
|
function getProperty2(sourceFile, pos) {
|
|
143277
143510
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment);
|
|
143278
143511
|
}
|
|
143279
|
-
var
|
|
143512
|
+
var fixId29, errorCodes35;
|
|
143280
143513
|
var init_fixPropertyAssignment = __esm({
|
|
143281
143514
|
"src/services/codefixes/fixPropertyAssignment.ts"() {
|
|
143282
143515
|
"use strict";
|
|
143283
143516
|
init_ts4();
|
|
143284
143517
|
init_ts_codefix();
|
|
143285
|
-
|
|
143286
|
-
|
|
143518
|
+
fixId29 = "fixPropertyAssignment";
|
|
143519
|
+
errorCodes35 = [
|
|
143287
143520
|
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
|
|
143288
143521
|
];
|
|
143289
143522
|
registerCodeFix({
|
|
143290
|
-
errorCodes:
|
|
143291
|
-
fixIds: [
|
|
143523
|
+
errorCodes: errorCodes35,
|
|
143524
|
+
fixIds: [fixId29],
|
|
143292
143525
|
getCodeActions(context) {
|
|
143293
143526
|
const { sourceFile, span } = context;
|
|
143294
143527
|
const property = getProperty2(sourceFile, span.start);
|
|
143295
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143296
|
-
return [createCodeFixAction(
|
|
143528
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, context.sourceFile, property));
|
|
143529
|
+
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
143297
143530
|
},
|
|
143298
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143531
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => doChange16(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
143299
143532
|
});
|
|
143300
143533
|
}
|
|
143301
143534
|
});
|
|
@@ -143321,16 +143554,16 @@ ${lanes.join("\n")}
|
|
|
143321
143554
|
changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end });
|
|
143322
143555
|
}
|
|
143323
143556
|
}
|
|
143324
|
-
var
|
|
143557
|
+
var fixId30, errorCodes36;
|
|
143325
143558
|
var init_fixExtendsInterfaceBecomesImplements = __esm({
|
|
143326
143559
|
"src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts"() {
|
|
143327
143560
|
"use strict";
|
|
143328
143561
|
init_ts4();
|
|
143329
143562
|
init_ts_codefix();
|
|
143330
|
-
|
|
143331
|
-
|
|
143563
|
+
fixId30 = "extendsInterfaceBecomesImplements";
|
|
143564
|
+
errorCodes36 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
143332
143565
|
registerCodeFix({
|
|
143333
|
-
errorCodes:
|
|
143566
|
+
errorCodes: errorCodes36,
|
|
143334
143567
|
getCodeActions(context) {
|
|
143335
143568
|
const { sourceFile } = context;
|
|
143336
143569
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
@@ -143338,10 +143571,10 @@ ${lanes.join("\n")}
|
|
|
143338
143571
|
return void 0;
|
|
143339
143572
|
const { extendsToken, heritageClauses } = nodes;
|
|
143340
143573
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses));
|
|
143341
|
-
return [createCodeFixAction(
|
|
143574
|
+
return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
143342
143575
|
},
|
|
143343
|
-
fixIds: [
|
|
143344
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143576
|
+
fixIds: [fixId30],
|
|
143577
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
|
|
143345
143578
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
143346
143579
|
if (nodes)
|
|
143347
143580
|
doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
@@ -143357,39 +143590,39 @@ ${lanes.join("\n")}
|
|
|
143357
143590
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
143358
143591
|
}
|
|
143359
143592
|
}
|
|
143360
|
-
function
|
|
143593
|
+
function doChange17(changes, sourceFile, { node, className }) {
|
|
143361
143594
|
suppressLeadingAndTrailingTrivia(node);
|
|
143362
143595
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
143363
143596
|
}
|
|
143364
|
-
var
|
|
143597
|
+
var fixId31, didYouMeanStaticMemberCode, errorCodes37;
|
|
143365
143598
|
var init_fixForgottenThisPropertyAccess = __esm({
|
|
143366
143599
|
"src/services/codefixes/fixForgottenThisPropertyAccess.ts"() {
|
|
143367
143600
|
"use strict";
|
|
143368
143601
|
init_ts4();
|
|
143369
143602
|
init_ts_codefix();
|
|
143370
|
-
|
|
143603
|
+
fixId31 = "forgottenThisPropertyAccess";
|
|
143371
143604
|
didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
143372
|
-
|
|
143605
|
+
errorCodes37 = [
|
|
143373
143606
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
143374
143607
|
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,
|
|
143375
143608
|
didYouMeanStaticMemberCode
|
|
143376
143609
|
];
|
|
143377
143610
|
registerCodeFix({
|
|
143378
|
-
errorCodes:
|
|
143611
|
+
errorCodes: errorCodes37,
|
|
143379
143612
|
getCodeActions(context) {
|
|
143380
143613
|
const { sourceFile } = context;
|
|
143381
143614
|
const info = getInfo9(sourceFile, context.span.start, context.errorCode);
|
|
143382
143615
|
if (!info) {
|
|
143383
143616
|
return void 0;
|
|
143384
143617
|
}
|
|
143385
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143386
|
-
return [createCodeFixAction(
|
|
143618
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, info));
|
|
143619
|
+
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)];
|
|
143387
143620
|
},
|
|
143388
|
-
fixIds: [
|
|
143389
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143621
|
+
fixIds: [fixId31],
|
|
143622
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
|
|
143390
143623
|
const info = getInfo9(diag2.file, diag2.start, diag2.code);
|
|
143391
143624
|
if (info)
|
|
143392
|
-
|
|
143625
|
+
doChange17(changes, context.sourceFile, info);
|
|
143393
143626
|
})
|
|
143394
143627
|
});
|
|
143395
143628
|
}
|
|
@@ -143399,7 +143632,7 @@ ${lanes.join("\n")}
|
|
|
143399
143632
|
function isValidCharacter(character) {
|
|
143400
143633
|
return hasProperty(htmlEntity, character);
|
|
143401
143634
|
}
|
|
143402
|
-
function
|
|
143635
|
+
function doChange18(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
143403
143636
|
const character = sourceFile.getText()[start];
|
|
143404
143637
|
if (!isValidCharacter(character)) {
|
|
143405
143638
|
return;
|
|
@@ -143407,7 +143640,7 @@ ${lanes.join("\n")}
|
|
|
143407
143640
|
const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`;
|
|
143408
143641
|
changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement);
|
|
143409
143642
|
}
|
|
143410
|
-
var fixIdExpression, fixIdHtmlEntity,
|
|
143643
|
+
var fixIdExpression, fixIdHtmlEntity, errorCodes38, htmlEntity;
|
|
143411
143644
|
var init_fixInvalidJsxCharacters = __esm({
|
|
143412
143645
|
"src/services/codefixes/fixInvalidJsxCharacters.ts"() {
|
|
143413
143646
|
"use strict";
|
|
@@ -143415,16 +143648,16 @@ ${lanes.join("\n")}
|
|
|
143415
143648
|
init_ts_codefix();
|
|
143416
143649
|
fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
143417
143650
|
fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
143418
|
-
|
|
143651
|
+
errorCodes38 = [
|
|
143419
143652
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
143420
143653
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
143421
143654
|
];
|
|
143422
143655
|
registerCodeFix({
|
|
143423
|
-
errorCodes:
|
|
143656
|
+
errorCodes: errorCodes38,
|
|
143424
143657
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
143425
143658
|
getCodeActions(context) {
|
|
143426
143659
|
const { sourceFile, preferences, span } = context;
|
|
143427
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143660
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143428
143661
|
t,
|
|
143429
143662
|
preferences,
|
|
143430
143663
|
sourceFile,
|
|
@@ -143432,7 +143665,7 @@ ${lanes.join("\n")}
|
|
|
143432
143665
|
/* useHtmlEntity */
|
|
143433
143666
|
false
|
|
143434
143667
|
));
|
|
143435
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143668
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143436
143669
|
t,
|
|
143437
143670
|
preferences,
|
|
143438
143671
|
sourceFile,
|
|
@@ -143446,7 +143679,7 @@ ${lanes.join("\n")}
|
|
|
143446
143679
|
];
|
|
143447
143680
|
},
|
|
143448
143681
|
getAllCodeActions(context) {
|
|
143449
|
-
return codeFixAll(context,
|
|
143682
|
+
return codeFixAll(context, errorCodes38, (changes, diagnostic) => doChange18(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
143450
143683
|
}
|
|
143451
143684
|
});
|
|
143452
143685
|
htmlEntity = {
|
|
@@ -143505,7 +143738,7 @@ ${lanes.join("\n")}
|
|
|
143505
143738
|
}
|
|
143506
143739
|
return void 0;
|
|
143507
143740
|
}
|
|
143508
|
-
var deleteUnmatchedParameter, renameUnmatchedParameter,
|
|
143741
|
+
var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes39;
|
|
143509
143742
|
var init_fixUnmatchedParameter = __esm({
|
|
143510
143743
|
"src/services/codefixes/fixUnmatchedParameter.ts"() {
|
|
143511
143744
|
"use strict";
|
|
@@ -143513,12 +143746,12 @@ ${lanes.join("\n")}
|
|
|
143513
143746
|
init_ts_codefix();
|
|
143514
143747
|
deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
143515
143748
|
renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
143516
|
-
|
|
143749
|
+
errorCodes39 = [
|
|
143517
143750
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
143518
143751
|
];
|
|
143519
143752
|
registerCodeFix({
|
|
143520
143753
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
143521
|
-
errorCodes:
|
|
143754
|
+
errorCodes: errorCodes39,
|
|
143522
143755
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
143523
143756
|
const { sourceFile, span } = context;
|
|
143524
143757
|
const actions2 = [];
|
|
@@ -143533,7 +143766,7 @@ ${lanes.join("\n")}
|
|
|
143533
143766
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
143534
143767
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
143535
143768
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
143536
|
-
eachDiagnostic(context,
|
|
143769
|
+
eachDiagnostic(context, errorCodes39, ({ file, start }) => {
|
|
143537
143770
|
const info = getInfo10(file, start);
|
|
143538
143771
|
if (info) {
|
|
143539
143772
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
@@ -143582,16 +143815,16 @@ ${lanes.join("\n")}
|
|
|
143582
143815
|
function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
|
|
143583
143816
|
ts_refactor_exports.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
|
|
143584
143817
|
}
|
|
143585
|
-
var
|
|
143818
|
+
var fixId32, errorCodes40;
|
|
143586
143819
|
var init_fixUnreferenceableDecoratorMetadata = __esm({
|
|
143587
143820
|
"src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts"() {
|
|
143588
143821
|
"use strict";
|
|
143589
143822
|
init_ts4();
|
|
143590
143823
|
init_ts_codefix();
|
|
143591
|
-
|
|
143592
|
-
|
|
143824
|
+
fixId32 = "fixUnreferenceableDecoratorMetadata";
|
|
143825
|
+
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];
|
|
143593
143826
|
registerCodeFix({
|
|
143594
|
-
errorCodes:
|
|
143827
|
+
errorCodes: errorCodes40,
|
|
143595
143828
|
getCodeActions: (context) => {
|
|
143596
143829
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
143597
143830
|
if (!importDeclaration)
|
|
@@ -143600,14 +143833,14 @@ ${lanes.join("\n")}
|
|
|
143600
143833
|
const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program));
|
|
143601
143834
|
let actions2;
|
|
143602
143835
|
if (namespaceChanges.length) {
|
|
143603
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143836
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
143604
143837
|
}
|
|
143605
143838
|
if (typeOnlyChanges.length) {
|
|
143606
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143839
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
|
|
143607
143840
|
}
|
|
143608
143841
|
return actions2;
|
|
143609
143842
|
},
|
|
143610
|
-
fixIds: [
|
|
143843
|
+
fixIds: [fixId32]
|
|
143611
143844
|
});
|
|
143612
143845
|
}
|
|
143613
143846
|
});
|
|
@@ -143760,7 +143993,7 @@ ${lanes.join("\n")}
|
|
|
143760
143993
|
function mayDeleteExpression(node) {
|
|
143761
143994
|
return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent);
|
|
143762
143995
|
}
|
|
143763
|
-
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer,
|
|
143996
|
+
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes41;
|
|
143764
143997
|
var init_fixUnusedIdentifier = __esm({
|
|
143765
143998
|
"src/services/codefixes/fixUnusedIdentifier.ts"() {
|
|
143766
143999
|
"use strict";
|
|
@@ -143771,7 +144004,7 @@ ${lanes.join("\n")}
|
|
|
143771
144004
|
fixIdDelete = "unusedIdentifier_delete";
|
|
143772
144005
|
fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
143773
144006
|
fixIdInfer = "unusedIdentifier_infer";
|
|
143774
|
-
|
|
144007
|
+
errorCodes41 = [
|
|
143775
144008
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
143776
144009
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
143777
144010
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -143781,7 +144014,7 @@ ${lanes.join("\n")}
|
|
|
143781
144014
|
Diagnostics.All_type_parameters_are_unused.code
|
|
143782
144015
|
];
|
|
143783
144016
|
registerCodeFix({
|
|
143784
|
-
errorCodes:
|
|
144017
|
+
errorCodes: errorCodes41,
|
|
143785
144018
|
getCodeActions(context) {
|
|
143786
144019
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
143787
144020
|
const checker = program.getTypeChecker();
|
|
@@ -143867,7 +144100,7 @@ ${lanes.join("\n")}
|
|
|
143867
144100
|
const { sourceFile, program, cancellationToken } = context;
|
|
143868
144101
|
const checker = program.getTypeChecker();
|
|
143869
144102
|
const sourceFiles = program.getSourceFiles();
|
|
143870
|
-
return codeFixAll(context,
|
|
144103
|
+
return codeFixAll(context, errorCodes41, (changes, diag2) => {
|
|
143871
144104
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
143872
144105
|
switch (context.fixId) {
|
|
143873
144106
|
case fixIdPrefix:
|
|
@@ -143939,7 +144172,7 @@ ${lanes.join("\n")}
|
|
|
143939
144172
|
});
|
|
143940
144173
|
|
|
143941
144174
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
143942
|
-
function
|
|
144175
|
+
function doChange19(changes, sourceFile, start, length2, errorCode) {
|
|
143943
144176
|
const token = getTokenAtPosition(sourceFile, start);
|
|
143944
144177
|
const statement = findAncestor(token, isStatement);
|
|
143945
144178
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -143987,31 +144220,31 @@ ${lanes.join("\n")}
|
|
|
143987
144220
|
}
|
|
143988
144221
|
return last2;
|
|
143989
144222
|
}
|
|
143990
|
-
var
|
|
144223
|
+
var fixId33, errorCodes42;
|
|
143991
144224
|
var init_fixUnreachableCode = __esm({
|
|
143992
144225
|
"src/services/codefixes/fixUnreachableCode.ts"() {
|
|
143993
144226
|
"use strict";
|
|
143994
144227
|
init_ts4();
|
|
143995
144228
|
init_ts_codefix();
|
|
143996
|
-
|
|
143997
|
-
|
|
144229
|
+
fixId33 = "fixUnreachableCode";
|
|
144230
|
+
errorCodes42 = [Diagnostics.Unreachable_code_detected.code];
|
|
143998
144231
|
registerCodeFix({
|
|
143999
|
-
errorCodes:
|
|
144232
|
+
errorCodes: errorCodes42,
|
|
144000
144233
|
getCodeActions(context) {
|
|
144001
144234
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
144002
144235
|
if (syntacticDiagnostics.length)
|
|
144003
144236
|
return;
|
|
144004
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144005
|
-
return [createCodeFixAction(
|
|
144237
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
144238
|
+
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
|
|
144006
144239
|
},
|
|
144007
|
-
fixIds: [
|
|
144008
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144240
|
+
fixIds: [fixId33],
|
|
144241
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
144009
144242
|
});
|
|
144010
144243
|
}
|
|
144011
144244
|
});
|
|
144012
144245
|
|
|
144013
144246
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
144014
|
-
function
|
|
144247
|
+
function doChange20(changes, sourceFile, start) {
|
|
144015
144248
|
const token = getTokenAtPosition(sourceFile, start);
|
|
144016
144249
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
144017
144250
|
const pos = token.getStart(sourceFile);
|
|
@@ -144024,28 +144257,28 @@ ${lanes.join("\n")}
|
|
|
144024
144257
|
);
|
|
144025
144258
|
changes.deleteRange(sourceFile, { pos, end });
|
|
144026
144259
|
}
|
|
144027
|
-
var
|
|
144260
|
+
var fixId34, errorCodes43;
|
|
144028
144261
|
var init_fixUnusedLabel = __esm({
|
|
144029
144262
|
"src/services/codefixes/fixUnusedLabel.ts"() {
|
|
144030
144263
|
"use strict";
|
|
144031
144264
|
init_ts4();
|
|
144032
144265
|
init_ts_codefix();
|
|
144033
|
-
|
|
144034
|
-
|
|
144266
|
+
fixId34 = "fixUnusedLabel";
|
|
144267
|
+
errorCodes43 = [Diagnostics.Unused_label.code];
|
|
144035
144268
|
registerCodeFix({
|
|
144036
|
-
errorCodes:
|
|
144269
|
+
errorCodes: errorCodes43,
|
|
144037
144270
|
getCodeActions(context) {
|
|
144038
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144039
|
-
return [createCodeFixAction(
|
|
144271
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, context.span.start));
|
|
144272
|
+
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
|
|
144040
144273
|
},
|
|
144041
|
-
fixIds: [
|
|
144042
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144274
|
+
fixIds: [fixId34],
|
|
144275
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange20(changes, diag2.file, diag2.start))
|
|
144043
144276
|
});
|
|
144044
144277
|
}
|
|
144045
144278
|
});
|
|
144046
144279
|
|
|
144047
144280
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
144048
|
-
function
|
|
144281
|
+
function doChange21(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
144049
144282
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
144050
144283
|
newType,
|
|
144051
144284
|
/*enclosingDeclaration*/
|
|
@@ -144094,7 +144327,7 @@ ${lanes.join("\n")}
|
|
|
144094
144327
|
}
|
|
144095
144328
|
return checker.getTypeFromTypeNode(node);
|
|
144096
144329
|
}
|
|
144097
|
-
var fixIdPlain, fixIdNullable,
|
|
144330
|
+
var fixIdPlain, fixIdNullable, errorCodes44;
|
|
144098
144331
|
var init_fixJSDocTypes = __esm({
|
|
144099
144332
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
144100
144333
|
"use strict";
|
|
@@ -144102,13 +144335,13 @@ ${lanes.join("\n")}
|
|
|
144102
144335
|
init_ts_codefix();
|
|
144103
144336
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
144104
144337
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
144105
|
-
|
|
144338
|
+
errorCodes44 = [
|
|
144106
144339
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
144107
144340
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
144108
144341
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
144109
144342
|
];
|
|
144110
144343
|
registerCodeFix({
|
|
144111
|
-
errorCodes:
|
|
144344
|
+
errorCodes: errorCodes44,
|
|
144112
144345
|
getCodeActions(context) {
|
|
144113
144346
|
const { sourceFile } = context;
|
|
144114
144347
|
const checker = context.program.getTypeChecker();
|
|
@@ -144122,22 +144355,22 @@ ${lanes.join("\n")}
|
|
|
144122
144355
|
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
144123
144356
|
}
|
|
144124
144357
|
return actions2;
|
|
144125
|
-
function fix(type2,
|
|
144126
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144127
|
-
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)],
|
|
144358
|
+
function fix(type2, fixId52, fixAllDescription) {
|
|
144359
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, typeNode, type2, checker));
|
|
144360
|
+
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
|
|
144128
144361
|
}
|
|
144129
144362
|
},
|
|
144130
144363
|
fixIds: [fixIdPlain, fixIdNullable],
|
|
144131
144364
|
getAllCodeActions(context) {
|
|
144132
|
-
const { fixId:
|
|
144365
|
+
const { fixId: fixId52, program, sourceFile } = context;
|
|
144133
144366
|
const checker = program.getTypeChecker();
|
|
144134
|
-
return codeFixAll(context,
|
|
144367
|
+
return codeFixAll(context, errorCodes44, (changes, err) => {
|
|
144135
144368
|
const info = getInfo11(err.file, err.start, checker);
|
|
144136
144369
|
if (!info)
|
|
144137
144370
|
return;
|
|
144138
144371
|
const { typeNode, type } = info;
|
|
144139
|
-
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ &&
|
|
144140
|
-
|
|
144372
|
+
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
144373
|
+
doChange21(changes, sourceFile, typeNode, fixedType, checker);
|
|
144141
144374
|
});
|
|
144142
144375
|
}
|
|
144143
144376
|
});
|
|
@@ -144145,7 +144378,7 @@ ${lanes.join("\n")}
|
|
|
144145
144378
|
});
|
|
144146
144379
|
|
|
144147
144380
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
144148
|
-
function
|
|
144381
|
+
function doChange22(changes, sourceFile, name) {
|
|
144149
144382
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
144150
144383
|
}
|
|
144151
144384
|
function getCallName(sourceFile, start) {
|
|
@@ -144162,31 +144395,31 @@ ${lanes.join("\n")}
|
|
|
144162
144395
|
}
|
|
144163
144396
|
return void 0;
|
|
144164
144397
|
}
|
|
144165
|
-
var
|
|
144398
|
+
var fixId35, errorCodes45;
|
|
144166
144399
|
var init_fixMissingCallParentheses = __esm({
|
|
144167
144400
|
"src/services/codefixes/fixMissingCallParentheses.ts"() {
|
|
144168
144401
|
"use strict";
|
|
144169
144402
|
init_ts4();
|
|
144170
144403
|
init_ts_codefix();
|
|
144171
|
-
|
|
144172
|
-
|
|
144404
|
+
fixId35 = "fixMissingCallParentheses";
|
|
144405
|
+
errorCodes45 = [
|
|
144173
144406
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
144174
144407
|
];
|
|
144175
144408
|
registerCodeFix({
|
|
144176
|
-
errorCodes:
|
|
144177
|
-
fixIds: [
|
|
144409
|
+
errorCodes: errorCodes45,
|
|
144410
|
+
fixIds: [fixId35],
|
|
144178
144411
|
getCodeActions(context) {
|
|
144179
144412
|
const { sourceFile, span } = context;
|
|
144180
144413
|
const callName = getCallName(sourceFile, span.start);
|
|
144181
144414
|
if (!callName)
|
|
144182
144415
|
return;
|
|
144183
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144184
|
-
return [createCodeFixAction(
|
|
144416
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, context.sourceFile, callName));
|
|
144417
|
+
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
|
|
144185
144418
|
},
|
|
144186
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144419
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => {
|
|
144187
144420
|
const callName = getCallName(diag2.file, diag2.start);
|
|
144188
144421
|
if (callName)
|
|
144189
|
-
|
|
144422
|
+
doChange22(changes, diag2.file, callName);
|
|
144190
144423
|
})
|
|
144191
144424
|
});
|
|
144192
144425
|
}
|
|
@@ -144228,7 +144461,7 @@ ${lanes.join("\n")}
|
|
|
144228
144461
|
returnType: getReturnType(containingFunction)
|
|
144229
144462
|
};
|
|
144230
144463
|
}
|
|
144231
|
-
function
|
|
144464
|
+
function doChange23(changes, sourceFile, { insertBefore, returnType }) {
|
|
144232
144465
|
if (returnType) {
|
|
144233
144466
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
144234
144467
|
if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -144237,36 +144470,36 @@ ${lanes.join("\n")}
|
|
|
144237
144470
|
}
|
|
144238
144471
|
changes.insertModifierBefore(sourceFile, 132 /* AsyncKeyword */, insertBefore);
|
|
144239
144472
|
}
|
|
144240
|
-
var
|
|
144473
|
+
var fixId36, errorCodes46;
|
|
144241
144474
|
var init_fixAwaitInSyncFunction = __esm({
|
|
144242
144475
|
"src/services/codefixes/fixAwaitInSyncFunction.ts"() {
|
|
144243
144476
|
"use strict";
|
|
144244
144477
|
init_ts4();
|
|
144245
144478
|
init_ts_codefix();
|
|
144246
|
-
|
|
144247
|
-
|
|
144479
|
+
fixId36 = "fixAwaitInSyncFunction";
|
|
144480
|
+
errorCodes46 = [
|
|
144248
144481
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144249
144482
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144250
144483
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
144251
144484
|
];
|
|
144252
144485
|
registerCodeFix({
|
|
144253
|
-
errorCodes:
|
|
144486
|
+
errorCodes: errorCodes46,
|
|
144254
144487
|
getCodeActions(context) {
|
|
144255
144488
|
const { sourceFile, span } = context;
|
|
144256
144489
|
const nodes = getNodes3(sourceFile, span.start);
|
|
144257
144490
|
if (!nodes)
|
|
144258
144491
|
return void 0;
|
|
144259
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144260
|
-
return [createCodeFixAction(
|
|
144492
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, nodes));
|
|
144493
|
+
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
|
|
144261
144494
|
},
|
|
144262
|
-
fixIds: [
|
|
144495
|
+
fixIds: [fixId36],
|
|
144263
144496
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
144264
144497
|
const seen = /* @__PURE__ */ new Map();
|
|
144265
|
-
return codeFixAll(context,
|
|
144498
|
+
return codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
144266
144499
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
144267
144500
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
144268
144501
|
return;
|
|
144269
|
-
|
|
144502
|
+
doChange23(changes, context.sourceFile, nodes);
|
|
144270
144503
|
});
|
|
144271
144504
|
}
|
|
144272
144505
|
});
|
|
@@ -144274,7 +144507,7 @@ ${lanes.join("\n")}
|
|
|
144274
144507
|
});
|
|
144275
144508
|
|
|
144276
144509
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
144277
|
-
function
|
|
144510
|
+
function doChange24(file, start, length2, code, context) {
|
|
144278
144511
|
let startPosition;
|
|
144279
144512
|
let endPosition;
|
|
144280
144513
|
if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
|
|
@@ -144301,28 +144534,28 @@ ${lanes.join("\n")}
|
|
|
144301
144534
|
}
|
|
144302
144535
|
return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message);
|
|
144303
144536
|
}
|
|
144304
|
-
var
|
|
144537
|
+
var errorCodes47, fixId37;
|
|
144305
144538
|
var init_fixPropertyOverrideAccessor = __esm({
|
|
144306
144539
|
"src/services/codefixes/fixPropertyOverrideAccessor.ts"() {
|
|
144307
144540
|
"use strict";
|
|
144308
144541
|
init_ts4();
|
|
144309
144542
|
init_ts_codefix();
|
|
144310
|
-
|
|
144543
|
+
errorCodes47 = [
|
|
144311
144544
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
144312
144545
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
144313
144546
|
];
|
|
144314
|
-
|
|
144547
|
+
fixId37 = "fixPropertyOverrideAccessor";
|
|
144315
144548
|
registerCodeFix({
|
|
144316
|
-
errorCodes:
|
|
144549
|
+
errorCodes: errorCodes47,
|
|
144317
144550
|
getCodeActions(context) {
|
|
144318
|
-
const edits =
|
|
144551
|
+
const edits = doChange24(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
144319
144552
|
if (edits) {
|
|
144320
|
-
return [createCodeFixAction(
|
|
144553
|
+
return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
144321
144554
|
}
|
|
144322
144555
|
},
|
|
144323
|
-
fixIds: [
|
|
144324
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144325
|
-
const edits =
|
|
144556
|
+
fixIds: [fixId37],
|
|
144557
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
144558
|
+
const edits = doChange24(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
144326
144559
|
if (edits) {
|
|
144327
144560
|
for (const edit of edits) {
|
|
144328
144561
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -144369,7 +144602,7 @@ ${lanes.join("\n")}
|
|
|
144369
144602
|
}
|
|
144370
144603
|
return errorCode;
|
|
144371
144604
|
}
|
|
144372
|
-
function
|
|
144605
|
+
function doChange25(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
144373
144606
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) {
|
|
144374
144607
|
return void 0;
|
|
144375
144608
|
}
|
|
@@ -145263,14 +145496,14 @@ ${lanes.join("\n")}
|
|
|
145263
145496
|
}
|
|
145264
145497
|
}
|
|
145265
145498
|
}
|
|
145266
|
-
var
|
|
145499
|
+
var fixId38, errorCodes48;
|
|
145267
145500
|
var init_inferFromUsage = __esm({
|
|
145268
145501
|
"src/services/codefixes/inferFromUsage.ts"() {
|
|
145269
145502
|
"use strict";
|
|
145270
145503
|
init_ts4();
|
|
145271
145504
|
init_ts_codefix();
|
|
145272
|
-
|
|
145273
|
-
|
|
145505
|
+
fixId38 = "inferFromUsage";
|
|
145506
|
+
errorCodes48 = [
|
|
145274
145507
|
// Variable declarations
|
|
145275
145508
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
145276
145509
|
// Variable uses
|
|
@@ -145304,13 +145537,13 @@ ${lanes.join("\n")}
|
|
|
145304
145537
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
145305
145538
|
];
|
|
145306
145539
|
registerCodeFix({
|
|
145307
|
-
errorCodes:
|
|
145540
|
+
errorCodes: errorCodes48,
|
|
145308
145541
|
getCodeActions(context) {
|
|
145309
145542
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
145310
145543
|
const token = getTokenAtPosition(sourceFile, start);
|
|
145311
145544
|
let declaration;
|
|
145312
145545
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
145313
|
-
declaration =
|
|
145546
|
+
declaration = doChange25(
|
|
145314
145547
|
changes2,
|
|
145315
145548
|
sourceFile,
|
|
145316
145549
|
token,
|
|
@@ -145324,14 +145557,14 @@ ${lanes.join("\n")}
|
|
|
145324
145557
|
);
|
|
145325
145558
|
});
|
|
145326
145559
|
const name = declaration && getNameOfDeclaration(declaration);
|
|
145327
|
-
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
145560
|
+
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId38, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId38, Diagnostics.Infer_all_types_from_usage)];
|
|
145328
145561
|
},
|
|
145329
|
-
fixIds: [
|
|
145562
|
+
fixIds: [fixId38],
|
|
145330
145563
|
getAllCodeActions(context) {
|
|
145331
145564
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
145332
145565
|
const markSeen = nodeSeenTracker();
|
|
145333
|
-
return codeFixAll(context,
|
|
145334
|
-
|
|
145566
|
+
return codeFixAll(context, errorCodes48, (changes, err) => {
|
|
145567
|
+
doChange25(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
145335
145568
|
});
|
|
145336
145569
|
}
|
|
145337
145570
|
});
|
|
@@ -145362,22 +145595,22 @@ ${lanes.join("\n")}
|
|
|
145362
145595
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
145363
145596
|
}
|
|
145364
145597
|
}
|
|
145365
|
-
function
|
|
145598
|
+
function doChange26(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
145366
145599
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
145367
145600
|
}
|
|
145368
|
-
var
|
|
145601
|
+
var fixId39, errorCodes49;
|
|
145369
145602
|
var init_fixReturnTypeInAsyncFunction = __esm({
|
|
145370
145603
|
"src/services/codefixes/fixReturnTypeInAsyncFunction.ts"() {
|
|
145371
145604
|
"use strict";
|
|
145372
145605
|
init_ts4();
|
|
145373
145606
|
init_ts_codefix();
|
|
145374
|
-
|
|
145375
|
-
|
|
145607
|
+
fixId39 = "fixReturnTypeInAsyncFunction";
|
|
145608
|
+
errorCodes49 = [
|
|
145376
145609
|
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
|
|
145377
145610
|
];
|
|
145378
145611
|
registerCodeFix({
|
|
145379
|
-
errorCodes:
|
|
145380
|
-
fixIds: [
|
|
145612
|
+
errorCodes: errorCodes49,
|
|
145613
|
+
fixIds: [fixId39],
|
|
145381
145614
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
145382
145615
|
const { sourceFile, program, span } = context;
|
|
145383
145616
|
const checker = program.getTypeChecker();
|
|
@@ -145386,23 +145619,23 @@ ${lanes.join("\n")}
|
|
|
145386
145619
|
return void 0;
|
|
145387
145620
|
}
|
|
145388
145621
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
145389
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145622
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
145390
145623
|
return [createCodeFixAction(
|
|
145391
|
-
|
|
145624
|
+
fixId39,
|
|
145392
145625
|
changes,
|
|
145393
145626
|
[
|
|
145394
145627
|
Diagnostics.Replace_0_with_Promise_1,
|
|
145395
145628
|
checker.typeToString(returnType),
|
|
145396
145629
|
checker.typeToString(promisedType)
|
|
145397
145630
|
],
|
|
145398
|
-
|
|
145631
|
+
fixId39,
|
|
145399
145632
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
145400
145633
|
)];
|
|
145401
145634
|
},
|
|
145402
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
145635
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes49, (changes, diag2) => {
|
|
145403
145636
|
const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
145404
145637
|
if (info) {
|
|
145405
|
-
|
|
145638
|
+
doChange26(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
145406
145639
|
}
|
|
145407
145640
|
})
|
|
145408
145641
|
});
|
|
@@ -145416,20 +145649,20 @@ ${lanes.join("\n")}
|
|
|
145416
145649
|
changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore");
|
|
145417
145650
|
}
|
|
145418
145651
|
}
|
|
145419
|
-
var fixName4,
|
|
145652
|
+
var fixName4, fixId40, errorCodes50;
|
|
145420
145653
|
var init_disableJsDiagnostics = __esm({
|
|
145421
145654
|
"src/services/codefixes/disableJsDiagnostics.ts"() {
|
|
145422
145655
|
"use strict";
|
|
145423
145656
|
init_ts4();
|
|
145424
145657
|
init_ts_codefix();
|
|
145425
145658
|
fixName4 = "disableJsDiagnostics";
|
|
145426
|
-
|
|
145427
|
-
|
|
145659
|
+
fixId40 = "disableJsDiagnostics";
|
|
145660
|
+
errorCodes50 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
145428
145661
|
const diag2 = Diagnostics[key];
|
|
145429
145662
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
145430
145663
|
});
|
|
145431
145664
|
registerCodeFix({
|
|
145432
|
-
errorCodes:
|
|
145665
|
+
errorCodes: errorCodes50,
|
|
145433
145666
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
145434
145667
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
145435
145668
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -145447,14 +145680,14 @@ ${lanes.join("\n")}
|
|
|
145447
145680
|
)
|
|
145448
145681
|
];
|
|
145449
145682
|
if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) {
|
|
145450
|
-
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message,
|
|
145683
|
+
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));
|
|
145451
145684
|
}
|
|
145452
145685
|
return fixes;
|
|
145453
145686
|
},
|
|
145454
|
-
fixIds: [
|
|
145687
|
+
fixIds: [fixId40],
|
|
145455
145688
|
getAllCodeActions: (context) => {
|
|
145456
145689
|
const seenLines = /* @__PURE__ */ new Set();
|
|
145457
|
-
return codeFixAll(context,
|
|
145690
|
+
return codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
145458
145691
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
145459
145692
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
145460
145693
|
}
|
|
@@ -146551,7 +146784,7 @@ ${lanes.join("\n")}
|
|
|
146551
146784
|
}
|
|
146552
146785
|
return void 0;
|
|
146553
146786
|
}
|
|
146554
|
-
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer,
|
|
146787
|
+
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes51;
|
|
146555
146788
|
var init_fixStrictClassInitialization = __esm({
|
|
146556
146789
|
"src/services/codefixes/fixStrictClassInitialization.ts"() {
|
|
146557
146790
|
"use strict";
|
|
@@ -146561,9 +146794,9 @@ ${lanes.join("\n")}
|
|
|
146561
146794
|
fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
146562
146795
|
fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
146563
146796
|
fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
146564
|
-
|
|
146797
|
+
errorCodes51 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
146565
146798
|
registerCodeFix({
|
|
146566
|
-
errorCodes:
|
|
146799
|
+
errorCodes: errorCodes51,
|
|
146567
146800
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
146568
146801
|
const info = getInfo13(context.sourceFile, context.span.start);
|
|
146569
146802
|
if (!info)
|
|
@@ -146576,7 +146809,7 @@ ${lanes.join("\n")}
|
|
|
146576
146809
|
},
|
|
146577
146810
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
146578
146811
|
getAllCodeActions: (context) => {
|
|
146579
|
-
return codeFixAll(context,
|
|
146812
|
+
return codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
146580
146813
|
const info = getInfo13(diag2.file, diag2.start);
|
|
146581
146814
|
if (!info)
|
|
146582
146815
|
return;
|
|
@@ -146604,7 +146837,7 @@ ${lanes.join("\n")}
|
|
|
146604
146837
|
});
|
|
146605
146838
|
|
|
146606
146839
|
// src/services/codefixes/requireInTs.ts
|
|
146607
|
-
function
|
|
146840
|
+
function doChange27(changes, sourceFile, info) {
|
|
146608
146841
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
146609
146842
|
changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(
|
|
146610
146843
|
/*modifiers*/
|
|
@@ -146666,29 +146899,29 @@ ${lanes.join("\n")}
|
|
|
146666
146899
|
return factory.createNamedImports(importSpecifiers);
|
|
146667
146900
|
}
|
|
146668
146901
|
}
|
|
146669
|
-
var
|
|
146902
|
+
var fixId41, errorCodes52;
|
|
146670
146903
|
var init_requireInTs = __esm({
|
|
146671
146904
|
"src/services/codefixes/requireInTs.ts"() {
|
|
146672
146905
|
"use strict";
|
|
146673
146906
|
init_ts4();
|
|
146674
146907
|
init_ts_codefix();
|
|
146675
|
-
|
|
146676
|
-
|
|
146908
|
+
fixId41 = "requireInTs";
|
|
146909
|
+
errorCodes52 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
146677
146910
|
registerCodeFix({
|
|
146678
|
-
errorCodes:
|
|
146911
|
+
errorCodes: errorCodes52,
|
|
146679
146912
|
getCodeActions(context) {
|
|
146680
146913
|
const info = getInfo14(context.sourceFile, context.program, context.span.start);
|
|
146681
146914
|
if (!info) {
|
|
146682
146915
|
return void 0;
|
|
146683
146916
|
}
|
|
146684
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146685
|
-
return [createCodeFixAction(
|
|
146917
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, info));
|
|
146918
|
+
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
|
|
146686
146919
|
},
|
|
146687
|
-
fixIds: [
|
|
146688
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
146920
|
+
fixIds: [fixId41],
|
|
146921
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
146689
146922
|
const info = getInfo14(diag2.file, context.program, diag2.start);
|
|
146690
146923
|
if (info) {
|
|
146691
|
-
|
|
146924
|
+
doChange27(changes, context.sourceFile, info);
|
|
146692
146925
|
}
|
|
146693
146926
|
})
|
|
146694
146927
|
});
|
|
@@ -146708,7 +146941,7 @@ ${lanes.join("\n")}
|
|
|
146708
146941
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
146709
146942
|
}
|
|
146710
146943
|
}
|
|
146711
|
-
function
|
|
146944
|
+
function doChange28(changes, sourceFile, info, preferences) {
|
|
146712
146945
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
146713
146946
|
info.name,
|
|
146714
146947
|
/*namedImports*/
|
|
@@ -146717,29 +146950,29 @@ ${lanes.join("\n")}
|
|
|
146717
146950
|
getQuotePreference(sourceFile, preferences)
|
|
146718
146951
|
));
|
|
146719
146952
|
}
|
|
146720
|
-
var
|
|
146953
|
+
var fixId42, errorCodes53;
|
|
146721
146954
|
var init_useDefaultImport = __esm({
|
|
146722
146955
|
"src/services/codefixes/useDefaultImport.ts"() {
|
|
146723
146956
|
"use strict";
|
|
146724
146957
|
init_ts4();
|
|
146725
146958
|
init_ts_codefix();
|
|
146726
|
-
|
|
146727
|
-
|
|
146959
|
+
fixId42 = "useDefaultImport";
|
|
146960
|
+
errorCodes53 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
146728
146961
|
registerCodeFix({
|
|
146729
|
-
errorCodes:
|
|
146962
|
+
errorCodes: errorCodes53,
|
|
146730
146963
|
getCodeActions(context) {
|
|
146731
146964
|
const { sourceFile, span: { start } } = context;
|
|
146732
146965
|
const info = getInfo15(sourceFile, start);
|
|
146733
146966
|
if (!info)
|
|
146734
146967
|
return void 0;
|
|
146735
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146736
|
-
return [createCodeFixAction(
|
|
146968
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, info, context.preferences));
|
|
146969
|
+
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
|
|
146737
146970
|
},
|
|
146738
|
-
fixIds: [
|
|
146739
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
146971
|
+
fixIds: [fixId42],
|
|
146972
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
146740
146973
|
const info = getInfo15(diag2.file, diag2.start);
|
|
146741
146974
|
if (info)
|
|
146742
|
-
|
|
146975
|
+
doChange28(changes, diag2.file, info, context.preferences);
|
|
146743
146976
|
})
|
|
146744
146977
|
});
|
|
146745
146978
|
}
|
|
@@ -146754,27 +146987,27 @@ ${lanes.join("\n")}
|
|
|
146754
146987
|
const newText = numericLiteral.getText(sourceFile) + "n";
|
|
146755
146988
|
changeTracker.replaceNode(sourceFile, numericLiteral, factory.createBigIntLiteral(newText));
|
|
146756
146989
|
}
|
|
146757
|
-
var
|
|
146990
|
+
var fixId43, errorCodes54;
|
|
146758
146991
|
var init_useBigintLiteral = __esm({
|
|
146759
146992
|
"src/services/codefixes/useBigintLiteral.ts"() {
|
|
146760
146993
|
"use strict";
|
|
146761
146994
|
init_ts4();
|
|
146762
146995
|
init_ts_codefix();
|
|
146763
|
-
|
|
146764
|
-
|
|
146996
|
+
fixId43 = "useBigintLiteral";
|
|
146997
|
+
errorCodes54 = [
|
|
146765
146998
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
146766
146999
|
];
|
|
146767
147000
|
registerCodeFix({
|
|
146768
|
-
errorCodes:
|
|
147001
|
+
errorCodes: errorCodes54,
|
|
146769
147002
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
146770
147003
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
146771
147004
|
if (changes.length > 0) {
|
|
146772
|
-
return [createCodeFixAction(
|
|
147005
|
+
return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId43, Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
146773
147006
|
}
|
|
146774
147007
|
},
|
|
146775
|
-
fixIds: [
|
|
147008
|
+
fixIds: [fixId43],
|
|
146776
147009
|
getAllCodeActions: (context) => {
|
|
146777
|
-
return codeFixAll(context,
|
|
147010
|
+
return codeFixAll(context, errorCodes54, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
146778
147011
|
}
|
|
146779
147012
|
});
|
|
146780
147013
|
}
|
|
@@ -146787,7 +147020,7 @@ ${lanes.join("\n")}
|
|
|
146787
147020
|
Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType");
|
|
146788
147021
|
return token.parent;
|
|
146789
147022
|
}
|
|
146790
|
-
function
|
|
147023
|
+
function doChange29(changes, sourceFile, importType) {
|
|
146791
147024
|
const newTypeNode = factory.updateImportTypeNode(
|
|
146792
147025
|
importType,
|
|
146793
147026
|
importType.argument,
|
|
@@ -146799,25 +147032,25 @@ ${lanes.join("\n")}
|
|
|
146799
147032
|
);
|
|
146800
147033
|
changes.replaceNode(sourceFile, importType, newTypeNode);
|
|
146801
147034
|
}
|
|
146802
|
-
var fixIdAddMissingTypeof,
|
|
147035
|
+
var fixIdAddMissingTypeof, fixId44, errorCodes55;
|
|
146803
147036
|
var init_fixAddModuleReferTypeMissingTypeof = __esm({
|
|
146804
147037
|
"src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts"() {
|
|
146805
147038
|
"use strict";
|
|
146806
147039
|
init_ts4();
|
|
146807
147040
|
init_ts_codefix();
|
|
146808
147041
|
fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
146809
|
-
|
|
146810
|
-
|
|
147042
|
+
fixId44 = fixIdAddMissingTypeof;
|
|
147043
|
+
errorCodes55 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
146811
147044
|
registerCodeFix({
|
|
146812
|
-
errorCodes:
|
|
147045
|
+
errorCodes: errorCodes55,
|
|
146813
147046
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
146814
147047
|
const { sourceFile, span } = context;
|
|
146815
147048
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
146816
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146817
|
-
return [createCodeFixAction(
|
|
147049
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, importType));
|
|
147050
|
+
return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
|
|
146818
147051
|
},
|
|
146819
|
-
fixIds: [
|
|
146820
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147052
|
+
fixIds: [fixId44],
|
|
147053
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => doChange29(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
146821
147054
|
});
|
|
146822
147055
|
}
|
|
146823
147056
|
});
|
|
@@ -146836,7 +147069,7 @@ ${lanes.join("\n")}
|
|
|
146836
147069
|
return void 0;
|
|
146837
147070
|
return binaryExpr;
|
|
146838
147071
|
}
|
|
146839
|
-
function
|
|
147072
|
+
function doChange30(changeTracker, sf, node) {
|
|
146840
147073
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
146841
147074
|
if (jsx)
|
|
146842
147075
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -146859,30 +147092,30 @@ ${lanes.join("\n")}
|
|
|
146859
147092
|
return void 0;
|
|
146860
147093
|
}
|
|
146861
147094
|
}
|
|
146862
|
-
var fixID2,
|
|
147095
|
+
var fixID2, errorCodes56;
|
|
146863
147096
|
var init_wrapJsxInFragment = __esm({
|
|
146864
147097
|
"src/services/codefixes/wrapJsxInFragment.ts"() {
|
|
146865
147098
|
"use strict";
|
|
146866
147099
|
init_ts4();
|
|
146867
147100
|
init_ts_codefix();
|
|
146868
147101
|
fixID2 = "wrapJsxInFragment";
|
|
146869
|
-
|
|
147102
|
+
errorCodes56 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
146870
147103
|
registerCodeFix({
|
|
146871
|
-
errorCodes:
|
|
147104
|
+
errorCodes: errorCodes56,
|
|
146872
147105
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
146873
147106
|
const { sourceFile, span } = context;
|
|
146874
147107
|
const node = findNodeToFix(sourceFile, span.start);
|
|
146875
147108
|
if (!node)
|
|
146876
147109
|
return void 0;
|
|
146877
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147110
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, node));
|
|
146878
147111
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
146879
147112
|
},
|
|
146880
147113
|
fixIds: [fixID2],
|
|
146881
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147114
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
|
|
146882
147115
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
146883
147116
|
if (!node)
|
|
146884
147117
|
return void 0;
|
|
146885
|
-
|
|
147118
|
+
doChange30(changes, context.sourceFile, node);
|
|
146886
147119
|
})
|
|
146887
147120
|
});
|
|
146888
147121
|
}
|
|
@@ -146902,7 +147135,7 @@ ${lanes.join("\n")}
|
|
|
146902
147135
|
function createTypeAliasFromInterface(declaration, type) {
|
|
146903
147136
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
146904
147137
|
}
|
|
146905
|
-
function
|
|
147138
|
+
function doChange31(changes, sourceFile, { indexSignature, container }) {
|
|
146906
147139
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
146907
147140
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
146908
147141
|
const parameter = first(indexSignature.parameters);
|
|
@@ -146929,48 +147162,48 @@ ${lanes.join("\n")}
|
|
|
146929
147162
|
]);
|
|
146930
147163
|
changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType));
|
|
146931
147164
|
}
|
|
146932
|
-
var
|
|
147165
|
+
var fixId45, errorCodes57;
|
|
146933
147166
|
var init_convertToMappedObjectType = __esm({
|
|
146934
147167
|
"src/services/codefixes/convertToMappedObjectType.ts"() {
|
|
146935
147168
|
"use strict";
|
|
146936
147169
|
init_ts4();
|
|
146937
147170
|
init_ts_codefix();
|
|
146938
|
-
|
|
146939
|
-
|
|
147171
|
+
fixId45 = "fixConvertToMappedObjectType";
|
|
147172
|
+
errorCodes57 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
146940
147173
|
registerCodeFix({
|
|
146941
|
-
errorCodes:
|
|
147174
|
+
errorCodes: errorCodes57,
|
|
146942
147175
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
146943
147176
|
const { sourceFile, span } = context;
|
|
146944
147177
|
const info = getInfo16(sourceFile, span.start);
|
|
146945
147178
|
if (!info)
|
|
146946
147179
|
return void 0;
|
|
146947
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147180
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info));
|
|
146948
147181
|
const name = idText(info.container.name);
|
|
146949
|
-
return [createCodeFixAction(
|
|
147182
|
+
return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
146950
147183
|
},
|
|
146951
|
-
fixIds: [
|
|
146952
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147184
|
+
fixIds: [fixId45],
|
|
147185
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
|
|
146953
147186
|
const info = getInfo16(diag2.file, diag2.start);
|
|
146954
147187
|
if (info)
|
|
146955
|
-
|
|
147188
|
+
doChange31(changes, diag2.file, info);
|
|
146956
147189
|
})
|
|
146957
147190
|
});
|
|
146958
147191
|
}
|
|
146959
147192
|
});
|
|
146960
147193
|
|
|
146961
147194
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
146962
|
-
var
|
|
147195
|
+
var fixId46, errorCodes58;
|
|
146963
147196
|
var init_removeAccidentalCallParentheses = __esm({
|
|
146964
147197
|
"src/services/codefixes/removeAccidentalCallParentheses.ts"() {
|
|
146965
147198
|
"use strict";
|
|
146966
147199
|
init_ts4();
|
|
146967
147200
|
init_ts_codefix();
|
|
146968
|
-
|
|
146969
|
-
|
|
147201
|
+
fixId46 = "removeAccidentalCallParentheses";
|
|
147202
|
+
errorCodes58 = [
|
|
146970
147203
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
146971
147204
|
];
|
|
146972
147205
|
registerCodeFix({
|
|
146973
|
-
errorCodes:
|
|
147206
|
+
errorCodes: errorCodes58,
|
|
146974
147207
|
getCodeActions(context) {
|
|
146975
147208
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
146976
147209
|
if (!callExpression) {
|
|
@@ -146979,9 +147212,9 @@ ${lanes.join("\n")}
|
|
|
146979
147212
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
146980
147213
|
t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
|
|
146981
147214
|
});
|
|
146982
|
-
return [createCodeFixActionWithoutFixAll(
|
|
147215
|
+
return [createCodeFixActionWithoutFixAll(fixId46, changes, Diagnostics.Remove_parentheses)];
|
|
146983
147216
|
},
|
|
146984
|
-
fixIds: [
|
|
147217
|
+
fixIds: [fixId46]
|
|
146985
147218
|
});
|
|
146986
147219
|
}
|
|
146987
147220
|
});
|
|
@@ -147010,27 +147243,27 @@ ${lanes.join("\n")}
|
|
|
147010
147243
|
}
|
|
147011
147244
|
changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression);
|
|
147012
147245
|
}
|
|
147013
|
-
var
|
|
147246
|
+
var fixId47, errorCodes59;
|
|
147014
147247
|
var init_removeUnnecessaryAwait = __esm({
|
|
147015
147248
|
"src/services/codefixes/removeUnnecessaryAwait.ts"() {
|
|
147016
147249
|
"use strict";
|
|
147017
147250
|
init_ts4();
|
|
147018
147251
|
init_ts_codefix();
|
|
147019
|
-
|
|
147020
|
-
|
|
147252
|
+
fixId47 = "removeUnnecessaryAwait";
|
|
147253
|
+
errorCodes59 = [
|
|
147021
147254
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
147022
147255
|
];
|
|
147023
147256
|
registerCodeFix({
|
|
147024
|
-
errorCodes:
|
|
147257
|
+
errorCodes: errorCodes59,
|
|
147025
147258
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
147026
147259
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
147027
147260
|
if (changes.length > 0) {
|
|
147028
|
-
return [createCodeFixAction(
|
|
147261
|
+
return [createCodeFixAction(fixId47, changes, Diagnostics.Remove_unnecessary_await, fixId47, Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
147029
147262
|
}
|
|
147030
147263
|
},
|
|
147031
|
-
fixIds: [
|
|
147264
|
+
fixIds: [fixId47],
|
|
147032
147265
|
getAllCodeActions: (context) => {
|
|
147033
|
-
return codeFixAll(context,
|
|
147266
|
+
return codeFixAll(context, errorCodes59, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
147034
147267
|
}
|
|
147035
147268
|
});
|
|
147036
147269
|
}
|
|
@@ -147072,26 +147305,26 @@ ${lanes.join("\n")}
|
|
|
147072
147305
|
importDeclaration.assertClause
|
|
147073
147306
|
));
|
|
147074
147307
|
}
|
|
147075
|
-
var
|
|
147308
|
+
var errorCodes60, fixId48;
|
|
147076
147309
|
var init_splitTypeOnlyImport = __esm({
|
|
147077
147310
|
"src/services/codefixes/splitTypeOnlyImport.ts"() {
|
|
147078
147311
|
"use strict";
|
|
147079
147312
|
init_ts4();
|
|
147080
147313
|
init_ts_codefix();
|
|
147081
|
-
|
|
147082
|
-
|
|
147314
|
+
errorCodes60 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
147315
|
+
fixId48 = "splitTypeOnlyImport";
|
|
147083
147316
|
registerCodeFix({
|
|
147084
|
-
errorCodes:
|
|
147085
|
-
fixIds: [
|
|
147317
|
+
errorCodes: errorCodes60,
|
|
147318
|
+
fixIds: [fixId48],
|
|
147086
147319
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
147087
147320
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
147088
147321
|
return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
|
|
147089
147322
|
});
|
|
147090
147323
|
if (changes.length) {
|
|
147091
|
-
return [createCodeFixAction(
|
|
147324
|
+
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
147092
147325
|
}
|
|
147093
147326
|
},
|
|
147094
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147327
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error) => {
|
|
147095
147328
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error), context);
|
|
147096
147329
|
})
|
|
147097
147330
|
});
|
|
@@ -147113,43 +147346,43 @@ ${lanes.join("\n")}
|
|
|
147113
147346
|
return;
|
|
147114
147347
|
return { symbol, token: constToken };
|
|
147115
147348
|
}
|
|
147116
|
-
function
|
|
147349
|
+
function doChange32(changes, sourceFile, token) {
|
|
147117
147350
|
changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */));
|
|
147118
147351
|
}
|
|
147119
|
-
var
|
|
147352
|
+
var fixId49, errorCodes61;
|
|
147120
147353
|
var init_convertConstToLet = __esm({
|
|
147121
147354
|
"src/services/codefixes/convertConstToLet.ts"() {
|
|
147122
147355
|
"use strict";
|
|
147123
147356
|
init_ts4();
|
|
147124
147357
|
init_ts_codefix();
|
|
147125
|
-
|
|
147126
|
-
|
|
147358
|
+
fixId49 = "fixConvertConstToLet";
|
|
147359
|
+
errorCodes61 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
147127
147360
|
registerCodeFix({
|
|
147128
|
-
errorCodes:
|
|
147361
|
+
errorCodes: errorCodes61,
|
|
147129
147362
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
147130
147363
|
const { sourceFile, span, program } = context;
|
|
147131
147364
|
const info = getInfo17(sourceFile, span.start, program);
|
|
147132
147365
|
if (info === void 0)
|
|
147133
147366
|
return;
|
|
147134
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147135
|
-
return [createCodeFixActionMaybeFixAll(
|
|
147367
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info.token));
|
|
147368
|
+
return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
|
|
147136
147369
|
},
|
|
147137
147370
|
getAllCodeActions: (context) => {
|
|
147138
147371
|
const { program } = context;
|
|
147139
147372
|
const seen = /* @__PURE__ */ new Map();
|
|
147140
147373
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
147141
|
-
eachDiagnostic(context,
|
|
147374
|
+
eachDiagnostic(context, errorCodes61, (diag2) => {
|
|
147142
147375
|
const info = getInfo17(diag2.file, diag2.start, program);
|
|
147143
147376
|
if (info) {
|
|
147144
147377
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
147145
|
-
return
|
|
147378
|
+
return doChange32(changes, diag2.file, info.token);
|
|
147146
147379
|
}
|
|
147147
147380
|
}
|
|
147148
147381
|
return void 0;
|
|
147149
147382
|
});
|
|
147150
147383
|
}));
|
|
147151
147384
|
},
|
|
147152
|
-
fixIds: [
|
|
147385
|
+
fixIds: [fixId49]
|
|
147153
147386
|
});
|
|
147154
147387
|
}
|
|
147155
147388
|
});
|
|
@@ -147159,40 +147392,40 @@ ${lanes.join("\n")}
|
|
|
147159
147392
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
147160
147393
|
return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
147161
147394
|
}
|
|
147162
|
-
function
|
|
147395
|
+
function doChange33(changes, sourceFile, { node }) {
|
|
147163
147396
|
const newNode = factory.createToken(27 /* CommaToken */);
|
|
147164
147397
|
changes.replaceNode(sourceFile, node, newNode);
|
|
147165
147398
|
}
|
|
147166
|
-
var
|
|
147399
|
+
var fixId50, expectedErrorCode, errorCodes62;
|
|
147167
147400
|
var init_fixExpectedComma = __esm({
|
|
147168
147401
|
"src/services/codefixes/fixExpectedComma.ts"() {
|
|
147169
147402
|
"use strict";
|
|
147170
147403
|
init_ts4();
|
|
147171
147404
|
init_ts_codefix();
|
|
147172
|
-
|
|
147405
|
+
fixId50 = "fixExpectedComma";
|
|
147173
147406
|
expectedErrorCode = Diagnostics._0_expected.code;
|
|
147174
|
-
|
|
147407
|
+
errorCodes62 = [expectedErrorCode];
|
|
147175
147408
|
registerCodeFix({
|
|
147176
|
-
errorCodes:
|
|
147409
|
+
errorCodes: errorCodes62,
|
|
147177
147410
|
getCodeActions(context) {
|
|
147178
147411
|
const { sourceFile } = context;
|
|
147179
147412
|
const info = getInfo18(sourceFile, context.span.start, context.errorCode);
|
|
147180
147413
|
if (!info)
|
|
147181
147414
|
return void 0;
|
|
147182
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147415
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(t, sourceFile, info));
|
|
147183
147416
|
return [createCodeFixAction(
|
|
147184
|
-
|
|
147417
|
+
fixId50,
|
|
147185
147418
|
changes,
|
|
147186
147419
|
[Diagnostics.Change_0_to_1, ";", ","],
|
|
147187
|
-
|
|
147420
|
+
fixId50,
|
|
147188
147421
|
[Diagnostics.Change_0_to_1, ";", ","]
|
|
147189
147422
|
)];
|
|
147190
147423
|
},
|
|
147191
|
-
fixIds: [
|
|
147192
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147424
|
+
fixIds: [fixId50],
|
|
147425
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes62, (changes, diag2) => {
|
|
147193
147426
|
const info = getInfo18(diag2.file, diag2.start, diag2.code);
|
|
147194
147427
|
if (info)
|
|
147195
|
-
|
|
147428
|
+
doChange33(changes, context.sourceFile, info);
|
|
147196
147429
|
})
|
|
147197
147430
|
});
|
|
147198
147431
|
}
|
|
@@ -147248,29 +147481,29 @@ ${lanes.join("\n")}
|
|
|
147248
147481
|
return node.typeArguments;
|
|
147249
147482
|
}
|
|
147250
147483
|
}
|
|
147251
|
-
var fixName7,
|
|
147484
|
+
var fixName7, fixId51, errorCodes63;
|
|
147252
147485
|
var init_fixAddVoidToPromise = __esm({
|
|
147253
147486
|
"src/services/codefixes/fixAddVoidToPromise.ts"() {
|
|
147254
147487
|
"use strict";
|
|
147255
147488
|
init_ts4();
|
|
147256
147489
|
init_ts_codefix();
|
|
147257
147490
|
fixName7 = "addVoidToPromise";
|
|
147258
|
-
|
|
147259
|
-
|
|
147491
|
+
fixId51 = "addVoidToPromise";
|
|
147492
|
+
errorCodes63 = [
|
|
147260
147493
|
Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
147261
147494
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
147262
147495
|
];
|
|
147263
147496
|
registerCodeFix({
|
|
147264
|
-
errorCodes:
|
|
147265
|
-
fixIds: [
|
|
147497
|
+
errorCodes: errorCodes63,
|
|
147498
|
+
fixIds: [fixId51],
|
|
147266
147499
|
getCodeActions(context) {
|
|
147267
147500
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
|
|
147268
147501
|
if (changes.length > 0) {
|
|
147269
|
-
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value,
|
|
147502
|
+
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId51, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
|
|
147270
147503
|
}
|
|
147271
147504
|
},
|
|
147272
147505
|
getAllCodeActions(context) {
|
|
147273
|
-
return codeFixAll(context,
|
|
147506
|
+
return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
147274
147507
|
}
|
|
147275
147508
|
});
|
|
147276
147509
|
}
|
|
@@ -147305,6 +147538,7 @@ ${lanes.join("\n")}
|
|
|
147305
147538
|
getFixes: () => getFixes,
|
|
147306
147539
|
getImportCompletionAction: () => getImportCompletionAction,
|
|
147307
147540
|
getImportKind: () => getImportKind,
|
|
147541
|
+
getJSDocTypedefNode: () => getJSDocTypedefNode,
|
|
147308
147542
|
getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
|
|
147309
147543
|
getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
|
|
147310
147544
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
@@ -147339,6 +147573,7 @@ ${lanes.join("\n")}
|
|
|
147339
147573
|
init_correctQualifiedNameToIndexedAccessType();
|
|
147340
147574
|
init_convertToTypeOnlyExport();
|
|
147341
147575
|
init_convertToTypeOnlyImport();
|
|
147576
|
+
init_convertTypedefToType();
|
|
147342
147577
|
init_convertLiteralTypeToMappedType();
|
|
147343
147578
|
init_fixClassIncorrectlyImplementsInterface();
|
|
147344
147579
|
init_importFixes();
|
|
@@ -156488,7 +156723,7 @@ ${lanes.join("\n")}
|
|
|
156488
156723
|
return void 0;
|
|
156489
156724
|
}
|
|
156490
156725
|
}
|
|
156491
|
-
function
|
|
156726
|
+
function doChange34(exportingSourceFile, program, info, changes, cancellationToken) {
|
|
156492
156727
|
changeExport(exportingSourceFile, info, changes, program.getTypeChecker());
|
|
156493
156728
|
changeImports(program, info, changes, cancellationToken);
|
|
156494
156729
|
}
|
|
@@ -156684,7 +156919,7 @@ ${lanes.join("\n")}
|
|
|
156684
156919
|
Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name");
|
|
156685
156920
|
const info = getInfo19(context);
|
|
156686
156921
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156687
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
156922
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, info, t, context.cancellationToken));
|
|
156688
156923
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156689
156924
|
}
|
|
156690
156925
|
});
|
|
@@ -156719,7 +156954,7 @@ ${lanes.join("\n")}
|
|
|
156719
156954
|
function getShouldUseDefault(program, importClause) {
|
|
156720
156955
|
return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
|
|
156721
156956
|
}
|
|
156722
|
-
function
|
|
156957
|
+
function doChange35(sourceFile, program, changes, info) {
|
|
156723
156958
|
const checker = program.getTypeChecker();
|
|
156724
156959
|
if (info.convertTo === 0 /* Named */) {
|
|
156725
156960
|
doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions()));
|
|
@@ -156911,7 +157146,7 @@ ${lanes.join("\n")}
|
|
|
156911
157146
|
Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name");
|
|
156912
157147
|
const info = getImportConversionInfo(context);
|
|
156913
157148
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156914
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157149
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, t, info));
|
|
156915
157150
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156916
157151
|
}
|
|
156917
157152
|
});
|
|
@@ -157253,7 +157488,7 @@ ${lanes.join("\n")}
|
|
|
157253
157488
|
afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
|
|
157254
157489
|
};
|
|
157255
157490
|
}
|
|
157256
|
-
function
|
|
157491
|
+
function doChange36(oldFile, program, toMove, changes, host, preferences) {
|
|
157257
157492
|
const checker = program.getTypeChecker();
|
|
157258
157493
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
157259
157494
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
@@ -158023,7 +158258,7 @@ ${lanes.join("\n")}
|
|
|
158023
158258
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
158024
158259
|
Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
|
|
158025
158260
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
158026
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158261
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(context.file, context.program, statements, t, context.host, context.preferences));
|
|
158027
158262
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
158028
158263
|
}
|
|
158029
158264
|
});
|
|
@@ -158685,12 +158920,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158685
158920
|
return void 0;
|
|
158686
158921
|
const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken);
|
|
158687
158922
|
if (groupedReferences.valid) {
|
|
158688
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158923
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(file, program, host, t, functionDeclaration, groupedReferences));
|
|
158689
158924
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
158690
158925
|
}
|
|
158691
158926
|
return { edits: [] };
|
|
158692
158927
|
}
|
|
158693
|
-
function
|
|
158928
|
+
function doChange37(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
158694
158929
|
const signature = groupedReferences.signature;
|
|
158695
158930
|
const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param));
|
|
158696
158931
|
if (signature) {
|
|
@@ -159483,7 +159718,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159483
159718
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
159484
159719
|
const edits = ts_textChanges_exports.ChangeTracker.with(
|
|
159485
159720
|
context,
|
|
159486
|
-
(t) =>
|
|
159721
|
+
(t) => doChange38(context.file, context.program.getTypeChecker(), t, info, actionName2)
|
|
159487
159722
|
);
|
|
159488
159723
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
159489
159724
|
}
|
|
@@ -159639,7 +159874,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159639
159874
|
}
|
|
159640
159875
|
return toConvert;
|
|
159641
159876
|
}
|
|
159642
|
-
function
|
|
159877
|
+
function doChange38(sourceFile, checker, changes, info, _actionName) {
|
|
159643
159878
|
const { finalExpression, occurrences, expression } = info;
|
|
159644
159879
|
const firstOccurrence = occurrences[occurrences.length - 1];
|
|
159645
159880
|
const convertedChain = convertOccurrences(checker, finalExpression, occurrences);
|
|
@@ -161375,7 +161610,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161375
161610
|
function getRefactorEditsToInferReturnType(context) {
|
|
161376
161611
|
const info = getInfo21(context);
|
|
161377
161612
|
if (info && !isRefactorErrorInfo(info)) {
|
|
161378
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
161613
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(context.file, t, info.declaration, info.returnTypeNode));
|
|
161379
161614
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
161380
161615
|
}
|
|
161381
161616
|
return void 0;
|
|
@@ -161400,7 +161635,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161400
161635
|
}
|
|
161401
161636
|
return emptyArray;
|
|
161402
161637
|
}
|
|
161403
|
-
function
|
|
161638
|
+
function doChange39(sourceFile, changes, declaration, typeNode) {
|
|
161404
161639
|
const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile);
|
|
161405
161640
|
const needParens = isArrowFunction(declaration) && closeParen === void 0;
|
|
161406
161641
|
const endNode2 = needParens ? first(declaration.parameters) : closeParen;
|
|
@@ -167667,7 +167902,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167667
167902
|
CommandTypes2["NavtoFull"] = "navto-full";
|
|
167668
167903
|
CommandTypes2["NavTree"] = "navtree";
|
|
167669
167904
|
CommandTypes2["NavTreeFull"] = "navtree-full";
|
|
167670
|
-
CommandTypes2["Occurrences"] = "occurrences";
|
|
167671
167905
|
CommandTypes2["DocumentHighlights"] = "documentHighlights";
|
|
167672
167906
|
CommandTypes2["DocumentHighlightsFull"] = "documentHighlights-full";
|
|
167673
167907
|
CommandTypes2["Open"] = "open";
|
|
@@ -167924,17 +168158,14 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167924
168158
|
* True when reloading contents of file from the disk is pending
|
|
167925
168159
|
*/
|
|
167926
168160
|
this.pendingReloadFromDisk = false;
|
|
167927
|
-
this.version = initialVersion ||
|
|
168161
|
+
this.version = initialVersion || 0;
|
|
167928
168162
|
}
|
|
167929
168163
|
getVersion() {
|
|
167930
|
-
return this.svc ? `SVC-${this.version
|
|
168164
|
+
return this.svc ? `SVC-${this.version}-${this.svc.getSnapshotVersion()}` : `Text-${this.version}`;
|
|
167931
168165
|
}
|
|
167932
168166
|
hasScriptVersionCache_TestOnly() {
|
|
167933
168167
|
return this.svc !== void 0;
|
|
167934
168168
|
}
|
|
167935
|
-
useScriptVersionCache_TestOnly() {
|
|
167936
|
-
this.switchToScriptVersionCache();
|
|
167937
|
-
}
|
|
167938
168169
|
resetSourceMapInfo() {
|
|
167939
168170
|
this.info.sourceFileLike = void 0;
|
|
167940
168171
|
this.info.closeSourceMapFileWatcher();
|
|
@@ -167947,15 +168178,17 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167947
168178
|
useText(newText) {
|
|
167948
168179
|
this.svc = void 0;
|
|
167949
168180
|
this.text = newText;
|
|
168181
|
+
this.textSnapshot = void 0;
|
|
167950
168182
|
this.lineMap = void 0;
|
|
167951
168183
|
this.fileSize = void 0;
|
|
167952
168184
|
this.resetSourceMapInfo();
|
|
167953
|
-
this.version
|
|
168185
|
+
this.version++;
|
|
167954
168186
|
}
|
|
167955
168187
|
edit(start, end, newText) {
|
|
167956
168188
|
this.switchToScriptVersionCache().edit(start, end - start, newText);
|
|
167957
168189
|
this.ownFileText = false;
|
|
167958
168190
|
this.text = void 0;
|
|
168191
|
+
this.textSnapshot = void 0;
|
|
167959
168192
|
this.lineMap = void 0;
|
|
167960
168193
|
this.fileSize = void 0;
|
|
167961
168194
|
this.resetSourceMapInfo();
|
|
@@ -167967,6 +168200,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167967
168200
|
reload(newText) {
|
|
167968
168201
|
Debug.assert(newText !== void 0);
|
|
167969
168202
|
this.pendingReloadFromDisk = false;
|
|
168203
|
+
if (!this.text && this.svc) {
|
|
168204
|
+
this.text = getSnapshotText(this.svc.getSnapshot());
|
|
168205
|
+
}
|
|
167970
168206
|
if (this.text !== newText) {
|
|
167971
168207
|
this.useText(newText);
|
|
167972
168208
|
this.ownFileText = false;
|
|
@@ -167979,21 +168215,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167979
168215
|
* returns true if text changed
|
|
167980
168216
|
*/
|
|
167981
168217
|
reloadWithFileText(tempFileName) {
|
|
167982
|
-
const { text: newText, fileSize } = this.getFileTextAndSize(tempFileName);
|
|
168218
|
+
const { text: newText, fileSize } = tempFileName || !this.info.isDynamicOrHasMixedContent() ? this.getFileTextAndSize(tempFileName) : { text: "", fileSize: void 0 };
|
|
167983
168219
|
const reloaded = this.reload(newText);
|
|
167984
168220
|
this.fileSize = fileSize;
|
|
167985
168221
|
this.ownFileText = !tempFileName || tempFileName === this.info.fileName;
|
|
167986
168222
|
return reloaded;
|
|
167987
168223
|
}
|
|
167988
168224
|
/**
|
|
167989
|
-
*
|
|
167990
|
-
* returns true
|
|
168225
|
+
* Schedule reload from the disk if its not already scheduled and its not own text
|
|
168226
|
+
* returns true when scheduling reload
|
|
167991
168227
|
*/
|
|
167992
|
-
|
|
167993
|
-
|
|
167994
|
-
return this.reloadWithFileText();
|
|
167995
|
-
}
|
|
167996
|
-
return false;
|
|
168228
|
+
scheduleReloadIfNeeded() {
|
|
168229
|
+
return !this.pendingReloadFromDisk && !this.ownFileText ? this.pendingReloadFromDisk = true : false;
|
|
167997
168230
|
}
|
|
167998
168231
|
delayReloadFromFileIntoText() {
|
|
167999
168232
|
this.pendingReloadFromDisk = true;
|
|
@@ -168009,39 +168242,48 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168009
168242
|
return !!this.fileSize ? this.fileSize : !!this.text ? this.text.length : !!this.svc ? this.svc.getSnapshot().getLength() : this.getSnapshot().getLength();
|
|
168010
168243
|
}
|
|
168011
168244
|
getSnapshot() {
|
|
168012
|
-
|
|
168245
|
+
var _a2, _b;
|
|
168246
|
+
return ((_a2 = this.tryUseScriptVersionCache()) == null ? void 0 : _a2.getSnapshot()) || ((_b = this.textSnapshot) != null ? _b : this.textSnapshot = ScriptSnapshot.fromString(Debug.checkDefined(this.text)));
|
|
168013
168247
|
}
|
|
168014
|
-
getAbsolutePositionAndLineText(
|
|
168015
|
-
|
|
168248
|
+
getAbsolutePositionAndLineText(oneBasedLine) {
|
|
168249
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168250
|
+
if (svc)
|
|
168251
|
+
return svc.getAbsolutePositionAndLineText(oneBasedLine);
|
|
168252
|
+
const lineMap = this.getLineMap();
|
|
168253
|
+
return oneBasedLine <= lineMap.length ? {
|
|
168254
|
+
absolutePosition: lineMap[oneBasedLine - 1],
|
|
168255
|
+
lineText: this.text.substring(lineMap[oneBasedLine - 1], lineMap[oneBasedLine])
|
|
168256
|
+
} : {
|
|
168257
|
+
absolutePosition: this.text.length,
|
|
168258
|
+
lineText: void 0
|
|
168259
|
+
};
|
|
168016
168260
|
}
|
|
168017
168261
|
/**
|
|
168018
168262
|
* @param line 0 based index
|
|
168019
168263
|
*/
|
|
168020
168264
|
lineToTextSpan(line) {
|
|
168021
|
-
|
|
168022
|
-
|
|
168023
|
-
|
|
168024
|
-
|
|
168025
|
-
|
|
168026
|
-
|
|
168027
|
-
return
|
|
168265
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168266
|
+
if (svc)
|
|
168267
|
+
return svc.lineToTextSpan(line);
|
|
168268
|
+
const lineMap = this.getLineMap();
|
|
168269
|
+
const start = lineMap[line];
|
|
168270
|
+
const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
|
|
168271
|
+
return createTextSpanFromBounds(start, end);
|
|
168028
168272
|
}
|
|
168029
168273
|
/**
|
|
168030
168274
|
* @param line 1 based index
|
|
168031
168275
|
* @param offset 1 based index
|
|
168032
168276
|
*/
|
|
168033
168277
|
lineOffsetToPosition(line, offset, allowEdits) {
|
|
168034
|
-
|
|
168035
|
-
|
|
168036
|
-
}
|
|
168037
|
-
return this.svc.lineOffsetToPosition(line, offset);
|
|
168278
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168279
|
+
return svc ? svc.lineOffsetToPosition(line, offset) : computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
|
|
168038
168280
|
}
|
|
168039
168281
|
positionToLineOffset(position) {
|
|
168040
|
-
|
|
168041
|
-
|
|
168042
|
-
return
|
|
168043
|
-
}
|
|
168044
|
-
return
|
|
168282
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168283
|
+
if (svc)
|
|
168284
|
+
return svc.positionToLineOffset(position);
|
|
168285
|
+
const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
|
|
168286
|
+
return { line: line + 1, offset: character + 1 };
|
|
168045
168287
|
}
|
|
168046
168288
|
getFileTextAndSize(tempFileName) {
|
|
168047
168289
|
let text;
|
|
@@ -168059,19 +168301,25 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168059
168301
|
}
|
|
168060
168302
|
return { text: getText() };
|
|
168061
168303
|
}
|
|
168304
|
+
/** @internal */
|
|
168062
168305
|
switchToScriptVersionCache() {
|
|
168063
168306
|
if (!this.svc || this.pendingReloadFromDisk) {
|
|
168064
168307
|
this.svc = ScriptVersionCache.fromString(this.getOrLoadText());
|
|
168065
|
-
this.
|
|
168308
|
+
this.textSnapshot = void 0;
|
|
168309
|
+
this.version++;
|
|
168066
168310
|
}
|
|
168067
168311
|
return this.svc;
|
|
168068
168312
|
}
|
|
168069
|
-
|
|
168070
|
-
if (this.
|
|
168071
|
-
|
|
168313
|
+
tryUseScriptVersionCache() {
|
|
168314
|
+
if (!this.svc || this.pendingReloadFromDisk) {
|
|
168315
|
+
this.getOrLoadText();
|
|
168072
168316
|
}
|
|
168073
|
-
if (this.
|
|
168074
|
-
this.
|
|
168317
|
+
if (this.isOpen) {
|
|
168318
|
+
if (!this.svc && !this.textSnapshot) {
|
|
168319
|
+
this.svc = ScriptVersionCache.fromString(Debug.checkDefined(this.text));
|
|
168320
|
+
this.textSnapshot = void 0;
|
|
168321
|
+
}
|
|
168322
|
+
return this.svc;
|
|
168075
168323
|
}
|
|
168076
168324
|
return this.svc;
|
|
168077
168325
|
}
|
|
@@ -168084,13 +168332,14 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168084
168332
|
}
|
|
168085
168333
|
getLineMap() {
|
|
168086
168334
|
Debug.assert(!this.svc, "ScriptVersionCache should not be set");
|
|
168087
|
-
return this.lineMap || (this.lineMap = computeLineStarts(this.
|
|
168335
|
+
return this.lineMap || (this.lineMap = computeLineStarts(Debug.checkDefined(this.text)));
|
|
168088
168336
|
}
|
|
168089
168337
|
getLineInfo() {
|
|
168090
|
-
|
|
168338
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168339
|
+
if (svc) {
|
|
168091
168340
|
return {
|
|
168092
|
-
getLineCount: () =>
|
|
168093
|
-
getLineText: (line) =>
|
|
168341
|
+
getLineCount: () => svc.getLineCount(),
|
|
168342
|
+
getLineText: (line) => svc.getAbsolutePositionAndLineText(line + 1).lineText
|
|
168094
168343
|
};
|
|
168095
168344
|
}
|
|
168096
168345
|
const lineMap = this.getLineMap();
|
|
@@ -168111,20 +168360,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168111
168360
|
this.isDynamic = isDynamicFileName(fileName);
|
|
168112
168361
|
this.textStorage = new TextStorage(host, this, initialVersion);
|
|
168113
168362
|
if (hasMixedContent || this.isDynamic) {
|
|
168114
|
-
this.textStorage.reload("");
|
|
168115
168363
|
this.realpath = this.path;
|
|
168116
168364
|
}
|
|
168117
168365
|
this.scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName);
|
|
168118
168366
|
}
|
|
168119
168367
|
/** @internal */
|
|
168120
|
-
getVersion() {
|
|
168121
|
-
return this.textStorage.version;
|
|
168122
|
-
}
|
|
168123
|
-
/** @internal */
|
|
168124
|
-
getTelemetryFileSize() {
|
|
168125
|
-
return this.textStorage.getTelemetryFileSize();
|
|
168126
|
-
}
|
|
168127
|
-
/** @internal */
|
|
168128
168368
|
isDynamicOrHasMixedContent() {
|
|
168129
168369
|
return this.hasMixedContent || this.isDynamic;
|
|
168130
168370
|
}
|
|
@@ -168139,11 +168379,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168139
168379
|
}
|
|
168140
168380
|
close(fileExists = true) {
|
|
168141
168381
|
this.textStorage.isOpen = false;
|
|
168142
|
-
if (this.
|
|
168143
|
-
if (this.textStorage.reload("")) {
|
|
168144
|
-
this.markContainingProjectsAsDirty();
|
|
168145
|
-
}
|
|
168146
|
-
} else if (this.textStorage.reloadFromDisk()) {
|
|
168382
|
+
if (fileExists && this.textStorage.scheduleReloadIfNeeded()) {
|
|
168147
168383
|
this.markContainingProjectsAsDirty();
|
|
168148
168384
|
}
|
|
168149
168385
|
}
|
|
@@ -168323,22 +168559,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168323
168559
|
this.markContainingProjectsAsDirty();
|
|
168324
168560
|
}
|
|
168325
168561
|
reloadFromFile(tempFileName) {
|
|
168326
|
-
if (this.
|
|
168327
|
-
this.textStorage.reload("");
|
|
168562
|
+
if (this.textStorage.reloadWithFileText(tempFileName)) {
|
|
168328
168563
|
this.markContainingProjectsAsDirty();
|
|
168329
168564
|
return true;
|
|
168330
|
-
} else {
|
|
168331
|
-
if (this.textStorage.reloadWithFileText(tempFileName)) {
|
|
168332
|
-
this.markContainingProjectsAsDirty();
|
|
168333
|
-
return true;
|
|
168334
|
-
}
|
|
168335
168565
|
}
|
|
168336
168566
|
return false;
|
|
168337
168567
|
}
|
|
168338
|
-
/** @internal */
|
|
168339
|
-
getAbsolutePositionAndLineText(line) {
|
|
168340
|
-
return this.textStorage.getAbsolutePositionAndLineText(line);
|
|
168341
|
-
}
|
|
168342
168568
|
editContent(start, end, newText) {
|
|
168343
168569
|
this.textStorage.edit(start, end, newText);
|
|
168344
168570
|
this.markContainingProjectsAsDirty();
|
|
@@ -168378,10 +168604,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168378
168604
|
return this.scriptKind === 1 /* JS */ || this.scriptKind === 2 /* JSX */;
|
|
168379
168605
|
}
|
|
168380
168606
|
/** @internal */
|
|
168381
|
-
getLineInfo() {
|
|
168382
|
-
return this.textStorage.getLineInfo();
|
|
168383
|
-
}
|
|
168384
|
-
/** @internal */
|
|
168385
168607
|
closeSourceMapFileWatcher() {
|
|
168386
168608
|
if (this.sourceMapFilePath && !isString(this.sourceMapFilePath)) {
|
|
168387
168609
|
closeFileWatcherOf(this.sourceMapFilePath);
|
|
@@ -168512,7 +168734,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168512
168734
|
deferredSize: 0
|
|
168513
168735
|
};
|
|
168514
168736
|
for (const info of infos) {
|
|
168515
|
-
const fileSize = includeSizes ? info.getTelemetryFileSize() : 0;
|
|
168737
|
+
const fileSize = includeSizes ? info.textStorage.getTelemetryFileSize() : 0;
|
|
168516
168738
|
switch (info.scriptKind) {
|
|
168517
168739
|
case 1 /* JS */:
|
|
168518
168740
|
result.js += 1;
|
|
@@ -169542,10 +169764,26 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169542
169764
|
const elapsed = timestamp() - start;
|
|
169543
169765
|
this.sendPerformanceEvent("UpdateGraph", elapsed);
|
|
169544
169766
|
this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
|
|
169545
|
-
if (this.
|
|
169767
|
+
if (this.projectService.logger.isTestLogger) {
|
|
169768
|
+
if (this.program !== oldProgram) {
|
|
169769
|
+
this.print(
|
|
169770
|
+
/*writeProjectFileNames*/
|
|
169771
|
+
true,
|
|
169772
|
+
this.hasAddedorRemovedFiles,
|
|
169773
|
+
/*writeFileVersionAndText*/
|
|
169774
|
+
true
|
|
169775
|
+
);
|
|
169776
|
+
} else {
|
|
169777
|
+
this.writeLog(`Same program as before`);
|
|
169778
|
+
}
|
|
169779
|
+
} else if (this.hasAddedorRemovedFiles) {
|
|
169546
169780
|
this.print(
|
|
169547
169781
|
/*writeProjectFileNames*/
|
|
169548
|
-
true
|
|
169782
|
+
true,
|
|
169783
|
+
/*writeFileExplaination*/
|
|
169784
|
+
true,
|
|
169785
|
+
/*writeFileVersionAndText*/
|
|
169786
|
+
false
|
|
169549
169787
|
);
|
|
169550
169788
|
} else if (this.program !== oldProgram) {
|
|
169551
169789
|
this.writeLog(`Different program with same set of files`);
|
|
@@ -169655,6 +169893,16 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169655
169893
|
return this.projectService.getScriptInfo(uncheckedFileName);
|
|
169656
169894
|
}
|
|
169657
169895
|
filesToString(writeProjectFileNames) {
|
|
169896
|
+
return this.filesToStringWorker(
|
|
169897
|
+
writeProjectFileNames,
|
|
169898
|
+
/*writeFileExplaination*/
|
|
169899
|
+
true,
|
|
169900
|
+
/*writeFileVersionAndText*/
|
|
169901
|
+
false
|
|
169902
|
+
);
|
|
169903
|
+
}
|
|
169904
|
+
/** @internal */
|
|
169905
|
+
filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
|
|
169658
169906
|
if (this.isInitialLoadPending())
|
|
169659
169907
|
return " Files (0) InitialLoadPending\n";
|
|
169660
169908
|
if (!this.program)
|
|
@@ -169664,23 +169912,33 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169664
169912
|
`;
|
|
169665
169913
|
if (writeProjectFileNames) {
|
|
169666
169914
|
for (const file of sourceFiles) {
|
|
169667
|
-
strBuilder += ` ${file.fileName}
|
|
169915
|
+
strBuilder += ` ${file.fileName}${writeFileVersionAndText ? ` ${file.version} ${JSON.stringify(file.text)}` : ""}
|
|
169668
169916
|
`;
|
|
169669
169917
|
}
|
|
169670
|
-
|
|
169671
|
-
|
|
169918
|
+
if (writeFileExplaination) {
|
|
169919
|
+
strBuilder += "\n\n";
|
|
169920
|
+
explainFiles(this.program, (s) => strBuilder += ` ${s}
|
|
169672
169921
|
`);
|
|
169922
|
+
}
|
|
169673
169923
|
}
|
|
169674
169924
|
return strBuilder;
|
|
169675
169925
|
}
|
|
169676
169926
|
/** @internal */
|
|
169677
|
-
print(writeProjectFileNames) {
|
|
169927
|
+
print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
|
|
169678
169928
|
this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
|
|
169679
|
-
this.writeLog(this.
|
|
169929
|
+
this.writeLog(this.filesToStringWorker(
|
|
169930
|
+
writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
|
|
169931
|
+
writeFileExplaination && this.projectService.logger.hasLevel(3 /* verbose */),
|
|
169932
|
+
writeFileVersionAndText && this.projectService.logger.hasLevel(3 /* verbose */)
|
|
169933
|
+
));
|
|
169680
169934
|
this.writeLog("-----------------------------------------------");
|
|
169681
169935
|
if (this.autoImportProviderHost) {
|
|
169682
169936
|
this.autoImportProviderHost.print(
|
|
169683
169937
|
/*writeProjectFileNames*/
|
|
169938
|
+
false,
|
|
169939
|
+
/*writeFileExplaination*/
|
|
169940
|
+
false,
|
|
169941
|
+
/*writeFileVersionAndText*/
|
|
169684
169942
|
false
|
|
169685
169943
|
);
|
|
169686
169944
|
}
|
|
@@ -170682,7 +170940,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170682
170940
|
return !!this.externalProjectRefCount;
|
|
170683
170941
|
}
|
|
170684
170942
|
getEffectiveTypeRoots() {
|
|
170685
|
-
return getEffectiveTypeRoots(this.getCompilationSettings(), this
|
|
170943
|
+
return getEffectiveTypeRoots(this.getCompilationSettings(), this) || [];
|
|
170686
170944
|
}
|
|
170687
170945
|
/** @internal */
|
|
170688
170946
|
updateErrorOnNoInputFiles(fileNames) {
|
|
@@ -170931,6 +171189,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170931
171189
|
function printProjectWithoutFileNames(project) {
|
|
170932
171190
|
project.print(
|
|
170933
171191
|
/*writeProjectFileNames*/
|
|
171192
|
+
false,
|
|
171193
|
+
/*writeFileExplaination*/
|
|
171194
|
+
false,
|
|
171195
|
+
/*writeFileVersionAndText*/
|
|
170934
171196
|
false
|
|
170935
171197
|
);
|
|
170936
171198
|
}
|
|
@@ -171635,7 +171897,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171635
171897
|
this.logger.info("`remove Project::");
|
|
171636
171898
|
project.print(
|
|
171637
171899
|
/*writeProjectFileNames*/
|
|
171638
|
-
true
|
|
171900
|
+
true,
|
|
171901
|
+
/*writeFileExplaination*/
|
|
171902
|
+
true,
|
|
171903
|
+
/*writeFileVersionAndText*/
|
|
171904
|
+
false
|
|
171639
171905
|
);
|
|
171640
171906
|
project.close();
|
|
171641
171907
|
if (Debug.shouldAssert(1 /* Normal */)) {
|
|
@@ -171774,7 +172040,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171774
172040
|
}
|
|
171775
172041
|
deleteScriptInfo(info) {
|
|
171776
172042
|
this.filenameToScriptInfo.delete(info.path);
|
|
171777
|
-
this.filenameToScriptInfoVersion.set(info.path, info.
|
|
172043
|
+
this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
|
|
171778
172044
|
const realpath = info.getRealpathIfDifferent();
|
|
171779
172045
|
if (realpath) {
|
|
171780
172046
|
this.realpathToScriptInfos.remove(realpath, info);
|
|
@@ -172858,7 +173124,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
172858
173124
|
const documentPositionMapper = getDocumentPositionMapper(
|
|
172859
173125
|
{ getCanonicalFileName: this.toCanonicalFileName, log: (s) => this.logger.info(s), getSourceFileLike: (f) => this.getSourceFileLike(f, projectName, declarationInfo) },
|
|
172860
173126
|
declarationInfo.fileName,
|
|
172861
|
-
declarationInfo.getLineInfo(),
|
|
173127
|
+
declarationInfo.textStorage.getLineInfo(),
|
|
172862
173128
|
readMapFile
|
|
172863
173129
|
);
|
|
172864
173130
|
readMapFile = void 0;
|
|
@@ -174687,7 +174953,6 @@ ${json}${newLine}`;
|
|
|
174687
174953
|
"signatureHelp-full" /* SignatureHelpFull */,
|
|
174688
174954
|
"navto" /* Navto */,
|
|
174689
174955
|
"navto-full" /* NavtoFull */,
|
|
174690
|
-
"occurrences" /* Occurrences */,
|
|
174691
174956
|
"documentHighlights" /* DocumentHighlights */,
|
|
174692
174957
|
"documentHighlights-full" /* DocumentHighlightsFull */
|
|
174693
174958
|
];
|
|
@@ -175120,9 +175385,6 @@ ${json}${newLine}`;
|
|
|
175120
175385
|
false
|
|
175121
175386
|
));
|
|
175122
175387
|
},
|
|
175123
|
-
["occurrences" /* Occurrences */]: (request) => {
|
|
175124
|
-
return this.requiredResponse(this.getOccurrences(request.arguments));
|
|
175125
|
-
},
|
|
175126
175388
|
["documentHighlights" /* DocumentHighlights */]: (request) => {
|
|
175127
175389
|
return this.requiredResponse(this.getDocumentHighlights(
|
|
175128
175390
|
request.arguments,
|
|
@@ -176085,21 +176347,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176085
176347
|
const implementations = this.mapImplementationLocations(project.getLanguageService().getImplementationAtPosition(file, position) || emptyArray2, project);
|
|
176086
176348
|
return simplifiedResult ? implementations.map(({ fileName, textSpan, contextSpan }) => this.toFileSpanWithContext(fileName, textSpan, contextSpan, project)) : implementations.map(Session3.mapToOriginalLocation);
|
|
176087
176349
|
}
|
|
176088
|
-
getOccurrences(args) {
|
|
176089
|
-
const { file, project } = this.getFileAndProject(args);
|
|
176090
|
-
const position = this.getPositionInFile(args, file);
|
|
176091
|
-
const occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position);
|
|
176092
|
-
return occurrences ? occurrences.map((occurrence) => {
|
|
176093
|
-
const { fileName, isWriteAccess: isWriteAccess2, textSpan, isInString: isInString2, contextSpan } = occurrence;
|
|
176094
|
-
const scriptInfo = project.getScriptInfo(fileName);
|
|
176095
|
-
return {
|
|
176096
|
-
...toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo),
|
|
176097
|
-
file: fileName,
|
|
176098
|
-
isWriteAccess: isWriteAccess2,
|
|
176099
|
-
...isInString2 ? { isInString: isInString2 } : void 0
|
|
176100
|
-
};
|
|
176101
|
-
}) : emptyArray2;
|
|
176102
|
-
}
|
|
176103
176350
|
getSyntacticDiagnosticsSync(args) {
|
|
176104
176351
|
const { configFile } = this.getConfigFileAndProject(args);
|
|
176105
176352
|
if (configFile) {
|
|
@@ -176510,7 +176757,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176510
176757
|
formatOptions
|
|
176511
176758
|
);
|
|
176512
176759
|
if (args.key === "\n" && (!edits || edits.length === 0 || allEditsBeforePos(edits, position))) {
|
|
176513
|
-
const { lineText, absolutePosition } = scriptInfo.getAbsolutePositionAndLineText(args.line);
|
|
176760
|
+
const { lineText, absolutePosition } = scriptInfo.textStorage.getAbsolutePositionAndLineText(args.line);
|
|
176514
176761
|
if (lineText && lineText.search("\\S") < 0) {
|
|
176515
176762
|
const preferredIndent = languageService.getIndentationAtPosition(file, position, formatOptions);
|
|
176516
176763
|
let hasIndent = 0;
|
|
@@ -176735,6 +176982,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176735
176982
|
change(args) {
|
|
176736
176983
|
const scriptInfo = this.projectService.getScriptInfo(args.file);
|
|
176737
176984
|
Debug.assert(!!scriptInfo);
|
|
176985
|
+
scriptInfo.textStorage.switchToScriptVersionCache();
|
|
176738
176986
|
const start = scriptInfo.lineOffsetToPosition(args.line, args.offset);
|
|
176739
176987
|
const end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);
|
|
176740
176988
|
if (start >= 0) {
|
|
@@ -177027,10 +177275,10 @@ ${e.message}`;
|
|
|
177027
177275
|
}
|
|
177028
177276
|
return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
|
|
177029
177277
|
}
|
|
177030
|
-
getCombinedCodeFix({ scope, fixId:
|
|
177278
|
+
getCombinedCodeFix({ scope, fixId: fixId52 }, simplifiedResult) {
|
|
177031
177279
|
Debug.assert(scope.type === "file");
|
|
177032
177280
|
const { file, project } = this.getFileAndProject(scope.args);
|
|
177033
|
-
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file },
|
|
177281
|
+
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId52, this.getFormatOptions(file), this.getPreferences(file));
|
|
177034
177282
|
if (simplifiedResult) {
|
|
177035
177283
|
return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
|
|
177036
177284
|
} else {
|
|
@@ -177069,8 +177317,8 @@ ${e.message}`;
|
|
|
177069
177317
|
mapCodeAction({ description: description2, changes, commands }) {
|
|
177070
177318
|
return { description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands };
|
|
177071
177319
|
}
|
|
177072
|
-
mapCodeFixAction({ fixName: fixName8, description: description2, changes, commands, fixId:
|
|
177073
|
-
return { fixName: fixName8, description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId:
|
|
177320
|
+
mapCodeFixAction({ fixName: fixName8, description: description2, changes, commands, fixId: fixId52, fixAllDescription }) {
|
|
177321
|
+
return { fixName: fixName8, description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId52, fixAllDescription };
|
|
177074
177322
|
}
|
|
177075
177323
|
mapTextChangesToCodeEdits(textChanges2) {
|
|
177076
177324
|
return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
|
|
@@ -180100,7 +180348,6 @@ ${e.message}`;
|
|
|
180100
180348
|
nodeToDisplayParts: () => nodeToDisplayParts,
|
|
180101
180349
|
noop: () => noop,
|
|
180102
180350
|
noopFileWatcher: () => noopFileWatcher,
|
|
180103
|
-
noopPush: () => noopPush,
|
|
180104
180351
|
normalizePath: () => normalizePath,
|
|
180105
180352
|
normalizeSlashes: () => normalizeSlashes,
|
|
180106
180353
|
not: () => not,
|
|
@@ -182459,7 +182706,6 @@ ${e.message}`;
|
|
|
182459
182706
|
nodeToDisplayParts: () => nodeToDisplayParts,
|
|
182460
182707
|
noop: () => noop,
|
|
182461
182708
|
noopFileWatcher: () => noopFileWatcher,
|
|
182462
|
-
noopPush: () => noopPush,
|
|
182463
182709
|
normalizePath: () => normalizePath,
|
|
182464
182710
|
normalizeSlashes: () => normalizeSlashes,
|
|
182465
182711
|
not: () => not,
|