@@ -97,9 +97,8 @@ namespace ts.codefix {
97
97
98
98
function getActionsForAddMissingMemberInJavaScriptFile ( context : CodeFixContext , classDeclarationSourceFile : SourceFile , classDeclaration : ClassLikeDeclaration , tokenName : string , makeStatic : boolean ) : CodeFixAction | undefined {
99
99
const changes = textChanges . ChangeTracker . with ( context , t => addMissingMemberInJs ( t , classDeclarationSourceFile , classDeclaration , tokenName , makeStatic ) ) ;
100
- if ( changes . length === 0 ) return undefined ;
101
- const description = formatStringFromArgs ( getLocaleSpecificMessage ( makeStatic ? Diagnostics . Initialize_static_property_0 : Diagnostics . Initialize_property_0_in_the_constructor ) , [ tokenName ] ) ;
102
- return { description, changes, fixId } ;
100
+ return changes . length === 0 ? undefined
101
+ : createCodeFixAction ( changes , [ makeStatic ? Diagnostics . Initialize_static_property_0 : Diagnostics . Initialize_property_0_in_the_constructor , tokenName ] , fixId , Diagnostics . Add_all_missing_members ) ;
103
102
}
104
103
105
104
function addMissingMemberInJs ( changeTracker : textChanges . ChangeTracker , classDeclarationSourceFile : SourceFile , classDeclaration : ClassLikeDeclaration , tokenName : string , makeStatic : boolean ) : void {
@@ -143,9 +142,8 @@ namespace ts.codefix {
143
142
}
144
143
145
144
function createAddPropertyDeclarationAction ( context : CodeFixContext , classDeclarationSourceFile : SourceFile , classDeclaration : ClassLikeDeclaration , makeStatic : boolean , tokenName : string , typeNode : TypeNode ) : CodeFixAction {
146
- const description = formatStringFromArgs ( getLocaleSpecificMessage ( makeStatic ? Diagnostics . Declare_static_property_0 : Diagnostics . Declare_property_0 ) , [ tokenName ] ) ;
147
145
const changes = textChanges . ChangeTracker . with ( context , t => addPropertyDeclaration ( t , classDeclarationSourceFile , classDeclaration , tokenName , typeNode , makeStatic ) ) ;
148
- return { description , changes , fixId } ;
146
+ return createCodeFixAction ( changes , [ makeStatic ? Diagnostics . Declare_static_property_0 : Diagnostics . Declare_property_0 , tokenName ] , fixId , Diagnostics . Add_all_missing_members ) ;
149
147
}
150
148
151
149
function addPropertyDeclaration ( changeTracker : textChanges . ChangeTracker , classDeclarationSourceFile : SourceFile , classDeclaration : ClassLikeDeclaration , tokenName : string , typeNode : TypeNode , makeStatic : boolean ) : void {
@@ -178,7 +176,7 @@ namespace ts.codefix {
178
176
179
177
const changes = textChanges . ChangeTracker . with ( context , t => t . insertNodeAtClassStart ( classDeclarationSourceFile , classDeclaration , indexSignature ) ) ;
180
178
// No fixId here because code-fix-all currently only works on adding individual named properties.
181
- return { description : formatStringFromArgs ( getLocaleSpecificMessage ( Diagnostics . Add_index_signature_for_property_0 ) , [ tokenName ] ) , changes , fixId : undefined } ;
179
+ return createCodeFixActionNoFixId ( changes , [ Diagnostics . Add_index_signature_for_property_0 , tokenName ] ) ;
182
180
}
183
181
184
182
function getActionForMethodDeclaration (
@@ -191,9 +189,8 @@ namespace ts.codefix {
191
189
inJs : boolean ,
192
190
preferences : UserPreferences ,
193
191
) : CodeFixAction | undefined {
194
- const description = formatStringFromArgs ( getLocaleSpecificMessage ( makeStatic ? Diagnostics . Declare_static_method_0 : Diagnostics . Declare_method_0 ) , [ token . text ] ) ;
195
192
const changes = textChanges . ChangeTracker . with ( context , t => addMethodDeclaration ( t , classDeclarationSourceFile , classDeclaration , token , callExpression , makeStatic , inJs , preferences ) ) ;
196
- return { description , changes , fixId } ;
193
+ return createCodeFixAction ( changes , [ makeStatic ? Diagnostics . Declare_static_method_0 : Diagnostics . Declare_method_0 , token . text ] , fixId , Diagnostics . Add_all_missing_members ) ;
197
194
}
198
195
199
196
function addMethodDeclaration (
0 commit comments