typescript 5.1.0-dev.20230301 → 5.1.0-dev.20230302
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 +127 -65
- package/lib/tsserver.js +867 -603
- package/lib/tsserverlibrary.d.ts +2 -37
- package/lib/tsserverlibrary.js +926 -652
- package/lib/typescript.d.ts +0 -3
- package/lib/typescript.js +804 -542
- package/lib/typingsInstaller.js +50 -14
- 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.20230302`;
|
|
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";
|
|
@@ -8458,6 +8454,7 @@ ${lanes.join("\n")}
|
|
|
8458
8454
|
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
8455
|
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
8456
|
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."),
|
|
8457
|
+
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
8458
|
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
8459
|
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
8460
|
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 +8850,8 @@ ${lanes.join("\n")}
|
|
|
8853
8850
|
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
8851
|
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
8852
|
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."),
|
|
8853
|
+
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."),
|
|
8854
|
+
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
8855
|
Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
|
|
8857
8856
|
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
8857
|
Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
|
|
@@ -9067,6 +9066,8 @@ ${lanes.join("\n")}
|
|
|
9067
9066
|
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
9067
|
Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
|
|
9069
9068
|
Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
9069
|
+
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
9070
|
+
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
9070
9071
|
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
9072
|
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
9073
|
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 +38854,14 @@ ${lanes.join("\n")}
|
|
|
38853
38854
|
currentDirectory = host.getCurrentDirectory();
|
|
38854
38855
|
}
|
|
38855
38856
|
if (currentDirectory !== void 0) {
|
|
38856
|
-
return getDefaultTypeRoots(currentDirectory
|
|
38857
|
+
return getDefaultTypeRoots(currentDirectory);
|
|
38857
38858
|
}
|
|
38858
38859
|
}
|
|
38859
|
-
function getDefaultTypeRoots(currentDirectory
|
|
38860
|
-
if (!host.directoryExists) {
|
|
38861
|
-
return [combinePaths(currentDirectory, nodeModulesAtTypes)];
|
|
38862
|
-
}
|
|
38860
|
+
function getDefaultTypeRoots(currentDirectory) {
|
|
38863
38861
|
let typeRoots;
|
|
38864
38862
|
forEachAncestorDirectory(normalizePath(currentDirectory), (directory) => {
|
|
38865
38863
|
const atTypes = combinePaths(directory, nodeModulesAtTypes);
|
|
38866
|
-
|
|
38867
|
-
(typeRoots || (typeRoots = [])).push(atTypes);
|
|
38868
|
-
}
|
|
38869
|
-
return void 0;
|
|
38864
|
+
(typeRoots != null ? typeRoots : typeRoots = []).push(atTypes);
|
|
38870
38865
|
});
|
|
38871
38866
|
return typeRoots;
|
|
38872
38867
|
}
|
|
@@ -39002,10 +38997,22 @@ ${lanes.join("\n")}
|
|
|
39002
38997
|
}
|
|
39003
38998
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
39004
38999
|
const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
|
|
39005
|
-
const
|
|
39006
|
-
const directoryExists = directoryProbablyExists(candidateDirectory, host);
|
|
39000
|
+
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
39007
39001
|
if (!directoryExists && traceEnabled) {
|
|
39008
|
-
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,
|
|
39002
|
+
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
39003
|
+
}
|
|
39004
|
+
if (options.typeRoots) {
|
|
39005
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState);
|
|
39006
|
+
if (resolvedFromFile) {
|
|
39007
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
39008
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
39009
|
+
packageDirectory,
|
|
39010
|
+
/*onlyRecordFailures*/
|
|
39011
|
+
false,
|
|
39012
|
+
moduleResolutionState
|
|
39013
|
+
) : void 0;
|
|
39014
|
+
return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile));
|
|
39015
|
+
}
|
|
39009
39016
|
}
|
|
39010
39017
|
return resolvedTypeScriptOnly(
|
|
39011
39018
|
loadNodeModuleFromDirectory(
|
|
@@ -39025,33 +39032,37 @@ ${lanes.join("\n")}
|
|
|
39025
39032
|
function secondaryLookup() {
|
|
39026
39033
|
const initialLocationForSecondaryLookup = containingFile && getDirectoryPath(containingFile);
|
|
39027
39034
|
if (initialLocationForSecondaryLookup !== void 0) {
|
|
39028
|
-
if (traceEnabled) {
|
|
39029
|
-
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
39030
|
-
}
|
|
39031
39035
|
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
|
-
|
|
39036
|
+
if (!options.typeRoots || !endsWith(containingFile, inferredTypesContainingFile)) {
|
|
39037
|
+
if (traceEnabled) {
|
|
39038
|
+
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
39039
|
+
}
|
|
39040
|
+
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
39041
|
+
const searchResult = loadModuleFromNearestNodeModulesDirectory(
|
|
39042
|
+
4 /* Declaration */,
|
|
39043
|
+
typeReferenceDirectiveName,
|
|
39044
|
+
initialLocationForSecondaryLookup,
|
|
39045
|
+
moduleResolutionState,
|
|
39046
|
+
/*cache*/
|
|
39047
|
+
void 0,
|
|
39048
|
+
/*redirectedReference*/
|
|
39049
|
+
void 0
|
|
39050
|
+
);
|
|
39051
|
+
result2 = searchResult && searchResult.value;
|
|
39052
|
+
} else {
|
|
39053
|
+
const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName);
|
|
39054
|
+
result2 = nodeLoadModuleByRelativeName(
|
|
39055
|
+
4 /* Declaration */,
|
|
39056
|
+
candidate,
|
|
39057
|
+
/*onlyRecordFailures*/
|
|
39058
|
+
false,
|
|
39059
|
+
moduleResolutionState,
|
|
39060
|
+
/*considerPackageJson*/
|
|
39061
|
+
true
|
|
39062
|
+
);
|
|
39063
|
+
}
|
|
39064
|
+
} else if (traceEnabled) {
|
|
39065
|
+
trace(host, Diagnostics.Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder);
|
|
39055
39066
|
}
|
|
39056
39067
|
return resolvedTypeScriptOnly(result2);
|
|
39057
39068
|
} else {
|
|
@@ -39870,6 +39881,9 @@ ${lanes.join("\n")}
|
|
|
39870
39881
|
}
|
|
39871
39882
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
39872
39883
|
}
|
|
39884
|
+
if (extensions2 & 4 /* Declaration */) {
|
|
39885
|
+
resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
|
|
39886
|
+
}
|
|
39873
39887
|
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
39874
39888
|
} else {
|
|
39875
39889
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
@@ -40049,6 +40063,7 @@ ${lanes.join("\n")}
|
|
|
40049
40063
|
return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
|
|
40050
40064
|
}
|
|
40051
40065
|
function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
40066
|
+
var _a2;
|
|
40052
40067
|
if (!onlyRecordFailures) {
|
|
40053
40068
|
if (state.host.fileExists(fileName)) {
|
|
40054
40069
|
if (state.traceEnabled) {
|
|
@@ -40061,7 +40076,7 @@ ${lanes.join("\n")}
|
|
|
40061
40076
|
}
|
|
40062
40077
|
}
|
|
40063
40078
|
}
|
|
40064
|
-
state.failedLookupLocations.push(fileName);
|
|
40079
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
|
|
40065
40080
|
return void 0;
|
|
40066
40081
|
}
|
|
40067
40082
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
@@ -40176,8 +40191,8 @@ ${lanes.join("\n")}
|
|
|
40176
40191
|
host,
|
|
40177
40192
|
compilerOptions: options,
|
|
40178
40193
|
traceEnabled: isTraceEnabled(options, host),
|
|
40179
|
-
failedLookupLocations:
|
|
40180
|
-
affectingLocations:
|
|
40194
|
+
failedLookupLocations: void 0,
|
|
40195
|
+
affectingLocations: void 0,
|
|
40181
40196
|
packageJsonInfoCache,
|
|
40182
40197
|
features: 0 /* None */,
|
|
40183
40198
|
conditions: emptyArray,
|
|
@@ -40211,24 +40226,24 @@ ${lanes.join("\n")}
|
|
|
40211
40226
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
40212
40227
|
}
|
|
40213
40228
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
40214
|
-
var _a2, _b, _c;
|
|
40229
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
40215
40230
|
const { host, traceEnabled } = state;
|
|
40216
40231
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
40217
40232
|
if (onlyRecordFailures) {
|
|
40218
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40233
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
|
|
40219
40234
|
return void 0;
|
|
40220
40235
|
}
|
|
40221
|
-
const existing = (
|
|
40236
|
+
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
40222
40237
|
if (existing !== void 0) {
|
|
40223
40238
|
if (typeof existing !== "boolean") {
|
|
40224
40239
|
if (traceEnabled)
|
|
40225
40240
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40226
|
-
state.affectingLocations.push(packageJsonPath);
|
|
40241
|
+
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
40227
40242
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
40228
40243
|
} else {
|
|
40229
40244
|
if (existing && traceEnabled)
|
|
40230
40245
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40231
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40246
|
+
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
40232
40247
|
return void 0;
|
|
40233
40248
|
}
|
|
40234
40249
|
}
|
|
@@ -40239,15 +40254,15 @@ ${lanes.join("\n")}
|
|
|
40239
40254
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
40240
40255
|
}
|
|
40241
40256
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
40242
|
-
(
|
|
40243
|
-
state.affectingLocations.push(packageJsonPath);
|
|
40257
|
+
(_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
|
|
40258
|
+
(_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
40244
40259
|
return result;
|
|
40245
40260
|
} else {
|
|
40246
40261
|
if (directoryExists && traceEnabled) {
|
|
40247
40262
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
40248
40263
|
}
|
|
40249
|
-
(
|
|
40250
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40264
|
+
(_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
40265
|
+
(_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
|
|
40251
40266
|
}
|
|
40252
40267
|
}
|
|
40253
40268
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -41067,11 +41082,13 @@ ${lanes.join("\n")}
|
|
|
41067
41082
|
state
|
|
41068
41083
|
));
|
|
41069
41084
|
});
|
|
41070
|
-
if (resolved2)
|
|
41085
|
+
if (resolved2)
|
|
41071
41086
|
return resolved2;
|
|
41072
|
-
}
|
|
41073
41087
|
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
41074
|
-
|
|
41088
|
+
let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
41089
|
+
if (extensions & 4 /* Declaration */)
|
|
41090
|
+
resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
|
|
41091
|
+
return resolved3;
|
|
41075
41092
|
}
|
|
41076
41093
|
} else {
|
|
41077
41094
|
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
|
@@ -41085,6 +41102,31 @@ ${lanes.join("\n")}
|
|
|
41085
41102
|
}
|
|
41086
41103
|
}
|
|
41087
41104
|
}
|
|
41105
|
+
function resolveFromTypeRoot(moduleName, state) {
|
|
41106
|
+
if (!state.compilerOptions.typeRoots)
|
|
41107
|
+
return;
|
|
41108
|
+
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
41109
|
+
const candidate = combinePaths(typeRoot, moduleName);
|
|
41110
|
+
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
41111
|
+
if (!directoryExists && state.traceEnabled) {
|
|
41112
|
+
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
41113
|
+
}
|
|
41114
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state);
|
|
41115
|
+
if (resolvedFromFile) {
|
|
41116
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
41117
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
41118
|
+
packageDirectory,
|
|
41119
|
+
/*onlyRecordFailures*/
|
|
41120
|
+
false,
|
|
41121
|
+
state
|
|
41122
|
+
) : void 0;
|
|
41123
|
+
return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
|
|
41124
|
+
}
|
|
41125
|
+
const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
|
|
41126
|
+
if (resolved)
|
|
41127
|
+
return toSearchResult(resolved);
|
|
41128
|
+
}
|
|
41129
|
+
}
|
|
41088
41130
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
41089
41131
|
return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
|
|
41090
41132
|
}
|
|
@@ -54007,7 +54049,11 @@ ${lanes.join("\n")}
|
|
|
54007
54049
|
const baseTypeVariable = getBaseTypeVariableOfClass(symbol);
|
|
54008
54050
|
return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type;
|
|
54009
54051
|
} else {
|
|
54010
|
-
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
54052
|
+
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
54053
|
+
type,
|
|
54054
|
+
/*isProperty*/
|
|
54055
|
+
true
|
|
54056
|
+
) : type;
|
|
54011
54057
|
}
|
|
54012
54058
|
}
|
|
54013
54059
|
function getTypeOfEnumMember(symbol) {
|
|
@@ -62708,6 +62754,7 @@ ${lanes.join("\n")}
|
|
|
62708
62754
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
62709
62755
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
62710
62756
|
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
62757
|
+
instantiateType(source2.objectType, reportUnreliableMapper);
|
|
62711
62758
|
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
62712
62759
|
}
|
|
62713
62760
|
if (result2) {
|
|
@@ -65853,7 +65900,7 @@ ${lanes.join("\n")}
|
|
|
65853
65900
|
);
|
|
65854
65901
|
}
|
|
65855
65902
|
function isInAmbientOrTypeNode(node) {
|
|
65856
|
-
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
65903
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n)));
|
|
65857
65904
|
}
|
|
65858
65905
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
65859
65906
|
switch (node.kind) {
|
|
@@ -69001,6 +69048,16 @@ ${lanes.join("\n")}
|
|
|
69001
69048
|
const symbol = getSymbolOfDeclaration(element);
|
|
69002
69049
|
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
69003
69050
|
}
|
|
69051
|
+
if (hasDynamicName(element)) {
|
|
69052
|
+
const name = getNameOfDeclaration(element);
|
|
69053
|
+
if (name && isComputedPropertyName(name)) {
|
|
69054
|
+
const exprType = checkExpression(name.expression);
|
|
69055
|
+
const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
|
|
69056
|
+
if (propType) {
|
|
69057
|
+
return propType;
|
|
69058
|
+
}
|
|
69059
|
+
}
|
|
69060
|
+
}
|
|
69004
69061
|
if (element.name) {
|
|
69005
69062
|
const nameType = getLiteralTypeFromPropertyName(element.name);
|
|
69006
69063
|
return mapType(
|
|
@@ -73774,7 +73831,7 @@ ${lanes.join("\n")}
|
|
|
73774
73831
|
}
|
|
73775
73832
|
function getNonArrayRestType(signature) {
|
|
73776
73833
|
const restType = getEffectiveRestType(signature);
|
|
73777
|
-
return restType && !isArrayType(restType) && !isTypeAny(restType)
|
|
73834
|
+
return restType && !isArrayType(restType) && !isTypeAny(restType) ? restType : void 0;
|
|
73778
73835
|
}
|
|
73779
73836
|
function getTypeOfFirstParameterOfSignature(signature) {
|
|
73780
73837
|
return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType);
|
|
@@ -78588,6 +78645,9 @@ ${lanes.join("\n")}
|
|
|
78588
78645
|
return;
|
|
78589
78646
|
}
|
|
78590
78647
|
if (isBindingPattern(node.name)) {
|
|
78648
|
+
if (isInAmbientOrTypeNode(node)) {
|
|
78649
|
+
return;
|
|
78650
|
+
}
|
|
78591
78651
|
const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* ForInStatement */;
|
|
78592
78652
|
const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression));
|
|
78593
78653
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
@@ -121573,7 +121633,7 @@ ${lanes.join("\n")}
|
|
|
121573
121633
|
return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
121574
121634
|
}
|
|
121575
121635
|
function createTypeRootsWatch(typeRootPath, typeRoot) {
|
|
121576
|
-
return resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
121636
|
+
return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
121577
121637
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
121578
121638
|
if (cachedDirectoryStructureHost) {
|
|
121579
121639
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -121584,7 +121644,7 @@ ${lanes.join("\n")}
|
|
|
121584
121644
|
if (dirPath) {
|
|
121585
121645
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
121586
121646
|
}
|
|
121587
|
-
}, 1 /* Recursive */);
|
|
121647
|
+
}, 1 /* Recursive */) : noopFileWatcher;
|
|
121588
121648
|
}
|
|
121589
121649
|
function updateTypeRootsWatch() {
|
|
121590
121650
|
const options = resolutionHost.getCompilationSettings();
|
|
@@ -121592,7 +121652,7 @@ ${lanes.join("\n")}
|
|
|
121592
121652
|
closeTypeRootsWatch();
|
|
121593
121653
|
return;
|
|
121594
121654
|
}
|
|
121595
|
-
const typeRoots = getEffectiveTypeRoots(options, {
|
|
121655
|
+
const typeRoots = getEffectiveTypeRoots(options, { getCurrentDirectory });
|
|
121596
121656
|
if (typeRoots) {
|
|
121597
121657
|
mutateMap(
|
|
121598
121658
|
typeRootsWatches,
|
|
@@ -121606,7 +121666,9 @@ ${lanes.join("\n")}
|
|
|
121606
121666
|
closeTypeRootsWatch();
|
|
121607
121667
|
}
|
|
121608
121668
|
}
|
|
121609
|
-
function
|
|
121669
|
+
function canWatchTypeRootPath(nodeTypesDirectory) {
|
|
121670
|
+
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
121671
|
+
return true;
|
|
121610
121672
|
const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
|
|
121611
121673
|
const dirPath = resolutionHost.toPath(dir);
|
|
121612
121674
|
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
@@ -131635,6 +131697,10 @@ ${lanes.join("\n")}
|
|
|
131635
131697
|
diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
|
|
131636
131698
|
}
|
|
131637
131699
|
}
|
|
131700
|
+
const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node);
|
|
131701
|
+
if (jsdocTypedefNode) {
|
|
131702
|
+
diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
|
|
131703
|
+
}
|
|
131638
131704
|
if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
|
|
131639
131705
|
diags.push(createDiagnosticForNode(node.name || node, Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types));
|
|
131640
131706
|
}
|
|
@@ -133450,18 +133516,6 @@ ${lanes.join("\n")}
|
|
|
133450
133516
|
synchronizeHostData();
|
|
133451
133517
|
return ts_FindAllReferences_exports.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position);
|
|
133452
133518
|
}
|
|
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
133519
|
function getDocumentHighlights(fileName, position, filesToSearch) {
|
|
133466
133520
|
const normalizedFileName = normalizePath(fileName);
|
|
133467
133521
|
Debug.assert(filesToSearch.some((f) => normalizePath(f) === normalizedFileName));
|
|
@@ -133654,22 +133708,22 @@ ${lanes.join("\n")}
|
|
|
133654
133708
|
}
|
|
133655
133709
|
return [];
|
|
133656
133710
|
}
|
|
133657
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
133711
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes64, formatOptions, preferences = emptyOptions) {
|
|
133658
133712
|
synchronizeHostData();
|
|
133659
133713
|
const sourceFile = getValidSourceFile(fileName);
|
|
133660
133714
|
const span = createTextSpanFromBounds(start, end);
|
|
133661
133715
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133662
|
-
return flatMap(deduplicate(
|
|
133716
|
+
return flatMap(deduplicate(errorCodes64, equateValues, compareValues), (errorCode) => {
|
|
133663
133717
|
cancellationToken.throwIfCancellationRequested();
|
|
133664
133718
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
133665
133719
|
});
|
|
133666
133720
|
}
|
|
133667
|
-
function getCombinedCodeFix(scope,
|
|
133721
|
+
function getCombinedCodeFix(scope, fixId52, formatOptions, preferences = emptyOptions) {
|
|
133668
133722
|
synchronizeHostData();
|
|
133669
133723
|
Debug.assert(scope.type === "file");
|
|
133670
133724
|
const sourceFile = getValidSourceFile(scope.fileName);
|
|
133671
133725
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133672
|
-
return ts_codefix_exports.getAllFixes({ fixId:
|
|
133726
|
+
return ts_codefix_exports.getAllFixes({ fixId: fixId52, sourceFile, program, host, cancellationToken, formatContext, preferences });
|
|
133673
133727
|
}
|
|
133674
133728
|
function organizeImports2(args, formatOptions, preferences = emptyOptions) {
|
|
133675
133729
|
var _a3;
|
|
@@ -134091,7 +134145,6 @@ ${lanes.join("\n")}
|
|
|
134091
134145
|
getReferencesAtPosition,
|
|
134092
134146
|
findReferences,
|
|
134093
134147
|
getFileReferences,
|
|
134094
|
-
getOccurrencesAtPosition,
|
|
134095
134148
|
getDocumentHighlights,
|
|
134096
134149
|
getNameOrDottedNameSpan,
|
|
134097
134150
|
getBreakpointStatementAtPosition,
|
|
@@ -134917,7 +134970,6 @@ ${lanes.join("\n")}
|
|
|
134917
134970
|
"getTypeDefinitionAtPosition",
|
|
134918
134971
|
"getReferencesAtPosition",
|
|
134919
134972
|
"findReferences",
|
|
134920
|
-
"getOccurrencesAtPosition",
|
|
134921
134973
|
"getDocumentHighlights",
|
|
134922
134974
|
"getNavigateToItems",
|
|
134923
134975
|
"getRenameInfo",
|
|
@@ -135501,12 +135553,6 @@ ${lanes.join("\n")}
|
|
|
135501
135553
|
() => this.languageService.getFileReferences(fileName)
|
|
135502
135554
|
);
|
|
135503
135555
|
}
|
|
135504
|
-
getOccurrencesAtPosition(fileName, position) {
|
|
135505
|
-
return this.forwardJSONCall(
|
|
135506
|
-
`getOccurrencesAtPosition('${fileName}', ${position})`,
|
|
135507
|
-
() => this.languageService.getOccurrencesAtPosition(fileName, position)
|
|
135508
|
-
);
|
|
135509
|
-
}
|
|
135510
135556
|
getDocumentHighlights(fileName, position, filesToSearch) {
|
|
135511
135557
|
return this.forwardJSONCall(
|
|
135512
135558
|
`getDocumentHighlights('${fileName}', ${position})`,
|
|
@@ -137140,23 +137186,23 @@ ${lanes.join("\n")}
|
|
|
137140
137186
|
void 0
|
|
137141
137187
|
);
|
|
137142
137188
|
}
|
|
137143
|
-
function createCodeFixAction(fixName8, changes, description2,
|
|
137144
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137189
|
+
function createCodeFixAction(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137190
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, diagnosticToString(fixAllDescription), command);
|
|
137145
137191
|
}
|
|
137146
|
-
function createCodeFixActionMaybeFixAll(fixName8, changes, description2,
|
|
137147
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137192
|
+
function createCodeFixActionMaybeFixAll(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137193
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
137148
137194
|
}
|
|
137149
|
-
function createCodeFixActionWorker(fixName8, description2, changes,
|
|
137150
|
-
return { fixName: fixName8, description: description2, changes, fixId:
|
|
137195
|
+
function createCodeFixActionWorker(fixName8, description2, changes, fixId52, fixAllDescription, command) {
|
|
137196
|
+
return { fixName: fixName8, description: description2, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
137151
137197
|
}
|
|
137152
137198
|
function registerCodeFix(reg) {
|
|
137153
137199
|
for (const error of reg.errorCodes) {
|
|
137154
137200
|
errorCodeToFixes.add(String(error), reg);
|
|
137155
137201
|
}
|
|
137156
137202
|
if (reg.fixIds) {
|
|
137157
|
-
for (const
|
|
137158
|
-
Debug.assert(!fixIdToRegistration.has(
|
|
137159
|
-
fixIdToRegistration.set(
|
|
137203
|
+
for (const fixId52 of reg.fixIds) {
|
|
137204
|
+
Debug.assert(!fixIdToRegistration.has(fixId52));
|
|
137205
|
+
fixIdToRegistration.set(fixId52, reg);
|
|
137160
137206
|
}
|
|
137161
137207
|
}
|
|
137162
137208
|
}
|
|
@@ -137164,17 +137210,17 @@ ${lanes.join("\n")}
|
|
|
137164
137210
|
return arrayFrom(errorCodeToFixes.keys());
|
|
137165
137211
|
}
|
|
137166
137212
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
137167
|
-
const { errorCodes:
|
|
137213
|
+
const { errorCodes: errorCodes64 } = registration;
|
|
137168
137214
|
let maybeFixableDiagnostics = 0;
|
|
137169
137215
|
for (const diag2 of diagnostics) {
|
|
137170
|
-
if (contains(
|
|
137216
|
+
if (contains(errorCodes64, diag2.code))
|
|
137171
137217
|
maybeFixableDiagnostics++;
|
|
137172
137218
|
if (maybeFixableDiagnostics > 1)
|
|
137173
137219
|
break;
|
|
137174
137220
|
}
|
|
137175
137221
|
const fixAllUnavailable = maybeFixableDiagnostics < 2;
|
|
137176
|
-
return ({ fixId:
|
|
137177
|
-
return fixAllUnavailable ? action : { ...action, fixId:
|
|
137222
|
+
return ({ fixId: fixId52, fixAllDescription, ...action }) => {
|
|
137223
|
+
return fixAllUnavailable ? action : { ...action, fixId: fixId52, fixAllDescription };
|
|
137178
137224
|
};
|
|
137179
137225
|
}
|
|
137180
137226
|
function getFixes(context) {
|
|
@@ -137191,14 +137237,14 @@ ${lanes.join("\n")}
|
|
|
137191
137237
|
function createFileTextChanges(fileName, textChanges2) {
|
|
137192
137238
|
return { fileName, textChanges: textChanges2 };
|
|
137193
137239
|
}
|
|
137194
|
-
function codeFixAll(context,
|
|
137240
|
+
function codeFixAll(context, errorCodes64, use) {
|
|
137195
137241
|
const commands = [];
|
|
137196
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
137242
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes64, (diag2) => use(t, diag2, commands)));
|
|
137197
137243
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
137198
137244
|
}
|
|
137199
|
-
function eachDiagnostic(context,
|
|
137245
|
+
function eachDiagnostic(context, errorCodes64, cb) {
|
|
137200
137246
|
for (const diag2 of getDiagnostics(context)) {
|
|
137201
|
-
if (contains(
|
|
137247
|
+
if (contains(errorCodes64, diag2.code)) {
|
|
137202
137248
|
cb(diag2);
|
|
137203
137249
|
}
|
|
137204
137250
|
}
|
|
@@ -139780,32 +139826,96 @@ ${lanes.join("\n")}
|
|
|
139780
139826
|
});
|
|
139781
139827
|
|
|
139782
139828
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
139783
|
-
function
|
|
139784
|
-
|
|
139829
|
+
function getDeclaration2(sourceFile, pos) {
|
|
139830
|
+
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
139831
|
+
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
139785
139832
|
}
|
|
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
|
|
139833
|
+
function doChange4(changes, sourceFile, declaration) {
|
|
139834
|
+
if (isImportSpecifier(declaration)) {
|
|
139835
|
+
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
139836
|
+
declaration,
|
|
139837
|
+
/*isTypeOnly*/
|
|
139838
|
+
true,
|
|
139839
|
+
declaration.propertyName,
|
|
139840
|
+
declaration.name
|
|
139808
139841
|
));
|
|
139842
|
+
} else {
|
|
139843
|
+
const importClause = declaration.importClause;
|
|
139844
|
+
if (importClause.name && importClause.namedBindings) {
|
|
139845
|
+
changes.replaceNodeWithNodes(sourceFile, declaration, [
|
|
139846
|
+
factory.createImportDeclaration(
|
|
139847
|
+
getSynthesizedDeepClones(
|
|
139848
|
+
declaration.modifiers,
|
|
139849
|
+
/*includeTrivia*/
|
|
139850
|
+
true
|
|
139851
|
+
),
|
|
139852
|
+
factory.createImportClause(
|
|
139853
|
+
/*isTypeOnly*/
|
|
139854
|
+
true,
|
|
139855
|
+
getSynthesizedDeepClone(
|
|
139856
|
+
importClause.name,
|
|
139857
|
+
/*includeTrivia*/
|
|
139858
|
+
true
|
|
139859
|
+
),
|
|
139860
|
+
/*namedBindings*/
|
|
139861
|
+
void 0
|
|
139862
|
+
),
|
|
139863
|
+
getSynthesizedDeepClone(
|
|
139864
|
+
declaration.moduleSpecifier,
|
|
139865
|
+
/*includeTrivia*/
|
|
139866
|
+
true
|
|
139867
|
+
),
|
|
139868
|
+
getSynthesizedDeepClone(
|
|
139869
|
+
declaration.assertClause,
|
|
139870
|
+
/*includeTrivia*/
|
|
139871
|
+
true
|
|
139872
|
+
)
|
|
139873
|
+
),
|
|
139874
|
+
factory.createImportDeclaration(
|
|
139875
|
+
getSynthesizedDeepClones(
|
|
139876
|
+
declaration.modifiers,
|
|
139877
|
+
/*includeTrivia*/
|
|
139878
|
+
true
|
|
139879
|
+
),
|
|
139880
|
+
factory.createImportClause(
|
|
139881
|
+
/*isTypeOnly*/
|
|
139882
|
+
true,
|
|
139883
|
+
/*name*/
|
|
139884
|
+
void 0,
|
|
139885
|
+
getSynthesizedDeepClone(
|
|
139886
|
+
importClause.namedBindings,
|
|
139887
|
+
/*includeTrivia*/
|
|
139888
|
+
true
|
|
139889
|
+
)
|
|
139890
|
+
),
|
|
139891
|
+
getSynthesizedDeepClone(
|
|
139892
|
+
declaration.moduleSpecifier,
|
|
139893
|
+
/*includeTrivia*/
|
|
139894
|
+
true
|
|
139895
|
+
),
|
|
139896
|
+
getSynthesizedDeepClone(
|
|
139897
|
+
declaration.assertClause,
|
|
139898
|
+
/*includeTrivia*/
|
|
139899
|
+
true
|
|
139900
|
+
)
|
|
139901
|
+
)
|
|
139902
|
+
]);
|
|
139903
|
+
} else {
|
|
139904
|
+
const importDeclaration = factory.updateImportDeclaration(
|
|
139905
|
+
declaration,
|
|
139906
|
+
declaration.modifiers,
|
|
139907
|
+
factory.updateImportClause(
|
|
139908
|
+
importClause,
|
|
139909
|
+
/*isTypeOnly*/
|
|
139910
|
+
true,
|
|
139911
|
+
importClause.name,
|
|
139912
|
+
importClause.namedBindings
|
|
139913
|
+
),
|
|
139914
|
+
declaration.moduleSpecifier,
|
|
139915
|
+
declaration.assertClause
|
|
139916
|
+
);
|
|
139917
|
+
changes.replaceNode(sourceFile, declaration, importDeclaration);
|
|
139918
|
+
}
|
|
139809
139919
|
}
|
|
139810
139920
|
}
|
|
139811
139921
|
var errorCodes14, fixId13;
|
|
@@ -139814,30 +139924,181 @@ ${lanes.join("\n")}
|
|
|
139814
139924
|
"use strict";
|
|
139815
139925
|
init_ts4();
|
|
139816
139926
|
init_ts_codefix();
|
|
139817
|
-
errorCodes14 = [
|
|
139927
|
+
errorCodes14 = [
|
|
139928
|
+
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
139929
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
139930
|
+
];
|
|
139818
139931
|
fixId13 = "convertToTypeOnlyImport";
|
|
139819
139932
|
registerCodeFix({
|
|
139820
139933
|
errorCodes: errorCodes14,
|
|
139821
139934
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139822
|
-
const
|
|
139823
|
-
|
|
139824
|
-
|
|
139825
|
-
});
|
|
139826
|
-
if (changes.length) {
|
|
139935
|
+
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
139936
|
+
if (declaration) {
|
|
139937
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration));
|
|
139827
139938
|
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
139939
|
}
|
|
139940
|
+
return void 0;
|
|
139829
139941
|
},
|
|
139830
139942
|
fixIds: [fixId13],
|
|
139831
139943
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139832
139944
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
139833
|
-
const
|
|
139834
|
-
|
|
139945
|
+
const declaration = getDeclaration2(diag2.file, diag2.start);
|
|
139946
|
+
if (declaration) {
|
|
139947
|
+
doChange4(changes, diag2.file, declaration);
|
|
139948
|
+
}
|
|
139835
139949
|
});
|
|
139836
139950
|
}
|
|
139837
139951
|
});
|
|
139838
139952
|
}
|
|
139839
139953
|
});
|
|
139840
139954
|
|
|
139955
|
+
// src/services/codefixes/convertTypedefToType.ts
|
|
139956
|
+
function doChange5(changes, node, sourceFile) {
|
|
139957
|
+
if (isJSDocTypedefTag(node)) {
|
|
139958
|
+
fixSingleTypeDef(changes, node, sourceFile);
|
|
139959
|
+
}
|
|
139960
|
+
}
|
|
139961
|
+
function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
|
|
139962
|
+
if (!typeDefNode)
|
|
139963
|
+
return;
|
|
139964
|
+
const declaration = createDeclaration(typeDefNode);
|
|
139965
|
+
if (!declaration)
|
|
139966
|
+
return;
|
|
139967
|
+
const comment = typeDefNode.parent;
|
|
139968
|
+
changes.replaceNode(
|
|
139969
|
+
sourceFile,
|
|
139970
|
+
comment,
|
|
139971
|
+
declaration
|
|
139972
|
+
);
|
|
139973
|
+
}
|
|
139974
|
+
function createDeclaration(tag) {
|
|
139975
|
+
var _a2;
|
|
139976
|
+
const { typeExpression } = tag;
|
|
139977
|
+
if (!typeExpression)
|
|
139978
|
+
return;
|
|
139979
|
+
const typeName = (_a2 = tag.name) == null ? void 0 : _a2.getText();
|
|
139980
|
+
if (!typeName)
|
|
139981
|
+
return;
|
|
139982
|
+
if (typeExpression.kind === 325 /* JSDocTypeLiteral */) {
|
|
139983
|
+
return createInterfaceForTypeLiteral(typeName, typeExpression);
|
|
139984
|
+
}
|
|
139985
|
+
if (typeExpression.kind === 312 /* JSDocTypeExpression */) {
|
|
139986
|
+
return createTypeAliasForTypeExpression(typeName, typeExpression);
|
|
139987
|
+
}
|
|
139988
|
+
}
|
|
139989
|
+
function createInterfaceForTypeLiteral(typeName, typeLiteral) {
|
|
139990
|
+
const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
|
|
139991
|
+
if (!some(propertySignatures))
|
|
139992
|
+
return;
|
|
139993
|
+
const interfaceDeclaration = factory.createInterfaceDeclaration(
|
|
139994
|
+
/*modifiers*/
|
|
139995
|
+
void 0,
|
|
139996
|
+
typeName,
|
|
139997
|
+
/*typeParameters*/
|
|
139998
|
+
void 0,
|
|
139999
|
+
/*heritageClauses*/
|
|
140000
|
+
void 0,
|
|
140001
|
+
propertySignatures
|
|
140002
|
+
);
|
|
140003
|
+
return interfaceDeclaration;
|
|
140004
|
+
}
|
|
140005
|
+
function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
140006
|
+
const typeReference = getSynthesizedDeepClone(typeExpression.type);
|
|
140007
|
+
if (!typeReference)
|
|
140008
|
+
return;
|
|
140009
|
+
const declaration = factory.createTypeAliasDeclaration(
|
|
140010
|
+
/*modifiers*/
|
|
140011
|
+
void 0,
|
|
140012
|
+
factory.createIdentifier(typeName),
|
|
140013
|
+
/*typeParameters*/
|
|
140014
|
+
void 0,
|
|
140015
|
+
typeReference
|
|
140016
|
+
);
|
|
140017
|
+
return declaration;
|
|
140018
|
+
}
|
|
140019
|
+
function createSignatureFromTypeLiteral(typeLiteral) {
|
|
140020
|
+
const propertyTags = typeLiteral.jsDocPropertyTags;
|
|
140021
|
+
if (!some(propertyTags))
|
|
140022
|
+
return;
|
|
140023
|
+
const getSignature = (tag) => {
|
|
140024
|
+
var _a2;
|
|
140025
|
+
const name = getPropertyName(tag);
|
|
140026
|
+
const type = (_a2 = tag.typeExpression) == null ? void 0 : _a2.type;
|
|
140027
|
+
const isOptional = tag.isBracketed;
|
|
140028
|
+
let typeReference;
|
|
140029
|
+
if (type && isJSDocTypeLiteral(type)) {
|
|
140030
|
+
const signatures = createSignatureFromTypeLiteral(type);
|
|
140031
|
+
typeReference = factory.createTypeLiteralNode(signatures);
|
|
140032
|
+
} else if (type) {
|
|
140033
|
+
typeReference = getSynthesizedDeepClone(type);
|
|
140034
|
+
}
|
|
140035
|
+
if (typeReference && name) {
|
|
140036
|
+
const questionToken = isOptional ? factory.createToken(57 /* QuestionToken */) : void 0;
|
|
140037
|
+
const prop = factory.createPropertySignature(
|
|
140038
|
+
/*modifiers*/
|
|
140039
|
+
void 0,
|
|
140040
|
+
name,
|
|
140041
|
+
questionToken,
|
|
140042
|
+
typeReference
|
|
140043
|
+
);
|
|
140044
|
+
return prop;
|
|
140045
|
+
}
|
|
140046
|
+
};
|
|
140047
|
+
const props = mapDefined(propertyTags, getSignature);
|
|
140048
|
+
return props;
|
|
140049
|
+
}
|
|
140050
|
+
function getPropertyName(tag) {
|
|
140051
|
+
return tag.name.kind === 79 /* Identifier */ ? tag.name.text : tag.name.right.text;
|
|
140052
|
+
}
|
|
140053
|
+
function getJSDocTypedefNode(node) {
|
|
140054
|
+
if (hasJSDocNodes(node)) {
|
|
140055
|
+
return forEach(node.jsDoc, (node2) => {
|
|
140056
|
+
var _a2;
|
|
140057
|
+
return (_a2 = node2.tags) == null ? void 0 : _a2.find(isJSDocTypedefTag);
|
|
140058
|
+
});
|
|
140059
|
+
}
|
|
140060
|
+
return void 0;
|
|
140061
|
+
}
|
|
140062
|
+
var fixId14, errorCodes15;
|
|
140063
|
+
var init_convertTypedefToType = __esm({
|
|
140064
|
+
"src/services/codefixes/convertTypedefToType.ts"() {
|
|
140065
|
+
"use strict";
|
|
140066
|
+
init_ts4();
|
|
140067
|
+
init_ts_codefix();
|
|
140068
|
+
fixId14 = "convertTypedefToType";
|
|
140069
|
+
errorCodes15 = [Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type.code];
|
|
140070
|
+
registerCodeFix({
|
|
140071
|
+
fixIds: [fixId14],
|
|
140072
|
+
errorCodes: errorCodes15,
|
|
140073
|
+
getCodeActions(context) {
|
|
140074
|
+
const node = getTokenAtPosition(
|
|
140075
|
+
context.sourceFile,
|
|
140076
|
+
context.span.start
|
|
140077
|
+
);
|
|
140078
|
+
if (!node)
|
|
140079
|
+
return;
|
|
140080
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, node, context.sourceFile));
|
|
140081
|
+
if (changes.length > 0) {
|
|
140082
|
+
return [
|
|
140083
|
+
createCodeFixAction(
|
|
140084
|
+
fixId14,
|
|
140085
|
+
changes,
|
|
140086
|
+
Diagnostics.Convert_typedef_to_TypeScript_type,
|
|
140087
|
+
fixId14,
|
|
140088
|
+
Diagnostics.Convert_all_typedef_to_TypeScript_types
|
|
140089
|
+
)
|
|
140090
|
+
];
|
|
140091
|
+
}
|
|
140092
|
+
},
|
|
140093
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
|
|
140094
|
+
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
140095
|
+
if (node)
|
|
140096
|
+
doChange5(changes, node, diag2.file);
|
|
140097
|
+
})
|
|
140098
|
+
});
|
|
140099
|
+
}
|
|
140100
|
+
});
|
|
140101
|
+
|
|
139841
140102
|
// src/services/codefixes/convertLiteralTypeToMappedType.ts
|
|
139842
140103
|
function getInfo2(sourceFile, pos) {
|
|
139843
140104
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -139853,7 +140114,7 @@ ${lanes.join("\n")}
|
|
|
139853
140114
|
}
|
|
139854
140115
|
return void 0;
|
|
139855
140116
|
}
|
|
139856
|
-
function
|
|
140117
|
+
function doChange6(changes, sourceFile, { container, typeNode, constraint, name }) {
|
|
139857
140118
|
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
|
|
139858
140119
|
/*readonlyToken*/
|
|
139859
140120
|
void 0,
|
|
@@ -139872,16 +140133,16 @@ ${lanes.join("\n")}
|
|
|
139872
140133
|
void 0
|
|
139873
140134
|
));
|
|
139874
140135
|
}
|
|
139875
|
-
var
|
|
140136
|
+
var fixId15, errorCodes16;
|
|
139876
140137
|
var init_convertLiteralTypeToMappedType = __esm({
|
|
139877
140138
|
"src/services/codefixes/convertLiteralTypeToMappedType.ts"() {
|
|
139878
140139
|
"use strict";
|
|
139879
140140
|
init_ts4();
|
|
139880
140141
|
init_ts_codefix();
|
|
139881
|
-
|
|
139882
|
-
|
|
140142
|
+
fixId15 = "convertLiteralTypeToMappedType";
|
|
140143
|
+
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
140144
|
registerCodeFix({
|
|
139884
|
-
errorCodes:
|
|
140145
|
+
errorCodes: errorCodes16,
|
|
139885
140146
|
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
139886
140147
|
const { sourceFile, span } = context;
|
|
139887
140148
|
const info = getInfo2(sourceFile, span.start);
|
|
@@ -139889,14 +140150,14 @@ ${lanes.join("\n")}
|
|
|
139889
140150
|
return void 0;
|
|
139890
140151
|
}
|
|
139891
140152
|
const { name, constraint } = info;
|
|
139892
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
139893
|
-
return [createCodeFixAction(
|
|
140153
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, sourceFile, info));
|
|
140154
|
+
return [createCodeFixAction(fixId15, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId15, Diagnostics.Convert_all_type_literals_to_mapped_type)];
|
|
139894
140155
|
},
|
|
139895
|
-
fixIds: [
|
|
139896
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
140156
|
+
fixIds: [fixId15],
|
|
140157
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes16, (changes, diag2) => {
|
|
139897
140158
|
const info = getInfo2(diag2.file, diag2.start);
|
|
139898
140159
|
if (info) {
|
|
139899
|
-
|
|
140160
|
+
doChange6(changes, diag2.file, info);
|
|
139900
140161
|
}
|
|
139901
140162
|
})
|
|
139902
140163
|
});
|
|
@@ -139955,31 +140216,31 @@ ${lanes.join("\n")}
|
|
|
139955
140216
|
const heritageClauseTypeSymbols = checker.getPropertiesOfType(heritageClauseType);
|
|
139956
140217
|
return createSymbolTable(heritageClauseTypeSymbols.filter(symbolPointsToNonPrivateMember));
|
|
139957
140218
|
}
|
|
139958
|
-
var
|
|
140219
|
+
var errorCodes17, fixId16;
|
|
139959
140220
|
var init_fixClassIncorrectlyImplementsInterface = __esm({
|
|
139960
140221
|
"src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts"() {
|
|
139961
140222
|
"use strict";
|
|
139962
140223
|
init_ts4();
|
|
139963
140224
|
init_ts_codefix();
|
|
139964
|
-
|
|
140225
|
+
errorCodes17 = [
|
|
139965
140226
|
Diagnostics.Class_0_incorrectly_implements_interface_1.code,
|
|
139966
140227
|
Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code
|
|
139967
140228
|
];
|
|
139968
|
-
|
|
140229
|
+
fixId16 = "fixClassIncorrectlyImplementsInterface";
|
|
139969
140230
|
registerCodeFix({
|
|
139970
|
-
errorCodes:
|
|
140231
|
+
errorCodes: errorCodes17,
|
|
139971
140232
|
getCodeActions(context) {
|
|
139972
140233
|
const { sourceFile, span } = context;
|
|
139973
140234
|
const classDeclaration = getClass(sourceFile, span.start);
|
|
139974
140235
|
return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => {
|
|
139975
140236
|
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(
|
|
140237
|
+
return changes.length === 0 ? void 0 : createCodeFixAction(fixId16, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId16, Diagnostics.Implement_all_unimplemented_interfaces);
|
|
139977
140238
|
});
|
|
139978
140239
|
},
|
|
139979
|
-
fixIds: [
|
|
140240
|
+
fixIds: [fixId16],
|
|
139980
140241
|
getAllCodeActions(context) {
|
|
139981
140242
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
139982
|
-
return codeFixAll(context,
|
|
140243
|
+
return codeFixAll(context, errorCodes17, (changes, diag2) => {
|
|
139983
140244
|
const classDeclaration = getClass(diag2.file, diag2.start);
|
|
139984
140245
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
139985
140246
|
for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) {
|
|
@@ -141153,7 +141414,7 @@ ${lanes.join("\n")}
|
|
|
141153
141414
|
}
|
|
141154
141415
|
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
141155
141416
|
}
|
|
141156
|
-
var importFixName, importFixId,
|
|
141417
|
+
var importFixName, importFixId, errorCodes18;
|
|
141157
141418
|
var init_importFixes = __esm({
|
|
141158
141419
|
"src/services/codefixes/importFixes.ts"() {
|
|
141159
141420
|
"use strict";
|
|
@@ -141161,7 +141422,7 @@ ${lanes.join("\n")}
|
|
|
141161
141422
|
init_ts_codefix();
|
|
141162
141423
|
importFixName = "import";
|
|
141163
141424
|
importFixId = "fixMissingImport";
|
|
141164
|
-
|
|
141425
|
+
errorCodes18 = [
|
|
141165
141426
|
Diagnostics.Cannot_find_name_0.code,
|
|
141166
141427
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
141167
141428
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
@@ -141173,7 +141434,7 @@ ${lanes.join("\n")}
|
|
|
141173
141434
|
Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code
|
|
141174
141435
|
];
|
|
141175
141436
|
registerCodeFix({
|
|
141176
|
-
errorCodes:
|
|
141437
|
+
errorCodes: errorCodes18,
|
|
141177
141438
|
getCodeActions(context) {
|
|
141178
141439
|
const { errorCode, preferences, sourceFile, span, program } = context;
|
|
141179
141440
|
const info = getFixInfos(
|
|
@@ -141208,7 +141469,7 @@ ${lanes.join("\n")}
|
|
|
141208
141469
|
host,
|
|
141209
141470
|
cancellationToken
|
|
141210
141471
|
);
|
|
141211
|
-
eachDiagnostic(context,
|
|
141472
|
+
eachDiagnostic(context, errorCodes18, (diag2) => importAdder.addImportFromDiagnostic(diag2, context));
|
|
141212
141473
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
|
|
141213
141474
|
}
|
|
141214
141475
|
});
|
|
@@ -141283,14 +141544,14 @@ ${lanes.join("\n")}
|
|
|
141283
141544
|
const contextualType = isExpression(node) ? checker.getContextualType(node) : void 0;
|
|
141284
141545
|
return contextualType || checker.getTypeAtLocation(node);
|
|
141285
141546
|
}
|
|
141286
|
-
var
|
|
141547
|
+
var fixId17, errorCodes19;
|
|
141287
141548
|
var init_fixAddMissingConstraint = __esm({
|
|
141288
141549
|
"src/services/codefixes/fixAddMissingConstraint.ts"() {
|
|
141289
141550
|
"use strict";
|
|
141290
141551
|
init_ts4();
|
|
141291
141552
|
init_ts_codefix();
|
|
141292
|
-
|
|
141293
|
-
|
|
141553
|
+
fixId17 = "addMissingConstraint";
|
|
141554
|
+
errorCodes19 = [
|
|
141294
141555
|
// We want errors this could be attached to:
|
|
141295
141556
|
// Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
|
|
141296
141557
|
Diagnostics.Type_0_is_not_comparable_to_type_1.code,
|
|
@@ -141303,21 +141564,21 @@ ${lanes.join("\n")}
|
|
|
141303
141564
|
Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code
|
|
141304
141565
|
];
|
|
141305
141566
|
registerCodeFix({
|
|
141306
|
-
errorCodes:
|
|
141567
|
+
errorCodes: errorCodes19,
|
|
141307
141568
|
getCodeActions(context) {
|
|
141308
141569
|
const { sourceFile, span, program, preferences, host } = context;
|
|
141309
141570
|
const info = getInfo3(program, sourceFile, span);
|
|
141310
141571
|
if (info === void 0)
|
|
141311
141572
|
return;
|
|
141312
141573
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info));
|
|
141313
|
-
return [createCodeFixAction(
|
|
141574
|
+
return [createCodeFixAction(fixId17, changes, Diagnostics.Add_extends_constraint, fixId17, Diagnostics.Add_extends_constraint_to_all_type_parameters)];
|
|
141314
141575
|
},
|
|
141315
|
-
fixIds: [
|
|
141576
|
+
fixIds: [fixId17],
|
|
141316
141577
|
getAllCodeActions: (context) => {
|
|
141317
141578
|
const { program, preferences, host } = context;
|
|
141318
141579
|
const seen = /* @__PURE__ */ new Map();
|
|
141319
141580
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141320
|
-
eachDiagnostic(context,
|
|
141581
|
+
eachDiagnostic(context, errorCodes19, (diag2) => {
|
|
141321
141582
|
const info = getInfo3(program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
141322
141583
|
if (info) {
|
|
141323
141584
|
if (addToSeen(seen, getNodeId(info.declaration))) {
|
|
@@ -141399,7 +141660,7 @@ ${lanes.join("\n")}
|
|
|
141399
141660
|
Debug.assert(classElement && isClassElementLikeHasJSDoc(classElement));
|
|
141400
141661
|
return classElement;
|
|
141401
141662
|
}
|
|
141402
|
-
var fixName, fixAddOverrideId, fixRemoveOverrideId,
|
|
141663
|
+
var fixName, fixAddOverrideId, fixRemoveOverrideId, errorCodes20, errorCodeFixIdMap;
|
|
141403
141664
|
var init_fixOverrideModifier = __esm({
|
|
141404
141665
|
"src/services/codefixes/fixOverrideModifier.ts"() {
|
|
141405
141666
|
"use strict";
|
|
@@ -141408,7 +141669,7 @@ ${lanes.join("\n")}
|
|
|
141408
141669
|
fixName = "fixOverrideModifier";
|
|
141409
141670
|
fixAddOverrideId = "fixAddOverrideModifier";
|
|
141410
141671
|
fixRemoveOverrideId = "fixRemoveOverrideModifier";
|
|
141411
|
-
|
|
141672
|
+
errorCodes20 = [
|
|
141412
141673
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code,
|
|
141413
141674
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
|
|
141414
141675
|
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 +141733,20 @@ ${lanes.join("\n")}
|
|
|
141472
141733
|
}
|
|
141473
141734
|
};
|
|
141474
141735
|
registerCodeFix({
|
|
141475
|
-
errorCodes:
|
|
141736
|
+
errorCodes: errorCodes20,
|
|
141476
141737
|
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
141477
141738
|
const { errorCode, span } = context;
|
|
141478
141739
|
const info = errorCodeFixIdMap[errorCode];
|
|
141479
141740
|
if (!info)
|
|
141480
141741
|
return emptyArray;
|
|
141481
|
-
const { descriptions, fixId:
|
|
141742
|
+
const { descriptions, fixId: fixId52, fixAllDescriptions } = info;
|
|
141482
141743
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
|
|
141483
141744
|
return [
|
|
141484
|
-
createCodeFixActionMaybeFixAll(fixName, changes, descriptions,
|
|
141745
|
+
createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId52, fixAllDescriptions)
|
|
141485
141746
|
];
|
|
141486
141747
|
},
|
|
141487
141748
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
141488
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141749
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => {
|
|
141489
141750
|
const { code, start } = diag2;
|
|
141490
141751
|
const info = errorCodeFixIdMap[code];
|
|
141491
141752
|
if (!info || info.fixId !== context.fixId) {
|
|
@@ -141498,7 +141759,7 @@ ${lanes.join("\n")}
|
|
|
141498
141759
|
});
|
|
141499
141760
|
|
|
141500
141761
|
// src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts
|
|
141501
|
-
function
|
|
141762
|
+
function doChange7(changes, sourceFile, node, preferences) {
|
|
141502
141763
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
141503
141764
|
const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */);
|
|
141504
141765
|
changes.replaceNode(
|
|
@@ -141510,32 +141771,32 @@ ${lanes.join("\n")}
|
|
|
141510
141771
|
function getPropertyAccessExpression(sourceFile, pos) {
|
|
141511
141772
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression);
|
|
141512
141773
|
}
|
|
141513
|
-
var
|
|
141774
|
+
var fixId18, errorCodes21;
|
|
141514
141775
|
var init_fixNoPropertyAccessFromIndexSignature = __esm({
|
|
141515
141776
|
"src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts"() {
|
|
141516
141777
|
"use strict";
|
|
141517
141778
|
init_ts4();
|
|
141518
141779
|
init_ts_codefix();
|
|
141519
|
-
|
|
141520
|
-
|
|
141780
|
+
fixId18 = "fixNoPropertyAccessFromIndexSignature";
|
|
141781
|
+
errorCodes21 = [
|
|
141521
141782
|
Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code
|
|
141522
141783
|
];
|
|
141523
141784
|
registerCodeFix({
|
|
141524
|
-
errorCodes:
|
|
141525
|
-
fixIds: [
|
|
141785
|
+
errorCodes: errorCodes21,
|
|
141786
|
+
fixIds: [fixId18],
|
|
141526
141787
|
getCodeActions(context) {
|
|
141527
141788
|
const { sourceFile, span, preferences } = context;
|
|
141528
141789
|
const property = getPropertyAccessExpression(sourceFile, span.start);
|
|
141529
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141530
|
-
return [createCodeFixAction(
|
|
141790
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, context.sourceFile, property, preferences));
|
|
141791
|
+
return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId18, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
141531
141792
|
},
|
|
141532
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141793
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => doChange7(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
141533
141794
|
});
|
|
141534
141795
|
}
|
|
141535
141796
|
});
|
|
141536
141797
|
|
|
141537
141798
|
// src/services/codefixes/fixImplicitThis.ts
|
|
141538
|
-
function
|
|
141799
|
+
function doChange8(changes, sourceFile, pos, checker) {
|
|
141539
141800
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141540
141801
|
if (!isThis(token))
|
|
141541
141802
|
return void 0;
|
|
@@ -141576,27 +141837,27 @@ ${lanes.join("\n")}
|
|
|
141576
141837
|
}
|
|
141577
141838
|
}
|
|
141578
141839
|
}
|
|
141579
|
-
var
|
|
141840
|
+
var fixId19, errorCodes22;
|
|
141580
141841
|
var init_fixImplicitThis = __esm({
|
|
141581
141842
|
"src/services/codefixes/fixImplicitThis.ts"() {
|
|
141582
141843
|
"use strict";
|
|
141583
141844
|
init_ts4();
|
|
141584
141845
|
init_ts_codefix();
|
|
141585
|
-
|
|
141586
|
-
|
|
141846
|
+
fixId19 = "fixImplicitThis";
|
|
141847
|
+
errorCodes22 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
141587
141848
|
registerCodeFix({
|
|
141588
|
-
errorCodes:
|
|
141849
|
+
errorCodes: errorCodes22,
|
|
141589
141850
|
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
141590
141851
|
const { sourceFile, program, span } = context;
|
|
141591
141852
|
let diagnostic;
|
|
141592
141853
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
141593
|
-
diagnostic =
|
|
141854
|
+
diagnostic = doChange8(t, sourceFile, span.start, program.getTypeChecker());
|
|
141594
141855
|
});
|
|
141595
|
-
return diagnostic ? [createCodeFixAction(
|
|
141856
|
+
return diagnostic ? [createCodeFixAction(fixId19, changes, diagnostic, fixId19, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
|
|
141596
141857
|
},
|
|
141597
|
-
fixIds: [
|
|
141598
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141599
|
-
|
|
141858
|
+
fixIds: [fixId19],
|
|
141859
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => {
|
|
141860
|
+
doChange8(changes, diag2.file, diag2.start, context.program.getTypeChecker());
|
|
141600
141861
|
})
|
|
141601
141862
|
});
|
|
141602
141863
|
}
|
|
@@ -141639,7 +141900,7 @@ ${lanes.join("\n")}
|
|
|
141639
141900
|
}
|
|
141640
141901
|
return void 0;
|
|
141641
141902
|
}
|
|
141642
|
-
function
|
|
141903
|
+
function doChange9(changes, program, { exportName, node, moduleSourceFile }) {
|
|
141643
141904
|
const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
|
|
141644
141905
|
if (exportDeclaration) {
|
|
141645
141906
|
updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
|
|
@@ -141721,32 +141982,32 @@ ${lanes.join("\n")}
|
|
|
141721
141982
|
const variableStatement = isVariableDeclaration(declaration) ? tryCast(declaration.parent.parent, isVariableStatement) : void 0;
|
|
141722
141983
|
return variableStatement && length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration;
|
|
141723
141984
|
}
|
|
141724
|
-
var
|
|
141985
|
+
var fixId20, errorCodes23;
|
|
141725
141986
|
var init_fixImportNonExportedMember = __esm({
|
|
141726
141987
|
"src/services/codefixes/fixImportNonExportedMember.ts"() {
|
|
141727
141988
|
"use strict";
|
|
141728
141989
|
init_ts4();
|
|
141729
141990
|
init_ts_codefix();
|
|
141730
|
-
|
|
141731
|
-
|
|
141991
|
+
fixId20 = "fixImportNonExportedMember";
|
|
141992
|
+
errorCodes23 = [
|
|
141732
141993
|
Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code
|
|
141733
141994
|
];
|
|
141734
141995
|
registerCodeFix({
|
|
141735
|
-
errorCodes:
|
|
141736
|
-
fixIds: [
|
|
141996
|
+
errorCodes: errorCodes23,
|
|
141997
|
+
fixIds: [fixId20],
|
|
141737
141998
|
getCodeActions(context) {
|
|
141738
141999
|
const { sourceFile, span, program } = context;
|
|
141739
142000
|
const info = getInfo4(sourceFile, span.start, program);
|
|
141740
142001
|
if (info === void 0)
|
|
141741
142002
|
return void 0;
|
|
141742
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141743
|
-
return [createCodeFixAction(
|
|
142003
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, program, info));
|
|
142004
|
+
return [createCodeFixAction(fixId20, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId20, Diagnostics.Export_all_referenced_locals)];
|
|
141744
142005
|
},
|
|
141745
142006
|
getAllCodeActions(context) {
|
|
141746
142007
|
const { program } = context;
|
|
141747
142008
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141748
142009
|
const exports = /* @__PURE__ */ new Map();
|
|
141749
|
-
eachDiagnostic(context,
|
|
142010
|
+
eachDiagnostic(context, errorCodes23, (diag2) => {
|
|
141750
142011
|
const info = getInfo4(diag2.file, diag2.start, program);
|
|
141751
142012
|
if (info === void 0)
|
|
141752
142013
|
return void 0;
|
|
@@ -141791,7 +142052,7 @@ ${lanes.join("\n")}
|
|
|
141791
142052
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141792
142053
|
return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */);
|
|
141793
142054
|
}
|
|
141794
|
-
function
|
|
142055
|
+
function doChange10(changes, sourceFile, namedTupleMember) {
|
|
141795
142056
|
if (!namedTupleMember) {
|
|
141796
142057
|
return;
|
|
141797
142058
|
}
|
|
@@ -141818,26 +142079,26 @@ ${lanes.join("\n")}
|
|
|
141818
142079
|
}
|
|
141819
142080
|
changes.replaceNode(sourceFile, namedTupleMember, updated);
|
|
141820
142081
|
}
|
|
141821
|
-
var
|
|
142082
|
+
var fixId21, errorCodes24;
|
|
141822
142083
|
var init_fixIncorrectNamedTupleSyntax = __esm({
|
|
141823
142084
|
"src/services/codefixes/fixIncorrectNamedTupleSyntax.ts"() {
|
|
141824
142085
|
"use strict";
|
|
141825
142086
|
init_ts4();
|
|
141826
142087
|
init_ts_codefix();
|
|
141827
|
-
|
|
141828
|
-
|
|
142088
|
+
fixId21 = "fixIncorrectNamedTupleSyntax";
|
|
142089
|
+
errorCodes24 = [
|
|
141829
142090
|
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
142091
|
Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code
|
|
141831
142092
|
];
|
|
141832
142093
|
registerCodeFix({
|
|
141833
|
-
errorCodes:
|
|
142094
|
+
errorCodes: errorCodes24,
|
|
141834
142095
|
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
141835
142096
|
const { sourceFile, span } = context;
|
|
141836
142097
|
const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
141837
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141838
|
-
return [createCodeFixAction(
|
|
142098
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, namedTupleMember));
|
|
142099
|
+
return [createCodeFixAction(fixId21, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId21, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
|
|
141839
142100
|
},
|
|
141840
|
-
fixIds: [
|
|
142101
|
+
fixIds: [fixId21]
|
|
141841
142102
|
});
|
|
141842
142103
|
}
|
|
141843
142104
|
});
|
|
@@ -141892,7 +142153,7 @@ ${lanes.join("\n")}
|
|
|
141892
142153
|
}
|
|
141893
142154
|
return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol };
|
|
141894
142155
|
}
|
|
141895
|
-
function
|
|
142156
|
+
function doChange11(changes, sourceFile, node, suggestedSymbol, target) {
|
|
141896
142157
|
const suggestion = symbolName(suggestedSymbol);
|
|
141897
142158
|
if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
|
|
141898
142159
|
const valDecl = suggestedSymbol.valueDeclaration;
|
|
@@ -141926,14 +142187,14 @@ ${lanes.join("\n")}
|
|
|
141926
142187
|
return void 0;
|
|
141927
142188
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
141928
142189
|
}
|
|
141929
|
-
var
|
|
142190
|
+
var fixId22, errorCodes25;
|
|
141930
142191
|
var init_fixSpelling = __esm({
|
|
141931
142192
|
"src/services/codefixes/fixSpelling.ts"() {
|
|
141932
142193
|
"use strict";
|
|
141933
142194
|
init_ts4();
|
|
141934
142195
|
init_ts_codefix();
|
|
141935
|
-
|
|
141936
|
-
|
|
142196
|
+
fixId22 = "fixSpelling";
|
|
142197
|
+
errorCodes25 = [
|
|
141937
142198
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141938
142199
|
Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141939
142200
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
@@ -141950,7 +142211,7 @@ ${lanes.join("\n")}
|
|
|
141950
142211
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code
|
|
141951
142212
|
];
|
|
141952
142213
|
registerCodeFix({
|
|
141953
|
-
errorCodes:
|
|
142214
|
+
errorCodes: errorCodes25,
|
|
141954
142215
|
getCodeActions(context) {
|
|
141955
142216
|
const { sourceFile, errorCode } = context;
|
|
141956
142217
|
const info = getInfo5(sourceFile, context.span.start, context, errorCode);
|
|
@@ -141958,15 +142219,15 @@ ${lanes.join("\n")}
|
|
|
141958
142219
|
return void 0;
|
|
141959
142220
|
const { node, suggestedSymbol } = info;
|
|
141960
142221
|
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)],
|
|
142222
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, node, suggestedSymbol, target));
|
|
142223
|
+
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId22, Diagnostics.Fix_all_detected_spelling_errors)];
|
|
141963
142224
|
},
|
|
141964
|
-
fixIds: [
|
|
141965
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142225
|
+
fixIds: [fixId22],
|
|
142226
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => {
|
|
141966
142227
|
const info = getInfo5(diag2.file, diag2.start, context, diag2.code);
|
|
141967
142228
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141968
142229
|
if (info)
|
|
141969
|
-
|
|
142230
|
+
doChange11(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
141970
142231
|
})
|
|
141971
142232
|
});
|
|
141972
142233
|
}
|
|
@@ -142150,7 +142411,7 @@ ${lanes.join("\n")}
|
|
|
142150
142411
|
}
|
|
142151
142412
|
function getActionForfixAddReturnStatement(context, expression, statement) {
|
|
142152
142413
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement));
|
|
142153
|
-
return createCodeFixAction(
|
|
142414
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement);
|
|
142154
142415
|
}
|
|
142155
142416
|
function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) {
|
|
142156
142417
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace(
|
|
@@ -142162,29 +142423,29 @@ ${lanes.join("\n")}
|
|
|
142162
142423
|
/* withParen */
|
|
142163
142424
|
false
|
|
142164
142425
|
));
|
|
142165
|
-
return createCodeFixAction(
|
|
142426
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues);
|
|
142166
142427
|
}
|
|
142167
142428
|
function getActionForfixWrapTheBlockWithParen(context, declaration, expression) {
|
|
142168
142429
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression));
|
|
142169
|
-
return createCodeFixAction(
|
|
142430
|
+
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
142431
|
}
|
|
142171
|
-
var
|
|
142432
|
+
var fixId23, fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen, errorCodes26;
|
|
142172
142433
|
var init_returnValueCorrect = __esm({
|
|
142173
142434
|
"src/services/codefixes/returnValueCorrect.ts"() {
|
|
142174
142435
|
"use strict";
|
|
142175
142436
|
init_ts4();
|
|
142176
142437
|
init_ts_codefix();
|
|
142177
|
-
|
|
142438
|
+
fixId23 = "returnValueCorrect";
|
|
142178
142439
|
fixIdAddReturnStatement = "fixAddReturnStatement";
|
|
142179
142440
|
fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody";
|
|
142180
142441
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142181
|
-
|
|
142442
|
+
errorCodes26 = [
|
|
142182
142443
|
Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
|
|
142183
142444
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142184
142445
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142185
142446
|
];
|
|
142186
142447
|
registerCodeFix({
|
|
142187
|
-
errorCodes:
|
|
142448
|
+
errorCodes: errorCodes26,
|
|
142188
142449
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
142189
142450
|
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
142190
142451
|
const { program, sourceFile, span: { start }, errorCode } = context;
|
|
@@ -142200,7 +142461,7 @@ ${lanes.join("\n")}
|
|
|
142200
142461
|
return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)];
|
|
142201
142462
|
}
|
|
142202
142463
|
},
|
|
142203
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142464
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => {
|
|
142204
142465
|
const info = getInfo6(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code);
|
|
142205
142466
|
if (!info)
|
|
142206
142467
|
return void 0;
|
|
@@ -142766,7 +143027,7 @@ ${lanes.join("\n")}
|
|
|
142766
143027
|
}
|
|
142767
143028
|
return getSourceFileOfNode(node);
|
|
142768
143029
|
}
|
|
142769
|
-
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration,
|
|
143030
|
+
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration, errorCodes27;
|
|
142770
143031
|
var init_fixAddMissingMember = __esm({
|
|
142771
143032
|
"src/services/codefixes/fixAddMissingMember.ts"() {
|
|
142772
143033
|
"use strict";
|
|
@@ -142776,7 +143037,7 @@ ${lanes.join("\n")}
|
|
|
142776
143037
|
fixMissingProperties = "fixMissingProperties";
|
|
142777
143038
|
fixMissingAttributes = "fixMissingAttributes";
|
|
142778
143039
|
fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration";
|
|
142779
|
-
|
|
143040
|
+
errorCodes27 = [
|
|
142780
143041
|
Diagnostics.Property_0_does_not_exist_on_type_1.code,
|
|
142781
143042
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
142782
143043
|
Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code,
|
|
@@ -142786,7 +143047,7 @@ ${lanes.join("\n")}
|
|
|
142786
143047
|
Diagnostics.Cannot_find_name_0.code
|
|
142787
143048
|
];
|
|
142788
143049
|
registerCodeFix({
|
|
142789
|
-
errorCodes:
|
|
143050
|
+
errorCodes: errorCodes27,
|
|
142790
143051
|
getCodeActions(context) {
|
|
142791
143052
|
const typeChecker = context.program.getTypeChecker();
|
|
142792
143053
|
const info = getInfo7(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program);
|
|
@@ -142813,21 +143074,21 @@ ${lanes.join("\n")}
|
|
|
142813
143074
|
},
|
|
142814
143075
|
fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
|
|
142815
143076
|
getAllCodeActions: (context) => {
|
|
142816
|
-
const { program, fixId:
|
|
143077
|
+
const { program, fixId: fixId52 } = context;
|
|
142817
143078
|
const checker = program.getTypeChecker();
|
|
142818
143079
|
const seen = /* @__PURE__ */ new Map();
|
|
142819
143080
|
const typeDeclToMembers = /* @__PURE__ */ new Map();
|
|
142820
143081
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
142821
|
-
eachDiagnostic(context,
|
|
143082
|
+
eachDiagnostic(context, errorCodes27, (diag2) => {
|
|
142822
143083
|
const info = getInfo7(diag2.file, diag2.start, diag2.code, checker, context.program);
|
|
142823
143084
|
if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
142824
143085
|
return;
|
|
142825
143086
|
}
|
|
142826
|
-
if (
|
|
143087
|
+
if (fixId52 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
|
142827
143088
|
addFunctionDeclaration(changes, context, info);
|
|
142828
|
-
} else if (
|
|
143089
|
+
} else if (fixId52 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
|
142829
143090
|
addObjectLiteralProperties(changes, context, info);
|
|
142830
|
-
} else if (
|
|
143091
|
+
} else if (fixId52 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
|
|
142831
143092
|
addJsxAttributes(changes, context, info);
|
|
142832
143093
|
} else {
|
|
142833
143094
|
if (info.kind === 1 /* Enum */) {
|
|
@@ -142883,23 +143144,23 @@ ${lanes.join("\n")}
|
|
|
142883
143144
|
}
|
|
142884
143145
|
return token;
|
|
142885
143146
|
}
|
|
142886
|
-
var
|
|
143147
|
+
var fixId24, errorCodes28;
|
|
142887
143148
|
var init_fixAddMissingNewOperator = __esm({
|
|
142888
143149
|
"src/services/codefixes/fixAddMissingNewOperator.ts"() {
|
|
142889
143150
|
"use strict";
|
|
142890
143151
|
init_ts4();
|
|
142891
143152
|
init_ts_codefix();
|
|
142892
|
-
|
|
142893
|
-
|
|
143153
|
+
fixId24 = "addMissingNewOperator";
|
|
143154
|
+
errorCodes28 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
|
142894
143155
|
registerCodeFix({
|
|
142895
|
-
errorCodes:
|
|
143156
|
+
errorCodes: errorCodes28,
|
|
142896
143157
|
getCodeActions(context) {
|
|
142897
143158
|
const { sourceFile, span } = context;
|
|
142898
143159
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span));
|
|
142899
|
-
return [createCodeFixAction(
|
|
143160
|
+
return [createCodeFixAction(fixId24, changes, Diagnostics.Add_missing_new_operator_to_call, fixId24, Diagnostics.Add_missing_new_operator_to_all_calls)];
|
|
142900
143161
|
},
|
|
142901
|
-
fixIds: [
|
|
142902
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143162
|
+
fixIds: [fixId24],
|
|
143163
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes28, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2))
|
|
142903
143164
|
});
|
|
142904
143165
|
}
|
|
142905
143166
|
});
|
|
@@ -142920,7 +143181,7 @@ ${lanes.join("\n")}
|
|
|
142920
143181
|
var _a2;
|
|
142921
143182
|
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
143183
|
}
|
|
142923
|
-
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule,
|
|
143184
|
+
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes29;
|
|
142924
143185
|
var init_fixCannotFindModule = __esm({
|
|
142925
143186
|
"src/services/codefixes/fixCannotFindModule.ts"() {
|
|
142926
143187
|
"use strict";
|
|
@@ -142929,12 +143190,12 @@ ${lanes.join("\n")}
|
|
|
142929
143190
|
fixName2 = "fixCannotFindModule";
|
|
142930
143191
|
fixIdInstallTypesPackage = "installTypesPackage";
|
|
142931
143192
|
errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
142932
|
-
|
|
143193
|
+
errorCodes29 = [
|
|
142933
143194
|
errorCodeCannotFindModule,
|
|
142934
143195
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
142935
143196
|
];
|
|
142936
143197
|
registerCodeFix({
|
|
142937
|
-
errorCodes:
|
|
143198
|
+
errorCodes: errorCodes29,
|
|
142938
143199
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
142939
143200
|
const { host, sourceFile, span: { start } } = context;
|
|
142940
143201
|
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
@@ -142953,7 +143214,7 @@ ${lanes.join("\n")}
|
|
|
142953
143214
|
},
|
|
142954
143215
|
fixIds: [fixIdInstallTypesPackage],
|
|
142955
143216
|
getAllCodeActions: (context) => {
|
|
142956
|
-
return codeFixAll(context,
|
|
143217
|
+
return codeFixAll(context, errorCodes29, (_changes, diag2, commands) => {
|
|
142957
143218
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
142958
143219
|
if (packageName === void 0)
|
|
142959
143220
|
return void 0;
|
|
@@ -142992,28 +143253,28 @@ ${lanes.join("\n")}
|
|
|
142992
143253
|
const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()));
|
|
142993
143254
|
return !(flags & 8 /* Private */) && !!(flags & 256 /* Abstract */);
|
|
142994
143255
|
}
|
|
142995
|
-
var
|
|
143256
|
+
var errorCodes30, fixId25;
|
|
142996
143257
|
var init_fixClassDoesntImplementInheritedAbstractMember = __esm({
|
|
142997
143258
|
"src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"() {
|
|
142998
143259
|
"use strict";
|
|
142999
143260
|
init_ts4();
|
|
143000
143261
|
init_ts_codefix();
|
|
143001
|
-
|
|
143262
|
+
errorCodes30 = [
|
|
143002
143263
|
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
143003
143264
|
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code
|
|
143004
143265
|
];
|
|
143005
|
-
|
|
143266
|
+
fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
143006
143267
|
registerCodeFix({
|
|
143007
|
-
errorCodes:
|
|
143268
|
+
errorCodes: errorCodes30,
|
|
143008
143269
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
143009
143270
|
const { sourceFile, span } = context;
|
|
143010
143271
|
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(
|
|
143272
|
+
return changes.length === 0 ? void 0 : [createCodeFixAction(fixId25, changes, Diagnostics.Implement_inherited_abstract_class, fixId25, Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
143012
143273
|
},
|
|
143013
|
-
fixIds: [
|
|
143274
|
+
fixIds: [fixId25],
|
|
143014
143275
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
143015
143276
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
143016
|
-
return codeFixAll(context,
|
|
143277
|
+
return codeFixAll(context, errorCodes30, (changes, diag2) => {
|
|
143017
143278
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
143018
143279
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
143019
143280
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -143025,7 +143286,7 @@ ${lanes.join("\n")}
|
|
|
143025
143286
|
});
|
|
143026
143287
|
|
|
143027
143288
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
143028
|
-
function
|
|
143289
|
+
function doChange12(changes, sourceFile, constructor, superCall) {
|
|
143029
143290
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
143030
143291
|
changes.delete(sourceFile, superCall);
|
|
143031
143292
|
}
|
|
@@ -143040,36 +143301,36 @@ ${lanes.join("\n")}
|
|
|
143040
143301
|
function findSuperCall(n) {
|
|
143041
143302
|
return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild(n, findSuperCall);
|
|
143042
143303
|
}
|
|
143043
|
-
var
|
|
143304
|
+
var fixId26, errorCodes31;
|
|
143044
143305
|
var init_fixClassSuperMustPrecedeThisAccess = __esm({
|
|
143045
143306
|
"src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts"() {
|
|
143046
143307
|
"use strict";
|
|
143047
143308
|
init_ts4();
|
|
143048
143309
|
init_ts_codefix();
|
|
143049
|
-
|
|
143050
|
-
|
|
143310
|
+
fixId26 = "classSuperMustPrecedeThisAccess";
|
|
143311
|
+
errorCodes31 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
143051
143312
|
registerCodeFix({
|
|
143052
|
-
errorCodes:
|
|
143313
|
+
errorCodes: errorCodes31,
|
|
143053
143314
|
getCodeActions(context) {
|
|
143054
143315
|
const { sourceFile, span } = context;
|
|
143055
143316
|
const nodes = getNodes(sourceFile, span.start);
|
|
143056
143317
|
if (!nodes)
|
|
143057
143318
|
return void 0;
|
|
143058
143319
|
const { constructor, superCall } = nodes;
|
|
143059
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143060
|
-
return [createCodeFixAction(
|
|
143320
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, constructor, superCall));
|
|
143321
|
+
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
143322
|
},
|
|
143062
|
-
fixIds: [
|
|
143323
|
+
fixIds: [fixId26],
|
|
143063
143324
|
getAllCodeActions(context) {
|
|
143064
143325
|
const { sourceFile } = context;
|
|
143065
143326
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
143066
|
-
return codeFixAll(context,
|
|
143327
|
+
return codeFixAll(context, errorCodes31, (changes, diag2) => {
|
|
143067
143328
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
143068
143329
|
if (!nodes)
|
|
143069
143330
|
return;
|
|
143070
143331
|
const { constructor, superCall } = nodes;
|
|
143071
143332
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
143072
|
-
|
|
143333
|
+
doChange12(changes, sourceFile, constructor, superCall);
|
|
143073
143334
|
}
|
|
143074
143335
|
});
|
|
143075
143336
|
}
|
|
@@ -143083,7 +143344,7 @@ ${lanes.join("\n")}
|
|
|
143083
143344
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
143084
143345
|
return token.parent;
|
|
143085
143346
|
}
|
|
143086
|
-
function
|
|
143347
|
+
function doChange13(changes, sourceFile, ctr) {
|
|
143087
143348
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
143088
143349
|
factory.createSuper(),
|
|
143089
143350
|
/*typeArguments*/
|
|
@@ -143093,42 +143354,42 @@ ${lanes.join("\n")}
|
|
|
143093
143354
|
));
|
|
143094
143355
|
changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall);
|
|
143095
143356
|
}
|
|
143096
|
-
var
|
|
143357
|
+
var fixId27, errorCodes32;
|
|
143097
143358
|
var init_fixConstructorForDerivedNeedSuperCall = __esm({
|
|
143098
143359
|
"src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts"() {
|
|
143099
143360
|
"use strict";
|
|
143100
143361
|
init_ts4();
|
|
143101
143362
|
init_ts_codefix();
|
|
143102
|
-
|
|
143103
|
-
|
|
143363
|
+
fixId27 = "constructorForDerivedNeedSuperCall";
|
|
143364
|
+
errorCodes32 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
143104
143365
|
registerCodeFix({
|
|
143105
|
-
errorCodes:
|
|
143366
|
+
errorCodes: errorCodes32,
|
|
143106
143367
|
getCodeActions(context) {
|
|
143107
143368
|
const { sourceFile, span } = context;
|
|
143108
143369
|
const ctr = getNode(sourceFile, span.start);
|
|
143109
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143110
|
-
return [createCodeFixAction(
|
|
143370
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, ctr));
|
|
143371
|
+
return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
|
|
143111
143372
|
},
|
|
143112
|
-
fixIds: [
|
|
143113
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143373
|
+
fixIds: [fixId27],
|
|
143374
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes, diag2) => doChange13(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
143114
143375
|
});
|
|
143115
143376
|
}
|
|
143116
143377
|
});
|
|
143117
143378
|
|
|
143118
143379
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
143119
|
-
function
|
|
143380
|
+
function doChange14(changeTracker, configFile) {
|
|
143120
143381
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
143121
143382
|
}
|
|
143122
|
-
var fixID,
|
|
143383
|
+
var fixID, errorCodes33;
|
|
143123
143384
|
var init_fixEnableJsxFlag = __esm({
|
|
143124
143385
|
"src/services/codefixes/fixEnableJsxFlag.ts"() {
|
|
143125
143386
|
"use strict";
|
|
143126
143387
|
init_ts4();
|
|
143127
143388
|
init_ts_codefix();
|
|
143128
143389
|
fixID = "fixEnableJsxFlag";
|
|
143129
|
-
|
|
143390
|
+
errorCodes33 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
143130
143391
|
registerCodeFix({
|
|
143131
|
-
errorCodes:
|
|
143392
|
+
errorCodes: errorCodes33,
|
|
143132
143393
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
143133
143394
|
const { configFile } = context.program.getCompilerOptions();
|
|
143134
143395
|
if (configFile === void 0) {
|
|
@@ -143136,19 +143397,19 @@ ${lanes.join("\n")}
|
|
|
143136
143397
|
}
|
|
143137
143398
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
143138
143399
|
context,
|
|
143139
|
-
(changeTracker) =>
|
|
143400
|
+
(changeTracker) => doChange14(changeTracker, configFile)
|
|
143140
143401
|
);
|
|
143141
143402
|
return [
|
|
143142
143403
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
143143
143404
|
];
|
|
143144
143405
|
},
|
|
143145
143406
|
fixIds: [fixID],
|
|
143146
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143407
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes) => {
|
|
143147
143408
|
const { configFile } = context.program.getCompilerOptions();
|
|
143148
143409
|
if (configFile === void 0) {
|
|
143149
143410
|
return void 0;
|
|
143150
143411
|
}
|
|
143151
|
-
|
|
143412
|
+
doChange14(changes, configFile);
|
|
143152
143413
|
})
|
|
143153
143414
|
});
|
|
143154
143415
|
}
|
|
@@ -143170,7 +143431,7 @@ ${lanes.join("\n")}
|
|
|
143170
143431
|
}
|
|
143171
143432
|
return void 0;
|
|
143172
143433
|
}
|
|
143173
|
-
function
|
|
143434
|
+
function doChange15(changes, sourceFile, arg, expression) {
|
|
143174
143435
|
const callExpression = factory.createCallExpression(
|
|
143175
143436
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
143176
143437
|
/*typeArguments*/
|
|
@@ -143188,33 +143449,33 @@ ${lanes.join("\n")}
|
|
|
143188
143449
|
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [];
|
|
143189
143450
|
return suggestion;
|
|
143190
143451
|
}
|
|
143191
|
-
var
|
|
143452
|
+
var fixId28, errorCodes34;
|
|
143192
143453
|
var init_fixNaNEquality = __esm({
|
|
143193
143454
|
"src/services/codefixes/fixNaNEquality.ts"() {
|
|
143194
143455
|
"use strict";
|
|
143195
143456
|
init_ts4();
|
|
143196
143457
|
init_ts_codefix();
|
|
143197
|
-
|
|
143198
|
-
|
|
143458
|
+
fixId28 = "fixNaNEquality";
|
|
143459
|
+
errorCodes34 = [
|
|
143199
143460
|
Diagnostics.This_condition_will_always_return_0.code
|
|
143200
143461
|
];
|
|
143201
143462
|
registerCodeFix({
|
|
143202
|
-
errorCodes:
|
|
143463
|
+
errorCodes: errorCodes34,
|
|
143203
143464
|
getCodeActions(context) {
|
|
143204
143465
|
const { sourceFile, span, program } = context;
|
|
143205
143466
|
const info = getInfo8(program, sourceFile, span);
|
|
143206
143467
|
if (info === void 0)
|
|
143207
143468
|
return;
|
|
143208
143469
|
const { suggestion, expression, arg } = info;
|
|
143209
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143210
|
-
return [createCodeFixAction(
|
|
143470
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, arg, expression));
|
|
143471
|
+
return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
143211
143472
|
},
|
|
143212
|
-
fixIds: [
|
|
143473
|
+
fixIds: [fixId28],
|
|
143213
143474
|
getAllCodeActions: (context) => {
|
|
143214
|
-
return codeFixAll(context,
|
|
143475
|
+
return codeFixAll(context, errorCodes34, (changes, diag2) => {
|
|
143215
143476
|
const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
143216
143477
|
if (info) {
|
|
143217
|
-
|
|
143478
|
+
doChange15(changes, diag2.file, info.arg, info.expression);
|
|
143218
143479
|
}
|
|
143219
143480
|
});
|
|
143220
143481
|
}
|
|
@@ -143270,32 +143531,32 @@ ${lanes.join("\n")}
|
|
|
143270
143531
|
});
|
|
143271
143532
|
|
|
143272
143533
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
143273
|
-
function
|
|
143534
|
+
function doChange16(changes, sourceFile, node) {
|
|
143274
143535
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
143275
143536
|
}
|
|
143276
143537
|
function getProperty2(sourceFile, pos) {
|
|
143277
143538
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment);
|
|
143278
143539
|
}
|
|
143279
|
-
var
|
|
143540
|
+
var fixId29, errorCodes35;
|
|
143280
143541
|
var init_fixPropertyAssignment = __esm({
|
|
143281
143542
|
"src/services/codefixes/fixPropertyAssignment.ts"() {
|
|
143282
143543
|
"use strict";
|
|
143283
143544
|
init_ts4();
|
|
143284
143545
|
init_ts_codefix();
|
|
143285
|
-
|
|
143286
|
-
|
|
143546
|
+
fixId29 = "fixPropertyAssignment";
|
|
143547
|
+
errorCodes35 = [
|
|
143287
143548
|
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
143549
|
];
|
|
143289
143550
|
registerCodeFix({
|
|
143290
|
-
errorCodes:
|
|
143291
|
-
fixIds: [
|
|
143551
|
+
errorCodes: errorCodes35,
|
|
143552
|
+
fixIds: [fixId29],
|
|
143292
143553
|
getCodeActions(context) {
|
|
143293
143554
|
const { sourceFile, span } = context;
|
|
143294
143555
|
const property = getProperty2(sourceFile, span.start);
|
|
143295
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143296
|
-
return [createCodeFixAction(
|
|
143556
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, context.sourceFile, property));
|
|
143557
|
+
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
143297
143558
|
},
|
|
143298
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143559
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => doChange16(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
143299
143560
|
});
|
|
143300
143561
|
}
|
|
143301
143562
|
});
|
|
@@ -143321,16 +143582,16 @@ ${lanes.join("\n")}
|
|
|
143321
143582
|
changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end });
|
|
143322
143583
|
}
|
|
143323
143584
|
}
|
|
143324
|
-
var
|
|
143585
|
+
var fixId30, errorCodes36;
|
|
143325
143586
|
var init_fixExtendsInterfaceBecomesImplements = __esm({
|
|
143326
143587
|
"src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts"() {
|
|
143327
143588
|
"use strict";
|
|
143328
143589
|
init_ts4();
|
|
143329
143590
|
init_ts_codefix();
|
|
143330
|
-
|
|
143331
|
-
|
|
143591
|
+
fixId30 = "extendsInterfaceBecomesImplements";
|
|
143592
|
+
errorCodes36 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
143332
143593
|
registerCodeFix({
|
|
143333
|
-
errorCodes:
|
|
143594
|
+
errorCodes: errorCodes36,
|
|
143334
143595
|
getCodeActions(context) {
|
|
143335
143596
|
const { sourceFile } = context;
|
|
143336
143597
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
@@ -143338,10 +143599,10 @@ ${lanes.join("\n")}
|
|
|
143338
143599
|
return void 0;
|
|
143339
143600
|
const { extendsToken, heritageClauses } = nodes;
|
|
143340
143601
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses));
|
|
143341
|
-
return [createCodeFixAction(
|
|
143602
|
+
return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
143342
143603
|
},
|
|
143343
|
-
fixIds: [
|
|
143344
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143604
|
+
fixIds: [fixId30],
|
|
143605
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
|
|
143345
143606
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
143346
143607
|
if (nodes)
|
|
143347
143608
|
doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
@@ -143357,39 +143618,39 @@ ${lanes.join("\n")}
|
|
|
143357
143618
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
143358
143619
|
}
|
|
143359
143620
|
}
|
|
143360
|
-
function
|
|
143621
|
+
function doChange17(changes, sourceFile, { node, className }) {
|
|
143361
143622
|
suppressLeadingAndTrailingTrivia(node);
|
|
143362
143623
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
143363
143624
|
}
|
|
143364
|
-
var
|
|
143625
|
+
var fixId31, didYouMeanStaticMemberCode, errorCodes37;
|
|
143365
143626
|
var init_fixForgottenThisPropertyAccess = __esm({
|
|
143366
143627
|
"src/services/codefixes/fixForgottenThisPropertyAccess.ts"() {
|
|
143367
143628
|
"use strict";
|
|
143368
143629
|
init_ts4();
|
|
143369
143630
|
init_ts_codefix();
|
|
143370
|
-
|
|
143631
|
+
fixId31 = "forgottenThisPropertyAccess";
|
|
143371
143632
|
didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
143372
|
-
|
|
143633
|
+
errorCodes37 = [
|
|
143373
143634
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
143374
143635
|
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
143636
|
didYouMeanStaticMemberCode
|
|
143376
143637
|
];
|
|
143377
143638
|
registerCodeFix({
|
|
143378
|
-
errorCodes:
|
|
143639
|
+
errorCodes: errorCodes37,
|
|
143379
143640
|
getCodeActions(context) {
|
|
143380
143641
|
const { sourceFile } = context;
|
|
143381
143642
|
const info = getInfo9(sourceFile, context.span.start, context.errorCode);
|
|
143382
143643
|
if (!info) {
|
|
143383
143644
|
return void 0;
|
|
143384
143645
|
}
|
|
143385
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143386
|
-
return [createCodeFixAction(
|
|
143646
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, info));
|
|
143647
|
+
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
143648
|
},
|
|
143388
|
-
fixIds: [
|
|
143389
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143649
|
+
fixIds: [fixId31],
|
|
143650
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
|
|
143390
143651
|
const info = getInfo9(diag2.file, diag2.start, diag2.code);
|
|
143391
143652
|
if (info)
|
|
143392
|
-
|
|
143653
|
+
doChange17(changes, context.sourceFile, info);
|
|
143393
143654
|
})
|
|
143394
143655
|
});
|
|
143395
143656
|
}
|
|
@@ -143399,7 +143660,7 @@ ${lanes.join("\n")}
|
|
|
143399
143660
|
function isValidCharacter(character) {
|
|
143400
143661
|
return hasProperty(htmlEntity, character);
|
|
143401
143662
|
}
|
|
143402
|
-
function
|
|
143663
|
+
function doChange18(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
143403
143664
|
const character = sourceFile.getText()[start];
|
|
143404
143665
|
if (!isValidCharacter(character)) {
|
|
143405
143666
|
return;
|
|
@@ -143407,7 +143668,7 @@ ${lanes.join("\n")}
|
|
|
143407
143668
|
const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`;
|
|
143408
143669
|
changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement);
|
|
143409
143670
|
}
|
|
143410
|
-
var fixIdExpression, fixIdHtmlEntity,
|
|
143671
|
+
var fixIdExpression, fixIdHtmlEntity, errorCodes38, htmlEntity;
|
|
143411
143672
|
var init_fixInvalidJsxCharacters = __esm({
|
|
143412
143673
|
"src/services/codefixes/fixInvalidJsxCharacters.ts"() {
|
|
143413
143674
|
"use strict";
|
|
@@ -143415,16 +143676,16 @@ ${lanes.join("\n")}
|
|
|
143415
143676
|
init_ts_codefix();
|
|
143416
143677
|
fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
143417
143678
|
fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
143418
|
-
|
|
143679
|
+
errorCodes38 = [
|
|
143419
143680
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
143420
143681
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
143421
143682
|
];
|
|
143422
143683
|
registerCodeFix({
|
|
143423
|
-
errorCodes:
|
|
143684
|
+
errorCodes: errorCodes38,
|
|
143424
143685
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
143425
143686
|
getCodeActions(context) {
|
|
143426
143687
|
const { sourceFile, preferences, span } = context;
|
|
143427
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143688
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143428
143689
|
t,
|
|
143429
143690
|
preferences,
|
|
143430
143691
|
sourceFile,
|
|
@@ -143432,7 +143693,7 @@ ${lanes.join("\n")}
|
|
|
143432
143693
|
/* useHtmlEntity */
|
|
143433
143694
|
false
|
|
143434
143695
|
));
|
|
143435
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143696
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143436
143697
|
t,
|
|
143437
143698
|
preferences,
|
|
143438
143699
|
sourceFile,
|
|
@@ -143446,7 +143707,7 @@ ${lanes.join("\n")}
|
|
|
143446
143707
|
];
|
|
143447
143708
|
},
|
|
143448
143709
|
getAllCodeActions(context) {
|
|
143449
|
-
return codeFixAll(context,
|
|
143710
|
+
return codeFixAll(context, errorCodes38, (changes, diagnostic) => doChange18(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
143450
143711
|
}
|
|
143451
143712
|
});
|
|
143452
143713
|
htmlEntity = {
|
|
@@ -143505,7 +143766,7 @@ ${lanes.join("\n")}
|
|
|
143505
143766
|
}
|
|
143506
143767
|
return void 0;
|
|
143507
143768
|
}
|
|
143508
|
-
var deleteUnmatchedParameter, renameUnmatchedParameter,
|
|
143769
|
+
var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes39;
|
|
143509
143770
|
var init_fixUnmatchedParameter = __esm({
|
|
143510
143771
|
"src/services/codefixes/fixUnmatchedParameter.ts"() {
|
|
143511
143772
|
"use strict";
|
|
@@ -143513,12 +143774,12 @@ ${lanes.join("\n")}
|
|
|
143513
143774
|
init_ts_codefix();
|
|
143514
143775
|
deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
143515
143776
|
renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
143516
|
-
|
|
143777
|
+
errorCodes39 = [
|
|
143517
143778
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
143518
143779
|
];
|
|
143519
143780
|
registerCodeFix({
|
|
143520
143781
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
143521
|
-
errorCodes:
|
|
143782
|
+
errorCodes: errorCodes39,
|
|
143522
143783
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
143523
143784
|
const { sourceFile, span } = context;
|
|
143524
143785
|
const actions2 = [];
|
|
@@ -143533,7 +143794,7 @@ ${lanes.join("\n")}
|
|
|
143533
143794
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
143534
143795
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
143535
143796
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
143536
|
-
eachDiagnostic(context,
|
|
143797
|
+
eachDiagnostic(context, errorCodes39, ({ file, start }) => {
|
|
143537
143798
|
const info = getInfo10(file, start);
|
|
143538
143799
|
if (info) {
|
|
143539
143800
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
@@ -143582,16 +143843,16 @@ ${lanes.join("\n")}
|
|
|
143582
143843
|
function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
|
|
143583
143844
|
ts_refactor_exports.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
|
|
143584
143845
|
}
|
|
143585
|
-
var
|
|
143846
|
+
var fixId32, errorCodes40;
|
|
143586
143847
|
var init_fixUnreferenceableDecoratorMetadata = __esm({
|
|
143587
143848
|
"src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts"() {
|
|
143588
143849
|
"use strict";
|
|
143589
143850
|
init_ts4();
|
|
143590
143851
|
init_ts_codefix();
|
|
143591
|
-
|
|
143592
|
-
|
|
143852
|
+
fixId32 = "fixUnreferenceableDecoratorMetadata";
|
|
143853
|
+
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
143854
|
registerCodeFix({
|
|
143594
|
-
errorCodes:
|
|
143855
|
+
errorCodes: errorCodes40,
|
|
143595
143856
|
getCodeActions: (context) => {
|
|
143596
143857
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
143597
143858
|
if (!importDeclaration)
|
|
@@ -143600,14 +143861,14 @@ ${lanes.join("\n")}
|
|
|
143600
143861
|
const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program));
|
|
143601
143862
|
let actions2;
|
|
143602
143863
|
if (namespaceChanges.length) {
|
|
143603
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143864
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
143604
143865
|
}
|
|
143605
143866
|
if (typeOnlyChanges.length) {
|
|
143606
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143867
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
|
|
143607
143868
|
}
|
|
143608
143869
|
return actions2;
|
|
143609
143870
|
},
|
|
143610
|
-
fixIds: [
|
|
143871
|
+
fixIds: [fixId32]
|
|
143611
143872
|
});
|
|
143612
143873
|
}
|
|
143613
143874
|
});
|
|
@@ -143760,7 +144021,7 @@ ${lanes.join("\n")}
|
|
|
143760
144021
|
function mayDeleteExpression(node) {
|
|
143761
144022
|
return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent);
|
|
143762
144023
|
}
|
|
143763
|
-
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer,
|
|
144024
|
+
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes41;
|
|
143764
144025
|
var init_fixUnusedIdentifier = __esm({
|
|
143765
144026
|
"src/services/codefixes/fixUnusedIdentifier.ts"() {
|
|
143766
144027
|
"use strict";
|
|
@@ -143771,7 +144032,7 @@ ${lanes.join("\n")}
|
|
|
143771
144032
|
fixIdDelete = "unusedIdentifier_delete";
|
|
143772
144033
|
fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
143773
144034
|
fixIdInfer = "unusedIdentifier_infer";
|
|
143774
|
-
|
|
144035
|
+
errorCodes41 = [
|
|
143775
144036
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
143776
144037
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
143777
144038
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -143781,7 +144042,7 @@ ${lanes.join("\n")}
|
|
|
143781
144042
|
Diagnostics.All_type_parameters_are_unused.code
|
|
143782
144043
|
];
|
|
143783
144044
|
registerCodeFix({
|
|
143784
|
-
errorCodes:
|
|
144045
|
+
errorCodes: errorCodes41,
|
|
143785
144046
|
getCodeActions(context) {
|
|
143786
144047
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
143787
144048
|
const checker = program.getTypeChecker();
|
|
@@ -143867,7 +144128,7 @@ ${lanes.join("\n")}
|
|
|
143867
144128
|
const { sourceFile, program, cancellationToken } = context;
|
|
143868
144129
|
const checker = program.getTypeChecker();
|
|
143869
144130
|
const sourceFiles = program.getSourceFiles();
|
|
143870
|
-
return codeFixAll(context,
|
|
144131
|
+
return codeFixAll(context, errorCodes41, (changes, diag2) => {
|
|
143871
144132
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
143872
144133
|
switch (context.fixId) {
|
|
143873
144134
|
case fixIdPrefix:
|
|
@@ -143939,7 +144200,7 @@ ${lanes.join("\n")}
|
|
|
143939
144200
|
});
|
|
143940
144201
|
|
|
143941
144202
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
143942
|
-
function
|
|
144203
|
+
function doChange19(changes, sourceFile, start, length2, errorCode) {
|
|
143943
144204
|
const token = getTokenAtPosition(sourceFile, start);
|
|
143944
144205
|
const statement = findAncestor(token, isStatement);
|
|
143945
144206
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -143987,31 +144248,31 @@ ${lanes.join("\n")}
|
|
|
143987
144248
|
}
|
|
143988
144249
|
return last2;
|
|
143989
144250
|
}
|
|
143990
|
-
var
|
|
144251
|
+
var fixId33, errorCodes42;
|
|
143991
144252
|
var init_fixUnreachableCode = __esm({
|
|
143992
144253
|
"src/services/codefixes/fixUnreachableCode.ts"() {
|
|
143993
144254
|
"use strict";
|
|
143994
144255
|
init_ts4();
|
|
143995
144256
|
init_ts_codefix();
|
|
143996
|
-
|
|
143997
|
-
|
|
144257
|
+
fixId33 = "fixUnreachableCode";
|
|
144258
|
+
errorCodes42 = [Diagnostics.Unreachable_code_detected.code];
|
|
143998
144259
|
registerCodeFix({
|
|
143999
|
-
errorCodes:
|
|
144260
|
+
errorCodes: errorCodes42,
|
|
144000
144261
|
getCodeActions(context) {
|
|
144001
144262
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
144002
144263
|
if (syntacticDiagnostics.length)
|
|
144003
144264
|
return;
|
|
144004
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144005
|
-
return [createCodeFixAction(
|
|
144265
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
144266
|
+
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
|
|
144006
144267
|
},
|
|
144007
|
-
fixIds: [
|
|
144008
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144268
|
+
fixIds: [fixId33],
|
|
144269
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
144009
144270
|
});
|
|
144010
144271
|
}
|
|
144011
144272
|
});
|
|
144012
144273
|
|
|
144013
144274
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
144014
|
-
function
|
|
144275
|
+
function doChange20(changes, sourceFile, start) {
|
|
144015
144276
|
const token = getTokenAtPosition(sourceFile, start);
|
|
144016
144277
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
144017
144278
|
const pos = token.getStart(sourceFile);
|
|
@@ -144024,28 +144285,28 @@ ${lanes.join("\n")}
|
|
|
144024
144285
|
);
|
|
144025
144286
|
changes.deleteRange(sourceFile, { pos, end });
|
|
144026
144287
|
}
|
|
144027
|
-
var
|
|
144288
|
+
var fixId34, errorCodes43;
|
|
144028
144289
|
var init_fixUnusedLabel = __esm({
|
|
144029
144290
|
"src/services/codefixes/fixUnusedLabel.ts"() {
|
|
144030
144291
|
"use strict";
|
|
144031
144292
|
init_ts4();
|
|
144032
144293
|
init_ts_codefix();
|
|
144033
|
-
|
|
144034
|
-
|
|
144294
|
+
fixId34 = "fixUnusedLabel";
|
|
144295
|
+
errorCodes43 = [Diagnostics.Unused_label.code];
|
|
144035
144296
|
registerCodeFix({
|
|
144036
|
-
errorCodes:
|
|
144297
|
+
errorCodes: errorCodes43,
|
|
144037
144298
|
getCodeActions(context) {
|
|
144038
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144039
|
-
return [createCodeFixAction(
|
|
144299
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, context.span.start));
|
|
144300
|
+
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
|
|
144040
144301
|
},
|
|
144041
|
-
fixIds: [
|
|
144042
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144302
|
+
fixIds: [fixId34],
|
|
144303
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange20(changes, diag2.file, diag2.start))
|
|
144043
144304
|
});
|
|
144044
144305
|
}
|
|
144045
144306
|
});
|
|
144046
144307
|
|
|
144047
144308
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
144048
|
-
function
|
|
144309
|
+
function doChange21(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
144049
144310
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
144050
144311
|
newType,
|
|
144051
144312
|
/*enclosingDeclaration*/
|
|
@@ -144094,7 +144355,7 @@ ${lanes.join("\n")}
|
|
|
144094
144355
|
}
|
|
144095
144356
|
return checker.getTypeFromTypeNode(node);
|
|
144096
144357
|
}
|
|
144097
|
-
var fixIdPlain, fixIdNullable,
|
|
144358
|
+
var fixIdPlain, fixIdNullable, errorCodes44;
|
|
144098
144359
|
var init_fixJSDocTypes = __esm({
|
|
144099
144360
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
144100
144361
|
"use strict";
|
|
@@ -144102,13 +144363,13 @@ ${lanes.join("\n")}
|
|
|
144102
144363
|
init_ts_codefix();
|
|
144103
144364
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
144104
144365
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
144105
|
-
|
|
144366
|
+
errorCodes44 = [
|
|
144106
144367
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
144107
144368
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
144108
144369
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
144109
144370
|
];
|
|
144110
144371
|
registerCodeFix({
|
|
144111
|
-
errorCodes:
|
|
144372
|
+
errorCodes: errorCodes44,
|
|
144112
144373
|
getCodeActions(context) {
|
|
144113
144374
|
const { sourceFile } = context;
|
|
144114
144375
|
const checker = context.program.getTypeChecker();
|
|
@@ -144122,22 +144383,22 @@ ${lanes.join("\n")}
|
|
|
144122
144383
|
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
144123
144384
|
}
|
|
144124
144385
|
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)],
|
|
144386
|
+
function fix(type2, fixId52, fixAllDescription) {
|
|
144387
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, typeNode, type2, checker));
|
|
144388
|
+
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
|
|
144128
144389
|
}
|
|
144129
144390
|
},
|
|
144130
144391
|
fixIds: [fixIdPlain, fixIdNullable],
|
|
144131
144392
|
getAllCodeActions(context) {
|
|
144132
|
-
const { fixId:
|
|
144393
|
+
const { fixId: fixId52, program, sourceFile } = context;
|
|
144133
144394
|
const checker = program.getTypeChecker();
|
|
144134
|
-
return codeFixAll(context,
|
|
144395
|
+
return codeFixAll(context, errorCodes44, (changes, err) => {
|
|
144135
144396
|
const info = getInfo11(err.file, err.start, checker);
|
|
144136
144397
|
if (!info)
|
|
144137
144398
|
return;
|
|
144138
144399
|
const { typeNode, type } = info;
|
|
144139
|
-
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ &&
|
|
144140
|
-
|
|
144400
|
+
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
144401
|
+
doChange21(changes, sourceFile, typeNode, fixedType, checker);
|
|
144141
144402
|
});
|
|
144142
144403
|
}
|
|
144143
144404
|
});
|
|
@@ -144145,7 +144406,7 @@ ${lanes.join("\n")}
|
|
|
144145
144406
|
});
|
|
144146
144407
|
|
|
144147
144408
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
144148
|
-
function
|
|
144409
|
+
function doChange22(changes, sourceFile, name) {
|
|
144149
144410
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
144150
144411
|
}
|
|
144151
144412
|
function getCallName(sourceFile, start) {
|
|
@@ -144162,31 +144423,31 @@ ${lanes.join("\n")}
|
|
|
144162
144423
|
}
|
|
144163
144424
|
return void 0;
|
|
144164
144425
|
}
|
|
144165
|
-
var
|
|
144426
|
+
var fixId35, errorCodes45;
|
|
144166
144427
|
var init_fixMissingCallParentheses = __esm({
|
|
144167
144428
|
"src/services/codefixes/fixMissingCallParentheses.ts"() {
|
|
144168
144429
|
"use strict";
|
|
144169
144430
|
init_ts4();
|
|
144170
144431
|
init_ts_codefix();
|
|
144171
|
-
|
|
144172
|
-
|
|
144432
|
+
fixId35 = "fixMissingCallParentheses";
|
|
144433
|
+
errorCodes45 = [
|
|
144173
144434
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
144174
144435
|
];
|
|
144175
144436
|
registerCodeFix({
|
|
144176
|
-
errorCodes:
|
|
144177
|
-
fixIds: [
|
|
144437
|
+
errorCodes: errorCodes45,
|
|
144438
|
+
fixIds: [fixId35],
|
|
144178
144439
|
getCodeActions(context) {
|
|
144179
144440
|
const { sourceFile, span } = context;
|
|
144180
144441
|
const callName = getCallName(sourceFile, span.start);
|
|
144181
144442
|
if (!callName)
|
|
144182
144443
|
return;
|
|
144183
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144184
|
-
return [createCodeFixAction(
|
|
144444
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, context.sourceFile, callName));
|
|
144445
|
+
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
|
|
144185
144446
|
},
|
|
144186
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144447
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => {
|
|
144187
144448
|
const callName = getCallName(diag2.file, diag2.start);
|
|
144188
144449
|
if (callName)
|
|
144189
|
-
|
|
144450
|
+
doChange22(changes, diag2.file, callName);
|
|
144190
144451
|
})
|
|
144191
144452
|
});
|
|
144192
144453
|
}
|
|
@@ -144228,7 +144489,7 @@ ${lanes.join("\n")}
|
|
|
144228
144489
|
returnType: getReturnType(containingFunction)
|
|
144229
144490
|
};
|
|
144230
144491
|
}
|
|
144231
|
-
function
|
|
144492
|
+
function doChange23(changes, sourceFile, { insertBefore, returnType }) {
|
|
144232
144493
|
if (returnType) {
|
|
144233
144494
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
144234
144495
|
if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -144237,36 +144498,36 @@ ${lanes.join("\n")}
|
|
|
144237
144498
|
}
|
|
144238
144499
|
changes.insertModifierBefore(sourceFile, 132 /* AsyncKeyword */, insertBefore);
|
|
144239
144500
|
}
|
|
144240
|
-
var
|
|
144501
|
+
var fixId36, errorCodes46;
|
|
144241
144502
|
var init_fixAwaitInSyncFunction = __esm({
|
|
144242
144503
|
"src/services/codefixes/fixAwaitInSyncFunction.ts"() {
|
|
144243
144504
|
"use strict";
|
|
144244
144505
|
init_ts4();
|
|
144245
144506
|
init_ts_codefix();
|
|
144246
|
-
|
|
144247
|
-
|
|
144507
|
+
fixId36 = "fixAwaitInSyncFunction";
|
|
144508
|
+
errorCodes46 = [
|
|
144248
144509
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144249
144510
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144250
144511
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
144251
144512
|
];
|
|
144252
144513
|
registerCodeFix({
|
|
144253
|
-
errorCodes:
|
|
144514
|
+
errorCodes: errorCodes46,
|
|
144254
144515
|
getCodeActions(context) {
|
|
144255
144516
|
const { sourceFile, span } = context;
|
|
144256
144517
|
const nodes = getNodes3(sourceFile, span.start);
|
|
144257
144518
|
if (!nodes)
|
|
144258
144519
|
return void 0;
|
|
144259
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144260
|
-
return [createCodeFixAction(
|
|
144520
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, nodes));
|
|
144521
|
+
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
|
|
144261
144522
|
},
|
|
144262
|
-
fixIds: [
|
|
144523
|
+
fixIds: [fixId36],
|
|
144263
144524
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
144264
144525
|
const seen = /* @__PURE__ */ new Map();
|
|
144265
|
-
return codeFixAll(context,
|
|
144526
|
+
return codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
144266
144527
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
144267
144528
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
144268
144529
|
return;
|
|
144269
|
-
|
|
144530
|
+
doChange23(changes, context.sourceFile, nodes);
|
|
144270
144531
|
});
|
|
144271
144532
|
}
|
|
144272
144533
|
});
|
|
@@ -144274,7 +144535,7 @@ ${lanes.join("\n")}
|
|
|
144274
144535
|
});
|
|
144275
144536
|
|
|
144276
144537
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
144277
|
-
function
|
|
144538
|
+
function doChange24(file, start, length2, code, context) {
|
|
144278
144539
|
let startPosition;
|
|
144279
144540
|
let endPosition;
|
|
144280
144541
|
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 +144562,28 @@ ${lanes.join("\n")}
|
|
|
144301
144562
|
}
|
|
144302
144563
|
return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message);
|
|
144303
144564
|
}
|
|
144304
|
-
var
|
|
144565
|
+
var errorCodes47, fixId37;
|
|
144305
144566
|
var init_fixPropertyOverrideAccessor = __esm({
|
|
144306
144567
|
"src/services/codefixes/fixPropertyOverrideAccessor.ts"() {
|
|
144307
144568
|
"use strict";
|
|
144308
144569
|
init_ts4();
|
|
144309
144570
|
init_ts_codefix();
|
|
144310
|
-
|
|
144571
|
+
errorCodes47 = [
|
|
144311
144572
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
144312
144573
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
144313
144574
|
];
|
|
144314
|
-
|
|
144575
|
+
fixId37 = "fixPropertyOverrideAccessor";
|
|
144315
144576
|
registerCodeFix({
|
|
144316
|
-
errorCodes:
|
|
144577
|
+
errorCodes: errorCodes47,
|
|
144317
144578
|
getCodeActions(context) {
|
|
144318
|
-
const edits =
|
|
144579
|
+
const edits = doChange24(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
144319
144580
|
if (edits) {
|
|
144320
|
-
return [createCodeFixAction(
|
|
144581
|
+
return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
144321
144582
|
}
|
|
144322
144583
|
},
|
|
144323
|
-
fixIds: [
|
|
144324
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144325
|
-
const edits =
|
|
144584
|
+
fixIds: [fixId37],
|
|
144585
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
144586
|
+
const edits = doChange24(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
144326
144587
|
if (edits) {
|
|
144327
144588
|
for (const edit of edits) {
|
|
144328
144589
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -144369,7 +144630,7 @@ ${lanes.join("\n")}
|
|
|
144369
144630
|
}
|
|
144370
144631
|
return errorCode;
|
|
144371
144632
|
}
|
|
144372
|
-
function
|
|
144633
|
+
function doChange25(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
144373
144634
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) {
|
|
144374
144635
|
return void 0;
|
|
144375
144636
|
}
|
|
@@ -145263,14 +145524,14 @@ ${lanes.join("\n")}
|
|
|
145263
145524
|
}
|
|
145264
145525
|
}
|
|
145265
145526
|
}
|
|
145266
|
-
var
|
|
145527
|
+
var fixId38, errorCodes48;
|
|
145267
145528
|
var init_inferFromUsage = __esm({
|
|
145268
145529
|
"src/services/codefixes/inferFromUsage.ts"() {
|
|
145269
145530
|
"use strict";
|
|
145270
145531
|
init_ts4();
|
|
145271
145532
|
init_ts_codefix();
|
|
145272
|
-
|
|
145273
|
-
|
|
145533
|
+
fixId38 = "inferFromUsage";
|
|
145534
|
+
errorCodes48 = [
|
|
145274
145535
|
// Variable declarations
|
|
145275
145536
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
145276
145537
|
// Variable uses
|
|
@@ -145304,13 +145565,13 @@ ${lanes.join("\n")}
|
|
|
145304
145565
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
145305
145566
|
];
|
|
145306
145567
|
registerCodeFix({
|
|
145307
|
-
errorCodes:
|
|
145568
|
+
errorCodes: errorCodes48,
|
|
145308
145569
|
getCodeActions(context) {
|
|
145309
145570
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
145310
145571
|
const token = getTokenAtPosition(sourceFile, start);
|
|
145311
145572
|
let declaration;
|
|
145312
145573
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
145313
|
-
declaration =
|
|
145574
|
+
declaration = doChange25(
|
|
145314
145575
|
changes2,
|
|
145315
145576
|
sourceFile,
|
|
145316
145577
|
token,
|
|
@@ -145324,14 +145585,14 @@ ${lanes.join("\n")}
|
|
|
145324
145585
|
);
|
|
145325
145586
|
});
|
|
145326
145587
|
const name = declaration && getNameOfDeclaration(declaration);
|
|
145327
|
-
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
145588
|
+
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId38, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId38, Diagnostics.Infer_all_types_from_usage)];
|
|
145328
145589
|
},
|
|
145329
|
-
fixIds: [
|
|
145590
|
+
fixIds: [fixId38],
|
|
145330
145591
|
getAllCodeActions(context) {
|
|
145331
145592
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
145332
145593
|
const markSeen = nodeSeenTracker();
|
|
145333
|
-
return codeFixAll(context,
|
|
145334
|
-
|
|
145594
|
+
return codeFixAll(context, errorCodes48, (changes, err) => {
|
|
145595
|
+
doChange25(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
145335
145596
|
});
|
|
145336
145597
|
}
|
|
145337
145598
|
});
|
|
@@ -145362,22 +145623,22 @@ ${lanes.join("\n")}
|
|
|
145362
145623
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
145363
145624
|
}
|
|
145364
145625
|
}
|
|
145365
|
-
function
|
|
145626
|
+
function doChange26(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
145366
145627
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
145367
145628
|
}
|
|
145368
|
-
var
|
|
145629
|
+
var fixId39, errorCodes49;
|
|
145369
145630
|
var init_fixReturnTypeInAsyncFunction = __esm({
|
|
145370
145631
|
"src/services/codefixes/fixReturnTypeInAsyncFunction.ts"() {
|
|
145371
145632
|
"use strict";
|
|
145372
145633
|
init_ts4();
|
|
145373
145634
|
init_ts_codefix();
|
|
145374
|
-
|
|
145375
|
-
|
|
145635
|
+
fixId39 = "fixReturnTypeInAsyncFunction";
|
|
145636
|
+
errorCodes49 = [
|
|
145376
145637
|
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
145638
|
];
|
|
145378
145639
|
registerCodeFix({
|
|
145379
|
-
errorCodes:
|
|
145380
|
-
fixIds: [
|
|
145640
|
+
errorCodes: errorCodes49,
|
|
145641
|
+
fixIds: [fixId39],
|
|
145381
145642
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
145382
145643
|
const { sourceFile, program, span } = context;
|
|
145383
145644
|
const checker = program.getTypeChecker();
|
|
@@ -145386,23 +145647,23 @@ ${lanes.join("\n")}
|
|
|
145386
145647
|
return void 0;
|
|
145387
145648
|
}
|
|
145388
145649
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
145389
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145650
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
145390
145651
|
return [createCodeFixAction(
|
|
145391
|
-
|
|
145652
|
+
fixId39,
|
|
145392
145653
|
changes,
|
|
145393
145654
|
[
|
|
145394
145655
|
Diagnostics.Replace_0_with_Promise_1,
|
|
145395
145656
|
checker.typeToString(returnType),
|
|
145396
145657
|
checker.typeToString(promisedType)
|
|
145397
145658
|
],
|
|
145398
|
-
|
|
145659
|
+
fixId39,
|
|
145399
145660
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
145400
145661
|
)];
|
|
145401
145662
|
},
|
|
145402
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
145663
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes49, (changes, diag2) => {
|
|
145403
145664
|
const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
145404
145665
|
if (info) {
|
|
145405
|
-
|
|
145666
|
+
doChange26(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
145406
145667
|
}
|
|
145407
145668
|
})
|
|
145408
145669
|
});
|
|
@@ -145416,20 +145677,20 @@ ${lanes.join("\n")}
|
|
|
145416
145677
|
changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore");
|
|
145417
145678
|
}
|
|
145418
145679
|
}
|
|
145419
|
-
var fixName4,
|
|
145680
|
+
var fixName4, fixId40, errorCodes50;
|
|
145420
145681
|
var init_disableJsDiagnostics = __esm({
|
|
145421
145682
|
"src/services/codefixes/disableJsDiagnostics.ts"() {
|
|
145422
145683
|
"use strict";
|
|
145423
145684
|
init_ts4();
|
|
145424
145685
|
init_ts_codefix();
|
|
145425
145686
|
fixName4 = "disableJsDiagnostics";
|
|
145426
|
-
|
|
145427
|
-
|
|
145687
|
+
fixId40 = "disableJsDiagnostics";
|
|
145688
|
+
errorCodes50 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
145428
145689
|
const diag2 = Diagnostics[key];
|
|
145429
145690
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
145430
145691
|
});
|
|
145431
145692
|
registerCodeFix({
|
|
145432
|
-
errorCodes:
|
|
145693
|
+
errorCodes: errorCodes50,
|
|
145433
145694
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
145434
145695
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
145435
145696
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -145447,14 +145708,14 @@ ${lanes.join("\n")}
|
|
|
145447
145708
|
)
|
|
145448
145709
|
];
|
|
145449
145710
|
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,
|
|
145711
|
+
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
145712
|
}
|
|
145452
145713
|
return fixes;
|
|
145453
145714
|
},
|
|
145454
|
-
fixIds: [
|
|
145715
|
+
fixIds: [fixId40],
|
|
145455
145716
|
getAllCodeActions: (context) => {
|
|
145456
145717
|
const seenLines = /* @__PURE__ */ new Set();
|
|
145457
|
-
return codeFixAll(context,
|
|
145718
|
+
return codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
145458
145719
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
145459
145720
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
145460
145721
|
}
|
|
@@ -146551,7 +146812,7 @@ ${lanes.join("\n")}
|
|
|
146551
146812
|
}
|
|
146552
146813
|
return void 0;
|
|
146553
146814
|
}
|
|
146554
|
-
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer,
|
|
146815
|
+
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes51;
|
|
146555
146816
|
var init_fixStrictClassInitialization = __esm({
|
|
146556
146817
|
"src/services/codefixes/fixStrictClassInitialization.ts"() {
|
|
146557
146818
|
"use strict";
|
|
@@ -146561,9 +146822,9 @@ ${lanes.join("\n")}
|
|
|
146561
146822
|
fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
146562
146823
|
fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
146563
146824
|
fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
146564
|
-
|
|
146825
|
+
errorCodes51 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
146565
146826
|
registerCodeFix({
|
|
146566
|
-
errorCodes:
|
|
146827
|
+
errorCodes: errorCodes51,
|
|
146567
146828
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
146568
146829
|
const info = getInfo13(context.sourceFile, context.span.start);
|
|
146569
146830
|
if (!info)
|
|
@@ -146576,7 +146837,7 @@ ${lanes.join("\n")}
|
|
|
146576
146837
|
},
|
|
146577
146838
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
146578
146839
|
getAllCodeActions: (context) => {
|
|
146579
|
-
return codeFixAll(context,
|
|
146840
|
+
return codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
146580
146841
|
const info = getInfo13(diag2.file, diag2.start);
|
|
146581
146842
|
if (!info)
|
|
146582
146843
|
return;
|
|
@@ -146604,7 +146865,7 @@ ${lanes.join("\n")}
|
|
|
146604
146865
|
});
|
|
146605
146866
|
|
|
146606
146867
|
// src/services/codefixes/requireInTs.ts
|
|
146607
|
-
function
|
|
146868
|
+
function doChange27(changes, sourceFile, info) {
|
|
146608
146869
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
146609
146870
|
changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(
|
|
146610
146871
|
/*modifiers*/
|
|
@@ -146666,29 +146927,29 @@ ${lanes.join("\n")}
|
|
|
146666
146927
|
return factory.createNamedImports(importSpecifiers);
|
|
146667
146928
|
}
|
|
146668
146929
|
}
|
|
146669
|
-
var
|
|
146930
|
+
var fixId41, errorCodes52;
|
|
146670
146931
|
var init_requireInTs = __esm({
|
|
146671
146932
|
"src/services/codefixes/requireInTs.ts"() {
|
|
146672
146933
|
"use strict";
|
|
146673
146934
|
init_ts4();
|
|
146674
146935
|
init_ts_codefix();
|
|
146675
|
-
|
|
146676
|
-
|
|
146936
|
+
fixId41 = "requireInTs";
|
|
146937
|
+
errorCodes52 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
146677
146938
|
registerCodeFix({
|
|
146678
|
-
errorCodes:
|
|
146939
|
+
errorCodes: errorCodes52,
|
|
146679
146940
|
getCodeActions(context) {
|
|
146680
146941
|
const info = getInfo14(context.sourceFile, context.program, context.span.start);
|
|
146681
146942
|
if (!info) {
|
|
146682
146943
|
return void 0;
|
|
146683
146944
|
}
|
|
146684
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146685
|
-
return [createCodeFixAction(
|
|
146945
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, info));
|
|
146946
|
+
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
|
|
146686
146947
|
},
|
|
146687
|
-
fixIds: [
|
|
146688
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
146948
|
+
fixIds: [fixId41],
|
|
146949
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
146689
146950
|
const info = getInfo14(diag2.file, context.program, diag2.start);
|
|
146690
146951
|
if (info) {
|
|
146691
|
-
|
|
146952
|
+
doChange27(changes, context.sourceFile, info);
|
|
146692
146953
|
}
|
|
146693
146954
|
})
|
|
146694
146955
|
});
|
|
@@ -146708,7 +146969,7 @@ ${lanes.join("\n")}
|
|
|
146708
146969
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
146709
146970
|
}
|
|
146710
146971
|
}
|
|
146711
|
-
function
|
|
146972
|
+
function doChange28(changes, sourceFile, info, preferences) {
|
|
146712
146973
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
146713
146974
|
info.name,
|
|
146714
146975
|
/*namedImports*/
|
|
@@ -146717,29 +146978,29 @@ ${lanes.join("\n")}
|
|
|
146717
146978
|
getQuotePreference(sourceFile, preferences)
|
|
146718
146979
|
));
|
|
146719
146980
|
}
|
|
146720
|
-
var
|
|
146981
|
+
var fixId42, errorCodes53;
|
|
146721
146982
|
var init_useDefaultImport = __esm({
|
|
146722
146983
|
"src/services/codefixes/useDefaultImport.ts"() {
|
|
146723
146984
|
"use strict";
|
|
146724
146985
|
init_ts4();
|
|
146725
146986
|
init_ts_codefix();
|
|
146726
|
-
|
|
146727
|
-
|
|
146987
|
+
fixId42 = "useDefaultImport";
|
|
146988
|
+
errorCodes53 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
146728
146989
|
registerCodeFix({
|
|
146729
|
-
errorCodes:
|
|
146990
|
+
errorCodes: errorCodes53,
|
|
146730
146991
|
getCodeActions(context) {
|
|
146731
146992
|
const { sourceFile, span: { start } } = context;
|
|
146732
146993
|
const info = getInfo15(sourceFile, start);
|
|
146733
146994
|
if (!info)
|
|
146734
146995
|
return void 0;
|
|
146735
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146736
|
-
return [createCodeFixAction(
|
|
146996
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, info, context.preferences));
|
|
146997
|
+
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
|
|
146737
146998
|
},
|
|
146738
|
-
fixIds: [
|
|
146739
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
146999
|
+
fixIds: [fixId42],
|
|
147000
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
146740
147001
|
const info = getInfo15(diag2.file, diag2.start);
|
|
146741
147002
|
if (info)
|
|
146742
|
-
|
|
147003
|
+
doChange28(changes, diag2.file, info, context.preferences);
|
|
146743
147004
|
})
|
|
146744
147005
|
});
|
|
146745
147006
|
}
|
|
@@ -146754,27 +147015,27 @@ ${lanes.join("\n")}
|
|
|
146754
147015
|
const newText = numericLiteral.getText(sourceFile) + "n";
|
|
146755
147016
|
changeTracker.replaceNode(sourceFile, numericLiteral, factory.createBigIntLiteral(newText));
|
|
146756
147017
|
}
|
|
146757
|
-
var
|
|
147018
|
+
var fixId43, errorCodes54;
|
|
146758
147019
|
var init_useBigintLiteral = __esm({
|
|
146759
147020
|
"src/services/codefixes/useBigintLiteral.ts"() {
|
|
146760
147021
|
"use strict";
|
|
146761
147022
|
init_ts4();
|
|
146762
147023
|
init_ts_codefix();
|
|
146763
|
-
|
|
146764
|
-
|
|
147024
|
+
fixId43 = "useBigintLiteral";
|
|
147025
|
+
errorCodes54 = [
|
|
146765
147026
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
146766
147027
|
];
|
|
146767
147028
|
registerCodeFix({
|
|
146768
|
-
errorCodes:
|
|
147029
|
+
errorCodes: errorCodes54,
|
|
146769
147030
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
146770
147031
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
146771
147032
|
if (changes.length > 0) {
|
|
146772
|
-
return [createCodeFixAction(
|
|
147033
|
+
return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId43, Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
146773
147034
|
}
|
|
146774
147035
|
},
|
|
146775
|
-
fixIds: [
|
|
147036
|
+
fixIds: [fixId43],
|
|
146776
147037
|
getAllCodeActions: (context) => {
|
|
146777
|
-
return codeFixAll(context,
|
|
147038
|
+
return codeFixAll(context, errorCodes54, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
146778
147039
|
}
|
|
146779
147040
|
});
|
|
146780
147041
|
}
|
|
@@ -146787,7 +147048,7 @@ ${lanes.join("\n")}
|
|
|
146787
147048
|
Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType");
|
|
146788
147049
|
return token.parent;
|
|
146789
147050
|
}
|
|
146790
|
-
function
|
|
147051
|
+
function doChange29(changes, sourceFile, importType) {
|
|
146791
147052
|
const newTypeNode = factory.updateImportTypeNode(
|
|
146792
147053
|
importType,
|
|
146793
147054
|
importType.argument,
|
|
@@ -146799,25 +147060,25 @@ ${lanes.join("\n")}
|
|
|
146799
147060
|
);
|
|
146800
147061
|
changes.replaceNode(sourceFile, importType, newTypeNode);
|
|
146801
147062
|
}
|
|
146802
|
-
var fixIdAddMissingTypeof,
|
|
147063
|
+
var fixIdAddMissingTypeof, fixId44, errorCodes55;
|
|
146803
147064
|
var init_fixAddModuleReferTypeMissingTypeof = __esm({
|
|
146804
147065
|
"src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts"() {
|
|
146805
147066
|
"use strict";
|
|
146806
147067
|
init_ts4();
|
|
146807
147068
|
init_ts_codefix();
|
|
146808
147069
|
fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
146809
|
-
|
|
146810
|
-
|
|
147070
|
+
fixId44 = fixIdAddMissingTypeof;
|
|
147071
|
+
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
147072
|
registerCodeFix({
|
|
146812
|
-
errorCodes:
|
|
147073
|
+
errorCodes: errorCodes55,
|
|
146813
147074
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
146814
147075
|
const { sourceFile, span } = context;
|
|
146815
147076
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
146816
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146817
|
-
return [createCodeFixAction(
|
|
147077
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, importType));
|
|
147078
|
+
return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
|
|
146818
147079
|
},
|
|
146819
|
-
fixIds: [
|
|
146820
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147080
|
+
fixIds: [fixId44],
|
|
147081
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => doChange29(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
146821
147082
|
});
|
|
146822
147083
|
}
|
|
146823
147084
|
});
|
|
@@ -146836,7 +147097,7 @@ ${lanes.join("\n")}
|
|
|
146836
147097
|
return void 0;
|
|
146837
147098
|
return binaryExpr;
|
|
146838
147099
|
}
|
|
146839
|
-
function
|
|
147100
|
+
function doChange30(changeTracker, sf, node) {
|
|
146840
147101
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
146841
147102
|
if (jsx)
|
|
146842
147103
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -146859,30 +147120,30 @@ ${lanes.join("\n")}
|
|
|
146859
147120
|
return void 0;
|
|
146860
147121
|
}
|
|
146861
147122
|
}
|
|
146862
|
-
var fixID2,
|
|
147123
|
+
var fixID2, errorCodes56;
|
|
146863
147124
|
var init_wrapJsxInFragment = __esm({
|
|
146864
147125
|
"src/services/codefixes/wrapJsxInFragment.ts"() {
|
|
146865
147126
|
"use strict";
|
|
146866
147127
|
init_ts4();
|
|
146867
147128
|
init_ts_codefix();
|
|
146868
147129
|
fixID2 = "wrapJsxInFragment";
|
|
146869
|
-
|
|
147130
|
+
errorCodes56 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
146870
147131
|
registerCodeFix({
|
|
146871
|
-
errorCodes:
|
|
147132
|
+
errorCodes: errorCodes56,
|
|
146872
147133
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
146873
147134
|
const { sourceFile, span } = context;
|
|
146874
147135
|
const node = findNodeToFix(sourceFile, span.start);
|
|
146875
147136
|
if (!node)
|
|
146876
147137
|
return void 0;
|
|
146877
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147138
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, node));
|
|
146878
147139
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
146879
147140
|
},
|
|
146880
147141
|
fixIds: [fixID2],
|
|
146881
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147142
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
|
|
146882
147143
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
146883
147144
|
if (!node)
|
|
146884
147145
|
return void 0;
|
|
146885
|
-
|
|
147146
|
+
doChange30(changes, context.sourceFile, node);
|
|
146886
147147
|
})
|
|
146887
147148
|
});
|
|
146888
147149
|
}
|
|
@@ -146902,7 +147163,7 @@ ${lanes.join("\n")}
|
|
|
146902
147163
|
function createTypeAliasFromInterface(declaration, type) {
|
|
146903
147164
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
146904
147165
|
}
|
|
146905
|
-
function
|
|
147166
|
+
function doChange31(changes, sourceFile, { indexSignature, container }) {
|
|
146906
147167
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
146907
147168
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
146908
147169
|
const parameter = first(indexSignature.parameters);
|
|
@@ -146929,48 +147190,48 @@ ${lanes.join("\n")}
|
|
|
146929
147190
|
]);
|
|
146930
147191
|
changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType));
|
|
146931
147192
|
}
|
|
146932
|
-
var
|
|
147193
|
+
var fixId45, errorCodes57;
|
|
146933
147194
|
var init_convertToMappedObjectType = __esm({
|
|
146934
147195
|
"src/services/codefixes/convertToMappedObjectType.ts"() {
|
|
146935
147196
|
"use strict";
|
|
146936
147197
|
init_ts4();
|
|
146937
147198
|
init_ts_codefix();
|
|
146938
|
-
|
|
146939
|
-
|
|
147199
|
+
fixId45 = "fixConvertToMappedObjectType";
|
|
147200
|
+
errorCodes57 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
146940
147201
|
registerCodeFix({
|
|
146941
|
-
errorCodes:
|
|
147202
|
+
errorCodes: errorCodes57,
|
|
146942
147203
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
146943
147204
|
const { sourceFile, span } = context;
|
|
146944
147205
|
const info = getInfo16(sourceFile, span.start);
|
|
146945
147206
|
if (!info)
|
|
146946
147207
|
return void 0;
|
|
146947
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147208
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info));
|
|
146948
147209
|
const name = idText(info.container.name);
|
|
146949
|
-
return [createCodeFixAction(
|
|
147210
|
+
return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
146950
147211
|
},
|
|
146951
|
-
fixIds: [
|
|
146952
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147212
|
+
fixIds: [fixId45],
|
|
147213
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
|
|
146953
147214
|
const info = getInfo16(diag2.file, diag2.start);
|
|
146954
147215
|
if (info)
|
|
146955
|
-
|
|
147216
|
+
doChange31(changes, diag2.file, info);
|
|
146956
147217
|
})
|
|
146957
147218
|
});
|
|
146958
147219
|
}
|
|
146959
147220
|
});
|
|
146960
147221
|
|
|
146961
147222
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
146962
|
-
var
|
|
147223
|
+
var fixId46, errorCodes58;
|
|
146963
147224
|
var init_removeAccidentalCallParentheses = __esm({
|
|
146964
147225
|
"src/services/codefixes/removeAccidentalCallParentheses.ts"() {
|
|
146965
147226
|
"use strict";
|
|
146966
147227
|
init_ts4();
|
|
146967
147228
|
init_ts_codefix();
|
|
146968
|
-
|
|
146969
|
-
|
|
147229
|
+
fixId46 = "removeAccidentalCallParentheses";
|
|
147230
|
+
errorCodes58 = [
|
|
146970
147231
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
146971
147232
|
];
|
|
146972
147233
|
registerCodeFix({
|
|
146973
|
-
errorCodes:
|
|
147234
|
+
errorCodes: errorCodes58,
|
|
146974
147235
|
getCodeActions(context) {
|
|
146975
147236
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
146976
147237
|
if (!callExpression) {
|
|
@@ -146979,9 +147240,9 @@ ${lanes.join("\n")}
|
|
|
146979
147240
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
146980
147241
|
t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
|
|
146981
147242
|
});
|
|
146982
|
-
return [createCodeFixActionWithoutFixAll(
|
|
147243
|
+
return [createCodeFixActionWithoutFixAll(fixId46, changes, Diagnostics.Remove_parentheses)];
|
|
146983
147244
|
},
|
|
146984
|
-
fixIds: [
|
|
147245
|
+
fixIds: [fixId46]
|
|
146985
147246
|
});
|
|
146986
147247
|
}
|
|
146987
147248
|
});
|
|
@@ -147010,27 +147271,27 @@ ${lanes.join("\n")}
|
|
|
147010
147271
|
}
|
|
147011
147272
|
changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression);
|
|
147012
147273
|
}
|
|
147013
|
-
var
|
|
147274
|
+
var fixId47, errorCodes59;
|
|
147014
147275
|
var init_removeUnnecessaryAwait = __esm({
|
|
147015
147276
|
"src/services/codefixes/removeUnnecessaryAwait.ts"() {
|
|
147016
147277
|
"use strict";
|
|
147017
147278
|
init_ts4();
|
|
147018
147279
|
init_ts_codefix();
|
|
147019
|
-
|
|
147020
|
-
|
|
147280
|
+
fixId47 = "removeUnnecessaryAwait";
|
|
147281
|
+
errorCodes59 = [
|
|
147021
147282
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
147022
147283
|
];
|
|
147023
147284
|
registerCodeFix({
|
|
147024
|
-
errorCodes:
|
|
147285
|
+
errorCodes: errorCodes59,
|
|
147025
147286
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
147026
147287
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
147027
147288
|
if (changes.length > 0) {
|
|
147028
|
-
return [createCodeFixAction(
|
|
147289
|
+
return [createCodeFixAction(fixId47, changes, Diagnostics.Remove_unnecessary_await, fixId47, Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
147029
147290
|
}
|
|
147030
147291
|
},
|
|
147031
|
-
fixIds: [
|
|
147292
|
+
fixIds: [fixId47],
|
|
147032
147293
|
getAllCodeActions: (context) => {
|
|
147033
|
-
return codeFixAll(context,
|
|
147294
|
+
return codeFixAll(context, errorCodes59, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
147034
147295
|
}
|
|
147035
147296
|
});
|
|
147036
147297
|
}
|
|
@@ -147072,26 +147333,26 @@ ${lanes.join("\n")}
|
|
|
147072
147333
|
importDeclaration.assertClause
|
|
147073
147334
|
));
|
|
147074
147335
|
}
|
|
147075
|
-
var
|
|
147336
|
+
var errorCodes60, fixId48;
|
|
147076
147337
|
var init_splitTypeOnlyImport = __esm({
|
|
147077
147338
|
"src/services/codefixes/splitTypeOnlyImport.ts"() {
|
|
147078
147339
|
"use strict";
|
|
147079
147340
|
init_ts4();
|
|
147080
147341
|
init_ts_codefix();
|
|
147081
|
-
|
|
147082
|
-
|
|
147342
|
+
errorCodes60 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
147343
|
+
fixId48 = "splitTypeOnlyImport";
|
|
147083
147344
|
registerCodeFix({
|
|
147084
|
-
errorCodes:
|
|
147085
|
-
fixIds: [
|
|
147345
|
+
errorCodes: errorCodes60,
|
|
147346
|
+
fixIds: [fixId48],
|
|
147086
147347
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
147087
147348
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
147088
147349
|
return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
|
|
147089
147350
|
});
|
|
147090
147351
|
if (changes.length) {
|
|
147091
|
-
return [createCodeFixAction(
|
|
147352
|
+
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
147092
147353
|
}
|
|
147093
147354
|
},
|
|
147094
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147355
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error) => {
|
|
147095
147356
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error), context);
|
|
147096
147357
|
})
|
|
147097
147358
|
});
|
|
@@ -147113,43 +147374,43 @@ ${lanes.join("\n")}
|
|
|
147113
147374
|
return;
|
|
147114
147375
|
return { symbol, token: constToken };
|
|
147115
147376
|
}
|
|
147116
|
-
function
|
|
147377
|
+
function doChange32(changes, sourceFile, token) {
|
|
147117
147378
|
changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */));
|
|
147118
147379
|
}
|
|
147119
|
-
var
|
|
147380
|
+
var fixId49, errorCodes61;
|
|
147120
147381
|
var init_convertConstToLet = __esm({
|
|
147121
147382
|
"src/services/codefixes/convertConstToLet.ts"() {
|
|
147122
147383
|
"use strict";
|
|
147123
147384
|
init_ts4();
|
|
147124
147385
|
init_ts_codefix();
|
|
147125
|
-
|
|
147126
|
-
|
|
147386
|
+
fixId49 = "fixConvertConstToLet";
|
|
147387
|
+
errorCodes61 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
147127
147388
|
registerCodeFix({
|
|
147128
|
-
errorCodes:
|
|
147389
|
+
errorCodes: errorCodes61,
|
|
147129
147390
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
147130
147391
|
const { sourceFile, span, program } = context;
|
|
147131
147392
|
const info = getInfo17(sourceFile, span.start, program);
|
|
147132
147393
|
if (info === void 0)
|
|
147133
147394
|
return;
|
|
147134
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147135
|
-
return [createCodeFixActionMaybeFixAll(
|
|
147395
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info.token));
|
|
147396
|
+
return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
|
|
147136
147397
|
},
|
|
147137
147398
|
getAllCodeActions: (context) => {
|
|
147138
147399
|
const { program } = context;
|
|
147139
147400
|
const seen = /* @__PURE__ */ new Map();
|
|
147140
147401
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
147141
|
-
eachDiagnostic(context,
|
|
147402
|
+
eachDiagnostic(context, errorCodes61, (diag2) => {
|
|
147142
147403
|
const info = getInfo17(diag2.file, diag2.start, program);
|
|
147143
147404
|
if (info) {
|
|
147144
147405
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
147145
|
-
return
|
|
147406
|
+
return doChange32(changes, diag2.file, info.token);
|
|
147146
147407
|
}
|
|
147147
147408
|
}
|
|
147148
147409
|
return void 0;
|
|
147149
147410
|
});
|
|
147150
147411
|
}));
|
|
147151
147412
|
},
|
|
147152
|
-
fixIds: [
|
|
147413
|
+
fixIds: [fixId49]
|
|
147153
147414
|
});
|
|
147154
147415
|
}
|
|
147155
147416
|
});
|
|
@@ -147159,40 +147420,40 @@ ${lanes.join("\n")}
|
|
|
147159
147420
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
147160
147421
|
return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
147161
147422
|
}
|
|
147162
|
-
function
|
|
147423
|
+
function doChange33(changes, sourceFile, { node }) {
|
|
147163
147424
|
const newNode = factory.createToken(27 /* CommaToken */);
|
|
147164
147425
|
changes.replaceNode(sourceFile, node, newNode);
|
|
147165
147426
|
}
|
|
147166
|
-
var
|
|
147427
|
+
var fixId50, expectedErrorCode, errorCodes62;
|
|
147167
147428
|
var init_fixExpectedComma = __esm({
|
|
147168
147429
|
"src/services/codefixes/fixExpectedComma.ts"() {
|
|
147169
147430
|
"use strict";
|
|
147170
147431
|
init_ts4();
|
|
147171
147432
|
init_ts_codefix();
|
|
147172
|
-
|
|
147433
|
+
fixId50 = "fixExpectedComma";
|
|
147173
147434
|
expectedErrorCode = Diagnostics._0_expected.code;
|
|
147174
|
-
|
|
147435
|
+
errorCodes62 = [expectedErrorCode];
|
|
147175
147436
|
registerCodeFix({
|
|
147176
|
-
errorCodes:
|
|
147437
|
+
errorCodes: errorCodes62,
|
|
147177
147438
|
getCodeActions(context) {
|
|
147178
147439
|
const { sourceFile } = context;
|
|
147179
147440
|
const info = getInfo18(sourceFile, context.span.start, context.errorCode);
|
|
147180
147441
|
if (!info)
|
|
147181
147442
|
return void 0;
|
|
147182
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147443
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(t, sourceFile, info));
|
|
147183
147444
|
return [createCodeFixAction(
|
|
147184
|
-
|
|
147445
|
+
fixId50,
|
|
147185
147446
|
changes,
|
|
147186
147447
|
[Diagnostics.Change_0_to_1, ";", ","],
|
|
147187
|
-
|
|
147448
|
+
fixId50,
|
|
147188
147449
|
[Diagnostics.Change_0_to_1, ";", ","]
|
|
147189
147450
|
)];
|
|
147190
147451
|
},
|
|
147191
|
-
fixIds: [
|
|
147192
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147452
|
+
fixIds: [fixId50],
|
|
147453
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes62, (changes, diag2) => {
|
|
147193
147454
|
const info = getInfo18(diag2.file, diag2.start, diag2.code);
|
|
147194
147455
|
if (info)
|
|
147195
|
-
|
|
147456
|
+
doChange33(changes, context.sourceFile, info);
|
|
147196
147457
|
})
|
|
147197
147458
|
});
|
|
147198
147459
|
}
|
|
@@ -147248,29 +147509,29 @@ ${lanes.join("\n")}
|
|
|
147248
147509
|
return node.typeArguments;
|
|
147249
147510
|
}
|
|
147250
147511
|
}
|
|
147251
|
-
var fixName7,
|
|
147512
|
+
var fixName7, fixId51, errorCodes63;
|
|
147252
147513
|
var init_fixAddVoidToPromise = __esm({
|
|
147253
147514
|
"src/services/codefixes/fixAddVoidToPromise.ts"() {
|
|
147254
147515
|
"use strict";
|
|
147255
147516
|
init_ts4();
|
|
147256
147517
|
init_ts_codefix();
|
|
147257
147518
|
fixName7 = "addVoidToPromise";
|
|
147258
|
-
|
|
147259
|
-
|
|
147519
|
+
fixId51 = "addVoidToPromise";
|
|
147520
|
+
errorCodes63 = [
|
|
147260
147521
|
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
147522
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
147262
147523
|
];
|
|
147263
147524
|
registerCodeFix({
|
|
147264
|
-
errorCodes:
|
|
147265
|
-
fixIds: [
|
|
147525
|
+
errorCodes: errorCodes63,
|
|
147526
|
+
fixIds: [fixId51],
|
|
147266
147527
|
getCodeActions(context) {
|
|
147267
147528
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
|
|
147268
147529
|
if (changes.length > 0) {
|
|
147269
|
-
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value,
|
|
147530
|
+
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
147531
|
}
|
|
147271
147532
|
},
|
|
147272
147533
|
getAllCodeActions(context) {
|
|
147273
|
-
return codeFixAll(context,
|
|
147534
|
+
return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
147274
147535
|
}
|
|
147275
147536
|
});
|
|
147276
147537
|
}
|
|
@@ -147305,6 +147566,7 @@ ${lanes.join("\n")}
|
|
|
147305
147566
|
getFixes: () => getFixes,
|
|
147306
147567
|
getImportCompletionAction: () => getImportCompletionAction,
|
|
147307
147568
|
getImportKind: () => getImportKind,
|
|
147569
|
+
getJSDocTypedefNode: () => getJSDocTypedefNode,
|
|
147308
147570
|
getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
|
|
147309
147571
|
getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
|
|
147310
147572
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
@@ -147339,6 +147601,7 @@ ${lanes.join("\n")}
|
|
|
147339
147601
|
init_correctQualifiedNameToIndexedAccessType();
|
|
147340
147602
|
init_convertToTypeOnlyExport();
|
|
147341
147603
|
init_convertToTypeOnlyImport();
|
|
147604
|
+
init_convertTypedefToType();
|
|
147342
147605
|
init_convertLiteralTypeToMappedType();
|
|
147343
147606
|
init_fixClassIncorrectlyImplementsInterface();
|
|
147344
147607
|
init_importFixes();
|
|
@@ -156488,7 +156751,7 @@ ${lanes.join("\n")}
|
|
|
156488
156751
|
return void 0;
|
|
156489
156752
|
}
|
|
156490
156753
|
}
|
|
156491
|
-
function
|
|
156754
|
+
function doChange34(exportingSourceFile, program, info, changes, cancellationToken) {
|
|
156492
156755
|
changeExport(exportingSourceFile, info, changes, program.getTypeChecker());
|
|
156493
156756
|
changeImports(program, info, changes, cancellationToken);
|
|
156494
156757
|
}
|
|
@@ -156684,7 +156947,7 @@ ${lanes.join("\n")}
|
|
|
156684
156947
|
Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name");
|
|
156685
156948
|
const info = getInfo19(context);
|
|
156686
156949
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156687
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
156950
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, info, t, context.cancellationToken));
|
|
156688
156951
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156689
156952
|
}
|
|
156690
156953
|
});
|
|
@@ -156719,7 +156982,7 @@ ${lanes.join("\n")}
|
|
|
156719
156982
|
function getShouldUseDefault(program, importClause) {
|
|
156720
156983
|
return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
|
|
156721
156984
|
}
|
|
156722
|
-
function
|
|
156985
|
+
function doChange35(sourceFile, program, changes, info) {
|
|
156723
156986
|
const checker = program.getTypeChecker();
|
|
156724
156987
|
if (info.convertTo === 0 /* Named */) {
|
|
156725
156988
|
doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions()));
|
|
@@ -156911,7 +157174,7 @@ ${lanes.join("\n")}
|
|
|
156911
157174
|
Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name");
|
|
156912
157175
|
const info = getImportConversionInfo(context);
|
|
156913
157176
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156914
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157177
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, t, info));
|
|
156915
157178
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156916
157179
|
}
|
|
156917
157180
|
});
|
|
@@ -157253,7 +157516,7 @@ ${lanes.join("\n")}
|
|
|
157253
157516
|
afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
|
|
157254
157517
|
};
|
|
157255
157518
|
}
|
|
157256
|
-
function
|
|
157519
|
+
function doChange36(oldFile, program, toMove, changes, host, preferences) {
|
|
157257
157520
|
const checker = program.getTypeChecker();
|
|
157258
157521
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
157259
157522
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
@@ -158023,7 +158286,7 @@ ${lanes.join("\n")}
|
|
|
158023
158286
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
158024
158287
|
Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
|
|
158025
158288
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
158026
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158289
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(context.file, context.program, statements, t, context.host, context.preferences));
|
|
158027
158290
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
158028
158291
|
}
|
|
158029
158292
|
});
|
|
@@ -158685,12 +158948,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158685
158948
|
return void 0;
|
|
158686
158949
|
const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken);
|
|
158687
158950
|
if (groupedReferences.valid) {
|
|
158688
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158951
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(file, program, host, t, functionDeclaration, groupedReferences));
|
|
158689
158952
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
158690
158953
|
}
|
|
158691
158954
|
return { edits: [] };
|
|
158692
158955
|
}
|
|
158693
|
-
function
|
|
158956
|
+
function doChange37(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
158694
158957
|
const signature = groupedReferences.signature;
|
|
158695
158958
|
const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param));
|
|
158696
158959
|
if (signature) {
|
|
@@ -159483,7 +159746,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159483
159746
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
159484
159747
|
const edits = ts_textChanges_exports.ChangeTracker.with(
|
|
159485
159748
|
context,
|
|
159486
|
-
(t) =>
|
|
159749
|
+
(t) => doChange38(context.file, context.program.getTypeChecker(), t, info, actionName2)
|
|
159487
159750
|
);
|
|
159488
159751
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
159489
159752
|
}
|
|
@@ -159639,7 +159902,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159639
159902
|
}
|
|
159640
159903
|
return toConvert;
|
|
159641
159904
|
}
|
|
159642
|
-
function
|
|
159905
|
+
function doChange38(sourceFile, checker, changes, info, _actionName) {
|
|
159643
159906
|
const { finalExpression, occurrences, expression } = info;
|
|
159644
159907
|
const firstOccurrence = occurrences[occurrences.length - 1];
|
|
159645
159908
|
const convertedChain = convertOccurrences(checker, finalExpression, occurrences);
|
|
@@ -161375,7 +161638,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161375
161638
|
function getRefactorEditsToInferReturnType(context) {
|
|
161376
161639
|
const info = getInfo21(context);
|
|
161377
161640
|
if (info && !isRefactorErrorInfo(info)) {
|
|
161378
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
161641
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(context.file, t, info.declaration, info.returnTypeNode));
|
|
161379
161642
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
161380
161643
|
}
|
|
161381
161644
|
return void 0;
|
|
@@ -161400,7 +161663,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161400
161663
|
}
|
|
161401
161664
|
return emptyArray;
|
|
161402
161665
|
}
|
|
161403
|
-
function
|
|
161666
|
+
function doChange39(sourceFile, changes, declaration, typeNode) {
|
|
161404
161667
|
const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile);
|
|
161405
161668
|
const needParens = isArrowFunction(declaration) && closeParen === void 0;
|
|
161406
161669
|
const endNode2 = needParens ? first(declaration.parameters) : closeParen;
|
|
@@ -167667,7 +167930,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167667
167930
|
CommandTypes2["NavtoFull"] = "navto-full";
|
|
167668
167931
|
CommandTypes2["NavTree"] = "navtree";
|
|
167669
167932
|
CommandTypes2["NavTreeFull"] = "navtree-full";
|
|
167670
|
-
CommandTypes2["Occurrences"] = "occurrences";
|
|
167671
167933
|
CommandTypes2["DocumentHighlights"] = "documentHighlights";
|
|
167672
167934
|
CommandTypes2["DocumentHighlightsFull"] = "documentHighlights-full";
|
|
167673
167935
|
CommandTypes2["Open"] = "open";
|
|
@@ -167924,17 +168186,14 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167924
168186
|
* True when reloading contents of file from the disk is pending
|
|
167925
168187
|
*/
|
|
167926
168188
|
this.pendingReloadFromDisk = false;
|
|
167927
|
-
this.version = initialVersion ||
|
|
168189
|
+
this.version = initialVersion || 0;
|
|
167928
168190
|
}
|
|
167929
168191
|
getVersion() {
|
|
167930
|
-
return this.svc ? `SVC-${this.version
|
|
168192
|
+
return this.svc ? `SVC-${this.version}-${this.svc.getSnapshotVersion()}` : `Text-${this.version}`;
|
|
167931
168193
|
}
|
|
167932
168194
|
hasScriptVersionCache_TestOnly() {
|
|
167933
168195
|
return this.svc !== void 0;
|
|
167934
168196
|
}
|
|
167935
|
-
useScriptVersionCache_TestOnly() {
|
|
167936
|
-
this.switchToScriptVersionCache();
|
|
167937
|
-
}
|
|
167938
168197
|
resetSourceMapInfo() {
|
|
167939
168198
|
this.info.sourceFileLike = void 0;
|
|
167940
168199
|
this.info.closeSourceMapFileWatcher();
|
|
@@ -167947,15 +168206,17 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167947
168206
|
useText(newText) {
|
|
167948
168207
|
this.svc = void 0;
|
|
167949
168208
|
this.text = newText;
|
|
168209
|
+
this.textSnapshot = void 0;
|
|
167950
168210
|
this.lineMap = void 0;
|
|
167951
168211
|
this.fileSize = void 0;
|
|
167952
168212
|
this.resetSourceMapInfo();
|
|
167953
|
-
this.version
|
|
168213
|
+
this.version++;
|
|
167954
168214
|
}
|
|
167955
168215
|
edit(start, end, newText) {
|
|
167956
168216
|
this.switchToScriptVersionCache().edit(start, end - start, newText);
|
|
167957
168217
|
this.ownFileText = false;
|
|
167958
168218
|
this.text = void 0;
|
|
168219
|
+
this.textSnapshot = void 0;
|
|
167959
168220
|
this.lineMap = void 0;
|
|
167960
168221
|
this.fileSize = void 0;
|
|
167961
168222
|
this.resetSourceMapInfo();
|
|
@@ -167967,6 +168228,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167967
168228
|
reload(newText) {
|
|
167968
168229
|
Debug.assert(newText !== void 0);
|
|
167969
168230
|
this.pendingReloadFromDisk = false;
|
|
168231
|
+
if (!this.text && this.svc) {
|
|
168232
|
+
this.text = getSnapshotText(this.svc.getSnapshot());
|
|
168233
|
+
}
|
|
167970
168234
|
if (this.text !== newText) {
|
|
167971
168235
|
this.useText(newText);
|
|
167972
168236
|
this.ownFileText = false;
|
|
@@ -167979,21 +168243,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167979
168243
|
* returns true if text changed
|
|
167980
168244
|
*/
|
|
167981
168245
|
reloadWithFileText(tempFileName) {
|
|
167982
|
-
const { text: newText, fileSize } = this.getFileTextAndSize(tempFileName);
|
|
168246
|
+
const { text: newText, fileSize } = tempFileName || !this.info.isDynamicOrHasMixedContent() ? this.getFileTextAndSize(tempFileName) : { text: "", fileSize: void 0 };
|
|
167983
168247
|
const reloaded = this.reload(newText);
|
|
167984
168248
|
this.fileSize = fileSize;
|
|
167985
168249
|
this.ownFileText = !tempFileName || tempFileName === this.info.fileName;
|
|
167986
168250
|
return reloaded;
|
|
167987
168251
|
}
|
|
167988
168252
|
/**
|
|
167989
|
-
*
|
|
167990
|
-
* returns true
|
|
168253
|
+
* Schedule reload from the disk if its not already scheduled and its not own text
|
|
168254
|
+
* returns true when scheduling reload
|
|
167991
168255
|
*/
|
|
167992
|
-
|
|
167993
|
-
|
|
167994
|
-
return this.reloadWithFileText();
|
|
167995
|
-
}
|
|
167996
|
-
return false;
|
|
168256
|
+
scheduleReloadIfNeeded() {
|
|
168257
|
+
return !this.pendingReloadFromDisk && !this.ownFileText ? this.pendingReloadFromDisk = true : false;
|
|
167997
168258
|
}
|
|
167998
168259
|
delayReloadFromFileIntoText() {
|
|
167999
168260
|
this.pendingReloadFromDisk = true;
|
|
@@ -168009,39 +168270,48 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168009
168270
|
return !!this.fileSize ? this.fileSize : !!this.text ? this.text.length : !!this.svc ? this.svc.getSnapshot().getLength() : this.getSnapshot().getLength();
|
|
168010
168271
|
}
|
|
168011
168272
|
getSnapshot() {
|
|
168012
|
-
|
|
168273
|
+
var _a2, _b;
|
|
168274
|
+
return ((_a2 = this.tryUseScriptVersionCache()) == null ? void 0 : _a2.getSnapshot()) || ((_b = this.textSnapshot) != null ? _b : this.textSnapshot = ScriptSnapshot.fromString(Debug.checkDefined(this.text)));
|
|
168013
168275
|
}
|
|
168014
|
-
getAbsolutePositionAndLineText(
|
|
168015
|
-
|
|
168276
|
+
getAbsolutePositionAndLineText(oneBasedLine) {
|
|
168277
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168278
|
+
if (svc)
|
|
168279
|
+
return svc.getAbsolutePositionAndLineText(oneBasedLine);
|
|
168280
|
+
const lineMap = this.getLineMap();
|
|
168281
|
+
return oneBasedLine <= lineMap.length ? {
|
|
168282
|
+
absolutePosition: lineMap[oneBasedLine - 1],
|
|
168283
|
+
lineText: this.text.substring(lineMap[oneBasedLine - 1], lineMap[oneBasedLine])
|
|
168284
|
+
} : {
|
|
168285
|
+
absolutePosition: this.text.length,
|
|
168286
|
+
lineText: void 0
|
|
168287
|
+
};
|
|
168016
168288
|
}
|
|
168017
168289
|
/**
|
|
168018
168290
|
* @param line 0 based index
|
|
168019
168291
|
*/
|
|
168020
168292
|
lineToTextSpan(line) {
|
|
168021
|
-
|
|
168022
|
-
|
|
168023
|
-
|
|
168024
|
-
|
|
168025
|
-
|
|
168026
|
-
|
|
168027
|
-
return
|
|
168293
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168294
|
+
if (svc)
|
|
168295
|
+
return svc.lineToTextSpan(line);
|
|
168296
|
+
const lineMap = this.getLineMap();
|
|
168297
|
+
const start = lineMap[line];
|
|
168298
|
+
const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
|
|
168299
|
+
return createTextSpanFromBounds(start, end);
|
|
168028
168300
|
}
|
|
168029
168301
|
/**
|
|
168030
168302
|
* @param line 1 based index
|
|
168031
168303
|
* @param offset 1 based index
|
|
168032
168304
|
*/
|
|
168033
168305
|
lineOffsetToPosition(line, offset, allowEdits) {
|
|
168034
|
-
|
|
168035
|
-
|
|
168036
|
-
}
|
|
168037
|
-
return this.svc.lineOffsetToPosition(line, offset);
|
|
168306
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168307
|
+
return svc ? svc.lineOffsetToPosition(line, offset) : computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
|
|
168038
168308
|
}
|
|
168039
168309
|
positionToLineOffset(position) {
|
|
168040
|
-
|
|
168041
|
-
|
|
168042
|
-
return
|
|
168043
|
-
}
|
|
168044
|
-
return
|
|
168310
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168311
|
+
if (svc)
|
|
168312
|
+
return svc.positionToLineOffset(position);
|
|
168313
|
+
const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
|
|
168314
|
+
return { line: line + 1, offset: character + 1 };
|
|
168045
168315
|
}
|
|
168046
168316
|
getFileTextAndSize(tempFileName) {
|
|
168047
168317
|
let text;
|
|
@@ -168059,19 +168329,25 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168059
168329
|
}
|
|
168060
168330
|
return { text: getText() };
|
|
168061
168331
|
}
|
|
168332
|
+
/** @internal */
|
|
168062
168333
|
switchToScriptVersionCache() {
|
|
168063
168334
|
if (!this.svc || this.pendingReloadFromDisk) {
|
|
168064
168335
|
this.svc = ScriptVersionCache.fromString(this.getOrLoadText());
|
|
168065
|
-
this.
|
|
168336
|
+
this.textSnapshot = void 0;
|
|
168337
|
+
this.version++;
|
|
168066
168338
|
}
|
|
168067
168339
|
return this.svc;
|
|
168068
168340
|
}
|
|
168069
|
-
|
|
168070
|
-
if (this.
|
|
168071
|
-
|
|
168341
|
+
tryUseScriptVersionCache() {
|
|
168342
|
+
if (!this.svc || this.pendingReloadFromDisk) {
|
|
168343
|
+
this.getOrLoadText();
|
|
168072
168344
|
}
|
|
168073
|
-
if (this.
|
|
168074
|
-
this.
|
|
168345
|
+
if (this.isOpen) {
|
|
168346
|
+
if (!this.svc && !this.textSnapshot) {
|
|
168347
|
+
this.svc = ScriptVersionCache.fromString(Debug.checkDefined(this.text));
|
|
168348
|
+
this.textSnapshot = void 0;
|
|
168349
|
+
}
|
|
168350
|
+
return this.svc;
|
|
168075
168351
|
}
|
|
168076
168352
|
return this.svc;
|
|
168077
168353
|
}
|
|
@@ -168084,13 +168360,14 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168084
168360
|
}
|
|
168085
168361
|
getLineMap() {
|
|
168086
168362
|
Debug.assert(!this.svc, "ScriptVersionCache should not be set");
|
|
168087
|
-
return this.lineMap || (this.lineMap = computeLineStarts(this.
|
|
168363
|
+
return this.lineMap || (this.lineMap = computeLineStarts(Debug.checkDefined(this.text)));
|
|
168088
168364
|
}
|
|
168089
168365
|
getLineInfo() {
|
|
168090
|
-
|
|
168366
|
+
const svc = this.tryUseScriptVersionCache();
|
|
168367
|
+
if (svc) {
|
|
168091
168368
|
return {
|
|
168092
|
-
getLineCount: () =>
|
|
168093
|
-
getLineText: (line) =>
|
|
168369
|
+
getLineCount: () => svc.getLineCount(),
|
|
168370
|
+
getLineText: (line) => svc.getAbsolutePositionAndLineText(line + 1).lineText
|
|
168094
168371
|
};
|
|
168095
168372
|
}
|
|
168096
168373
|
const lineMap = this.getLineMap();
|
|
@@ -168111,20 +168388,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168111
168388
|
this.isDynamic = isDynamicFileName(fileName);
|
|
168112
168389
|
this.textStorage = new TextStorage(host, this, initialVersion);
|
|
168113
168390
|
if (hasMixedContent || this.isDynamic) {
|
|
168114
|
-
this.textStorage.reload("");
|
|
168115
168391
|
this.realpath = this.path;
|
|
168116
168392
|
}
|
|
168117
168393
|
this.scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName);
|
|
168118
168394
|
}
|
|
168119
168395
|
/** @internal */
|
|
168120
|
-
getVersion() {
|
|
168121
|
-
return this.textStorage.version;
|
|
168122
|
-
}
|
|
168123
|
-
/** @internal */
|
|
168124
|
-
getTelemetryFileSize() {
|
|
168125
|
-
return this.textStorage.getTelemetryFileSize();
|
|
168126
|
-
}
|
|
168127
|
-
/** @internal */
|
|
168128
168396
|
isDynamicOrHasMixedContent() {
|
|
168129
168397
|
return this.hasMixedContent || this.isDynamic;
|
|
168130
168398
|
}
|
|
@@ -168139,11 +168407,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168139
168407
|
}
|
|
168140
168408
|
close(fileExists = true) {
|
|
168141
168409
|
this.textStorage.isOpen = false;
|
|
168142
|
-
if (this.
|
|
168143
|
-
if (this.textStorage.reload("")) {
|
|
168144
|
-
this.markContainingProjectsAsDirty();
|
|
168145
|
-
}
|
|
168146
|
-
} else if (this.textStorage.reloadFromDisk()) {
|
|
168410
|
+
if (fileExists && this.textStorage.scheduleReloadIfNeeded()) {
|
|
168147
168411
|
this.markContainingProjectsAsDirty();
|
|
168148
168412
|
}
|
|
168149
168413
|
}
|
|
@@ -168323,22 +168587,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168323
168587
|
this.markContainingProjectsAsDirty();
|
|
168324
168588
|
}
|
|
168325
168589
|
reloadFromFile(tempFileName) {
|
|
168326
|
-
if (this.
|
|
168327
|
-
this.textStorage.reload("");
|
|
168590
|
+
if (this.textStorage.reloadWithFileText(tempFileName)) {
|
|
168328
168591
|
this.markContainingProjectsAsDirty();
|
|
168329
168592
|
return true;
|
|
168330
|
-
} else {
|
|
168331
|
-
if (this.textStorage.reloadWithFileText(tempFileName)) {
|
|
168332
|
-
this.markContainingProjectsAsDirty();
|
|
168333
|
-
return true;
|
|
168334
|
-
}
|
|
168335
168593
|
}
|
|
168336
168594
|
return false;
|
|
168337
168595
|
}
|
|
168338
|
-
/** @internal */
|
|
168339
|
-
getAbsolutePositionAndLineText(line) {
|
|
168340
|
-
return this.textStorage.getAbsolutePositionAndLineText(line);
|
|
168341
|
-
}
|
|
168342
168596
|
editContent(start, end, newText) {
|
|
168343
168597
|
this.textStorage.edit(start, end, newText);
|
|
168344
168598
|
this.markContainingProjectsAsDirty();
|
|
@@ -168378,10 +168632,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168378
168632
|
return this.scriptKind === 1 /* JS */ || this.scriptKind === 2 /* JSX */;
|
|
168379
168633
|
}
|
|
168380
168634
|
/** @internal */
|
|
168381
|
-
getLineInfo() {
|
|
168382
|
-
return this.textStorage.getLineInfo();
|
|
168383
|
-
}
|
|
168384
|
-
/** @internal */
|
|
168385
168635
|
closeSourceMapFileWatcher() {
|
|
168386
168636
|
if (this.sourceMapFilePath && !isString(this.sourceMapFilePath)) {
|
|
168387
168637
|
closeFileWatcherOf(this.sourceMapFilePath);
|
|
@@ -168512,7 +168762,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168512
168762
|
deferredSize: 0
|
|
168513
168763
|
};
|
|
168514
168764
|
for (const info of infos) {
|
|
168515
|
-
const fileSize = includeSizes ? info.getTelemetryFileSize() : 0;
|
|
168765
|
+
const fileSize = includeSizes ? info.textStorage.getTelemetryFileSize() : 0;
|
|
168516
168766
|
switch (info.scriptKind) {
|
|
168517
168767
|
case 1 /* JS */:
|
|
168518
168768
|
result.js += 1;
|
|
@@ -169542,10 +169792,26 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169542
169792
|
const elapsed = timestamp() - start;
|
|
169543
169793
|
this.sendPerformanceEvent("UpdateGraph", elapsed);
|
|
169544
169794
|
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.
|
|
169795
|
+
if (this.projectService.logger.isTestLogger) {
|
|
169796
|
+
if (this.program !== oldProgram) {
|
|
169797
|
+
this.print(
|
|
169798
|
+
/*writeProjectFileNames*/
|
|
169799
|
+
true,
|
|
169800
|
+
this.hasAddedorRemovedFiles,
|
|
169801
|
+
/*writeFileVersionAndText*/
|
|
169802
|
+
true
|
|
169803
|
+
);
|
|
169804
|
+
} else {
|
|
169805
|
+
this.writeLog(`Same program as before`);
|
|
169806
|
+
}
|
|
169807
|
+
} else if (this.hasAddedorRemovedFiles) {
|
|
169546
169808
|
this.print(
|
|
169547
169809
|
/*writeProjectFileNames*/
|
|
169548
|
-
true
|
|
169810
|
+
true,
|
|
169811
|
+
/*writeFileExplaination*/
|
|
169812
|
+
true,
|
|
169813
|
+
/*writeFileVersionAndText*/
|
|
169814
|
+
false
|
|
169549
169815
|
);
|
|
169550
169816
|
} else if (this.program !== oldProgram) {
|
|
169551
169817
|
this.writeLog(`Different program with same set of files`);
|
|
@@ -169655,6 +169921,16 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169655
169921
|
return this.projectService.getScriptInfo(uncheckedFileName);
|
|
169656
169922
|
}
|
|
169657
169923
|
filesToString(writeProjectFileNames) {
|
|
169924
|
+
return this.filesToStringWorker(
|
|
169925
|
+
writeProjectFileNames,
|
|
169926
|
+
/*writeFileExplaination*/
|
|
169927
|
+
true,
|
|
169928
|
+
/*writeFileVersionAndText*/
|
|
169929
|
+
false
|
|
169930
|
+
);
|
|
169931
|
+
}
|
|
169932
|
+
/** @internal */
|
|
169933
|
+
filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
|
|
169658
169934
|
if (this.isInitialLoadPending())
|
|
169659
169935
|
return " Files (0) InitialLoadPending\n";
|
|
169660
169936
|
if (!this.program)
|
|
@@ -169664,23 +169940,33 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169664
169940
|
`;
|
|
169665
169941
|
if (writeProjectFileNames) {
|
|
169666
169942
|
for (const file of sourceFiles) {
|
|
169667
|
-
strBuilder += ` ${file.fileName}
|
|
169943
|
+
strBuilder += ` ${file.fileName}${writeFileVersionAndText ? ` ${file.version} ${JSON.stringify(file.text)}` : ""}
|
|
169668
169944
|
`;
|
|
169669
169945
|
}
|
|
169670
|
-
|
|
169671
|
-
|
|
169946
|
+
if (writeFileExplaination) {
|
|
169947
|
+
strBuilder += "\n\n";
|
|
169948
|
+
explainFiles(this.program, (s) => strBuilder += ` ${s}
|
|
169672
169949
|
`);
|
|
169950
|
+
}
|
|
169673
169951
|
}
|
|
169674
169952
|
return strBuilder;
|
|
169675
169953
|
}
|
|
169676
169954
|
/** @internal */
|
|
169677
|
-
print(writeProjectFileNames) {
|
|
169955
|
+
print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
|
|
169678
169956
|
this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
|
|
169679
|
-
this.writeLog(this.
|
|
169957
|
+
this.writeLog(this.filesToStringWorker(
|
|
169958
|
+
writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
|
|
169959
|
+
writeFileExplaination && this.projectService.logger.hasLevel(3 /* verbose */),
|
|
169960
|
+
writeFileVersionAndText && this.projectService.logger.hasLevel(3 /* verbose */)
|
|
169961
|
+
));
|
|
169680
169962
|
this.writeLog("-----------------------------------------------");
|
|
169681
169963
|
if (this.autoImportProviderHost) {
|
|
169682
169964
|
this.autoImportProviderHost.print(
|
|
169683
169965
|
/*writeProjectFileNames*/
|
|
169966
|
+
false,
|
|
169967
|
+
/*writeFileExplaination*/
|
|
169968
|
+
false,
|
|
169969
|
+
/*writeFileVersionAndText*/
|
|
169684
169970
|
false
|
|
169685
169971
|
);
|
|
169686
169972
|
}
|
|
@@ -170682,7 +170968,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170682
170968
|
return !!this.externalProjectRefCount;
|
|
170683
170969
|
}
|
|
170684
170970
|
getEffectiveTypeRoots() {
|
|
170685
|
-
return getEffectiveTypeRoots(this.getCompilationSettings(), this
|
|
170971
|
+
return getEffectiveTypeRoots(this.getCompilationSettings(), this) || [];
|
|
170686
170972
|
}
|
|
170687
170973
|
/** @internal */
|
|
170688
170974
|
updateErrorOnNoInputFiles(fileNames) {
|
|
@@ -170931,6 +171217,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170931
171217
|
function printProjectWithoutFileNames(project) {
|
|
170932
171218
|
project.print(
|
|
170933
171219
|
/*writeProjectFileNames*/
|
|
171220
|
+
false,
|
|
171221
|
+
/*writeFileExplaination*/
|
|
171222
|
+
false,
|
|
171223
|
+
/*writeFileVersionAndText*/
|
|
170934
171224
|
false
|
|
170935
171225
|
);
|
|
170936
171226
|
}
|
|
@@ -171635,7 +171925,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171635
171925
|
this.logger.info("`remove Project::");
|
|
171636
171926
|
project.print(
|
|
171637
171927
|
/*writeProjectFileNames*/
|
|
171638
|
-
true
|
|
171928
|
+
true,
|
|
171929
|
+
/*writeFileExplaination*/
|
|
171930
|
+
true,
|
|
171931
|
+
/*writeFileVersionAndText*/
|
|
171932
|
+
false
|
|
171639
171933
|
);
|
|
171640
171934
|
project.close();
|
|
171641
171935
|
if (Debug.shouldAssert(1 /* Normal */)) {
|
|
@@ -171774,7 +172068,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171774
172068
|
}
|
|
171775
172069
|
deleteScriptInfo(info) {
|
|
171776
172070
|
this.filenameToScriptInfo.delete(info.path);
|
|
171777
|
-
this.filenameToScriptInfoVersion.set(info.path, info.
|
|
172071
|
+
this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
|
|
171778
172072
|
const realpath = info.getRealpathIfDifferent();
|
|
171779
172073
|
if (realpath) {
|
|
171780
172074
|
this.realpathToScriptInfos.remove(realpath, info);
|
|
@@ -172858,7 +173152,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
172858
173152
|
const documentPositionMapper = getDocumentPositionMapper(
|
|
172859
173153
|
{ getCanonicalFileName: this.toCanonicalFileName, log: (s) => this.logger.info(s), getSourceFileLike: (f) => this.getSourceFileLike(f, projectName, declarationInfo) },
|
|
172860
173154
|
declarationInfo.fileName,
|
|
172861
|
-
declarationInfo.getLineInfo(),
|
|
173155
|
+
declarationInfo.textStorage.getLineInfo(),
|
|
172862
173156
|
readMapFile
|
|
172863
173157
|
);
|
|
172864
173158
|
readMapFile = void 0;
|
|
@@ -174687,7 +174981,6 @@ ${json}${newLine}`;
|
|
|
174687
174981
|
"signatureHelp-full" /* SignatureHelpFull */,
|
|
174688
174982
|
"navto" /* Navto */,
|
|
174689
174983
|
"navto-full" /* NavtoFull */,
|
|
174690
|
-
"occurrences" /* Occurrences */,
|
|
174691
174984
|
"documentHighlights" /* DocumentHighlights */,
|
|
174692
174985
|
"documentHighlights-full" /* DocumentHighlightsFull */
|
|
174693
174986
|
];
|
|
@@ -175120,9 +175413,6 @@ ${json}${newLine}`;
|
|
|
175120
175413
|
false
|
|
175121
175414
|
));
|
|
175122
175415
|
},
|
|
175123
|
-
["occurrences" /* Occurrences */]: (request) => {
|
|
175124
|
-
return this.requiredResponse(this.getOccurrences(request.arguments));
|
|
175125
|
-
},
|
|
175126
175416
|
["documentHighlights" /* DocumentHighlights */]: (request) => {
|
|
175127
175417
|
return this.requiredResponse(this.getDocumentHighlights(
|
|
175128
175418
|
request.arguments,
|
|
@@ -176085,21 +176375,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176085
176375
|
const implementations = this.mapImplementationLocations(project.getLanguageService().getImplementationAtPosition(file, position) || emptyArray2, project);
|
|
176086
176376
|
return simplifiedResult ? implementations.map(({ fileName, textSpan, contextSpan }) => this.toFileSpanWithContext(fileName, textSpan, contextSpan, project)) : implementations.map(Session3.mapToOriginalLocation);
|
|
176087
176377
|
}
|
|
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
176378
|
getSyntacticDiagnosticsSync(args) {
|
|
176104
176379
|
const { configFile } = this.getConfigFileAndProject(args);
|
|
176105
176380
|
if (configFile) {
|
|
@@ -176510,7 +176785,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176510
176785
|
formatOptions
|
|
176511
176786
|
);
|
|
176512
176787
|
if (args.key === "\n" && (!edits || edits.length === 0 || allEditsBeforePos(edits, position))) {
|
|
176513
|
-
const { lineText, absolutePosition } = scriptInfo.getAbsolutePositionAndLineText(args.line);
|
|
176788
|
+
const { lineText, absolutePosition } = scriptInfo.textStorage.getAbsolutePositionAndLineText(args.line);
|
|
176514
176789
|
if (lineText && lineText.search("\\S") < 0) {
|
|
176515
176790
|
const preferredIndent = languageService.getIndentationAtPosition(file, position, formatOptions);
|
|
176516
176791
|
let hasIndent = 0;
|
|
@@ -176735,6 +177010,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176735
177010
|
change(args) {
|
|
176736
177011
|
const scriptInfo = this.projectService.getScriptInfo(args.file);
|
|
176737
177012
|
Debug.assert(!!scriptInfo);
|
|
177013
|
+
scriptInfo.textStorage.switchToScriptVersionCache();
|
|
176738
177014
|
const start = scriptInfo.lineOffsetToPosition(args.line, args.offset);
|
|
176739
177015
|
const end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);
|
|
176740
177016
|
if (start >= 0) {
|
|
@@ -177027,10 +177303,10 @@ ${e.message}`;
|
|
|
177027
177303
|
}
|
|
177028
177304
|
return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
|
|
177029
177305
|
}
|
|
177030
|
-
getCombinedCodeFix({ scope, fixId:
|
|
177306
|
+
getCombinedCodeFix({ scope, fixId: fixId52 }, simplifiedResult) {
|
|
177031
177307
|
Debug.assert(scope.type === "file");
|
|
177032
177308
|
const { file, project } = this.getFileAndProject(scope.args);
|
|
177033
|
-
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file },
|
|
177309
|
+
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId52, this.getFormatOptions(file), this.getPreferences(file));
|
|
177034
177310
|
if (simplifiedResult) {
|
|
177035
177311
|
return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
|
|
177036
177312
|
} else {
|
|
@@ -177069,8 +177345,8 @@ ${e.message}`;
|
|
|
177069
177345
|
mapCodeAction({ description: description2, changes, commands }) {
|
|
177070
177346
|
return { description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands };
|
|
177071
177347
|
}
|
|
177072
|
-
mapCodeFixAction({ fixName: fixName8, description: description2, changes, commands, fixId:
|
|
177073
|
-
return { fixName: fixName8, description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId:
|
|
177348
|
+
mapCodeFixAction({ fixName: fixName8, description: description2, changes, commands, fixId: fixId52, fixAllDescription }) {
|
|
177349
|
+
return { fixName: fixName8, description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId52, fixAllDescription };
|
|
177074
177350
|
}
|
|
177075
177351
|
mapTextChangesToCodeEdits(textChanges2) {
|
|
177076
177352
|
return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
|
|
@@ -180100,7 +180376,6 @@ ${e.message}`;
|
|
|
180100
180376
|
nodeToDisplayParts: () => nodeToDisplayParts,
|
|
180101
180377
|
noop: () => noop,
|
|
180102
180378
|
noopFileWatcher: () => noopFileWatcher,
|
|
180103
|
-
noopPush: () => noopPush,
|
|
180104
180379
|
normalizePath: () => normalizePath,
|
|
180105
180380
|
normalizeSlashes: () => normalizeSlashes,
|
|
180106
180381
|
not: () => not,
|
|
@@ -182459,7 +182734,6 @@ ${e.message}`;
|
|
|
182459
182734
|
nodeToDisplayParts: () => nodeToDisplayParts,
|
|
182460
182735
|
noop: () => noop,
|
|
182461
182736
|
noopFileWatcher: () => noopFileWatcher,
|
|
182462
|
-
noopPush: () => noopPush,
|
|
182463
182737
|
normalizePath: () => normalizePath,
|
|
182464
182738
|
normalizeSlashes: () => normalizeSlashes,
|
|
182465
182739
|
not: () => not,
|