mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Combine code-fix-all for missing class member and missing enum member
This commit is contained in:
@@ -4450,9 +4450,5 @@
|
||||
"Add missing enum member '{0}'": {
|
||||
"category": "Message",
|
||||
"code": 95063
|
||||
},
|
||||
"Add all missing enum members": {
|
||||
"category": "Message",
|
||||
"code": 95064
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ts.codefix {
|
||||
if (info.kind === InfoKind.enum) {
|
||||
const { token, enumDeclaration } = info;
|
||||
const changes = textChanges.ChangeTracker.with(context, t => addEnumMemberDeclaration(t, context.program.getTypeChecker(), token, enumDeclaration));
|
||||
return singleElementArray(createCodeFixAction(fixName, changes, [Diagnostics.Add_missing_enum_member_0, token.text], fixId, Diagnostics.Add_all_missing_enum_members));
|
||||
return [createCodeFixAction(fixName, changes, [Diagnostics.Add_missing_enum_member_0, token.text], fixId, Diagnostics.Add_all_missing_members)];
|
||||
}
|
||||
const { classDeclaration, classDeclarationSourceFile, inJs, makeStatic, token, call } = info;
|
||||
const methodCodeAction = call && getActionForMethodDeclaration(context, classDeclarationSourceFile, classDeclaration, token, call, makeStatic, inJs, context.preferences);
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
//// this.x = "";
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
////enum E {}
|
||||
////E.A;
|
||||
|
||||
verify.codeFixAll({
|
||||
fixId: "addMissingMember",
|
||||
@@ -22,5 +25,10 @@ verify.codeFixAll({
|
||||
y(): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
}
|
||||
|
||||
enum E {
|
||||
A
|
||||
}
|
||||
E.A;`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user