Skip to content

Commit 2e70675

Browse files
Add function names for code fixes. (#46728)
* Add function names for code fixes. * Remove double space. * Undo CRLF -> LF change.
1 parent 912c01a commit 2e70675

30 files changed

+34
-35
lines changed

src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace ts.codefix {
44
const errorCodes = [Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code];
55
registerCodeFix({
66
errorCodes,
7-
getCodeActions: (context) => {
7+
getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) {
88
const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start));
99
return [createCodeFixAction(fixId, changes, Diagnostics.Add_unknown_conversion_for_non_overlapping_types, fixId, Diagnostics.Add_unknown_to_all_conversions_of_non_overlapping_types)];
1010
},

src/services/codefixes/addEmptyExportDeclaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ts.codefix {
55
Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
66
Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
77
],
8-
getCodeActions: context => {
8+
getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) {
99
const { sourceFile } = context;
1010
const changes = textChanges.ChangeTracker.with(context, changes => {
1111
const exportDeclaration = factory.createExportDeclaration(

src/services/codefixes/addMissingAsync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace ts.codefix {
1111
registerCodeFix({
1212
fixIds: [fixId],
1313
errorCodes,
14-
getCodeActions: context => {
14+
getCodeActions: function getCodeActionsToAddMissingAsync(context) {
1515
const { sourceFile, errorCode, cancellationToken, program, span } = context;
1616
const diagnostic = find(program.getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode));
1717
const directSpan = diagnostic && diagnostic.relatedInformation && find(diagnostic.relatedInformation, r => r.code === Diagnostics.Did_you_mean_to_mark_this_function_as_async.code) as TextSpan | undefined;

src/services/codefixes/addMissingAwait.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace ts.codefix {
3030
registerCodeFix({
3131
fixIds: [fixId],
3232
errorCodes,
33-
getCodeActions: context => {
33+
getCodeActions: function getCodeActionsToAddMissingAwait(context) {
3434
const { sourceFile, errorCode, span, cancellationToken, program } = context;
3535
const expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program);
3636
if (!expression) {

src/services/codefixes/addMissingConst.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ts.codefix {
88

99
registerCodeFix({
1010
errorCodes,
11-
getCodeActions: (context) => {
11+
getCodeActions: function getCodeActionsToAddMissingConst(context) {
1212
const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start, context.program));
1313
if (changes.length > 0) {
1414
return [createCodeFixAction(fixId, changes, Diagnostics.Add_const_to_unresolved_variable, fixId, Diagnostics.Add_const_to_all_unresolved_variables)];

src/services/codefixes/addMissingDeclareProperty.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ts.codefix {
77

88
registerCodeFix({
99
errorCodes,
10-
getCodeActions: (context) => {
10+
getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) {
1111
const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start));
1212
if (changes.length > 0) {
1313
return [createCodeFixAction(fixId, changes, Diagnostics.Prefix_with_declare, fixId, Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)];

src/services/codefixes/addMissingInvocationForDecorator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace ts.codefix {
44
const errorCodes = [Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code];
55
registerCodeFix({
66
errorCodes,
7-
getCodeActions: (context) => {
7+
getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) {
88
const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start));
99
return [createCodeFixAction(fixId, changes, Diagnostics.Call_decorator_expression, fixId, Diagnostics.Add_to_all_uncalled_decorators)];
1010
},

src/services/codefixes/addNameToNamelessParameter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace ts.codefix {
44
const errorCodes = [Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
55
registerCodeFix({
66
errorCodes,
7-
getCodeActions: (context) => {
7+
getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) {
88
const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start));
99
return [createCodeFixAction(fixId, changes, Diagnostics.Add_parameter_name, fixId, Diagnostics.Add_names_to_all_parameters_without_names)];
1010
},

src/services/codefixes/convertConstToLet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ts.codefix {
55

66
registerCodeFix({
77
errorCodes,
8-
getCodeActions: context => {
8+
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
99
const { sourceFile, span, program } = context;
1010
const range = getConstTokenRange(sourceFile, span.start, program);
1111
if (range === undefined) return;

src/services/codefixes/convertLiteralTypeToMappedType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ts.codefix {
55

66
registerCodeFix({
77
errorCodes,
8-
getCodeActions: context => {
8+
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
99
const { sourceFile, span } = context;
1010
const info = getInfo(sourceFile, span.start);
1111
if (!info) {

0 commit comments

Comments
 (0)