Chromium Code Reviews| 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..d9aedaaafc3099bf6b9a625469c14335f181e721 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 body = node.getAncestor((n) => n is ClassMember); |
|
scheglov
2016/02/26 22:17:20
body => member?
pquitslund
2016/02/26 22:21:13
Done.
|
| + if (body == null) { |
| + return; |
| + } |
| + exitPosition = new Position(file, body.offset - 1); |
| + String indent = utils.getIndent(1); |
| + _addReplaceEdit(rf.rangeStartLength(body, 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 { |