@typescript-deploys/pr-build 5.7.0-pr-59417-7 → 5.7.0-pr-59759-2
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/lib.es2015.core.d.ts +9 -9
- package/lib/lib.es2015.iterable.d.ts +27 -90
- package/lib/lib.es2015.symbol.wellknown.d.ts +10 -10
- package/lib/lib.es2016.array.include.d.ts +9 -9
- package/lib/lib.es2017.sharedmemory.d.ts +12 -12
- package/lib/lib.es2017.typedarrays.d.ts +9 -9
- package/lib/lib.es2020.bigint.d.ts +49 -51
- package/lib/lib.es2020.sharedmemory.d.ts +11 -11
- package/lib/lib.es2022.array.d.ts +11 -11
- package/lib/lib.es2023.array.d.ts +99 -99
- package/lib/lib.es5.d.ts +251 -251
- package/lib/tsc.js +105 -12
- package/lib/typescript.js +564 -388
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -429,6 +429,7 @@ __export(typescript_exports, {
|
|
|
429
429
|
createPackageJsonInfo: () => createPackageJsonInfo,
|
|
430
430
|
createParenthesizerRules: () => createParenthesizerRules,
|
|
431
431
|
createPatternMatcher: () => createPatternMatcher,
|
|
432
|
+
createPrefixSuffixTrie: () => createPrefixSuffixTrie,
|
|
432
433
|
createPrinter: () => createPrinter,
|
|
433
434
|
createPrinterWithDefaults: () => createPrinterWithDefaults,
|
|
434
435
|
createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
|
|
@@ -2265,7 +2266,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2265
2266
|
|
|
2266
2267
|
// src/compiler/corePublic.ts
|
|
2267
2268
|
var versionMajorMinor = "5.7";
|
|
2268
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2269
|
+
var version = `${versionMajorMinor}.0-insiders.20240826`;
|
|
2269
2270
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2270
2271
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2271
2272
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3745,6 +3746,73 @@ function skipWhile(array, predicate) {
|
|
|
3745
3746
|
function isNodeLikeSystem() {
|
|
3746
3747
|
return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof require !== "undefined";
|
|
3747
3748
|
}
|
|
3749
|
+
function createPrefixSuffixTrie() {
|
|
3750
|
+
function createTrie() {
|
|
3751
|
+
return {
|
|
3752
|
+
children: void 0,
|
|
3753
|
+
value: void 0
|
|
3754
|
+
};
|
|
3755
|
+
}
|
|
3756
|
+
const root = createTrie();
|
|
3757
|
+
function* iterateAllMatches(input) {
|
|
3758
|
+
var _a;
|
|
3759
|
+
let node = root;
|
|
3760
|
+
if (node.value) {
|
|
3761
|
+
yield* iterateSuffix(node.value, 0);
|
|
3762
|
+
}
|
|
3763
|
+
for (let i = 0; i < input.length; i++) {
|
|
3764
|
+
const child = (_a = node.children) == null ? void 0 : _a[input[i]];
|
|
3765
|
+
if (!child) break;
|
|
3766
|
+
if (child.value) {
|
|
3767
|
+
yield* iterateSuffix(child.value, i + 1);
|
|
3768
|
+
}
|
|
3769
|
+
node = child;
|
|
3770
|
+
}
|
|
3771
|
+
return;
|
|
3772
|
+
function* iterateSuffix(node2, start) {
|
|
3773
|
+
var _a2;
|
|
3774
|
+
if (node2.value) {
|
|
3775
|
+
yield node2.value;
|
|
3776
|
+
}
|
|
3777
|
+
for (let i = input.length - 1; i >= start; i--) {
|
|
3778
|
+
const child = (_a2 = node2.children) == null ? void 0 : _a2[input[i]];
|
|
3779
|
+
if (!child) break;
|
|
3780
|
+
if (child.value) {
|
|
3781
|
+
yield child.value;
|
|
3782
|
+
}
|
|
3783
|
+
node2 = child;
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
function set(prefix, suffix, fn) {
|
|
3788
|
+
let prefixNode = root;
|
|
3789
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
3790
|
+
const char = prefix[i];
|
|
3791
|
+
const children = prefixNode.children ?? (prefixNode.children = {});
|
|
3792
|
+
const child = children[char] ?? (children[char] = createTrie());
|
|
3793
|
+
prefixNode = child;
|
|
3794
|
+
}
|
|
3795
|
+
let suffixNode = prefixNode.value ?? (prefixNode.value = createTrie());
|
|
3796
|
+
for (let i = suffix.length - 1; i >= 0; i--) {
|
|
3797
|
+
const char = suffix[i];
|
|
3798
|
+
const children = suffixNode.children ?? (suffixNode.children = {});
|
|
3799
|
+
const child = children[char] ?? (children[char] = createTrie());
|
|
3800
|
+
suffixNode = child;
|
|
3801
|
+
}
|
|
3802
|
+
suffixNode.value = fn(suffixNode.value);
|
|
3803
|
+
}
|
|
3804
|
+
function hasAnyMatch(input) {
|
|
3805
|
+
for (const _ of iterateAllMatches(input)) {
|
|
3806
|
+
return true;
|
|
3807
|
+
}
|
|
3808
|
+
return false;
|
|
3809
|
+
}
|
|
3810
|
+
return {
|
|
3811
|
+
iterateAllMatches,
|
|
3812
|
+
set,
|
|
3813
|
+
hasAnyMatch
|
|
3814
|
+
};
|
|
3815
|
+
}
|
|
3748
3816
|
|
|
3749
3817
|
// src/compiler/debug.ts
|
|
3750
3818
|
var LogLevel = /* @__PURE__ */ ((LogLevel3) => {
|
|
@@ -9539,6 +9607,8 @@ var Diagnostics = {
|
|
|
9539
9607
|
/*reportsDeprecated*/
|
|
9540
9608
|
true
|
|
9541
9609
|
),
|
|
9610
|
+
Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1541, 1 /* Error */, "Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribut_1541", "Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
9611
|
+
Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1542, 1 /* Error */, "Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute_1542", "Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
9542
9612
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
9543
9613
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
9544
9614
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -11246,6 +11316,8 @@ var Diagnostics = {
|
|
|
11246
11316
|
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
11247
11317
|
Wrap_in_parentheses: diag(95194, 3 /* Message */, "Wrap_in_parentheses_95194", "Wrap in parentheses"),
|
|
11248
11318
|
Wrap_all_invalid_decorator_expressions_in_parentheses: diag(95195, 3 /* Message */, "Wrap_all_invalid_decorator_expressions_in_parentheses_95195", "Wrap all invalid decorator expressions in parentheses"),
|
|
11319
|
+
Add_resolution_mode_import_attribute: diag(95196, 3 /* Message */, "Add_resolution_mode_import_attribute_95196", "Add 'resolution-mode' import attribute"),
|
|
11320
|
+
Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it: diag(95197, 3 /* Message */, "Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it_95197", "Add 'resolution-mode' import attribute to all type-only imports that need it"),
|
|
11249
11321
|
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."),
|
|
11250
11322
|
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'."),
|
|
11251
11323
|
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?"),
|
|
@@ -53077,7 +53149,7 @@ function createTypeChecker(host) {
|
|
|
53077
53149
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
53078
53150
|
}
|
|
53079
53151
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
53080
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
53152
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
53081
53153
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
53082
53154
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
53083
53155
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -53146,14 +53218,11 @@ function createTypeChecker(host) {
|
|
|
53146
53218
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
53147
53219
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
53148
53220
|
}
|
|
53221
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_j = overrideHost.importClause) == null ? void 0 : _j.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
53149
53222
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
53150
53223
|
getSourceFileOfNode(errorNode),
|
|
53151
53224
|
errorNode,
|
|
53152
|
-
chainDiagnosticMessages(
|
|
53153
|
-
diagnosticDetails,
|
|
53154
|
-
Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead,
|
|
53155
|
-
moduleReference
|
|
53156
|
-
)
|
|
53225
|
+
chainDiagnosticMessages(diagnosticDetails, message, moduleReference)
|
|
53157
53226
|
));
|
|
53158
53227
|
}
|
|
53159
53228
|
}
|
|
@@ -53212,14 +53281,14 @@ function createTypeChecker(host) {
|
|
|
53212
53281
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
53213
53282
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
53214
53283
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
53215
|
-
const suggestedExt = (
|
|
53284
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
53216
53285
|
if (suggestedExt) {
|
|
53217
53286
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
53218
53287
|
} else {
|
|
53219
53288
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
53220
53289
|
}
|
|
53221
53290
|
} else {
|
|
53222
|
-
if ((
|
|
53291
|
+
if ((_l = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _l.alternateResult) {
|
|
53223
53292
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
53224
53293
|
errorOrSuggestion(
|
|
53225
53294
|
/*isError*/
|
|
@@ -64542,13 +64611,38 @@ function createTypeChecker(host) {
|
|
|
64542
64611
|
}
|
|
64543
64612
|
}
|
|
64544
64613
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
64545
|
-
|
|
64546
|
-
|
|
64614
|
+
let patterns = filter(types, isPatternLiteralType);
|
|
64615
|
+
const templateLiterals = filter(patterns, (t) => !!(t.flags & 134217728 /* TemplateLiteral */));
|
|
64616
|
+
const estimatedCount = templateLiterals.length * countWhere(types, (t) => !!(t.flags & 128 /* StringLiteral */));
|
|
64617
|
+
if (estimatedCount > 0) {
|
|
64618
|
+
const trie = createPrefixSuffixTrie();
|
|
64619
|
+
forEach(templateLiterals, (t) => {
|
|
64620
|
+
const prefix = t.texts[0];
|
|
64621
|
+
const suffix = t.texts[t.texts.length - 1];
|
|
64622
|
+
trie.set(prefix, suffix, (templates) => append(templates, t));
|
|
64623
|
+
});
|
|
64624
|
+
let i = types.length;
|
|
64625
|
+
outer: while (i > 0) {
|
|
64626
|
+
i--;
|
|
64627
|
+
const t = types[i];
|
|
64628
|
+
if (!(t.flags & 128 /* StringLiteral */)) continue;
|
|
64629
|
+
const text = t.value;
|
|
64630
|
+
for (const templates of trie.iterateAllMatches(text)) {
|
|
64631
|
+
if (some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) {
|
|
64632
|
+
orderedRemoveItemAt(types, i);
|
|
64633
|
+
continue outer;
|
|
64634
|
+
}
|
|
64635
|
+
}
|
|
64636
|
+
}
|
|
64637
|
+
patterns = filter(patterns, (t) => !!(t.flags & 268435456 /* StringMapping */));
|
|
64638
|
+
}
|
|
64639
|
+
if (patterns.length) {
|
|
64547
64640
|
let i = types.length;
|
|
64548
64641
|
while (i > 0) {
|
|
64549
64642
|
i--;
|
|
64550
64643
|
const t = types[i];
|
|
64551
|
-
if (t.flags & 128 /* StringLiteral */
|
|
64644
|
+
if (!(t.flags & 128 /* StringLiteral */)) continue;
|
|
64645
|
+
if (some(patterns, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) {
|
|
64552
64646
|
orderedRemoveItemAt(types, i);
|
|
64553
64647
|
}
|
|
64554
64648
|
}
|
|
@@ -150578,22 +150672,22 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
150578
150672
|
}
|
|
150579
150673
|
return [];
|
|
150580
150674
|
}
|
|
150581
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
150675
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes68, formatOptions, preferences = emptyOptions) {
|
|
150582
150676
|
synchronizeHostData();
|
|
150583
150677
|
const sourceFile = getValidSourceFile(fileName);
|
|
150584
150678
|
const span = createTextSpanFromBounds(start, end);
|
|
150585
150679
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
150586
|
-
return flatMap(deduplicate(
|
|
150680
|
+
return flatMap(deduplicate(errorCodes68, equateValues, compareValues), (errorCode) => {
|
|
150587
150681
|
cancellationToken.throwIfCancellationRequested();
|
|
150588
150682
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
150589
150683
|
});
|
|
150590
150684
|
}
|
|
150591
|
-
function getCombinedCodeFix(scope,
|
|
150685
|
+
function getCombinedCodeFix(scope, fixId56, formatOptions, preferences = emptyOptions) {
|
|
150592
150686
|
synchronizeHostData();
|
|
150593
150687
|
Debug.assert(scope.type === "file");
|
|
150594
150688
|
const sourceFile = getValidSourceFile(scope.fileName);
|
|
150595
150689
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
150596
|
-
return ts_codefix_exports.getAllFixes({ fixId:
|
|
150690
|
+
return ts_codefix_exports.getAllFixes({ fixId: fixId56, sourceFile, program, host, cancellationToken, formatContext, preferences });
|
|
150597
150691
|
}
|
|
150598
150692
|
function organizeImports2(args, formatOptions, preferences = emptyOptions) {
|
|
150599
150693
|
synchronizeHostData();
|
|
@@ -152265,14 +152359,14 @@ function createCodeFixActionWithoutFixAll(fixName8, changes, description3) {
|
|
|
152265
152359
|
void 0
|
|
152266
152360
|
);
|
|
152267
152361
|
}
|
|
152268
|
-
function createCodeFixAction(fixName8, changes, description3,
|
|
152269
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes,
|
|
152362
|
+
function createCodeFixAction(fixName8, changes, description3, fixId56, fixAllDescription, command) {
|
|
152363
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId56, diagnosticToString(fixAllDescription), command);
|
|
152270
152364
|
}
|
|
152271
|
-
function createCodeFixActionMaybeFixAll(fixName8, changes, description3,
|
|
152272
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes,
|
|
152365
|
+
function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId56, fixAllDescription, command) {
|
|
152366
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId56, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
152273
152367
|
}
|
|
152274
|
-
function createCodeFixActionWorker(fixName8, description3, changes,
|
|
152275
|
-
return { fixName: fixName8, description: description3, changes, fixId:
|
|
152368
|
+
function createCodeFixActionWorker(fixName8, description3, changes, fixId56, fixAllDescription, command) {
|
|
152369
|
+
return { fixName: fixName8, description: description3, changes, fixId: fixId56, fixAllDescription, commands: command ? [command] : void 0 };
|
|
152276
152370
|
}
|
|
152277
152371
|
function registerCodeFix(reg) {
|
|
152278
152372
|
for (const error2 of reg.errorCodes) {
|
|
@@ -152280,9 +152374,9 @@ function registerCodeFix(reg) {
|
|
|
152280
152374
|
errorCodeToFixes.add(String(error2), reg);
|
|
152281
152375
|
}
|
|
152282
152376
|
if (reg.fixIds) {
|
|
152283
|
-
for (const
|
|
152284
|
-
Debug.assert(!fixIdToRegistration.has(
|
|
152285
|
-
fixIdToRegistration.set(
|
|
152377
|
+
for (const fixId56 of reg.fixIds) {
|
|
152378
|
+
Debug.assert(!fixIdToRegistration.has(fixId56));
|
|
152379
|
+
fixIdToRegistration.set(fixId56, reg);
|
|
152286
152380
|
}
|
|
152287
152381
|
}
|
|
152288
152382
|
}
|
|
@@ -152291,15 +152385,15 @@ function getSupportedErrorCodes() {
|
|
|
152291
152385
|
return errorCodeToFixesArray ?? (errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys()));
|
|
152292
152386
|
}
|
|
152293
152387
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
152294
|
-
const { errorCodes:
|
|
152388
|
+
const { errorCodes: errorCodes68 } = registration;
|
|
152295
152389
|
let maybeFixableDiagnostics = 0;
|
|
152296
152390
|
for (const diag2 of diagnostics) {
|
|
152297
|
-
if (contains(
|
|
152391
|
+
if (contains(errorCodes68, diag2.code)) maybeFixableDiagnostics++;
|
|
152298
152392
|
if (maybeFixableDiagnostics > 1) break;
|
|
152299
152393
|
}
|
|
152300
152394
|
const fixAllUnavailable = maybeFixableDiagnostics < 2;
|
|
152301
|
-
return ({ fixId:
|
|
152302
|
-
return fixAllUnavailable ? action : { ...action, fixId:
|
|
152395
|
+
return ({ fixId: fixId56, fixAllDescription, ...action }) => {
|
|
152396
|
+
return fixAllUnavailable ? action : { ...action, fixId: fixId56, fixAllDescription };
|
|
152303
152397
|
};
|
|
152304
152398
|
}
|
|
152305
152399
|
function getFixes(context) {
|
|
@@ -152316,14 +152410,14 @@ function createCombinedCodeActions(changes, commands) {
|
|
|
152316
152410
|
function createFileTextChanges(fileName, textChanges2) {
|
|
152317
152411
|
return { fileName, textChanges: textChanges2 };
|
|
152318
152412
|
}
|
|
152319
|
-
function codeFixAll(context,
|
|
152413
|
+
function codeFixAll(context, errorCodes68, use) {
|
|
152320
152414
|
const commands = [];
|
|
152321
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
152415
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes68, (diag2) => use(t, diag2, commands)));
|
|
152322
152416
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
152323
152417
|
}
|
|
152324
|
-
function eachDiagnostic(context,
|
|
152418
|
+
function eachDiagnostic(context, errorCodes68, cb) {
|
|
152325
152419
|
for (const diag2 of getDiagnostics(context)) {
|
|
152326
|
-
if (contains(
|
|
152420
|
+
if (contains(errorCodes68, diag2.code)) {
|
|
152327
152421
|
cb(diag2);
|
|
152328
152422
|
}
|
|
152329
152423
|
}
|
|
@@ -152837,19 +152931,99 @@ function makeChange6(changeTracker, sourceFile, pos) {
|
|
|
152837
152931
|
changeTracker.replaceNode(sourceFile, decorator.expression, replacement);
|
|
152838
152932
|
}
|
|
152839
152933
|
|
|
152840
|
-
// src/services/codefixes/
|
|
152841
|
-
var fixId7 = "
|
|
152842
|
-
var errorCodes7 = [
|
|
152934
|
+
// src/services/codefixes/addMissingResolutionModeImportAttribute.ts
|
|
152935
|
+
var fixId7 = "addMissingResolutionModeImportAttribute";
|
|
152936
|
+
var errorCodes7 = [
|
|
152937
|
+
Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute.code,
|
|
152938
|
+
Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute.code
|
|
152939
|
+
];
|
|
152843
152940
|
registerCodeFix({
|
|
152844
152941
|
errorCodes: errorCodes7,
|
|
152845
|
-
getCodeActions: function
|
|
152846
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange7(t, context.sourceFile, context.span.start));
|
|
152847
|
-
return [createCodeFixAction(fixId7, changes, Diagnostics.
|
|
152942
|
+
getCodeActions: function getCodeActionsToAddMissingResolutionModeImportAttribute(context) {
|
|
152943
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange7(t, context.sourceFile, context.span.start, context.program, context.host, context.preferences));
|
|
152944
|
+
return [createCodeFixAction(fixId7, changes, Diagnostics.Add_resolution_mode_import_attribute, fixId7, Diagnostics.Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it)];
|
|
152848
152945
|
},
|
|
152849
152946
|
fixIds: [fixId7],
|
|
152850
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes7, (changes, diag2) => makeChange7(changes, diag2.file, diag2.start))
|
|
152947
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes7, (changes, diag2) => makeChange7(changes, diag2.file, diag2.start, context.program, context.host, context.preferences))
|
|
152851
152948
|
});
|
|
152852
|
-
function makeChange7(changeTracker, sourceFile,
|
|
152949
|
+
function makeChange7(changeTracker, sourceFile, pos, program, host, preferences) {
|
|
152950
|
+
var _a, _b, _c;
|
|
152951
|
+
const token = getTokenAtPosition(sourceFile, pos);
|
|
152952
|
+
const importNode = findAncestor(token, or(isImportDeclaration, isImportTypeNode));
|
|
152953
|
+
Debug.assert(!!importNode, "Expected position to be owned by an ImportDeclaration or ImportType.");
|
|
152954
|
+
const useSingleQuotes = getQuotePreference(sourceFile, preferences) === 0 /* Single */;
|
|
152955
|
+
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importNode);
|
|
152956
|
+
const canUseImportMode = !moduleSpecifier || ((_a = resolveModuleName(
|
|
152957
|
+
moduleSpecifier.text,
|
|
152958
|
+
sourceFile.fileName,
|
|
152959
|
+
program.getCompilerOptions(),
|
|
152960
|
+
host,
|
|
152961
|
+
program.getModuleResolutionCache(),
|
|
152962
|
+
/*redirectedReference*/
|
|
152963
|
+
void 0,
|
|
152964
|
+
99 /* ESNext */
|
|
152965
|
+
).resolvedModule) == null ? void 0 : _a.resolvedFileName) === ((_c = (_b = program.getResolvedModuleFromModuleSpecifier(
|
|
152966
|
+
moduleSpecifier,
|
|
152967
|
+
sourceFile
|
|
152968
|
+
)) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.resolvedFileName);
|
|
152969
|
+
const attributes = importNode.attributes ? factory.updateImportAttributes(
|
|
152970
|
+
importNode.attributes,
|
|
152971
|
+
factory.createNodeArray([
|
|
152972
|
+
...importNode.attributes.elements,
|
|
152973
|
+
factory.createImportAttribute(
|
|
152974
|
+
factory.createStringLiteral("resolution-mode", useSingleQuotes),
|
|
152975
|
+
factory.createStringLiteral(canUseImportMode ? "import" : "require", useSingleQuotes)
|
|
152976
|
+
)
|
|
152977
|
+
], importNode.attributes.elements.hasTrailingComma),
|
|
152978
|
+
importNode.attributes.multiLine
|
|
152979
|
+
) : factory.createImportAttributes(
|
|
152980
|
+
factory.createNodeArray([
|
|
152981
|
+
factory.createImportAttribute(
|
|
152982
|
+
factory.createStringLiteral("resolution-mode", useSingleQuotes),
|
|
152983
|
+
factory.createStringLiteral(canUseImportMode ? "import" : "require", useSingleQuotes)
|
|
152984
|
+
)
|
|
152985
|
+
])
|
|
152986
|
+
);
|
|
152987
|
+
if (importNode.kind === 272 /* ImportDeclaration */) {
|
|
152988
|
+
changeTracker.replaceNode(
|
|
152989
|
+
sourceFile,
|
|
152990
|
+
importNode,
|
|
152991
|
+
factory.updateImportDeclaration(
|
|
152992
|
+
importNode,
|
|
152993
|
+
importNode.modifiers,
|
|
152994
|
+
importNode.importClause,
|
|
152995
|
+
importNode.moduleSpecifier,
|
|
152996
|
+
attributes
|
|
152997
|
+
)
|
|
152998
|
+
);
|
|
152999
|
+
} else {
|
|
153000
|
+
changeTracker.replaceNode(
|
|
153001
|
+
sourceFile,
|
|
153002
|
+
importNode,
|
|
153003
|
+
factory.updateImportTypeNode(
|
|
153004
|
+
importNode,
|
|
153005
|
+
importNode.argument,
|
|
153006
|
+
attributes,
|
|
153007
|
+
importNode.qualifier,
|
|
153008
|
+
importNode.typeArguments
|
|
153009
|
+
)
|
|
153010
|
+
);
|
|
153011
|
+
}
|
|
153012
|
+
}
|
|
153013
|
+
|
|
153014
|
+
// src/services/codefixes/addNameToNamelessParameter.ts
|
|
153015
|
+
var fixId8 = "addNameToNamelessParameter";
|
|
153016
|
+
var errorCodes8 = [Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
|
153017
|
+
registerCodeFix({
|
|
153018
|
+
errorCodes: errorCodes8,
|
|
153019
|
+
getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) {
|
|
153020
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, context.sourceFile, context.span.start));
|
|
153021
|
+
return [createCodeFixAction(fixId8, changes, Diagnostics.Add_parameter_name, fixId8, Diagnostics.Add_names_to_all_parameters_without_names)];
|
|
153022
|
+
},
|
|
153023
|
+
fixIds: [fixId8],
|
|
153024
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes8, (changes, diag2) => makeChange8(changes, diag2.file, diag2.start))
|
|
153025
|
+
});
|
|
153026
|
+
function makeChange8(changeTracker, sourceFile, start) {
|
|
152853
153027
|
const token = getTokenAtPosition(sourceFile, start);
|
|
152854
153028
|
const param = token.parent;
|
|
152855
153029
|
if (!isParameter(param)) {
|
|
@@ -152890,13 +153064,13 @@ function tryGetNextParam(sourceFile, param) {
|
|
|
152890
153064
|
|
|
152891
153065
|
// src/services/codefixes/addOptionalPropertyUndefined.ts
|
|
152892
153066
|
var addOptionalPropertyUndefined = "addOptionalPropertyUndefined";
|
|
152893
|
-
var
|
|
153067
|
+
var errorCodes9 = [
|
|
152894
153068
|
Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target.code,
|
|
152895
153069
|
Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
|
|
152896
153070
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code
|
|
152897
153071
|
];
|
|
152898
153072
|
registerCodeFix({
|
|
152899
|
-
errorCodes:
|
|
153073
|
+
errorCodes: errorCodes9,
|
|
152900
153074
|
getCodeActions(context) {
|
|
152901
153075
|
const typeChecker = context.program.getTypeChecker();
|
|
152902
153076
|
const toAdd = getPropertiesToAdd(context.sourceFile, context.span, typeChecker);
|
|
@@ -152967,18 +153141,18 @@ function addUndefinedToOptionalProperty(changes, toAdd) {
|
|
|
152967
153141
|
}
|
|
152968
153142
|
|
|
152969
153143
|
// src/services/codefixes/annotateWithTypeFromJSDoc.ts
|
|
152970
|
-
var
|
|
152971
|
-
var
|
|
153144
|
+
var fixId9 = "annotateWithTypeFromJSDoc";
|
|
153145
|
+
var errorCodes10 = [Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types.code];
|
|
152972
153146
|
registerCodeFix({
|
|
152973
|
-
errorCodes:
|
|
153147
|
+
errorCodes: errorCodes10,
|
|
152974
153148
|
getCodeActions(context) {
|
|
152975
153149
|
const decl = getDeclaration(context.sourceFile, context.span.start);
|
|
152976
153150
|
if (!decl) return;
|
|
152977
153151
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, context.sourceFile, decl));
|
|
152978
|
-
return [createCodeFixAction(
|
|
153152
|
+
return [createCodeFixAction(fixId9, changes, Diagnostics.Annotate_with_type_from_JSDoc, fixId9, Diagnostics.Annotate_everything_with_types_from_JSDoc)];
|
|
152979
153153
|
},
|
|
152980
|
-
fixIds: [
|
|
152981
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153154
|
+
fixIds: [fixId9],
|
|
153155
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes10, (changes, diag2) => {
|
|
152982
153156
|
const decl = getDeclaration(diag2.file, diag2.start);
|
|
152983
153157
|
if (decl) doChange8(changes, diag2.file, decl);
|
|
152984
153158
|
})
|
|
@@ -153135,16 +153309,16 @@ function transformJSDocIndexSignature(node) {
|
|
|
153135
153309
|
}
|
|
153136
153310
|
|
|
153137
153311
|
// src/services/codefixes/convertFunctionToEs6Class.ts
|
|
153138
|
-
var
|
|
153139
|
-
var
|
|
153312
|
+
var fixId10 = "convertFunctionToEs6Class";
|
|
153313
|
+
var errorCodes11 = [Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration.code];
|
|
153140
153314
|
registerCodeFix({
|
|
153141
|
-
errorCodes:
|
|
153315
|
+
errorCodes: errorCodes11,
|
|
153142
153316
|
getCodeActions(context) {
|
|
153143
153317
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, context.sourceFile, context.span.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()));
|
|
153144
|
-
return [createCodeFixAction(
|
|
153318
|
+
return [createCodeFixAction(fixId10, changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId10, Diagnostics.Convert_all_constructor_functions_to_classes)];
|
|
153145
153319
|
},
|
|
153146
|
-
fixIds: [
|
|
153147
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153320
|
+
fixIds: [fixId10],
|
|
153321
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes11, (changes, err) => doChange9(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()))
|
|
153148
153322
|
});
|
|
153149
153323
|
function doChange9(changes, sourceFile, position, checker, preferences, compilerOptions) {
|
|
153150
153324
|
const ctorSymbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, position));
|
|
@@ -153416,18 +153590,18 @@ function tryGetPropertyName(node, compilerOptions, quotePreference) {
|
|
|
153416
153590
|
}
|
|
153417
153591
|
|
|
153418
153592
|
// src/services/codefixes/convertToAsyncFunction.ts
|
|
153419
|
-
var
|
|
153420
|
-
var
|
|
153593
|
+
var fixId11 = "convertToAsyncFunction";
|
|
153594
|
+
var errorCodes12 = [Diagnostics.This_may_be_converted_to_an_async_function.code];
|
|
153421
153595
|
var codeActionSucceeded = true;
|
|
153422
153596
|
registerCodeFix({
|
|
153423
|
-
errorCodes:
|
|
153597
|
+
errorCodes: errorCodes12,
|
|
153424
153598
|
getCodeActions(context) {
|
|
153425
153599
|
codeActionSucceeded = true;
|
|
153426
153600
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => convertToAsyncFunction(t, context.sourceFile, context.span.start, context.program.getTypeChecker()));
|
|
153427
|
-
return codeActionSucceeded ? [createCodeFixAction(
|
|
153601
|
+
return codeActionSucceeded ? [createCodeFixAction(fixId11, changes, Diagnostics.Convert_to_async_function, fixId11, Diagnostics.Convert_all_to_async_functions)] : [];
|
|
153428
153602
|
},
|
|
153429
|
-
fixIds: [
|
|
153430
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153603
|
+
fixIds: [fixId11],
|
|
153604
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes12, (changes, err) => convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker()))
|
|
153431
153605
|
});
|
|
153432
153606
|
function convertToAsyncFunction(changes, sourceFile, position, checker) {
|
|
153433
153607
|
const tokenAtPosition = getTokenAtPosition(sourceFile, position);
|
|
@@ -154627,19 +154801,19 @@ function convertedImports(newImports, useSitesToUnqualify) {
|
|
|
154627
154801
|
}
|
|
154628
154802
|
|
|
154629
154803
|
// src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts
|
|
154630
|
-
var
|
|
154631
|
-
var
|
|
154804
|
+
var fixId12 = "correctQualifiedNameToIndexedAccessType";
|
|
154805
|
+
var errorCodes13 = [Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code];
|
|
154632
154806
|
registerCodeFix({
|
|
154633
|
-
errorCodes:
|
|
154807
|
+
errorCodes: errorCodes13,
|
|
154634
154808
|
getCodeActions(context) {
|
|
154635
154809
|
const qualifiedName = getQualifiedName(context.sourceFile, context.span.start);
|
|
154636
154810
|
if (!qualifiedName) return void 0;
|
|
154637
154811
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, context.sourceFile, qualifiedName));
|
|
154638
154812
|
const newText = `${qualifiedName.left.text}["${qualifiedName.right.text}"]`;
|
|
154639
|
-
return [createCodeFixAction(
|
|
154813
|
+
return [createCodeFixAction(fixId12, changes, [Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId12, Diagnostics.Rewrite_all_as_indexed_access_types)];
|
|
154640
154814
|
},
|
|
154641
|
-
fixIds: [
|
|
154642
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154815
|
+
fixIds: [fixId12],
|
|
154816
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes13, (changes, diag2) => {
|
|
154643
154817
|
const q = getQualifiedName(diag2.file, diag2.start);
|
|
154644
154818
|
if (q) {
|
|
154645
154819
|
doChange10(changes, diag2.file, q);
|
|
@@ -154665,20 +154839,20 @@ function doChange10(changeTracker, sourceFile, qualifiedName) {
|
|
|
154665
154839
|
}
|
|
154666
154840
|
|
|
154667
154841
|
// src/services/codefixes/convertToTypeOnlyExport.ts
|
|
154668
|
-
var
|
|
154669
|
-
var
|
|
154842
|
+
var errorCodes14 = [Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type.code];
|
|
154843
|
+
var fixId13 = "convertToTypeOnlyExport";
|
|
154670
154844
|
registerCodeFix({
|
|
154671
|
-
errorCodes:
|
|
154845
|
+
errorCodes: errorCodes14,
|
|
154672
154846
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) {
|
|
154673
154847
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context));
|
|
154674
154848
|
if (changes.length) {
|
|
154675
|
-
return [createCodeFixAction(
|
|
154849
|
+
return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_export, fixId13, Diagnostics.Convert_all_re_exported_types_to_type_only_exports)];
|
|
154676
154850
|
}
|
|
154677
154851
|
},
|
|
154678
|
-
fixIds: [
|
|
154852
|
+
fixIds: [fixId13],
|
|
154679
154853
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) {
|
|
154680
154854
|
const fixedExportDeclarations = /* @__PURE__ */ new Map();
|
|
154681
|
-
return codeFixAll(context,
|
|
154855
|
+
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
154682
154856
|
const exportSpecifier = getExportSpecifierForDiagnosticSpan(diag2, context.sourceFile);
|
|
154683
154857
|
if (exportSpecifier && addToSeen(fixedExportDeclarations, getNodeId(exportSpecifier.parent.parent))) {
|
|
154684
154858
|
fixSingleExportDeclaration(changes, exportSpecifier, context);
|
|
@@ -154737,18 +154911,18 @@ function getTypeExportSpecifiers(originExportSpecifier, context) {
|
|
|
154737
154911
|
);
|
|
154738
154912
|
return filter(exportClause.elements, (element) => {
|
|
154739
154913
|
var _a;
|
|
154740
|
-
return element === originExportSpecifier || ((_a = findDiagnosticForNode(element, diagnostics)) == null ? void 0 : _a.code) ===
|
|
154914
|
+
return element === originExportSpecifier || ((_a = findDiagnosticForNode(element, diagnostics)) == null ? void 0 : _a.code) === errorCodes14[0];
|
|
154741
154915
|
});
|
|
154742
154916
|
}
|
|
154743
154917
|
|
|
154744
154918
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
154745
|
-
var
|
|
154919
|
+
var errorCodes15 = [
|
|
154746
154920
|
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code,
|
|
154747
154921
|
Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
154748
154922
|
];
|
|
154749
|
-
var
|
|
154923
|
+
var fixId14 = "convertToTypeOnlyImport";
|
|
154750
154924
|
registerCodeFix({
|
|
154751
|
-
errorCodes:
|
|
154925
|
+
errorCodes: errorCodes15,
|
|
154752
154926
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
154753
154927
|
var _a;
|
|
154754
154928
|
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
@@ -154756,15 +154930,15 @@ registerCodeFix({
|
|
|
154756
154930
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
|
|
154757
154931
|
const importDeclarationChanges = declaration.kind === 276 /* ImportSpecifier */ && isImportDeclaration(declaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
|
|
154758
154932
|
const mainAction = createCodeFixAction(
|
|
154759
|
-
|
|
154933
|
+
fixId14,
|
|
154760
154934
|
changes,
|
|
154761
154935
|
declaration.kind === 276 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type,
|
|
154762
|
-
|
|
154936
|
+
fixId14,
|
|
154763
154937
|
Diagnostics.Fix_all_with_type_only_imports
|
|
154764
154938
|
);
|
|
154765
154939
|
if (some(importDeclarationChanges)) {
|
|
154766
154940
|
return [
|
|
154767
|
-
createCodeFixActionWithoutFixAll(
|
|
154941
|
+
createCodeFixActionWithoutFixAll(fixId14, importDeclarationChanges, Diagnostics.Use_import_type),
|
|
154768
154942
|
mainAction
|
|
154769
154943
|
];
|
|
154770
154944
|
}
|
|
@@ -154772,10 +154946,10 @@ registerCodeFix({
|
|
|
154772
154946
|
}
|
|
154773
154947
|
return void 0;
|
|
154774
154948
|
},
|
|
154775
|
-
fixIds: [
|
|
154949
|
+
fixIds: [fixId14],
|
|
154776
154950
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
154777
154951
|
const fixedImportDeclarations = /* @__PURE__ */ new Set();
|
|
154778
|
-
return codeFixAll(context,
|
|
154952
|
+
return codeFixAll(context, errorCodes15, (changes, diag2) => {
|
|
154779
154953
|
const errorDeclaration = getDeclaration2(diag2.file, diag2.start);
|
|
154780
154954
|
if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 272 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
|
|
154781
154955
|
doChange11(changes, diag2.file, errorDeclaration);
|
|
@@ -154908,11 +155082,11 @@ function doChange11(changes, sourceFile, declaration) {
|
|
|
154908
155082
|
}
|
|
154909
155083
|
|
|
154910
155084
|
// src/services/codefixes/convertTypedefToType.ts
|
|
154911
|
-
var
|
|
154912
|
-
var
|
|
155085
|
+
var fixId15 = "convertTypedefToType";
|
|
155086
|
+
var errorCodes16 = [Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type.code];
|
|
154913
155087
|
registerCodeFix({
|
|
154914
|
-
fixIds: [
|
|
154915
|
-
errorCodes:
|
|
155088
|
+
fixIds: [fixId15],
|
|
155089
|
+
errorCodes: errorCodes16,
|
|
154916
155090
|
getCodeActions(context) {
|
|
154917
155091
|
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
154918
155092
|
const node = getTokenAtPosition(
|
|
@@ -154924,10 +155098,10 @@ registerCodeFix({
|
|
|
154924
155098
|
if (changes.length > 0) {
|
|
154925
155099
|
return [
|
|
154926
155100
|
createCodeFixAction(
|
|
154927
|
-
|
|
155101
|
+
fixId15,
|
|
154928
155102
|
changes,
|
|
154929
155103
|
Diagnostics.Convert_typedef_to_TypeScript_type,
|
|
154930
|
-
|
|
155104
|
+
fixId15,
|
|
154931
155105
|
Diagnostics.Convert_all_typedef_to_TypeScript_types
|
|
154932
155106
|
)
|
|
154933
155107
|
];
|
|
@@ -154935,7 +155109,7 @@ registerCodeFix({
|
|
|
154935
155109
|
},
|
|
154936
155110
|
getAllCodeActions: (context) => codeFixAll(
|
|
154937
155111
|
context,
|
|
154938
|
-
|
|
155112
|
+
errorCodes16,
|
|
154939
155113
|
(changes, diag2) => {
|
|
154940
155114
|
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options);
|
|
154941
155115
|
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
@@ -155078,10 +155252,10 @@ function getJSDocTypedefNodes(node) {
|
|
|
155078
155252
|
}
|
|
155079
155253
|
|
|
155080
155254
|
// src/services/codefixes/convertLiteralTypeToMappedType.ts
|
|
155081
|
-
var
|
|
155082
|
-
var
|
|
155255
|
+
var fixId16 = "convertLiteralTypeToMappedType";
|
|
155256
|
+
var errorCodes17 = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code];
|
|
155083
155257
|
registerCodeFix({
|
|
155084
|
-
errorCodes:
|
|
155258
|
+
errorCodes: errorCodes17,
|
|
155085
155259
|
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
155086
155260
|
const { sourceFile, span } = context;
|
|
155087
155261
|
const info = getInfo5(sourceFile, span.start);
|
|
@@ -155090,10 +155264,10 @@ registerCodeFix({
|
|
|
155090
155264
|
}
|
|
155091
155265
|
const { name, constraint } = info;
|
|
155092
155266
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, info));
|
|
155093
|
-
return [createCodeFixAction(
|
|
155267
|
+
return [createCodeFixAction(fixId16, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId16, Diagnostics.Convert_all_type_literals_to_mapped_type)];
|
|
155094
155268
|
},
|
|
155095
|
-
fixIds: [
|
|
155096
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
155269
|
+
fixIds: [fixId16],
|
|
155270
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes17, (changes, diag2) => {
|
|
155097
155271
|
const info = getInfo5(diag2.file, diag2.start);
|
|
155098
155272
|
if (info) {
|
|
155099
155273
|
doChange13(changes, diag2.file, info);
|
|
@@ -155139,25 +155313,25 @@ function doChange13(changes, sourceFile, { container, typeNode, constraint, name
|
|
|
155139
155313
|
}
|
|
155140
155314
|
|
|
155141
155315
|
// src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts
|
|
155142
|
-
var
|
|
155316
|
+
var errorCodes18 = [
|
|
155143
155317
|
Diagnostics.Class_0_incorrectly_implements_interface_1.code,
|
|
155144
155318
|
Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code
|
|
155145
155319
|
];
|
|
155146
|
-
var
|
|
155320
|
+
var fixId17 = "fixClassIncorrectlyImplementsInterface";
|
|
155147
155321
|
registerCodeFix({
|
|
155148
|
-
errorCodes:
|
|
155322
|
+
errorCodes: errorCodes18,
|
|
155149
155323
|
getCodeActions(context) {
|
|
155150
155324
|
const { sourceFile, span } = context;
|
|
155151
155325
|
const classDeclaration = getClass(sourceFile, span.start);
|
|
155152
155326
|
return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => {
|
|
155153
155327
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences));
|
|
155154
|
-
return changes.length === 0 ? void 0 : createCodeFixAction(
|
|
155328
|
+
return changes.length === 0 ? void 0 : createCodeFixAction(fixId17, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId17, Diagnostics.Implement_all_unimplemented_interfaces);
|
|
155155
155329
|
});
|
|
155156
155330
|
},
|
|
155157
|
-
fixIds: [
|
|
155331
|
+
fixIds: [fixId17],
|
|
155158
155332
|
getAllCodeActions(context) {
|
|
155159
155333
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
155160
|
-
return codeFixAll(context,
|
|
155334
|
+
return codeFixAll(context, errorCodes18, (changes, diag2) => {
|
|
155161
155335
|
const classDeclaration = getClass(diag2.file, diag2.start);
|
|
155162
155336
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
155163
155337
|
for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) {
|
|
@@ -155223,7 +155397,7 @@ function getHeritageClauseSymbolTable(classDeclaration, checker) {
|
|
|
155223
155397
|
// src/services/codefixes/importFixes.ts
|
|
155224
155398
|
var importFixName = "import";
|
|
155225
155399
|
var importFixId = "fixMissingImport";
|
|
155226
|
-
var
|
|
155400
|
+
var errorCodes19 = [
|
|
155227
155401
|
Diagnostics.Cannot_find_name_0.code,
|
|
155228
155402
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
155229
155403
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
@@ -155245,7 +155419,7 @@ var errorCodes18 = [
|
|
|
155245
155419
|
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code
|
|
155246
155420
|
];
|
|
155247
155421
|
registerCodeFix({
|
|
155248
|
-
errorCodes:
|
|
155422
|
+
errorCodes: errorCodes19,
|
|
155249
155423
|
getCodeActions(context) {
|
|
155250
155424
|
const { errorCode, preferences, sourceFile, span, program } = context;
|
|
155251
155425
|
const info = getFixInfos(
|
|
@@ -155281,7 +155455,7 @@ registerCodeFix({
|
|
|
155281
155455
|
host,
|
|
155282
155456
|
cancellationToken
|
|
155283
155457
|
);
|
|
155284
|
-
eachDiagnostic(context,
|
|
155458
|
+
eachDiagnostic(context, errorCodes19, (diag2) => importAdder.addImportFromDiagnostic(diag2, context));
|
|
155285
155459
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
|
|
155286
155460
|
}
|
|
155287
155461
|
});
|
|
@@ -156756,8 +156930,8 @@ function getEmitModuleFormatOfFile(file, program) {
|
|
|
156756
156930
|
}
|
|
156757
156931
|
|
|
156758
156932
|
// src/services/codefixes/fixAddMissingConstraint.ts
|
|
156759
|
-
var
|
|
156760
|
-
var
|
|
156933
|
+
var fixId18 = "addMissingConstraint";
|
|
156934
|
+
var errorCodes20 = [
|
|
156761
156935
|
// We want errors this could be attached to:
|
|
156762
156936
|
// Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
|
|
156763
156937
|
Diagnostics.Type_0_is_not_comparable_to_type_1.code,
|
|
@@ -156770,20 +156944,20 @@ var errorCodes19 = [
|
|
|
156770
156944
|
Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code
|
|
156771
156945
|
];
|
|
156772
156946
|
registerCodeFix({
|
|
156773
|
-
errorCodes:
|
|
156947
|
+
errorCodes: errorCodes20,
|
|
156774
156948
|
getCodeActions(context) {
|
|
156775
156949
|
const { sourceFile, span, program, preferences, host } = context;
|
|
156776
156950
|
const info = getInfo6(program, sourceFile, span);
|
|
156777
156951
|
if (info === void 0) return;
|
|
156778
156952
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info));
|
|
156779
|
-
return [createCodeFixAction(
|
|
156953
|
+
return [createCodeFixAction(fixId18, changes, Diagnostics.Add_extends_constraint, fixId18, Diagnostics.Add_extends_constraint_to_all_type_parameters)];
|
|
156780
156954
|
},
|
|
156781
|
-
fixIds: [
|
|
156955
|
+
fixIds: [fixId18],
|
|
156782
156956
|
getAllCodeActions: (context) => {
|
|
156783
156957
|
const { program, preferences, host } = context;
|
|
156784
156958
|
const seen = /* @__PURE__ */ new Map();
|
|
156785
156959
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
156786
|
-
eachDiagnostic(context,
|
|
156960
|
+
eachDiagnostic(context, errorCodes20, (diag2) => {
|
|
156787
156961
|
const info = getInfo6(program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
156788
156962
|
if (info) {
|
|
156789
156963
|
if (addToSeen(seen, getNodeId(info.declaration))) {
|
|
@@ -156865,7 +157039,7 @@ function tryGetConstraintType(checker, node) {
|
|
|
156865
157039
|
var fixName = "fixOverrideModifier";
|
|
156866
157040
|
var fixAddOverrideId = "fixAddOverrideModifier";
|
|
156867
157041
|
var fixRemoveOverrideId = "fixRemoveOverrideModifier";
|
|
156868
|
-
var
|
|
157042
|
+
var errorCodes21 = [
|
|
156869
157043
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code,
|
|
156870
157044
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
|
|
156871
157045
|
Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,
|
|
@@ -156929,19 +157103,19 @@ var errorCodeFixIdMap = {
|
|
|
156929
157103
|
}
|
|
156930
157104
|
};
|
|
156931
157105
|
registerCodeFix({
|
|
156932
|
-
errorCodes:
|
|
157106
|
+
errorCodes: errorCodes21,
|
|
156933
157107
|
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
156934
157108
|
const { errorCode, span } = context;
|
|
156935
157109
|
const info = errorCodeFixIdMap[errorCode];
|
|
156936
157110
|
if (!info) return emptyArray;
|
|
156937
|
-
const { descriptions, fixId:
|
|
157111
|
+
const { descriptions, fixId: fixId56, fixAllDescriptions } = info;
|
|
156938
157112
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
|
|
156939
157113
|
return [
|
|
156940
|
-
createCodeFixActionMaybeFixAll(fixName, changes, descriptions,
|
|
157114
|
+
createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId56, fixAllDescriptions)
|
|
156941
157115
|
];
|
|
156942
157116
|
},
|
|
156943
157117
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
156944
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157118
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => {
|
|
156945
157119
|
const { code, start } = diag2;
|
|
156946
157120
|
const info = errorCodeFixIdMap[code];
|
|
156947
157121
|
if (!info || info.fixId !== context.fixId) {
|
|
@@ -157017,20 +157191,20 @@ function findContainerClassElementLike(sourceFile, pos) {
|
|
|
157017
157191
|
}
|
|
157018
157192
|
|
|
157019
157193
|
// src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts
|
|
157020
|
-
var
|
|
157021
|
-
var
|
|
157194
|
+
var fixId19 = "fixNoPropertyAccessFromIndexSignature";
|
|
157195
|
+
var errorCodes22 = [
|
|
157022
157196
|
Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code
|
|
157023
157197
|
];
|
|
157024
157198
|
registerCodeFix({
|
|
157025
|
-
errorCodes:
|
|
157026
|
-
fixIds: [
|
|
157199
|
+
errorCodes: errorCodes22,
|
|
157200
|
+
fixIds: [fixId19],
|
|
157027
157201
|
getCodeActions(context) {
|
|
157028
157202
|
const { sourceFile, span, preferences } = context;
|
|
157029
157203
|
const property = getPropertyAccessExpression(sourceFile, span.start);
|
|
157030
157204
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property, preferences));
|
|
157031
|
-
return [createCodeFixAction(
|
|
157205
|
+
return [createCodeFixAction(fixId19, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId19, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
157032
157206
|
},
|
|
157033
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157207
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => doChange14(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
157034
157208
|
});
|
|
157035
157209
|
function doChange14(changes, sourceFile, node, preferences) {
|
|
157036
157210
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
@@ -157046,20 +157220,20 @@ function getPropertyAccessExpression(sourceFile, pos) {
|
|
|
157046
157220
|
}
|
|
157047
157221
|
|
|
157048
157222
|
// src/services/codefixes/fixImplicitThis.ts
|
|
157049
|
-
var
|
|
157050
|
-
var
|
|
157223
|
+
var fixId20 = "fixImplicitThis";
|
|
157224
|
+
var errorCodes23 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
157051
157225
|
registerCodeFix({
|
|
157052
|
-
errorCodes:
|
|
157226
|
+
errorCodes: errorCodes23,
|
|
157053
157227
|
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
157054
157228
|
const { sourceFile, program, span } = context;
|
|
157055
157229
|
let diagnostic;
|
|
157056
157230
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
157057
157231
|
diagnostic = doChange15(t, sourceFile, span.start, program.getTypeChecker());
|
|
157058
157232
|
});
|
|
157059
|
-
return diagnostic ? [createCodeFixAction(
|
|
157233
|
+
return diagnostic ? [createCodeFixAction(fixId20, changes, diagnostic, fixId20, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
|
|
157060
157234
|
},
|
|
157061
|
-
fixIds: [
|
|
157062
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157235
|
+
fixIds: [fixId20],
|
|
157236
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes23, (changes, diag2) => {
|
|
157063
157237
|
doChange15(changes, diag2.file, diag2.start, context.program.getTypeChecker());
|
|
157064
157238
|
})
|
|
157065
157239
|
});
|
|
@@ -157104,25 +157278,25 @@ function doChange15(changes, sourceFile, pos, checker) {
|
|
|
157104
157278
|
}
|
|
157105
157279
|
|
|
157106
157280
|
// src/services/codefixes/fixImportNonExportedMember.ts
|
|
157107
|
-
var
|
|
157108
|
-
var
|
|
157281
|
+
var fixId21 = "fixImportNonExportedMember";
|
|
157282
|
+
var errorCodes24 = [
|
|
157109
157283
|
Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code
|
|
157110
157284
|
];
|
|
157111
157285
|
registerCodeFix({
|
|
157112
|
-
errorCodes:
|
|
157113
|
-
fixIds: [
|
|
157286
|
+
errorCodes: errorCodes24,
|
|
157287
|
+
fixIds: [fixId21],
|
|
157114
157288
|
getCodeActions(context) {
|
|
157115
157289
|
const { sourceFile, span, program } = context;
|
|
157116
157290
|
const info = getInfo7(sourceFile, span.start, program);
|
|
157117
157291
|
if (info === void 0) return void 0;
|
|
157118
157292
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, program, info));
|
|
157119
|
-
return [createCodeFixAction(
|
|
157293
|
+
return [createCodeFixAction(fixId21, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId21, Diagnostics.Export_all_referenced_locals)];
|
|
157120
157294
|
},
|
|
157121
157295
|
getAllCodeActions(context) {
|
|
157122
157296
|
const { program } = context;
|
|
157123
157297
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
157124
157298
|
const exports2 = /* @__PURE__ */ new Map();
|
|
157125
|
-
eachDiagnostic(context,
|
|
157299
|
+
eachDiagnostic(context, errorCodes24, (diag2) => {
|
|
157126
157300
|
const info = getInfo7(diag2.file, diag2.start, program);
|
|
157127
157301
|
if (info === void 0) return void 0;
|
|
157128
157302
|
const { exportName, node, moduleSourceFile } = info;
|
|
@@ -157262,20 +157436,20 @@ function getNodeOfSymbol(symbol) {
|
|
|
157262
157436
|
}
|
|
157263
157437
|
|
|
157264
157438
|
// src/services/codefixes/fixIncorrectNamedTupleSyntax.ts
|
|
157265
|
-
var
|
|
157266
|
-
var
|
|
157439
|
+
var fixId22 = "fixIncorrectNamedTupleSyntax";
|
|
157440
|
+
var errorCodes25 = [
|
|
157267
157441
|
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,
|
|
157268
157442
|
Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code
|
|
157269
157443
|
];
|
|
157270
157444
|
registerCodeFix({
|
|
157271
|
-
errorCodes:
|
|
157445
|
+
errorCodes: errorCodes25,
|
|
157272
157446
|
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
157273
157447
|
const { sourceFile, span } = context;
|
|
157274
157448
|
const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
157275
157449
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, namedTupleMember));
|
|
157276
|
-
return [createCodeFixAction(
|
|
157450
|
+
return [createCodeFixAction(fixId22, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId22, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
|
|
157277
157451
|
},
|
|
157278
|
-
fixIds: [
|
|
157452
|
+
fixIds: [fixId22]
|
|
157279
157453
|
});
|
|
157280
157454
|
function getNamedTupleMember(sourceFile, pos) {
|
|
157281
157455
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -157310,8 +157484,8 @@ function doChange17(changes, sourceFile, namedTupleMember) {
|
|
|
157310
157484
|
}
|
|
157311
157485
|
|
|
157312
157486
|
// src/services/codefixes/fixSpelling.ts
|
|
157313
|
-
var
|
|
157314
|
-
var
|
|
157487
|
+
var fixId23 = "fixSpelling";
|
|
157488
|
+
var errorCodes26 = [
|
|
157315
157489
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
157316
157490
|
Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
|
|
157317
157491
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
@@ -157328,7 +157502,7 @@ var errorCodes25 = [
|
|
|
157328
157502
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code
|
|
157329
157503
|
];
|
|
157330
157504
|
registerCodeFix({
|
|
157331
|
-
errorCodes:
|
|
157505
|
+
errorCodes: errorCodes26,
|
|
157332
157506
|
getCodeActions(context) {
|
|
157333
157507
|
const { sourceFile, errorCode } = context;
|
|
157334
157508
|
const info = getInfo8(sourceFile, context.span.start, context, errorCode);
|
|
@@ -157336,10 +157510,10 @@ registerCodeFix({
|
|
|
157336
157510
|
const { node, suggestedSymbol } = info;
|
|
157337
157511
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
157338
157512
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, sourceFile, node, suggestedSymbol, target));
|
|
157339
|
-
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)],
|
|
157513
|
+
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId23, Diagnostics.Fix_all_detected_spelling_errors)];
|
|
157340
157514
|
},
|
|
157341
|
-
fixIds: [
|
|
157342
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157515
|
+
fixIds: [fixId23],
|
|
157516
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => {
|
|
157343
157517
|
const info = getInfo8(diag2.file, diag2.start, context, diag2.code);
|
|
157344
157518
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
157345
157519
|
if (info) doChange18(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
@@ -157428,17 +157602,17 @@ function getResolvedSourceFileFromImportDeclaration(context, importDeclaration,
|
|
|
157428
157602
|
}
|
|
157429
157603
|
|
|
157430
157604
|
// src/services/codefixes/returnValueCorrect.ts
|
|
157431
|
-
var
|
|
157605
|
+
var fixId24 = "returnValueCorrect";
|
|
157432
157606
|
var fixIdAddReturnStatement = "fixAddReturnStatement";
|
|
157433
157607
|
var fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody";
|
|
157434
157608
|
var fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
157435
|
-
var
|
|
157609
|
+
var errorCodes27 = [
|
|
157436
157610
|
Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code,
|
|
157437
157611
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
157438
157612
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
157439
157613
|
];
|
|
157440
157614
|
registerCodeFix({
|
|
157441
|
-
errorCodes:
|
|
157615
|
+
errorCodes: errorCodes27,
|
|
157442
157616
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
157443
157617
|
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
157444
157618
|
const { program, sourceFile, span: { start }, errorCode } = context;
|
|
@@ -157453,7 +157627,7 @@ registerCodeFix({
|
|
|
157453
157627
|
return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)];
|
|
157454
157628
|
}
|
|
157455
157629
|
},
|
|
157456
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157630
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes27, (changes, diag2) => {
|
|
157457
157631
|
const info = getInfo9(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code);
|
|
157458
157632
|
if (!info) return void 0;
|
|
157459
157633
|
switch (context.fixId) {
|
|
@@ -157652,7 +157826,7 @@ function wrapBlockWithParen(changes, sourceFile, declaration, expression) {
|
|
|
157652
157826
|
}
|
|
157653
157827
|
function getActionForfixAddReturnStatement(context, expression, statement) {
|
|
157654
157828
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement));
|
|
157655
|
-
return createCodeFixAction(
|
|
157829
|
+
return createCodeFixAction(fixId24, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement);
|
|
157656
157830
|
}
|
|
157657
157831
|
function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) {
|
|
157658
157832
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace(
|
|
@@ -157664,11 +157838,11 @@ function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration,
|
|
|
157664
157838
|
/*withParen*/
|
|
157665
157839
|
false
|
|
157666
157840
|
));
|
|
157667
|
-
return createCodeFixAction(
|
|
157841
|
+
return createCodeFixAction(fixId24, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues);
|
|
157668
157842
|
}
|
|
157669
157843
|
function getActionForfixWrapTheBlockWithParen(context, declaration, expression) {
|
|
157670
157844
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression));
|
|
157671
|
-
return createCodeFixAction(
|
|
157845
|
+
return createCodeFixAction(fixId24, changes, Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, Diagnostics.Wrap_all_object_literal_with_parentheses);
|
|
157672
157846
|
}
|
|
157673
157847
|
|
|
157674
157848
|
// src/services/codefixes/fixAddMissingMember.ts
|
|
@@ -157676,7 +157850,7 @@ var fixMissingMember = "fixMissingMember";
|
|
|
157676
157850
|
var fixMissingProperties = "fixMissingProperties";
|
|
157677
157851
|
var fixMissingAttributes = "fixMissingAttributes";
|
|
157678
157852
|
var fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration";
|
|
157679
|
-
var
|
|
157853
|
+
var errorCodes28 = [
|
|
157680
157854
|
Diagnostics.Property_0_does_not_exist_on_type_1.code,
|
|
157681
157855
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
157682
157856
|
Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code,
|
|
@@ -157686,7 +157860,7 @@ var errorCodes27 = [
|
|
|
157686
157860
|
Diagnostics.Cannot_find_name_0.code
|
|
157687
157861
|
];
|
|
157688
157862
|
registerCodeFix({
|
|
157689
|
-
errorCodes:
|
|
157863
|
+
errorCodes: errorCodes28,
|
|
157690
157864
|
getCodeActions(context) {
|
|
157691
157865
|
const typeChecker = context.program.getTypeChecker();
|
|
157692
157866
|
const info = getInfo10(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program);
|
|
@@ -157713,21 +157887,21 @@ registerCodeFix({
|
|
|
157713
157887
|
},
|
|
157714
157888
|
fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
|
|
157715
157889
|
getAllCodeActions: (context) => {
|
|
157716
|
-
const { program, fixId:
|
|
157890
|
+
const { program, fixId: fixId56 } = context;
|
|
157717
157891
|
const checker = program.getTypeChecker();
|
|
157718
157892
|
const seen = /* @__PURE__ */ new Map();
|
|
157719
157893
|
const typeDeclToMembers = /* @__PURE__ */ new Map();
|
|
157720
157894
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
157721
|
-
eachDiagnostic(context,
|
|
157895
|
+
eachDiagnostic(context, errorCodes28, (diag2) => {
|
|
157722
157896
|
const info = getInfo10(diag2.file, diag2.start, diag2.code, checker, context.program);
|
|
157723
157897
|
if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier : info.token.text))) {
|
|
157724
157898
|
return;
|
|
157725
157899
|
}
|
|
157726
|
-
if (
|
|
157900
|
+
if (fixId56 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
|
157727
157901
|
addFunctionDeclaration(changes, context, info);
|
|
157728
|
-
} else if (
|
|
157902
|
+
} else if (fixId56 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
|
157729
157903
|
addObjectLiteralProperties(changes, context, info);
|
|
157730
|
-
} else if (
|
|
157904
|
+
} else if (fixId56 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
|
|
157731
157905
|
addJsxAttributes(changes, context, info);
|
|
157732
157906
|
} else {
|
|
157733
157907
|
if (info.kind === 1 /* Enum */) {
|
|
@@ -158296,17 +158470,17 @@ function findScope(node) {
|
|
|
158296
158470
|
}
|
|
158297
158471
|
|
|
158298
158472
|
// src/services/codefixes/fixAddMissingNewOperator.ts
|
|
158299
|
-
var
|
|
158300
|
-
var
|
|
158473
|
+
var fixId25 = "addMissingNewOperator";
|
|
158474
|
+
var errorCodes29 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
|
158301
158475
|
registerCodeFix({
|
|
158302
|
-
errorCodes:
|
|
158476
|
+
errorCodes: errorCodes29,
|
|
158303
158477
|
getCodeActions(context) {
|
|
158304
158478
|
const { sourceFile, span } = context;
|
|
158305
158479
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span));
|
|
158306
|
-
return [createCodeFixAction(
|
|
158480
|
+
return [createCodeFixAction(fixId25, changes, Diagnostics.Add_missing_new_operator_to_call, fixId25, Diagnostics.Add_missing_new_operator_to_all_calls)];
|
|
158307
158481
|
},
|
|
158308
|
-
fixIds: [
|
|
158309
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158482
|
+
fixIds: [fixId25],
|
|
158483
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes29, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2))
|
|
158310
158484
|
});
|
|
158311
158485
|
function addMissingNewOperator(changes, sourceFile, span) {
|
|
158312
158486
|
const call = cast(findAncestorMatchingSpan2(sourceFile, span), isCallExpression);
|
|
@@ -158325,9 +158499,9 @@ function findAncestorMatchingSpan2(sourceFile, span) {
|
|
|
158325
158499
|
// src/services/codefixes/fixAddMissingParam.ts
|
|
158326
158500
|
var addMissingParamFixId = "addMissingParam";
|
|
158327
158501
|
var addOptionalParamFixId = "addOptionalParam";
|
|
158328
|
-
var
|
|
158502
|
+
var errorCodes30 = [Diagnostics.Expected_0_arguments_but_got_1.code];
|
|
158329
158503
|
registerCodeFix({
|
|
158330
|
-
errorCodes:
|
|
158504
|
+
errorCodes: errorCodes30,
|
|
158331
158505
|
fixIds: [addMissingParamFixId, addOptionalParamFixId],
|
|
158332
158506
|
getCodeActions(context) {
|
|
158333
158507
|
const info = getInfo11(context.sourceFile, context.program, context.span.start);
|
|
@@ -158360,7 +158534,7 @@ registerCodeFix({
|
|
|
158360
158534
|
}
|
|
158361
158535
|
return actions2;
|
|
158362
158536
|
},
|
|
158363
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158537
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes30, (changes, diag2) => {
|
|
158364
158538
|
const info = getInfo11(context.sourceFile, context.program, diag2.start);
|
|
158365
158539
|
if (info) {
|
|
158366
158540
|
const { declarations, newParameters, newOptionalParameters } = info;
|
|
@@ -158563,12 +158737,12 @@ function getParameterType(importAdder, typeNode, scriptTarget) {
|
|
|
158563
158737
|
var fixName2 = "fixCannotFindModule";
|
|
158564
158738
|
var fixIdInstallTypesPackage = "installTypesPackage";
|
|
158565
158739
|
var errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
158566
|
-
var
|
|
158740
|
+
var errorCodes31 = [
|
|
158567
158741
|
errorCodeCannotFindModule,
|
|
158568
158742
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
158569
158743
|
];
|
|
158570
158744
|
registerCodeFix({
|
|
158571
|
-
errorCodes:
|
|
158745
|
+
errorCodes: errorCodes31,
|
|
158572
158746
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
158573
158747
|
const { host, sourceFile, span: { start } } = context;
|
|
158574
158748
|
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
@@ -158586,7 +158760,7 @@ registerCodeFix({
|
|
|
158586
158760
|
},
|
|
158587
158761
|
fixIds: [fixIdInstallTypesPackage],
|
|
158588
158762
|
getAllCodeActions: (context) => {
|
|
158589
|
-
return codeFixAll(context,
|
|
158763
|
+
return codeFixAll(context, errorCodes31, (_changes, diag2, commands) => {
|
|
158590
158764
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
158591
158765
|
if (packageName === void 0) return void 0;
|
|
158592
158766
|
switch (context.fixId) {
|
|
@@ -158619,7 +158793,7 @@ function getTypesPackageNameToInstall(packageName, host, diagCode) {
|
|
|
158619
158793
|
}
|
|
158620
158794
|
|
|
158621
158795
|
// src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
|
|
158622
|
-
var
|
|
158796
|
+
var errorCodes32 = [
|
|
158623
158797
|
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
158624
158798
|
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2.code,
|
|
158625
158799
|
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more.code,
|
|
@@ -158627,18 +158801,18 @@ var errorCodes31 = [
|
|
|
158627
158801
|
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1.code,
|
|
158628
158802
|
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more.code
|
|
158629
158803
|
];
|
|
158630
|
-
var
|
|
158804
|
+
var fixId26 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
158631
158805
|
registerCodeFix({
|
|
158632
|
-
errorCodes:
|
|
158806
|
+
errorCodes: errorCodes32,
|
|
158633
158807
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
158634
158808
|
const { sourceFile, span } = context;
|
|
158635
158809
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
|
|
158636
|
-
return changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
158810
|
+
return changes.length === 0 ? void 0 : [createCodeFixAction(fixId26, changes, Diagnostics.Implement_inherited_abstract_class, fixId26, Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
158637
158811
|
},
|
|
158638
|
-
fixIds: [
|
|
158812
|
+
fixIds: [fixId26],
|
|
158639
158813
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
158640
158814
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
158641
|
-
return codeFixAll(context,
|
|
158815
|
+
return codeFixAll(context, errorCodes32, (changes, diag2) => {
|
|
158642
158816
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
158643
158817
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
158644
158818
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -158665,23 +158839,23 @@ function symbolPointsToNonPrivateAndAbstractMember(symbol) {
|
|
|
158665
158839
|
}
|
|
158666
158840
|
|
|
158667
158841
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
158668
|
-
var
|
|
158669
|
-
var
|
|
158842
|
+
var fixId27 = "classSuperMustPrecedeThisAccess";
|
|
158843
|
+
var errorCodes33 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
158670
158844
|
registerCodeFix({
|
|
158671
|
-
errorCodes:
|
|
158845
|
+
errorCodes: errorCodes33,
|
|
158672
158846
|
getCodeActions(context) {
|
|
158673
158847
|
const { sourceFile, span } = context;
|
|
158674
158848
|
const nodes = getNodes(sourceFile, span.start);
|
|
158675
158849
|
if (!nodes) return void 0;
|
|
158676
158850
|
const { constructor, superCall } = nodes;
|
|
158677
158851
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, constructor, superCall));
|
|
158678
|
-
return [createCodeFixAction(
|
|
158852
|
+
return [createCodeFixAction(fixId27, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId27, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)];
|
|
158679
158853
|
},
|
|
158680
|
-
fixIds: [
|
|
158854
|
+
fixIds: [fixId27],
|
|
158681
158855
|
getAllCodeActions(context) {
|
|
158682
158856
|
const { sourceFile } = context;
|
|
158683
158857
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
158684
|
-
return codeFixAll(context,
|
|
158858
|
+
return codeFixAll(context, errorCodes33, (changes, diag2) => {
|
|
158685
158859
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
158686
158860
|
if (!nodes) return;
|
|
158687
158861
|
const { constructor, superCall } = nodes;
|
|
@@ -158707,18 +158881,18 @@ function findSuperCall(n) {
|
|
|
158707
158881
|
}
|
|
158708
158882
|
|
|
158709
158883
|
// src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts
|
|
158710
|
-
var
|
|
158711
|
-
var
|
|
158884
|
+
var fixId28 = "constructorForDerivedNeedSuperCall";
|
|
158885
|
+
var errorCodes34 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
158712
158886
|
registerCodeFix({
|
|
158713
|
-
errorCodes:
|
|
158887
|
+
errorCodes: errorCodes34,
|
|
158714
158888
|
getCodeActions(context) {
|
|
158715
158889
|
const { sourceFile, span } = context;
|
|
158716
158890
|
const ctr = getNode(sourceFile, span.start);
|
|
158717
158891
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, ctr));
|
|
158718
|
-
return [createCodeFixAction(
|
|
158892
|
+
return [createCodeFixAction(fixId28, changes, Diagnostics.Add_missing_super_call, fixId28, Diagnostics.Add_all_missing_super_calls)];
|
|
158719
158893
|
},
|
|
158720
|
-
fixIds: [
|
|
158721
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158894
|
+
fixIds: [fixId28],
|
|
158895
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange21(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
158722
158896
|
});
|
|
158723
158897
|
function getNode(sourceFile, pos) {
|
|
158724
158898
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -158738,9 +158912,9 @@ function doChange21(changes, sourceFile, ctr) {
|
|
|
158738
158912
|
|
|
158739
158913
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
158740
158914
|
var fixID = "fixEnableJsxFlag";
|
|
158741
|
-
var
|
|
158915
|
+
var errorCodes35 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
158742
158916
|
registerCodeFix({
|
|
158743
|
-
errorCodes:
|
|
158917
|
+
errorCodes: errorCodes35,
|
|
158744
158918
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
158745
158919
|
const { configFile } = context.program.getCompilerOptions();
|
|
158746
158920
|
if (configFile === void 0) {
|
|
@@ -158752,7 +158926,7 @@ registerCodeFix({
|
|
|
158752
158926
|
];
|
|
158753
158927
|
},
|
|
158754
158928
|
fixIds: [fixID],
|
|
158755
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158929
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes) => {
|
|
158756
158930
|
const { configFile } = context.program.getCompilerOptions();
|
|
158757
158931
|
if (configFile === void 0) {
|
|
158758
158932
|
return void 0;
|
|
@@ -158765,23 +158939,23 @@ function doChange22(changeTracker, configFile) {
|
|
|
158765
158939
|
}
|
|
158766
158940
|
|
|
158767
158941
|
// src/services/codefixes/fixNaNEquality.ts
|
|
158768
|
-
var
|
|
158769
|
-
var
|
|
158942
|
+
var fixId29 = "fixNaNEquality";
|
|
158943
|
+
var errorCodes36 = [
|
|
158770
158944
|
Diagnostics.This_condition_will_always_return_0.code
|
|
158771
158945
|
];
|
|
158772
158946
|
registerCodeFix({
|
|
158773
|
-
errorCodes:
|
|
158947
|
+
errorCodes: errorCodes36,
|
|
158774
158948
|
getCodeActions(context) {
|
|
158775
158949
|
const { sourceFile, span, program } = context;
|
|
158776
158950
|
const info = getInfo12(program, sourceFile, span);
|
|
158777
158951
|
if (info === void 0) return;
|
|
158778
158952
|
const { suggestion, expression, arg } = info;
|
|
158779
158953
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, arg, expression));
|
|
158780
|
-
return [createCodeFixAction(
|
|
158954
|
+
return [createCodeFixAction(fixId29, changes, [Diagnostics.Use_0, suggestion], fixId29, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
158781
158955
|
},
|
|
158782
|
-
fixIds: [
|
|
158956
|
+
fixIds: [fixId29],
|
|
158783
158957
|
getAllCodeActions: (context) => {
|
|
158784
|
-
return codeFixAll(context,
|
|
158958
|
+
return codeFixAll(context, errorCodes36, (changes, diag2) => {
|
|
158785
158959
|
const info = getInfo12(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
158786
158960
|
if (info) {
|
|
158787
158961
|
doChange23(changes, diag2.file, info.arg, info.expression);
|
|
@@ -158861,20 +159035,20 @@ registerCodeFix({
|
|
|
158861
159035
|
});
|
|
158862
159036
|
|
|
158863
159037
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
158864
|
-
var
|
|
158865
|
-
var
|
|
159038
|
+
var fixId30 = "fixPropertyAssignment";
|
|
159039
|
+
var errorCodes37 = [
|
|
158866
159040
|
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
|
|
158867
159041
|
];
|
|
158868
159042
|
registerCodeFix({
|
|
158869
|
-
errorCodes:
|
|
158870
|
-
fixIds: [
|
|
159043
|
+
errorCodes: errorCodes37,
|
|
159044
|
+
fixIds: [fixId30],
|
|
158871
159045
|
getCodeActions(context) {
|
|
158872
159046
|
const { sourceFile, span } = context;
|
|
158873
159047
|
const property = getProperty2(sourceFile, span.start);
|
|
158874
159048
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, context.sourceFile, property));
|
|
158875
|
-
return [createCodeFixAction(
|
|
159049
|
+
return [createCodeFixAction(fixId30, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId30, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
158876
159050
|
},
|
|
158877
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
159051
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => doChange24(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
158878
159052
|
});
|
|
158879
159053
|
function doChange24(changes, sourceFile, node) {
|
|
158880
159054
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
@@ -158884,20 +159058,20 @@ function getProperty2(sourceFile, pos) {
|
|
|
158884
159058
|
}
|
|
158885
159059
|
|
|
158886
159060
|
// src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts
|
|
158887
|
-
var
|
|
158888
|
-
var
|
|
159061
|
+
var fixId31 = "extendsInterfaceBecomesImplements";
|
|
159062
|
+
var errorCodes38 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
158889
159063
|
registerCodeFix({
|
|
158890
|
-
errorCodes:
|
|
159064
|
+
errorCodes: errorCodes38,
|
|
158891
159065
|
getCodeActions(context) {
|
|
158892
159066
|
const { sourceFile } = context;
|
|
158893
159067
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
158894
159068
|
if (!nodes) return void 0;
|
|
158895
159069
|
const { extendsToken, heritageClauses } = nodes;
|
|
158896
159070
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses));
|
|
158897
|
-
return [createCodeFixAction(
|
|
159071
|
+
return [createCodeFixAction(fixId31, changes, Diagnostics.Change_extends_to_implements, fixId31, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
158898
159072
|
},
|
|
158899
|
-
fixIds: [
|
|
158900
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
159073
|
+
fixIds: [fixId31],
|
|
159074
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes38, (changes, diag2) => {
|
|
158901
159075
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
158902
159076
|
if (nodes) doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
158903
159077
|
})
|
|
@@ -158924,15 +159098,15 @@ function doChanges2(changes, sourceFile, extendsToken, heritageClauses) {
|
|
|
158924
159098
|
}
|
|
158925
159099
|
|
|
158926
159100
|
// src/services/codefixes/fixForgottenThisPropertyAccess.ts
|
|
158927
|
-
var
|
|
159101
|
+
var fixId32 = "forgottenThisPropertyAccess";
|
|
158928
159102
|
var didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
158929
|
-
var
|
|
159103
|
+
var errorCodes39 = [
|
|
158930
159104
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
158931
159105
|
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,
|
|
158932
159106
|
didYouMeanStaticMemberCode
|
|
158933
159107
|
];
|
|
158934
159108
|
registerCodeFix({
|
|
158935
|
-
errorCodes:
|
|
159109
|
+
errorCodes: errorCodes39,
|
|
158936
159110
|
getCodeActions(context) {
|
|
158937
159111
|
const { sourceFile } = context;
|
|
158938
159112
|
const info = getInfo13(sourceFile, context.span.start, context.errorCode);
|
|
@@ -158940,10 +159114,10 @@ registerCodeFix({
|
|
|
158940
159114
|
return void 0;
|
|
158941
159115
|
}
|
|
158942
159116
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, info));
|
|
158943
|
-
return [createCodeFixAction(
|
|
159117
|
+
return [createCodeFixAction(fixId32, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId32, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)];
|
|
158944
159118
|
},
|
|
158945
|
-
fixIds: [
|
|
158946
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
159119
|
+
fixIds: [fixId32],
|
|
159120
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes39, (changes, diag2) => {
|
|
158947
159121
|
const info = getInfo13(diag2.file, diag2.start, diag2.code);
|
|
158948
159122
|
if (info) doChange25(changes, context.sourceFile, info);
|
|
158949
159123
|
})
|
|
@@ -158962,12 +159136,12 @@ function doChange25(changes, sourceFile, { node, className }) {
|
|
|
158962
159136
|
// src/services/codefixes/fixInvalidJsxCharacters.ts
|
|
158963
159137
|
var fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
158964
159138
|
var fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
158965
|
-
var
|
|
159139
|
+
var errorCodes40 = [
|
|
158966
159140
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
158967
159141
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
158968
159142
|
];
|
|
158969
159143
|
registerCodeFix({
|
|
158970
|
-
errorCodes:
|
|
159144
|
+
errorCodes: errorCodes40,
|
|
158971
159145
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
158972
159146
|
getCodeActions(context) {
|
|
158973
159147
|
const { sourceFile, preferences, span } = context;
|
|
@@ -158993,7 +159167,7 @@ registerCodeFix({
|
|
|
158993
159167
|
];
|
|
158994
159168
|
},
|
|
158995
159169
|
getAllCodeActions(context) {
|
|
158996
|
-
return codeFixAll(context,
|
|
159170
|
+
return codeFixAll(context, errorCodes40, (changes, diagnostic) => doChange26(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
158997
159171
|
}
|
|
158998
159172
|
});
|
|
158999
159173
|
var htmlEntity = {
|
|
@@ -159015,12 +159189,12 @@ function doChange26(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
|
159015
159189
|
// src/services/codefixes/fixUnmatchedParameter.ts
|
|
159016
159190
|
var deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
159017
159191
|
var renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
159018
|
-
var
|
|
159192
|
+
var errorCodes41 = [
|
|
159019
159193
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
159020
159194
|
];
|
|
159021
159195
|
registerCodeFix({
|
|
159022
159196
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
159023
|
-
errorCodes:
|
|
159197
|
+
errorCodes: errorCodes41,
|
|
159024
159198
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
159025
159199
|
const { sourceFile, span } = context;
|
|
159026
159200
|
const actions2 = [];
|
|
@@ -159035,7 +159209,7 @@ registerCodeFix({
|
|
|
159035
159209
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
159036
159210
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
159037
159211
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
159038
|
-
eachDiagnostic(context,
|
|
159212
|
+
eachDiagnostic(context, errorCodes41, ({ file, start }) => {
|
|
159039
159213
|
const info = getInfo14(file, start);
|
|
159040
159214
|
if (info) {
|
|
159041
159215
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
@@ -159098,10 +159272,10 @@ function getInfo14(sourceFile, pos) {
|
|
|
159098
159272
|
}
|
|
159099
159273
|
|
|
159100
159274
|
// src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts
|
|
159101
|
-
var
|
|
159102
|
-
var
|
|
159275
|
+
var fixId33 = "fixUnreferenceableDecoratorMetadata";
|
|
159276
|
+
var errorCodes42 = [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];
|
|
159103
159277
|
registerCodeFix({
|
|
159104
|
-
errorCodes:
|
|
159278
|
+
errorCodes: errorCodes42,
|
|
159105
159279
|
getCodeActions: (context) => {
|
|
159106
159280
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
159107
159281
|
if (!importDeclaration) return;
|
|
@@ -159109,14 +159283,14 @@ registerCodeFix({
|
|
|
159109
159283
|
const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program));
|
|
159110
159284
|
let actions2;
|
|
159111
159285
|
if (namespaceChanges.length) {
|
|
159112
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
159286
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId33, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
159113
159287
|
}
|
|
159114
159288
|
if (typeOnlyChanges.length) {
|
|
159115
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
159289
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId33, typeOnlyChanges, Diagnostics.Use_import_type));
|
|
159116
159290
|
}
|
|
159117
159291
|
return actions2;
|
|
159118
159292
|
},
|
|
159119
|
-
fixIds: [
|
|
159293
|
+
fixIds: [fixId33]
|
|
159120
159294
|
});
|
|
159121
159295
|
function getImportDeclaration(sourceFile, program, start) {
|
|
159122
159296
|
const identifier = tryCast(getTokenAtPosition(sourceFile, start), isIdentifier);
|
|
@@ -159153,7 +159327,7 @@ var fixIdPrefix = "unusedIdentifier_prefix";
|
|
|
159153
159327
|
var fixIdDelete = "unusedIdentifier_delete";
|
|
159154
159328
|
var fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
159155
159329
|
var fixIdInfer = "unusedIdentifier_infer";
|
|
159156
|
-
var
|
|
159330
|
+
var errorCodes43 = [
|
|
159157
159331
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
159158
159332
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
159159
159333
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -159163,7 +159337,7 @@ var errorCodes42 = [
|
|
|
159163
159337
|
Diagnostics.All_type_parameters_are_unused.code
|
|
159164
159338
|
];
|
|
159165
159339
|
registerCodeFix({
|
|
159166
|
-
errorCodes:
|
|
159340
|
+
errorCodes: errorCodes43,
|
|
159167
159341
|
getCodeActions(context) {
|
|
159168
159342
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
159169
159343
|
const checker = program.getTypeChecker();
|
|
@@ -159252,7 +159426,7 @@ registerCodeFix({
|
|
|
159252
159426
|
const { sourceFile, program, cancellationToken } = context;
|
|
159253
159427
|
const checker = program.getTypeChecker();
|
|
159254
159428
|
const sourceFiles = program.getSourceFiles();
|
|
159255
|
-
return codeFixAll(context,
|
|
159429
|
+
return codeFixAll(context, errorCodes43, (changes, diag2) => {
|
|
159256
159430
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
159257
159431
|
switch (context.fixId) {
|
|
159258
159432
|
case fixIdPrefix:
|
|
@@ -159492,18 +159666,18 @@ function deleteFunctionLikeDeclaration(changes, sourceFile, node) {
|
|
|
159492
159666
|
}
|
|
159493
159667
|
|
|
159494
159668
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
159495
|
-
var
|
|
159496
|
-
var
|
|
159669
|
+
var fixId34 = "fixUnreachableCode";
|
|
159670
|
+
var errorCodes44 = [Diagnostics.Unreachable_code_detected.code];
|
|
159497
159671
|
registerCodeFix({
|
|
159498
|
-
errorCodes:
|
|
159672
|
+
errorCodes: errorCodes44,
|
|
159499
159673
|
getCodeActions(context) {
|
|
159500
159674
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
159501
159675
|
if (syntacticDiagnostics.length) return;
|
|
159502
159676
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
159503
|
-
return [createCodeFixAction(
|
|
159677
|
+
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unreachable_code, fixId34, Diagnostics.Remove_all_unreachable_code)];
|
|
159504
159678
|
},
|
|
159505
|
-
fixIds: [
|
|
159506
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
159679
|
+
fixIds: [fixId34],
|
|
159680
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => doChange27(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
159507
159681
|
});
|
|
159508
159682
|
function doChange27(changes, sourceFile, start, length2, errorCode) {
|
|
159509
159683
|
const token = getTokenAtPosition(sourceFile, start);
|
|
@@ -159554,16 +159728,16 @@ function lastWhere(a, pred) {
|
|
|
159554
159728
|
}
|
|
159555
159729
|
|
|
159556
159730
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
159557
|
-
var
|
|
159558
|
-
var
|
|
159731
|
+
var fixId35 = "fixUnusedLabel";
|
|
159732
|
+
var errorCodes45 = [Diagnostics.Unused_label.code];
|
|
159559
159733
|
registerCodeFix({
|
|
159560
|
-
errorCodes:
|
|
159734
|
+
errorCodes: errorCodes45,
|
|
159561
159735
|
getCodeActions(context) {
|
|
159562
159736
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, context.sourceFile, context.span.start));
|
|
159563
|
-
return [createCodeFixAction(
|
|
159737
|
+
return [createCodeFixAction(fixId35, changes, Diagnostics.Remove_unused_label, fixId35, Diagnostics.Remove_all_unused_labels)];
|
|
159564
159738
|
},
|
|
159565
|
-
fixIds: [
|
|
159566
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
159739
|
+
fixIds: [fixId35],
|
|
159740
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => doChange28(changes, diag2.file, diag2.start))
|
|
159567
159741
|
});
|
|
159568
159742
|
function doChange28(changes, sourceFile, start) {
|
|
159569
159743
|
const token = getTokenAtPosition(sourceFile, start);
|
|
@@ -159582,13 +159756,13 @@ function doChange28(changes, sourceFile, start) {
|
|
|
159582
159756
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
159583
159757
|
var fixIdPlain = "fixJSDocTypes_plain";
|
|
159584
159758
|
var fixIdNullable = "fixJSDocTypes_nullable";
|
|
159585
|
-
var
|
|
159759
|
+
var errorCodes46 = [
|
|
159586
159760
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
159587
159761
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
159588
159762
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
159589
159763
|
];
|
|
159590
159764
|
registerCodeFix({
|
|
159591
|
-
errorCodes:
|
|
159765
|
+
errorCodes: errorCodes46,
|
|
159592
159766
|
getCodeActions(context) {
|
|
159593
159767
|
const { sourceFile } = context;
|
|
159594
159768
|
const checker = context.program.getTypeChecker();
|
|
@@ -159601,20 +159775,20 @@ registerCodeFix({
|
|
|
159601
159775
|
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
159602
159776
|
}
|
|
159603
159777
|
return actions2;
|
|
159604
|
-
function fix(type2,
|
|
159778
|
+
function fix(type2, fixId56, fixAllDescription) {
|
|
159605
159779
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker));
|
|
159606
|
-
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)],
|
|
159780
|
+
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId56, fixAllDescription);
|
|
159607
159781
|
}
|
|
159608
159782
|
},
|
|
159609
159783
|
fixIds: [fixIdPlain, fixIdNullable],
|
|
159610
159784
|
getAllCodeActions(context) {
|
|
159611
|
-
const { fixId:
|
|
159785
|
+
const { fixId: fixId56, program, sourceFile } = context;
|
|
159612
159786
|
const checker = program.getTypeChecker();
|
|
159613
|
-
return codeFixAll(context,
|
|
159787
|
+
return codeFixAll(context, errorCodes46, (changes, err) => {
|
|
159614
159788
|
const info = getInfo15(err.file, err.start, checker);
|
|
159615
159789
|
if (!info) return;
|
|
159616
159790
|
const { typeNode, type } = info;
|
|
159617
|
-
const fixedType = typeNode.kind === 314 /* JSDocNullableType */ &&
|
|
159791
|
+
const fixedType = typeNode.kind === 314 /* JSDocNullableType */ && fixId56 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
159618
159792
|
doChange29(changes, sourceFile, typeNode, fixedType, checker);
|
|
159619
159793
|
});
|
|
159620
159794
|
}
|
|
@@ -159670,21 +159844,21 @@ function getType(checker, node) {
|
|
|
159670
159844
|
}
|
|
159671
159845
|
|
|
159672
159846
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
159673
|
-
var
|
|
159674
|
-
var
|
|
159847
|
+
var fixId36 = "fixMissingCallParentheses";
|
|
159848
|
+
var errorCodes47 = [
|
|
159675
159849
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
159676
159850
|
];
|
|
159677
159851
|
registerCodeFix({
|
|
159678
|
-
errorCodes:
|
|
159679
|
-
fixIds: [
|
|
159852
|
+
errorCodes: errorCodes47,
|
|
159853
|
+
fixIds: [fixId36],
|
|
159680
159854
|
getCodeActions(context) {
|
|
159681
159855
|
const { sourceFile, span } = context;
|
|
159682
159856
|
const callName = getCallName(sourceFile, span.start);
|
|
159683
159857
|
if (!callName) return;
|
|
159684
159858
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, context.sourceFile, callName));
|
|
159685
|
-
return [createCodeFixAction(
|
|
159859
|
+
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_missing_call_parentheses, fixId36, Diagnostics.Add_all_missing_call_parentheses)];
|
|
159686
159860
|
},
|
|
159687
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
159861
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
159688
159862
|
const callName = getCallName(diag2.file, diag2.start);
|
|
159689
159863
|
if (callName) doChange30(changes, diag2.file, callName);
|
|
159690
159864
|
})
|
|
@@ -159708,11 +159882,11 @@ function getCallName(sourceFile, start) {
|
|
|
159708
159882
|
}
|
|
159709
159883
|
|
|
159710
159884
|
// src/services/codefixes/fixMissingTypeAnnotationOnExports.ts
|
|
159711
|
-
var
|
|
159885
|
+
var fixId37 = "fixMissingTypeAnnotationOnExports";
|
|
159712
159886
|
var addAnnotationFix = "add-annotation";
|
|
159713
159887
|
var addInlineTypeAssertion = "add-type-assertion";
|
|
159714
159888
|
var extractExpression = "extract-expression";
|
|
159715
|
-
var
|
|
159889
|
+
var errorCodes48 = [
|
|
159716
159890
|
Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
|
|
159717
159891
|
Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
|
|
159718
159892
|
Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
|
|
@@ -159752,8 +159926,8 @@ var canHaveTypeAnnotation = /* @__PURE__ */ new Set([
|
|
|
159752
159926
|
var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
159753
159927
|
var declarationEmitInternalNodeBuilderFlags2 = 1 /* WriteComputedProps */;
|
|
159754
159928
|
registerCodeFix({
|
|
159755
|
-
errorCodes:
|
|
159756
|
-
fixIds: [
|
|
159929
|
+
errorCodes: errorCodes48,
|
|
159930
|
+
fixIds: [fixId37],
|
|
159757
159931
|
getCodeActions(context) {
|
|
159758
159932
|
const fixes = [];
|
|
159759
159933
|
addCodeAction(addAnnotationFix, fixes, context, 0 /* Full */, (f) => f.addTypeAnnotation(context.span));
|
|
@@ -159767,7 +159941,7 @@ registerCodeFix({
|
|
|
159767
159941
|
},
|
|
159768
159942
|
getAllCodeActions: (context) => {
|
|
159769
159943
|
const changes = withContext(context, 0 /* Full */, (f) => {
|
|
159770
|
-
eachDiagnostic(context,
|
|
159944
|
+
eachDiagnostic(context, errorCodes48, (diag2) => {
|
|
159771
159945
|
f.addTypeAnnotation(diag2);
|
|
159772
159946
|
});
|
|
159773
159947
|
});
|
|
@@ -159781,7 +159955,7 @@ function addCodeAction(fixName8, fixes, context, typePrintMode, cb) {
|
|
|
159781
159955
|
fixName8,
|
|
159782
159956
|
changes.textChanges,
|
|
159783
159957
|
changes.result,
|
|
159784
|
-
|
|
159958
|
+
fixId37,
|
|
159785
159959
|
Diagnostics.Add_all_missing_type_annotations
|
|
159786
159960
|
));
|
|
159787
159961
|
}
|
|
@@ -160601,26 +160775,26 @@ function withContext(context, typePrintMode, cb) {
|
|
|
160601
160775
|
}
|
|
160602
160776
|
|
|
160603
160777
|
// src/services/codefixes/fixAwaitInSyncFunction.ts
|
|
160604
|
-
var
|
|
160605
|
-
var
|
|
160778
|
+
var fixId38 = "fixAwaitInSyncFunction";
|
|
160779
|
+
var errorCodes49 = [
|
|
160606
160780
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
160607
160781
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
160608
160782
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
160609
160783
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
160610
160784
|
];
|
|
160611
160785
|
registerCodeFix({
|
|
160612
|
-
errorCodes:
|
|
160786
|
+
errorCodes: errorCodes49,
|
|
160613
160787
|
getCodeActions(context) {
|
|
160614
160788
|
const { sourceFile, span } = context;
|
|
160615
160789
|
const nodes = getNodes3(sourceFile, span.start);
|
|
160616
160790
|
if (!nodes) return void 0;
|
|
160617
160791
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, nodes));
|
|
160618
|
-
return [createCodeFixAction(
|
|
160792
|
+
return [createCodeFixAction(fixId38, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId38, Diagnostics.Add_all_missing_async_modifiers)];
|
|
160619
160793
|
},
|
|
160620
|
-
fixIds: [
|
|
160794
|
+
fixIds: [fixId38],
|
|
160621
160795
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
160622
160796
|
const seen = /* @__PURE__ */ new Map();
|
|
160623
|
-
return codeFixAll(context,
|
|
160797
|
+
return codeFixAll(context, errorCodes49, (changes, diag2) => {
|
|
160624
160798
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
160625
160799
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return;
|
|
160626
160800
|
doChange31(changes, context.sourceFile, nodes);
|
|
@@ -160673,21 +160847,21 @@ function doChange31(changes, sourceFile, { insertBefore, returnType }) {
|
|
|
160673
160847
|
}
|
|
160674
160848
|
|
|
160675
160849
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
160676
|
-
var
|
|
160850
|
+
var errorCodes50 = [
|
|
160677
160851
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
160678
160852
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
160679
160853
|
];
|
|
160680
|
-
var
|
|
160854
|
+
var fixId39 = "fixPropertyOverrideAccessor";
|
|
160681
160855
|
registerCodeFix({
|
|
160682
|
-
errorCodes:
|
|
160856
|
+
errorCodes: errorCodes50,
|
|
160683
160857
|
getCodeActions(context) {
|
|
160684
160858
|
const edits = doChange32(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
160685
160859
|
if (edits) {
|
|
160686
|
-
return [createCodeFixAction(
|
|
160860
|
+
return [createCodeFixAction(fixId39, edits, Diagnostics.Generate_get_and_set_accessors, fixId39, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
160687
160861
|
}
|
|
160688
160862
|
},
|
|
160689
|
-
fixIds: [
|
|
160690
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
160863
|
+
fixIds: [fixId39],
|
|
160864
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
160691
160865
|
const edits = doChange32(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
160692
160866
|
if (edits) {
|
|
160693
160867
|
for (const edit of edits) {
|
|
@@ -160723,8 +160897,8 @@ function doChange32(file, start, length2, code, context) {
|
|
|
160723
160897
|
}
|
|
160724
160898
|
|
|
160725
160899
|
// src/services/codefixes/inferFromUsage.ts
|
|
160726
|
-
var
|
|
160727
|
-
var
|
|
160900
|
+
var fixId40 = "inferFromUsage";
|
|
160901
|
+
var errorCodes51 = [
|
|
160728
160902
|
// Variable declarations
|
|
160729
160903
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
160730
160904
|
// Variable uses
|
|
@@ -160758,7 +160932,7 @@ var errorCodes50 = [
|
|
|
160758
160932
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
160759
160933
|
];
|
|
160760
160934
|
registerCodeFix({
|
|
160761
|
-
errorCodes:
|
|
160935
|
+
errorCodes: errorCodes51,
|
|
160762
160936
|
getCodeActions(context) {
|
|
160763
160937
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
160764
160938
|
const token = getTokenAtPosition(sourceFile, start);
|
|
@@ -160778,13 +160952,13 @@ registerCodeFix({
|
|
|
160778
160952
|
);
|
|
160779
160953
|
});
|
|
160780
160954
|
const name = declaration && getNameOfDeclaration(declaration);
|
|
160781
|
-
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
160955
|
+
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId40, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId40, Diagnostics.Infer_all_types_from_usage)];
|
|
160782
160956
|
},
|
|
160783
|
-
fixIds: [
|
|
160957
|
+
fixIds: [fixId40],
|
|
160784
160958
|
getAllCodeActions(context) {
|
|
160785
160959
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
160786
160960
|
const markSeen = nodeSeenTracker();
|
|
160787
|
-
return codeFixAll(context,
|
|
160961
|
+
return codeFixAll(context, errorCodes51, (changes, err) => {
|
|
160788
160962
|
doChange33(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
160789
160963
|
});
|
|
160790
160964
|
}
|
|
@@ -161715,13 +161889,13 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
161715
161889
|
}
|
|
161716
161890
|
|
|
161717
161891
|
// src/services/codefixes/fixReturnTypeInAsyncFunction.ts
|
|
161718
|
-
var
|
|
161719
|
-
var
|
|
161892
|
+
var fixId41 = "fixReturnTypeInAsyncFunction";
|
|
161893
|
+
var errorCodes52 = [
|
|
161720
161894
|
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
|
|
161721
161895
|
];
|
|
161722
161896
|
registerCodeFix({
|
|
161723
|
-
errorCodes:
|
|
161724
|
-
fixIds: [
|
|
161897
|
+
errorCodes: errorCodes52,
|
|
161898
|
+
fixIds: [fixId41],
|
|
161725
161899
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
161726
161900
|
const { sourceFile, program, span } = context;
|
|
161727
161901
|
const checker = program.getTypeChecker();
|
|
@@ -161732,14 +161906,14 @@ registerCodeFix({
|
|
|
161732
161906
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
161733
161907
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
161734
161908
|
return [createCodeFixAction(
|
|
161735
|
-
|
|
161909
|
+
fixId41,
|
|
161736
161910
|
changes,
|
|
161737
161911
|
[Diagnostics.Replace_0_with_Promise_1, checker.typeToString(returnType), checker.typeToString(promisedType)],
|
|
161738
|
-
|
|
161912
|
+
fixId41,
|
|
161739
161913
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
161740
161914
|
)];
|
|
161741
161915
|
},
|
|
161742
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
161916
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
161743
161917
|
const info = getInfo16(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
161744
161918
|
if (info) {
|
|
161745
161919
|
doChange34(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
@@ -161775,13 +161949,13 @@ function doChange34(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
|
161775
161949
|
|
|
161776
161950
|
// src/services/codefixes/disableJsDiagnostics.ts
|
|
161777
161951
|
var fixName4 = "disableJsDiagnostics";
|
|
161778
|
-
var
|
|
161779
|
-
var
|
|
161952
|
+
var fixId42 = "disableJsDiagnostics";
|
|
161953
|
+
var errorCodes53 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
161780
161954
|
const diag2 = Diagnostics[key];
|
|
161781
161955
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
161782
161956
|
});
|
|
161783
161957
|
registerCodeFix({
|
|
161784
|
-
errorCodes:
|
|
161958
|
+
errorCodes: errorCodes53,
|
|
161785
161959
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
161786
161960
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
161787
161961
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -161802,21 +161976,21 @@ registerCodeFix({
|
|
|
161802
161976
|
)
|
|
161803
161977
|
];
|
|
161804
161978
|
if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) {
|
|
161805
|
-
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
161979
|
+
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId42, Diagnostics.Add_ts_ignore_to_all_error_messages));
|
|
161806
161980
|
}
|
|
161807
161981
|
return fixes;
|
|
161808
161982
|
},
|
|
161809
|
-
fixIds: [
|
|
161983
|
+
fixIds: [fixId42],
|
|
161810
161984
|
getAllCodeActions: (context) => {
|
|
161811
161985
|
const seenLines = /* @__PURE__ */ new Set();
|
|
161812
|
-
return codeFixAll(context,
|
|
161986
|
+
return codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
161813
161987
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
161814
|
-
|
|
161988
|
+
makeChange9(changes, diag2.file, diag2.start, seenLines);
|
|
161815
161989
|
}
|
|
161816
161990
|
});
|
|
161817
161991
|
}
|
|
161818
161992
|
});
|
|
161819
|
-
function
|
|
161993
|
+
function makeChange9(changes, sourceFile, position, seenLines) {
|
|
161820
161994
|
const { line: lineNumber } = getLineAndCharacterOfPosition(sourceFile, position);
|
|
161821
161995
|
if (!seenLines || tryAddToSet(seenLines, lineNumber)) {
|
|
161822
161996
|
changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore");
|
|
@@ -162829,9 +163003,9 @@ var fixName6 = "strictClassInitialization";
|
|
|
162829
163003
|
var fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
162830
163004
|
var fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
162831
163005
|
var fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
162832
|
-
var
|
|
163006
|
+
var errorCodes54 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
162833
163007
|
registerCodeFix({
|
|
162834
|
-
errorCodes:
|
|
163008
|
+
errorCodes: errorCodes54,
|
|
162835
163009
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
162836
163010
|
const info = getInfo17(context.sourceFile, context.span.start);
|
|
162837
163011
|
if (!info) return;
|
|
@@ -162843,7 +163017,7 @@ registerCodeFix({
|
|
|
162843
163017
|
},
|
|
162844
163018
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
162845
163019
|
getAllCodeActions: (context) => {
|
|
162846
|
-
return codeFixAll(context,
|
|
163020
|
+
return codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
162847
163021
|
const info = getInfo17(diag2.file, diag2.start);
|
|
162848
163022
|
if (!info) return;
|
|
162849
163023
|
switch (context.fixId) {
|
|
@@ -162966,20 +163140,20 @@ function getDefaultValueFromType(checker, type) {
|
|
|
162966
163140
|
}
|
|
162967
163141
|
|
|
162968
163142
|
// src/services/codefixes/requireInTs.ts
|
|
162969
|
-
var
|
|
162970
|
-
var
|
|
163143
|
+
var fixId43 = "requireInTs";
|
|
163144
|
+
var errorCodes55 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
162971
163145
|
registerCodeFix({
|
|
162972
|
-
errorCodes:
|
|
163146
|
+
errorCodes: errorCodes55,
|
|
162973
163147
|
getCodeActions(context) {
|
|
162974
163148
|
const info = getInfo18(context.sourceFile, context.program, context.span.start, context.preferences);
|
|
162975
163149
|
if (!info) {
|
|
162976
163150
|
return void 0;
|
|
162977
163151
|
}
|
|
162978
163152
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(t, context.sourceFile, info));
|
|
162979
|
-
return [createCodeFixAction(
|
|
163153
|
+
return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_require_to_import, fixId43, Diagnostics.Convert_all_require_to_import)];
|
|
162980
163154
|
},
|
|
162981
|
-
fixIds: [
|
|
162982
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163155
|
+
fixIds: [fixId43],
|
|
163156
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => {
|
|
162983
163157
|
const info = getInfo18(diag2.file, context.program, diag2.start, context.preferences);
|
|
162984
163158
|
if (info) {
|
|
162985
163159
|
doChange35(changes, context.sourceFile, info);
|
|
@@ -163056,19 +163230,19 @@ function tryCreateNamedImportsFromObjectBindingPattern(node) {
|
|
|
163056
163230
|
}
|
|
163057
163231
|
|
|
163058
163232
|
// src/services/codefixes/useDefaultImport.ts
|
|
163059
|
-
var
|
|
163060
|
-
var
|
|
163233
|
+
var fixId44 = "useDefaultImport";
|
|
163234
|
+
var errorCodes56 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
163061
163235
|
registerCodeFix({
|
|
163062
|
-
errorCodes:
|
|
163236
|
+
errorCodes: errorCodes56,
|
|
163063
163237
|
getCodeActions(context) {
|
|
163064
163238
|
const { sourceFile, span: { start } } = context;
|
|
163065
163239
|
const info = getInfo19(sourceFile, start);
|
|
163066
163240
|
if (!info) return void 0;
|
|
163067
163241
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(t, sourceFile, info, context.preferences));
|
|
163068
|
-
return [createCodeFixAction(
|
|
163242
|
+
return [createCodeFixAction(fixId44, changes, Diagnostics.Convert_to_default_import, fixId44, Diagnostics.Convert_all_to_default_imports)];
|
|
163069
163243
|
},
|
|
163070
|
-
fixIds: [
|
|
163071
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163244
|
+
fixIds: [fixId44],
|
|
163245
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
|
|
163072
163246
|
const info = getInfo19(diag2.file, diag2.start);
|
|
163073
163247
|
if (info) doChange36(changes, diag2.file, info, context.preferences);
|
|
163074
163248
|
})
|
|
@@ -163095,24 +163269,24 @@ function doChange36(changes, sourceFile, info, preferences) {
|
|
|
163095
163269
|
}
|
|
163096
163270
|
|
|
163097
163271
|
// src/services/codefixes/useBigintLiteral.ts
|
|
163098
|
-
var
|
|
163099
|
-
var
|
|
163272
|
+
var fixId45 = "useBigintLiteral";
|
|
163273
|
+
var errorCodes57 = [
|
|
163100
163274
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
163101
163275
|
];
|
|
163102
163276
|
registerCodeFix({
|
|
163103
|
-
errorCodes:
|
|
163277
|
+
errorCodes: errorCodes57,
|
|
163104
163278
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
163105
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
163279
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
163106
163280
|
if (changes.length > 0) {
|
|
163107
|
-
return [createCodeFixAction(
|
|
163281
|
+
return [createCodeFixAction(fixId45, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId45, Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
163108
163282
|
}
|
|
163109
163283
|
},
|
|
163110
|
-
fixIds: [
|
|
163284
|
+
fixIds: [fixId45],
|
|
163111
163285
|
getAllCodeActions: (context) => {
|
|
163112
|
-
return codeFixAll(context,
|
|
163286
|
+
return codeFixAll(context, errorCodes57, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
163113
163287
|
}
|
|
163114
163288
|
});
|
|
163115
|
-
function
|
|
163289
|
+
function makeChange10(changeTracker, sourceFile, span) {
|
|
163116
163290
|
const numericLiteral = tryCast(getTokenAtPosition(sourceFile, span.start), isNumericLiteral);
|
|
163117
163291
|
if (!numericLiteral) {
|
|
163118
163292
|
return;
|
|
@@ -163123,18 +163297,18 @@ function makeChange9(changeTracker, sourceFile, span) {
|
|
|
163123
163297
|
|
|
163124
163298
|
// src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts
|
|
163125
163299
|
var fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
163126
|
-
var
|
|
163127
|
-
var
|
|
163300
|
+
var fixId46 = fixIdAddMissingTypeof;
|
|
163301
|
+
var errorCodes58 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
163128
163302
|
registerCodeFix({
|
|
163129
|
-
errorCodes:
|
|
163303
|
+
errorCodes: errorCodes58,
|
|
163130
163304
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
163131
163305
|
const { sourceFile, span } = context;
|
|
163132
163306
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
163133
163307
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(t, sourceFile, importType));
|
|
163134
|
-
return [createCodeFixAction(
|
|
163308
|
+
return [createCodeFixAction(fixId46, changes, Diagnostics.Add_missing_typeof, fixId46, Diagnostics.Add_missing_typeof)];
|
|
163135
163309
|
},
|
|
163136
|
-
fixIds: [
|
|
163137
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163310
|
+
fixIds: [fixId46],
|
|
163311
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => doChange37(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
163138
163312
|
});
|
|
163139
163313
|
function getImportTypeNode(sourceFile, pos) {
|
|
163140
163314
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -163157,9 +163331,9 @@ function doChange37(changes, sourceFile, importType) {
|
|
|
163157
163331
|
|
|
163158
163332
|
// src/services/codefixes/wrapJsxInFragment.ts
|
|
163159
163333
|
var fixID2 = "wrapJsxInFragment";
|
|
163160
|
-
var
|
|
163334
|
+
var errorCodes59 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
163161
163335
|
registerCodeFix({
|
|
163162
|
-
errorCodes:
|
|
163336
|
+
errorCodes: errorCodes59,
|
|
163163
163337
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
163164
163338
|
const { sourceFile, span } = context;
|
|
163165
163339
|
const node = findNodeToFix(sourceFile, span.start);
|
|
@@ -163168,7 +163342,7 @@ registerCodeFix({
|
|
|
163168
163342
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
163169
163343
|
},
|
|
163170
163344
|
fixIds: [fixID2],
|
|
163171
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163345
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes59, (changes, diag2) => {
|
|
163172
163346
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
163173
163347
|
if (!node) return void 0;
|
|
163174
163348
|
doChange38(changes, context.sourceFile, node);
|
|
@@ -163207,18 +163381,18 @@ function flattenInvalidBinaryExpr(node) {
|
|
|
163207
163381
|
}
|
|
163208
163382
|
|
|
163209
163383
|
// src/services/codefixes/wrapDecoratorInParentheses.ts
|
|
163210
|
-
var
|
|
163211
|
-
var
|
|
163384
|
+
var fixId47 = "wrapDecoratorInParentheses";
|
|
163385
|
+
var errorCodes60 = [Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator.code];
|
|
163212
163386
|
registerCodeFix({
|
|
163213
|
-
errorCodes:
|
|
163387
|
+
errorCodes: errorCodes60,
|
|
163214
163388
|
getCodeActions: function getCodeActionsToWrapDecoratorExpressionInParentheses(context) {
|
|
163215
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
163216
|
-
return [createCodeFixAction(
|
|
163389
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span.start));
|
|
163390
|
+
return [createCodeFixAction(fixId47, changes, Diagnostics.Wrap_in_parentheses, fixId47, Diagnostics.Wrap_all_invalid_decorator_expressions_in_parentheses)];
|
|
163217
163391
|
},
|
|
163218
|
-
fixIds: [
|
|
163219
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163392
|
+
fixIds: [fixId47],
|
|
163393
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, diag2) => makeChange11(changes, diag2.file, diag2.start))
|
|
163220
163394
|
});
|
|
163221
|
-
function
|
|
163395
|
+
function makeChange11(changeTracker, sourceFile, pos) {
|
|
163222
163396
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
163223
163397
|
const decorator = findAncestor(token, isDecorator);
|
|
163224
163398
|
Debug.assert(!!decorator, "Expected position to be owned by a decorator.");
|
|
@@ -163227,20 +163401,20 @@ function makeChange10(changeTracker, sourceFile, pos) {
|
|
|
163227
163401
|
}
|
|
163228
163402
|
|
|
163229
163403
|
// src/services/codefixes/convertToMappedObjectType.ts
|
|
163230
|
-
var
|
|
163231
|
-
var
|
|
163404
|
+
var fixId48 = "fixConvertToMappedObjectType";
|
|
163405
|
+
var errorCodes61 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
163232
163406
|
registerCodeFix({
|
|
163233
|
-
errorCodes:
|
|
163407
|
+
errorCodes: errorCodes61,
|
|
163234
163408
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
163235
163409
|
const { sourceFile, span } = context;
|
|
163236
163410
|
const info = getInfo20(sourceFile, span.start);
|
|
163237
163411
|
if (!info) return void 0;
|
|
163238
163412
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info));
|
|
163239
163413
|
const name = idText(info.container.name);
|
|
163240
|
-
return [createCodeFixAction(
|
|
163414
|
+
return [createCodeFixAction(fixId48, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId48, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
163241
163415
|
},
|
|
163242
|
-
fixIds: [
|
|
163243
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163416
|
+
fixIds: [fixId48],
|
|
163417
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => {
|
|
163244
163418
|
const info = getInfo20(diag2.file, diag2.start);
|
|
163245
163419
|
if (info) doChange39(changes, diag2.file, info);
|
|
163246
163420
|
})
|
|
@@ -163285,12 +163459,12 @@ function doChange39(changes, sourceFile, { indexSignature, container }) {
|
|
|
163285
163459
|
}
|
|
163286
163460
|
|
|
163287
163461
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
163288
|
-
var
|
|
163289
|
-
var
|
|
163462
|
+
var fixId49 = "removeAccidentalCallParentheses";
|
|
163463
|
+
var errorCodes62 = [
|
|
163290
163464
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
163291
163465
|
];
|
|
163292
163466
|
registerCodeFix({
|
|
163293
|
-
errorCodes:
|
|
163467
|
+
errorCodes: errorCodes62,
|
|
163294
163468
|
getCodeActions(context) {
|
|
163295
163469
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
163296
163470
|
if (!callExpression) {
|
|
@@ -163299,30 +163473,30 @@ registerCodeFix({
|
|
|
163299
163473
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
163300
163474
|
t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
|
|
163301
163475
|
});
|
|
163302
|
-
return [createCodeFixActionWithoutFixAll(
|
|
163476
|
+
return [createCodeFixActionWithoutFixAll(fixId49, changes, Diagnostics.Remove_parentheses)];
|
|
163303
163477
|
},
|
|
163304
|
-
fixIds: [
|
|
163478
|
+
fixIds: [fixId49]
|
|
163305
163479
|
});
|
|
163306
163480
|
|
|
163307
163481
|
// src/services/codefixes/removeUnnecessaryAwait.ts
|
|
163308
|
-
var
|
|
163309
|
-
var
|
|
163482
|
+
var fixId50 = "removeUnnecessaryAwait";
|
|
163483
|
+
var errorCodes63 = [
|
|
163310
163484
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
163311
163485
|
];
|
|
163312
163486
|
registerCodeFix({
|
|
163313
|
-
errorCodes:
|
|
163487
|
+
errorCodes: errorCodes63,
|
|
163314
163488
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
163315
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
163489
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange12(t, context.sourceFile, context.span));
|
|
163316
163490
|
if (changes.length > 0) {
|
|
163317
|
-
return [createCodeFixAction(
|
|
163491
|
+
return [createCodeFixAction(fixId50, changes, Diagnostics.Remove_unnecessary_await, fixId50, Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
163318
163492
|
}
|
|
163319
163493
|
},
|
|
163320
|
-
fixIds: [
|
|
163494
|
+
fixIds: [fixId50],
|
|
163321
163495
|
getAllCodeActions: (context) => {
|
|
163322
|
-
return codeFixAll(context,
|
|
163496
|
+
return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange12(changes, diag2.file, diag2));
|
|
163323
163497
|
}
|
|
163324
163498
|
});
|
|
163325
|
-
function
|
|
163499
|
+
function makeChange12(changeTracker, sourceFile, span) {
|
|
163326
163500
|
const awaitKeyword = tryCast(getTokenAtPosition(sourceFile, span.start), (node) => node.kind === 135 /* AwaitKeyword */);
|
|
163327
163501
|
const awaitExpression = awaitKeyword && tryCast(awaitKeyword.parent, isAwaitExpression);
|
|
163328
163502
|
if (!awaitExpression) {
|
|
@@ -163347,20 +163521,20 @@ function makeChange11(changeTracker, sourceFile, span) {
|
|
|
163347
163521
|
}
|
|
163348
163522
|
|
|
163349
163523
|
// src/services/codefixes/splitTypeOnlyImport.ts
|
|
163350
|
-
var
|
|
163351
|
-
var
|
|
163524
|
+
var errorCodes64 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
163525
|
+
var fixId51 = "splitTypeOnlyImport";
|
|
163352
163526
|
registerCodeFix({
|
|
163353
|
-
errorCodes:
|
|
163354
|
-
fixIds: [
|
|
163527
|
+
errorCodes: errorCodes64,
|
|
163528
|
+
fixIds: [fixId51],
|
|
163355
163529
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
163356
163530
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
163357
163531
|
return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
|
|
163358
163532
|
});
|
|
163359
163533
|
if (changes.length) {
|
|
163360
|
-
return [createCodeFixAction(
|
|
163534
|
+
return [createCodeFixAction(fixId51, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId51, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
163361
163535
|
}
|
|
163362
163536
|
},
|
|
163363
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163537
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes64, (changes, error2) => {
|
|
163364
163538
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
163365
163539
|
})
|
|
163366
163540
|
});
|
|
@@ -163409,22 +163583,22 @@ function splitTypeOnlyImport(changes, importDeclaration, context) {
|
|
|
163409
163583
|
}
|
|
163410
163584
|
|
|
163411
163585
|
// src/services/codefixes/convertConstToLet.ts
|
|
163412
|
-
var
|
|
163413
|
-
var
|
|
163586
|
+
var fixId52 = "fixConvertConstToLet";
|
|
163587
|
+
var errorCodes65 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
163414
163588
|
registerCodeFix({
|
|
163415
|
-
errorCodes:
|
|
163589
|
+
errorCodes: errorCodes65,
|
|
163416
163590
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
163417
163591
|
const { sourceFile, span, program } = context;
|
|
163418
163592
|
const info = getInfo21(sourceFile, span.start, program);
|
|
163419
163593
|
if (info === void 0) return;
|
|
163420
163594
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info.token));
|
|
163421
|
-
return [createCodeFixActionMaybeFixAll(
|
|
163595
|
+
return [createCodeFixActionMaybeFixAll(fixId52, changes, Diagnostics.Convert_const_to_let, fixId52, Diagnostics.Convert_all_const_to_let)];
|
|
163422
163596
|
},
|
|
163423
163597
|
getAllCodeActions: (context) => {
|
|
163424
163598
|
const { program } = context;
|
|
163425
163599
|
const seen = /* @__PURE__ */ new Map();
|
|
163426
163600
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
163427
|
-
eachDiagnostic(context,
|
|
163601
|
+
eachDiagnostic(context, errorCodes65, (diag2) => {
|
|
163428
163602
|
const info = getInfo21(diag2.file, diag2.start, program);
|
|
163429
163603
|
if (info) {
|
|
163430
163604
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
@@ -163435,7 +163609,7 @@ registerCodeFix({
|
|
|
163435
163609
|
});
|
|
163436
163610
|
}));
|
|
163437
163611
|
},
|
|
163438
|
-
fixIds: [
|
|
163612
|
+
fixIds: [fixId52]
|
|
163439
163613
|
});
|
|
163440
163614
|
function getInfo21(sourceFile, pos, program) {
|
|
163441
163615
|
var _a;
|
|
@@ -163453,26 +163627,26 @@ function doChange40(changes, sourceFile, token) {
|
|
|
163453
163627
|
}
|
|
163454
163628
|
|
|
163455
163629
|
// src/services/codefixes/fixExpectedComma.ts
|
|
163456
|
-
var
|
|
163630
|
+
var fixId53 = "fixExpectedComma";
|
|
163457
163631
|
var expectedErrorCode = Diagnostics._0_expected.code;
|
|
163458
|
-
var
|
|
163632
|
+
var errorCodes66 = [expectedErrorCode];
|
|
163459
163633
|
registerCodeFix({
|
|
163460
|
-
errorCodes:
|
|
163634
|
+
errorCodes: errorCodes66,
|
|
163461
163635
|
getCodeActions(context) {
|
|
163462
163636
|
const { sourceFile } = context;
|
|
163463
163637
|
const info = getInfo22(sourceFile, context.span.start, context.errorCode);
|
|
163464
163638
|
if (!info) return void 0;
|
|
163465
163639
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange41(t, sourceFile, info));
|
|
163466
163640
|
return [createCodeFixAction(
|
|
163467
|
-
|
|
163641
|
+
fixId53,
|
|
163468
163642
|
changes,
|
|
163469
163643
|
[Diagnostics.Change_0_to_1, ";", ","],
|
|
163470
|
-
|
|
163644
|
+
fixId53,
|
|
163471
163645
|
[Diagnostics.Change_0_to_1, ";", ","]
|
|
163472
163646
|
)];
|
|
163473
163647
|
},
|
|
163474
|
-
fixIds: [
|
|
163475
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163648
|
+
fixIds: [fixId53],
|
|
163649
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes66, (changes, diag2) => {
|
|
163476
163650
|
const info = getInfo22(diag2.file, diag2.start, diag2.code);
|
|
163477
163651
|
if (info) doChange41(changes, context.sourceFile, info);
|
|
163478
163652
|
})
|
|
@@ -163488,25 +163662,25 @@ function doChange41(changes, sourceFile, { node }) {
|
|
|
163488
163662
|
|
|
163489
163663
|
// src/services/codefixes/fixAddVoidToPromise.ts
|
|
163490
163664
|
var fixName7 = "addVoidToPromise";
|
|
163491
|
-
var
|
|
163492
|
-
var
|
|
163665
|
+
var fixId54 = "addVoidToPromise";
|
|
163666
|
+
var errorCodes67 = [
|
|
163493
163667
|
Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
163494
163668
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
163495
163669
|
];
|
|
163496
163670
|
registerCodeFix({
|
|
163497
|
-
errorCodes:
|
|
163498
|
-
fixIds: [
|
|
163671
|
+
errorCodes: errorCodes67,
|
|
163672
|
+
fixIds: [fixId54],
|
|
163499
163673
|
getCodeActions(context) {
|
|
163500
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
163674
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange13(t, context.sourceFile, context.span, context.program));
|
|
163501
163675
|
if (changes.length > 0) {
|
|
163502
|
-
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value,
|
|
163676
|
+
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId54, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
|
|
163503
163677
|
}
|
|
163504
163678
|
},
|
|
163505
163679
|
getAllCodeActions(context) {
|
|
163506
|
-
return codeFixAll(context,
|
|
163680
|
+
return codeFixAll(context, errorCodes67, (changes, diag2) => makeChange13(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
163507
163681
|
}
|
|
163508
163682
|
});
|
|
163509
|
-
function
|
|
163683
|
+
function makeChange13(changes, sourceFile, span, program, seen) {
|
|
163510
163684
|
const node = getTokenAtPosition(sourceFile, span.start);
|
|
163511
163685
|
if (!isIdentifier(node) || !isCallExpression(node.parent) || node.parent.expression !== node || node.parent.arguments.length !== 0) return;
|
|
163512
163686
|
const checker = program.getTypeChecker();
|
|
@@ -179581,10 +179755,10 @@ __export(ts_PasteEdits_exports, {
|
|
|
179581
179755
|
});
|
|
179582
179756
|
|
|
179583
179757
|
// src/services/pasteEdits.ts
|
|
179584
|
-
var
|
|
179758
|
+
var fixId55 = "providePostPasteEdits";
|
|
179585
179759
|
function pasteEditsProvider(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken) {
|
|
179586
179760
|
const changes = ts_textChanges_exports.ChangeTracker.with({ host, formatContext, preferences }, (changeTracker) => pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changeTracker));
|
|
179587
|
-
return { edits: changes, fixId:
|
|
179761
|
+
return { edits: changes, fixId: fixId55 };
|
|
179588
179762
|
}
|
|
179589
179763
|
function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changes) {
|
|
179590
179764
|
let actualPastedText;
|
|
@@ -180069,6 +180243,7 @@ __export(ts_exports2, {
|
|
|
180069
180243
|
createPackageJsonInfo: () => createPackageJsonInfo,
|
|
180070
180244
|
createParenthesizerRules: () => createParenthesizerRules,
|
|
180071
180245
|
createPatternMatcher: () => createPatternMatcher,
|
|
180246
|
+
createPrefixSuffixTrie: () => createPrefixSuffixTrie,
|
|
180072
180247
|
createPrinter: () => createPrinter,
|
|
180073
180248
|
createPrinterWithDefaults: () => createPrinterWithDefaults,
|
|
180074
180249
|
createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
|
|
@@ -192537,10 +192712,10 @@ ${e.message}`;
|
|
|
192537
192712
|
}
|
|
192538
192713
|
return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
|
|
192539
192714
|
}
|
|
192540
|
-
getCombinedCodeFix({ scope, fixId:
|
|
192715
|
+
getCombinedCodeFix({ scope, fixId: fixId56 }, simplifiedResult) {
|
|
192541
192716
|
Debug.assert(scope.type === "file");
|
|
192542
192717
|
const { file, project } = this.getFileAndProject(scope.args);
|
|
192543
|
-
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file },
|
|
192718
|
+
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId56, this.getFormatOptions(file), this.getPreferences(file));
|
|
192544
192719
|
if (simplifiedResult) {
|
|
192545
192720
|
return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
|
|
192546
192721
|
} else {
|
|
@@ -192579,11 +192754,11 @@ ${e.message}`;
|
|
|
192579
192754
|
mapCodeAction({ description: description3, changes, commands }) {
|
|
192580
192755
|
return { description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands };
|
|
192581
192756
|
}
|
|
192582
|
-
mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId:
|
|
192583
|
-
return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId:
|
|
192757
|
+
mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId: fixId56, fixAllDescription }) {
|
|
192758
|
+
return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId56, fixAllDescription };
|
|
192584
192759
|
}
|
|
192585
|
-
mapPasteEditsAction({ edits, fixId:
|
|
192586
|
-
return { edits: this.mapTextChangesToCodeEdits(edits), fixId:
|
|
192760
|
+
mapPasteEditsAction({ edits, fixId: fixId56 }) {
|
|
192761
|
+
return { edits: this.mapTextChangesToCodeEdits(edits), fixId: fixId56 };
|
|
192587
192762
|
}
|
|
192588
192763
|
mapTextChangesToCodeEdits(textChanges2) {
|
|
192589
192764
|
return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
|
|
@@ -194427,6 +194602,7 @@ if (typeof console !== "undefined") {
|
|
|
194427
194602
|
createPackageJsonInfo,
|
|
194428
194603
|
createParenthesizerRules,
|
|
194429
194604
|
createPatternMatcher,
|
|
194605
|
+
createPrefixSuffixTrie,
|
|
194430
194606
|
createPrinter,
|
|
194431
194607
|
createPrinterWithDefaults,
|
|
194432
194608
|
createPrinterWithRemoveComments,
|