2
2
namespace ts . codefix {
3
3
const fixId = "returnValueCorrect" ;
4
4
const fixIdAddReturnStatement = "fixAddReturnStatement" ;
5
- const fixIdRemoveBlockBodyBrace = "fixRemoveBlockBodyBrace " ;
5
+ const fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody " ;
6
6
const fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen" ;
7
7
const errorCodes = [
8
8
Diagnostics . A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value . code ,
@@ -35,7 +35,7 @@ namespace ts.codefix {
35
35
36
36
registerCodeFix ( {
37
37
errorCodes,
38
- fixIds : [ fixIdAddReturnStatement , fixIdRemoveBlockBodyBrace , fixIdWrapTheBlockWithParen ] ,
38
+ fixIds : [ fixIdAddReturnStatement , fixRemoveBracesFromArrowFunctionBody , fixIdWrapTheBlockWithParen ] ,
39
39
getCodeActions : context => {
40
40
const { program, sourceFile, span : { start } , errorCode } = context ;
41
41
const info = getInfo ( program . getTypeChecker ( ) , sourceFile , start , errorCode ) ;
@@ -44,7 +44,7 @@ namespace ts.codefix {
44
44
if ( info . kind === ProblemKind . MissingReturnStatement ) {
45
45
return append (
46
46
[ getActionForfixAddReturnStatement ( context , info . expression , info . statement ) ] ,
47
- isArrowFunction ( info . declaration ) ? getActionForfixRemoveBlockBodyBrace ( context , info . declaration , info . expression , info . commentSource ) : undefined ) ;
47
+ isArrowFunction ( info . declaration ) ? getActionForFixRemoveBracesFromArrowFunctionBody ( context , info . declaration , info . expression , info . commentSource ) : undefined ) ;
48
48
}
49
49
else {
50
50
return [ getActionForfixWrapTheBlockWithParen ( context , info . declaration , info . expression ) ] ;
@@ -58,7 +58,7 @@ namespace ts.codefix {
58
58
case fixIdAddReturnStatement :
59
59
addReturnStatement ( changes , diag . file , info . expression , info . statement ) ;
60
60
break ;
61
- case fixIdRemoveBlockBodyBrace :
61
+ case fixRemoveBracesFromArrowFunctionBody :
62
62
if ( ! isArrowFunction ( info . declaration ) ) return undefined ;
63
63
removeBlockBodyBrace ( changes , diag . file , info . declaration , info . expression , info . commentSource , /* withParen */ false ) ;
64
64
break ;
@@ -196,9 +196,9 @@ namespace ts.codefix {
196
196
return createCodeFixAction ( fixId , changes , Diagnostics . Add_a_return_statement , fixIdAddReturnStatement , Diagnostics . Add_all_missing_return_statement ) ;
197
197
}
198
198
199
- function getActionForfixRemoveBlockBodyBrace ( context : CodeFixContext , declaration : ArrowFunction , expression : Expression , commentSource : Node ) {
199
+ function getActionForFixRemoveBracesFromArrowFunctionBody ( context : CodeFixContext , declaration : ArrowFunction , expression : Expression , commentSource : Node ) {
200
200
const changes = textChanges . ChangeTracker . with ( context , t => removeBlockBodyBrace ( t , context . sourceFile , declaration , expression , commentSource , /* withParen */ false ) ) ;
201
- return createCodeFixAction ( fixId , changes , Diagnostics . Remove_block_body_braces , fixIdRemoveBlockBodyBrace , Diagnostics . Remove_all_incorrect_body_block_braces ) ;
201
+ return createCodeFixAction ( fixId , changes , Diagnostics . Remove_braces_from_arrow_function_body , fixRemoveBracesFromArrowFunctionBody , Diagnostics . Remove_braces_from_all_arrow_function_bodies_with_relevant_issues ) ;
202
202
}
203
203
204
204
function getActionForfixWrapTheBlockWithParen ( context : CodeFixContext , declaration : ArrowFunction , expression : Expression ) {
0 commit comments