Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
index 01ddada39915dd611ead32c365ee63f8dd586749..78fb2c427ed67076278948f3d86ddb0c338a513a 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
@@ -343,6 +343,12 @@ class FixProcessor { |
_addFix_undefinedClassAccessor_useSimilar(); |
_addFix_createField(); |
} |
+ // lints |
+ if (errorCode is LintCode) { |
+ if (errorCode.name == LintNames.annotate_overrides) { |
+ _addLintFixAddOverrideAnnotation(); |
+ } |
+ } |
// done |
return fixes; |
} |
@@ -2202,6 +2208,17 @@ class FixProcessor { |
group.addPosition(position, range.length); |
} |
+ void _addLintFixAddOverrideAnnotation() { |
+ ClassMember member = node.getAncestor((n) => n is ClassMember); |
+ if (member == null) { |
+ return; |
+ } |
+ exitPosition = new Position(file, member.offset - 1); |
+ String indent = utils.getIndent(1); |
+ _addReplaceEdit(rf.rangeStartLength(member, 0), '@override$eol$indent'); |
+ _addFix(DartFixKind.LINT_ADD_OVERRIDE, []); |
+ } |
+ |
/** |
* Prepares proposal for creating function corresponding to the given |
* [FunctionType]. |
@@ -2884,6 +2901,13 @@ class FixProcessor { |
} |
/** |
+ * An enumeration of lint names. |
+ */ |
+class LintNames { |
+ static const String annotate_overrides = 'annotate_overrides'; |
+} |
+ |
+/** |
* Helper for finding [Element] with name closest to the given. |
*/ |
class _ClosestElementFinder { |